Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F727110
D162.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Jan 6, 6:55 AM
Size
6 KB
Mime Type
text/x-diff
Expires
Tue, Jan 7, 6:55 AM (3 d, 29 m ago)
Engine
blob
Format
Raw Data
Handle
537172
Attached To
D162: INP-1511 - Add "export presets" support for category items export dialogs
D162.id.diff
View Options
Index: branches/5.3.x/core/admin_templates/incs/form_blocks.tpl
===================================================================
--- branches/5.3.x/core/admin_templates/incs/form_blocks.tpl
+++ branches/5.3.x/core/admin_templates/incs/form_blocks.tpl
@@ -1277,3 +1277,125 @@
<span id="error_msg_<inp2:m_Param name='prefix'/>" style="font-weight: bold;"><br/></span>
</inp2:m_RenderElement>
</inp2:m_DefineElement>
+
+<inp2:m_DefineElement name="inp_edit_export_presets">
+ <inp2:m_RenderElement design="form_row" prefix="$prefix" field="ExportPresets" title="la_fld_ExportPresets">
+ <td class="control-cell">
+ <select tabindex="<inp2:m_get param="tab_index"/>" name="<inp2:$prefix_InputName field="ExportPresets"/>" id="<inp2:$prefix_InputName field="ExportPresets"/>" onchange="update_fields(this.value)">
+ <inp2:$prefix_PredefinedOptions field="ExportPresets" block="inp_option_item" selected="selected"/>
+ </select>
+
+ <input class="button" type="button" value="<inp2:m_Phrase label="la_Text_Delete"/>" onclick="delete_preset()">
+
+ <script type="text/javascript" src="incs/ajax.js"></script>
+ <script type="text/javascript">
+ var delete_busy = false;
+
+ function delete_preset()
+ {
+ if (!confirm('<inp2:m_Phrase label="la_ConfirmDeleteExportPreset" js_escape="1"/>')) return;
+ var $kf = document.getElementById('kernel_form');
+ tmp = $kf.elements['events[<inp2:m_param name="prefix"/>]'].value;
+ $kf.elements['events[<inp2:m_param name="prefix"/>]'].value = 'OnDeleteExportPreset';
+ Request.method = 'POST';
+ Request.params = Request.serializeForm($kf);
+ $kf.elements['events[<inp2:m_param name="prefix"/>]'].value = tmp;
+ Request.makeRequest('<inp2:m_t ajax="1" {$prefix}_event="OnDeleteExportPreset" no_amp="1" js_escape="1"/>', delete_busy, '', function() {
+ presets = document.getElementById('<inp2:$prefix_InputName field="ExportPresets"/>');
+
+ for (i=0; i< presets.options.length; i++) {
+ if (presets.options[i].selected) {
+ presets.options.remove[i];
+ }
+ }
+ presets.options[0].selected = true;
+ }, function() {alert('error')} );
+ }
+
+ function update_preset_field(status)
+ {
+ if (status) {
+ presets = document.getElementById('<inp2:$prefix_InputName field="ExportPresets"/>');
+ if ( presets.value != '' ) {
+ for (i=0; i< presets.options.length; i++) {
+ if (presets.options[i].selected) {
+ preset_name = presets.options[i].text
+ }
+ }
+ document.getElementById('<inp2:$prefix_InputName field="ExportPresetName"/>').value = preset_name;
+ }
+ }
+ document.getElementById('<inp2:$prefix_InputName field="ExportPresetName"/>').disabled = !status;
+ }
+
+ function update_fields(preset)
+ {
+ $export = select_to_string(document.getElementById('<inp2:$prefix_InputName field="ExportColumns"/>'));
+ if ($export != '') {
+ string_to_selected($export, document.getElementById('<inp2:$prefix_InputName field="ExportColumns"/>'));
+ move_selected('<inp2:$prefix_InputName field="ExportColumns"/>', '<inp2:$prefix_InputName field="AvailableColumns"/>');
+ }
+
+ av = document.getElementById('<inp2:$prefix_InputName field="AvailableColumns"/>');
+ fields = preset.split('|');
+
+ for (var i=0; i<fields.length; i++) {
+ fld = fields[i];
+ var $cur = null;
+ for (var $i = 0; $i < av.length; $i++)
+ {
+ cur = av.options[$i];
+ if (cur.value == fld) {
+ av.options[$i].selected = true;
+ move_selected('<inp2:$prefix_InputName field="AvailableColumns"/>', '<inp2:$prefix_InputName field="ExportColumns"/>');
+ }
+ else {
+ av.options[$i].selected = false;
+ }
+ }
+ }
+ }
+
+ $(document).ready(
+ function () {
+ update_preset_field(document.getElementById('<inp2:$prefix_InputName field="ExportPresetName"/>').checked);
+ }
+ );
+ </script>
+ </td>
+ </inp2:m_RenderElement>
+
+ <inp2:m_RenderElement design="form_row" prefix="$prefix" field="ExportColumns" title="la_fld_ExportColumns">
+ <td class="control-cell">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td>
+ <input type="button" value="<inp2:m_phrase name='la_btn_Up'/>" onclick="move_options_up('<inp2:$prefix_InputName field='ExportColumns'/>', 1)" class="button">
+ <input type="button" value="<inp2:m_phrase name='la_btn_Down'/>" onclick="move_options_down('<inp2:$prefix_InputName field='ExportColumns'/>', 1)" class="button"><br />
+ <img src="img/spacer.gif" width="1" height="5" alt=""><br />
+ </td>
+ <td><img src="img/spacer.gif" width="45" height="1" alt=""><br></td>
+ <td><inp2:m_phrase name="la_fld_AvailableColumns"/>:</td>
+ </tr>
+ <tr>
+ <td>
+ <select multiple id="<inp2:$prefix_InputName field='ExportColumns'/>" size="15" style="width: 225px;">
+ <inp2:$prefix_PredefinedOptions field="ExportColumns" block="inp_option_item" selected="selected"/>
+ </select>
+ <input type="hidden" id="hidden_export_columns" name="<inp2:$prefix_InputName field='ExportColumns'/>" value="<inp2:$prefix_Field field='ExportColumns'/>" />
+ </td>
+ <td align="center">
+ <input type="button" value=" «« " onclick="move_selected('<inp2:$prefix_InputName field='AvailableColumns'/>', '<inp2:$prefix_InputName field='ExportColumns'/>')" class="button"><br>
+ <img src="img/spacer.gif" width="1" height="4" alt=""><br>
+ <input type="button" value=" »» " onclick="move_selected('<inp2:$prefix_InputName field='ExportColumns'/>', '<inp2:$prefix_InputName field='AvailableColumns'/>'); select_sort('<inp2:$prefix_InputName field='AvailableColumns'/>');" class="button">
+ </td>
+ <td>
+ <select multiple id="<inp2:$prefix_InputName field='AvailableColumns'/>" size="15" style="width: 225px;">
+ <inp2:$prefix_PredefinedOptions field="AvailableColumns" block="inp_option_item" selected="selected"/>
+ </select>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </inp2:m_RenderElement>
+</inp2:m_DefineElement>
Event Timeline
Log In to Comment