Changeset 12372
- Timestamp:
- 09/19/07 00:44:21 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/midcom/midcom.helper.datamanager/widget_contactchooser.php
r3972 r12372 2 2 /** 3 3 * @package midcom.helper.datamanager 4 * @author The Midgard Project, http://www.midgard-project.org 4 * @author The Midgard Project, http://www.midgard-project.org 5 5 * @version $Id$ 6 6 * @copyright The Midgard Project, http://www.midgard-project.org … … 16 16 17 17 class midcom_helper_datamanager_widget_contactchooser extends midcom_helper_datamanager_widget { 18 18 19 19 /** 20 * URL to the OpenPSA Contacts installation's FOAF search interface. 20 * URL to the OpenPSA Contacts installation's FOAF search interface. 21 21 * For example https://openpsa.example.net/contacts/search/foaf/ 22 * 22 * 23 23 * @var string 24 24 */ 25 25 var $contacts_url; 26 26 27 27 /** 28 28 * Whether this is a multiple select or not … … 30 30 */ 31 31 var $_multiple = false; 32 32 33 33 /** 34 34 * Whether to look up DBE parameters of persons … … 39 39 function _constructor (&$datamanager, $field, $defaultvalue) { 40 40 parent::_constructor ($datamanager, $field, $defaultvalue); 41 41 42 42 if (!array_key_exists('widget_contactchooser_contacts_url', $this->_field)) 43 43 { … … 46 46 $this->_field['widget_contactchooser_contacts_url'] = $this->_find_contacts_url(); 47 47 } 48 48 49 49 if (array_key_exists('datatype', $this->_field)) 50 50 { … … 54 54 } 55 55 } 56 56 57 57 $this->contacts_url = $this->_field['widget_contactchooser_contacts_url']; 58 58 59 59 // This component uses Ajax, include the handler javascripts 60 $_MIDCOM->add_jsfile(MIDCOM_STATIC_URL."/org.openpsa.helpers/messages.js"); 60 $_MIDCOM->add_jsfile(MIDCOM_STATIC_URL."/org.openpsa.helpers/messages.js"); 61 61 $_MIDCOM->add_jsfile(MIDCOM_STATIC_URL."/org.openpsa.helpers/ajaxutils.js"); 62 62 $_MIDCOM->add_jsfile(MIDCOM_STATIC_URL."/midcom.helper.datamanager/contactchooser_ajax.js"); … … 75 75 } 76 76 77 function _read_formdata () 77 function _read_formdata () 78 78 { 79 79 debug_push_class(__CLASS__, __FUNCTION__); … … 89 89 90 90 // Read form data only if we have submitted 91 if (array_key_exists("midcom_helper_datamanager_submit", $_POST)) 91 if (array_key_exists("midcom_helper_datamanager_submit", $_POST)) 92 92 { 93 93 //Reset multiple selection array (since we only get information about checked boxes) … … 129 129 else 130 130 { 131 echo "<li>{$person->lastname}, {$person->firstname}</li>\n"; 132 } 133 } 134 135 function draw_view() 131 echo "<li>{$person->lastname}, {$person->firstname}</li>\n"; 132 } 133 } 134 135 function draw_view() 136 136 { 137 137 if (!$this->_value) { … … 142 142 //Do we have IDs or GUIDs as values. 143 143 $idtype = $this->_datatype2identifier(); 144 144 145 145 if ($this->_multiple) 146 146 { … … 163 163 echo "</div>\n"; 164 164 } 165 165 166 166 function draw_widget () { 167 167 echo '<script type="text/javascript" language="text/javascript" src="'.MIDCOM_STATIC_URL . '/org.openpsa.helpers/ajaxutils.js"></script>'; … … 171 171 echo '<div class="widget_contactchooser">'; 172 172 // This should be hidden unless there are selected results, then made visible using JS 173 echo "<ul class=\"widget_contactchooser_selected hidden\" id=\"widget_contactchooser_selected_{$this->_fieldname}\">\n"; 173 echo "<ul class=\"widget_contactchooser_selected hidden\" id=\"widget_contactchooser_selected_{$this->_fieldname}\">\n"; 174 174 if ($this->_value) 175 175 { … … 202 202 { 203 203 $person = new midcom_baseclasses_database_person($this->_value); 204 /* 204 /* 205 205 echo "<li><input type='checkbox' checked='checked' name='{$this->_fieldname}[{$this->_value}]' id='widget_contactchooser_{$this->_fieldname}' />"; 206 206 echo "<label for=\"widget_contactchooser_{$this->_fieldname}\">{$person->rname}</label></li>\n"; … … 216 216 //Check datatype, set return mode 217 217 $modeString = $this->_datatype2identifier(); 218 218 219 219 //Check multiple, set action mode 220 220 if ($this->_multiple) … … 226 226 $modeString .= ', single'; 227 227 } 228 228 229 229 echo "<input type='hidden' id='{$this->_fieldname}_ajaxWidgetMode' value='{$modeString}' />\n"; 230 230 echo "<input type='hidden' id='{$this->_fieldname}_ajaxUrl' value='{$this->contacts_url}' />\n"; … … 232 232 // TODO: Support Safari <input type="search" /> 233 233 // http://weblogs.mozillazine.org/hyatt/archives/2004_07.html#005890 234 echo "<input type='text' autocomplete='off' class='ajax_editable' id='{$this->_fieldname}' on Focus='ooAjaxFocus(this);' onBlur='ooAjaxBlur_noSave(this);' onKeyUp='ooAjaxChange(this);' />\n";235 234 echo "<input type='text' autocomplete='off' class='ajax_editable' id='{$this->_fieldname}' onfocus='ooAjaxFocus(this);' onblur='ooAjaxBlur_noSave(this);' onkeyup='ooAjaxChange(this);' />\n"; 235 236 236 // Here we place the search results, hidden by default 237 237 echo "<ul class=\"widget_contactchooser_resultset\" style=\"display: none;\" id=\"widget_contactchooser_resultset_{$this->_fieldname}\"></ul>\n"; 238 238 echo '</div>'; 239 240 } 241 239 240 } 241 242 242 function _datatype2identifier() 243 243 { … … 253 253 return 'guid'; 254 254 break; 255 } 256 } 257 255 } 256 } 257 258 258 } 259 259 trunk/midcom/org.openpsa.contacts/style/show-group-persons-item.php
r5048 r12372 15 15 <input id=\"editable_title_{$data['person']->guid}_ajaxDefault\" value=\"".$data['l10n']->get('<title>')."\" type=\"hidden\" /> 16 16 <input id=\"editable_title_{$data['person']->guid}_ajaxUrl\" value=\"{$node[MIDCOM_NAV_FULLURL]}group/{$data['group']->guid}/update_member_title/\" type=\"hidden\" /> 17 <input id=\"editable_title_{$data['person']->guid}\" name=\"member_title[{$data['member']->id}]\" class=\"ajax_editable\" style=\"width: 80%;\" on Focus=\"ooAjaxFocus(this)\" onBlur=\"ooAjaxBlur(this)\" value=\"{$data['member_title']}\" />17 <input id=\"editable_title_{$data['person']->guid}\" name=\"member_title[{$data['member']->id}]\" class=\"ajax_editable\" style=\"width: 80%;\" onfocus=\"ooAjaxFocus(this)\" onblur=\"ooAjaxBlur(this)\" value=\"{$data['member_title']}\" /> 18 18 </li>\n"; 19 19 } trunk/midcom/org.openpsa.contacts/style/show-person-groups-item.php
r5048 r12372 10 10 $view_title_form = "<input id=\"editable_title_{$group_guid}_ajaxDefault\" value=\"".$data['l10n']->get('<title>')."\" type=\"hidden\" />\n"; 11 11 $view_title_form .= "<input id=\"editable_title_{$group_guid}_ajaxUrl\" value=\"{$node[MIDCOM_NAV_FULLURL]}group/{$group_guid}/update_member_title/\" type=\"hidden\" />\n"; 12 $view_title_form .= "<input id=\"editable_title_{$group_guid}\" name=\"member_title[{$data['member']->id}]\" class=\"ajax_editable\" style=\"width: 80%;\" on Focus=\"ooAjaxFocus(this)\" onBlur=\"ooAjaxBlur(this)\" value=\"{$data['member_title']}\" />\n";12 $view_title_form .= "<input id=\"editable_title_{$group_guid}\" name=\"member_title[{$data['member']->id}]\" class=\"ajax_editable\" style=\"width: 80%;\" onfocus=\"ooAjaxFocus(this)\" onblur=\"ooAjaxBlur(this)\" value=\"{$data['member_title']}\" />\n"; 13 13 } 14 14 else
