Changeset 15204
- Timestamp:
- 02/23/08 00:17:16 (8 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/MidCOM_2_8/midcom.helper.datamanager2/widget/chooser.php
r14720 r15204 204 204 /** 205 205 * These options are always visible 206 * 206 * 207 207 * @var array 208 208 */ … … 284 284 /** 285 285 * The group of widgets items as QuickForm elements 286 * 286 * 287 287 * @var array 288 288 */ 289 289 var $widget_elements = array(); 290 290 291 291 var $_static_items_html = ""; 292 292 var $_added_static_items = array(); 293 293 294 294 var $allow_multiple = true; 295 295 var $require_corresponding_option = true; … … 1094 1094 $dialog_id = $this->_element_id . '_creation_dialog'; 1095 1095 1096 $dialog_js = '<script type="text/javascript">';1097 $dialog_js .= "function close_dialog(){jQuery('#{$dialog_id}').hide();};";1098 $dialog_js .= "function add_item(data){jQuery('#{$this->_element_id}_search_input').midcom_helper_datamanager2_widget_chooser_add_result_item(data);};";1099 $dialog_js .= '</script>';1100 1101 1096 $dialog_html = '<div class="chooser_widget_creation_dialog" id="' . $dialog_id . '">'; 1102 1097 $dialog_html .= '<div class="chooser_widget_creation_dialog_content_holder">'; 1103 $dialog_html .= $dialog_js;1104 1098 $dialog_html .= '</div>'; 1105 1099 $dialog_html .= '</div>'; … … 1151 1145 // debug_pop(); 1152 1146 1153 // $this->_static_items_html = "<noscript>\n"; 1147 // $this->_static_items_html = "<noscript>\n"; 1154 1148 $this->_static_items_html .= "<table class=\"widget_chooser_static_items_table\">\n<thead><tr>\n"; 1155 1149 1156 1150 if ( !empty($this->reflector_key) 1157 1151 && !$this->result_headers) … … 1165 1159 { 1166 1160 $this->_static_items_html .= " <th class=\"{$header_item['name']}\">{$header_item['title']} </th>\n"; 1167 } 1168 } 1169 1161 } 1162 } 1163 1170 1164 $title = $_MIDCOM->i18n->get_string('Selected', 'midcom.helper.datamanager2'); 1171 1165 $this->_static_items_html .= " <th class=\"selected\">{$title} </th>\n"; 1172 1166 1173 1167 $this->_static_items_html .= "</tr></thead>\n<tbody>\n"; 1174 1168 1175 1169 $ee_script = ''; 1176 1170 if ($this->_renderer_callback) … … 1207 1201 } 1208 1202 } 1209 1203 1210 1204 $this->_jscript .= $ee_script; 1211 1205 … … 1226 1220 $this->_jscript 1227 1221 ); 1228 1222 1229 1223 $this->widget_elements[] =& HTML_QuickForm::createElement 1230 1224 ( … … 1237 1231 $group =& $this->_form->addGroup($this->widget_elements, $this->name, $this->_translate($this->_field['title']), '', array('class' => 'midcom_helper_datamanager2_widget_chooser')); 1238 1232 } 1239 1233 1240 1234 function _add_existing_item_as_static($key) 1241 1235 { … … 1243 1237 $id_field = $this->id_field; 1244 1238 $item_id = @$object->$id_field; 1245 1239 1246 1240 if ( empty($item_id) 1247 1241 || isset($this->_added_static_items[$item_id])) … … 1249 1243 return; 1250 1244 } 1251 1245 1252 1246 $this->_static_items_html .= "<tr id=\"{$this->_element_id}_existing_item_{$item_id}_row\" class=\"chooser_widget_existing_item_static_row\">\n"; 1253 1247 1254 1248 if ( !empty($this->reflector_key) 1255 1249 && !$this->result_headers) … … 1269 1263 // $value = rawurlencode(utf8_decode($value)); 1270 1264 // debug_add("adding header item: name={$item_name} value={$value}"); 1271 // 1265 // 1272 1266 $this->_static_items_html .= "<td class=\"{$item_name}\">{$value} </td>"; 1273 1267 } 1274 1268 } 1275 1269 1276 1270 $this->_static_items_html .= "<td>\n"; 1277 1271 $this->_static_items_html .= "<input type=\"checkbox\" name=\"{$this->_element_id}_selections[{$item_id}]\" id=\"{$this->_element_id}_existing_item_{$item_id}_value\" class=\"chooser_widget_existing_item_static_input\" checked=\"checked\"/>\n"; 1278 1272 $this->_static_items_html .= "</td>\n"; 1279 1273 1280 1274 $this->_static_items_html .= "</tr>\n"; 1281 1275 1282 1276 $this->_added_static_items[$item_id] = true; 1283 1277 } … … 1390 1384 return $this->_callback->resolve_object_name($key); 1391 1385 } 1392 1386 1393 1387 $results = $this->_callback->get_key_data($key); 1394 1388 … … 1452 1446 1453 1447 $_MIDCOM->auth->drop_sudo(); 1454 1448 1455 1449 // debug_pop(); 1456 1450 if ($return_object) branches/MidCOM_2_8/midgard.admin.asgard/style/midgard_admin_asgard_object_create_after.php
r13651 r15204 1 1 <script type="text/javascript"> 2 /* 3 * we need to determine the correct widget_id prefix here, loading from the parent 4 * frame breaks when multiple choosers with creation support exist 5 */ 6 var widget_id = window.parent.jQuery("iframe[src^=" + window.location.pathname + "]").attr("id"); 7 widget_id = widget_id.replace('chooser_widget_creation_dialog_content',''); 8 9 10 function close_dialog(){window.parent.jQuery('#' + widget_id + '_creation_dialog').hide();}; 11 function add_item(data){window.parent.jQuery('#' + widget_id + '_search_input').midcom_helper_datamanager2_widget_chooser_add_result_item(data);}; 2 12 <?php 3 13 if (! isset($data['cancelled'])) 4 14 { 5 echo "window.parent.add_item({$data['jsdata']});"; 15 16 echo "add_item({$data['jsdata']});"; 6 17 } 7 18 ?> 8 window.parent.close_dialog();19 close_dialog(); 9 20 </script>
