';
- var header = this.CreateScroller( this.CreateTable( this.GetHeaderCells(), 'header_'+this.GridId), 100, 10, 'header_'+this.GridId, true, 5 )
- var data = this.CreateScroller( this.CreateTable( this.GetDataCells(), 'data_'+this.GridId ), 100, 10, 'data_'+this.GridId, true, 5 )
- var footer = this.HasFooter() ? this.CreateScroller( this.CreateTable( this.GetFooterCells(), 'footer_'+this.GridId ), 100, 10, 'footer_'+this.GridId, true, 5 ) : '';
+ var header_rows = this.Header.length;
+ var cols = this.Header[0].length;
+ var data_rows = this.Data.length;
+ var header = this.GetTableWithScroller(this.Header, [this.LeftCells, 0, cols, header_rows], 'header')
+ var data = this.GetTableWithScroller(this.Data, [this.LeftCells, 0, cols, data_rows], 'data', 'grid-data-row-even', '')
+ var footer = this.HasFooter() ? this.GetTableWithScroller(this.Footer, [this.LeftCells], 'footer') : '';
+
+ var left_header = this.GetTableWithScroller(this.Header, [0,0,this.LeftCells, header_rows], ['header','left_header'])
+ var left_data = this.GetTableWithScroller(this.Data, [0,0,this.LeftCells, data_rows], ['data','left_data'], 'grid-data-row-even', 'left_')
+ var left_footer = this.GetTableWithScroller(this.Footer, [0,0,this.LeftCells], ['footer','left_footer'])
+
+ /*var css = '';
+ for (var i=0;i
'+css+'';*/
+
if (this.LeftCells != 0) {
- var left_header = this.CreateScroller( this.CreateTable( this.GetLeftHeader(), 'left_header_'+this.GridId), 20, 10, 'left_header_'+this.GridId, true, 5 )
- var left_data = this.CreateScroller( this.CreateTable( this.GetLeftData(), 'left_data_'+this.GridId), 20, 10, 'left_data_'+this.GridId, true, 5 )
- var left_footer = this.CreateScroller( this.CreateTable( this.GetLeftFooter(), 'left_footer_'+this.GridId), 20, 10, 'left_footer_'+this.GridId, true, 5 )
- o += ''
+ o += ''
o += '' + left_header + ' | '
o += '' + header + ' |
'
o += '' + left_data + ' | '
o += '' + data + ' |
'
-
if (this.HasFooter()) {
o += '' + left_footer + ' | '
o += '' + footer + ' |
'
@@ -675,21 +604,110 @@
o += header + data + footer;
}
o += '';
+ return o;
+}
- return o
+GridScroller.prototype.PrepareWidths = function()
+{
+ cache = getFrame('head').grid_widths_cache;
+ if (cache[this.GridId+'_'+this.PickerCRC]) {
+ return cache[this.GridId+'_'+this.PickerCRC]
+ }
+
+ var o = '';
+ data = this.Header.concat(this.Data).concat(this.Footer);
+ o += this.GetTableCells(this.Header, [0,0,this.Header[0].length,this.Header.length], 'header', null, null, false, true)[0];
+ if (this.Data.length) {
+ o += this.GetTableCells(this.Data, [0,0,this.Data[0].length,this.Data.length], 'data', null, null, false, true)[0];
+ }
+ o = ''
+
+ document.write(o)
+ widths = this.GetWidths('tmp_'+this.GridId);
+// print_pre(widths)
+
+ tmp_el = document.getElementById('tmp_'+this.GridId);
+ var p = tmp_el.parentNode;
+ p.removeChild(tmp_el);
+ cache[this.GridId+'_'+this.PickerCRC] = widths;
+ return widths;
}
+GridScroller.prototype.GetTableWithScroller = function(source, dim, class_mode, even_class, id_prefix)
+{
+ var tmp = this.GetIdAndClassName(class_mode);
+ var id = tmp[1];
+ var cells = this.GetTableCells(source, dim, class_mode, even_class, id_prefix);
+ return this.CreateScroller('', cells[1], 100, id+'_'+this.GridId, true, 5);
+}
-GridScroller.prototype.HasFooter = function()
+GridScroller.prototype.GetIdAndClassName = function(class_mode)
{
- return (this.Footer != false)
+ if (typeof(class_mode)=='object') {
+ var class_name = class_mode[0];
+ var id = class_mode[1]
+ }
+ else {
+ var class_name = class_mode;
+ var id = class_mode;
+ }
+ return [class_name, id]
}
-GridScroller.prototype.CreateTable = function(content, id)
+GridScroller.prototype.GetTableCells = function(source, dim, class_mode, even_class, id_prefix, needs_last, no_inner_div)
{
- return '';
+ if (!source.length) return ['', 0];
+ var o = '';
+ var start_col = dim[0];
+ var start_row = dim[1];
+ var end_col = dim[2];
+ var end_row = dim[3];
+ var even = false;
+ if (!even_class) even_class = '';
+ var tmp = this.GetIdAndClassName(class_mode);
+ var class_name = tmp[0];
+ var id = tmp[1];
+ if (id_prefix==null) id_prefix = id;
+ var needs_last = needs_last == null ? (end_col == source[0].length) : needs_last;
+ var total_width = 0;
+ for (var row=start_row; row'
+ even = !even;
+
+ total_width = 0;
+ for (var col=start_col; col', ''];
+ }
+ else {
+ var cursor_workaround = ['','']
+ }
+ width = this.MinWidths[col] ? this.MinWidths[col] + 'px' : 'auto';
+ total_width += this.MinWidths[col];
+ if (no_inner_div) {
+ rh += ''+cursor_workaround[0]+source[row][col]+cursor_workaround[1]+' | '
+ }
+ else {
+ rh += ''+cursor_workaround[0]+' '+source[row][col]+cursor_workaround[1]+' | '
+ }
+ }
+ if (needs_last) {
+ rh += ' | '
+ }
+ rh += ''
+ o += rh;
+ }
+ return [o, total_width];
}
+
+GridScroller.prototype.HasFooter = function()
+{
+ return (this.Footer != false)
+}
+
GridScroller.prototype.CreateScroller = function(content, w, h, id, hidden, z)
{
if (hidden) {
@@ -717,108 +735,6 @@
return o
}
-GridScroller.prototype.GetLeftHeader = function()
-{
- var o = '';
- for (var row in this.Header) {
- o +=''
- }
- return o
-}
-
-GridScroller.prototype.GetLeftData = function()
-{
- var o = '';
- var even = false;
- for (var row in this.Data) {
- var id = this.IDs[row] ? 'id="left_'+this.IDs[row]+'"' : '';
- o += even ? '' : '
'
- even = !even;
- for (var col=0; col'+this.Data[row][col]+'
'
- }
- o += '
'
- }
-
- return o
-}
-
-GridScroller.prototype.GetLeftFooter = function()
-{
- var o = '';
- if (this.HasFooter()) {
- o += ''
- }
- return o
-}
-
-GridScroller.prototype.GetHeaderCells = function()
-{
- var o = '';
- for (var row in this.Header) {
- o +=''
- }
- return o
-
- /*var o = ''
- return o*/
-}
-
-
-GridScroller.prototype.GetDataCells = function()
-{
- var o = '';
- var even = false;
- var width;
-
- for (var row in this.Data) {
- var id = this.IDs[row] ? 'id="'+this.IDs[row]+'"' : '';
- o += even ? '' : '
'
- even = !even;
- for (var col=this.LeftCells; col'+this.Data[row][col]+'
'
- }
- o += ' | '
- o += '
'
- }
- return o
-}
-
-GridScroller.prototype.GetFooterCells = function()
-{
- var o = ''
- return o
-}
-
GridScroller.prototype.SetData = function(a_data)
{
this.Data = a_data;
Index: branches/unlabeled/unlabeled-1.68.4/core/kernel/db/db_tag_processor.php
===================================================================
diff -u -r7091 -r7102
--- branches/unlabeled/unlabeled-1.68.4/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 7091)
+++ branches/unlabeled/unlabeled-1.68.4/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 7102)
@@ -158,6 +158,15 @@
return $o;
}
+ function PickerCRC($params)
+ {
+ /* @var $picker_helper kColumnPickerHelper */
+ $picker_helper =& $this->Application->RecallObject('ColumnPickerHelper');
+ $picker_helper->SetGridName($params['grid']);
+ $data = $picker_helper->LoadColumns($this->getPrefixSpecial());
+ return $data['crc'];
+ }
+
function GridFieldsCount($params)
{
$grids = $this->Application->getUnitOption($this->Prefix, 'Grids');
@@ -186,11 +195,14 @@
$block_params['name'] = $this->SelectParam($params, 'render_as,block');
$block_params['pass_params'] = 'true';
+ $i = 0;
while (!$list->EOL())
{
$this->Application->SetVar( $this->getPrefixSpecial().'_id', $list->GetDBField($id_field) ); // for edit/delete links using GET
+ $block_params['is_last'] = ($i == $list->SelectedCount-1);
$o.= $this->Application->ParseBlock($block_params, 1);
$list->GoNext();
+ $i++;
}
$this->Application->SetVar( $this->getPrefixSpecial().'_id', '');
@@ -1501,7 +1513,7 @@
if (isset($params['type'])) {
$ret = $ret[ $params['type'] ];
}
-
+
if( !$this->HasParam($params, 'no_special') ) $ret = htmlspecialchars($ret);
return $ret;
}
Index: branches/unlabeled/unlabeled-1.2.2/core/admin_templates/js/script.js
===================================================================
diff -u -r7099 -r7102
--- branches/unlabeled/unlabeled-1.2.2/core/admin_templates/js/script.js (.../script.js) (revision 7099)
+++ branches/unlabeled/unlabeled-1.2.2/core/admin_templates/js/script.js (.../script.js) (revision 7102)
@@ -437,8 +437,10 @@
$kf.target = $window_name;
var $prev_opener = opener_action('p');
+ event_bak = get_hidden_field('events[' + $prefix_special + ']')
submit_event($prefix_special, $event, $t);
opener_action($prev_opener); // restore opener in parent window
+ set_hidden_field('events[' + $prefix_special + ']', event_bak); // restore event
}
function openSelector($prefix, $url, $dst_field, $window_size, $event)
@@ -511,6 +513,7 @@
function std_edit_item(prefix_special, edit_template)
{
+ var mode_bak = get_hidden_field(prefix_special+'_mode');
set_hidden_field(prefix_special+'_mode', 't');
if (use_popups(prefix_special, 'OnEdit')) {
open_popup(prefix_special, 'OnEdit', edit_template);
@@ -519,6 +522,7 @@
opener_action('d');
submit_event(prefix_special,'OnEdit',edit_template);
}
+ set_hidden_field(prefix_special+'_mode', mode_bak)
}
function std_edit_temp_item(prefix_special, edit_template)
Index: branches/unlabeled/unlabeled-1.3.2/core/admin_templates/js/toolbar.js
===================================================================
diff -u -r7090 -r7102
--- branches/unlabeled/unlabeled-1.3.2/core/admin_templates/js/toolbar.js (.../toolbar.js) (revision 7090)
+++ branches/unlabeled/unlabeled-1.3.2/core/admin_templates/js/toolbar.js (.../toolbar.js) (revision 7102)
@@ -225,11 +225,12 @@
ToolBar.prototype.Render = function($container)
{
if ($container) {
- $container.innerHTML = ''; // container will contain only buttons
+ var tmp = '';
for (var i in this.Buttons) {
btn = this.Buttons[i];
- $container.innerHTML += btn.GetHTML();
+ tmp += btn.GetHTML();
}
+ $container.innerHTML = tmp; // container will contain only buttons
// init all buttons after because objects are not yet created directly after assigning to innerHTML
for (var i in this.Buttons) {