- Timestamp:
- Jan 10, 2012, 9:50:25 PM (13 years ago)
- Location:
- trunk/admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/configuration.php
r12782 r12872 136 136 $order_by = array(); 137 137 $order_by_inside_category = array(); 138 138 139 for ($i=0; $i<count($_POST['order_by_field']); $i++) 139 140 { 140 if ( $i>5) continue;141 if ( $_POST['order_by_field'][$i] == '')141 if ( $i >= (count($sort_fields)-1) ) break; // limit to the number of available parameters 142 if ( empty($_POST['order_by_field'][$i]) ) 142 143 { 143 144 array_push($page['errors'], l10n('No field selected')); 145 break; 144 146 } 145 147 else 146 148 { 149 // there is no rank outside categories 147 150 if ($_POST['order_by_field'][$i] != 'rank') 148 151 { … … 152 155 } 153 156 } 157 // must define a default order_by if user want to order by rank only 158 if ( count($order_by) == 0 ) 159 { 160 $order_by = array('id ASC'); 161 } 162 154 163 $_POST['order_by'] = 'ORDER BY '.implode(', ', $order_by); 155 164 $_POST['order_by_inside_category'] = 'ORDER BY '.implode(', ', $order_by_inside_category); 165 unset($_POST['order_by_field']); 156 166 } 157 167 } -
trunk/admin/themes/default/template/configuration.tpl
r12681 r12872 116 116 117 117 {if !$ORDER_BY_IS_CUSTOM} 118 {footer_script require='jquery'}{literal} 118 {footer_script require='jquery'} 119 // counters for displaying of addFilter link 120 fields = {$main.order_by|@count}; max_fields = {$main.order_field_options|@count}; max_fields--; 121 122 {literal} 123 function updateAddFilterLink() { 124 if (fields >= max_fields) { 125 $('.addFilter').css('display', 'none'); 126 } else { 127 $('.addFilter').css('display', ''); 128 } 129 } 130 131 function updateRemoveFilterTrigger() { 132 $(".removeFilter").click(function () { 133 $(this).parent('span.filter').remove(); 134 fields--; 135 updateAddFilterLink(); 136 }); 137 } 138 119 139 jQuery(document).ready(function () { 120 140 $('.addFilter').click(function() { … … 123 143 $(this).prev('span.filter').children('select[name="order_by_field[]"]').val(''); 124 144 $(this).prev('span.filter').children('select[name="order_by_direction[]"]').val('ASC'); 125 126 $(".removeFilter").click(function () {127 $(this).parent('span.filter').remove();128 });145 146 fields++; 147 updateAddFilterLink(); 148 updateRemoveFilterTrigger(); 129 149 }); 130 150 131 $(".removeFilter").click(function () { 132 $(this).parent('span.filter').remove(); 133 }); 151 updateRemoveFilterTrigger(); 152 updateAddFilterLink(); 134 153 }); 135 {/literal}{/footer_script} 154 {/literal} 155 {/footer_script} 136 156 {/if} 137 157 </ul>
Note: See TracChangeset
for help on using the changeset viewer.