| | |
| | | this.env.message_commands = ['show', 'reply', 'reply-all', 'reply-list', |
| | | 'moveto', 'copy', 'delete', 'open', 'mark', 'edit', 'viewsource', |
| | | 'print', 'load-attachment', 'download-attachment', 'show-headers', 'hide-headers', 'download', |
| | | 'forward', 'forward-inline', 'forward-attachment']; |
| | | 'forward', 'forward-inline', 'forward-attachment', 'change-format']; |
| | | |
| | | if (this.env.action == 'show' || this.env.action == 'preview') { |
| | | this.enable_command(this.env.message_commands, this.env.uid); |
| | |
| | | else { |
| | | this.open_window(this.env.permaurl, 900, 900); |
| | | } |
| | | break; |
| | | |
| | | case 'change-format': |
| | | url = this.env.permaurl + '&_format=' + props; |
| | | |
| | | if (this.env.action == 'preview') |
| | | url = url.replace(/_action=show/, '_action=preview') + '&_framed=1'; |
| | | if (this.env.extwin) |
| | | url += '&_extwin=1'; |
| | | |
| | | location.href = url; |
| | | break; |
| | | |
| | | case 'menu-open': |
| | |
| | | if (!url) |
| | | url = this.env.comm_path; |
| | | |
| | | return url.replace(/_task=[a-z]+/, '_task='+task); |
| | | return url.replace(/_task=[a-z0-9_-]+/i, '_task='+task); |
| | | }; |
| | | |
| | | this.reload = function(delay) |
| | |
| | | var base = this.env.comm_path, k, param = {}; |
| | | |
| | | // overwrite task name |
| | | if (query._action.match(/([a-z]+)\/([a-z0-9-_.]+)/)) { |
| | | if (query._action.match(/([a-z0-9_-]+)\/([a-z0-9-_.]+)/)) { |
| | | query._action = RegExp.$2; |
| | | base = base.replace(/\_task=[a-z]+/, '_task='+RegExp.$1); |
| | | base = base.replace(/\_task=[a-z0-9_-]+/, '_task='+RegExp.$1); |
| | | } |
| | | |
| | | // remove undefined values |
| | |
| | | if (location_url && this.env.action != 'compose') // don't redirect on compose screen, contents might get lost (#1488926) |
| | | this.redirect(location_url); |
| | | |
| | | // 403 Forbidden response (CSRF prevention) - reload the page. |
| | | // In case there's a new valid session it will be used, otherwise |
| | | // login form will be presented (#1488960). |
| | | if (request.status == 403) { |
| | | (this.is_framed() ? parent : window).location.reload(); |
| | | return; |
| | | } |
| | | |
| | | // re-send keep-alive requests after 30 seconds |
| | | if (action == 'keep-alive') |
| | | setTimeout(function(){ ref.keep_alive(); ref.start_keepalive(); }, 30000); |