From fc5c2baa455681dc63232a18ef6aff5e2cdac0ea Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 21 Mar 2006 22:13:46 +0000 Subject: [PATCH] added ablity to set onchange via content --- etemplate/inc/class.nextmatch_widget.inc.php | 5 + etemplate/inc/class.uietemplate.inc.php | 4 + etemplate/setup/etemplates.inc.php | 6 +- etemplate/templates/default/editor.styles.xet | 2 +- .../templates/default/nextmatch_widget.xet | 123 +++++++++--------- 5 files changed, 78 insertions(+), 62 deletions(-) diff --git a/etemplate/inc/class.nextmatch_widget.inc.php b/etemplate/inc/class.nextmatch_widget.inc.php index a70a8e4a5b..dccc162afb 100644 --- a/etemplate/inc/class.nextmatch_widget.inc.php +++ b/etemplate/inc/class.nextmatch_widget.inc.php @@ -38,8 +38,10 @@ * 'col_filter' => // IO array of column-name value pairs (optional for the filterheaders) * 'filter' => // IO filter, if not 'no_filter' => True * 'filter_no_lang' => True// I set no_lang for filter (=dont translate the options) + * 'filter_onchange'=> 'this.form.submit();' // I onChange action for filter, default: this.form.submit(); * 'filter2' => // IO filter2, if not 'no_filter2' => True * 'filter2_no_lang'=> True// I set no_lang for filter2 (=dont translate the options) + * 'filter2_onchange'=> 'this.form.submit();' // I onChange action for filter2, default: this.form.submit(); * 'rows' => // O content set by callback * 'total' => // O the total number of entries * 'sel_options' => // O additional or changed sel_options set by the callback and merged into $tmpl->sel_options @@ -165,6 +167,9 @@ $extension_data['old_value'] = $value = $nm_global['col_filter'][$this->last_part($name)]; return True; } + if (!$value['filter_onchange']) $value['filter_onchange'] = 'this.form.submit();'; + if (!$value['filter2_onchange']) $value['filter2_onchange'] = 'this.form.submit();'; + list($app,$class,$method) = explode('.',$value['get_rows']); if ($app && $class) { diff --git a/etemplate/inc/class.uietemplate.inc.php b/etemplate/inc/class.uietemplate.inc.php index 8b87ddac20..971814a3de 100644 --- a/etemplate/inc/class.uietemplate.inc.php +++ b/etemplate/inc/class.uietemplate.inc.php @@ -853,6 +853,10 @@ } if ($cell['onchange'] && $cell['type'] != 'button') // values != '1' can only set by a program (not in the editor so fa { + if (strchr($cell['onchange'],'$') || $cell['onchange']{0} == '@') + { + $cell['onchange'] = $this->expand_name($cell['onchange'],$show_c,$show_row,$content['.c'],$content['.row'],$content); + } $options .= ' onChange="'.($cell['onchange']=='1'?'this.form.submit();':$cell['onchange']).'"'; } } diff --git a/etemplate/setup/etemplates.inc.php b/etemplate/setup/etemplates.inc.php index 66a7bf3672..8a0b6be2bc 100644 --- a/etemplate/setup/etemplates.inc.php +++ b/etemplate/setup/etemplates.inc.php @@ -1,5 +1,5 @@ 'etemplate.editor.show','template' => '','lang' $templ_data[] = array('name' => 'etemplate.editor.show-buttons','template' => '','lang' => '','group' => '0','version' => '0.9.15.002','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:4:{s:1:"A";a:4:{s:4:"type";s:6:"button";s:5:"label";s:4:"Read";s:4:"name";s:4:"read";s:4:"help";s:49:"read eTemplate from database (for the keys above)";}s:1:"B";a:4:{s:4:"type";s:6:"button";s:5:"label";s:11:"Show Values";s:4:"name";s:6:"values";s:4:"help";s:65:"shows / allows you to enter values into the eTemplate for testing";}s:1:"C";a:4:{s:4:"type";s:6:"button";s:5:"label";s:4:"Edit";s:4:"name";s:4:"edit";s:4:"help";s:30:"edit the eTemplate spez. above";}s:1:"D";a:4:{s:4:"type";s:6:"button";s:5:"label";s:6:"Delete";s:4:"name";s:6:"delete";s:4:"help";s:33:"deletes the eTemplate spez. above";}}}s:4:"rows";i:1;s:4:"cols";i:4;}}','size' => '','style' => '','modified' => '1032907904',); -$templ_data[] = array('name' => 'etemplate.editor.styles','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:1:{s:2:"h1";s:6:",!@msg";}i:1;a:1:{s:1:"A";a:4:{s:4:"type";s:5:"label";s:4:"name";s:3:"msg";s:4:"span";s:10:",redItalic";s:7:"no_lang";s:1:"1";}}i:2;a:1:{s:1:"A";a:6:{s:4:"type";s:6:"select";s:5:"label";s:10:"CSS-Styles";s:4:"name";s:4:"from";s:8:"onchange";s:1:"1";s:7:"no_lang";s:1:"1";s:4:"help";s:60:" edit embeded CSS styles or of the applications app.css file";}}i:3;a:1:{s:1:"A";a:3:{s:4:"type";s:8:"textarea";s:4:"size";s:5:"22,70";s:4:"name";s:6:"styles";}}i:4;a:1:{s:1:"A";a:6:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"4";i:1;a:4:{s:4:"type";s:6:"button";s:5:"label";s:4:"Save";s:4:"name";s:4:"save";s:4:"help";s:42:"save the changes made and close the window";}i:2;a:4:{s:4:"type";s:6:"button";s:5:"label";s:5:"Apply";s:4:"name";s:5:"apply";s:4:"help";s:24:"applies the changes made";}i:3;a:5:{s:4:"type";s:6:"button";s:5:"label";s:6:"Cancel";s:4:"name";s:6:"cancel";s:4:"help";s:44:"closes the window without saving the changes";s:7:"onclick";s:15:"window.close();";}i:4;a:2:{s:4:"type";s:4:"html";s:4:"name";s:11:"java_script";}}}}s:4:"rows";i:4;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1109028002',); +$templ_data[] = array('name' => 'etemplate.editor.styles','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:1:{s:2:"h1";s:6:",!@msg";}i:1;a:1:{s:1:"A";a:4:{s:4:"type";s:5:"label";s:4:"name";s:3:"msg";s:4:"span";s:10:",redItalic";s:7:"no_lang";s:1:"1";}}i:2;a:1:{s:1:"A";a:6:{s:4:"type";s:6:"select";s:5:"label";s:10:"CSS-Styles";s:4:"name";s:4:"from";s:8:"onchange";s:1:"1";s:7:"no_lang";s:1:"1";s:4:"help";s:60:" edit embeded CSS styles or of the applications app.css file";}}i:3;a:1:{s:1:"A";a:3:{s:4:"type";s:8:"textarea";s:4:"size";s:5:"20,65";s:4:"name";s:6:"styles";}}i:4;a:1:{s:1:"A";a:6:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"4";i:1;a:4:{s:4:"type";s:6:"button";s:5:"label";s:4:"Save";s:4:"name";s:4:"save";s:4:"help";s:42:"save the changes made and close the window";}i:2;a:4:{s:4:"type";s:6:"button";s:5:"label";s:5:"Apply";s:4:"name";s:5:"apply";s:4:"help";s:24:"applies the changes made";}i:3;a:5:{s:4:"type";s:6:"button";s:5:"label";s:6:"Cancel";s:4:"name";s:6:"cancel";s:4:"help";s:44:"closes the window without saving the changes";s:7:"onclick";s:15:"window.close();";}i:4;a:2:{s:4:"type";s:4:"html";s:4:"name";s:11:"java_script";}}}}s:4:"rows";i:4;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1109028002',); $templ_data[] = array('name' => 'etemplate.editor.values','template' => '','lang' => '','group' => '0','version' => '0.9.13.002','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:2:{s:2:"c1";s:3:"nmh";s:2:"c2";s:3:"nmr";}i:1;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:3:"Key";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:5:"label";s:5:"Value";}}i:2;a:2:{s:1:"A";a:3:{s:4:"type";s:4:"text";s:4:"name";s:8:"$col$row";s:8:"readonly";s:1:"1";}s:1:"B";a:2:{s:4:"type";s:4:"text";s:4:"name";s:8:"$col$row";}}}s:4:"rows";i:2;s:4:"cols";i:2;}}','size' => '','style' => '','modified' => '1081094454',); @@ -136,7 +136,7 @@ $templ_data[] = array('name' => 'etemplate.nextmatch_widget.header_only','templa $templ_data[] = array('name' => 'etemplate.nextmatch_widget.nm_row','template' => '','lang' => '','group' => '0','version' => '0.9.15.006','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:9:{s:1:"A";s:2:"1%";s:1:"B";s:2:"1%";s:1:"C";s:3:"30%";s:1:"D";s:3:"30%";s:1:"F";s:3:"15%";s:1:"G";s:2:"5%";s:1:"H";s:2:"1%";s:1:"I";s:2:"1%";s:2:"c1";s:3:"nmh";}i:1;a:9:{s:1:"A";a:5:{s:4:"type";s:6:"button";s:4:"size";s:24:"first.gif,first-grey.gif";s:5:"label";s:5:"First";s:4:"name";s:5:"first";s:4:"help";s:21:"go to the first entry";}s:1:"B";a:5:{s:4:"type";s:6:"button";s:4:"size";s:22:"left.gif,left-grey.gif";s:5:"label";s:4:"Left";s:4:"name";s:4:"left";s:4:"help";s:34:"go to the previous page of entries";}s:1:"C";a:6:{s:4:"type";s:10:"select-cat";s:4:"size";s:2:"-1";s:5:"label";s:8:"Category";s:4:"name";s:6:"cat_id";s:8:"onchange";s:1:"1";s:4:"help";s:17:"select a Category";}s:1:"D";a:6:{s:4:"type";s:6:"select";s:5:"label";s:13:"@filter_label";s:5:"align";s:6:"center";s:4:"name";s:6:"filter";s:8:"onchange";s:1:"1";s:4:"help";s:12:"@filter_help";}s:1:"E";a:6:{s:4:"type";s:6:"select";s:5:"label";s:14:"@filter2_label";s:5:"align";s:5:"right";s:4:"name";s:7:"filter2";s:8:"onchange";s:1:"1";s:4:"help";s:13:"@filter2_help";}s:1:"F";a:5:{s:4:"type";s:4:"text";s:5:"align";s:5:"right";s:4:"name";s:6:"search";s:8:"onchange";s:1:"1";s:4:"help";s:28:"a pattern to be searched for";}s:1:"G";a:4:{s:4:"type";s:6:"button";s:5:"label";s:6:"Search";s:4:"name";s:12:"start_search";s:4:"help";s:19:"to start the search";}s:1:"H";a:5:{s:4:"type";s:6:"button";s:4:"size";s:24:"right.gif,right-grey.gif";s:5:"label";s:5:"Right";s:4:"name";s:5:"right";s:4:"help";s:30:"go to the next page of entries";}s:1:"I";a:5:{s:4:"type";s:6:"button";s:4:"size";s:22:"last.gif,last-grey.gif";s:5:"label";s:4:"Last";s:4:"name";s:4:"last";s:4:"help";s:20:"go to the last entry";}}}s:4:"rows";i:1;s:4:"cols";i:9;s:4:"size";s:11:"100%,,,,0,5";s:4:"span";s:11:",thinBorder";}}','size' => '100%,,,,0,5','style' => '.thinBorder { border: 1px solid black; }','modified' => '1061331789',); -$templ_data[] = array('name' => 'etemplate.nextmatch_widget.nm_row','template' => '','lang' => '','group' => '0','version' => '1.0.0.001','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:9:{s:1:"A";s:2:"1%";s:1:"B";s:2:"1%";s:1:"C";s:3:"30%";s:1:"D";s:3:"30%";s:1:"F";s:3:"15%";s:1:"G";s:2:"5%";s:1:"H";s:2:"1%";s:1:"I";s:2:"1%";s:2:"c1";s:3:"nmh";}i:1;a:9:{s:1:"A";a:5:{s:4:"type";s:6:"button";s:4:"size";s:24:"first.gif,first-grey.gif";s:5:"label";s:5:"First";s:4:"name";s:5:"first";s:4:"help";s:21:"go to the first entry";}s:1:"B";a:5:{s:4:"type";s:6:"button";s:4:"size";s:22:"left.gif,left-grey.gif";s:5:"label";s:4:"Left";s:4:"name";s:4:"left";s:4:"help";s:34:"go to the previous page of entries";}s:1:"C";a:6:{s:4:"type";s:10:"select-cat";s:4:"size";s:2:"-1";s:5:"label";s:8:"Category";s:4:"name";s:6:"cat_id";s:8:"onchange";s:1:"1";s:4:"help";s:17:"select a Category";}s:1:"D";a:6:{s:4:"type";s:6:"select";s:5:"label";s:13:"@filter_label";s:5:"align";s:6:"center";s:4:"name";s:6:"filter";s:8:"onchange";s:1:"1";s:4:"help";s:12:"@filter_help";}s:1:"E";a:6:{s:4:"type";s:6:"select";s:5:"label";s:14:"@filter2_label";s:5:"align";s:5:"right";s:4:"name";s:7:"filter2";s:8:"onchange";s:1:"1";s:4:"help";s:13:"@filter2_help";}s:1:"F";a:5:{s:4:"type";s:4:"text";s:5:"align";s:5:"right";s:4:"name";s:6:"search";s:8:"onchange";s:1:"1";s:4:"help";s:28:"a pattern to be searched for";}s:1:"G";a:4:{s:4:"type";s:6:"button";s:5:"label";s:6:"Search";s:4:"name";s:12:"start_search";s:4:"help";s:19:"to start the search";}s:1:"H";a:5:{s:4:"type";s:6:"button";s:4:"size";s:24:"right.gif,right-grey.gif";s:5:"label";s:5:"Right";s:4:"name";s:5:"right";s:4:"help";s:30:"go to the next page of entries";}s:1:"I";a:5:{s:4:"type";s:6:"button";s:4:"size";s:22:"last.gif,last-grey.gif";s:5:"label";s:4:"Last";s:4:"name";s:4:"last";s:4:"help";s:20:"go to the last entry";}}}s:4:"rows";i:1;s:4:"cols";i:9;s:4:"size";s:11:"100%,,,,0,5";s:4:"span";s:11:",thinBorder";}}','size' => '100%,,,,0,5','style' => '.thinBorder { border: 1px solid black; }','modified' => '1113294054',); +$templ_data[] = array('name' => 'etemplate.nextmatch_widget.nm_row','template' => '','lang' => '','group' => '0','version' => '1.0.0.001','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:9:{s:1:"A";s:2:"1%";s:1:"B";s:2:"1%";s:1:"C";s:3:"30%";s:1:"D";s:3:"30%";s:1:"F";s:3:"15%";s:1:"G";s:2:"5%";s:1:"H";s:2:"1%";s:1:"I";s:2:"1%";s:2:"c1";s:3:"nmh";}i:1;a:9:{s:1:"A";a:5:{s:4:"type";s:6:"button";s:4:"size";s:24:"first.gif,first-grey.gif";s:5:"label";s:5:"First";s:4:"name";s:5:"first";s:4:"help";s:21:"go to the first entry";}s:1:"B";a:5:{s:4:"type";s:6:"button";s:4:"size";s:22:"left.gif,left-grey.gif";s:5:"label";s:4:"Left";s:4:"name";s:4:"left";s:4:"help";s:34:"go to the previous page of entries";}s:1:"C";a:6:{s:4:"type";s:10:"select-cat";s:4:"size";s:2:"-1";s:5:"label";s:8:"Category";s:4:"name";s:6:"cat_id";s:8:"onchange";s:1:"1";s:4:"help";s:17:"select a Category";}s:1:"D";a:6:{s:4:"type";s:6:"select";s:5:"label";s:13:"@filter_label";s:5:"align";s:6:"center";s:4:"name";s:6:"filter";s:8:"onchange";s:16:"@filter_onchange";s:4:"help";s:12:"@filter_help";}s:1:"E";a:6:{s:4:"type";s:6:"select";s:5:"label";s:14:"@filter2_label";s:5:"align";s:5:"right";s:4:"name";s:7:"filter2";s:8:"onchange";s:17:"@filter2_onchange";s:4:"help";s:13:"@filter2_help";}s:1:"F";a:5:{s:4:"type";s:4:"text";s:5:"align";s:5:"right";s:4:"name";s:6:"search";s:8:"onchange";s:1:"1";s:4:"help";s:28:"a pattern to be searched for";}s:1:"G";a:4:{s:4:"type";s:6:"button";s:5:"label";s:6:"Search";s:4:"name";s:12:"start_search";s:4:"help";s:19:"to start the search";}s:1:"H";a:5:{s:4:"type";s:6:"button";s:4:"size";s:24:"right.gif,right-grey.gif";s:5:"label";s:5:"Right";s:4:"name";s:5:"right";s:4:"help";s:30:"go to the next page of entries";}s:1:"I";a:5:{s:4:"type";s:6:"button";s:4:"size";s:22:"last.gif,last-grey.gif";s:5:"label";s:4:"Last";s:4:"name";s:4:"last";s:4:"help";s:20:"go to the last entry";}}}s:4:"rows";i:1;s:4:"cols";i:9;s:4:"size";s:11:"100%,,,,0,5";s:4:"span";s:11:",thinBorder";}}','size' => '100%,,,,0,5','style' => '.thinBorder { border: 1px solid black; }','modified' => '1113294054',); $templ_data[] = array('name' => 'etemplate.popup.manual','template' => '','lang' => '','group' => '0','version' => '1.2','data' => 'a:1:{i:0;a:5:{s:4:"type";s:6:"manual";s:4:"data";a:2:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:1;s:4:"cols";i:1;s:4:"span";s:12:",popupManual";}}','size' => '','style' => '.popupManual { position: absolute; right: 27px; top: 24px; }','modified' => '1131553453',); diff --git a/etemplate/templates/default/editor.styles.xet b/etemplate/templates/default/editor.styles.xet index eec444a216..d30357b5ff 100644 --- a/etemplate/templates/default/editor.styles.xet +++ b/etemplate/templates/default/editor.styles.xet @@ -16,7 +16,7 @@ - + diff --git a/etemplate/templates/default/nextmatch_widget.xet b/etemplate/templates/default/nextmatch_widget.xet index 24f45f44eb..2fbcd0cc25 100644 --- a/etemplate/templates/default/nextmatch_widget.xet +++ b/etemplate/templates/default/nextmatch_widget.xet @@ -1,66 +1,73 @@ - - - - - - - - - - - - - - -