-/* ***** BEGIN LICENSE BLOCK *****
- * Copyright (c) 2008-2009 EADS DEFENCE AND SECURITY - All rights reserved.
- * ximfmail is under the triple license MPL 1.1/GPL 2.0/LGPL 2.1.
- *
- *
- * Redistribution and use, in source and binary forms, with or without modification,
- * are permitted provided that the following conditons are met :
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * 2. MPL 1.1/GPL 2.0/LGPL 2.1. license agreements must be attached
- * in the redistribution of the source code.
- * 3. Neither the names of the copyright holders nor the names of any contributors
- * may be used to endorse or promote products derived from this software without specific
- * prior written permission from EADS Defence and Security.
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * REMINDER :
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * EADS Defence and Security - 1 Boulevard Jean Moulin -
- * ZAC de la Clef Saint Pierre - 78990 Elancourt - FRANCE (IDDN.FR.001.480012.002.S.P.2008.000.10000)
- * ***** END LICENSE BLOCK ***** */
-
-/*
- * TreeThread observer
- */
-var XimfThreadTreeDBViewObserver = {
- // Components.interfaces.nsIObserver
- observe: function(aMsgFolder, aTopic, aData) {
- if(gXimfThreadTree) gXimfThreadTree.addCustomColumnHandler();
- }
-}
-
-/*
- * XimfThreadTree class
- */
-function XimfThreadTree(){
- // private:
- var _ximfHdrArrayByID = [];
-
- //
- function isDataInArray(data,array){
- for(var i=0; i<array.length; ++i){
- if(data == array[i]){
- return true;
- }
- }
- return false;
- }
-
- /*
- * Get ilk values from instance
- */
- function LoadIlkColumnsValues2(currentInstance){
- try{
- var ilkArray = [];
- // get xml schema for instance
- if(!gXimfCatalog){
- gXimfCatalog = new XimfCatalog();
- }
- var dir = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
- var completePath = getFilePathInProfile("extensions/"+gXimfCatalog.getSchemaInstance(currentInstance));
- dir.initWithPath( completePath );
- if(!dir.exists()){
- gConsole.logStringMessage("[Ximfmail - createThreadTree - LoadIlkColumnsValues2] Error loading schema file : " + completePath);
- return;
- }
- var objXML = GetXmlDocument(completePath);
- var headers = objXML.getElementsByTagName("ximf:header");
-
- // get xml dictionary parser
- var urlDictionary = getFilePathInProfile("extensions/"+gXimfCatalog.getDictionaryInstance(currentInstance));
- dir.initWithPath( urlDictionary );
- if(!dir.exists()){
- gConsole.logStringMessage("[Ximfmail - LoadIlkColumnsValues2] Error loading dictionary file : " + completePath);
- return;
- }
- var dicoXML = GetXmlDocument(urlDictionary);
- var dicoElements = dicoXML.getElementsByTagName("ximf:locale");
-
- // get local lang
- var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
- var refLang = prefs.getCharPref("general.useragent.locale");
- if(!refLang) refLang = "fr-FR";
- var ilkEntities = null;
- for(var idxLang=0 ; idxLang < dicoElements.length ; ++idxLang){
- if(dicoElements[idxLang].getAttribute("lang") == refLang){
- ilkEntities = dicoElements[idxLang].getElementsByTagName("ximf:ilk");
- break;
- }
- }
-
- // parse XML and get labels
- for(var i=0 ; i < _ximfHdrArrayByID.length ; ++i){
- var currentTreeColId = _ximfHdrArrayByID[i];
- for(var idxH = 0 ; idxH < headers.length; ++idxH){
- var attrHeaderList = headers[idxH].attributes;
- var headerName = headers[idxH].getAttribute("headerName");
-
- if(headerName.toLowerCase() == currentTreeColId.toLowerCase()){
- var stringListElt = headers[idxH].getElementsByTagName("ximf:string");
- var treeElement = document.getElementById(currentTreeColId);
-
- var reg=new RegExp(' ', "gi");
- for(var j=0 ; j< stringListElt.length ; j++){
- try{
- // get values from instance headers
- var sContent = stringListElt[j].getAttribute("content");
- var sIlk = stringListElt[j].getAttribute("ilk")
-
- // get ilk entity from instance dictionay
- if(ilkEntities){
- for(var idxIlk = 0 ; idxIlk < ilkEntities.length ; ++idxIlk){
- if(ilkEntities[idxIlk].getAttribute("entity") == sIlk){
- sIlk = ilkEntities[idxIlk].textContent;
- //gConsole.logStringMessage("[Ximfmail - LoadIlkColumnsValues2] sIlk : " + sIlk);
- break;
- }
- }
- }
- // set values to tree column
- var ilkid = "ximfkey_"+sContent;
- ilkid = ilkid.replace(reg,"_");
- //gConsole.logStringMessage("[Ximfmail - LoadIlkColumnsValues2] ]"+ilkid +":"+sIlk+"[");
- treeElement.setAttribute(ilkid,sIlk);
- }catch(e){}
- }
- break;
- }
- }
- }
-
- }catch(e){
- gConsole.logStringMessage("[ximfmail - LoadIlkColumnsValues ] " + e +"\nline : " + e.lineNumber + " : "+ e + "\nfile : "+ Error().fileName);
- }
- return ilkArray;
- }
-
- //
- function addCustomPreferences(preference, lower){
- var xListHdr = "";
- var prefList = [];
- var prefBranch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch(null);
-
- try {
- xListHdr = prefBranch.getCharPref(preference);
- if((xListHdr) != ""){
- var reg=new RegExp("[ ]+", "g");
- prefList=xListHdr.split(reg);
- }
- } catch(ex) {}
-
- // add only new headers
- for (var i = 0; i < _ximfHdrArrayByID.length; i++) {
- if (!isDataInArray(_ximfHdrArrayByID[i].toLowerCase(),prefList)){
- if (xListHdr != "") {
- xListHdr += " ";
- }
- xListHdr += _ximfHdrArrayByID[i].toLowerCase();
- }
- }
- prefBranch.setCharPref(preference, xListHdr);
- };
- //Column handler template definition
- function XimfCustomColumnHandler(property) {
- // Properties
- this.property = property;
- this.isString = true;
-
- // Functions
- this.getSortStringForRow = function (hdr){ return (this.isString) ? hdr.getStringProperty(this.property) : ""; };
- this.isString = function (){ return this.isString; };
- this.getCellProperties = function (row, col, props) {};
- this.getRowProperties = function(row, props){};
- this.getImageSrc = function (row, col){return null; };
- this.getSortLongForRow = function(hdr){ return (this.isString) ? 0 : new Number(hdr.getStringProperty(this.property)).value; };
- this.getIlkValue = function(value){
- var newValue = value;
- listTreecol = $("treecol[ximfheadtree='1']");
- var reg=new RegExp(' ', "gi");
- for(var i=0; i<listTreecol.length; ++i){
- if(listTreecol[i].getAttribute("id").toLowerCase()== this.property){
- // set values to tree column
- var ilkid = "ximfkey_"+value;
- ilkid = ilkid.replace(reg,"_");
- newValue = listTreecol[i].getAttribute(ilkid);
- if (newValue == ""){
- newValue = value;
- }
- break;
- }
- }
- return newValue;
- };
- this.getCellText = function (row, col){
- var key = gDBView.getKeyAt(row);
- var hdr = gDBView.db.GetMsgHdrForKey(key);
- var value = hdr.getStringProperty(this.property);
- //return hdr.getStringProperty(this.property);
- //return value.toLowerCase();
- return this.getIlkValue(value);;
- };
- };
-
- function updateColumnToHide(){
- try{
- if(_ximfHdrArrayByID.length <= 0 ) return;
- if(gCurrentIdentity){
- var prefList = gCurrentIdentity.getCharAttribute("ximfmail_context_DBHeaders");
- if(prefList == "undefined") return;
- for(var i=0; i<_ximfHdrArrayByID.length; ++i){
- if(prefList.lastIndexOf(_ximfHdrArrayByID[i]) != -1){
- $("treecol[id='"+_ximfHdrArrayByID[i]+"']").attr("hidden","true");
- }
- }
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - createThreadTree ] " + e +"\nline : " + Error().lineNumber + " : "+ e + "\nfile : "+ Error().fileName);
- }
- };
-
- // public:
- if(typeof XimfThreadTree.initialized == "undefined"){
- //load tree cells with ximf headers
- XimfThreadTree.prototype.createThreadTree = function(){
- try{
- if(gCurrentIdentity){
- var currentInstance = gCurrentIdentity.getCharAttribute("ximfmail_instance_treethread_ref");
- // delete previous ximfmail columns
- $("splitter[ximfheadtree='1']").remove();
- $("treecol[ximfheadtree='1']").remove();
- _ximfHdrArrayByID.splice(0,_ximfHdrArrayByID.length);
- // new instance -> new ximf columns
- if(gCurrentIdentity.getBoolAttribute(XIMF_PREF_IDENTITY_USE_XIMFMAIL)){
- $("#threadCols").append(CreateDOMWithXimfInstance(currentInstance,gChromeXslTreeRcv));
-
- // save list of ximf columns
- var listID = $("#threadCols treecol[ximfheadtree='1']");
-
- if(!listID) return;
- for(var idx=0; idx<listID.length; ++idx){
- _ximfHdrArrayByID.push(listID[idx].id);
- }
- updateColumnToHide();
- //LoadIlkColumnsValues(currentInstance);
- LoadIlkColumnsValues2(currentInstance);
-
- // use by Thunderbird to check for x-headers
- addCustomPreferences('mailnews.customDBHeaders', true);
- }
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - createThreadTree ] " + e +"\nline : " + Error().lineNumber + " : "+ e + "\nfile : "+ Error().fileName);
- }
- };
- XimfThreadTree.prototype.addCustomColumnHandler = function(){
- if(_ximfHdrArrayByID.length <= 0 ) return;
- if (gDBView) {
- for(var i=0; i<_ximfHdrArrayByID.length; ++i){
- gDBView.addColumnHandler(_ximfHdrArrayByID[i], new XimfCustomColumnHandler(_ximfHdrArrayByID[i].toLowerCase()));
- }
- }
- };
- XimfThreadTree.prototype.saveColumnToHide = function(){
- var listID = $("#threadCols treecol[ximfheadtree='1']");//
- try{
- if(gCurrentIdentity){
- prefList = ""
- for(var i=0; i<listID.length; ++i){
- if(listID[i].getAttribute("hidden") == "true"){
- if(prefList != "") prefList +=",";
- prefList += listID[i].id;
- }
- }
- gCurrentIdentity.setCharAttribute("ximfmail_context_DBHeaders",prefList);
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - createThreadTree ] " + e +"\nline : " + Error().lineNumber + " : "+ e + "\nfile : "+ Error().fileName);
- }
- };
- // loaded object
- XimfThreadTree.initialized = true;
- }
+/* ***** BEGIN LICENSE BLOCK *****\r
+ * Copyright (c) 2008-2009 EADS DEFENCE AND SECURITY - All rights reserved.\r
+ * ximfmail is under the triple license MPL 1.1/GPL 2.0/LGPL 2.1.\r
+ * \r
+ *\r
+ * Redistribution and use, in source and binary forms, with or without modification, \r
+ * are permitted provided that the following conditons are met :\r
+ *\r
+ * 1. Redistributions of source code must retain the above copyright notice, \r
+ * 2. MPL 1.1/GPL 2.0/LGPL 2.1. license agreements must be attached \r
+ * in the redistribution of the source code.\r
+ * 3. Neither the names of the copyright holders nor the names of any contributors \r
+ * may be used to endorse or promote products derived from this software without specific \r
+ * prior written permission from EADS Defence and Security.\r
+ * \r
+ * Alternatively, the contents of this file may be used under the terms of\r
+ * either of the GNU General Public License Version 2 or later (the "GPL"),\r
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),\r
+ * in which case the provisions of the GPL or the LGPL are applicable instead\r
+ * of those above. If you wish to allow use of your version of this file only\r
+ * under the terms of either the GPL or the LGPL, and not to allow others to\r
+ * use your version of this file under the terms of the MPL, indicate your\r
+ * decision by deleting the provisions above and replace them with the notice\r
+ * and other provisions required by the GPL or the LGPL. If you do not delete\r
+ * the provisions above, a recipient may use your version of this file under\r
+ * the terms of any one of the MPL, the GPL or the LGPL.\r
+ * \r
+ * REMINDER :\r
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND \r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \r
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \r
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \r
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES \r
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; \r
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \r
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING \r
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ * \r
+ * EADS Defence and Security - 1 Boulevard Jean Moulin - \r
+ * ZAC de la Clef Saint Pierre - 78990 Elancourt - FRANCE (IDDN.FR.001.480012.002.S.P.2008.000.10000) \r
+ * ***** END LICENSE BLOCK ***** */\r
+ \r
+/*\r
+ * TreeThread observer\r
+ */\r
+var XimfThreadTreeDBViewObserver = {\r
+ // Components.interfaces.nsIObserver\r
+ observe: function(aMsgFolder, aTopic, aData) { \r
+ if(gXimfThreadTree) gXimfThreadTree.addCustomColumnHandler();\r
+ }\r
+}\r
+\r
+/* \r
+ * XimfThreadTree class\r
+ */\r
+function XimfThreadTree(){\r
+ // private:\r
+ var _ximfHdrArrayByID = [];\r
+ \r
+ //\r
+ function isDataInArray(data,array){\r
+ for(var i=0; i<array.length; ++i){\r
+ if(data == array[i]){\r
+ return true;\r
+ }\r
+ }\r
+ return false;\r
+ }\r
+ \r
+ /*\r
+ * Get ilk values from instance\r
+ */\r
+ function LoadIlkColumnsValues2(currentInstance){\r
+ try{\r
+ var ilkArray = [];\r
+ // get xml schema for instance\r
+ if(!gXimfCatalog){ \r
+ gXimfCatalog = new XimfCatalog();\r
+ }\r
+ var dir = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);\r
+ var completePath = getFilePathInProfile("extensions/"+gXimfCatalog.getSchemaInstance(currentInstance));\r
+ dir.initWithPath( completePath ); \r
+ if(!dir.exists()){ \r
+ gConsole.logStringMessage("[Ximfmail - createThreadTree - LoadIlkColumnsValues2] Error loading schema file : " + completePath);\r
+ return;\r
+ } \r
+ var objXML = GetXmlDocument(completePath);\r
+ var headers = objXML.getElementsByTagName("ximf:header");\r
+ \r
+ // get xml dictionary parser\r
+ var urlDictionary = getFilePathInProfile("extensions/"+gXimfCatalog.getDictionaryInstance(currentInstance));\r
+ dir.initWithPath( urlDictionary ); \r
+ if(!dir.exists()){ \r
+ gConsole.logStringMessage("[Ximfmail - LoadIlkColumnsValues2] Error loading dictionary file : " + completePath);\r
+ return;\r
+ } \r
+ var dicoXML = GetXmlDocument(urlDictionary);\r
+ var dicoElements = dicoXML.getElementsByTagName("ximf:locale");\r
+ \r
+ // get local lang \r
+ var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);\r
+ var refLang = prefs.getCharPref("general.useragent.locale");\r
+ if(!refLang) refLang = "fr-FR"; \r
+ var ilkEntities = null;\r
+ for(var idxLang=0 ; idxLang < dicoElements.length ; ++idxLang){ \r
+ if(dicoElements[idxLang].getAttribute("lang") == refLang){\r
+ ilkEntities = dicoElements[idxLang].getElementsByTagName("ximf:ilk");\r
+ break;\r
+ }\r
+ }\r
+ \r
+ // parse XML and get labels\r
+ for(var i=0 ; i < _ximfHdrArrayByID.length ; ++i){\r
+ var currentTreeColId = _ximfHdrArrayByID[i];\r
+ for(var idxH = 0 ; idxH < headers.length; ++idxH){ \r
+ var attrHeaderList = headers[idxH].attributes; \r
+ var headerName = headers[idxH].getAttribute("headerName");\r
+ \r
+ if(headerName.toLowerCase() == currentTreeColId.toLowerCase()){ \r
+ var stringListElt = headers[idxH].getElementsByTagName("ximf:string");\r
+ var treeElement = document.getElementById(currentTreeColId);\r
+ \r
+ var reg=new RegExp(' ', "gi");\r
+ for(var j=0 ; j< stringListElt.length ; j++){\r
+ try{ \r
+ // get values from instance headers\r
+ var sContent = stringListElt[j].getAttribute("content"); \r
+ var sIlk = stringListElt[j].getAttribute("ilk")\r
+ \r
+ // get ilk entity from instance dictionay\r
+ if(ilkEntities){\r
+ for(var idxIlk = 0 ; idxIlk < ilkEntities.length ; ++idxIlk){\r
+ if(ilkEntities[idxIlk].getAttribute("entity") == sIlk){\r
+ sIlk = ilkEntities[idxIlk].textContent;\r
+ //gConsole.logStringMessage("[Ximfmail - LoadIlkColumnsValues2] sIlk : " + sIlk); \r
+ break;\r
+ }\r
+ }\r
+ }\r
+ // set values to tree column \r
+ var ilkid = "ximfkey_"+sContent;\r
+ ilkid = ilkid.replace(reg,"_");\r
+ //gConsole.logStringMessage("[Ximfmail - LoadIlkColumnsValues2] ]"+ilkid +":"+sIlk+"["); \r
+ treeElement.setAttribute(ilkid,sIlk); \r
+ }catch(e){} \r
+ }\r
+ break;\r
+ }\r
+ }\r
+ }\r
+\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - LoadIlkColumnsValues ] " + e +"\nline : " + e.lineNumber + " : "+ e + "\nfile : "+ Error().fileName);\r
+ }\r
+ return ilkArray;\r
+ }\r
+ \r
+ //\r
+ function addCustomPreferences(preference, lower){\r
+ var xListHdr = "";\r
+ var prefList = [];\r
+ var prefBranch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch(null);\r
+ \r
+ try {\r
+ xListHdr = prefBranch.getCharPref(preference);\r
+ if((xListHdr) != ""){\r
+ var reg=new RegExp("[ ]+", "g");\r
+ prefList=xListHdr.split(reg); \r
+ }\r
+ } catch(ex) {}\r
+\r
+ // add only new headers\r
+ for (var i = 0; i < _ximfHdrArrayByID.length; i++) { \r
+ if (!isDataInArray(_ximfHdrArrayByID[i].toLowerCase(),prefList)){\r
+ if (xListHdr != "") {\r
+ xListHdr += " ";\r
+ } \r
+ xListHdr += _ximfHdrArrayByID[i].toLowerCase();\r
+ }\r
+ } \r
+ prefBranch.setCharPref(preference, xListHdr);\r
+ };\r
+ //Column handler template definition \r
+ function XimfCustomColumnHandler(property) {\r
+ // Properties\r
+ this.property = property;\r
+ this.isString = true; \r
+ \r
+ // Functions\r
+ this.getSortStringForRow = function (hdr){ return (this.isString) ? hdr.getStringProperty(this.property) : ""; };\r
+ this.isString = function (){ return this.isString; };\r
+ this.getCellProperties = function (row, col, props) {};\r
+ this.getRowProperties = function(row, props){};\r
+ this.getImageSrc = function (row, col){return null; };\r
+ this.getSortLongForRow = function(hdr){ return (this.isString) ? 0 : new Number(hdr.getStringProperty(this.property)).value; };\r
+ this.getIlkValue = function(value){\r
+ var newValue = value;\r
+ listTreecol = $("treecol[ximfheadtree='1']");\r
+ var reg=new RegExp(' ', "gi");\r
+ for(var i=0; i<listTreecol.length; ++i){\r
+ if(listTreecol[i].getAttribute("id").toLowerCase()== this.property){\r
+ // set values to tree column\r
+ var ilkid = "ximfkey_"+value;\r
+ ilkid = ilkid.replace(reg,"_"); \r
+ newValue = listTreecol[i].getAttribute(ilkid);\r
+ if (newValue == ""){ \r
+ newValue = value;\r
+ }\r
+ break;\r
+ }\r
+ }\r
+ return newValue;\r
+ };\r
+ this.getCellText = function (row, col){\r
+ var key = gDBView.getKeyAt(row);\r
+ var hdr = gDBView.db.GetMsgHdrForKey(key);\r
+ var value = hdr.getStringProperty(this.property);\r
+ //return hdr.getStringProperty(this.property);\r
+ //return value.toLowerCase();\r
+ return this.getIlkValue(value);;\r
+ }; \r
+ };\r
+ \r
+ function updateColumnToHide(){\r
+ try{\r
+ if(_ximfHdrArrayByID.length <= 0 ) return;\r
+ if(gCurrentIdentity){ \r
+ var prefList = gCurrentIdentity.getCharAttribute("ximfmail_context_DBHeaders");\r
+ if(prefList == "undefined") return;\r
+ for(var i=0; i<_ximfHdrArrayByID.length; ++i){\r
+ if(prefList.lastIndexOf(_ximfHdrArrayByID[i]) != -1){\r
+ $("treecol[id='"+_ximfHdrArrayByID[i]+"']").attr("hidden","true");\r
+ }\r
+ }\r
+ }\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - createThreadTree ] " + e +"\nline : " + Error().lineNumber + " : "+ e + "\nfile : "+ Error().fileName);\r
+ } \r
+ }; \r
+ \r
+ // public:\r
+ if(typeof XimfThreadTree.initialized == "undefined"){\r
+ //load tree cells with ximf headers\r
+ XimfThreadTree.prototype.createThreadTree = function(){\r
+ try{\r
+ if(gCurrentIdentity){\r
+ var currentInstance = gCurrentIdentity.getCharAttribute("ximfmail_instance_treethread_ref");\r
+ // delete previous ximfmail columns\r
+ $("splitter[ximfheadtree='1']").remove();\r
+ $("treecol[ximfheadtree='1']").remove();\r
+ _ximfHdrArrayByID.splice(0,_ximfHdrArrayByID.length);\r
+ // new instance -> new ximf columns\r
+ if(gCurrentIdentity.getBoolAttribute(XIMF_PREF_IDENTITY_USE_XIMFMAIL)){\r
+ $("#threadCols").append(CreateDOMWithXimfInstance(currentInstance,gChromeXslTreeRcv));\r
+ \r
+ // save list of ximf columns\r
+ var listID = $("#threadCols treecol[ximfheadtree='1']");\r
+ \r
+ if(!listID) return;\r
+ for(var idx=0; idx<listID.length; ++idx){\r
+ _ximfHdrArrayByID.push(listID[idx].id); \r
+ }\r
+ updateColumnToHide();\r
+ //LoadIlkColumnsValues(currentInstance);\r
+ LoadIlkColumnsValues2(currentInstance); \r
+ \r
+ // use by Thunderbird to check for x-headers\r
+ addCustomPreferences('mailnews.customDBHeaders', true); \r
+ }\r
+ } \r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - createThreadTree ] " + e +"\nline : " + Error().lineNumber + " : "+ e + "\nfile : "+ Error().fileName);\r
+ }\r
+ }; \r
+ XimfThreadTree.prototype.addCustomColumnHandler = function(){\r
+ if(_ximfHdrArrayByID.length <= 0 ) return;\r
+ if (gDBView) { \r
+ for(var i=0; i<_ximfHdrArrayByID.length; ++i){\r
+ gDBView.addColumnHandler(_ximfHdrArrayByID[i], new XimfCustomColumnHandler(_ximfHdrArrayByID[i].toLowerCase()));\r
+ }\r
+ }\r
+ };\r
+ XimfThreadTree.prototype.saveColumnToHide = function(){\r
+ var listID = $("#threadCols treecol[ximfheadtree='1']");//\r
+ try{\r
+ if(gCurrentIdentity){ \r
+ prefList = ""\r
+ for(var i=0; i<listID.length; ++i){\r
+ if(listID[i].getAttribute("hidden") == "true"){\r
+ if(prefList != "") prefList +=",";\r
+ prefList += listID[i].id;\r
+ }\r
+ } \r
+ gCurrentIdentity.setCharAttribute("ximfmail_context_DBHeaders",prefList);\r
+ }\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - createThreadTree ] " + e +"\nline : " + Error().lineNumber + " : "+ e + "\nfile : "+ Error().fileName);\r
+ } \r
+ }; \r
+ // loaded object\r
+ XimfThreadTree.initialized = true;\r
+ }\r
}
\ No newline at end of file