openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit ef2fd07c9f91884336f139c5a0d32055bda53914
parent 102631e58ee47b595ba09edd227feb99c7c7ea5b
Author: dankert <dankert@laptop-jan>
Date:   Tue, 19 Mar 2013 19:54:45 +0100

Autosave-Funktion: Sinnvoll, wenn es in der View nur Checkboxen gibt. Wirkt bisher nur auf Checkboxen!

Diffstat:
themes/default/css/openrat.css.php | 4++++
themes/default/include/elements.ini.php | 2+-
themes/default/include/html/form.inc.php | 1+
themes/default/js/openrat.js | 26++++++++++++++++----------
themes/default/templates/group/memberships.tpl.src.xml | 36++++++++++++++++++++++++++++++++----
themes/default/templates/user/memberships.tpl.src.xml | 2+-
6 files changed, 55 insertions(+), 16 deletions(-)

diff --git a/themes/default/css/openrat.css.php b/themes/default/css/openrat.css.php @@ -1170,6 +1170,10 @@ div.content div.bottom > div.command float:right; z-index:20; } +div.content form[data-autosave='true'] div.command +{ + display: none; +} div.content > form { diff --git a/themes/default/include/elements.ini.php b/themes/default/include/elements.ini.php @@ -11,7 +11,7 @@ column = width,style,class,colspan,rowspan,header:false,title,url,action,id,na date = date dummy = focus = field:* -form = action,subaction,id,name:,target:_self,method:post,enctype:application/x-www-form-urlencoded,type:,cancel:true,label,visible:false,async:false +form = action,subaction,id,name:,target:_self,method:post,enctype:application/x-www-form-urlencoded,type:,cancel:true,label,visible:false,async:false,autosave:false frame = file,name,scrolling frameset = rows,columns frameset-page=menu diff --git a/themes/default/include/html/form.inc.php b/themes/default/include/html/form.inc.php @@ -50,6 +50,7 @@ enctype="<?php echo $attr_enctype ?>" class="<?php echo $attr_action ?>" data-async="<?php echo $attr_async?'true':'false' ?>" + data-autosave="<?php echo $attr_autosave?'true':'false' ?>" onSubmit="<?php echo $attr_tmp_submitFunction ?>"><input type="submit" class="invisible" /> <?php if ($this->isEditable() && !$this->isEditMode()) { ?> diff --git a/themes/default/js/openrat.js b/themes/default/js/openrat.js @@ -435,7 +435,7 @@ function loadView(contentEl,action,method,id ) $(this).html(""); $(this).removeClass("loader"); // OK-button Ausblenden. - $(targetEl).closest('div.panel').find('div.bottom > div.command > input').addClass('invisible'); + //$(targetEl).closest('div.panel').find('div.bottom > div.command > input').addClass('invisible'); // var msg = "Sorry but there was an error: "; //$(this).html(msg + xhr.status + " " + xhr.statusText); return; @@ -456,12 +456,12 @@ function loadView(contentEl,action,method,id ) function registerViewEvents( viewEl ) { - var $formVorhanden = $(viewEl).find('form').size() > 0; - var $formInput = $(viewEl).closest('div.panel').find('div.bottom > div.command > input'); - if ( $formVorhanden ) - $formInput.removeClass('invisible'); - else - $formInput.addClass('invisible'); +// var $formVorhanden = $(viewEl).find('form').size() > 0; +// var $formInput = $(viewEl).closest('div.panel').find('div.bottom > div.command > input'); +// if ( $formVorhanden ) +// $formInput.removeClass('invisible'); +// else +// $formInput.addClass('invisible'); if ( $('div.panel form input[type=password]').length>0 && $('#uname').attr('value')!='' ) { @@ -577,9 +577,9 @@ function registerViewEvents( viewEl ) } ); //$(viewEl).find('div.header').html('<!-- moved to window-menu -->'); - $(viewEl).find('input,select,textarea').focus( function() { - $(this).closest('div.panel').find('div.command').css('visibility','visible').fadeIn('slow'); - }); +// $(viewEl).find('input,select,textarea').focus( function() { +// $(this).closest('div.panel').find('div.command').css('visibility','visible').fadeIn('slow'); +// }); $(viewEl).find('fieldset > legend').click( function() { $(this).parent().toggleClass('open'); @@ -625,6 +625,12 @@ function registerViewEvents( viewEl ) }); $(viewEl).find('textarea').orAutoheight(); + + // Autosave in Formularen. Bei Veränderungen wird das Formular sofort abgeschickt. + $(viewEl).find('form.[data-autosave="true"] input[type="checkbox"]').click( function() { + formSubmit( $(this).closest('form') ); + }); + } diff --git a/themes/default/templates/group/memberships.tpl.src.xml b/themes/default/templates/group/memberships.tpl.src.xml @@ -1,3 +1,31 @@ -<output xmlns="http://www.openrat.de/template" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.openrat.de/template ../template.xsd"><form><window icon="user" name="GROUP_MEMBERSHIPS"><table><row class="headline"><column width="10%"></column><column><text key="name"></text></column></row><list list="memberships" extract="true"><row class="data"><column><checkbox name="var:var"></checkbox></column><column><label for="var:var"><image file="icon_user"></image><text var="name"></text></label></column></row></list></table><row><column colspan="2" class="act"><button type="ok"></button></column></row></window></form></output>- \ No newline at end of file +<output xmlns="http://www.openrat.de/template" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.openrat.de/template ../template.xsd"> + <form autosave="true"> + <table> + <row class="headline"> + <column width="10%"></column> + <column> + <text key="name"></text> + </column> + </row> + <list list="memberships" extract="true"> + <row class="data"> + <column> + <checkbox name="var:var"></checkbox> + </column> + <column> + <label for="var:var"> + <image file="icon_user"></image> + <text var="name"></text> + </label> + </column> + </row> + </list> + </table> + <row> + <column colspan="2" class="act"> + <button type="ok"></button> + </column> + </row> + </form> +</output>+ \ No newline at end of file diff --git a/themes/default/templates/user/memberships.tpl.src.xml b/themes/default/templates/user/memberships.tpl.src.xml @@ -1,6 +1,6 @@ <output xmlns="http://www.openrat.de/template" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openrat.de/template ../template.xsd"> - <form> + <form autosave="true"> <table> <row class="headline"> <column colspan="2">