thomascube
2009-10-06 01ffe039089e08fd6faaf03f4170853defd41fc8
program/js/app.js
@@ -2172,11 +2172,8 @@
      }
    // check if all files has been uploaded
    if (this.gui_objects.attachmentlist) {
      var list = this.gui_objects.attachmentlist.getElementsByTagName("li");
      for (i=0;i<list.length;i++)
        if (!String(list[i].id).match(/^rcmfile/))
          {
    for (var key in this.env.attachments) {
      if (typeof this.env.attachments[key] == 'object' && !this.env.attachments[key].complete) {
          alert(this.get_label('notuploadedwarning'));
          return false;
          }
@@ -2496,7 +2493,7 @@
        content = '<img src="'+this.env.loadingicon+'" alt="" />'+content;
      if (this.env.cancelicon)
        content = '<a title="'+this.get_label('cancel')+'" onclick="return rcmail.cancel_attachment_upload(\''+ts+'\', \''+frame_name+'\');" href="#cancelupload"><img src="'+this.env.cancelicon+'" alt="" /></a>'+content;
      this.add2attachment_list(ts, content);
      this.add2attachment_list(ts, { name:'', html:content, complete:false });
      }
    
    // set reference to the form object
@@ -2506,26 +2503,35 @@
  // add file name to attachment list
  // called from upload page
  this.add2attachment_list = function(name, content, upload_id)
  this.add2attachment_list = function(name, att, upload_id)
    {
    if (!this.gui_objects.attachmentlist)
      return false;
    
    var li = $('<li>').attr('id', name).html(att.html);
    var indicator;
    // replace indicator's li
    if (upload_id && (indicator = document.getElementById(upload_id))) {
      var li = document.createElement('li');
      $(li).attr('id', name).html(content);
      indicator.parentNode.replaceChild(li, indicator);
      } else { // add new li
      $('<li>').attr('id', name).html(content).appendTo(this.gui_objects.attachmentlist);
      li.replaceAll(indicator);
      }
    else { // add new li
      li.appendTo(this.gui_objects.attachmentlist);
    }
    if (upload_id && this.env.attachments[upload_id])
      delete this.env.attachments[upload_id];
    this.env.attachments[name] = att;
    
    return true;
    };
  this.remove_from_attachment_list = function(name)
    {
    if (this.env.attachments[name])
      delete this.env.attachments[name];
    if (!this.gui_objects.attachmentlist)
      return false;
@@ -2537,7 +2543,7 @@
  this.remove_attachment = function(name)
    {
    if (name)
    if (name && this.env.attachments[name])
      this.http_post('remove-attachment', '_file='+urlencode(name));
    return true;