Changeset 10061

Show
Ignore:
Timestamp:
12/01/08 08:01:48 (1 month ago)
Author:
afz
Message:

store contact message items if sending failed

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/jaws/html/gadgets/Contact/HTML.php

    r10023 r10061  
    9393        { 
    9494            $GLOBALS['app']->Session->PushSimpleResponse(_t('GLOBAL_ERROR_INCOMPLETE_FIELDS'), 'Contact'); 
     95            $GLOBALS['app']->Session->PushSimpleResponse($post, 'Contact_Data'); 
    9596            Jaws_Header::Referrer(); 
    9697        } 
     
    104105                if (!$captcha->Check()) { 
    105106                    $GLOBALS['app']->Session->PushSimpleResponse(_t('GLOBAL_CAPTCHA_ERROR_DOES_NOT_MATCH'), 'Contact'); 
     107                    $GLOBALS['app']->Session->PushSimpleResponse($post, 'Contact_Data'); 
    106108                    Jaws_Header::Referrer(); 
    107109                } 
     
    113115            if (Validate::email($post['contact_email'], true) === false) { 
    114116                $GLOBALS['app']->Session->PushSimpleResponse(_t('CONTACT_RESULT_BAD_EMAIL_ADDRESS'), 'Contact'); 
     117                $GLOBALS['app']->Session->PushSimpleResponse($post, 'Contact_Data'); 
    115118                Jaws_Header::Referrer(); 
    116119            } 
  • trunk/jaws/html/gadgets/Contact/LayoutHTML.php

    r9760 r10061  
    4949        $tpl->SetVariable('btn_send', $btnSend->Get()); 
    5050 
     51        $xss = $GLOBALS['app']->loadClass('XSS', 'Jaws_XSS'); 
     52        $last_message = $GLOBALS['app']->Session->PopSimpleResponse('Contact_Data'); 
    5153        if ($response = $GLOBALS['app']->Session->PopSimpleResponse('Contact')) { 
    5254            $tpl->SetBlock('contact/response'); 
     
    5557        } 
    5658 
    57         $xss = $GLOBALS['app']->loadClass('XSS', 'Jaws_XSS'); 
    58  
    5959        //name 
    6060        if (in_array('name', $items_array)) { 
    6161            $tpl->SetBlock('contact/name'); 
    6262            $tpl->SetVariable('lbl_name', _t('GLOBAL_NAME')); 
    63             $name = Jaws_Session_Web::GetCookie('visitor_name'); 
     63            $name = isset($last_message['contact_name'])? 
     64                    $last_message['contact_name'] : Jaws_Session_Web::GetCookie('visitor_name'); 
    6465            $tpl->SetVariable('name', isset($name)? $xss->filter($name) : ''); 
    6566            $tpl->ParseBlock('contact/name'); 
     
    7071            $tpl->SetBlock('contact/email'); 
    7172            $tpl->SetVariable('lbl_email', _t('GLOBAL_EMAIL')); 
    72             $email = Jaws_Session_Web::GetCookie('visitor_email'); 
     73            $email = isset($last_message['contact_email'])? 
     74                     $last_message['contact_email'] : Jaws_Session_Web::GetCookie('visitor_email'); 
    7375            $tpl->SetVariable('email', isset($email)? $xss->filter($email) : ''); 
    7476            $tpl->ParseBlock('contact/email'); 
     
    7981            $tpl->SetBlock('contact/company'); 
    8082            $tpl->SetVariable('lbl_company', _t('CONTACT_COMPANY')); 
     83            $company = isset($last_message['contact_company'])? $last_message['contact_company'] : ''; 
     84            $tpl->SetVariable('company', $xss->filter($company)); 
    8185            $tpl->ParseBlock('contact/company'); 
    8286        } 
     
    8690            $tpl->SetBlock('contact/url'); 
    8791            $tpl->SetVariable('lbl_url', _t('GLOBAL_URL')); 
    88             $url = Jaws_Session_Web::GetCookie('visitor_url'); 
     92            $url = isset($last_message['contact_url'])? 
     93                   $last_message['contact_url'] : Jaws_Session_Web::GetCookie('visitor_url'); 
    8994            $tpl->SetVariable('url', isset($url)? $xss->filter($url) : 'http://'); 
    9095            $tpl->ParseBlock('contact/url'); 
     
    95100            $tpl->SetBlock('contact/tel'); 
    96101            $tpl->SetVariable('lbl_tel', _t('CONTACT_TEL')); 
     102            $tel = isset($last_message['contact_tel'])? $last_message['contact_tel'] : ''; 
     103            $tpl->SetVariable('tel', $xss->filter($tel)); 
    97104            $tpl->ParseBlock('contact/tel'); 
    98105        } 
     
    102109            $tpl->SetBlock('contact/fax'); 
    103110            $tpl->SetVariable('lbl_fax', _t('CONTACT_FAX')); 
     111            $fax = isset($last_message['contact_fax'])? $last_message['contact_fax'] : ''; 
     112            $tpl->SetVariable('fax', $xss->filter($fax)); 
    104113            $tpl->ParseBlock('contact/fax'); 
    105114        } 
     
    109118            $tpl->SetBlock('contact/mobile'); 
    110119            $tpl->SetVariable('lbl_mobile', _t('CONTACT_MOBILE')); 
     120            $mobile = isset($last_message['contact_mobile'])? $last_message['contact_mobile'] : ''; 
     121            $tpl->SetVariable('mobile', $xss->filter($mobile)); 
    111122            $tpl->ParseBlock('contact/mobile'); 
    112123        } 
     
    116127            $tpl->SetBlock('contact/address'); 
    117128            $tpl->SetVariable('lbl_address',  _t('CONTACT_ADDRESS')); 
     129            $address = isset($last_message['contact_address'])? $last_message['contact_address'] : ''; 
     130            $tpl->SetVariable('address', $xss->filter($address)); 
    118131            $tpl->ParseBlock('contact/address'); 
    119132        } 
     
    148161                                      'name' => $GLOBALS['app']->Registry->Get('/config/owner_name')); 
    149162            } 
     163 
     164            $rcpt = isset($last_message['contact_recipient'])? $last_message['contact_recipient'] : ''; 
    150165            foreach ($recipients as $recipient) { 
    151166                $tpl->SetBlock('contact/recipient/item'); 
    152167                $tpl->SetVariable('recipient_id',   $recipient['id']); 
    153168                $tpl->SetVariable('recipient_name', $recipient['name']); 
     169                $tpl->SetVariable('selected', ($rcpt== $recipient['id'])? 'selected="selected"': ''); 
    154170                $tpl->ParseBlock('contact/recipient/item'); 
    155171            } 
     
    161177            $tpl->SetBlock('contact/subject'); 
    162178            $tpl->SetVariable('lbl_subject',  _t('CONTACT_SUBJECT')); 
     179            $subject = isset($last_message['contact_subject'])? $last_message['contact_subject'] : ''; 
     180            $tpl->SetVariable('subject', $xss->filter($subject)); 
    163181            $tpl->ParseBlock('contact/subject'); 
    164182        } 
     
    168186            $tpl->SetBlock('contact/message'); 
    169187            $tpl->SetVariable('lbl_message',  _t('CONTACT_MESSAGE')); 
     188            $message = isset($last_message['contact_message'])? $last_message['contact_message'] : ''; 
     189            $tpl->SetVariable('message', $xss->filter($message)); 
    170190            $tpl->ParseBlock('contact/message'); 
    171191        } 
  • trunk/jaws/html/gadgets/Contact/templates/Contact.html

    r9258 r10061  
    5252      <p><label>{lbl_recipient}:</label> 
    5353          <select name="contact_recipient"> 
    54           <!-- BEGIN item --><option value="{recipient_id}">{recipient_name}</option><!-- END item --> 
     54          <!-- BEGIN item --><option value="{recipient_id}" {selected}>{recipient_name}</option><!-- END item --> 
    5555          </select> 
    5656      </p> 
     
    6262<!-- BEGIN message --> 
    6363      <p><label>{lbl_message}:</label> 
    64          <textarea name="contact_message" cols="25" rows="6"></textarea> 
     64         <textarea name="contact_message" cols="25" rows="6">{message}</textarea> 
    6565      </p> 
    6666<!-- END message -->