📄 addressbook-js.tpl
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head> <meta http-equiv="CONTENT-TYPE" content="text/html; charset={charset}"> <title>{title}</title> <STYLE TYPE="text/css"> SELECT { font-size: {widget_font_size};} INPUT{ font-size: {widget_font_size};} TEXTAREA { font-size: {widget_font_size};} body { margin-top: 0px; margin-right: 0px; margin-left: 0px; font-family: "Arial", Helvetica, sans-serif; } #wait { visibility:hidden;} </STYLE> <script src="{include_link}"> </script> <script language="javascript"> var savedestboxes; var backtobox; var closewhenfinished; var forget_after; var submittheform; var hidetoselect; var hideccselect; var hidebccselect; var fetch_udata; var toparser; var ccparser; var bccparser; var forget; var clicked_destination; //Global variables to know if we neednt work on a given destination box //since the php framwork wants it hidden window.hidetoselect={hidetoselectjs}; window.hideccselect={hideccselectjs}; window.hidebccselect={hidebccselectjs}; //Dummy window.event_destboxes_saved=event_destboxes_saved; //@function event_userdata_got //@discussion called by the frameset upon receiving a call fromt he secondary frame telling it //the userdata is here.....we get it from the frameset and act accordingly //unhiding the textarea userdata box and seting its proper width and heigth function event_userdata_got() { document.forms["{main_form_name}"].elements['userdata'].value=unescape(window.parent.userdata); document.forms["{main_form_name}"].elements['userdata'].rows=window.parent.userdata_rows; document.forms["{main_form_name}"].elements['userdata'].cols=window.parent.userdata_cols; hider('wait',1); hider('udata',0); } //@function event_all_forgoten //@discussion Well...upon knowing we have forgoten everything we execute this code //Which checks out if some event wants us to close ourselves....if so is the case, we do it function event_all_forgoten() { if(window.closewhenfinished==1) { window.parent.close(); } hider('wait',1); } //@function event_destboxes_saved //@discussion Okay, the destinationbox data we sent in the save_destination_boxes trigger have been saved //This function lets us decide what we want to do when we are told that the data was saved, and that new email //data is here. //If an event wants us to copy all the destination box data back to the compose textboxes, we do it //If an event wants u to die after that, we do so //If an event wants the form submited to the phpn backend now, we do it as well (category select does this) //If an event wants us to remove the selected options in the destination boxes, we gladly comply function event_destboxes_saved() { //alert("The destination boxes have been saved"); window.hidetoselect={hidetoselectjs}; window.hideccselect={hideccselectjs}; window.hidebccselect={hidebccselectjs}; mover.sortSelect('nameselect[]'); if(window.backtobox==1) { window.all_to_dest(); } if(window.closewhenfinished==1) { window.parent.close(); } if(window.remove_selections==1) { if(window.hidetoselect==0 && window.remove_selections==1) { mover.update_emails(window.parent.toselectbox_email,window.parent.toselectbox_keys); mover.removeSelectedFromParser('toselectbox[]',window.toparser); mover.moveSelectedOptions('toselectbox[]','nameselect[]'); } if(window.hidebccselect==0 && window.remove_selections==1) { mover.update_emails(window.parent.bccselectbox_email,window.parent.bccselectbox_keys); mover.removeSelectedFromParser('bccselectbox[]',window.bccparser); mover.moveSelectedOptions('bccselectbox[]','nameselect[]'); } if(window.hideccselect==0 && window.remove_selections==1) { mover.update_emails(window.parent.ccselectbox_email,window.parent.ccselectbox_keys); mover.removeSelectedFromParser('ccselectbox[]',window.ccparser); mover.moveSelectedOptions('ccselectbox[]','nameselect[]'); } window.savedestboxes=1; window.remove_selections=0; hider('wait',1); } if(window.submittheform==1) { document.forms["{main_form_name}"].submit(); } window.submittheform=0; window.backtobox=0; } //@function all_to_dest //@abstract NOT AN EVENT HANDLER //@discussion This function syncronizes the data in the destination boxes to the //destination textboxes in the compose window. It does it very smartly by using //parsers which are array represented comma separated lists. So, in this case, //This function uses the selectToParser function which makes shure we dont repeat //the same address in the destination box. Of course, it expects that all emails //addresses for the destination boxes are here. That is why we only call this function //after a save_destboxes event function all_to_dest() { window.hidetoselect={hidetoselectjs}; window.hideccselect={hideccselectjs}; window.hidebccselect={hidebccselectjs}; if(window.hidetoselect==0) { mover.selectToParser('toselectbox[]',window.parent.toselectbox_keys ,window.parent.toselectbox_name ,window.parent.toselectbox_email ,window.toparser); mover.stringToTextbox(window.toparser.parse_out(),window.parent.opener.document.doit.to); } if(window.hidebccselect==0) { mover.selectToParser('bccselectbox[]',window.parent.bccselectbox_keys ,window.parent.bccselectbox_name ,window.parent.bccselectbox_email ,window.bccparser); mover.stringToTextbox(window.bccparser.parse_out(),window.parent.opener.document.doit.bcc); } if(window.hideccselect==0) { mover.selectToParser('ccselectbox[]',window.parent.ccselectbox_keys ,window.parent.ccselectbox_name ,window.parent.ccselectbox_email ,window.ccparser); mover.stringToTextbox(window.ccparser.parse_out(),window.parent.opener.document.doit.cc); } } //@function trigger_save_destboxes //@abstract A trigger to tell this thing to go save the destboxes data //@discussion triggers are functions that really go and //tell the frameset to move its ass and tell the secondary frame //to do something for us. This trigger um...triggers the save_destboxes //event which will save all data in the destination boxes in the bo class //of the phpgw backend. It previously converts all destination boxes //to GET type http vars and looks if it has to flag the backend to //completely purge a destination box (if its empty) function trigger_save_destboxes() { var str; window.hidetoselect={hidetoselectjs}; window.hideccselect={hideccselectjs}; window.hidebccselect={hidebccselectjs}; if(window.hidetoselect==0) { str=mover.option2get('toselectbox[]'); if(mover.getSize('toselectbox[]')< 1) { str=str+"&deleted[toselectbox]=true"; } } if(window.hideccselect==0) { str=str+mover.option2get('ccselectbox[]'); if(mover.getSize('ccselectbox[]')< 1) { str=str+"&deleted[ccselectbox]=true"; } } if(window.hidebccselect==0) { str=str+mover.option2get('bccselectbox[]'); if(mover.getSize('bccselectbox[]')< 1) { str=str+"&deleted[bccselectbox]=true"; } } if((window.closewhenfinished==1) && (window.forget_after==1)) { str=str+"&forget_after=1"; } window.parent.set_destboxes(str); } //@function trigger_forget //@abstract triggers the forget_destboxes event //@discussion WARNING //This event is badly named in the parent window. Should be named forget_all //Im not touching it cause it works, but well whatever... //By now you should know what this does. For the sake of the mentally chalenged //i will repeat: This calls the forget_destboxes event on the partent frameset //which will direct the secondary frame to the forget_all method on the uijsaddressbook class //in turn, that class will output an onLoad event for the body of the page it generates //which will call window.parent.destboxes_forgoten...that, in turn, calls the event_all_forgoten //which is declared and explained up there ^ .. u see? ....More Up THERE...there function trigger_forget() { window.parent.forget_destboxes(); } //@function go_triggers //@abstract Machine gun... will call all triggers flagged to GO! //@discussion //Okay now, lets go through this again: //This file declares some nasty global variables. //Understand that all of them are flags. They tell this functions, and the events above //which other functions to call. This function is called by anything in this file that //needs data updated, like when you remove elements from the destboxes, we need to know //the emails of the destinataries so that we can also remove them from the parsers which //actually will end up being the string we insert in the compose destination boxes. So the onCLick //event of the remove button, sets savedestboxes to 1, and removeselections also to 1 and calls //this go_triggers function. Thisone then, necesarily calls trigger_save_destboxes //Whcih will transform all the select boxes into GET vars and tell the frameset to //send that to the php backend through the secondary frame. The corresponding funciton //in the php backend will output the emails arrays which have whatever data we dont have //here in the emails hidden fields (which ONLY get generated when the form in this frame is submited) //Finaly, the event_saved_destboxes will be called and it will se what it needs to do upon such //notification. It checks the flags and finds that it also should remove the selected options //on the destination checkboxes. "Okay", it says, and calls all those mover.update_email function and //mover.removeSelectedFromParser functions that actually reflect what you are removing in the resulting //emails string that will go into the compose's destination textboxes (bear with me...this are the parsers).. //Now, obviously, this could get ugly if say, saveddestboxes is on, and fetch_udata is on too... //Well, thats something we leave for the caller to be carefull of. function go_triggers() { if(window.savedestboxes==1) { window.trigger_save_destboxes(); } if(window.fetch_udata) { var selidx; window.parent.get_user_data(fetch_udata); window.fetch_udata=false; } if(window.forget==1) { window.trigger_forget(); } hider("wait",0); } </script></head><body onload="//The onload function initializes the autoselect framework setUpVisual('{main_form_name}','nameselect[]','searchautocomplete'); //Makes shure that, if there is a value in the autocomplete textbox, //the nameselectbox reflects this (thats what bldUpdate does after youve //initialized obj1 with setUpVisual obj1.bldUpdate(); //Sorts the main selectbox mover.sortSelect('nameselect[]'); //This function also takes whatever is in the destination textboxes //of the compose window (if u guys change the names of them ill kill u) //and creates parsers for all of them. Parsers are cool cause they //make an array that has an email address per comma separated value //in the sourcer strings... so this allows us to do funcky suff like bellow window.toparser=new box_parser(window.parent.opener.document.doit.to.value); window.ccparser=new box_parser(window.parent.opener.document.doit.cc.value); window.bccparser=new box_parser(window.parent.opener.document.doit.bcc.value); if(window.parent.mainfirsttimeflag==1)//first time loaded { //If its our first time here //Which means the firsttime flag in the frameset is set to 1, //we also try and sync whatever is in the destination boxes with what //we have in the parser.... this allows us for stuff like: //Uopen the addressbook, select some destinataries in the to box, click done //change your mind, delete by hand a destinatary in the textbox //click addressbook again...and its gone from the corresponding selectbox as well.. //cool? ... well i think so mover.update_emails(window.parent.toselectbox_email,window.parent.toselectbox_keys); if(window.hidetoselect != 1) { mover.removeParsedFromSelect('toselectbox[]',window.toparser); } if(window.hidebccselect != 1) { mover.removeParsedFromSelect('bccselectbox[]',window.bccparser); } if(window.hideccselect != 1) { mover.removeParsedFromSelect('ccselectbox[]',window.ccparser); } window.parent.mainfirsttimeflag=0; window.savedestboxes=1; mover.selectOptionOfValue('cat_id',{selected_cat_value}); } hider('wait',1); " ><table style="width: {optimal_width}px;" cellpadding="0" border="1" cellspacing="0"> <thead> <tr> <td valign="top" align="center" bgcolor="#336699" style="width: 30%;"> <font size="-1" face="Helvetica, Arial, sans-serif" color="#ffffff"> {first_column_label} </font> <font color="#ffffff"> <br> </font> </td> <td valign="top" align="center" bgcolor="#336699" style="width: 30%"> <div align="center"> <font face="Helvetica, Arial, sans-serif" size="-1" color="#ffffff"> {second_column_label} </font> <font style="color:#ffffff; font-weight:bold;"> <br> {selected_cat_name} </font> </div> <font color="#ffffff"> <br> </font> </td> <td valign="top" style="text-align: center; background-color: rgb(51, 102, 153);" rowspan="1" colspan="3"> <div align="center"><font face="Helvetica, Arial, sans-serif" size="-1" color="#ffffff"> {third_column_label} </font> <font color="#ffffff"> <br> </font> </div> </td> </tr> <tr bgcolor="#cccccc"> <td colspan="5" valign="middle"> <div ID="wait"> <center> <font style="font-weight=bold; font-family=Helvetica,Arial,sans-serif"> Please Wait! </font> </div> </center> </td> </tr> <tr> <form name="{main_form_name}" action="{main_form_action}" method="POST" onSubmit=" "> <td rowspan="1" style="width: 30%" valign="top" align="center" bgcolor="#cccccc"> <select name="cat_id" size="30" onChange="//A cat_id selection makes us submit the whole form //We could make an event for this window.savedestboxes=1; window.submittheform=1; window.go_triggers(); "> {cats_list} <option value="-2">All (can be very slow)</option> <option value="-3">Personal</option> </select> </td> <td colspan="1" style="width: 30%" valign="top" rowspan="1" bgcolor="#cccccc"> <table style="width:100%"> <tbody> <tr> <td style="width:50%"> <input type="text" size="15" name="searchbox" value="{searchbox_value}"> </td> <td style="width:50%"> <select name="querycommand" onChange=" //Get what was selected var selidx; selidx=mover.getSelectedIdx('querycommand'); //If it was a goquery command if(this.form.elements['querycommand'][selidx].value == 'cleanquery') { //Clean the searchbox and proceed to submit this.form.searchbox.value=''; } selidx=mover.getSelectedIdx('cat_id'); if(selidx == -1) { //If no category is selected, user wants to search through the whole thing //which is the option of value -2 in the cat_id selectbox (hardcoded, look //down there) mover.selectOptionOfValue('cat_id',-2);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -