ability to set the onchange attribute

This commit is contained in:
Ralf Becker 2006-03-07 23:44:21 +00:00
parent 15c845e0de
commit bd8dab6477
4 changed files with 106 additions and 44 deletions

View File

@ -81,6 +81,11 @@
'popup' => 'popup',
'custom' => 'custom',
);
var $onchange_types = array(
'' => 'nothing',
'submit' => 'submit form',
'custom' => 'custom',
);
var $extensions = '';
var $public_functions = array
@ -417,7 +422,7 @@
if ($app == 'etemplate')
{
$additional = $this->etemplate->types + $this->extensions + $this->aligns + $this->valigns +
$this->edit_menu + $this->box_menu + $this->row_menu + $this->column_menu + $this->onclick_types;
$this->edit_menu + $this->box_menu + $this->row_menu + $this->column_menu + $this->onclick_types + $this->onchange_types;
}
else // try to call the writeLangFile function of the app's ui-layer
{
@ -435,7 +440,7 @@
}
unset($ui);
}
if (empty($msg))
//if (empty($msg))
{
$msg = $this->etemplate->writeLangFile($app,'en',$additional);
}
@ -1067,6 +1072,46 @@
//echo "<p>editor::fix_set_onclick(,,widget2content=".(int)$widget2content.") widget="; _debug_array($widget); echo "content="; _debug_array($cell_content);
}
/**
* converts onchange selectbox and onchange text to one javascript call
*
* @param array &$widget reference into the widget-tree
* @param array &$cell_content cell array in content
* @param boolean $widget2content=true copy from widget to content or other direction
*/
function fix_set_onchange(&$widget,&$cell_content,$widget2content=true)
{
if ($widget2content)
{
if (!$widget['onchange'])
{
$cell_content['onchange_type'] = $cell_content['onchange'] = '';
}
elseif ($widget['onchange'] == 1 || $widget['onchange'] == 'this.form.submit();')
{
$cell_content['onchange'] = '';
$cell_content['onchange_type'] = 'submit';
}
else
{
$cell_content['onchange_type'] = 'custom';
}
}
else // content --> widget
{
if ($cell_content['onchange_type'] == 'submit' || $cell_content['onchange'] == 'this.form.submit();')
{
$widget['onchange'] = 1;
}
elseif(!$cell_content['onchange'])
{
$widget['onchange'] = 0;
}
unset($widget['onchange_type']);
}
//echo "<p>editor::fix_set_onchange(,,widget2content=".(int)$widget2content.") widget="; _debug_array($widget); echo "content="; _debug_array($cell_content);
}
/**
* edit dialog for a widget
*
@ -1159,6 +1204,7 @@
case 'goto2':
$content['cell'] = $widget;
$this->fix_set_onclick($widget,$content['cell'],true);
$this->fix_set_onchange($widget,$content['cell'],true);
break;
case '':
@ -1176,6 +1222,10 @@
{
$this->fix_set_onclick($widget,$content['cell'],false);
}
if ($content['cell']['onchange_type'] || $content['cell']['onchange'])
{
$this->fix_set_onchange($widget,$content['cell'],false);
}
// row- and column-attr for a grid
if ($parent['type'] == 'grid' && preg_match('/^([0-9]+)([A-Z]+)$/',$child_id,$matches))
{
@ -1225,6 +1275,7 @@
$content = $this->etemplate->as_array(-1);
$content['cell'] = $widget;
$this->fix_set_onclick($widget,$content['cell'],true);
$this->fix_set_onchange($widget,$content['cell'],true);
foreach($this->etemplate->db_key_cols as $var)
{
@ -1295,6 +1346,7 @@
'row_menu' => &$this->row_menu,
'column_menu'=> &$this->column_menu,
'onclick_type'=>&$this->onclick_types,
'onchange_type'=>&$this->onchange_types,
'options[6]' => &$this->overflows,
),'',$preserv,2);
}

File diff suppressed because one or more lines are too long

View File

@ -82,6 +82,7 @@ css-class name for this row, preset: 'th' = header, 'row' = alternating row, 'ro
css-styles etemplate de CSS Stile
custom etemplate de Benutzerdefiniert
custom fields etemplate de Benutzerdefinierte Felder
custom javascript for onchange etemplate de Benutzerdefiniertes Javascript für onChange
cut etemplate de Ausschneiden
date+time etemplate de Datum+Uhrzeit
datum etemplate de Datum
@ -242,6 +243,7 @@ nothing matched search criteria !!! etemplate de Nicht gefunden bei diesem Suchk
number of colums the field/cell should span or 'all' for the remaining columns, css-class name (for the td tag) etemplate de Anzahl der Spalten die ein Feld überspannt oder 'all' für die übrigen Spalten, CSS class Name (für das TD-tag)
number of rows/cols in a v/hbox, cellpadding, cellspacing etemplate de Anzahl Zeilen/Spalten der V/HBox, Innenabstand (Cellpadding), Zellenabstand (Cellspacing)
of etemplate de von
onchange etemplate de onChange
onclick etemplate de onClick
only an other version found !!! etemplate de nur eine andere Version gefunden !!!
open the online help. etemplate de Öffnet die online Hilfe.
@ -307,6 +309,7 @@ select which values to show etemplate de ausw
select year etemplate de Jahr auswählen
selectbox etemplate de Auswahlbox
sets today as date etemplate de setzt heutiges Datum
should the form be submitted or any custom javascript be executed etemplate de Soll das Formular abgeschickt werden oder beliebiges JavaScript ausgeführt werden
show etemplate de Anzeigen
show (no save) etemplate de Anzeigen (nicht speichern)
show values etemplate de Werte anzeigen
@ -319,6 +322,7 @@ 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
start new search for the above pattern etemplate de neue Suche für das obige Muster starten
submit form etemplate de Formular abschicken
submitbutton etemplate de Schaltfläche
swap etemplate de tauschen
swap widget with next one etemplate de tauscht das Widget mit dem nächsten

View File

@ -82,6 +82,7 @@ css-class name for this row, preset: 'th' = header, 'row' = alternating row, 'ro
css-styles etemplate en CSS-styles
custom etemplate en custom
custom fields etemplate en custom fields
custom javascript for onchange etemplate en custom javascript for onChange
cut etemplate en Cut
date+time etemplate en Date+Time
datum etemplate en Datum
@ -242,6 +243,7 @@ nothing matched search criteria !!! etemplate en Nothing matched search criteria
number of colums the field/cell should span or 'all' for the remaining columns, css-class name (for the td tag) etemplate en number of colums the field/cell should span or 'all' for the remaining columns, CSS-class name (for the TD tag)
number of rows/cols in a v/hbox, cellpadding, cellspacing etemplate en number of rows/cols in a V/HBox, Cellpadding, Cellspacing
of etemplate en of
onchange etemplate en onChange
onclick etemplate en onClick
only an other version found !!! etemplate en only an other Version found !!!
open the online help. etemplate en Open the online help.
@ -307,6 +309,7 @@ select which values to show etemplate en select which values to show
select year etemplate en Select Year
selectbox etemplate en Selectbox
sets today as date etemplate en sets today as date
should the form be submitted or any custom javascript be executed etemplate en Should the form be submitted or any custom javascript be executed
show etemplate en Show
show (no save) etemplate en Show (no save)
show values etemplate en Show Values
@ -319,6 +322,7 @@ 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
start new search for the above pattern etemplate en start new search for the above pattern
submit form etemplate en submit form
submitbutton etemplate en Submitbutton
swap etemplate en swap
swap widget with next one etemplate en swap widget with next one