Index: branches/RC/core/units/admin/admin_tag_processor.php
===================================================================
diff -u -r9313 -r9359
--- branches/RC/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 9313)
+++ branches/RC/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 9359)
@@ -626,6 +626,8 @@
$main_prefix = $this->Application->RecallVar('main_prefix');
$cols = $picker_helper->LoadColumns($main_prefix);
+ $this->Application->Phrases->AddCachedPhrase('__FREEZER__', '-------------');
+
$o = '';
if (isset($params['hidden']) && $params['hidden']) {
foreach ($cols['hidden_fields'] as $col) {
Index: branches/RC/core/units/general/helpers/col_picker_helper.php
===================================================================
diff -u -r8929 -r9359
--- branches/RC/core/units/general/helpers/col_picker_helper.php (.../col_picker_helper.php) (revision 8929)
+++ branches/RC/core/units/general/helpers/col_picker_helper.php (.../col_picker_helper.php) (revision 9359)
@@ -24,11 +24,15 @@
return $cols;
}
- function ApplyPicker($prefix, &$fields, $grid_name)
+ function PreparePicker($prefix, $grid_name)
{
$this->SetGridName($grid_name);
$this->PickerData = $this->LoadColumns($prefix);
+ }
+ function ApplyPicker($prefix, &$fields, $grid_name)
+ {
+ $this->PreparePicker($prefix, $grid_name);
uksort($fields, array($this, 'CmpElems'));
$this->RemoveHiddenColumns($fields);
}
@@ -59,9 +63,16 @@
//get added columns - present in xml, but not in db
$added = array_diff($cols['order'], $current['order']);
+ if (in_array('__FREEZER__', $added)) {
+ array_unshift($common, '__FREEZER__');
+ unset($added[array_search('__FREEZER__', $added)]);
+ }
$cols['order'] = array_merge($common, $added);
$cols['hidden_fields'] = array_intersect($current['order'], $current['hidden_fields']);
+ foreach($common as $col) {
+ $cols['widths'][$col] = isset($current['widths'][$col]) ? $current['widths'][$col] : 100;
+ }
$this->SetCRC($cols);
}
$this->StoreCols($prefix, $cols);
@@ -79,7 +90,11 @@
{
$splited = $this->Application->processPrefix($prefix);
$grids = $this->Application->getUnitOption($splited['prefix'], 'Grids');
- $conf_fields = $grids[$this->GridName]['Fields'];
+ $conf_fields = array_merge_recursive(
+ array('__FREEZER__' => array('title' => '__FREEZER__')),
+ $grids[$this->GridName]['Fields']
+ );
+// $conf_fields = $grids[$this->GridName]['Fields'];
// we NEED to recall dummy here to apply fields changes imposed by formatters,
// such as replacing multilingual field titles etc.
@@ -89,9 +104,11 @@
$hidden = array();
$fields = array();
$titles = array();
+ $widths = array();
foreach ($conf_fields as $name => $options) {
$fields[$counter] = $name;
$titles[$name] = $options['title'];
+ $widths[$name] = 100;
if (isset($options['hidden']) && $options['hidden'])
{
$hidden[$counter] = $name;
@@ -103,7 +120,8 @@
$cols = array(
'order' => $fields,
'titles' => $titles,
- 'hidden_fields' => $hidden
+ 'hidden_fields' => $hidden,
+ 'widths' => $widths,
);
$this->SetCRC($cols);
return $cols;
@@ -137,11 +155,28 @@
$hidden = $hidden ? explode('|', $hidden) : array();
$order = array_merge($order, $hidden);
- $cols = array();
+ $cols = $this->LoadColumns($prefix);
$cols['order'] = $order;
$cols['hidden_fields'] = $hidden;
$this->SetCRC($cols);
$this->StoreCols($prefix, $cols);
}
+
+ function SaveWidths($prefix, $widths)
+ {
+ if (!is_array($widths)) $widths = explode(':', $widths);
+ array_shift($widths); // removing first col (checkbox col) width
+ $i = 0;
+ foreach ($this->PickerData['order'] as $ord => $field) {
+ if ($field == '__FREEZER__') continue;
+ $this->PickerData['widths'][$field] = $widths[$i++];
+ }
+ $this->StoreCols($prefix, $this->PickerData);
+ }
+
+ function GetWidth($field)
+ {
+ return isset($this->PickerData['widths'][$field]) ? $this->PickerData['widths'][$field] : false;
+ }
}
\ No newline at end of file
Index: branches/RC/core/kernel/db/db_event_handler.php
===================================================================
diff -u -r9313 -r9359
--- branches/RC/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 9313)
+++ branches/RC/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 9359)
@@ -152,6 +152,7 @@
'OnUploadFile' => Array('self'=>true, 'subitem'=>true),
'OnViewFile' => Array('self'=>true, 'subitem'=>true),
+ 'OnSaveWidths' => Array('self'=>true, 'subitem'=>true),
);
$this->permMapping = array_merge($this->permMapping, $permissions);
}
@@ -2128,6 +2129,25 @@
$event->status = erSTOP;
}
+ /**
+ * Enter description here...
+ *
+ * @param kEvent $event
+ */
+ function OnSaveWidths(&$event)
+ {
+ safeDefine('DBG_SKIP_REPORTING', 1);
+ $lang =& $this->Application->recallObject('lang.current');
+// header('Content-type: text/xml; charset='.$lang->GetDBField('Charset'));
+
+ $picker_helper =& $this->Application->RecallObject('ColumnPickerHelper');
+ /* @var $picker_helper kColumnPickerHelper */
+ $picker_helper->PreparePicker($event->getPrefixSpecial(), $this->Application->GetVar('grid_name'));
+
+ $picker_helper->SaveWidths($event->getPrefixSpecial(), $this->Application->GetVar('widths'));
+ exit;
+ }
+
}
Index: branches/RC/core/admin_templates/incs/grid_blocks.tpl
===================================================================
diff -u -r8929 -r9359
--- branches/RC/core/admin_templates/incs/grid_blocks.tpl (.../grid_blocks.tpl) (revision 8929)
+++ branches/RC/core/admin_templates/incs/grid_blocks.tpl (.../grid_blocks.tpl) (revision 9359)
@@ -422,8 +422,8 @@
Reload Frame ';
-
+
if (this.ErrorsCount > 0) {
$toolbar_content += 'Show Debugger (' + this.ErrorsCount + ' errors) ';
}
else {
$toolbar_content += 'Show Debugger ';
}
-
+
if (this.SQLCount > 0) {
$toolbar_content += '' + this.SQLCount + ' sqls ';
}
@@ -257,9 +257,9 @@
function GetWindowHeight() {
var currWinHeight;
-
+
// if (document.body.clientHeight) {
-// currWinHeight = document.body.clientHeight;
+// currWinHeight = document.body.clientHeight;
if (window.innerHeight) {//FireFox with correction for status bar at bottom of window
currWinHeight = window.innerHeight;
@@ -379,23 +379,23 @@
}
}
var the_debugger = this;
- drag_object.onmousedown = function(ev){
+ this.AddEvent(drag_object, 'mousedown', function(ev){
ev = ev || window.event;
the_debugger.InitialPos = findPos(drag_object);
var coords = the_debugger.mouseCoords(ev);
- var pos = findPos(this);
+ var pos = findPos(drag_object);
the_debugger.MouseOffset = [coords.x - pos[0], coords.y - pos[1]];
- the_debugger.DragObject = this;
- the_debugger.LastDragObject = this;
+ the_debugger.DragObject = drag_object;
+ the_debugger.LastDragObject = drag_object;
the_debugger.DragObject.style.position = 'absolute';
the_debugger.Options = cur_options;
startCallback(drag_object);
- }
- document.onmousemove = function(ev){
- ev = ev || window.event;
- var coords = the_debugger.mouseCoords(ev);
+ });
+ this.AddEvent(document, 'mousemove', function(ev) {
// window.status = 'mouse at: '+coords.x+','+coords.y;
if(the_debugger.DragObject){
+ ev = ev || window.event;
+ var coords = the_debugger.mouseCoords(ev);
if (the_debugger.Options.VerticalDrag) {
the_debugger.DragObject.style.top = (coords.y - the_debugger.MouseOffset[1] ) + 'px' // ;
}
@@ -405,13 +405,13 @@
moveCallback(drag_object, coords)
return false;
}
- }
- document.onmouseup = function(ev){
+ });
+ this.AddEvent(document, 'mouseup', function(ev){
var tmp = the_debugger.DragObject;
the_debugger.DragObject = null;
if(tmp){
endCallback(tmp);
}
var pos = findPos(drag_object);
- }
+ });
}
\ No newline at end of file
Index: branches/RC/core/admin_templates/js/drag.js
===================================================================
diff -u -r9299 -r9359
--- branches/RC/core/admin_templates/js/drag.js (.../drag.js) (revision 9299)
+++ branches/RC/core/admin_templates/js/drag.js (.../drag.js) (revision 9359)
@@ -6,6 +6,7 @@
DragManager.ResizeHappening = false;
DragManager.ResizeTimer = null;
DragManager.InitialPos = null;
+DragManager.Options = {};
DragManager.mouseCoords = function(ev)
{
@@ -30,22 +31,21 @@
cur_options[i] = options[i];
}
}
- drag_object.onmousedown = function(ev){
+ addEvent(drag_object, 'mousedown', function(ev){
ev = ev || window.event;
DragManager.InitialPos = findPos(drag_object);
var coords = DragManager.mouseCoords(ev);
- var pos = findPos(this);
+ var pos = findPos(drag_object);
DragManager.MouseOffset = [coords.x - pos[0], coords.y - pos[1]];
- DragManager.DragObject = this;
- DragManager.LastDragObject = this;
+ DragManager.DragObject = drag_object;
+ DragManager.LastDragObject = drag_object;
DragManager.DragObject.style.position = 'absolute';
DragManager.Options = cur_options;
startCallback(drag_object);
- }
- document.onmousemove = function(ev){
+ });
+ addEvent(document, 'mousemove', function(ev){
ev = ev || window.event;
- var coords = DragManager.mouseCoords(ev);
-// window.status = 'mouse at: '+coords.x+','+coords.y;
+ var coords = DragManager.mouseCoords(ev);
if(DragManager.DragObject){
if (DragManager.Options.VerticalDrag) {
DragManager.DragObject.style.top = (coords.y - DragManager.MouseOffset[1] ) + 'px' // ;
@@ -56,14 +56,14 @@
moveCallback(drag_object, coords)
return false;
}
- }
- document.onmouseup = function(ev){
+ });
+ addEvent(document, 'mouseup', function(ev){
var tmp = DragManager.DragObject;
DragManager.DragObject = null;
if(tmp){
endCallback(tmp);
}
- }
+ })
}
function init_resizer()
Index: branches/RC/core/admin_templates/incs/menu_blocks.tpl
===================================================================
diff -u -r9358 -r9359
--- branches/RC/core/admin_templates/incs/menu_blocks.tpl (.../menu_blocks.tpl) (revision 9358)
+++ branches/RC/core/admin_templates/incs/menu_blocks.tpl (.../menu_blocks.tpl) (revision 9359)
@@ -1,5 +1,5 @@