Author: michkinn
Date: 2010-04-14 16:35:26 +0200 (Wed, 14 Apr 2010)
New Revision: 29145
Modified:
plugins/sfDoctrineFBAutocompletePlugin/trunk/lib/widget/sfWidgetFormDoctrineFBAutocompleter.class.php
plugins/sfDoctrineFBAutocompletePlugin/trunk/web/css/style.css
Log:
Modified:
plugins/sfDoctrineFBAutocompletePlugin/trunk/lib/widget/sfWidgetFormDoctrineFBAutocompleter.class.php
===================================================================
---
plugins/sfDoctrineFBAutocompletePlugin/trunk/lib/widget/sfWidgetFormDoctrineFBAutocompleter.class.php
2010-04-14 14:22:03 UTC (rev 29144)
+++
plugins/sfDoctrineFBAutocompletePlugin/trunk/lib/widget/sfWidgetFormDoctrineFBAutocompleter.class.php
2010-04-14 14:35:26 UTC (rev 29145)
@@ -46,8 +46,31 @@
$this->addOption('onselect', false);
$this->addOption('onremove', false);
$this->addOption('delay ', false);
+ $this->addOption('template', <<<EOF
+ %associated%
+ <script type="text/javascript">
+
+ jQuery(document).ready(function() {
+ jQuery("#%id%").fcbkcomplete({
+ %json_url%
+ %cache%
+ %newel%
+ %firstselected%
+ %filter_case%
+ %filter_hide%
+ %filter_selected%
+ %complete_text%
+ %maxshownitems%
+ %maxitems%
+ %onselect%
+ %onremove%
+ %delay%
+ })
+ });
+ </script>
+EOF
+);
-
parent::configure($options, $attributes);
}
@@ -63,22 +86,20 @@
*/
public function render($name, $value = null, $attributes = array(), $errors
= array())
{
- if (is_null($value)){$value = array();}
- $choices = $this->getOption('choices');
+ if (is_null($value)){$value = array();}
+
+ $choices = $this->getChoices();
+
+ $associated = array();
+
+ foreach ($choices as $key => $option)
+ {
+ if (in_array(strval($key), $value))
+ {
+ $associated[$key] = $option;
+ }
+ }
- if ($choices instanceof sfCallable)
- {
- $choices = $choices->call();
- }
- $associated = array();
- foreach ($choices as $key => $option)
- {
- if (in_array(strval($key), $value))
- {
- $associated[$key] = $option;
- }
- }
-
$url = str_replace('%model%',$this->getOption('model') ,
$this->getOption('json_url'));
$json_url = 'json_url : "' . $url .'",';
$cache = $this->getOption('cache') ? 'cache : true,' : '' ;
@@ -94,45 +115,28 @@
$onremove = $this->getOption('onremove') ? 'onremove :
"'.$this->getOption('onremove').'",' : '' ;
$delay = $this->getOption('delay') ? 'delay :
"'.$this->getOption('delay').'",' : '' ;
- return $this->renderTag('input', array('type' => 'text', 'name' => $name,
'value' => $value)).
- sprintf(<<<EOF
-<script type="text/javascript">
- jQuery(document).ready(function() {
- jQuery("#%s").fcbkcomplete({
- %s
- %s
- %s
- %s
- %s
- %s
- %s
- %s
- %s
- %s
- %s
- %s
- %s
-
- })
- });
-</script>
-EOF
- ,
- $this->generateId($name),
- $json_url,
- $cache,
- $newel,
- $firstselected,
- $filter_case ,
- $filter_hide ,
- $filter_selected ,
- $complete_text ,
- $maxshownitems ,
- $maxitems ,
- $onselect ,
- $onremove ,
- $delay
- );
+
+ $associatedWidget = new sfWidgetFormSelect(array('multiple' => false,
'choices' => $associated));
+
+ return strtr($this->getOption('template'), array(
+ '%id%' => $this->generateId($name),
+ '%json_url%' => $json_url,
+ '%cache%' => $cache,
+ '%newel%' => $newel,
+ '%firstselected%' => $firstselected,
+ '%filter_case%' => $filter_case,
+ '%filter_hide%' => $filter_hide,
+ '%filter_selected%' => $filter_selected,
+ '%complete_text%' => $complete_text,
+ '%maxshownitems%' => $maxshownitems,
+ '%maxitems%' => $maxitems,
+ '%onselect%' => $onselect,
+ '%onremove%' => $onremove,
+ '%delay%' => $delay,
+ '%associated%' => $associatedWidget->render($name)
+ ));
+
+
}
/**
Modified: plugins/sfDoctrineFBAutocompletePlugin/trunk/web/css/style.css
===================================================================
--- plugins/sfDoctrineFBAutocompletePlugin/trunk/web/css/style.css
2010-04-14 14:22:03 UTC (rev 29144)
+++ plugins/sfDoctrineFBAutocompletePlugin/trunk/web/css/style.css
2010-04-14 14:35:26 UTC (rev 29145)
@@ -22,8 +22,8 @@
#apple-list ul.holder li.bit-input input.smallinput { width: 5px; }
ul.holder li.bit-hover { background: #BBCEF1; border: 1px solid #6D95E0; }
ul.holder li.bit-box-focus { border-color: #598BEC; background: #598BEC;
color: #fff; }
-ul.holder li.bit-box a.closebutton { position: absolute; right: 4px; top: 5px;
display: block; width: 7px; height: 7px; font-size: 1px; background:
url('../images/close.gif'); }
-ul.holder li.bit-box a.closebutton:hover { background-position: 7px; }
+ul.holder li.bit-box a.closebutton ,#sf_admin_container ul.holder li.bit-box
a.closebutton{ position: absolute; right: 4px; top: 5px; display: block; width:
7px; height: 7px; font-size: 1px; background: url('../images/close.gif');
padding :0; }
+ul.holder li.bit-box a.closebutton:hover,#sf_admin_container ul.holder
li.bit-box a.closebutton:hover { background-position: 7px; }
ul.holder li.bit-box-focus a.closebutton, ul.holder li.bit-box-focus
a.closebutton:hover { background-position: bottom; }
/* Autocompleter */
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.