From 0793450251b2018398346cb8df77507381f75dc6 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 20 May 2005 16:56:16 +0000 Subject: [PATCH] own template to edit grids: has now separate fields and helptexts for the diverse values comulated in size/options --- etemplate/inc/class.editor.inc.php | 48 ++++++++++----- etemplate/setup/etemplates.inc.php | 4 +- etemplate/setup/phpgw_de.lang | 1 + etemplate/setup/phpgw_en.lang | 1 + .../templates/default/editor.widget.grid.xet | 61 +++++++++++++++++++ 5 files changed, 100 insertions(+), 15 deletions(-) create mode 100644 etemplate/templates/default/editor.widget.grid.xet diff --git a/etemplate/inc/class.editor.inc.php b/etemplate/inc/class.editor.inc.php index 5e86aaea6f..abc9597ccf 100644 --- a/etemplate/inc/class.editor.inc.php +++ b/etemplate/inc/class.editor.inc.php @@ -1068,6 +1068,20 @@ { $path = $content['goto'] ? $content['goto'] : ($content['goto2'] ? $content['goto2'] : $content['path']); $Ok = $this->etemplate->read($content['name'],$content['template'],$content['lang'],0,$content['goto'] || $content['goto2'] ? $content['version'] : $content['old_version']); + + // build size from options array, if applicable + if (is_array($content['cell']['options'])) + { + $size = ''; + for ($n = max(array_keys($content['cell']['options'])); $n >= 0; --$n) + { + if (strlen($content['cell']['options'][$n]) || strlen($size)) + { + $size = $content['cell']['options'][$n].(strlen($size) ? ','.$size : ''); + } + } + $content['cell']['size'] = $size; + } } else { @@ -1232,6 +1246,8 @@ $content['msg'] = $msg; $content['goto'] = $this->path_components($content['path']); $content['goto2'] = $this->parent_navigation($parent,$parent_path,$child_id,$widget); + + $content['cell']['options'] = explode(',',$content['cell']['size']); $editor =& new etemplate('etemplate.editor.widget'); $type_tmpl =& new etemplate; @@ -1248,24 +1264,28 @@ $editor->disable_cells('row_menu'); $editor->disable_cells('column_menu'); } + $preserv = $this->etemplate->as_array()+array( + 'path' => $content['path'], + 'old_version' => $this->etemplate->version, + 'opener' => $content['opener'], + 'cell' => $content['cell'], + 'goto' => $content['goto'], + ); + unset($preserv['cell']['options']); // otherwise we never know if content is returned via options array or size + $GLOBALS['phpgw_info']['flags']['java_script'] = "\n"; $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Editable Templates - Editor'); $editor->exec('etemplate.editor.widget',$content,array( 'type' => array_merge($this->etemplate->types,$this->extensions), - 'align' => $this->aligns, - 'valign' => $this->valigns, - 'edit_menu' => $this->edit_menu, - 'box_menu' => $this->box_menu, - 'row_menu' => $this->row_menu, - 'column_menu'=> $this->column_menu, - 'onclick_type'=> $this->onclick_types, - ),'',$this->etemplate->as_array()+array( - 'path' => $content['path'], - 'old_version' => $this->etemplate->version, - 'opener' => $content['opener'], - 'cell' => $content['cell'], - 'goto' => $content['goto'], - ),2); + 'align' => &$this->aligns, + 'valign' => &$this->valigns, + 'edit_menu' => &$this->edit_menu, + 'box_menu' => &$this->box_menu, + 'row_menu' => &$this->row_menu, + 'column_menu'=> &$this->column_menu, + 'onclick_type'=>&$this->onclick_types, + 'options[6]' => &$this->overflows, + ),'',$preserv,2); } /** diff --git a/etemplate/setup/etemplates.inc.php b/etemplate/setup/etemplates.inc.php index bdadc60e9e..2c0e4039f4 100644 --- a/etemplate/setup/etemplates.inc.php +++ b/etemplate/setup/etemplates.inc.php @@ -1,5 +1,5 @@ 'etemplate.editor.widget','template' => '','lang $templ_data[] = array('name' => 'etemplate.editor.widget.generic','template' => '','lang' => '','group' => '0','version' => '1.0.1.001','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:6:{i:0;a:6:{s:2:"c1";s:3:"row";s:2:"c2";s:3:"row";s:2:"c3";s:3:"row";s:2:"c4";s:3:"row";s:2:"c5";s:3:"row";s:2:"h5";s:14:",!@type=button";}i:1;a:6:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"size";s:7:",,,type";s:5:"label";s:4:"Type";}s:1:"B";a:4:{s:4:"type";s:6:"select";s:4:"name";s:4:"type";s:8:"onchange";s:1:"1";s:4:"help";s:57:"type of the field (select Label if field should be empty)";}s:1:"C";a:4:{s:4:"type";s:5:"label";s:4:"size";s:7:",,,size";s:5:"label";s:7:"Options";s:5:"align";s:6:"center";}s:1:"D";a:4:{s:4:"type";s:4:"text";s:4:"size";s:2:"10";s:4:"name";s:4:"size";s:4:"help";s:187:"Label:[bold][italic] Text:[len][,max] Numbers:[min][,[max][,len]] T.area:[rows][,cols] Radiob.:value H.Rule:[width] Templ.:[IndexInContent] Select:[multiselect] Date:[values: eg. \'Y-m-d\']";}s:1:"E";a:4:{s:4:"type";s:5:"label";s:4:"size";s:7:",,,span";s:5:"label";s:11:"Span, Class";s:5:"align";s:6:"center";}s:1:"F";a:4:{s:4:"type";s:4:"text";s:4:"size";s:2:"10";s:4:"name";s:4:"span";s:4:"help";s:111:"number of colums the field/cell should span or \'all\' for the remaining columns, CSS-class name (for the TD tag)";}}i:2;a:6:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"size";s:8:",,,label";s:5:"label";s:5:"Label";}s:1:"B";a:3:{s:4:"type";s:4:"text";s:4:"name";s:5:"label";s:4:"help";s:118:"displayed in front of input or input is inserted for a \'%s\' in the label (label of the Submitbutton or Image-filename)";}s:1:"C";a:6:{s:4:"type";s:8:"checkbox";s:4:"span";s:1:"2";s:5:"label";s:16:"%s NoTranslation";s:5:"align";s:6:"center";s:4:"name";s:7:"no_lang";s:4:"help";s:82:"select if content of field should not be translated (label gets always translated)";}s:1:"D";a:1:{s:4:"type";s:5:"label";}s:1:"E";a:3:{s:4:"type";s:5:"label";s:5:"label";s:5:"Align";s:5:"align";s:6:"center";}s:1:"F";a:3:{s:4:"type";s:6:"select";s:4:"name";s:5:"align";s:4:"help";s:48:"alignment of label and input-field in table-cell";}}i:3;a:6:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"size";s:7:",,,name";s:5:"label";s:4:"Name";}s:1:"B";a:3:{s:4:"type";s:4:"text";s:4:"name";s:4:"name";s:4:"help";s:78:"index/name of returned content (name of the Template, Link / Method for Image)";}s:1:"C";a:7:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"4";s:4:"span";s:1:"4";i:1;a:5:{s:4:"type";s:8:"checkbox";s:5:"label";s:9:"%s needed";s:5:"align";s:6:"center";s:4:"name";s:6:"needed";s:4:"help";s:39:"check if field has to be filled by user";}i:2;a:5:{s:4:"type";s:8:"checkbox";s:5:"label";s:11:"%s readonly";s:5:"align";s:6:"center";s:4:"name";s:8:"readonly";s:4:"help";s:94:"check if content should only be displayed but not altered (the content is not send back then!)";}i:3;a:5:{s:4:"type";s:8:"checkbox";s:5:"label";s:11:"%s disabled";s:5:"align";s:6:"center";s:4:"name";s:8:"disabled";s:4:"help";s:96:"if field is disabled an empty table-cell is displayed, for (temporal) removement of a field/cell";}i:4;a:5:{s:4:"type";s:8:"checkbox";s:5:"label";s:11:"%s onChange";s:5:"align";s:6:"center";s:4:"name";s:8:"onchange";s:4:"help";s:33:"enable JavaScript onChange submit";}}s:1:"D";a:1:{s:4:"type";s:5:"label";}s:1:"E";a:1:{s:4:"type";s:5:"label";}s:1:"F";a:1:{s:4:"type";s:5:"label";}}i:4;a:6:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"size";s:7:",,,help";s:5:"label";s:4:"Help";}s:1:"B";a:5:{s:4:"type";s:4:"text";s:4:"size";s:2:"45";s:4:"span";s:1:"3";s:4:"name";s:4:"help";s:4:"help";s:60:"displayed in statusline of browser if input-field gets focus";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:1:{s:4:"type";s:5:"label";}s:1:"E";a:4:{s:4:"type";s:5:"label";s:4:"size";s:7:",,,blur";s:5:"label";s:8:"blurText";s:5:"align";s:6:"center";}s:1:"F";a:4:{s:4:"type";s:4:"text";s:4:"size";s:2:"10";s:4:"name";s:4:"blur";s:4:"help";s:76:"this text gets displayed if the input-field is empty and has no focus (blur)";}}i:5;a:6:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"size";s:7:"onclick";s:5:"label";s:7:"onClick";}s:1:"B";a:3:{s:4:"type";s:6:"select";s:4:"name";s:12:"onclick_type";s:4:"help";s:43:"confirmation necesary or custom java-script";}s:1:"C";a:5:{s:4:"type";s:4:"text";s:4:"size";s:2:"45";s:4:"span";s:3:"all";s:4:"name";s:7:"onclick";s:4:"help";s:67:"confirmation message or custom javascript (returning true or false)";}s:1:"D";a:1:{s:4:"type";s:5:"label";}s:1:"E";a:1:{s:4:"type";s:5:"label";}s:1:"F";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:5;s:4:"cols";i:6;}}','size' => '','style' => '','modified' => '1108415433',); +$templ_data[] = array('name' => 'etemplate.editor.widget.grid','template' => '','lang' => '','group' => '0','version' => '1.0.1.001','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:5:{i:0;a:4:{s:2:"c1";s:3:"row";s:2:"c2";s:3:"row";s:2:"c3";s:3:"row";s:2:"c4";s:3:"row";}i:1;a:6:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"size";s:7:",,,type";s:5:"label";s:4:"Type";}s:1:"B";a:4:{s:4:"type";s:6:"select";s:4:"name";s:4:"type";s:8:"onchange";s:1:"1";s:4:"help";s:57:"type of the field (select Label if field should be empty)";}s:1:"C";a:4:{s:4:"type";s:5:"label";s:4:"size";s:8:",,,align";s:5:"label";s:5:"Align";s:5:"align";s:5:"right";}s:1:"D";a:3:{s:4:"type";s:6:"select";s:4:"name";s:5:"align";s:4:"help";s:48:"alignment of label and input-field in table-cell";}s:1:"E";a:4:{s:4:"type";s:5:"label";s:4:"size";s:7:",,,span";s:5:"label";s:4:"Span";s:5:"align";s:5:"right";}s:1:"F";a:4:{s:4:"type";s:4:"text";s:4:"size";s:2:"10";s:4:"name";s:4:"span";s:4:"help";s:111:"number of colums the field/cell should span or \'all\' for the remaining columns, CSS-class name (for the TD tag)";}}i:2;a:6:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"size";s:7:",,,name";s:5:"label";s:4:"Name";}s:1:"B";a:3:{s:4:"type";s:4:"text";s:4:"name";s:4:"name";s:4:"help";s:78:"index/name of returned content (name of the Template, Link / Method for Image)";}s:1:"C";a:5:{s:4:"type";s:8:"checkbox";s:5:"label";s:11:"%s disabled";s:4:"name";s:8:"disabled";s:4:"help";s:96:"if field is disabled an empty table-cell is displayed, for (temporal) removement of a field/cell";s:4:"span";s:1:"2";}s:1:"D";a:1:{s:4:"type";s:5:"label";}s:1:"E";a:4:{s:4:"type";s:5:"label";s:4:"size";s:13:",,,options[3]";s:5:"label";s:5:"Class";s:5:"align";s:5:"right";}s:1:"F";a:4:{s:4:"type";s:4:"text";s:4:"size";s:2:"10";s:4:"name";s:10:"options[3]";s:4:"help";s:27:"CSS class for the table-tag";}}i:3;a:6:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"size";s:13:",,,options[0]";s:5:"label";s:5:"Width";}s:1:"B";a:4:{s:4:"type";s:4:"text";s:4:"size";s:1:"5";s:4:"name";s:10:"options[0]";s:4:"help";s:71:" Width of the table in % or pixels for the table-tag and (optional) div";}s:1:"C";a:4:{s:4:"type";s:5:"label";s:4:"size";s:13:",,,options[1]";s:5:"label";s:6:"Height";s:5:"align";s:5:"right";}s:1:"D";a:4:{s:4:"type";s:4:"text";s:4:"size";s:1:"5";s:4:"name";s:10:"options[1]";s:4:"help";s:72:" Height of the table in % or pixels for the table-tag and (optional) div";}s:1:"E";a:4:{s:4:"type";s:5:"label";s:4:"size";s:13:",,,options[6]";s:5:"label";s:8:"Overflow";s:5:"align";s:5:"right";}s:1:"F";a:4:{s:4:"type";s:6:"select";s:7:"no_lang";s:1:"1";s:4:"name";s:10:"options[6]";s:4:"help";s:96:"what happens with overflowing content: visible (default), hidden, scroll, auto (browser decides)";}}i:4;a:6:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"size";s:13:",,,options[4]";s:5:"label";s:7:"Spacing";}s:1:"B";a:4:{s:4:"type";s:13:"select-number";s:4:"name";s:10:"options[4]";s:4:"help";s:29:"Cellspacing for the table-tag";s:4:"size";s:14:"Default,0,10,1";}s:1:"C";a:3:{s:4:"type";s:5:"label";s:4:"size";s:13:",,,options[5]";s:5:"label";s:7:"Padding";}s:1:"D";a:4:{s:4:"type";s:13:"select-number";s:4:"size";s:14:"Default,0,10,1";s:4:"name";s:10:"options[5]";s:4:"help";s:29:"Cellpadding for the table-tag";}s:1:"E";a:4:{s:4:"type";s:5:"label";s:4:"size";s:13:",,,options[2]";s:5:"label";s:6:"Border";s:5:"align";s:5:"right";}s:1:"F";a:4:{s:4:"type";s:13:"select-number";s:4:"size";s:14:"Default,0,10,1";s:4:"name";s:10:"options[2]";s:4:"help";s:39:"Border-line-thickness for the table-tag";}}}s:4:"rows";i:4;s:4:"cols";i:6;}}','size' => '','style' => '','modified' => '1116599469',); + $templ_data[] = array('name' => 'etemplate.groupbox.test','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:5:{s:4:"type";s:8:"groupbox";s:4:"size";s:1:"2";s:5:"label";s:18:"Selection grouping";i:1;a:4:{s:4:"type";s:5:"radio";s:4:"size";s:1:"1";s:5:"label";s:18:"%s selection #1 or";s:4:"name";s:9:"selection";}i:2;a:4:{s:4:"type";s:5:"radio";s:4:"size";s:1:"2";s:5:"label";s:15:"%s selection #2";s:4:"name";s:9:"selection";}}}}s:4:"rows";i:1;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1107699792',); $templ_data[] = array('name' => 'etemplate.groupbox.test-template','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:4:{s:4:"type";s:8:"groupbox";s:4:"size";s:1:"1";s:5:"label";s:8:"Template";i:1;a:2:{s:4:"type";s:8:"template";s:4:"name";s:25:"etemplate.tab_widget.test";}}}}s:4:"rows";i:1;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1107701431',); diff --git a/etemplate/setup/phpgw_de.lang b/etemplate/setup/phpgw_de.lang index 43bce36a94..cd8e13ec77 100644 --- a/etemplate/setup/phpgw_de.lang +++ b/etemplate/setup/phpgw_de.lang @@ -296,6 +296,7 @@ showing etemplate de zeigt shows / allows you to enter values into the etemplate for testing etemplate de zeigt den Inhalt / Werte an und erlaubt welche zum Testen des eTemplates einzugeben shows/displays etemplate for testing, does not save it before etemplate de zeigt eTemplate zum Testen an, speichert es NICHT davor spacing etemplate de Zellenabstand +span etemplate de Überspannt span, class etemplate de Span, Class stack etemplate de Stapel start a new search, cancel this link etemplate de neue Suche Starten, diese Verknüpfung abbrechen diff --git a/etemplate/setup/phpgw_en.lang b/etemplate/setup/phpgw_en.lang index 6b9a499b85..aa2a3867bf 100644 --- a/etemplate/setup/phpgw_en.lang +++ b/etemplate/setup/phpgw_en.lang @@ -296,6 +296,7 @@ showing etemplate en showing shows / allows you to enter values into the etemplate for testing etemplate en shows / allows you to enter values into the eTemplate for testing shows/displays etemplate for testing, does not save it before etemplate en shows/displays eTemplate for testing, does NOT save it before spacing etemplate en Spacing +span etemplate en Span span, class etemplate en Span, Class stack etemplate en Stack start a new search, cancel this link etemplate en start a new search, cancel this link diff --git a/etemplate/templates/default/editor.widget.grid.xet b/etemplate/templates/default/editor.widget.grid.xet new file mode 100644 index 0000000000..c87c474a13 --- /dev/null +++ b/etemplate/templates/default/editor.widget.grid.xet @@ -0,0 +1,61 @@ + + + + + \ No newline at end of file