openrat-cms

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

commit 4b59c9a7d0b78197ccff9e5b84385c87159285d8
parent 69d5af804ebf127055beece0e3278ce937e347ae
Author: dankert <dankert@laptop-jan>
Date:   Mon, 18 Mar 2013 09:34:00 +0100

Dialoge: Wenn das Formular erfolgreich verarbeitet wurde, dann den Dialog schließen.

Diffstat:
themes/default/include/elements.ini.php | 2+-
themes/default/include/html/form.inc.php | 1+
themes/default/js/openrat.js | 34++++++++++++++++++++++++++++++++--
3 files changed, 34 insertions(+), 3 deletions(-)

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 +form = action,subaction,id,name:,target:_self,method:post,enctype:application/x-www-form-urlencoded,type:,cancel:true,label,visible:false,async: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 @@ -49,6 +49,7 @@ method="<?php echo $attr_method ?>" enctype="<?php echo $attr_enctype ?>" class="<?php echo $attr_action ?>" + data-async="<?php echo $attr_async ?>" 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 @@ -1,4 +1,3 @@ - // Default-Subaction var DEFAULT_CONTENT_ACTION = 'edit'; @@ -1066,6 +1065,18 @@ function formSubmit(form) $(form).closest('div.content').addClass('loader'); url += '?output=json'; params['output'] = 'json';// Irgendwie geht das nicht. + + if ( $(form).data('async')=='true') + { + // Verarbeitung erfolgt asynchron, das heißt, dass der evtl. geöffnete Dialog + // beendet wird. + $('div#dialog').html('').hide(); // Dialog beenden + + //$('div.modaldialog').fadeOut(500); + //$('div#workbench').removeClass('modal'); // Modalen Dialog beenden. + $('div#filler').fadeOut(500); // Filler beenden + } + $.ajax( { 'type':'POST',url:url, data:params, success:function(data, textStatus, jqXHR) { $(form).closest('div.content').removeClass('loader'); @@ -1137,10 +1148,29 @@ function doResponse(data,status,element) } ); var timeoutSeconds; - if ( value.status == 'ok' ) + if ( value.status == 'ok' ) // Kein Fehler? + { + // Kein Fehler timeoutSeconds = 3; + + // Nur bei synchronen Prozessen soll nach Verarbeitung der Dialog + // geschlossen werden. + if ( $(element).data('async') != 'true' ) + { + // Verarbeitung erfolgt asynchron, das heißt, dass der evtl. geöffnete Dialog + // beendet wird. + $('div#dialog').html('').hide(); // Dialog beenden + + //$('div.modaldialog').fadeOut(500); + //$('div#workbench').removeClass('modal'); // Modalen Dialog beenden. + $('div#filler').fadeOut(500); // Filler beenden + } + } else + // Server liefert Fehler zurück. + { timeoutSeconds = 8; + } // Und nach einem Timeout entfernt sich die Notice von alleine. setTimeout( function() { $(notice).fadeOut('slow').remove(); },timeoutSeconds*1000 );