- Improved command() to call simple command functions directly

release-0.6
alecpl 15 years ago
parent 98570f6e27
commit edfe91737e

@ -484,7 +484,6 @@ function rcube_webmail()
} }
break; break;
// misc list commands
case 'list': case 'list':
if (this.task=='mail') { if (this.task=='mail') {
if (!this.env.search_request || (props && props != this.env.mailbox)) if (!this.env.search_request || (props && props != this.env.mailbox))
@ -504,17 +503,10 @@ function rcube_webmail()
} }
break; break;
case 'listgroup':
this.list_contacts(props.source, props.id);
break;
case 'load-headers': case 'load-headers':
this.load_headers(obj); this.load_headers(obj);
break; break;
case 'sort': case 'sort':
var sort_order, sort_col = props; var sort_order, sort_col = props;
@ -557,7 +549,6 @@ function rcube_webmail()
this.purge_mailbox(this.env.mailbox); this.purge_mailbox(this.env.mailbox);
break; break;
// common commands used in multiple tasks // common commands used in multiple tasks
case 'show': case 'show':
if (this.task=='mail') { if (this.task=='mail') {
@ -597,7 +588,6 @@ function rcube_webmail()
} }
break; break;
case 'save-identity':
case 'save': case 'save':
if (this.gui_objects.editform) { if (this.gui_objects.editform) {
var input_pagesize = $("input[name='_pagesize']"); var input_pagesize = $("input[name='_pagesize']");
@ -879,10 +869,6 @@ function rcube_webmail()
this.upload_file(props) this.upload_file(props)
break; break;
case 'remove-attachment':
this.remove_attachment(props);
break;
case 'insert-sig': case 'insert-sig':
this.change_identity($("[name='_from']")[0], true); this.change_identity($("[name='_from']")[0], true);
break; break;
@ -927,10 +913,6 @@ function rcube_webmail()
this.goto_url('viewsource', '&_uid='+uid+'&_mbox='+urlencode(this.env.mailbox)+'&_save=1'); this.goto_url('viewsource', '&_uid='+uid+'&_mbox='+urlencode(this.env.mailbox)+'&_save=1');
break; break;
case 'add-contact':
this.add_contact(props);
break;
// quicksearch // quicksearch
case 'search': case 'search':
if (!props && this.gui_objects.qsearchbox) if (!props && this.gui_objects.qsearchbox)
@ -951,16 +933,8 @@ function rcube_webmail()
this.list_contacts(this.env.source, this.env.group); this.list_contacts(this.env.source, this.env.group);
break; break;
case 'group-create': case 'listgroup':
this.add_contact_group(props) this.list_contacts(props.source, props.id);
break;
case 'group-rename':
this.rename_contact_group();
break;
case 'group-delete':
this.delete_contact_group();
break; break;
case 'import': case 'import':
@ -988,12 +962,6 @@ function rcube_webmail()
} }
break; break;
// collapse/expand folder
case 'collapse-folder':
if (props)
this.collapse_folder(props);
break;
// user settings commands // user settings commands
case 'preferences': case 'preferences':
this.goto_url(''); this.goto_url('');
@ -1003,41 +971,17 @@ function rcube_webmail()
this.goto_url('identities'); this.goto_url('identities');
break; break;
case 'delete-identity':
this.delete_identity();
case 'folders': case 'folders':
this.goto_url('folders'); this.goto_url('folders');
break; break;
case 'subscribe': // unified command call (command name == function name)
this.subscribe_folder(props); default:
break; var func = command.replace('-', '_');
alert(func);
case 'unsubscribe': if (this[func] && typeof this[func] == 'function')
this.unsubscribe_folder(props); this[func](props);
break;
case 'enable-threading':
this.enable_threading(props);
break;
case 'disable-threading':
this.disable_threading(props);
break;
case 'create-folder':
this.create_folder(props);
break;
case 'rename-folder':
this.rename_folder(props);
break;
case 'delete-folder':
this.delete_folder(props);
break; break;
} }
this.triggerEvent('after'+command, props); this.triggerEvent('after'+command, props);
@ -3736,7 +3680,7 @@ function rcube_webmail()
}; };
this.add_contact_group = function() this.group_create = function()
{ {
if (!this.gui_objects.folderlist || !this.env.address_sources[this.env.source].groups) if (!this.gui_objects.folderlist || !this.env.address_sources[this.env.source].groups)
return; return;
@ -3753,7 +3697,7 @@ function rcube_webmail()
this.name_input.select(); this.name_input.select();
}; };
this.rename_contact_group = function() this.group_rename = function()
{ {
if (!this.env.group || !this.gui_objects.folderlist) if (!this.env.group || !this.gui_objects.folderlist)
return; return;
@ -3773,7 +3717,7 @@ function rcube_webmail()
this.name_input.select(); this.name_input.select();
}; };
this.delete_contact_group = function() this.group_delete = function()
{ {
if (this.env.group) if (this.env.group)
this.http_post('group-delete', '_source='+urlencode(this.env.source)+'&_gid='+urlencode(this.env.group), true); this.http_post('group-delete', '_source='+urlencode(this.env.source)+'&_gid='+urlencode(this.env.group), true);
@ -3888,9 +3832,9 @@ function rcube_webmail()
this.subscription_list.row_init = function (row) { this.subscription_list.row_init = function (row) {
var anchors = row.obj.getElementsByTagName('a'); var anchors = row.obj.getElementsByTagName('a');
if (anchors[0]) if (anchors[0])
anchors[0].onclick = function() { p.rename_folder(row.id); return false; }; anchors[0].onclick = function() { p.command('rename-folder', row.id); return false; };
if (anchors[1]) if (anchors[1])
anchors[1].onclick = function() { p.delete_folder(row.id); return false; }; anchors[1].onclick = function() { p.command('delete-folder', row.id); return false; };
row.obj.onmouseover = function() { p.focus_subscription(row.id); }; row.obj.onmouseover = function() { p.focus_subscription(row.id); };
row.obj.onmouseout = function() { p.unfocus_subscription(row.id); }; row.obj.onmouseout = function() { p.unfocus_subscription(row.id); };
}; };
@ -4257,13 +4201,13 @@ function rcube_webmail()
form.elements['_folder_newname'].value = ''; form.elements['_folder_newname'].value = '';
}; };
this.subscribe_folder = function(folder) this.subscribe = function(folder)
{ {
if (folder) if (folder)
this.http_post('subscribe', '_mbox='+urlencode(folder)); this.http_post('subscribe', '_mbox='+urlencode(folder));
}; };
this.unsubscribe_folder = function(folder) this.unsubscribe = function(folder)
{ {
if (folder) if (folder)
this.http_post('unsubscribe', '_mbox='+urlencode(folder)); this.http_post('unsubscribe', '_mbox='+urlencode(folder));

Loading…
Cancel
Save