Changeset 12723
- Timestamp:
- 10/09/07 22:28:27 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/midcom/midcom.helper.datamanager2/exec/chooser_handler.php
r11584 r12723 65 65 } 66 66 67 if (! empty($reflector_key))67 if (! empty($reflector_key)) 68 68 { 69 69 $_MIDCOM->componentloader->load_graceful('midgard.admin.asgard'); … … 72 72 debug_pop(); 73 73 debug_push_class('midcom_helper_datamanager2_widget_chooser_handler', 'search'); 74 75 // Handle automatic wildcards 76 if ( !empty($auto_wildcards) 77 && strpos($query, '%') === false) 78 { 79 switch($auto_wildcards) 80 { 81 case 'both': 82 $query = "%{$query}%"; 83 break; 84 case 'start': 85 $query = "%{$query}"; 86 break; 87 case 'end': 88 $query = "{$query}%"; 89 break; 90 default: 91 debug_add("Don't know how to handle auto_wildcards value '{$auto_wildcards}'", MIDCOM_LOG_WARN); 92 break; 93 } 94 } 74 95 75 96 if (!empty($_callback_class)) … … 127 148 $_MIDCOM->finish(); 128 149 exit(); 129 }130 131 // Handle automatic wildcards132 if ( !empty($auto_wildcards)133 && strpos($query, '%') === false)134 {135 switch($auto_wildcards)136 {137 case 'both':138 $query = "%{$query}%";139 break;140 case 'start':141 $query = "%{$query}";142 break;143 case 'end':144 $query = "{$query}%";145 break;146 default:147 debug_add("Don't know how to handle auto_wildcards value '{$auto_wildcards}'", MIDCOM_LOG_WARN);148 break;149 }150 150 } 151 151 trunk/midcom/midcom.helper.datamanager2/static/chooser/jquery.chooser_widget.js
r12130 r12723 603 603 function inactivate(id) 604 604 { 605 jQuery('#'+options.widget_id + '_result_item_'+id+'_input', list).attr({ value: id});605 jQuery('#'+options.widget_id + '_result_item_'+id+'_input', list).attr({ value: 0 }); 606 606 jQuery('#'+options.widget_id + '_result_item_'+id).removeClass(CLASSES.DELETED); 607 607 jQuery('#'+options.widget_id + '_result_item_'+id).removeClass(CLASSES.ACTIVE); … … 609 609 jQuery('#'+options.widget_id + '_result_item_'+id).attr("keep_on_list","false"); 610 610 jQuery('#'+options.widget_id + '_result_item_'+id).attr("deleted","false"); 611 selected_items.push(id); 611 //selected_items.push(id); 612 selected_items = jQuery.grep( selected_items, function(n,i){ 613 return n != id; 614 }); 612 615 } 613 616 trunk/midcom/midcom.helper.datamanager2/widget/chooser.php
r12711 r12723 212 212 213 213 /** 214 * The argument to pass to the option callback constructor.214 * The arguments to pass to the option callback constructor. 215 215 * 216 216 * @var mixed … … 293 293 MIDCOM_LOG_WARN); 294 294 debug_pop(); 295 } 296 return false; 295 296 return false; 297 } 297 298 } 298 299 … … 316 317 } 317 318 318 if (empty($this->class)) 319 { 320 debug_push_class(__CLASS__, __FUNCTION__); 321 debug_add("Warning, the field {$this->name} does not have class defined.", 322 MIDCOM_LOG_WARN); 323 debug_pop(); 324 return false; 325 } 326 327 if (empty($this->component)) 328 { 329 debug_push_class(__CLASS__, __FUNCTION__); 330 debug_add("Warning, the field {$this->name} does not have component the class {$this->class} belongs to defined.", 331 MIDCOM_LOG_WARN); 332 debug_pop(); 333 return false; 334 } 335 336 if (empty($this->searchfields)) 319 // if (empty($this->class)) 320 // { 321 // debug_push_class(__CLASS__, __FUNCTION__); 322 // debug_add("Warning, the field {$this->name} does not have class defined.", 323 // MIDCOM_LOG_WARN); 324 // debug_pop(); 325 // return false; 326 // } 327 328 // if (empty($this->component)) 329 // { 330 // debug_push_class(__CLASS__, __FUNCTION__); 331 // debug_add("Warning, the field {$this->name} does not have component the class {$this->class} belongs to defined.", 332 // MIDCOM_LOG_WARN); 333 // debug_pop(); 334 // return false; 335 // } 336 337 if ( empty($this->searchfields) 338 && !isset($this->_callback_class)) 337 339 { 338 340 debug_push_class(__CLASS__, __FUNCTION__); … … 353 355 ); 354 356 355 $_MIDCOM->add_jsfile(MIDCOM_STATIC_URL . '/midcom.helper.datamanager2/chooser/jquery.chooser_widget. pack.js');357 $_MIDCOM->add_jsfile(MIDCOM_STATIC_URL . '/midcom.helper.datamanager2/chooser/jquery.chooser_widget.js'); 356 358 357 359 $this->_element_id = "{$this->_namespace}{$this->name}_chooser_widget"; … … 458 460 function _check_callback() 459 461 { 460 //debug_push_class(__CLASS__, __FUNCTION__);461 //debug_add("Checking callback class {$this->_callback_class}");462 debug_push_class(__CLASS__, __FUNCTION__); 463 debug_add("Checking callback class {$this->_callback_class}"); 462 464 463 465 if (! class_exists($this->_callback_class)) … … 484 486 $this->_callback = new $this->_callback_class($this->_callback_args); 485 487 486 // debug_pop(); 487 return $this->_callback->initialize(); 488 debug_pop(); 489 490 if (is_callable(array($this->_callback, 'initialize'))) 491 { 492 return $this->_callback->initialize(); 493 } 494 495 return $this->_callback; 488 496 } 489 497 … … 948 956 function add_elements_to_form() 949 957 { 950 // debug_push_class(__CLASS__, __FUNCTION__);958 //debug_push_class(__CLASS__, __FUNCTION__); 951 959 952 960 // Get url to search handler … … 1046 1054 $existing_elements = $this->_type->selection; 1047 1055 1048 // debug_print_r('existing_elements',$existing_elements);1056 //debug_print_r('existing_elements',$existing_elements); 1049 1057 1050 1058 // debug_print_r('static_options',$this->static_options); … … 1052 1060 $elements = array_merge($this->static_options, $existing_elements); 1053 1061 // debug_print_r('all elements to be added',$elements); 1054 1062 // debug_pop(); 1063 1055 1064 $ee_script = ''; 1056 1065 if ($this->_renderer_callback) … … 1130 1139 function _object_to_jsdata(&$object) 1131 1140 { 1132 //debug_push_class(__CLASS__, __FUNCTION__);1133 //debug_add("converting object with id {$object->id} to jsdata");1141 debug_push_class(__CLASS__, __FUNCTION__); 1142 debug_add("converting object with id {$object->id} to jsdata"); 1134 1143 1135 1144 $id = @$object->id; … … 1147 1156 $value = @$object->get_label(); 1148 1157 $value = rawurlencode($value); 1149 // debug_add("adding header item: name=label value={$value}");1158 //debug_add("adding header item: name=label value={$value}"); 1150 1159 $jsdata .= "label: '{$value}'"; 1151 1160 } … … 1159 1168 $value = @$object->$item_name; 1160 1169 $value = rawurlencode($value); 1161 //debug_add("adding header item: name={$item_name} value={$value}");1170 debug_add("adding header item: name={$item_name} value={$value}"); 1162 1171 $jsdata .= "{$item_name}: '{$value}'"; 1163 1172 … … 1173 1182 $jsdata .= "}"; 1174 1183 1175 return $jsdata;1176 1177 // debug_pop();1184 debug_pop(); 1185 1186 return $jsdata; 1178 1187 } 1179 1188 1180 1189 function _get_key_data($key, $in_render_mode=false) 1181 1190 { 1182 //debug_push_class(__CLASS__, __FUNCTION__);1183 //debug_add("get_key_data for key: {$key}");1191 debug_push_class(__CLASS__, __FUNCTION__); 1192 debug_add("get_key_data for key: {$key}"); 1184 1193 1185 1194 if ($this->_callback) … … 1190 1199 { 1191 1200 // debug_pop(); 1192 return $ _callback->resolve_object_name($key);1193 } 1194 1195 $results = $ _callback->get_key_data($key);1201 return $this->_callback->resolve_object_name($key); 1202 } 1203 1204 $results = $this->_callback->get_key_data($key); 1196 1205 1197 1206 if (! $results) … … 1200 1209 } 1201 1210 1202 //debug_pop();1211 debug_pop(); 1203 1212 1204 1213 if ($this->_renderer_callback)
