diff --git a/README.md b/README.md index c3f235b5..3ba107fd 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,73 @@ -NO LONGER MAINTAINED -=================== +##Exchange EWS Provider +===================== +Thank you for checking out Ericsson's Exchange EWS Provider. Ericsson and the Ericsson QA team are grateful for the help and hard work of many [contributors][contributors] like yourself. -(2014-05-08) Sorry but this add-on is no longer maintained. +Current Release Vs. Download trend is something like [this](https://rawgit.com/muthusuba/github-tools/master/downloads-trend.html?user=Ericsson&repo=exchangecalendar) + + +Getting involved as a contributor +------------------------------------------ +We love working with contributors for Exchange EWS Provider, but it does require a few skills. You will need to know some Javascript, XUL, some CSS and a basic familiarity with GitHub. + +If you know some Javascript, it's worth having a look at the Object Oriented Programming to understand the basic concepts of class based coding and especially for xul window objects. + +If you need to brush-up on programming, but are eager to start contributing immediately, please consider helping us find bugs in Github [Exchange EWS Provider][Exchange EWS Provider] or find bugs in the Issues tested by the [EricssonQA][EricssonQA] team. To brush up on Javascript skills before engaging with us, Dive Into Javascript [mozilla][mozilla] is an excellent resource. W3schools also has [notes on Javascript][w3schools] available through their website. The programming concepts you will need to know include functions, working with classes, and some object-oriented programming basics. To brush up on XUL, Mozilla [XUL][XUL] is an easy and simple place to learn XUL, More of XUL are dynamically configured and cross-plateform. + +Special thanks to all our [contributors][contributors] + +[w3schools]: http://www.w3schools.com/js/ +[mozilla]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide +[EricssonQA]: https://github.com/Ericsson/exchangecalendar/ +[Exchange EWS Provider]: https://github.com/Ericsson/exchangecalendar/issues +[XUL]: https://developer.mozilla.org/en-US/Add-ons/Overlay_Extensions/XUL_School +[contributors]: https://github.com/Ericsson/exchangecalendar/contributors + +Questions are always welcome +---------------------------- +While we take pains to keep our documentation updated, the best source of information is those of us who work on the project. We also have the [wiki][wiki] pages to answer your general questions about contributing to Exchange EWS Provider. + +[wiki]: https://github.com/Ericsson/exchangecalendar/wiki + +Getting set up +------------- +It's easy to get set up: just 2 pieces of software to install and in few command lines you'll be running the addon! + +### Install Thunderbird +If you don't already have it installed, please install latest version +https://support.mozilla.org/en-US/kb/installing-thunderbird + +### Install Lightning +If you don't already have it installed, please install latest version +https://support.mozilla.org/en-US/kb/installing-lightning-thunderbird + +### Cloning the test repository with Git +After you have installed [Git] you will need to clone the project to your hard drive. From your workspace directory run this command which will copy (clone) the project to your hard drive + + git clone --recursive git://github.com/Ericsson/exchangecalendar.git +[Git]: http://en.wikipedia.org/wiki/Git_%28software%29 + +### Installing developement tools +You will need to install Dom Inspector, Javascript Debugger and some other development tools. Fortunately `Thunderbird addons` makes it easy to install all of these: + +Now using bash we'll compile the addon we need (which are written in wiki) + + cd ./exchangecalendar_master; chmod +x ./build.sh; ./build.sh; + +Now you can install the Exchange EWS Provider addon + +Writing Code +------------- +If you want to get involved and add more code, then there's just a few things +we'd like to ask you to do: + +1. Use the similar code format for all new developement and window objects +2. Follow mozilla's simple [Coding Style Guide][Coding Style Guide] recommendations +3. Fork this project with your own GitHub account +4. Make sure all tests are passing and submit a pull request with your changes + +[Coding Style Guide]: https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style + +License +------- +This software is licensed under the [GNU GPL] Version 3 +[GNU GPL]: http://www.gnu.org/licenses/gpl.html diff --git a/build.sh b/build.sh new file mode 100755 index 00000000..b1da063b --- /dev/null +++ b/build.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +usage() { echo "Usage: $0 [-u | -d ]" 1>&2;echo "-u:enable update";echo "-d:disable update"; exit 1; } + +if [ $# = 0 ];then +usage +fi + +version=`sed -n -e "s/.*\(.*\)<\/em:version>/\1/p" install.rdf` +while getopts ":ud" OPTION +do + case ${OPTION} in + u) echo "update" + cat defaults/preferences/update_enable.txt > defaults/preferences/update.js + zip -r exchangecalendar-v$version.xpi * -x \*.git \*.xpi \*.sh update\*.txt + exit + ;; + d) echo "no update" + cat defaults/preferences/update_disable.txt > defaults/preferences/update.js + zip -r exchangecalendar-v$version.xpi * -x \*.git \*.xpi \*.sh update\*.txt + exit + ;; + *) usage ;; + esac +done + +usage + diff --git a/chrome.manifest b/chrome.manifest index f3bf46c8..ff53de49 100644 --- a/chrome.manifest +++ b/chrome.manifest @@ -1,5 +1,9 @@ content exchangecalendar chrome/content/ -skin exchangecalendar fugue chrome/skins/fugue/ +skin exchangecalendar fugue chrome/skins/unix/ +skin exchangecalendar fugue chrome/skins/win/ os=WINNT +skin exchangecalendar fugue chrome/skins/winaero/ os=WINNT osversion>=6 +skin exchangecalendar fugue chrome/skins/mac/ os=Darwin +skin exchangecalendar-common fugue chrome/skins/common/ resource exchangecalendar components/ resource interfaces interfaces/ @@ -21,10 +25,19 @@ overlay chrome://messenger/content/preferences/preferences.xul chrome://exchang overlay chrome://messenger/content/preferences/preferences.xul chrome://exchangecalendar/content/otherPreferences.xul overlay chrome://calendar/content/calendar-task-view.xul chrome://exchangecalendar/content/calendar-task-view.xul overlay chrome://communicator/content/pref/preferences.xul chrome://exchangecalendar/content/suite-overlay-preferences.xul application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} +overlay chrome://communicator/content/pref/preferences.xul chrome://exchangecalendar/content/extra-suite-preferences.xul application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} + overlay chrome://calendar/content/calendar-common-sets.xul chrome://exchangecalendar/content/calendar-common-sets.xul overlay chrome://calendar/content/calendar-event-dialog-attendees.xul chrome://exchangecalendar/content/calendar-event-dialog-attendees.xul overlay chrome://messenger/content/messenger.xul chrome://exchangecalendar/content/OutOfOfficeMenu.xul overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://exchangecalendar/content/addressingWidgetOverlay.xul +overlay chrome://messenger/content/preferences/preferences.xul chrome://exchangecalendar/content/timezonePreference.xul +overlay chrome://messenger/content/messenger.xul chrome://exchangecalendar/content/lightningtimezoneOverlay.xul +overlay chrome://messenger/content/preferences/preferences.xul chrome://exchangecalendar/content/extra-messenger-preferences.xul +overlay chrome://messenger/content/messenger.xul chrome://exchangecalendar/content/priority-display.xul +overlay chrome://messenger/content/messenger.xul chrome://exchangecalendar/content/invite-style.xul +overlay chrome://messenger/content/folderProps.xul chrome://exchangecalendar/content/folderPropsOverlay.xul +overlay chrome://messenger/content/messenger.xul chrome://exchangecalendar/content/rtews-overlay.xul locale exchangecalendar nl locale/exchangecalendar/nl/ locale exchangecalendar en-US locale/exchangecalendar/en-US/ diff --git a/chrome/content/addressingWidgetOverlay.css b/chrome/content/addressingWidgetOverlay.css deleted file mode 100644 index 2d7017c7..00000000 --- a/chrome/content/addressingWidgetOverlay.css +++ /dev/null @@ -1,12 +0,0 @@ -@import url("chrome://messenger/skin/"); - -@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); - -treechildren::-moz-tree-image(exchange-abook) { - margin-top: 2px; - margin-bottom: 2px; - -moz-margin-start: 2px; - -moz-margin-end: -3px; - list-style-image: url("chrome://exchangecalendar/content/exchange-addrbook.png"); -} - diff --git a/chrome/content/addressingWidgetOverlay.xul b/chrome/content/addressingWidgetOverlay.xul index 7509b229..4ba15257 100644 --- a/chrome/content/addressingWidgetOverlay.xul +++ b/chrome/content/addressingWidgetOverlay.xul @@ -21,7 +21,7 @@ - + diff --git a/chrome/content/adutils.js b/chrome/content/adutils.js new file mode 100644 index 00000000..11cd0b08 --- /dev/null +++ b/chrome/content/adutils.js @@ -0,0 +1,508 @@ +var gLdapServerURL; +var gLdapConnection; +var gLdapOperation; + +var gPrefs = Components.classes["@mozilla.org/preferences-service;1"] + .getService(Components.interfaces.nsIPrefBranch); +var gConsole = Components.classes["@mozilla.org/consoleservice;1"] + .getService(Components.interfaces.nsIConsoleService); +// global arrays (or arrays) to hold data of manager and direct reports +// will be of the form... +// [[signum1, displayname1, phone1, office1, title1][signum2, displayname2, phone2, office2, title2]] +// phone is concat of all known phone numbers +var reporteeDtls = []; +var managerDtls = []; + +//array of attributes that will always be retrieved from AD +var mandatoryAttribs = ["objectClass", "cn", "mail"] +var managersignum; +var searchemail; +var Cc = Components.classes; +var Ci = Components.interfaces; +var Cu = Components.utils; +var calWinId=window.arguments[0].calendar.id; + +var calPreferences = Cc["@mozilla.org/preferences-service;1"] + .getService(Ci.nsIPrefService) + .getBranch("extensions.exchangecalendar@extensions.1st-setup.nl."+ calWinId+"."); +var globalFunctions = Cc["@1st-setup.nl/global/functions;1"] + .getService(Ci.mivFunctions); +searchemail=globalFunctions.safeGetCharPref(calPreferences, "ecMailbox"); +var calendarEmail=searchemail; + +//mapping of AD attributes to address book elements +//for people: +var peopleAttribMapping = [["givenName", "FirstName"] + ,["sn", "LastName"] + ,["displayName", "DisplayName"] + ,["mailNickname","NickName"] //re-label to signum + ,["mail","PrimaryEmail"] + ,["homePhone","Relationship"] //new item added in ericssoncontactcard.xul + ,["telephoneNumber","WorkPhone"] + ,["otherTelephone","PagerNumber"] //re-label to ECN Number + ,["mobile","CellularNumber"] + ,["title","JobTitle"] + ,["department","Department"] + ,["company","Company"] + ,["streetAddress","WorkAddress"] + ,["l","WorkCity"] //city + ,["st","WorkState"] //state + ,["postalCode","WorkZipCode"] + ,["co","WorkCountry"] //country + ,["physicalDeliveryOfficeName","WebPage1"] //re-label Web Page to Office + ,["info","Notes"] + ,["facsimileTelephoneNumber","FaxNumber"] + ]; + +var additionalPeopleAttribs = ["manager", "directReports"]; + +//define attribs to get for manger and direct reports +//the display attribs will be displayed +//the check attribs are to check to ensure everything is in order +var otherPeopleDisplayAttribs = ["displayName", "mail", "telephoneNumber", "mobile", "otherTelephone", "physicalDeliveryOfficeName", "title"]; +var otherPeopleCheckAttribs = ["manager"]; + + //this is where it all starts +//identify AD server and initiate async connection +//use callback functions in ldapListener object to process data returned. + + +function ldapInit(){ + var adServer; + var container = document.getElementById("teamcontainer"); + try{ + adServer = gPrefs.getCharPref("mail.identity.id1.directoryServer"); + } + catch(e){ + container.hidden=true; + } + finally{ + } + + var adURL = gPrefs.getCharPref(adServer + ".uri"); + var adBindDN = gPrefs.getCharPref(adServer + ".auth.dn"); + //gConsole.logStringMessage("AD URL: " + adURL + " Bind DN: " + adBindDN); + + gLdapServerURL = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService).newURI(adURL, null, null).QueryInterface(Components.interfaces.nsILDAPURL); + gLdapServerURL.dn = adBindDN; + + gLdapConnection = Components.classes["@mozilla.org/network/ldap-connection;1"].createInstance().QueryInterface(Components.interfaces.nsILDAPConnection); + gLdapConnection.init(gLdapServerURL,gLdapServerURL.dn,new ldapListener(),null,Components.interfaces.nsILDAPConnection.VERSION3 ); + +} + +function ldapListener(){ +} + +ldapListener.prototype.QueryInterface = + function(iid) { + if (iid.equals(Components.interfaces.nsISupports) || iid.equals(Components.interfaces.nsILDAPMessageListener)){ + //gConsole.logStringMessage("Inside QueryInterface"); + return this; + } + throw Components.results.NS_ERROR_NO_INTERFACE; + } + + +ldapListener.prototype.onLDAPMessage = function(aMessage){ + + //gConsole.logStringMessage("Inside onLDAPMessage; Operation: " + aMessage.operation + " Type: " + aMessage.type); + var mailID = searchemail ; + if (aMessage.type === Components.interfaces.nsILDAPMessage.RES_BIND){ + //0x61 Result of a bind operation. + //gConsole.logStringMessage("starting search..."); + searchUserByEmail(mailID); + } + else if (aMessage.type === Components.interfaces.nsILDAPMessage.RES_SEARCH_ENTRY){ + //first check if this is a person, or a DL, or something else + //this is why the mandatoryAttrib check is important in searchUser + var objectClassValues = aMessage.getValues("objectClass", {}); + if (objectClassValues.indexOf("person") > -1){ + //check if the data returned is for the person on the card + let mailValues = aMessage.getValues("mail", {}); + if (mailValues.indexOf(mailID) > -1){ + //yep is for the card, start populating card values + //populateCard(aMessage); + //aMessage should also have manager and reportee details + //send out request to AD for manager and reportee... + if( searchemail== calendarEmail ) + { + sendRequestForManagerInfo(aMessage); + } + sendRequestForReporteeInfo(aMessage); + } + else{ + //its either the manager or the reportees + let retAttribs = aMessage.getAttributes({}); + if (retAttribs.indexOf("manager") > -1){ + //manager found!! + let retValues = aMessage.getValues("manager", {}); + let retValue = retValues[0] //pick up the first entry; should be more than one in any case + //break the string down to get the signum + let mgrSignum = getSignumFromCNString(retValue); + //check if manager of the record recieved is same the one for the current contact card + if (mgrSignum === managersignum ){ + //direct reportee found + processDirectReportData(aMessage); + } + else{ + //manager found + if( searchemail==calendarEmail) + { + processManagerData(aMessage); + } + } + } + else{ + //reached Hans Vestberg + if( searchemail==calendarEmail) + { + processManagerData(aMessage); + } + } + } + } + else if (objectClassValues.indexOf("group") > -1){ + //this is a distributionlist + // populateCard(aMessage); + } + else{ + //this is neither a person nor a list + //lets just spit out the details + // aMessageBreakup(amessage); + } + } + else if ( aMessage.type === Components.interfaces.nsILDAPMessage.RES_SEARCH_RESULT ){ + //gConsole.logStringMessage("Inside onLDAPMessage; Operation: " + aMessage.operation + " Type: " + aMessage.type); + //aMessageBreakup(amessage); + //tried messagebreakup... nothing is returned. We can safely ignore this... i hope! + } + else{ + //not sure what happened!! + //log since we get a message other than one of the above + gConsole.logStringMessage("Inside onLDAPMessage; Operation: " + aMessage.operation + " Type: " + aMessage.type); + } + return + } + +//following function is basically used to breakdown the aMessage +//for debugging etc +function aMessageBreakup(aMessage){ + var retValues = [] + var retAttribs = [] + retAttribs = aMessage.getAttributes({}); + gConsole.logStringMessage("numAttribs recd: " + retAttribs.length); + for (let ctr = 0; ctr < retAttribs.length; ctr ++){ + gConsole.logStringMessage("Value at pos: " + ctr + " is: " + retAttribs[ctr]); + retValues = aMessage.getValues(retAttribs[ctr], {}); + gConsole.logStringMessage("numValues: " + retValues.length); + for (let ctr2 = 0; ctr2 < retValues.length; ctr2 ++){ + gConsole.logStringMessage("Value at pos: " + ctr2 + " is: " + retValues[ctr2]); + } + } +} + +ldapListener.prototype.onLDAPInit = + function(aConn, aStatus){ + if (aStatus === 0){ + //all ok, procedding with bind operation + kickOffBind() + } + else{ + //oops!! something wrong, log it and get out! + gConsole.logStringMessage("Inside onLDAPInit. Status is:" + aStatus); + } + return; + } + + +function getLDAPOperation(){ + gLdapOperation = Components.classes["@mozilla.org/network/ldap-operation;1"].createInstance().QueryInterface(Components.interfaces.nsILDAPOperation); + gLdapOperation.init(gLdapConnection, new ldapListener(), null); +} + + +function kickOffBind(){ + try{ + getLDAPOperation(); + var passwd = getPassword(); + if (passwd !== ""){ + gLdapOperation.simpleBind(passwd); + } + } + catch(e){ + gConsole.logStringMessage("Error in Bind: " + e); + } + return; +} + + +function searchUser(searchString, wantedAttribs){ + var maxEntriesWanted = 300; + //ensure the mandatory attribs are in the list of wantedAttribs... this is important!! + for (let ctr = 0; ctr < mandatoryAttribs.length; ctr++){ + if (wantedAttribs.indexOf(mandatoryAttribs[ctr]) === -1){ + //do nothing and return + return; + } + } + getLDAPOperation(); + if(gLdapOperation) + { + gLdapOperation.searchExt("DC=ericsson,DC=se", gLdapServerURL.scope, searchString, wantedAttribs, 0, maxEntriesWanted); + } +} + + +//use this function to get details of the main entry on the contact card +function searchUserByEmail(mailID){ + //start building a list of attrib to be retrieved. + //do a slice as we do not want a shallow copy as we will be adding more elements to this + var wantedAttribs = mandatoryAttribs.slice(0); + for (let ctr = 0; ctr < peopleAttribMapping.length; ctr++){ + let len = wantedAttribs.push(peopleAttribMapping[ctr][0]); + } + for (let ctr = 0; ctr < additionalPeopleAttribs.length; ctr++){ + let len = wantedAttribs.push(additionalPeopleAttribs[ctr]); + } + + var searchString = "(&(mail=" + mailID + "))"; + searchUser(searchString, wantedAttribs); +} + + +//use this function to get details of manager and direct reports of the main entry on the contact card +function searchUserBySignum(signum){ + //start building a list of attrib to be retrieved. + //do a slice as we do not want a shallow copy as we will be adding more elements to this + var wantedAttribs = mandatoryAttribs.slice(0); + for (let ctr = 0; ctr < otherPeopleDisplayAttribs.length; ctr++){ + let len = wantedAttribs.push(otherPeopleDisplayAttribs[ctr]); + } + for (let ctr = 0; ctr < otherPeopleCheckAttribs.length; ctr++){ + let len = wantedAttribs.push(otherPeopleCheckAttribs[ctr]); + } + var searchString = "(&(cn=" + signum + "))"; + searchUser(searchString, wantedAttribs); +} + + +function sendRequestForManagerInfo(aMessage){ + //see if manager attrib is present + var retAttribs = aMessage.getAttributes({}); + if (retAttribs.indexOf("manager") > -1){ + //manager found!! + let retValues = aMessage.getValues("manager", {}); + let retValue = retValues[0] //pick up the first entry; should be more than one in any case + //break the string down to get the signum + let mgrSignum = getSignumFromCNString(retValue); + searchUserBySignum(mgrSignum); + //gConsole.logStringMessage("Manager: " + mgrSignum); + } +} + + +function sendRequestForReporteeInfo(aMessage){ + //see if directReports attrib is present + var retAttribs = aMessage.getAttributes({}); + if (retAttribs.indexOf("directReports") > -1){ + //direct reports found!! + let retValues = aMessage.getValues("directReports", {}); + for (let ctr = 0; ctr < retValues.length; ctr++){ + let empSignum = getSignumFromCNString(retValues[ctr]); + searchUserBySignum(empSignum); + //gConsole.logStringMessage("Direct Report: " + empSignum); + } + } +} + +function getSignumFromCNString(strEmp){ + //used to convert string like CN=erahver,OU=CA,OU=User,OU=P001,OU=ID,OU=Data,DC=ericsson,DC=se into erahver + var signum = ""; + let signumStart = strEmp.indexOf("CN=") + 3; + if (signumStart > -1){ + let signumEnd = strEmp.indexOf(",", signumStart); + signum = strEmp.substr(signumStart, signumEnd - signumStart) + } + return signum; +} + +//get the user password for the ericsson email account +//we are screwed if the server is no longer mail.internal.ericsson.com!! +function getPassword(){ + var appInfo = Components.classes["@mozilla.org/xre/app-info;1"] + .getService(Components.interfaces.nsIXULAppInfo); + var versionChecker = Components.classes["@mozilla.org/xpcom/version-comparator;1"] + .getService(Components.interfaces.nsIVersionComparator); + var passwd = ""; + var acctMgr = Components.classes["@mozilla.org/messenger/account-manager;1"] + .getService(Components.interfaces.nsIMsgAccountManager); + var accounts = acctMgr.accounts; + if (versionChecker.compare(appInfo.version, "20.0") >= 0){ + for (var i = 0; i < accounts.length; i++) { + var account = accounts.queryElementAt(i, Components.interfaces.nsIMsgAccount); + + passwd = account.incomingServer.password; + return passwd; + + } + } + else{ + for (let i = 0; i < accounts.Count(); i++) { + let account = accounts.QueryElementAt(i, Components.interfaces.nsIMsgAccount); + + passwd = account.incomingServer.password; + return passwd; + + } + } + return passwd; +} + +//extract first value from aMessage corresponding to attrib +//Note: the _first_ value will be returned, do not use this function if aMessaage has more than one value for attrib +function getValueFromAttrib(aMessage, attrib){ + //gConsole.logStringMessage("Attrib: " + attrib); + var attribValue = "" + try{ + var attribValues = aMessage.getValues(attrib, {}) + attribValue = attribValues[0]; + } + catch(exp){ + //could not find the attribute, use a blank string instead + attribValue = "" + } + return attribValue +} + + +function processDirectReportData(aMessage){ + // create local array of resource to look like inner array (below) and then push to global reporteeDtls + // [[signum1, displayname1, phone1, office1, title1][signum2, displayname2, phone2, office2, title2]] + // based on ["displayName", "mail", "telephoneNumber", "mobile", "otherTelephone", "physicalDeliveryOfficeName", "title"] + + var reporteeData = []; + + var signum = getValueFromAttrib(aMessage, "cn"); + reporteeData.push(signum); + var displayName= getValueFromAttrib(aMessage, "displayName"); + reporteeData.push(displayName); + var mail= getValueFromAttrib(aMessage, "mail"); + reporteeData.push(mail); + var phone1 = getValueFromAttrib(aMessage, "telephoneNumber"); + var phone2 = getValueFromAttrib(aMessage, "mobile"); + var phone3 = getValueFromAttrib(aMessage, "otherTelephone"); + var phone = concatPhoneNumbers(phone1, phone2, phone3); + reporteeData.push(phone); + var office = getValueFromAttrib(aMessage, "physicalDeliveryOfficeName"); + reporteeData.push(office); + var title = getValueFromAttrib(aMessage, "title"); + reporteeData.push(title); + // dump("\nccccccccc reporteeData " + reporteeData ); + + var tree = document.getElementById("team"); + var cboxitem = document.createElement("treeitem"); + cboxrow = document.createElement("treerow"); + + //add checkbox + var cboxcell = document.createElement("treecell"); + + cboxcell.setAttribute("value","false"); + cboxcell.setAttribute("editable",true); + cboxcell.setAttribute("name", "checkbox" ); + cboxrow.appendChild(cboxcell); + + //add user + cboxcell = document.createElement("treecell"); + cboxcell.setAttribute("label", displayName ); + cboxcell.setAttribute("name", "name" ); + cboxcell.setAttribute("value", mail ); + cboxcell.setAttribute("editable",false); + cboxrow.appendChild(cboxcell); + cboxitem.appendChild(cboxrow); + tree.appendChild(cboxitem); + + + reporteeDtls.push(reporteeData); + // document.getElementById('reporteeTree').view = reporteesTreeView; +} + +//simply add all numbers to an array and then covert it into a string +function concatPhoneNumbers(phone1, phone2, phone3){ + var phonearray = []; + var temp; + if (phone1 != "") {temp = phonearray.push(phone1);} + if (phone2 != "") {temp = phonearray.push(phone2);} + if (phone3 != "") {temp = phonearray.push(phone3);} + return phonearray.toString(); +} + +//identical to processDirectReportData +//should merge the two functions... +//...the main reason for not doing this now is because the xul/dom should have unique element ids +//...we can merge if we have the same ids for both the manager tree and the reportee tree +function processManagerData(aMessage){ + var managerData = []; + + var signum = getValueFromAttrib(aMessage, "cn"); + managerData.push(signum); + var displayName= getValueFromAttrib(aMessage, "displayName"); + managerData.push(displayName); + var mail= getValueFromAttrib(aMessage, "mail"); + managerData.push(mail); + var phone1 = getValueFromAttrib(aMessage, "telephoneNumber"); + var phone2 = getValueFromAttrib(aMessage, "mobile"); + var phone3 = getValueFromAttrib(aMessage, "otherTelephone"); + var phone = concatPhoneNumbers(phone1, phone2, phone3); + managerData.push(phone); + var office = getValueFromAttrib(aMessage, "physicalDeliveryOfficeName"); + managerData.push(office); + var title = getValueFromAttrib(aMessage, "title"); + managerData.push(title); + // dump("\nccccccccc managerData " + managerData ); + + document.getElementById("teamheader").setAttribute("label","Team: " + displayName); + + + var tree = document.getElementById("team"); + var cboxitem = document.createElement("treeitem"); + cboxrow = document.createElement("treerow"); + + //add checkbox + var cboxcell = document.createElement("treecell"); + + cboxcell.setAttribute("value","false"); + cboxcell.setAttribute("editable",true); + cboxcell.setAttribute("name", "checkbox" ); + cboxrow.appendChild(cboxcell); + + //add user + cboxcell = document.createElement("treecell"); + cboxcell.setAttribute("label", displayName ); + cboxcell.setAttribute("name", "name" ); + cboxcell.setAttribute("cycler","true"); + cboxcell.setAttribute("tooltiptext", mail ); + cboxcell.setAttribute("value", mail ); + cboxcell.setAttribute("editable",false); + cboxrow.appendChild(cboxcell); + cboxitem.appendChild(cboxrow); + tree.appendChild(cboxitem); + + + managerDtls.push(managerData); + managersignum=signum; + searchemail=mail; + searchUserByEmail(searchemail); +} + +function stopFetching() +{ + if (gLdapOperation){ + try { + gLdapOperation.abandon(); + } + catch (e) { + } + } + return true; +} \ No newline at end of file diff --git a/chrome/content/attachments-view.js b/chrome/content/attachments-view.js index df3bcb37..da40f9e3 100644 --- a/chrome/content/attachments-view.js +++ b/chrome/content/attachments-view.js @@ -98,7 +98,7 @@ exchAttachments.prototype = { this.globalFunctions.LOG("exchWebService.attachments.addAttachment"); if (aAttachment.uri) { - let documentLink = this._document.getElementById("exchWebService-attachment-link"); + let documentLink = this._document.getElementById("attachment-link"); let item = documentLink.appendChild(createXULElement("listitem")); item.setAttribute("crop", "end"); item.setAttribute("class", "listitem-iconic"); @@ -160,9 +160,9 @@ exchAttachments.prototype = { this.globalFunctions.LOG(" == extension:"+extension); if (ext2file[extension]) { - item.setAttribute("image", "chrome://exchangecalendar/skin/" + ext2file[extension]); + item.setAttribute("image", "chrome://exchangecalendar-common/skin/images/" + ext2file[extension]); } else { - item.setAttribute("image", "chrome://exchangecalendar/skin/document--exclamation.png"); + item.setAttribute("image", "chrome://exchangecalendar-common/skin/images/document--exclamation.png"); } // full attachment object is stored here @@ -187,7 +187,7 @@ exchAttachments.prototype = { deleteAttachment: function deleteAttachment() { - var documentLink = this._document.getElementById("exchWebService-attachment-link"); + var documentLink = this._document.getElementById("attachment-link"); if ((documentLink.selectedItem) && (documentLink.selectedItem.attachment)) { delete gAttachMap[documentLink.selectedItem.attachment.hashId]; documentLink.removeItemAt(documentLink.selectedIndex); @@ -220,7 +220,7 @@ exchAttachments.prototype = { removeItemsFromListbox: function _removeItemsFromListbox() { - var documentLink = this._document.getElementById("exchWebService-attachment-link"); + var documentLink = this._document.getElementById("attachment-link"); while (documentLink.itemCount > 0) { this.globalFunctions.LOG(" == Removing item from listbox"); documentLink.removeItemAt(0); @@ -251,8 +251,10 @@ exchAttachments.prototype = { this._document.getElementById("button-url").hidden = true; this._document.getElementById("event-toolbar").setAttribute("currentset", "button-save,button-attendees,button-privacy,button-url,exchWebService-add-attachment-button,button-delete"); this._document.getElementById("exchWebService-add-attachment-button").hidden = false; + if(this._document.getElementById("options-attachments-menuitem")){ this._document.getElementById("options-attachments-menuitem").setAttribute("label", this._document.getElementById("exchWebService-add-attachment-button").getAttribute("label")); this._document.getElementById("options-attachments-menuitem").setAttribute("command", "exchWebService_addAttachmentDialog"); + } } catch (ex) {this.globalFunctions.LOG(" -- Could not add exchange attachment buttons:"+ex.toString());} @@ -330,7 +332,13 @@ exchAttachments.prototype = { var taskTree = this._document.getElementById("calendar-task-tree"); var item = taskTree.currentTask; - + var displayElement=function(id,flag) { + setBooleanAttribute(id, "hidden", !flag); + return flag; + } + if (displayElement("calendar-task-details-container", item != null) && + displayElement("calendar-task-view-splitter", item != null)) { + if ((item.calendar) && (item.calendar.type == "exchangecalendar")) { // calendar-task-view (hide existing attachment view) //this.globalFunctions.LOG("exchWebService.attachments.onSelectTask: it is an Exchange task 1."); @@ -368,13 +376,14 @@ exchAttachments.prototype = { catch (ex) {this.globalFunctions.LOG("exchWebService.attachments.onSelectTask: Foutje Y:");} this.attachmentListboxVisible = false; } + } }, onSelect: function _onSelect(aEvent) { this.globalFunctions.LOG("exchWebService.attachments.onSelect"); - let documentLink = this._document.getElementById("exchWebService-attachment-link"); + let documentLink = this._document.getElementById("attachment-link"); var isReadOnly = "true"; if ((this._document.getElementById("calendar-event-dialog")) || (this._document.getElementById("calendar-task-dialog"))) { @@ -419,7 +428,7 @@ exchAttachments.prototype = { openAttachment: function _openAttachment() { this.globalFunctions.LOG("exchWebService.attachments.openAttachment"); - let documentLink = this._document.getElementById("exchWebService-attachment-link"); + let documentLink = this._document.getElementById("attachment-link"); if (documentLink.selectedItem.attachment) { var attURI = documentLink.selectedItem.attachment.uri; @@ -440,7 +449,7 @@ exchAttachments.prototype = { saveAttachment: function _saveAttachment() { this.globalFunctions.LOG("exchWebService.attachments.saveAttachment"); - let documentLink = this._document.getElementById("exchWebService-attachment-link"); + let documentLink = this._document.getElementById("attachment-link"); this.downloadAttachment(documentLink.selectedItem.attachment, true); }, diff --git a/chrome/content/attachments-view.xul b/chrome/content/attachments-view.xul index b8260635..9f47a7e2 100644 --- a/chrome/content/attachments-view.xul +++ b/chrome/content/attachments-view.xul @@ -39,7 +39,7 @@ %dtd1; ]> - + @@ -92,13 +92,7 @@ - - + diff --git a/chrome/content/browseFolder.css b/chrome/content/browseFolder.css deleted file mode 100644 index 18a7032c..00000000 --- a/chrome/content/browseFolder.css +++ /dev/null @@ -1,6 +0,0 @@ -@import url(chrome://global/skin/); - -treechildren:-moz-tree-image(IPFAppointment) -{ - list-style-image: url("chrome://exchangecalendar/skin/browser_calendar.png"); -} diff --git a/chrome/content/browseFolder.js b/chrome/content/browseFolder.js index 8bb6b8dd..43bd0c9b 100644 --- a/chrome/content/browseFolder.js +++ b/chrome/content/browseFolder.js @@ -186,38 +186,38 @@ exchWebService_browseTreeView.prototype = { if (column.id == "exchWebService_foldername") { switch (this.folders[idx].folderClass) { case "IPF.Appointment": - return "chrome://exchangecalendar/skin/calendar-month.png"; + return "chrome://exchangecalendar-common/skin/images/calendar-month.png"; break; case "IPF.Note": - return "chrome://exchangecalendar/skin/mail.png"; + return "chrome://exchangecalendar-common/skin/images/mail.png"; break; case "IPF.Contact": - return "chrome://exchangecalendar/skin/address-book.png"; + return "chrome://exchangecalendar-common/skin/images/address-book.png"; break; case "IPF.Configuration": - return "chrome://exchangecalendar/skin/wrench-screwdriver.png"; + return "chrome://exchangecalendar-common/skin/images/wrench-screwdriver.png"; break; case "IPF.Note.OutlookHomepage": case "IPF.Note.SocialConnector.FeedItems": - return "chrome://exchangecalendar/skin/feed.png"; + return "chrome://exchangecalendar-common/skin/images/feed.png"; break; case "IPF.Task": - return "chrome://exchangecalendar/skin/task.png"; + return "chrome://exchangecalendar-common/skin/images/task.png"; break; case "IPF.StickyNote": - return "chrome://exchangecalendar/skin/sticky-notes.png"; + return "chrome://exchangecalendar-common/skin/images/sticky-notes.png"; break; case "IPF.Journal": - return "chrome://exchangecalendar/skin/blog.png"; + return "chrome://exchangecalendar-common/skin/images/blog.png"; break; } if (this.folders[idx].isContainerOpen) { - return "chrome://exchangecalendar/skin/folder-open.png"; + return "chrome://exchangecalendar-common/skin/images/folder-open.png"; } - return "chrome://exchangecalendar/skin/folder.png"; + return "chrome://exchangecalendar-common/skin/images/folder.png"; } }, diff --git a/chrome/content/browseFolder.xul b/chrome/content/browseFolder.xul index b381b49b..8039154d 100644 --- a/chrome/content/browseFolder.xul +++ b/chrome/content/browseFolder.xul @@ -38,8 +38,8 @@ * ***** BEGIN LICENSE BLOCK *****/ --> - - + + %dtd1; diff --git a/chrome/content/cachePreferences.xul b/chrome/content/cachePreferences.xul index accebca5..df672f08 100644 --- a/chrome/content/cachePreferences.xul +++ b/chrome/content/cachePreferences.xul @@ -46,7 +46,7 @@ %dtd1; ]> - + diff --git a/chrome/content/calendar-calendars-list.js b/chrome/content/calendar-calendars-list.js index 1903ef78..d9ec96cf 100644 --- a/chrome/content/calendar-calendars-list.js +++ b/chrome/content/calendar-calendars-list.js @@ -212,6 +212,19 @@ exchCalPopUpMenu.prototype = { } }, + delegateCalendarSettings: function _delegateCalendarSettings() + { + var myCal = getSelectedCalendar(); + var aResult = ""; + if (myCal) { + var aResult = { calendar: myCal, answer: ""}; + this._window.openDialog("chrome://exchangecalendar/content/delegateCalendar.xul", + "delegateCalendarSettings", + "chrome,titlebar,toolbar,centerscreen,dialog,modal=yes,resizable=no", + aResult); + } + }, + onLoad: function _onLoad() { //this._document.getElementById("calendar-list-tree-widget").setAttribute("type", "exchange"); diff --git a/chrome/content/calendar-calendars-list.xul b/chrome/content/calendar-calendars-list.xul index a7863299..2946cdb0 100644 --- a/chrome/content/calendar-calendars-list.xul +++ b/chrome/content/calendar-calendars-list.xul @@ -38,7 +38,7 @@ * ***** BEGIN LICENSE BLOCK *****/ --> - + @@ -52,6 +52,7 @@ + @@ -69,6 +70,9 @@ + @@ -78,3 +82,5 @@ type="exchange"/> + + diff --git a/chrome/content/calendar-common-sets.js b/chrome/content/calendar-common-sets.js index a7053ba5..1bfb66b6 100644 --- a/chrome/content/calendar-common-sets.js +++ b/chrome/content/calendar-common-sets.js @@ -75,29 +75,42 @@ exchForewardEvent.prototype = { args.calendar =calendar; args.onOk = this.callOnRightClick; args.opener="exchWebService-onForEve"; + + dump("\nxxxxxxx args"+JSON.stringify(args)); + this._window.openDialog("chrome://calendar/content/calendar-event-dialog-attendees.xul","_blank", "chrome,titlebar,modal,resizable",args); }, callOnRightClick : function(attendee,organizer,startTime,endTime){ - var item = this.currentView().getSelectedItems({})[0]; + var item = tmpForewardEvent.currentView().getSelectedItems({})[0]; var calendar = item.calendar; var calId = calendar.id; var calPrefs = Cc["@mozilla.org/preferences-service;1"] .getService(Ci.nsIPrefService) .getBranch("extensions.exchangecalendar@extensions.1st-setup.nl."+calId+"."); var tmpObject = new erForewardItemRequest( - {user: this.globalFunctions.safeGetCharPref(calPrefs, "ecDomain")+"\\"+this.globalFunctions.safeGetCharPref(calPrefs, "ecUser"), - mailbox: this.globalFunctions.safeGetCharPref(calPrefs, "ecMailbox"), - serverUrl: this.globalFunctions.safeGetCharPref(calPrefs, "ecServer"), item: item, attendees: attendee, + {user: tmpForewardEvent.globalFunctions.safeGetCharPref(calPrefs, "ecDomain")+"\\"+tmpForewardEvent.globalFunctions.safeGetCharPref(calPrefs, "ecUser"), + mailbox: tmpForewardEvent.globalFunctions.safeGetCharPref(calPrefs, "ecMailbox"), + serverUrl: tmpForewardEvent.globalFunctions.safeGetCharPref(calPrefs, "ecServer"), item: item, attendees: attendee, changeKey : item.changeKey, description : item.getProperty("description")}, - this.erForewardItemRequestOK, this.erForewardItemRequestError); + tmpForewardEvent.erForewardItemRequestOK, tmpForewardEvent.erForewardItemRequestError); return true; }, erForewardItemRequestOK : function _erForewardItemRequestOK(aForewardItemRequest, aResp) { - alert(aResp); + if(aResp){ + var title="Forwarding Event"; + var msg=aResp; + var image = "chrome://exchangecalendar-common/skin/images/notify-icon.png"; + var win = Components.classes['@mozilla.org/embedcomp/window-watcher;1']. + getService(Components.interfaces.nsIWindowWatcher). + openWindow(null, 'chrome://global/content/alerts/alert.xul', + '_blank', 'chrome,titlebar=no,popup=yes', null); + win.arguments = [image, title, msg, true, '']; + + } }, erForewardItemRequestError: function _erForewardItemRequestError(aForewardItemRequest, aCode, aMsg) diff --git a/chrome/content/calendar-common-sets.xul b/chrome/content/calendar-common-sets.xul index a9082a11..90b5ce34 100644 --- a/chrome/content/calendar-common-sets.xul +++ b/chrome/content/calendar-common-sets.xul @@ -41,10 +41,10 @@ %eventDialogDTD; %menuOverlayDTD; ]> - + +