00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 function apply()
00026 {
00027 var msg = T_("This will copy the modified menu to the main menu.");
00028 if (confirm(msg))
00029 {
00030 SendEvent('edit_menu', 'apply');
00031 }
00032 }
00033
00034 function cancel()
00035 {
00036 var msg = T_("This will get a fresh copy of the main menu, discarding any modifications");
00037 if (confirm(msg))
00038 {
00039 SendEvent('edit_menu', 'cancel');
00040 }
00041 }
00042
00043 function update()
00044 {
00045 var form = document.edit_menu_item;
00046 var bookid = form.item_bookid.value;
00047 var caption = form.item_caption.value;
00048
00049 if (caption=='')
00050 {
00051 alert(T_("Caption cannot be empty."));
00052 form.item_caption.focus();
00053 return;
00054 }
00055
00056 var event_args = 'bookid='+bookid+';caption='+caption;
00057 SendEvent('edit_menu', 'update', event_args);
00058 }
00059
00060 function del()
00061 {
00062 var msg = T_("You are deleting this item and all its subitems.");
00063 if (confirm(msg))
00064 {
00065 SendEvent('edit_menu', 'delete');
00066 }
00067 }
00068
00069 function move_up(item_id)
00070 {
00071 SendEvent('edit_menu', 'move_up', 'item_id='+item_id);
00072 }
00073
00074 function move_down(item_id)
00075 {
00076 SendEvent('edit_menu', 'move_down', 'item_id='+item_id);
00077 }
00078
00079 function add_subitem()
00080 {
00081 var form = document.new_menu_item;
00082 var new_bookid = form.new_bookid.value;
00083 var new_caption = form.new_caption.value;
00084
00085 if (new_caption=='')
00086 {
00087 alert(T_("Please fill the Caption field."));
00088 form.new_caption.focus();
00089 return;
00090 }
00091
00092 var event_args = 'new_bookid='+new_bookid+';new_caption='+new_caption;
00093 SendEvent('edit_menu', 'add_subitem', event_args);
00094 }
00095
00096 function copy_to_cb()
00097 {
00098 var id = session.getVar('edit_menu->item_id');
00099 var bookid = session.getVar('edit_menu->item_bookid');
00100 var caption = session.getVar('edit_menu->item_caption');
00101 var item = id+':' + bookid + ':' + caption;
00102 var clipboard = session.getVar('edit_menu->clipboard');
00103 session.setVar('edit_menu->clipboard', clipboard + item + '\n');
00104
00105
00106 var msg = T_("Item 'v_item' appended to clipboard.");
00107 item = item.replace(/^[^:]*:/, '');
00108 msg = msg.replace(/v_item/, item);
00109 alert(msg);
00110 }
00111
00112 function paste_from_cb()
00113 {
00114 var clipboard = session.getVar('edit_menu->clipboard');
00115 if (clipboard=='')
00116 {
00117 alert(T_("Clipboard is empty!"));
00118 return;
00119 }
00120
00121 SendEvent('edit_menu', 'paste');
00122 }
00123
00124 function show_cb()
00125 {
00126 var clipboard = session.getVar('edit_menu->clipboard');
00127 clipboard = clipboard.replace(/^[^:]*:/, '');
00128 clipboard = clipboard.replace(/\n[^:]*:/g, '\n');
00129 if (clipboard=='')
00130 alert(T_("Clipboard is empty."));
00131 else
00132 alert(clipboard);
00133 }
00134
00135 function empty_cb()
00136 {
00137 session.setVar('edit_menu->clipboard', '');
00138 alert(T_("Clipboard is now empty."));
00139 }
00140
00141 function select_book(listbox)
00142 {
00143
00144 var idx = listbox.selectedIndex;
00145 var book_id = listbox.options[idx].value;
00146
00147
00148 document.new_menu_item.new_bookid.value = book_id;
00149 document.new_menu_item.new_caption.value = book_id;
00150 }