Ignore:
Timestamp:
Apr 30, 2008 4:21:42 AM (5 years ago)
Author:
thomasb
Message:

Next step: introduce the application class 'rcmail' and get rid of some global vars

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/steps/mail/compose.inc

    r1315 r1344  
    2727 
    2828// remove an attachment 
    29 if ($_action=='remove-attachment' && preg_match('/^rcmfile([0-9]+)$/', $_POST['_file'], $regs)) 
     29if ($RCMAIL->action=='remove-attachment' && preg_match('/^rcmfile([0-9]+)$/', $_POST['_file'], $regs)) 
    3030{ 
    3131  $id = $regs[1]; 
     
    4040} 
    4141 
    42 if ($_action=='display-attachment' && preg_match('/^rcmfile([0-9]+)$/', $_GET['_file'], $regs)) 
     42if ($RCMAIL->action=='display-attachment' && preg_match('/^rcmfile([0-9]+)$/', $_GET['_file'], $regs)) 
    4343{ 
    4444  $id = $regs[1]; 
     
    338338function rcmail_compose_body($attrib) 
    339339{ 
    340   global $CONFIG, $OUTPUT, $MESSAGE, $compose_mode; 
     340  global $RCMAIL, $CONFIG, $OUTPUT, $MESSAGE, $compose_mode; 
    341341   
    342342  list($form_start, $form_end) = get_form_tags($attrib); 
     
    411411    } 
    412412 
    413   $tinylang = substr($_SESSION['user_lang'], 0, 2);  
     413  $tinylang = substr($_SESSION['language'], 0, 2); 
    414414  if (!file_exists('program/js/tiny_mce/langs/'.$tinylang.'.js')) 
    415415    {  
     
    456456      "googie.decorateTextarea('%s');\n". 
    457457      "%s.set_env('spellcheck', googie);", 
    458       $GLOBALS['COMM_PATH'], 
     458      $RCMAIL->comm_path, 
    459459      JQ(Q(rcube_label('checkspelling'))), 
    460460      JQ(Q(rcube_label('resumeediting'))), 
     
    463463      JQ(Q(rcube_label('nospellerrors'))), 
    464464      $lang_set, 
    465       substr($_SESSION['user_lang'], 0, 2), 
     465      substr($_SESSION['language'], 0, 2), 
    466466      $attrib['id'], 
    467467      JS_OBJECT_NAME), 'foot'); 
     
    705705function rcmail_compose_attachment_form($attrib) 
    706706{ 
    707   global $OUTPUT, $SESS_HIDDEN_FIELD; 
     707  global $OUTPUT; 
    708708 
    709709  // add ID if not given 
     
    711711    $attrib['id'] = 'rcmUploadbox'; 
    712712   
    713   // allow the following attributes to be added to the <div> tag 
    714   $attrib_str = create_attrib_string($attrib, array('id', 'class', 'style')); 
    715   $input_field = rcmail_compose_attachment_field(array()); 
    716   $label_send = rcube_label('upload'); 
    717   $label_close = rcube_label('close'); 
    718   $js_instance = JS_OBJECT_NAME; 
    719    
    720   $out = <<<EOF 
    721 <div$attrib_str> 
    722 <form action="./" method="post" enctype="multipart/form-data"> 
    723 $SESS_HIDDEN_FIELD 
    724 $input_field<br /> 
    725 <input type="button" value="$label_close" class="button" onclick="document.getElementById('$attrib[id]').style.visibility='hidden'" /> 
    726 <input type="button" value="$label_send" class="button" onclick="$js_instance.command('send-attachment', this.form)" /> 
    727 </form> 
    728 </div> 
    729 EOF; 
    730  
     713  $button = new html_inputfield(array('type' => "button", 'class' => "button")); 
     714   
     715  $out = html::div($attrib, 
     716    $OUTPUT->form_tag(array('name' => "form", 'method' => "post")) . 
     717    rcmail_compose_attachment_field(array()) . html::br() . 
     718    $button->show(rcube_label('close'), array('onclick' => "document.getElementById('$attrib[id]').style.visibility='hidden'")) . 
     719    $button->show(rcube_label('upload'), array('onclick' => JS_OBJECT_NAME . ".command('send-attachment', this.form)")) 
     720  ); 
     721   
    731722   
    732723  $OUTPUT->add_gui_object('uploadbox', $attrib['id']); 
     
    844835function get_form_tags($attrib) 
    845836{ 
    846   global $CONFIG, $OUTPUT, $MESSAGE_FORM, $SESS_HIDDEN_FIELD;   
     837  global $RCMAIL, $MESSAGE_FORM; 
    847838 
    848839  $form_start = ''; 
    849840  if (!strlen($MESSAGE_FORM)) 
    850841  { 
    851     $hiddenfields = new html_hiddenfield(array('name' => '_task', 'value' => $GLOBALS['_task'])); 
     842    $hiddenfields = new html_hiddenfield(array('name' => '_task', 'value' => $RCMAIL->task)); 
    852843    $hiddenfields->add(array('name' => '_action', 'value' => 'send')); 
    853844 
    854     $form_start = empty($attrib['form']) ? '<form name="form" action="./" method="post">' : ''; 
    855     $form_start .= "\n$SESS_HIDDEN_FIELD\n"; 
     845    $form_start = empty($attrib['form']) ? $RCMAIL->output->form_tag(array('name' => "form", 'method' => "post")) : ''; 
    856846    $form_start .= $hiddenfields->show(); 
    857847  } 
     
    861851   
    862852  if (!strlen($MESSAGE_FORM)) 
    863     $OUTPUT->add_gui_object('messageform', $form_name); 
     853    $RCMAIL->output->add_gui_object('messageform', $form_name); 
    864854   
    865855  $MESSAGE_FORM = $form_name; 
Note: See TracChangeset for help on using the changeset viewer.