diff --git a/etemplate/inc/class.editor.inc.php b/etemplate/inc/class.editor.inc.php index 7f1b9df952..b100fa2bc1 100644 --- a/etemplate/inc/class.editor.inc.php +++ b/etemplate/inc/class.editor.inc.php @@ -36,6 +36,21 @@ 'right' => 'Right', 'center' => 'Center' ); + var $options = array( + 'width', + 'height', + 'border', + 'class', + 'spaceing', + 'padding', + 'overflow' + ); + var $overflows = array( + '' => 'visible', + 'hidden' => 'hidden', + 'scroll' => 'scroll', + 'auto' => 'auto' + ); var $extensions = ''; var $public_functions = array @@ -95,6 +110,12 @@ 'cols' => $this->etemplate->cols, 'msg' => $msg ); + $options = explode(',',$this->etemplate->size); + reset($this->options); + while (list($n,$opt) = each($this->options)) + { + $content['options'][$opt] = $options[$n]; + } $cols_spanned = array(); reset($this->etemplate->data); if (isset($this->etemplate->data[0])) @@ -160,7 +181,8 @@ $this->editor->exec('etemplate.editor.process_edit',$content, array( 'type' => $types, - 'align' => $this->aligns + 'align' => $this->aligns, + 'overflow' => $this->overflows ), $no_button,$cols_spanned + array('**extensions**' => $this->extensions)); } @@ -178,11 +200,18 @@ } $this->extensions = $content['**extensions**']; unset($content['**extensions**']); $this->etemplate->init($content); - $this->etemplate->size = $content['size']; - $this->etemplate->style = $content['style']; $opts = array(); + reset($this->options); + while (list(,$opt) = each($this->options)) + { + $opts[$opt] = $content['options'][$opt]; + } + $this->etemplate->size = ereg_replace(',*$','',implode(',',$opts)); + $this->etemplate->style = $content['style']; + $names = array('width','height','class'); + $opts = array(); while (list(,$opt) = each($names)) { if (is_array($content[$opt])) @@ -363,6 +392,10 @@ } elseif ($content['save']) { + if (!$this->etemplate->modified_set || !$this->etemplate->modified) + { + $this->etemplate->modified = time(); + } $ok = $this->etemplate->save($content['name'],$content['template'],$content['lang'],$content['group'],$content['version']); $msg = $this->messages[$ok ? 'saved' : 'error_writing']; } @@ -459,6 +492,8 @@ $this->etemplate->xul_io = CreateObject('etemplate.xul_io'); } $imported = $this->etemplate->xul_io->import(&$this->etemplate,$xul); + $this->etemplate->modified = filemtime($f); + $this->etemplate->modified_set = 'xul-import'; if (is_array($imported)) { diff --git a/etemplate/inc/class.soetemplate.inc.php b/etemplate/inc/class.soetemplate.inc.php index 8d2cc94a3c..2a1c3c16bf 100644 --- a/etemplate/inc/class.soetemplate.inc.php +++ b/etemplate/inc/class.soetemplate.inc.php @@ -61,7 +61,8 @@ var $db_data_cols = array( 'et_data' => 'data', 'et_size' => 'size', - 'et_style' => 'style' + 'et_style' => 'style', + 'et_modified' => 'modified' ); var $db_cols; @@ -258,7 +259,7 @@ if ($this->name == '' || $app == '' || $name == '' || !@file_exists($file) || !($f = @fopen($file,'r'))) { - if ($this->debug == 1 || $this->debug == $this->name) + if ($this->debug == 1 || $this->name != '' && $this->debug == $this->name) { echo "
Can't open '$file' !!!
\n"; } @@ -333,7 +334,10 @@ $result = array(); while ($this->db->next_record()) { - $result[] = $this->db->Record; + if ($this->db->f('et_lang') != '##') // exclude or import-time-stamps + { + $result[] = $this->db->Record; + } } return $result; } @@ -494,6 +498,10 @@ } } } + if (!$this->modified) + { + $this->modified = time(); + } $data = $this->as_array(1); $data['data'] = serialize($this->compress_array($data['data'])); @@ -693,7 +701,7 @@ */ function import_dump($app) { - include(PHPGW_SERVER_ROOT."/$app/setup/etemplates.inc.php"); + include($path = PHPGW_SERVER_ROOT."/$app/setup/etemplates.inc.php"); $templ = new etemplate($app); for ($n = 0; isset($templ_data[$n]); ++$n) @@ -703,6 +711,10 @@ $templ->$name = $templ_data[$n][$name]; } $templ->data = unserialize(stripslashes($templ->data)); + if (!$templ->modified) + { + $templ->modified = filemtime($path); + } $templ->save(); } return "$n new eTemplates imported for Application '$app'"; @@ -730,10 +742,10 @@ if ($time = @filemtime($path)) { $templ = new soetemplate(".$app",'','##'); - if ($templ->lang != '##' || $templ->data[0] < $time) // need to import + if ($templ->lang != '##' || $templ->modified < $time) // need to import { $ret = $this->import_dump($app); - $templ->data = array($time); + $templ->modified = $time; $templ->save(".$app",'','##'); } } diff --git a/etemplate/inc/class.uietemplate.inc.php b/etemplate/inc/class.uietemplate.inc.php index 9948e3cd96..bbef6098e1 100644 --- a/etemplate/inc/class.uietemplate.inc.php +++ b/etemplate/inc/class.uietemplate.inc.php @@ -301,11 +301,14 @@ $style = $this->html->style($this->style); $GLOBALS['phpgw_info']['etemplate']['styles_included'][$this->name] = True; } - list(,,$border) = explode(',',$this->size); + $html = $this->html->table($rows,$this->html->formatOptions($this->size,'WIDTH,HEIGHT,BORDER,CLASS,CELLSPACING,CELLPADDING')); - return "\n\n\n$style\n". - $this->html->table($rows,$this->html->formatOptions($this->size,'WIDTH,HEIGHT,BORDER,CLASS,CELLSPACING,CELLPADDING')). - "\n\n"; + list($width,$height,,,,,$overflow) = explode(',',$this->size); + if (!empty($overflow)) { + $div_style=' STYLE="'.($width?"width: $width; ":'').($height ? "height: $height; ":'')."overflow: $overflow\""; + $html = $this->html->div($html,$div_style); + } + return "\n\n\n$style\n".$html."\n\n"; } /*! diff --git a/etemplate/setup/phpgw_en.lang b/etemplate/setup/phpgw_en.lang index c36420b77e..3cb5f37d27 100644 --- a/etemplate/setup/phpgw_en.lang +++ b/etemplate/setup/phpgw_en.lang @@ -22,6 +22,7 @@ @help etemplate en @help @label etemplate en @label a pattern to be searched for etemplate en a pattern to be searched for +access etemplate en Access add column etemplate en Add Column add table etemplate en Add Table align etemplate en Align @@ -30,10 +31,14 @@ an indexed column speeds up querys using that column (cost space on the disk !!! application etemplate en Application birtday etemplate en Birtday birthday etemplate en Birthday +border etemplate en Border +border-line-thickness for the table-tag etemplate en Border-line-thickness for the table-tag can have special sql-value null etemplate en can have special SQL-value NULL cancel etemplate en Cancel cancel, discarding changes etemplate en Cancel, discarding changes category etemplate en Category +cellpadding for the table-tag etemplate en Cellpadding for the table-tag +cellspacing for the table-tag etemplate en Cellspacing for the table-tag center etemplate en Center check if content should only be displayed but not altered (the content is not send back then!) etemplate en check if content should only be displayed but not altered (the content is not send back then!) check if field has to be filled by user etemplate en check if field has to be filled by user @@ -45,6 +50,7 @@ columnname etemplate en ColumnName companyname etemplate en Companyname create a new table for the application etemplate en Create a new table for the application creates an english ('en') langfile from label and helptexts (for application in name) etemplate en creates an english ('en') langfile from label and helptexts (for application in Name) +css class for the table-tag etemplate en CSS class for the table-tag css-class name for this row, preset: 'nmh' = nextmatch header, 'nmr' = alternating nm row, 'nmr0'+'nmr1' nm rows etemplate en CSS-class name for this row, preset: 'nmh' = NextMatch header, 'nmr' = alternating NM row, 'nmr0'+'nmr1' NM rows css-styles etemplate en CSS-styles date etemplate en Date @@ -109,6 +115,7 @@ go to the previous page of entries etemplate en go to the previous page of entri group/-user etemplate en Group/-User height etemplate en Height height of row (in percent or pixel) etemplate en height of row (in percent or pixel) +height of the table in % or pixels for the table-tag and (optional) div etemplate en Height of the table in % or pixels for the table-tag and (optional) div help etemplate en Help hier kommt text rein etemplate en Hier kommt text rein horizontal rule etemplate en Horizontal Rule @@ -156,6 +163,10 @@ number of colums the field/cell should span or 'all' for the remaining columns, of etemplate en of only an other version found !!! etemplate en only an other Version found !!! options etemplate en Options +options: etemplate en Options: +overflow etemplate en Overflow +padding etemplate en Padding +padding for the table-tag etemplate en Padding for the table-tag precision etemplate en Precision primary key etemplate en Primary Key primary key for the table, gets automaticaly indexed etemplate en Primary key for the table, gets automaticaly indexed @@ -203,6 +214,8 @@ shows / allows you to enter values into the etemplate for testing etemplate en s shows/displays etemplate for testing, does not save it before etemplate en shows/displays eTemplate for testing, does NOT save it before shows/displays the template for testing, does not save it before etemplate en shows/displays the template for testing, does NOT save it before size etemplate en Size +spacing etemplate en Spacing +spacing for the table-tag etemplate en Spacing for the table-tag span etemplate en Span span, class etemplate en Span, Class start new search for the above pattern etemplate en start new search for the above pattern @@ -215,6 +228,7 @@ telefonnumber etemplate en Telefonnumber template etemplate en Template template deleted etemplate en Template deleted template saved etemplate en Template saved +test etemplate en Test text etemplate en Text textarea etemplate en Textarea textfeld: etemplate en Textfeld: @@ -232,9 +246,11 @@ upload etemplate en Upload value etemplate en Value version etemplate en Version version-number, should be in the form: major.minor.revision.number (eg. 0.9.13.001 all numbers filled up with zeros) etemplate en version-number, should be in the form: major.minor.revision.number (eg. 0.9.13.001 all numbers filled up with zeros) +what happens with overflowing content: visible (default), hidden, scroll, auto (browser decides) etemplate en what happens with overflowing content: visible (default), hidden, scroll, auto (browser decides) when was the company founded etemplate en when was the company founded width etemplate en Width width of column (in percent or pixel) etemplate en width of column (in percent or pixel) +width of the table in % or pixels for the table-tag and (optional) div etemplate en Width of the table in % or pixels for the table-tag and (optional) div width, height and border-line-thickness of the table / template etemplate en width, height and border-line-thickness of the table / template width, height, border etemplate en Width, Height, Border width, height, border, class, cellspacing, cellpadding etemplate en Width, Height, Border, class, Cellspacing, Cellpadding diff --git a/etemplate/setup/setup.inc.php b/etemplate/setup/setup.inc.php index 6bef087efb..84d701754f 100644 --- a/etemplate/setup/setup.inc.php +++ b/etemplate/setup/setup.inc.php @@ -14,7 +14,7 @@ $setup_info['etemplate']['name'] = 'etemplate'; $setup_info['etemplate']['title'] = 'eTemplates'; - $setup_info['etemplate']['version'] = '0.9.13.001'; + $setup_info['etemplate']['version'] = '0.9.15.001'; $setup_info['etemplate']['app_order'] = 8; // just behind the developers-tools $setup_info['etemplate']['tables'] = array('phpgw_etemplate'); $setup_info['etemplate']['enable'] = 1; diff --git a/etemplate/setup/tables_baseline.inc.php b/etemplate/setup/tables_baseline.inc.php new file mode 100755 index 0000000000..dbacb89bdc --- /dev/null +++ b/etemplate/setup/tables_baseline.inc.php @@ -0,0 +1,34 @@ + * + * -------------------------------------------- * + * This program is free software; you can redistribute it and/or modify it * + * under the terms of the GNU General Public License as published by the * + * Free Software Foundation; either version 2 of the License, or (at your * + * option) any later version. * + \**************************************************************************/ + + /* $Id$ */ + + $phpgw_baseline = array( + 'phpgw_etemplate' => array( + 'fd' => array( + 'et_name' => array('type' => 'char','precision' => 80,'nullable' => False), + 'et_template' => array('type' => 'char','precision' => 20,'nullable' => False,'default' => ''), + 'et_lang' => array('type' => 'char', 'precision' => 5,'nullable' => False,'default' => ''), + 'et_group' => array('type' => 'int', 'precision' => 4,'nullable' => False, 'default' => 0), + 'et_version' => array('type' => 'char','precision' => 20,'nullable' => False,'default' => ''), + 'et_data' => array('type' => 'varchar', 'precision' => 32000,'nullable' => True), + 'et_size' => array('type' => 'char','precision' => 20,'nullable' => True), + 'et_style' => array('type' => 'varchar', 'precision' => 32000,'nullable' => True) + ), + 'pk' => array('et_name','et_template','et_lang','et_group','et_version'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + ) + ); + +?> diff --git a/etemplate/setup/tables_current.inc.php b/etemplate/setup/tables_current.inc.php index dbacb89bdc..393e79063f 100644 --- a/etemplate/setup/tables_current.inc.php +++ b/etemplate/setup/tables_current.inc.php @@ -15,14 +15,15 @@ $phpgw_baseline = array( 'phpgw_etemplate' => array( 'fd' => array( - 'et_name' => array('type' => 'char','precision' => 80,'nullable' => False), - 'et_template' => array('type' => 'char','precision' => 20,'nullable' => False,'default' => ''), - 'et_lang' => array('type' => 'char', 'precision' => 5,'nullable' => False,'default' => ''), - 'et_group' => array('type' => 'int', 'precision' => 4,'nullable' => False, 'default' => 0), - 'et_version' => array('type' => 'char','precision' => 20,'nullable' => False,'default' => ''), - 'et_data' => array('type' => 'varchar', 'precision' => 32000,'nullable' => True), - 'et_size' => array('type' => 'char','precision' => 20,'nullable' => True), - 'et_style' => array('type' => 'varchar', 'precision' => 32000,'nullable' => True) + 'et_name' => array('type' => 'char','precision' => '80','nullable' => False), + 'et_template' => array('type' => 'char','precision' => '20','default' => '','nullable' => False), + 'et_lang' => array('type' => 'char','precision' => '5','default' => '','nullable' => False), + 'et_group' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), + 'et_version' => array('type' => 'char','precision' => '20','default' => '','nullable' => False), + 'et_data' => array('type' => 'text','nullable' => True), + 'et_size' => array('type' => 'char','precision' => '128','nullable' => True), + 'et_style' => array('type' => 'text','nullable' => True), + 'et_modified' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False) ), 'pk' => array('et_name','et_template','et_lang','et_group','et_version'), 'fk' => array(), @@ -30,5 +31,3 @@ 'uc' => array() ) ); - -?> diff --git a/etemplate/setup/tables_update.inc.php b/etemplate/setup/tables_update.inc.php new file mode 100644 index 0000000000..e96fa4e8d9 --- /dev/null +++ b/etemplate/setup/tables_update.inc.php @@ -0,0 +1,41 @@ +oProc->AlterColumn('phpgw_etemplate','et_data',array( + 'type' => 'text', + 'nullable' => True + )); + $GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_etemplate','et_size',array( + 'type' => 'char', + 'precision' => '128', + 'nullable' => True + )); + $GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_etemplate','et_style',array( + 'type' => 'text', + 'nullable' => True + )); + $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_etemplate','et_modified',array( + 'type' => 'int', + 'precision' => '4', + 'default' => '0', + 'nullable' => False + )); + + + $GLOBALS['setup_info']['etemplate']['currentver'] = '0.9.15.001'; + return $GLOBALS['setup_info']['etemplate']['currentver']; + } +?>