Index: branches/unlabeled/unlabeled-1.1.2/core/admin_templates/incs/menu_blocks.tpl =================================================================== diff -u -r6820 -r6848 --- branches/unlabeled/unlabeled-1.1.2/core/admin_templates/incs/menu_blocks.tpl (.../menu_blocks.tpl) (revision 6820) +++ branches/unlabeled/unlabeled-1.1.2/core/admin_templates/incs/menu_blocks.tpl (.../menu_blocks.tpl) (revision 6848) @@ -10,7 +10,7 @@ $Menus[''+'_filter_menu'].addSeparator(); - + // define ViewMenu @@ -69,6 +69,10 @@ $Menus[''+'_view_menu'].dropShadow("none"); $Menus[''+'_view_menu'].showIcon = true; + + $Menus[''+'_view_menu'].addItem(rs('.columns'),'','javascript:openSelector("", "", "", "400x500")'); + + $Menus[''+'_view_menu'].addItem(rs('.filters'), '', 'javascript:void()', null, true, null, rs('.filter.menu'), null); Index: branches/unlabeled/unlabeled-1.1.2/core/admin_templates/popups/translator.tpl =================================================================== diff -u --- branches/unlabeled/unlabeled-1.1.2/core/admin_templates/popups/translator.tpl (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/core/admin_templates/popups/translator.tpl (revision 6848) @@ -0,0 +1,90 @@ + + + + +In-Portal :: Administration Panel + +"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +"> +"> + + + + + + + + + + + + + +
+ + \ No newline at end of file Index: branches/unlabeled/unlabeled-1.1.2/core/admin_templates/popups/column_picker.tpl =================================================================== diff -u --- branches/unlabeled/unlabeled-1.1.2/core/admin_templates/popups/column_picker.tpl (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/core/admin_templates/popups/column_picker.tpl (revision 6848) @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + +
+ + +
+ + + + + + + +
+ : + + + + + + + +
+ + + + + + + +
+
+ +
+ + + +
+
 
+ + + + + \ No newline at end of file Index: branches/unlabeled/unlabeled-1.27.2/core/units/admin/admin_tag_processor.php =================================================================== diff -u -r6820 -r6848 --- branches/unlabeled/unlabeled-1.27.2/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 6820) +++ branches/unlabeled/unlabeled-1.27.2/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 6848) @@ -504,6 +504,35 @@ { return (PROTOCOL == 'https://')? 1 : 0; } + + function PrintColumns($params) + { + $var_name = $this->Application->GetVar('picker_name'); + $new = isset($params['new']) && $params['new']; + if ($new) { + $var_name = 'column_picker_'.$var_name; + } + + $user =& $this->Application->recallObject('u'); + $val = $user->getPersistantVar($var_name); + $cols = $val ? unserialize($val) : array(); + + $o = ''; + if ($params['hidden'] == 'true') { + foreach ($cols['hidden_fields'] as $col) { + $title = $new ? $this->Application->Phrase($cols['titles'][$col]) : $cols['titles'][$col]; + $o .= "
name="" value=""/> + + + + + class="filter" name="" value="" size="5" />
+ class="filter" name="" value="" size="5" />
+ +
$Menus[''+'_sorting_menu'].addMenuItem('','direct_sort_grid("","","", null, );','2'); Index: branches/unlabeled/unlabeled-1.1.2/core/units/general/helpers/col_picker_helper.php =================================================================== diff -u --- branches/unlabeled/unlabeled-1.1.2/core/units/general/helpers/col_picker_helper.php (revision 0) +++ branches/unlabeled/unlabeled-1.1.2/core/units/general/helpers/col_picker_helper.php (revision 6848) @@ -0,0 +1,116 @@ +Application->RecallVar('user_id'); + $var_name = 'new_'.$this->Prefix; + $q = "SELECT value FROM persistent_session WHERE var='$var_name' and user_id = $user_id"; + $conn =& $this->Application->GetADODBConnection(); + $val = $conn->GetOne($q); + + if ($val == '') { + $this->PickerData = $this->RebuildColumns(); + } + else { + $cols = unserialize($val); + $current_cols = $this->GetColumns(); + + if ($cols === false || $cols['crc'] != $current_cols['crc']) + { + $this->PickerData = $this->RebuildColumns($cols); + } + else { + $this->PickerData = $cols; + } + } + $fields =& $this->Application->NConfig[ $this->Owner->NKey ]['Fields']; + uksort($fields, array($this, 'CmpElems')); + $this->RemoveHiddenColumns($fields); + } + + function CmpElems($a, $b) + { + $a_index = array_search($a, $this->PickerData['order']); + $b_index = array_search($b, $this->PickerData['order']); + + if ($a_index == $b_index) { + return 0; + } + return ($a_index < $b_index) ? -1 : 1; + } + + function RebuildColumns($current=null) + { + $cols = $this->GetColumns(); + + if (is_array($current)) { + //get common fields both in db and xml + $common = array_intersect($current['order'], $cols['order']); + + //get added columns - present in xml, but not in db + $added = array_diff($cols['order'], $current['order']); + + $cols['order'] = array_merge($common, $added); + $cols['hidden_fields'] = array_intersect($current['order'], $current['hidden_fields']); + $this->SetCRC($cols); + } + + $conn =& $this->Application->GetADODBConnection(); + $user_id = $this->Application->RecallVar('user_id'); + $var_name = 'new_'.$this->Prefix; + $data = $conn->qstr(serialize($cols)); + $q = "REPLACE INTO persistent_session (user_id, var, value) VALUES ($user_id, '$var_name', $data)"; + $conn->Execute($q); + return $cols; + } + + function GetColumns() + { + $conf_fields = $this->Application->NConfig[ $this->Owner->NKey ]['Fields']; + + $counter = 0; + $hidden = array(); + foreach ($conf_fields as $name => $options) { + $fields[$counter] = $name; + $titles[$name] = $options['title']; + if (isset($options['hidden']) && $options['hidden']) + { + $hidden[$counter] = $name; + } + $counter++; + } + $sorted_fields = $fields; + sort($sorted_fields); + $cols = array( + 'order' => $fields, + 'titles' => $titles, + 'hidden_fields' => $hidden + ); + $this->SetCRC($cols); + return $cols; + } + + function SetCRC(&$cols) + { + $sorted_fields = $cols['order']; + $sorted_titles = $cols['titles']; + asort($sorted_fields); + asort($sorted_titles); + $cols['crc'] = crc32(implode(',', $sorted_fields).implode(',', $sorted_titles)); + } + + function RemoveHiddenColumns(&$fields) + { + $to_remove = array(); + foreach ($fields as $name => $options) { + if (array_search($name, $this->PickerData['hidden_fields']) !== false) { + $to_remove[] = $name; + } + } + foreach ($to_remove as $name) { + unset($fields[$name]); + } + } +} \ No newline at end of file