openrat-cms

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

commit a354c6acd7d851bfeae5d25b960b4fe92d4d6cc9
parent aeda2c193cc68a7559ccde86246aa541b6874032
Author: dankert <devnull@localhost>
Date:   Mon,  5 Nov 2007 21:51:03 +0100

Aufruf von "addValidationError(...)" bei Eingabefehlern.

Diffstat:
actionClasses/PageAction.class.php | 5+++++
actionClasses/ProfileAction.class.php | 97+++++++++++++++++++++++++++++++++++++++++++++----------------------------------
actionClasses/ProjectAction.class.php | 46+++++++++++++++++++++++++++++++++-------------
actionClasses/TemplateAction.class.php | 17+++++++++++++++--
4 files changed, 108 insertions(+), 57 deletions(-)

diff --git a/actionClasses/PageAction.class.php b/actionClasses/PageAction.class.php @@ -312,6 +312,11 @@ class PageAction extends ObjectAction $this->page->save(); $this->addNotice($this->page->getType(),$this->page->name,'PROP_SAVED','ok'); } + else + { + $this->addValidationError('name'); + $this->callSubAction('prop'); + } } diff --git a/actionClasses/ProfileAction.class.php b/actionClasses/ProfileAction.class.php @@ -46,10 +46,18 @@ class ProfileAction extends Action $this->user->fullname = $this->getRequestVar('fullname'); $this->user->tel = $this->getRequestVar('tel' ); $this->user->desc = $this->getRequestVar('desc' ); - $this->user->style = $this->getRequestVar('style' ); - $this->user->save(); - - $this->addNotice('user',$this->user->name,'SAVED','ok'); + $this->user->style = $this->getRequestVar('style' ); + + if ( !empty($this->user->fullname) ) + { + $this->user->save(); + $this->addNotice('user',$this->user->name,'SAVED','ok'); + } + else + { + $this->addValidationError('fullname'); + $this->callSubAction('edit'); + } } @@ -70,16 +78,26 @@ class ProfileAction extends Action srand ((double)microtime()*1000003); $code = rand(); $newMail = $this->getRequestVar('mail'); - Session::set('mailChangeCode',$code ); - Session::set('mailChangeMail',$newMail); - - // E-Mail an die neue Adresse senden. - $mail = new Mail( $newMail,'mail_change_code' ); - $mail->setVar('code',$code ); - $mail->setVar('name',$this->user->getName()); - $mail->send(); - - $this->addNotice('user',$newUser->name,'mail_sent','ok'); // Meldung + + if ( empty($newMail) ) + { + // Bestätigungscode stimmt nicht. + $this->addValidationError('mail'); + $this->callSubAction('mail'); + } + else + { + Session::set('mailChangeCode',$code ); + Session::set('mailChangeMail',$newMail); + + // E-Mail an die neue Adresse senden. + $mail = new Mail( $newMail,'mail_change_code' ); + $mail->setVar('code',$code ); + $mail->setVar('name',$this->user->getName()); + $mail->send(); + + $this->addNotice('user',$newUser->name,'mail_sent','ok'); // Meldung + } } @@ -98,44 +116,39 @@ class ProfileAction extends Action $this->user->save(); $this->addNotice('user',$newUser->name,'user_saved','ok'); - } + } else { // Bestätigungscode stimmt nicht. - $this->addNotice('user',$newUser->name,'mailcode_not_match','error'); - } + $this->addValidationError('code','mailcode_not_match'); + $this->callSubAction('confirmmail'); + } } function savepw() - { - if ( $this->getRequestVar('password1') != '' && - $this->getRequestVar('password1') == $this->getRequestVar('password2') ) + { + if ( ! $this->user->checkPassword( $this->getRequestVar('act_password') ) ) + { + $this->addValidationError('act_password'); + $this->callSubAction('pwchange'); + } + elseif ( $this->getRequestVar('password1') == '' ) + { + $this->addValidationError('password1'); + $this->callSubAction('pwchange'); + } + elseif ( $this->getRequestVar('password1') != $this->getRequestVar('password2') ) + { + $this->addValidationError('password2'); + $this->callSubAction('pwchange'); + } + else { - $ok = $this->user->checkPassword( $this->getRequestVar('act_password') ); - - if ( !$ok ) - { - $this->addNotice('user',$this->user->name,'ERROR','error'); - } - else - { - $this->user->setPassword( $this->getRequestVar('password1') ); - - // E-Mail mit dem neuen Kennwort an Benutzer senden - if ( $this->hasRequestVar('mail') && !empty($this->user->mail) ) - { - // Text der E-Mail zusammenfuegen - $text = wordwrap(lang('USER_MAIL_PREFIX'),70,"\n")."\n\n".$this->getRequestVar('password1')."\n\n".wordwrap(lang('USER_MAIL_SUFFFIX'),70,"\n"); - - // Mail versenden - mail($this->user->mail,lang('USER_MAIL_SUBJECT'),$text); - } - - $this->addNotice('user',$this->user->name,'SAVED','ok'); - } + $this->user->setPassword( $this->getRequestVar('password1') ); + $this->addNotice('user',$this->user->name,'SAVED','ok'); } } diff --git a/actionClasses/ProjectAction.class.php b/actionClasses/ProjectAction.class.php @@ -20,6 +20,9 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // --------------------------------------------------------------------------- // $Log$ +// Revision 1.15 2007-11-05 20:51:03 dankert +// Aufruf von "addValidationError(...)" bei Eingabefehlern. +// // Revision 1.14 2007-10-04 21:50:37 dankert // Notiz, wenn Projekt gespeichert. // @@ -79,29 +82,36 @@ class ProjectAction extends Action function ProjectAction() { - if ( !$this->userIsAdmin() ) - die('n/a'); - if ( $this->getRequestId()!=0 ) { $this->project = new Project( $this->getRequestId() ); $this->project->load(); } + + } function save() { - $this->project->name = $this->getRequestVar('name' ); - $this->project->target_dir = $this->getRequestVar('target_dir' ); - $this->project->ftp_url = $this->getRequestVar('ftp_url' ); - $this->project->ftp_passive = $this->getRequestVar('ftp_passive' ); - $this->project->cmd_after_publish = $this->getRequestVar('cmd_after_publish' ); - $this->project->content_negotiation = $this->getRequestVar('content_negotiation'); - $this->project->cut_index = $this->getRequestVar('cut_index' ); - - $this->addNotice('project',$this->project->name,'SAVED','ok'); - $this->project->save(); // speichern + if ( $this->getRequestVar('name') != '') + { + $this->project->name = $this->getRequestVar('name' ); + $this->project->target_dir = $this->getRequestVar('target_dir' ); + $this->project->ftp_url = $this->getRequestVar('ftp_url' ); + $this->project->ftp_passive = $this->getRequestVar('ftp_passive' ); + $this->project->cmd_after_publish = $this->getRequestVar('cmd_after_publish' ); + $this->project->content_negotiation = $this->getRequestVar('content_negotiation'); + $this->project->cut_index = $this->getRequestVar('cut_index' ); + + $this->addNotice('project',$this->project->name,'SAVED','ok'); + $this->project->save(); // speichern + } + else + { + $this->addValidationError('name'); + $this->callSubAction('edit'); + } } @@ -120,6 +130,11 @@ class ProjectAction extends Action $this->project->name = $this->getRequestVar('name'); $this->project->add(); } + else + { + $this->addValidationError('name'); + $this->callSubAction('add'); + } $this->callSubAction('listing'); } @@ -193,6 +208,11 @@ class ProjectAction extends Action $this->setTemplateVar('tree_refresh',true); } + else + { + $this->addValidationError('delete'); + $this->callSubAction('remove'); + } } diff --git a/actionClasses/TemplateAction.class.php b/actionClasses/TemplateAction.class.php @@ -20,6 +20,9 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // --------------------------------------------------------------------------- // $Log$ +// Revision 1.18 2007-11-05 20:51:03 dankert +// Aufruf von "addValidationError(...)" bei Eingabefehlern. +// // Revision 1.17 2007-10-10 19:49:20 dankert // Anzeige von abh?ngigen Seiten in den Template-Eigenschaften. // @@ -254,10 +257,15 @@ class TemplateAction extends Action if ( $this->getRequestVar('name') != '' ) { $this->template->addElement( $this->getRequestVar('name'),$this->getRequestVar('description'),$this->getRequestVar('type') ); + $this->setTemplateVar('tree_refresh',true); + $this->addNotice('template',$this->template->name,'SAVED','ok'); + } + else + { + $this->addValidationError('name'); + $this->callSubAction('addel'); } - $this->setTemplateVar('tree_refresh',true); - $this->addNotice('template',$this->template->name,'SAVED','ok'); } @@ -298,6 +306,11 @@ class TemplateAction extends Action $this->addNotice('template',$copy_template->name,'COPIED','ok'); } } + else + { + $this->addValidationError('name'); + $this->callSubAction('add'); + } $this->setTemplateVar('tree_refresh',true); }