Changeset ad334a12 in github


Ignore:
Timestamp:
Oct 13, 2010 2:44:41 PM (3 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
f6aac38
Parents:
48e8b31
Message:
  • Improve displaying of UI messages (#1486977)
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    ra392125 rad334a12  
    2828- Add caching support in id2uid and uid2id functions (#1487019) 
    2929- Add SASL proxy authentication for SMTP (#1486693) 
     30- Improve displaying of UI messages (#1486977) 
    3031 
    3132RELEASE 0.4.2 
  • program/include/rcube_json_output.php

    r5c461ba rad334a12  
    135135    { 
    136136        $cmd = func_get_args(); 
    137          
     137 
    138138        if (strpos($cmd[0], 'plugin.') === 0) 
    139139          $this->callbacks[] = $cmd; 
     
    141141          $this->commands[] = $cmd; 
    142142    } 
    143      
    144      
     143 
     144 
    145145    /** 
    146146     * Add a localized label to the client environment 
     
    151151        if (count($args) == 1 && is_array($args[0])) 
    152152            $args = $args[0]; 
    153          
     153 
    154154        foreach ($args as $name) { 
    155155            $this->texts[$name] = rcube_label($name); 
     
    204204        exit; 
    205205    } 
    206      
    207      
     206 
     207 
    208208    /** 
    209209     * Send an AJAX response to the client. 
     
    214214        exit; 
    215215    } 
    216      
    217      
     216 
     217 
    218218    /** 
    219219     * Send an AJAX response with executable JS code 
     
    238238 
    239239        $rcmail = rcmail::get_instance(); 
    240         $response = array('action' => $rcmail->action, 'unlock' => (bool)$_REQUEST['_unlock']); 
    241          
     240        $response = array('action' => $rcmail->action, 'unlock' => get_input_value('_unlock', RCUBE_INPUT_GPC)); 
     241 
    242242        if (!empty($this->env)) 
    243243            $response['env'] = $this->env; 
    244            
     244 
    245245        if (!empty($this->texts)) 
    246246            $response['texts'] = $this->texts; 
     
    248248        // send function calls 
    249249        $response['exec'] = $this->get_js_commands() . $add; 
    250          
     250 
    251251        if (!empty($this->callbacks)) 
    252252            $response['callbacks'] = $this->callbacks; 
  • program/include/rcube_template.php

    re999919 rad334a12  
    5858        $this->config = $this->app->config->all(); 
    5959        $this->browser = new rcube_browser(); 
    60          
     60 
    6161        //$this->framed = $framed; 
    6262        $this->set_env('task', $task); 
     
    130130            $title = ucfirst($this->env['task']); 
    131131        } 
    132          
     132 
    133133        return $title; 
    134134    } 
     
    141141    { 
    142142        $valid = false; 
    143          
     143 
    144144        if (!empty($skin) && is_dir('skins/'.$skin) && is_readable('skins/'.$skin)) { 
    145145            $skin_path = 'skins/'.$skin; 
     
    153153        $this->app->config->set('skin_path', $skin_path); 
    154154        $this->config['skin_path'] = $skin_path; 
    155          
     155 
    156156        return $valid; 
    157157    } 
     
    227227        if (count($args) == 1 && is_array($args[0])) 
    228228          $args = $args[0]; 
    229          
     229 
    230230        foreach ($args as $name) { 
    231231            $this->command('add_label', $name, rcube_label($name)); 
     
    316316        ob_flush(); 
    317317        flush(); 
    318          
     318 
    319319        if ($exit) { 
    320320            exit; 
     
    332332    { 
    333333        // unlock interface after iframe load 
     334        $unlock = preg_replace('/[^a-z0-9]/i', '', $_GET['_unlock']); 
    334335        if ($this->framed) { 
    335             array_unshift($this->js_commands, array('set_busy', false)); 
     336            array_unshift($this->js_commands, array('set_busy', false, null, $unlock)); 
     337        } 
     338        else if ($unlock) { 
     339            array_unshift($this->js_commands, array('hide_message', $unlock)); 
    336340        } 
    337341        // write all env variables to client 
     
    339343        $js .= $this->get_js_commands() . ($this->framed ? ' }' : ''); 
    340344        $this->add_script($js, 'head_top'); 
    341          
     345 
    342346        // make sure all <form> tags have a valid request token 
    343347        $template = preg_replace_callback('/<form\s+([^>]+)>/Ui', array($this, 'alter_form_tag'), $template); 
     
    362366        $skin_path = $this->config['skin_path']; 
    363367        $plugin = false; 
    364          
     368 
    365369        $temp = explode(".", $name, 2); 
    366370        if (count($temp) > 1) { 
     
    374378            } 
    375379        } 
    376          
     380 
    377381        $path = "$skin_path/templates/$name.html"; 
    378382 
     
    388392            return false; 
    389393        } 
    390          
     394 
    391395        // replace all path references to plugins/... with the configured plugins dir 
    392396        // and /this/ to the current plugin skin directory 
     
    398402        $output = $this->parse_conditions($templ); 
    399403        $output = $this->parse_xml($output); 
    400          
     404 
    401405        // trigger generic hook where plugins can put additional content to the page 
    402406        $hook = $this->app->plugins->exec_hook("render_page", array('template' => $name, 'content' => $output)); 
     
    409413            ); 
    410414        } 
    411          
     415 
    412416        $output = $this->parse_with_globals($hook['content']); 
    413417        $this->write(trim($output)); 
     
    442446            ); 
    443447        } 
    444          
     448 
    445449        return $out; 
    446450    } 
     
    546550        return eval("return (".$this->parse_expression($condition).");"); 
    547551    } 
    548      
    549      
     552 
     553 
    550554    /** 
    551555     * Inserts hidden field with CSRF-prevention-token into POST forms 
     
    555559        $out = $matches[0]; 
    556560        $attrib  = parse_attrib_string($matches[1]); 
    557        
     561 
    558562        if (strtolower($attrib['method']) == 'post') { 
    559563            $hidden = new html_hiddenfield(array('name' => '_token', 'value' => $this->app->get_request_token())); 
    560564            $out .= "\n" . $hidden->show(); 
    561565        } 
    562        
     566 
    563567        return $out; 
    564568    } 
     
    661665                return $hook['content']; 
    662666                break; 
    663              
     667 
    664668            // define a container block 
    665669            case 'container': 
     
    707711                    $content = Q($title); 
    708712                } 
    709                  
     713 
    710714                // exec plugin hooks for this template object 
    711715                $hook = $this->app->plugins->exec_hook("template_object_$object", $attrib + array('content' => $content)); 
     
    716720                $value = $this->parse_expression($attrib['expression']); 
    717721                return eval("return Q($value);"); 
    718              
     722 
    719723            // return variable 
    720724            case 'var': 
     
    804808        if ($attrib['task']) 
    805809          $command = $attrib['task'] . '.' . $command; 
    806            
     810 
    807811        if (!$attrib['image']) { 
    808812            $attrib['image'] = $attrib['imagepas'] ? $attrib['imagepas'] : $attrib['imageact']; 
     
    940944        $hidden = $hiddenfield->show(); 
    941945      } 
    942        
     946 
    943947      if (!$content) 
    944948        $attrib['noclose'] = true; 
    945        
     949 
    946950      return html::tag('form', 
    947951        $attrib + array('action' => "./", 'method' => "get"), 
     
    949953        array('id','class','style','name','method','action','enctype','onsubmit')); 
    950954    } 
    951      
    952      
     955 
     956 
    953957    /** 
    954958     * Build a form tag with a unique request token 
     
    967971            $hidden->add(array('name' => '_action', 'value' => $attrib['action'])); 
    968972        } 
    969        
     973 
    970974        unset($attrib['task'], $attrib['request']); 
    971975        $attrib['action'] = './'; 
    972        
     976 
    973977        // we already have a <form> tag 
    974978        if ($attrib['form']) 
     
    10231027 
    10241028        $_SESSION['temp'] = true; 
    1025          
     1029 
    10261030        // save original url 
    10271031        $url = get_input_value('_url', RCUBE_INPUT_POST); 
     
    10801084        $out .= $input_url->show(); 
    10811085        $out .= $table->show(); 
    1082          
     1086 
    10831087        if ($hide_host) { 
    10841088            $out .= $input_host->show(); 
     
    11381142            unset($attrib['type'], $attrib['results']); 
    11391143        } 
    1140          
     1144 
    11411145        $input_q = new html_inputfield($attrib); 
    11421146        $out = $input_q->show(); 
  • program/js/app.js

    rbb26996 rad334a12  
    3030  this.command_handlers = {}; 
    3131  this.onloads = []; 
     32  this.messages = {}; 
    3233 
    3334  // create protected reference to myself 
     
    148149 
    149150    // tell parent window that this frame is loaded 
    150     if (this.env.framed && parent.rcmail && parent.rcmail.set_busy) 
    151       parent.rcmail.set_busy(false); 
     151    if (this.env.framed && parent.rcmail && parent.rcmail.set_busy) { 
     152      parent.rcmail.set_busy(false, null, parent.rcmail.env.frame_lock); 
     153      parent.rcmail.env.frame_lock = null; 
     154    } 
    152155 
    153156    // enable general commands 
     
    370373        // display 'loading' message on form submit 
    371374        $('form').submit(function () { 
    372           rcmail.display_message(rcmail.get_label('loading'), 'loading', true);  
     375          rcmail.display_message(rcmail.get_label('loading'), 'loading'); 
    373376        });  
    374377 
     
    845848          break; 
    846849 
    847         this.set_busy(true, 'savingmessage'); 
    848         var form = this.gui_objects.messageform; 
     850        var form = this.gui_objects.messageform, 
     851          msgid = this.set_busy(true, 'savingmessage'); 
     852 
    849853        form.target = "savetarget"; 
    850854        form._draft.value = '1'; 
     855        form.action = this.add_url(form.action, '_unlock', msgid); 
    851856        form.submit(); 
    852857        break; 
     
    863868 
    864869        // all checks passed, send message 
    865         this.set_busy(true, 'sendingmessage'); 
    866         var form = this.gui_objects.messageform; 
     870        var form = this.gui_objects.messageform, 
     871          msgid = this.set_busy(true, 'sendingmessage'); 
     872 
    867873        form.target = 'savetarget'; 
    868874        form._draft.value = ''; 
     875        form.action = this.add_url(form.action, '_unlock', msgid); 
    869876        form.submit(); 
    870877 
     
    10311038 
    10321039  // lock/unlock interface 
    1033   this.set_busy = function(a, message) 
     1040  this.set_busy = function(a, message, id) 
    10341041  { 
    10351042    if (a && message) { 
     
    10381045        msg = 'Loading...'; 
    10391046 
    1040       // @TODO: show many messages at a time (one below the other ?) 
    1041       if (this.message_type() != 'error') 
    1042         this.display_message(msg, 'loading', true); 
    1043     } 
    1044     else if (!a && this.message_type() != 'error') { 
    1045       this.hide_message(); 
     1047      id = this.display_message(msg, 'loading'); 
     1048    } 
     1049    else if (!a && id) { 
     1050      this.hide_message(id); 
    10461051    } 
    10471052 
     
    10591064    if (a && this.env.request_timeout) 
    10601065      this.request_timer = window.setTimeout(function(){ ref.request_timed_out(); }, this.env.request_timeout * 1000); 
     1066 
     1067    return id; 
    10611068  }; 
    10621069 
     
    11131120  }; 
    11141121 
     1122  // Add variable to GET string, replace old value if exists 
     1123  this.add_url = function(url, name, value) 
     1124  { 
     1125    value = urlencode(value); 
     1126 
     1127    if (/(\?.*)$/.test(url)) { 
     1128      var urldata = RegExp.$1, 
     1129        datax = RegExp('((\\?|&)'+RegExp.escape(name)+'=[^&]*)'); 
     1130 
     1131      if (datax.test(urldata)) { 
     1132        urldata = urldata.replace(datax, RegExp.$2 + name + '=' + value); 
     1133      } 
     1134      else 
     1135        urldata += '&' + name + '=' + value 
     1136 
     1137      return url.replace(/(\?.*)$/, urldata); 
     1138    } 
     1139    else 
     1140      return url + '?' + name + '=' + value; 
     1141  }; 
    11151142 
    11161143  /*********************************************************/ 
     
    17701797      this.show_contentframe(true); 
    17711798    else { 
    1772       this.set_busy(true, 'loading'); 
     1799      if (!this.env.frame_lock) 
     1800        this.env.frame_lock = this.set_busy(true, 'loading'); 
    17731801      target.location.href = this.env.comm_path+url; 
    17741802 
     
    18301858  this.filter_mailbox = function(filter) 
    18311859  { 
    1832     var search; 
     1860    var search, lock = this.set_busy(true, 'searching'); 
     1861 
    18331862    if (this.gui_objects.qsearchbox) 
    18341863      search = this.gui_objects.qsearchbox.value; 
     
    18381867    // reset vars 
    18391868    this.env.current_page = 1; 
    1840     this.set_busy(true, 'searching'); 
    18411869    this.http_request('search', '_filter='+filter 
    18421870        + (search ? '&_q='+urlencode(search) : '') 
    1843         + (this.env.mailbox ? '&_mbox='+urlencode(this.env.mailbox) : ''), true); 
     1871        + (this.env.mailbox ? '&_mbox='+urlencode(this.env.mailbox) : ''), lock); 
    18441872  }; 
    18451873 
     
    19141942 
    19151943    // send request to server 
    1916     var url = '_mbox='+urlencode(mbox)+(page ? '&_page='+page : ''); 
    1917     this.set_busy(true, 'loading'); 
    1918     this.http_request('list', url+add_url, true); 
     1944    var url = '_mbox='+urlencode(mbox)+(page ? '&_page='+page : ''), 
     1945      lock = this.set_busy(true, 'loading'); 
     1946    this.http_request('list', url+add_url, lock); 
    19191947  }; 
    19201948 
     
    23212349 
    23222350    // show wait message 
    2323     if (this.env.action=='show') { 
    2324       lock = true; 
    2325       this.set_busy(true, 'movingmessage'); 
     2351    if (this.env.action == 'show') { 
     2352      lock = this.set_busy(true, 'movingmessage'); 
    23262353    } 
    23272354    else 
     
    26562683    // lock interface if it's the active mailbox 
    26572684    if (mbox == this.env.mailbox) { 
    2658        lock = true; 
    2659        this.set_busy(true, 'loading'); 
     2685       lock = this.set_busy(true, 'loading'); 
    26602686       add_url = '&_reload=1'; 
    26612687     } 
     
    26762702    // lock interface if it's the active mailbox 
    26772703    if (mbox == this.env.mailbox) { 
    2678        lock = true; 
    2679        this.set_busy(true, 'loading'); 
     2704       lock = this.set_busy(true, 'loading'); 
    26802705       add_url = '&_reload=1'; 
    26812706     } 
     
    32413266      // reset vars 
    32423267      this.env.current_page = 1; 
    3243       this.set_busy(true, 'searching'); 
     3268      var lock = this.set_busy(true, 'searching'); 
    32443269      this.http_request('search', '_q='+urlencode(value) 
    32453270        + (this.env.mailbox ? '&_mbox='+urlencode(this.env.mailbox) : '') 
    32463271        + (this.env.source ? '&_source='+urlencode(this.env.source) : '') 
    32473272        + (this.env.group ? '&_gid='+urlencode(this.env.group) : '') 
    3248         + (addurl ? addurl : ''), true); 
     3273        + (addurl ? addurl : ''), lock); 
    32493274    } 
    32503275    return true; 
     
    32633288  this.sent_successfully = function(type, msg) 
    32643289  { 
    3265     this.display_message(msg, type, true); 
     3290    this.display_message(msg, type); 
    32663291    // before redirect we need to wait some time for Chrome (#1486177) 
    32673292    window.setTimeout(function(){ ref.list_mailbox(); }, 500); 
     
    34183443      return; 
    34193444 
    3420     this.display_message(this.get_label('searching'), 'loading', false); 
    3421     this.http_post('autocomplete', '_search='+urlencode(q)); 
     3445    var lock = this.display_message(this.get_label('searching'), 'loading'); 
     3446    this.http_post('autocomplete', '_search='+urlencode(q), lock); 
    34223447  }; 
    34233448 
     
    34283453      return; 
    34293454 
    3430     this.hide_message(); 
    34313455    this.env.contacts = results ? results : []; 
    34323456    this.ksearch_display_results(this.env.contacts); 
     
    35873611 
    35883612    // send request to server 
    3589     var url = (src ? '_source='+urlencode(src) : '') + (page ? (src?'&':'') + '_page='+page : ''); 
     3613    var url = (src ? '_source='+urlencode(src) : '') + (page ? (src?'&':'') + '_page='+page : ''), 
     3614      lock = this.set_busy(true, 'loading'); 
     3615 
    35903616    this.env.source = src; 
    35913617    this.env.group = group; 
     
    35983624      url += '&_search='+this.env.search_request; 
    35993625 
    3600     this.set_busy(true, 'loading'); 
    3601     this.http_request('list', url, true); 
     3626    this.http_request('list', url, lock); 
    36023627  }; 
    36033628 
     
    38093834 
    38103835      if (newname) { 
    3811         this.set_busy(true, 'loading'); 
     3836        var lock = this.set_busy(true, 'loading'); 
    38123837        if (this.env.group_renaming) 
    3813           this.http_post('group-rename', '_source='+urlencode(this.env.source)+'&_gid='+urlencode(this.env.group)+'&_name='+urlencode(newname), true); 
     3838          this.http_post('group-rename', '_source='+urlencode(this.env.source)+'&_gid='+urlencode(this.env.group)+'&_name='+urlencode(newname), lock); 
    38143839        else 
    3815           this.http_post('group-create', '_source='+urlencode(this.env.source)+'&_name='+urlencode(newname), true); 
     3840          this.http_post('group-create', '_source='+urlencode(this.env.source)+'&_name='+urlencode(newname), lock); 
    38163841      } 
    38173842      return false; 
     
    40224047      var newname = this.env.dstfolder==this.env.delimiter ? basename : this.env.dstfolder+this.env.delimiter+basename; 
    40234048 
    4024       this.set_busy(true, 'foldermoving'); 
    4025       this.http_post('rename-folder', '_folder_oldname='+urlencode(this.env.folder)+'&_folder_newname='+urlencode(newname), true); 
     4049      var lock = this.set_busy(true, 'foldermoving'); 
     4050      this.http_post('rename-folder', '_folder_oldname='+urlencode(this.env.folder)+'&_folder_newname='+urlencode(newname), lock); 
    40264051    } 
    40274052    this.drag_active = false; 
     
    40474072        name = this.env.folder+this.env.delimiter+name; 
    40484073 
    4049       this.set_busy(true, 'foldercreating'); 
    4050       this.http_post('create-folder', '_name='+urlencode(name), true); 
     4074      var lock = this.set_busy(true, 'foldercreating'); 
     4075      this.http_post('create-folder', '_name='+urlencode(name), lock); 
    40514076    } 
    40524077    else if (form.elements['_folder_name']) 
     
    41144139          newname = this.name_input.__parent + this.env.delimiter + newname; 
    41154140 
    4116         this.set_busy(true, 'folderrenaming'); 
    4117         this.http_post('rename-folder', '_folder_oldname='+urlencode(this.env.subscriptionrows[this.edit_folder][0])+'&_folder_newname='+urlencode(newname), true); 
     4141        var lock = this.set_busy(true, 'folderrenaming'); 
     4142        this.http_post('rename-folder', '_folder_oldname='+urlencode(this.env.subscriptionrows[this.edit_folder][0])+'&_folder_newname='+urlencode(newname), lock); 
    41184143      } 
    41194144    } 
     
    41324157 
    41334158    if (folder && confirm(this.get_label('deletefolderconfirm'))) { 
    4134       this.set_busy(true, 'folderdeleting'); 
    4135       this.http_post('delete-folder', '_mboxes='+urlencode(folder), true); 
     4159      var lock = this.set_busy(true, 'folderdeleting'); 
     4160      this.http_post('delete-folder', '_mboxes='+urlencode(folder), lock); 
    41364161      this.set_env('folder', null); 
    41374162 
     
    45024527  }; 
    45034528 
    4504   // display a system message 
    4505   this.display_message = function(msg, type, hold) 
    4506   { 
    4507     if (!this.loaded) { 
    4508       // save message in order to display after page loaded 
    4509       this.pending_message = new Array(msg, type); 
    4510       return true; 
    4511     } 
    4512  
     4529  // display a system message, list of types in common.css (below #message definition) 
     4530  this.display_message = function(msg, type) 
     4531  { 
    45134532    // pass command to parent window 
    45144533    if (this.env.framed && parent.rcmail) 
    4515       return parent.rcmail.display_message(msg, type, hold); 
    4516  
    4517     if (!this.gui_objects.message) 
     4534      return parent.rcmail.display_message(msg, type); 
     4535 
     4536    if (!this.gui_objects.message) { 
     4537      // save message in order to display after page loaded 
     4538      if (type != 'loading') 
     4539        this.pending_message = new Array(msg, type); 
    45184540      return false; 
    4519  
    4520     if (this.message_timer) 
    4521       clearTimeout(this.message_timer); 
    4522  
    4523     var cont = msg; 
    4524     if (type) 
    4525       cont = '<div class="'+type+'">'+cont+'</div>'; 
    4526  
    4527     var obj = $(this.gui_objects.message).html(cont).show(); 
    4528     this.gui_objects.message.__type = type; 
    4529  
    4530     if (type!='loading') 
    4531       obj.bind('mousedown', function(){ ref.hide_message(); return true; }); 
    4532  
    4533     if (!hold) 
    4534       this.message_timer = window.setTimeout(function(){ ref.hide_message(true); }, this.message_time); 
    4535   }; 
    4536  
    4537   // make a message row disapear 
    4538   this.hide_message = function(fade) 
    4539   { 
    4540     var msg; 
    4541     if (this.gui_objects.message) 
    4542       msg = this.gui_objects.message; 
    4543     else if (this.env.framed && parent.rcmail) 
    4544       msg = parent.rcmail.gui_objects.message; 
    4545  
    4546     if (msg) { 
    4547       $(msg).unbind()[(fade?'fadeOut':'hide')](); 
    4548       msg.__type = null; 
    4549     } 
    4550   }; 
    4551  
    4552   // get type of currently displayed message 
    4553   this.message_type = function() 
    4554   { 
    4555       if (this.gui_objects.message) 
    4556         return this.gui_objects.message.__type; 
    4557       else if (this.env.framed && parent.rcmail && parent.rcmail.gui_objects.message) 
    4558         return parent.rcmail.gui_objects.message.__type; 
     4541    } 
     4542 
     4543    type = type ? type : 'notice'; 
     4544 
     4545    var date = new Date(), 
     4546      id = type + date.getTime(); 
     4547 
     4548    // The same message of type 'loading' is already displayed 
     4549    if (type == 'loading' && this.messages[msg]) { 
     4550       this.messages[msg].elements.push(id); 
     4551       return id; 
     4552    } 
     4553 
     4554    var ref = this, 
     4555      obj = $('<div>').addClass(type).html(msg), 
     4556      cont = $(this.gui_objects.message).show(); 
     4557 
     4558    if (type == 'loading') { 
     4559      obj.appendTo(cont); 
     4560      this.messages[msg] = {'obj': obj, 'elements': [id]}; 
     4561      window.setTimeout(function() { rcmail.hide_message(id); }, this.env.request_timeout * 1000); 
     4562      return id; 
     4563    } 
     4564    else { 
     4565      obj.appendTo(cont).bind('mousedown', function(){ return ref.hide_message(obj); }); 
     4566      window.setTimeout(function(){ ref.hide_message(obj, true); }, this.message_time); 
     4567      return obj; 
     4568    } 
     4569  }; 
     4570 
     4571  // make a message to disapear 
     4572  this.hide_message = function(obj, fade) 
     4573  { 
     4574    // pass command to parent window 
     4575    if (this.env.framed && parent.rcmail) 
     4576      return parent.rcmail.hide_message(obj, fade); 
     4577 
     4578    if (typeof(obj) == 'object') { 
     4579      // custom message 
     4580      $(obj)[fade?'fadeOut':'hide'](); 
     4581    } 
     4582    else { 
     4583      // 'loading' message 
     4584      var k, n; 
     4585      for (k in this.messages) { 
     4586        for (n in this.messages[k].elements) { 
     4587          if (this.messages[k].elements[n] == obj) { 
     4588            this.messages[k].elements.splice(n, 1); 
     4589            if (!this.messages[k].elements.length) { 
     4590              this.messages[k].obj[fade?'fadeOut':'hide'](); 
     4591              delete this.messages[k]; 
     4592            } 
     4593          } 
     4594        } 
     4595      } 
     4596    } 
    45594597  }; 
    45604598 
     
    47654803  this.set_headers = function(content) 
    47664804  { 
    4767     if (this.gui_objects.all_headers_row && this.gui_objects.all_headers_box && content) { 
     4805    if (this.gui_objects.all_headers_row && this.gui_objects.all_headers_box && content) 
    47684806      $(this.gui_objects.all_headers_box).html(content).show(); 
    4769  
    4770       if (this.env.framed && parent.rcmail) 
    4771         parent.rcmail.set_busy(false); 
    4772       else 
    4773         this.set_busy(false); 
    4774     } 
    47754807  }; 
    47764808 
     
    47874819    // fetch headers only once 
    47884820    if (!this.gui_objects.all_headers_box.innerHTML) { 
    4789       this.display_message(this.get_label('loading'), 'loading', true); 
    4790       this.http_post('headers', '_uid='+this.env.uid); 
     4821      var lock = this.display_message(this.get_label('loading'), 'loading'); 
     4822      this.http_post('headers', '_uid='+this.env.uid, lock); 
    47914823    } 
    47924824  }; 
     
    48734905  { 
    48744906    var rcmail = this, 
    4875       url = '?_task=utils&_action=html2text'; 
    4876  
    4877     this.set_busy(true, 'converting'); 
     4907      url = '?_task=utils&_action=html2text', 
     4908      lock = this.set_busy(true, 'converting'); 
     4909 
    48784910    console.log('HTTP POST: ' + url); 
    48794911 
    48804912    $.ajax({ type: 'POST', url: url, data: htmlText, contentType: 'application/octet-stream', 
    4881       error: function(o) { rcmail.http_error(o); }, 
    4882       success: function(data) { rcmail.set_busy(false); $(document.getElementById(id)).val(data); console.log(data); } 
     4913      error: function(o, status, err) { rcmail.http_error(o, status, err, lock); }, 
     4914      success: function(data) { rcmail.set_busy(false, null, lock); $(document.getElementById(id)).val(data); console.log(data); } 
    48834915    }); 
    48844916  }; 
     
    48864918  this.plain2html = function(plainText, id) 
    48874919  { 
    4888     this.set_busy(true, 'converting'); 
     4920    var lock = this.set_busy(true, 'converting'); 
    48894921    $(document.getElementById(id)).val('<pre>'+plainText+'</pre>'); 
    4890     this.set_busy(false); 
     4922    this.set_busy(false, null, lock); 
    48914923  }; 
    48924924 
     
    49474979    // send request 
    49484980    console.log('HTTP GET: ' + url); 
    4949     $.get(url, { _unlock:(lock?1:0) }, function(data){ ref.http_response(data); }, 'json'); 
     4981    $.ajax({ 
     4982      type: 'GET', url: url, data: { _unlock:(lock?lock:0) }, dataType: 'json', 
     4983      success: function(data){ ref.http_response(data); }, 
     4984      error: function(o, status, err) { rcmail.http_error(o, status, err, lock); } 
     4985    }); 
    49504986  }; 
    49514987 
     
    49655001    if (postdata && typeof(postdata) == 'object') { 
    49665002      postdata._remote = 1; 
    4967       postdata._unlock = (lock ? 1 : 0); 
     5003      postdata._unlock = (lock ? lock : 0); 
    49685004    } 
    49695005    else 
    4970       postdata += (postdata ? '&' : '') + '_remote=1' + (lock ? '&_unlock=1' : ''); 
     5006      postdata += (postdata ? '&' : '') + '_remote=1' + (lock ? '&_unlock='+lock : ''); 
    49715007 
    49725008    // trigger plugin hook 
     
    49825018    // send request 
    49835019    console.log('HTTP POST: ' + url); 
    4984     $.post(url, postdata, function(data){ ref.http_response(data); }, 'json'); 
     5020    $.ajax({ 
     5021      type: 'POST', url: url, data: postdata, dataType: 'json', 
     5022      success: function(data){ ref.http_response(data); }, 
     5023      error: function(o, status, err) { rcmail.http_error(o, status, err, lock); } 
     5024    }); 
    49855025  }; 
    49865026 
     
    49885028  this.http_response = function(response) 
    49895029  { 
     5030    if (!response) 
     5031      return; 
     5032 
    49905033    if (response.unlock) 
    49915034      this.set_busy(false); 
     
    50825125    } 
    50835126 
     5127    if (response.unlock) 
     5128      this.hide_message(response.unlock); 
     5129 
    50845130    this.triggerEvent('responseafter', {response: response}); 
    50855131    this.triggerEvent('responseafter'+response.action, {response: response}); 
     
    50875133 
    50885134  // handle HTTP request errors 
    5089   this.http_error = function(request, status, err) 
     5135  this.http_error = function(request, status, err, lock) 
    50905136  { 
    50915137    var errmsg = request.statusText; 
    50925138 
    5093     this.set_busy(false); 
     5139    this.set_busy(false, null, lock); 
    50945140    request.abort(); 
    50955141 
     
    51235169      return; 
    51245170 
    5125     var addurl = '_t=' + (new Date().getTime()) + '&_mbox=' + urlencode(this.env.mailbox); 
     5171    var lock, addurl = '_t=' + (new Date().getTime()) + '&_mbox=' + urlencode(this.env.mailbox); 
    51265172 
    51275173    if (refresh) { 
    5128       this.set_busy(true, 'checkingmail'); 
     5174      lock = this.set_busy(true, 'checkingmail'); 
    51295175      addurl += '&_refresh=1'; 
    51305176      // reset check-recent interval 
     
    51395185      addurl += '&_search=' + this.env.search_request; 
    51405186 
    5141     this.http_request('check-recent', addurl, true); 
     5187    this.http_request('check-recent', addurl, lock); 
    51425188  }; 
    51435189 
  • program/js/googiespell.js

    r48e8b31 rad334a12  
    978978    // roundcube mod. 
    979979    if (window.rcmail) 
    980         rcmail.set_busy(false); 
     980        rcmail.set_busy(false, null, this.rc_msg_id); 
    981981}; 
    982982 
     
    984984    // modified by roundcube 
    985985    if (window.rcmail) 
    986             rcmail.set_busy(true, 'checking'); 
     986            this.rc_msg_id = rcmail.set_busy(true, 'checking'); 
    987987/* 
    988988    this.indicator = document.createElement('img'); 
  • program/steps/mail/sendmail.inc

    rf22ea7b rad334a12  
    2525$OUTPUT->framed = TRUE; 
    2626 
    27 $savedraft = !empty($_POST['_draft']) ? TRUE : FALSE; 
     27$savedraft = !empty($_POST['_draft']) ? true : false; 
    2828 
    2929/****** checks ********/ 
Note: See TracChangeset for help on using the changeset viewer.