Index: branches/5.3.x/core/admin_templates/incs/config_blocks.tpl =================================================================== --- branches/5.3.x/core/admin_templates/incs/config_blocks.tpl +++ branches/5.3.x/core/admin_templates/incs/config_blocks.tpl @@ -36,6 +36,46 @@ <input type="hidden" id="<inp2:InputName field='$field'/>" name="<inp2:InputName field='$field'/>" value="<inp2:Field field='$field'/>"/> </inp2:m_DefineElement> +<inp2:m_DefineElement name="config_edit_option_picker"> + <option value="<inp2:m_param name='key'/>"><inp2:m_param name="option"/></option> +</inp2:m_DefineElement> + +<inp2:m_DefineElement name="config_edit_picker"> + <table style="width: 300px"> + <tr> + <td> + <strong> + <inp2:m_phrase label="la_SelectedItems"/> + </strong> + </td> + <td> </td> + <td> + <strong> + <inp2:m_phrase label="la_AvailableItems"/> + </strong> + </td> + </tr> + <tr> + <td> + <select id="<inp2:InputName field='$field'/>_selected" tabindex="<inp2:m_get param='tab_index'/>" multiple="multiple" size="15" style="width: 200px"> + <inp2:PredefinedOptions field="$field" block="config_edit_option_picker" selected="selected" selected_only="1"/> + </select> + <input type="hidden" id="<inp2:InputName field='$field'/>" name="<inp2:InputName field='$field'/>" value="<inp2:Field field='$field'/>"/> + </td> + <td align="center"> + <input type="button" value=" «« " onclick="move_selected('<inp2:InputName field='$field'/>_available', '<inp2:InputName field='$field'/>_selected'); select_sort('<inp2:InputName field='$field'/>_selected'); set_hidden_field('<inp2:InputName field='$field'/>', select_to_string('<inp2:InputName field='$field'/>_selected'));" class="button"><br> + <img src="img/s.gif" width="1" height="4" alt=""><br> + <input type="button" value=" »» " onclick="move_selected('<inp2:InputName field='$field'/>_selected', '<inp2:InputName field='$field'/>_available'); select_sort('<inp2:InputName field='$field'/>_available'); set_hidden_field('<inp2:InputName field='$field'/>', select_to_string('<inp2:InputName field='$field'/>_selected'));" class="button"> + </td> + <td> + <select id="<inp2:InputName field='$field'/>_available" tabindex="<inp2:m_get param='tab_index'/>" multiple="multiple" size="15" style="width: 200px"> + <inp2:PredefinedOptions field="$field" block="config_edit_option_picker" selected="selected" unselected_only="1"/> + </select> + </td> + </tr> + </table> +</inp2:m_DefineElement> + <inp2:m_DefineElement name="config_edit_checkbox" field_class=""> <input type="hidden" id="<inp2:InputName field='$field'/>" name="<inp2:InputName field='$field'/>" value="<inp2:Field field='$field' db='db'/>"> <input tabindex="<inp2:m_get param='tab_index'/>" type="checkbox" id="_cb_<inp2:InputName field='$field'/>" name="_cb_<inp2:InputName field='$field'/>" <inp2:Field field="$field" checked="checked" db="db"/> class="<inp2:m_param name="field_class"/>" onclick="update_checkbox(this, document.getElementById('<inp2:InputName field="$field"/>'))"> Index: branches/5.3.x/core/install/english.lang =================================================================== --- branches/5.3.x/core/install/english.lang +++ branches/5.3.x/core/install/english.lang @@ -1722,6 +1722,7 @@ <PHRASE Label="la_type_label" Module="Core" Type="1">TGFiZWw=</PHRASE> <PHRASE Label="la_type_multiselect" Module="Core" Type="1">TXVsdGlwbGUgU2VsZWN0</PHRASE> <PHRASE Label="la_type_password" Module="Core" Type="1">UGFzc3dvcmQgZmllbGQ=</PHRASE> + <PHRASE Label="la_type_picker" Module="Core" Type="1">UGlja2Vy</PHRASE> <PHRASE Label="la_type_radio" Module="Core" Type="1">UmFkaW8gYnV0dG9ucw==</PHRASE> <PHRASE Label="la_type_RangeSlider" Module="Core" Type="1">UmFuZ2UgU2xpZGVy</PHRASE> <PHRASE Label="la_type_select" Module="Core" Type="1">RHJvcCBkb3duIGZpZWxk</PHRASE> Index: branches/5.3.x/core/kernel/db/db_tag_processor.php =================================================================== --- branches/5.3.x/core/kernel/db/db_tag_processor.php +++ branches/5.3.x/core/kernel/db/db_tag_processor.php @@ -1207,6 +1207,9 @@ if ( isset($params['selected_only']) && $params['selected_only'] ) { $options = $this->getSelectedOptions($options, $selected_option_keys); } + elseif ( isset($params['unselected_only']) && $params['unselected_only'] ) { + $options = $this->getUnselectedOptions($options, $selected_option_keys); + } $column_changed = false; $option_number = $column_number = 1; @@ -1279,6 +1282,27 @@ } /** + * Returns only options, that have not been selected. + * + * @param array $options All options. + * @param array $selected_option_keys Selected options. + * + * @return array + */ + protected function getUnselectedOptions(array $options, array $selected_option_keys) + { + $ret = array(); + + foreach ( $options as $option_key => $option_title ) { + if ( !$this->isOptionSelected($option_key, $selected_option_keys) ) { + $ret[$option_key] = $option_title; + } + } + + return $ret; + } + + /** * Determines if given option is among selected ones. * * @param mixed $option_key Option key. @@ -2157,6 +2181,7 @@ case 'select': case 'multiselect': case 'radio': + case 'picker': if ($object->GetDBField('DirectOptions')) { // used for custom fields $options = $object->GetDBField('DirectOptions'); Index: branches/5.3.x/core/units/configuration/configuration_config.php =================================================================== --- branches/5.3.x/core/units/configuration/configuration_config.php +++ branches/5.3.x/core/units/configuration/configuration_config.php @@ -101,7 +101,7 @@ ), 'ElementType' => Array ( 'type' => 'string', - 'formatter' => 'kOptionsFormatter', 'options' => Array ('text' => 'la_type_text', 'select' => 'la_type_select', 'multiselect' => 'la_type_multiselect', 'radio' => 'la_type_radio', 'checkbox' => 'la_type_checkbox', 'password' => 'la_type_password', 'textarea' => 'la_type_textarea'), 'use_phrases' => 1, + 'formatter' => 'kOptionsFormatter', 'options' => Array ('text' => 'la_type_text', 'select' => 'la_type_select', 'multiselect' => 'la_type_multiselect', 'radio' => 'la_type_radio', 'checkbox' => 'la_type_checkbox', 'password' => 'la_type_password', 'textarea' => 'la_type_textarea', 'picker' => 'la_type_picker'), 'use_phrases' => 1, 'not_null' => 1, 'required' => 1, 'default' => '' ), 'Validation' => Array ('type' => 'string', 'default' => NULL), @@ -123,4 +123,4 @@ 'VirtualFields' => Array ( 'DirectOptions' => Array ('type' => 'string', 'default' => ''), ), -); \ No newline at end of file +);