Changeset f0f98fb in github
- Timestamp:
- Jul 24, 2006 2:41:27 PM (7 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- 24053e0
- Parents:
- d52676e
- Files:
-
- 7 edited
-
CHANGELOG (modified) (1 diff)
-
index.php (modified) (1 diff)
-
program/js/app.js (modified) (11 diffs)
-
program/steps/mail/compose.inc (modified) (4 diffs)
-
program/steps/mail/sendmail.inc (modified) (5 diffs)
-
program/steps/mail/upload.inc (modified) (1 diff)
-
skins/default/templates/compose.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
CHANGELOG
rbaf1355 rf0f98fb 1 1 CHANGELOG RoundCube Webmail 2 2 --------------------------- 3 4 2006/07/24 (richs) 5 ---------- 6 - Draft window no longer reloads. It saves to an iframe in the background instead (fixes bug #1483869) 7 - Draft timer now part of program/js/app.js instead of skins/default/templates/compose.inc 8 - Draft saving now properly returns an error when saving fails 9 - Draft timer stops and resets properly when attachments are uploaded, or when saving manually 10 - Old compose session/attachments are now cleaned up when a new/forward/reply/draft is made/opened 11 3 12 4 13 2006/07/19 (thomasb) -
index.php
rbac7d17 rf0f98fb 292 292 293 293 // kill compose entry from session 294 if (isset($_SESSION['compose']))295 rcmail_compose_cleanup();294 // if (isset($_SESSION['compose'])) 295 // rcmail_compose_cleanup(); 296 296 297 297 // make sure the message count is refreshed -
program/js/app.js
rf07394f rf0f98fb 18 18 var SHIFT_KEY = 2; 19 19 var CONTROL_SHIFT_KEY = 3; 20 var DRAFT_AUTOSAVE = 10; // Minutes 20 21 21 22 var rcube_webmail_client; 23 var rcube_save_timer; 22 24 23 25 function rcube_webmail() … … 40 42 this.message_time = 5000; 41 43 this.request_timeout = 180000; 42 this. kepp_alive_interval = 60000;44 this._interval = 60000; 43 45 this.mbox_expression = new RegExp('[^0-9a-z\-_]', 'gi'); 44 46 this.env.blank_img = 'skins/default/images/blank.gif'; … … 255 257 256 258 // start interval for keep-alive/recent_check signal 257 if (this. kepp_alive_interval && this.task=='mail' && this.gui_objects.messagelist)258 this. kepp_alive_int = setInterval(this.ref+'.check_for_recent()', this.kepp_alive_interval);259 if (this._interval && this.task=='mail' && this.gui_objects.messagelist) 260 this._int = setInterval(this.ref+'.check_for_recent()', this.keep_alive_interval); 259 261 else if (this.task!='login') 260 this. kepp_alive_int = setInterval(this.ref+'.send_keep_alive()', this.kepp_alive_interval);262 this._int = setInterval(this.ref+'.send_keep_alive()', this.keep_alive_interval); 261 263 }; 262 264 … … 437 439 // get summary of all field values 438 440 this.cmp_hash = this.compose_field_hash(); 439 }; 440 441 442 // start the auto-save timer 443 this.auto_save_start(); 444 445 }; 441 446 442 447 this.init_address_input_events = function(obj) … … 914 919 915 920 case 'savedraft': 921 // Reset the auto-save timer 922 self.clearTimeout(rcube_save_timer); 923 916 924 if (!this.gui_objects.messageform) 917 925 break; 918 926 919 927 // if saving Drafts is disabled in main.inc.php 920 928 if (!this.env.drafts_mailbox) 921 929 break; 922 930 923 931 this.set_busy(true, 'savingmessage'); 924 932 var form = this.gui_objects.messageform; 933 form.target = "savetarget"; 925 934 form.submit(); 926 935 break; … … 944 953 945 954 case 'send-attachment': 955 // Reset the auto-save timer 956 self.clearTimeout(rcube_save_timer); 957 946 958 this.upload_file(props) 947 959 break; … … 1953 1965 }; 1954 1966 1955 1967 this.auto_save_start = function() 1968 { 1969 rcube_save_timer = self.setTimeout('rcmail.command("savedraft","",this)',DRAFT_AUTOSAVE * 60000); 1970 } 1971 1956 1972 this.compose_field_hash = function() 1957 1973 { … … 2053 2069 this.upload_file = function(form) 2054 2070 { 2071 2055 2072 if (!form) 2056 2073 return false; … … 2953 2970 this.display_message = function(msg, type, hold) 2954 2971 { 2972 this.set_busy(false); 2955 2973 if (!this.loaded) // save message in order to display after page loaded 2956 2974 { … … 2958 2976 return true; 2959 2977 } 2960 2978 2961 2979 if (!this.gui_objects.message) 2962 2980 return false; 2963 2981 2964 2982 if (this.message_timer) 2965 2983 clearTimeout(this.message_timer); … … 2972 2990 this.gui_objects.message.innerHTML = cont; 2973 2991 this.gui_objects.message.style.display = 'block'; 2974 2992 2975 2993 if (type!='loading') 2976 2994 this.gui_objects.message.onmousedown = function(){ this._rcube.hide_message(); return true; }; -
program/steps/mail/compose.inc
r66e2bfa rf0f98fb 23 23 require_once('Mail/mimeDecode.php'); 24 24 25 26 $MESSAGE_FORM = NULL;27 $REPLY_MESSAGE = NULL;28 $FORWARD_MESSAGE = NULL;29 $DRAFT_MESSAGE = NULL;30 31 32 if (!is_array($_SESSION['compose']))33 $_SESSION['compose'] = array('id' => uniqid(rand()));34 35 25 // remove an attachment 36 26 if ($_action=='remove-attachment' && !empty($_GET['_filename'])) … … 47 37 } 48 38 } 39 40 $MESSAGE_FORM = NULL; 41 $REPLY_MESSAGE = NULL; 42 $FORWARD_MESSAGE = NULL; 43 $DRAFT_MESSAGE = NULL; 44 45 // nothing below is called during message composition, only at "new/forward/reply/draft" initialization 46 // since there are many ways to leave the compose page improperly, it seems necessary to clean-up an old 47 // compose when a "new/forward/reply/draft" is called - otherwise the old session attachments will appear 48 49 rcmail_compose_cleanup(); 50 $_SESSION['compose'] = array('id' => uniqid(rand())); 49 51 50 52 // add some labels to client … … 377 379 $out = $form_start ? "$form_start\n" : ''; 378 380 379 // Check if a previous save was done so we can delete it upon the next save 380 if (!empty($_POST['_draft_newsaveid'])) 381 $saveid = new hiddenfield(array('name' => '_draft_saveid', 'value' => $_POST['_draft_newsaveid'])); 382 else if (strlen($DRAFT_MESSAGE['headers']->messageID) > 6) 383 $saveid = new hiddenfield(array('name' => '_draft_saveid', 'value' => str_replace(array('<','>'),"",$DRAFT_MESSAGE['headers']->messageID) )); 384 385 if ($saveid) 386 $out .= $saveid->show(); 387 388 $newsaveid = new hiddenfield(array('name' => '_draft_newsaveid', 'value' => sprintf('%s@%s', md5(uniqid('rcmail'.rand(),true)), $_SESSION['imap_host']) )); 389 $out .= $newsaveid->show(); 390 381 $saveid = new hiddenfield(array('name' => '_draft_saveid', 'value' => str_replace(array('<','>'),"",$DRAFT_MESSAGE['headers']->messageID) )); 382 $out .= $saveid->show(); 383 391 384 $drafttoggle = new hiddenfield(array('name' => '_draft', 'value' => 'yes')); 392 385 $out .= $drafttoggle->show(); … … 418 411 rcube_add_label('checking'); 419 412 } 420 413 414 $out .= '<iframe name="savetarget" src="program/blank.gif" style="width:0;height:0;visibility:hidden;"></iframe>'; 415 421 416 return $out; 422 417 } -
program/steps/mail/sendmail.inc
r5084427 rf0f98fb 66 66 $olddraftmessageid = get_input_value('_draft_saveid', RCUBE_INPUT_POST); 67 67 68 if (strlen($_POST['_draft_newsaveid']) > 3) 69 $newdraftmessageid = get_input_value('_draft_newsaveid', RCUBE_INPUT_POST); 68 $message_id = sprintf('<%s@%s>', md5(uniqid('rcmail'.rand(),true)), $_SESSION['imap_host']); 70 69 71 70 $savedraft = !empty($_POST['_draft']) ? TRUE : FALSE; 72 71 73 74 72 /****** check submission and compose message ********/ 75 73 … … 97 95 $identity_arr = rcmail_get_identity(get_input_value('_from', RCUBE_INPUT_POST)); 98 96 99 100 97 $from = $identity_arr['mailto']; 101 98 $first_to = is_array($to_address_arr[0]) ? $to_address_arr[0]['mailto'] : $mailto; 102 99 103 104 // try the message-id submitted by the compose form105 if ($newdraftmessageid)106 $message_id = sprintf('<%s>',$newdraftmessageid);107 else108 $message_id = sprintf('<%s@%s>', md5(uniqid('rcmail'.rand(),true)), $_SESSION['imap_host']);109 110 100 if (empty($identity_arr['string'])) 111 101 $identity_arr['string'] = $from; 112 113 102 114 103 // compose headers array … … 322 311 // raise error if saving failed 323 312 if (!$saved) 313 { 314 // clear the "saving message" busy status, and display failure 315 $errorout = sprintf("parent.%s.display_message('%s', '%s');", 316 $JS_OBJECT_NAME, 317 addslashes(rep_specialchars_output(rcube_label(array('name' => 'errorsaving', 'vars' => NULL)))), 318 'error'); 319 print "<html><script type=\"text/javascript\">$errorout</script></html>"; 324 320 raise_error(array('code' => 800, 325 321 'type' => 'imap', 326 322 'file' => __FILE__, 327 323 'message' => "Could not save message in $CONFIG[$store_target]"), TRUE, FALSE); 324 exit; 325 } 328 326 329 327 if ($olddraftmessageid) … … 333 331 $deleted = $IMAP->delete_message($IMAP->get_uid($a_deleteid[0],$CONFIG['drafts_mbox']),$CONFIG['drafts_mbox']); 334 332 333 // raise error if deletion of old draft failed 335 334 if (!$deleted) 336 335 raise_error(array('code' => 800, … … 343 342 if ($savedraft) 344 343 { 345 show_message('messagesaved', 'confirmation'); 346 rcmail_overwrite_action('compose'); 344 // clear the "saving message" busy status, and display success 345 $frameout = sprintf("parent.%s.display_message('%s', '%s');", 346 $JS_OBJECT_NAME, 347 addslashes(rep_specialchars_output(rcube_label(array('name' => 'messagesaved', 'vars' => NULL)))), 348 'confirmation'); 349 350 // update "_draft_saveid" on the page, which is used to delete a previous draft 351 $frameout .= 'var foundid = parent.rcube_find_object("_draft_saveid",parent.document);'; 352 $frameout .= sprintf('foundid.value = "%s";',str_replace(array('<','>'),"",$message_id)); 353 354 // update the "cmp_hash" to prevent "Unsaved changes" warning 355 $frameout .= sprintf("parent.%s.cmp_hash = parent.%s.compose_field_hash();",$JS_OBJECT_NAME,$JS_OBJECT_NAME); 356 357 // start the auto-save timer again 358 $frameout .= sprintf("parent.%s.auto_save_start();",$JS_OBJECT_NAME); 359 360 // send html page with JS calls as response 361 print "<html><script type=\"text/javascript\">$frameout</script></html>"; 362 exit; 347 363 } 348 364 else -
program/steps/mail/upload.inc
r5084427 rf0f98fb 61 61 $response 62 62 parent.$JS_OBJECT_NAME.show_attachment_form(false); 63 parent.$JS_OBJECT_NAME.auto_save_start(); 63 64 } 64 65 </script> -
skins/default/templates/compose.html
rd52676e rf0f98fb 21 21 } 22 22 23 function rcmail_auto_save()24 {25 rcmail.command('savedraft','',this);26 self.setTimeout('rcmail_auto_save()',300000);27 }28 self.setTimeout('rcmail_auto_save()',300000);29 30 23 //--> 31 24 </script>
Note: See TracChangeset
for help on using the changeset viewer.
