--- /dev/null
+#
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is mozilla.org code.
+#
+# The Initial Developer of the Original Code is
+# Netscape Communications Corporation.
+# Portions created by the Initial Developer are Copyright (C) 1998
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#
+# 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.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH = ../../..
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+MODULE = ximf-company-def
+DIRS =
+
+XPI_NAME = ximf_company_def
+INSTALL_EXTENSION_ID = {E255643F-7DCA-4cd8-B0C2-61EAADE39FCE}
+XPI_PKGNAME = ximf_company_def
+
+DIST_FILES = install.rdf
+
+USE_EXTENSION_MANIFEST = 1
+
+libs::
+ $(INSTALL) $(srcdir)/chrome/content/*.xml $(FINAL_TARGET)/chrome/content
+ $(INSTALL) $(srcdir)/chrome/content/AmocoCorporation/*.xml $(FINAL_TARGET)/chrome/content/AmocoCorporation
+ $(INSTALL) $(srcdir)/chrome/content/CaterpillarInc/*.xml $(FINAL_TARGET)/chrome/content/CaterpillarInc
+ $(INSTALL) $(srcdir)/chrome/content/WhirlpoolCorporation/*.xml $(FINAL_TARGET)/chrome/content/WhirlpoolCorporation
+
+include $(topsrcdir)/config/rules.mk
--- /dev/null
+content ximf-conpany-def chrome/content/ xpcnativewrappers=yes
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+\r
+<ximf:instance name="Amoco" version="1.0" ximfVersion="2.0" xmlns:ximf="http://eads.org/ximf/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://eads.org/ximf/ ximf.xsd">\r
+ <ximf:dictionary id="OneDico">\r
+ <ximf:locale lang="fr">\r
+ <ximf:ilk entity="ilk-info-box">Information</ximf:ilk>\r
+ <ximf:ilk entity="ilk-security-panel">Securité</ximf:ilk>\r
+ <ximf:ilk entity="ilk-originator-reference">Réferences d'origine</ximf:ilk> \r
+ <ximf:ilk entity="ilk-reply-before">Répondre avant</ximf:ilk>\r
+ <ximf:ilk entity="ilk-classification-panel">Classification</ximf:ilk>\r
+ <ximf:ilk entity="ilk-classification">Classification de sécurité</ximf:ilk>\r
+ <ximf:ilk entity="ilk-privacy-mark">Marque privée</ximf:ilk> \r
+ <ximf:ilk entity="ilk-general">Général</ximf:ilk>\r
+ <ximf:ilk entity="ilk-confidential">Confidentiel</ximf:ilk> \r
+ <ximf:ilk entity="ilk-highly-confidential">Très confidentiel</ximf:ilk>\r
+ <ximf:ilk entity="ilk-minimum">Minimum</ximf:ilk>\r
+ <ximf:ilk entity="ilk-medium">Moyen</ximf:ilk>\r
+ <ximf:ilk entity="ilk-maximum">Maximum</ximf:ilk>\r
+ <ximf:ilk entity="ilk-critical">Critique</ximf:ilk> \r
+ </ximf:locale>\r
+ <ximf:locale lang="en-US">\r
+ <ximf:ilk entity="ilk-info-box">Information</ximf:ilk>\r
+ <ximf:ilk entity="ilk-security-panel">Security</ximf:ilk>\r
+ <ximf:ilk entity="ilk-reply-before">Reply before</ximf:ilk>\r
+ <ximf:ilk entity="ilk-originator-reference">Origin references</ximf:ilk>\r
+ <ximf:ilk entity="ilk-classification-panel">Classification</ximf:ilk>\r
+ <ximf:ilk entity="ilk-classification">Security classification</ximf:ilk>\r
+ <ximf:ilk entity="ilk-privacy-mark">Privacy mark</ximf:ilk>\r
+ <ximf:ilk entity="ilk-general">General</ximf:ilk>\r
+ <ximf:ilk entity="ilk-confidential">Confidential</ximf:ilk> \r
+ <ximf:ilk entity="ilk-highly-confidential">Highly Confidential</ximf:ilk>\r
+ <ximf:ilk entity="ilk-minimum">Minimum</ximf:ilk>\r
+ <ximf:ilk entity="ilk-medium">Medium</ximf:ilk>\r
+ <ximf:ilk entity="ilk-maximum">Maximum</ximf:ilk>\r
+ <ximf:ilk entity="ilk-critical">Critical</ximf:ilk> \r
+ </ximf:locale>\r
+ </ximf:dictionary>\r
+</ximf:instance>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<?xml-stylesheet type="text/xsl" href="ximftoxul.xsl"?>\r
+<ximf:instance name="Amoco" version="1.0" ximfVersion="2.0" xmlns:ximf="http://eads.org/ximf/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://eads.org/ximf/ ximf.xsd">\r
+\r
+ <!-- OID AMOCO -->\r
+ <ximf:header id="header-policy-identifier" headerName="X-XIMF-Security-Policy-Identifier" > \r
+ <ximf:string content="1.2.840.113549.1.9.16.7.1"/>\r
+ </ximf:header>\r
+ \r
+ <!-- Security Classification-->\r
+ <ximf:header id="header-classification" \r
+ headerName="X-XIMF-Security-Classification"\r
+ technicalHeaderName="X-XIMF-Security-Classification-Identifier"\r
+ type="string"\r
+ technicalType="oid"\r
+ ilk="ilk-classification"\r
+ isMandatory="true">\r
+ <ximf:set id="value-amoco-classification">\r
+ <ximf:string ilk="ilk-general" content="amoco-general" technicalContent="6" /> \r
+ <ximf:string ilk="ilk-confidential" content="amoco-confidential" technicalContent="7" />\r
+ <ximf:string ilk="ilk-highly-confidential" content="amoco-highly-confidential" technicalContent="8" /> \r
+ </ximf:set>\r
+ </ximf:header>\r
+ \r
+ <ximf:header id="header-privacy-mark" headerName="X-XIMF-Privacy-Mark" ilk="ilk-privacy-mark" isMandatory="true">\r
+ <ximf:set id="value-privacy-mark">\r
+ <ximf:string ilk="ilk-minimum" content="amoco-minimum" />\r
+ <ximf:string ilk="ilk-medium" content="amoco-medium" />\r
+ <ximf:string ilk="ilk-maximum" content="amoco-maximum" />\r
+ <ximf:string ilk="ilk-critical" content="amoco-critical" />\r
+ </ximf:set>\r
+ </ximf:header>\r
+ \r
+ <!-- headers advanced -->\r
+ <!-- headers advanced -->\r
+ <ximf:header id="header-primary-precedence" headerName="X-XIMF-Primary-Precedence" ilk="ilk-primary-precedence" isMandatory="true">\r
+ <ximf:set id="value-precedence">\r
+ <ximf:string id="data-routine-precedence" ilk="ilk-routine" content="routine" index="0" aclLevel="30"/>\r
+ <ximf:string id="data-urgent-precedence" ilk="ilk-urgent" content="priority" index="1" aclLevel="40"/>\r
+ <ximf:string id="data-immediat-precedence" ilk="ilk-immediat" content="immediate" index="2" aclLevel="50"/>\r
+ <ximf:string id="data-flash-precedence" ilk="ilk-flash" content="flash" index="3" aclLevel="100"/>\r
+ </ximf:set>\r
+ </ximf:header>\r
+ \r
+ <ximf:header id="header-copy-precedence" headerName="X-XIMF-Copy-Precedence" ilk="ilk-copy-precedence" isMandatory="false">\r
+ <ximf:set ref="value-precedence"/>\r
+ </ximf:header>\r
+ \r
+ <ximf:header id="header-reply-before" headerName="X-XIMF-Reply-Before" ilk="ilk-reply-before" isMandatory="false" type="date">\r
+ <ximf:string id="value-reply-before" editable="true" />\r
+ </ximf:header> \r
+ \r
+ <ximf:header id="header-originator-reference" headerName="X-XIMF-Originator-Reference" ilk="ilk-originator-reference" isMandatory="false" type="string">\r
+ <ximf:string id="value-originator-reference" maxItem="5" editable="true" separator=";"/>\r
+ </ximf:header>\r
+ \r
+</ximf:instance>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<ximf:instance name="Amoco" version="1.0" ximfVersion="2.0" xmlns:ximf="http://eads.org/ximf/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://eads.org/ximf/ ximf.xsd">\r
+<ximf:ihm xmlns:ximf="http://eads.org/ximf/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\r
+ <ximf:panel id="pane_security" ilk="ilk-classification-panel">\r
+ <ximf:groupbox id="group-classification" ilk="ilk-security-panel">\r
+ <ximf:headerRef>header-classification</ximf:headerRef> \r
+ <ximf:headerRef>header-privacy-mark</ximf:headerRef>\r
+ </ximf:groupbox> \r
+ <ximf:groupbox id="group-info" ilk="ilk-info-box"> \r
+ <ximf:headerRef>header-originator-reference</ximf:headerRef> \r
+ <ximf:headerRef>header-reply-before</ximf:headerRef> \r
+ </ximf:groupbox> \r
+ </ximf:panel> \r
+ <ximf:treeRcv>\r
+ <ximf:headerRef>header-classification</ximf:headerRef> \r
+ <ximf:headerRef>header-privacy-mark</ximf:headerRef>\r
+ </ximf:treeRcv>\r
+</ximf:ihm>\r
+</ximf:instance>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+\r
+<ximf:instance name="Amoco" version="1.0" ximfVersion="2.0" xmlns:ximf="http://eads.org/ximf/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://eads.org/ximf/ ximf.xsd">\r
+ <ximf:rule id="compatibility-rule" description="Règle sur la compatibilités X-SMTP / XIMF" >\r
+ <ximf:compatibility targetName="X-SMTP" targetVersion="1.1">\r
+ <ximf:aliasHeader headerName="X-P772-Version">\r
+ <ximf:aliasValue valueName="1.1"/> \r
+ </ximf:aliasHeader> \r
+ <ximf:aliasHeader headerName="X-P772-Originator-Reference" headerRef="X-XIMF-Originator-Reference"/>\r
+ <ximf:aliasHeader headerName="X-P772-Security-Classification" headerRef="X-XIMF-Security-Classification"/>\r
+ </ximf:compatibility> \r
+ </ximf:rule>\r
+ <ximf:rule id="association-rule" description="Règle d'associations de valeurs" >\r
+ <ximf:association>\r
+ <ximf:aliasHeader headerName="X-XIMF-Privacy-Mark" headerRef="X-XIMF-Security-Classification">\r
+ <ximf:aliasValue valueName="amoco-minimum,amoco-medium" valueRef="amoco-general" />\r
+ <ximf:aliasValue valueName="amoco-minimum,amoco-medium,amoco-maximum" valueRef="amoco-confidential" />\r
+ <ximf:aliasValue valueName="amoco-minimum,amoco-medium,amoco-maximum,amoco-critical" valueRef="amoco-highly-confidential" />\r
+ </ximf:aliasHeader> \r
+ </ximf:association>\r
+ </ximf:rule> \r
+</ximf:instance>\r
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<ximf xmlns:ximf="http://eads.org/ximf/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\r
+ <ximf:base name="Attribution_List">\r
+ <ximf:header>\r
+ <ximf:title>Attribution</ximf:title>\r
+ <ximf:description>Attribution keys</ximf:description>\r
+ <ximf:column>key</ximf:column>\r
+ <ximf:column>description</ximf:column>\r
+ </ximf:header>\r
+ <ximf:tree>\r
+ <ximf:description>\r
+ <ximf:data>HUMAN RESOURCE</ximf:data>\r
+ <ximf:data>Message for human resource only</ximf:data>\r
+ </ximf:description>\r
+ <ximf:description>\r
+ <ximf:data>SOFTWARE RESOURCE</ximf:data>\r
+ <ximf:data>Message for software resource only</ximf:data>\r
+ </ximf:description> \r
+ <ximf:description>\r
+ <ximf:data>BUSINESS RESOURCE</ximf:data>\r
+ <ximf:data>Message for businnes resource only</ximf:data>\r
+ </ximf:description> \r
+ <ximf:description>\r
+ <ximf:data>MARKET RESOURCE</ximf:data>\r
+ <ximf:data>Message for market resource only</ximf:data>\r
+ </ximf:description>\r
+ <ximf:description>\r
+ <ximf:data>ALL PUBLIC</ximf:data>\r
+ <ximf:data>Message for public</ximf:data>\r
+ </ximf:description>\r
+ <ximf:description>\r
+ <ximf:data>CONTRIBUTORS ONLY</ximf:data>\r
+ <ximf:data>Message for contributors only</ximf:data>\r
+ </ximf:description> \r
+ </ximf:tree>\r
+ </ximf:base>\r
+</ximf>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+\r
+<ximf:instance name="caterpillar" version="1.0" ximfVersion="2.0" xmlns:ximf="http://eads.org/ximf/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://eads.org/ximf/ ximf.xsd">\r
+ <ximf:dictionary id="OneDico">\r
+ <ximf:locale lang="fr">\r
+ <ximf:ilk entity="ilk-akw">Attribution</ximf:ilk>\r
+ <ximf:ilk entity="ilk-security-box">Sécurité</ximf:ilk>\r
+ <ximf:ilk entity="ilk-precedence-panel">Urgence</ximf:ilk>\r
+ <ximf:ilk entity="ilk-public">PUBLIC</ximf:ilk>\r
+ <ximf:ilk entity="ilk-confidential-green">CONFIDENTIEL VERT</ximf:ilk>\r
+ <ximf:ilk entity="ilk-confidential-yellow">CONFIDENTIEL JAUNE</ximf:ilk>\r
+ <ximf:ilk entity="ilk-confidential-red">CONFIDENTIEL ROUGE</ximf:ilk>\r
+ <ximf:ilk entity="ilk-routine">Routine</ximf:ilk>\r
+ <ximf:ilk entity="ilk-urgent">Urgent</ximf:ilk>\r
+ <ximf:ilk entity="ilk-immediat">Immédiat</ximf:ilk>\r
+ <ximf:ilk entity="ilk-flash">Flash</ximf:ilk> \r
+ <ximf:ilk entity="header-akw">Attribution</ximf:ilk>\r
+ <ximf:ilk entity="ilk-primary-precedence">Urgence pour action</ximf:ilk>\r
+ <ximf:ilk entity="ilk-copy-precedence">Urgence pour information</ximf:ilk>\r
+ <ximf:ilk entity="ilk-advanced-panel">Avancé</ximf:ilk>\r
+ <ximf:ilk entity="ilk-originator-reference">Réferences d'origine</ximf:ilk> \r
+ <ximf:ilk entity="ilk-reply-before">Répondre avant</ximf:ilk>\r
+ <ximf:ilk entity="ilk-classification-panel">Classification</ximf:ilk>\r
+ <ximf:ilk entity="ilk-classification">Classification de sécurité</ximf:ilk>\r
+ <ximf:ilk entity="ilk-privacy-mark">Marque privée</ximf:ilk> \r
+ <ximf:ilk entity="ilk-general">Général</ximf:ilk>\r
+ <ximf:ilk entity="ilk-confidential">Confidentiel</ximf:ilk> \r
+ <ximf:ilk entity="ilk-highly-confidential">Très confidentiel</ximf:ilk>\r
+ <ximf:ilk entity="ilk-minimum">Minimum</ximf:ilk>\r
+ <ximf:ilk entity="ilk-medium">Moyen</ximf:ilk>\r
+ <ximf:ilk entity="ilk-maximum">Maximum</ximf:ilk>\r
+ <ximf:ilk entity="ilk-critical">Critique</ximf:ilk> \r
+ </ximf:locale>\r
+ <ximf:locale lang="en-US">\r
+ <ximf:ilk entity="ilk-akw">Attribution</ximf:ilk>\r
+ <ximf:ilk entity="ilk-security-box">Security</ximf:ilk>\r
+ <ximf:ilk entity="ilk-precedence-panel">Precedence</ximf:ilk>\r
+ <ximf:ilk entity="ilk-public">PUBLIC</ximf:ilk>\r
+ <ximf:ilk entity="ilk-confidential-green">CONFIDENTIAL GREEN</ximf:ilk>\r
+ <ximf:ilk entity="ilk-confidential-yellow">CONFIDENTIAL YELLOW</ximf:ilk>\r
+ <ximf:ilk entity="ilk-confidential-red">CONFIDENTIAL RED</ximf:ilk>\r
+ <ximf:ilk entity="ilk-routine">Routine</ximf:ilk>\r
+ <ximf:ilk entity="ilk-urgent">Urgent</ximf:ilk>\r
+ <ximf:ilk entity="ilk-immediat">Immediate</ximf:ilk>\r
+ <ximf:ilk entity="ilk-flash">Flash</ximf:ilk>\r
+ <ximf:ilk entity="header-akw">Attribution</ximf:ilk>\r
+ <ximf:ilk entity="ilk-primary-precedence">Primary precedence</ximf:ilk>\r
+ <ximf:ilk entity="ilk-copy-precedence">Copy precedence</ximf:ilk>\r
+ <ximf:ilk entity="ilk-advanced-panel">Advanced</ximf:ilk>\r
+ <ximf:ilk entity="ilk-reply-before">Reply before</ximf:ilk>\r
+ <ximf:ilk entity="ilk-originator-reference">Origin references</ximf:ilk>\r
+ <ximf:ilk entity="ilk-classification-panel">Classification</ximf:ilk>\r
+ <ximf:ilk entity="ilk-classification">Security classification</ximf:ilk>\r
+ <ximf:ilk entity="ilk-privacy-mark">Privacy mark</ximf:ilk>\r
+ <ximf:ilk entity="ilk-general">General</ximf:ilk>\r
+ <ximf:ilk entity="ilk-confidential">Confidential</ximf:ilk> \r
+ <ximf:ilk entity="ilk-highly-confidential">Highly Confidential</ximf:ilk>\r
+ <ximf:ilk entity="ilk-minimum">Minimum</ximf:ilk>\r
+ <ximf:ilk entity="ilk-medium">Medium</ximf:ilk>\r
+ <ximf:ilk entity="ilk-maximum">Maximum</ximf:ilk>\r
+ <ximf:ilk entity="ilk-critical">Critical</ximf:ilk> \r
+ </ximf:locale>\r
+ </ximf:dictionary>\r
+</ximf:instance>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<?xml-stylesheet type="text/xsl" href="ximftoxul.xsl"?>\r
+<ximf:instance name="Caterpillar" version="1.0" ximfVersion="2.0" xmlns:ximf="http://eads.org/ximf/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://eads.org/ximf/ ximf.xsd">\r
+\r
+ <!-- OID CATERPILLAR -->\r
+ <ximf:header id="header-policy-identifier" headerName="X-XIMF-Security-Policy-Identifier" > \r
+ <ximf:string content="1.2.840.113549.1.9.16.7.2"/>\r
+ </ximf:header>\r
+ \r
+ <!-- Security Classification-->\r
+ <ximf:header id="header-classification" \r
+ headerName="X-XIMF-Security-Classification"\r
+ technicalHeaderName="X-XIMF-Security-Classification-Identifier"\r
+ type="string"\r
+ technicalType="oid"\r
+ ilk="ilk-classification"\r
+ isMandatory="true">\r
+ <ximf:set id="value-caterpillar-classification">\r
+ <ximf:string ilk="ilk-public" content="caterpillar-public" technicalContent="6" /> \r
+ <ximf:string ilk="ilk-confidential-green" content="caterpillar-green" technicalContent="7" />\r
+ <ximf:string ilk="ilk-confidential-yellow" content="caterpillar-yellow" technicalContent="8" />\r
+ <ximf:string ilk="ilk-confidential-red" content="caterpillar-red" technicalContent="9" /> \r
+ </ximf:set>\r
+ </ximf:header>\r
+ \r
+ <!-- headers advanced -->\r
+ <ximf:header id="header-primary-precedence" headerName="X-XIMF-Primary-Precedence" ilk="ilk-primary-precedence" isMandatory="true">\r
+ <ximf:set id="value-precedence">\r
+ <ximf:string id="data-routine-precedence" ilk="ilk-routine" content="routine" index="0" aclLevel="30"/>\r
+ <ximf:string id="data-urgent-precedence" ilk="ilk-urgent" content="priority" index="1" aclLevel="40"/>\r
+ <ximf:string id="data-immediat-precedence" ilk="ilk-immediat" content="immediate" index="2" aclLevel="50"/>\r
+ <ximf:string id="data-flash-precedence" ilk="ilk-flash" content="flash" index="3" aclLevel="100"/>\r
+ </ximf:set>\r
+ </ximf:header>\r
+ \r
+ <ximf:header id="header-copy-precedence" headerName="X-XIMF-Copy-Precedence" ilk="ilk-copy-precedence" isMandatory="false">\r
+ <ximf:set ref="value-precedence"/>\r
+ </ximf:header>\r
+ \r
+ <!-- attribution --> \r
+ <ximf:header id="header-akw" headerName="X-XIMF-Attribution-Key-Word" ilk="ilk-akw" type="string">\r
+ <ximf:set ref="attribution-list.xml" separator=";" maxItem="2"/>\r
+ </ximf:header> \r
+ \r
+</ximf:instance>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<ximf:instance name="Caterpillar" version="1.0" ximfVersion="2.0" xmlns:ximf="http://eads.org/ximf/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://eads.org/ximf/ ximf.xsd">\r
+<ximf:ihm xmlns:ximf="http://eads.org/ximf/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\r
+ <ximf:panel id="pane_security" ilk="ilk-classification-panel">\r
+ <ximf:groupbox ilk="ilk-security-box">\r
+ <ximf:headerRef>header-classification</ximf:headerRef>\r
+ </ximf:groupbox>\r
+ </ximf:panel> \r
+ <ximf:panel id="pane_adanced" ilk="ilk-advanced-panel">\r
+ <ximf:groupbox ilk="ilk-precedence-panel">\r
+ <ximf:headerRef>header-primary-precedence</ximf:headerRef>\r
+ <ximf:headerRef>header-copy-precedence</ximf:headerRef>\r
+ <ximf:headerRef>header-akw</ximf:headerRef>\r
+ </ximf:groupbox> \r
+ </ximf:panel>\r
+ <ximf:treeRcv>\r
+ <ximf:headerRef>header-classification</ximf:headerRef>\r
+ </ximf:treeRcv>\r
+</ximf:ihm>\r
+</ximf:instance>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+\r
+<ximf:instance name="caterpillar" version="1.0" ximfVersion="2.0" xmlns:ximf="http://eads.org/ximf/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://eads.org/ximf/ ximf.xsd">\r
+ <ximf:rule id="compatibility-rule" description="Règle sur la compatibilités X-SMTP / XIMF" >\r
+ <ximf:association>\r
+ <ximf:aliasHeader headerName="X-XIMF-Copy-Precedence" headerRef="X-XIMF-Primary-Precedence"> \r
+ <ximf:aliasValue valueName="routine" valueRef="routine" />\r
+ <ximf:aliasValue valueName="routine" valueRef="priority" />\r
+ <ximf:aliasValue valueName="routine,priority" valueRef="immediate" />\r
+ <ximf:aliasValue valueName="routine,priority,immediate" valueRef="flash" />\r
+ </ximf:aliasHeader>\r
+ </ximf:association>\r
+ </ximf:rule> \r
+ <!-- \r
+ <ximf:rule id="security-sign-rule" description="Règle de signature des entêtes XIMF" > \r
+ <ximf:secureHeaders targetName="SecureHeaders"> \r
+ <ximf:aliasHeader headerName="X-XIMF-Security-Policy-Identifier" status="0"/> \r
+ <ximf:aliasHeader headerName="X-XIMF-Security-Classification-Identifier" status="0"/>\r
+ <ximf:aliasHeader headerName="X-XIMF-Security-Classification" status="0"/> \r
+ <ximf:aliasHeader headerName="Reply-To" status="0"/>\r
+ <ximf:aliasHeader headerName="Sender" status="0"/> \r
+ <ximf:aliasHeader headerName="To" status="0"/>\r
+ <ximf:aliasHeader headerName="Cc" status="0"/>\r
+ <ximf:aliasHeader headerName="From" status="0"/>\r
+ <ximf:aliasHeader headerName="Subject" status="0"/> \r
+ </ximf:secureHeaders>\r
+ <ximf:securityLabel targetName="SecurityLabel" id="intraced">\r
+ <ximf:aliasHeader headerName="SecurityPolicyIdentifier" headerRef="X-XIMF-Security-Policy-Identifier"/> \r
+ <ximf:aliasHeader headerName="SecurityClassification" headerRef="X-XIMF-Security-Classification-Identifier"/> \r
+ <ximf:aliasHeader headerName="ESSPrivacyMark" headerRef="X-XIMF-Privacy-Mark"/> \r
+ <ximf:aliasHeader headerName="SecurityCategory" headerRef="X-XIMF-Security-Categories-Identifier" type="2"/>\r
+ </ximf:securityLabel> \r
+ </ximf:rule> \r
+ -->\r
+ <ximf:rule id="label-pictures-rule" description="rule to display pictures on received mails" > \r
+ <ximf:classificationPictures targetName="ClassificationPictures">\r
+ <ximf:aliasHeader headerName="url" headerRef="X-XIMF-Security-Classification-Identifier" > \r
+ <ximf:aliasValue valueRef="7" valueName="chrome://ximf-conpany-def/content/CaterpillarInc/resource/caterpillar-green.png" />\r
+ <ximf:aliasValue valueRef="8" valueName="chrome://ximf-conpany-def/content/CaterpillarInc/resource/caterpillar-yellow.png" />\r
+ <ximf:aliasValue valueRef="9" valueName="chrome://ximf-conpany-def/content/CaterpillarInc/resource/caterpillar-red.png" /> \r
+ </ximf:aliasHeader>\r
+ </ximf:classificationPictures> \r
+ </ximf:rule>\r
+</ximf:instance>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+\r
+<ximf:instance name="Whirlpool" version="1.0" ximfVersion="2.0" xmlns:ximf="http://eads.org/ximf/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://eads.org/ximf/ ximf.xsd">\r
+ <ximf:dictionary id="OneDico">\r
+ <ximf:locale lang="fr">\r
+ <ximf:ilk entity="ilk-exempted-address">Adresses exemptées</ximf:ilk>\r
+ <ximf:ilk entity="ilk-address">Addresses</ximf:ilk>\r
+ <ximf:ilk entity="ilk-urgence-box">Information</ximf:ilk>\r
+ <ximf:ilk entity="ilk-general-panel">Général</ximf:ilk>\r
+ <ximf:ilk entity="ilk-internal">INTERNE</ximf:ilk>\r
+ <ximf:ilk entity="ilk-public">PUBLIC</ximf:ilk>\r
+ <ximf:ilk entity="ilk-security-panel">Securité</ximf:ilk>\r
+ <ximf:ilk entity="ilk-originator-reference">Réferences d'origine</ximf:ilk> \r
+ <ximf:ilk entity="ilk-reply-before">Répondre avant</ximf:ilk>\r
+ <ximf:ilk entity="ilk-classification-panel">Classification</ximf:ilk>\r
+ <ximf:ilk entity="ilk-classification">Classification de sécurité</ximf:ilk>\r
+ <ximf:ilk entity="ilk-privacy-mark">Marque privée</ximf:ilk> \r
+ <ximf:ilk entity="ilk-general">Général</ximf:ilk>\r
+ <ximf:ilk entity="ilk-confidential">CONFIDENTIEL</ximf:ilk> \r
+ <ximf:ilk entity="ilk-highly-confidential">Très confidentiel</ximf:ilk>\r
+ <ximf:ilk entity="ilk-minimum">Minimum</ximf:ilk>\r
+ <ximf:ilk entity="ilk-medium">Moyen</ximf:ilk>\r
+ <ximf:ilk entity="ilk-maximum">Maximum</ximf:ilk>\r
+ <ximf:ilk entity="ilk-critical">Critique</ximf:ilk> \r
+ </ximf:locale>\r
+ <ximf:locale lang="en-US">\r
+ <ximf:ilk entity="ilk-exempted-address">Exempted adresses</ximf:ilk>\r
+ <ximf:ilk entity="ilk-address">Address</ximf:ilk>\r
+ <ximf:ilk entity="ilk-urgence-box">Information</ximf:ilk>\r
+ <ximf:ilk entity="ilk-general-panel">General</ximf:ilk>\r
+ <ximf:ilk entity="ilk-internal">INTERAL</ximf:ilk>\r
+ <ximf:ilk entity="ilk-public">PUBLIC</ximf:ilk>\r
+ <ximf:ilk entity="ilk-security-panel">Security</ximf:ilk>\r
+ <ximf:ilk entity="ilk-reply-before">Reply before</ximf:ilk>\r
+ <ximf:ilk entity="ilk-originator-reference">Origin references</ximf:ilk>\r
+ <ximf:ilk entity="ilk-classification-panel">Classification</ximf:ilk>\r
+ <ximf:ilk entity="ilk-classification">Security classification</ximf:ilk>\r
+ <ximf:ilk entity="ilk-privacy-mark">Privacy mark</ximf:ilk>\r
+ <ximf:ilk entity="ilk-general">General</ximf:ilk>\r
+ <ximf:ilk entity="ilk-confidential">CONFIDENTIAL</ximf:ilk> \r
+ <ximf:ilk entity="ilk-highly-confidential">Highly Confidential</ximf:ilk>\r
+ <ximf:ilk entity="ilk-minimum">Minimum</ximf:ilk>\r
+ <ximf:ilk entity="ilk-medium">Medium</ximf:ilk>\r
+ <ximf:ilk entity="ilk-maximum">Maximum</ximf:ilk>\r
+ <ximf:ilk entity="ilk-critical">Critical</ximf:ilk> \r
+ </ximf:locale>\r
+ </ximf:dictionary>\r
+</ximf:instance>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<?xml-stylesheet type="text/xsl" href="ximftoxul.xsl"?>\r
+<ximf:instance name="Whirlpool" version="1.0" ximfVersion="2.0" xmlns:ximf="http://eads.org/ximf/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://eads.org/ximf/ ximf.xsd">\r
+\r
+ <!-- OID WHIRLPOOL -->\r
+ <ximf:header id="header-policy-identifier" headerName="X-XIMF-Security-Policy-Identifier" > \r
+ <ximf:string content="1.2.840.113549.1.9.16.7.3"/>\r
+ </ximf:header>\r
+ \r
+ <!-- Security Classification-->\r
+ <ximf:header id="header-classification" \r
+ headerName="X-XIMF-Security-Classification"\r
+ technicalHeaderName="X-XIMF-Security-Classification-Identifier"\r
+ type="string"\r
+ technicalType="oid"\r
+ ilk="ilk-classification"\r
+ isMandatory="true">\r
+ <ximf:set id="value-whirlpool-classification">\r
+ <ximf:string ilk="ilk-public" content="whirlpool-public" technicalContent="6" > \r
+ <ximf:linkedValue ref="value-privacy-mark-other" />\r
+ </ximf:string> \r
+ <ximf:string ilk="ilk-internal" content="whirlpool-internal" technicalContent="7" >\r
+ <ximf:linkedValue ref="value-privacy-mark-confidential" />\r
+ </ximf:string> \r
+ <ximf:string ilk="ilk-confidential" content="whirlpool-confidential" technicalContent="8" >\r
+ <ximf:linkedValue ref="value-privacy-mark-confidential" />\r
+ </ximf:string> \r
+ </ximf:set>\r
+ </ximf:header> \r
+ <ximf:header id="header-privacy-mark" headerName="X-XIMF-Privacy-Mark" ilk="ilk-privacy-mark" isMandatory="false">\r
+ <ximf:set id="value-privacy-mark-confidential">\r
+ <ximf:compstring ilk="LIMITED TO" content="LIMITED TO" separator=" : ">\r
+ <ximf:string editable="true" />\r
+ </ximf:compstring>\r
+ <ximf:string ilk="MAKE NO COPY" content="MAKE NO COPY" />\r
+ <ximf:string ilk="ATTORNEY-CLIENT PRIVILEGED DOCUMENT" content="ATTORNEY-CLIENT PRIVILEGED DOCUMENT" />\r
+ <ximf:string ilk="THIRD PARTY CONFIDENTIAL" content="THIRD PARTY CONFIDENTIAL" />\r
+ <ximf:string ilk="COVERED BY A NON-ANALYSIS AGREEMENT" content="COVERED BY A NON-ANALYSIS AGREEMENT" />\r
+ </ximf:set>\r
+ <ximf:set id="value-privacy-mark-other">\r
+ <ximf:string ilk="SEND BY INTERNET" content="SEND BY INTERNET" />\r
+ <ximf:string ilk="PRIVATE" content="PRIVATE" />\r
+ </ximf:set>\r
+ </ximf:header>\r
+ \r
+ <!-- headers unmandatories -->\r
+ <ximf:header id="header-reply-before" headerName="X-XIMF-Reply-Before" ilk="ilk-reply-before" isMandatory="false" type="date">\r
+ <ximf:string id="value-reply-before" editable="true" />\r
+ </ximf:header> \r
+ \r
+ <ximf:header id="header-originator-reference" headerName="X-XIMF-Originator-Reference" ilk="ilk-originator-reference" isMandatory="false" type="string">\r
+ <ximf:string id="value-originator-reference" maxItem="10" editable="true" separator=" - "/>\r
+ </ximf:header>\r
+ \r
+ <!-- Adresses exemptées -->\r
+ <ximf:header id="header-exempted-address" headerName="X-XIMF-Exempted-Address" ilk="ilk-exempted-address" isMandatory="false" type="address">\r
+ <ximf:string id="value-exempted-address" editable="true" />\r
+ </ximf:header>\r
+\r
+</ximf:instance>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<ximf:instance name="Whirlpool" version="1.0" ximfVersion="2.0" xmlns:ximf="http://eads.org/ximf/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://eads.org/ximf/ ximf.xsd">\r
+ <ximf:ihm xmlns:ximf="http://eads.org/ximf/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\r
+ <ximf:panel id="pane_security" ilk="ilk-security-panel">\r
+ <ximf:groupbox id="group-classification" ilk="ilk-classification-panel">\r
+ <ximf:headerRef>header-classification</ximf:headerRef> \r
+ <ximf:headerRef>header-privacy-mark</ximf:headerRef>\r
+ </ximf:groupbox> \r
+ </ximf:panel> \r
+ <ximf:panel id="pane_general" ilk="ilk-general-panel"> \r
+ <ximf:groupbox id="group-ref" ilk="ilk-urgence-box"> \r
+ <ximf:headerRef>header-originator-reference</ximf:headerRef> \r
+ <ximf:headerRef>header-reply-before</ximf:headerRef> \r
+ </ximf:groupbox> \r
+ </ximf:panel>\r
+ <ximf:panel id="pane_address" ilk="ilk-address"> \r
+ <ximf:headerRef>header-exempted-address</ximf:headerRef> \r
+ </ximf:panel>\r
+ <ximf:treeRcv>\r
+ <ximf:headerRef>header-classification</ximf:headerRef> \r
+ <ximf:headerRef>header-privacy-mark</ximf:headerRef>\r
+ </ximf:treeRcv>\r
+ </ximf:ihm>\r
+</ximf:instance>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+\r
+<ximf:instance name="Whirlpool" version="1.0" ximfVersion="2.0" xmlns:ximf="http://eads.org/ximf/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://eads.org/ximf/ ximf.xsd">\r
+ <!-- \r
+ <ximf:rule id="security-sign-rule" description="Règle de signature des entêtes XIMF" > \r
+ <ximf:secureHeaders targetName="SecureHeaders"> \r
+ <ximf:aliasHeader headerName="X-XIMF-Security-Policy-Identifier" status="0"/> \r
+ <ximf:aliasHeader headerName="X-XIMF-Security-Classification-Identifier" status="0"/>\r
+ <ximf:aliasHeader headerName="X-XIMF-Security-Classification" status="0"/> \r
+ <ximf:aliasHeader headerName="Reply-To" status="0"/>\r
+ <ximf:aliasHeader headerName="Sender" status="0"/> \r
+ <ximf:aliasHeader headerName="To" status="0"/>\r
+ <ximf:aliasHeader headerName="Cc" status="0"/>\r
+ <ximf:aliasHeader headerName="From" status="0"/>\r
+ <ximf:aliasHeader headerName="Subject" status="0"/> \r
+ </ximf:secureHeaders>\r
+ <ximf:securityLabel targetName="SecurityLabel" id="intraced"> \r
+ <ximf:aliasHeader headerName="SecurityPolicyIdentifier" headerRef="X-XIMF-Security-Policy-Identifier"/> \r
+ <ximf:aliasHeader headerName="SecurityClassification" headerRef="X-XIMF-Security-Classification-Identifier"/> \r
+ <ximf:aliasHeader headerName="ESSPrivacyMark" headerRef="X-XIMF-Privacy-Mark"/> \r
+ <ximf:aliasHeader headerName="SecurityCategory" headerRef="X-XIMF-Security-Categories-Identifier" type="2"/>\r
+ </ximf:securityLabel> \r
+ </ximf:rule> \r
+ -->\r
+</ximf:instance>\r
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<profile>\r
+ <theme name="Company Def"\r
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+ xsi:noNamespaceSchemaLocation="D:\DOC\DOC_THUN_INTRACED\ximf_profile.xsd">\r
+ <instance id="smtp" ximfVersion="2.0" version="1.0" label="Message standard" name="smtp" directory="" author="string"/>\r
+ <instance id="idAmocoDefinition" ximfVersion="2.0" version="1.0"\r
+ name="Amoco"\r
+ directory="{E255643F-7DCA-4cd8-B0C2-61EAADE39FCE}/chrome/content/AmocoCorporation/"\r
+ author="Ximfmail">\r
+ <schema id="AAAAB" name="Amoco">headers-amoco.xml</schema>\r
+ <dictionary author="EADS DS">dictionary-amoco.xml</dictionary>\r
+ <ihm id="AAAAC" name="string">ihm-amoco.xml</ihm>\r
+ <rule id="AAAAD" author="string">rules-amoco.xml</rule>\r
+ </instance>\r
+ <instance id="idCaterpillarDefinition" ximfVersion="2.0"\r
+ version="1.0" name="Caterpillar"\r
+ directory="{E255643F-7DCA-4cd8-B0C2-61EAADE39FCE}/chrome/content/CaterpillarInc/"\r
+ author="Ximfmail">\r
+ <schema name="Caterpillar">headers-caterpillar.xml</schema>\r
+ <dictionary>dictionary-caterpillar.xml</dictionary>\r
+ <ihm>ihm-caterpillar.xml</ihm>\r
+ <rule author="string">rules-caterpillar.xml</rule>\r
+ </instance>\r
+ <instance id="idWhirlpoolDefinition" ximfVersion="2.0"\r
+ version="1.0" name="Whirlpool"\r
+ directory="{E255643F-7DCA-4cd8-B0C2-61EAADE39FCE}/chrome/content/WhirlpoolCorporation/"\r
+ author="Ximfmail">\r
+ <schema name="Whirlpool">headers-whirlpool.xml</schema>\r
+ <dictionary>dictionary-whirlpool.xml</dictionary>\r
+ <ihm>ihm-whirlpool.xml</ihm>\r
+ <rule>rules-whirlpool.xml</rule>\r
+ </instance>\r
+ </theme>\r
+</profile>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">\r
+ <Description about="urn:mozilla:install-manifest">\r
+ <em:name>Definition Company Sample</em:name>\r
+ <em:version>3.1.4+0.3.0</em:version>\r
+ <em:id>{E255643F-7DCA-4cd8-B0C2-61EAADE39FCE}</em:id>\r
+ <em:description>Sample Definition Instances for Ximfmail</em:description>\r
+\r
+ <em:targetApplication>\r
+ <!-- Thunderbird -->\r
+ <Description>\r
+ <em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>\r
+ <em:minVersion>3.1</em:minVersion>\r
+ <em:maxVersion>3.1.*</em:maxVersion>\r
+ </Description>\r
+ </em:targetApplication>\r
+\r
+ <!-- Development team -->\r
+ <em:creator>CASSIDIAN - an EADS Company</em:creator>\r
+\r
+ <!-- Informations -->\r
+ <em:homepageURL>http://www.cassidian.com/cassidian/int/en.html</em:homepageURL>\r
+ <em:optionsURL/><em:aboutURL/><em:iconURL/><em:updateURL/></Description>\r
+</RDF>
\ No newline at end of file
--- /dev/null
+ximf-company-def.jar:
+% content ximf-company-def %content/ xpcnativewrappers=yes
+% locale ximf-company-def fr %locale/fr-FR/
+% locale ximf-company-def us %locale/en-US/
+% skin ximf-incompany-def %classic/1.0 skin/classic/
+ content/CaterpillarInc/resource/caterpillar-green.png (chrome/content/CaterpillarInc/resource/caterpillar-green.png)
+ content/CaterpillarInc/resource/caterpillar-yellow.png (chrome/content/CaterpillarInc/resource/caterpillar-yellow.png)
+ content/CaterpillarInc/resource/caterpillar-red.png (chrome/content/CaterpillarInc/resource/caterpillar-red.png)
+
+
--- /dev/null
+Ximfmail (3.1.11+0.6.4)
+* Corrective on blocking TrustedBird on downloading messages with big attachments
+* Corrective on using settings to sign messages
+-- Sep 09 2011
--- /dev/null
+#
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is mozilla.org code.
+#
+# The Initial Developer of the Original Code is
+# Netscape Communications Corporation.
+# Portions created by the Initial Developer are Copyright (C) 1998
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#
+# 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.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH = ../../..
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+MODULE = ximfmail
+DIRS =
+
+XPI_NAME = ximf_mail
+INSTALL_EXTENSION_ID = {A627B834-BD9F-4b3f-9AF5-347B5A570402}
+XPI_PKGNAME = ximf_mail
+
+DIST_FILES = install.rdf update.rdf
+
+USE_EXTENSION_MANIFEST = 1
+
+libs::
+ $(INSTALL) $(srcdir)/components/*.js $(FINAL_TARGET)/components
+ $(INSTALL) $(srcdir)/chrome/content/theme/*.xsl $(FINAL_TARGET)/chrome/content/theme
+
+include $(topsrcdir)/config/rules.mk
-/* ***** 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 ***** */
-
-/*
- * global variables
- */
-var gJSLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].createInstance(Components.interfaces.mozIJSSubScriptLoader);
-var gXimfmailIdentity=null;
-gJSLoader.loadSubScript("chrome://ximfmail/content/jquery.js");
-gJSLoader.loadSubScript("chrome://ximfmail/content/controler-ximfmail.js");
-gJSLoader.loadSubScript("chrome://ximfmail/content/constant-ximfmail.js");
-
-
-/*
- * new theme selection : load instances of theme
- */
-function onCommandTheme(){
- var themeRef = $("#listTheme").attr("value");
- ChangeRefAttrRdfElement("instanceCompose", themeRef);
- InitRDFMenuList("instanceComposeList");
- ChangeRefAttrRdfElement("instanceTreeThread", themeRef);
- InitRDFMenuList("instanceTreeThreadList");
- ChangeRefAttrRdfElement("instanceMailPanel", themeRef);
- InitRDFMenuList("instanceMailPanelList");
-};
-
-
-/*
- * load pref ximfmail settings
- */
-function onInit(aPageId, aServerId){
-
- if(gXimfmailIdentity == null){
- // no account id (local folder)
- $("#checkListTheme").attr("checked", "false");
- UseXimfmail();
- $("#checkListTheme").attr("disabled", "true");
- return;
- }
- $("#checkListTheme").removeAttr("disabled");
-
- //get XIMF instances of profile for account
- CreateXimfmailCatalog();
- var listInstances = document.getElementById("listThemPopup");
- listInstances.database.AddDataSource(gXimfCatalog.getDSCatalog());
- listInstances.builder.rebuild();
-
- //alert("Informations compte : \r\n\n" + aPageId + "\r\n"+ aServerId + "\r\n" + gXimfIdentity + "\r\n" + gXimfAccount.incomingServer.key);
- UpdateRDFListWithPref(gXimfmailIdentity.key,"ximfmail_theme_ref","listTheme");
- onCommandTheme();
- UpdateRDFListWithPref(gXimfmailIdentity.key,"ximfmail_instance_compose_ref","instanceComposeList");
- UpdateRDFListWithPref(gXimfmailIdentity.key,XIMF_PREF_IDENTITY_TREETHREAD_REF,"instanceTreeThreadList");
- UpdateRDFListWithPref(gXimfmailIdentity.key,XIMF_PREF_IDENTITY_MAIL_PANEL_REF,"instanceMailPanelList");
-
- // determine if user uses ximfmail
- if(gXimfmailIdentity.getBoolAttribute(XIMF_PREF_IDENTITY_USE_XIMFMAIL)){
- $("#checkListTheme").attr("checked", "true");
- }else{
- $("#checkListTheme").attr("checked", "false");
- }
-
- $("#listTheme").bind('command', onCommandTheme);
- $("#checkListTheme").click(UseXimfmail);
- UseXimfmail();
-
- // determine if user wants XSMTP compatibility
- $("#xsmtpComptibilityBox").attr("checked", gXimfmailIdentity.getBoolAttribute("ximfmail_xsmtp_compatibility_on"));
- //$("#secureHeadersRuleBox").attr("checked", gXimfmailIdentity.getBoolAttribute("ximfmail_secure_header_on"));
- //$("#signMsgAlwaysRuleBox").attr("checked", gXimfmailIdentity.getBoolAttribute("ximfmail_sign_message_always_on"));
-
-}
-
-/*
- *
- */
-function UseXimfmail(){
- //IsDisableXimfmailManager("checkListTheme","isUsingXimfail");
- //alert("UseXimfmail " +idCheckElement+" "+idBroadcaster );
- if($("#checkListTheme").attr("checked") == "true"){
- $("#isUsingXimfail").attr("disabled","false");
- return false;
- }else{
- $("#isUsingXimfail").attr("disabled","true");
- return true;
- }
-}
-
-/*
- * get pref settings
- */
-function onPreInit(account, accountValues){
- gXimfmailIdentity = account.defaultIdentity;
-}
-
-/*
- * save all changes on this page
- */
-function onSave(){
- if(gXimfmailIdentity == null)return;
- // save ximfmail selection to preferences
- SetXimfmailPref(gXimfmailIdentity.key, "ximfmail_theme_ref", $("#listTheme").attr("value"));
- SetXimfmailPref(gXimfmailIdentity.key, "ximfmail_theme_name", $("#listTheme").attr("label"));
- SetXimfmailPref(gXimfmailIdentity.key, "ximfmail_instance_compose_ref", $("#instanceComposeList").attr("value"));
- gXimfmailIdentity.setCharAttribute(XIMF_PREF_IDENTITY_TREETHREAD_REF,$("#instanceTreeThreadList").attr("value"));
- gXimfmailIdentity.setCharAttribute(XIMF_PREF_IDENTITY_MAIL_PANEL_REF,$("#instanceMailPanelList").attr("value"));
-
- if($("#checkListTheme").attr("checked") == "true"){
- gXimfmailIdentity.setBoolAttribute(XIMF_PREF_IDENTITY_USE_XIMFMAIL,true);
- try{CreateSecurityLabelXml()}catch(e){}
- }else{
- gXimfmailIdentity.setBoolAttribute(XIMF_PREF_IDENTITY_USE_XIMFMAIL,false);
- }
-
- if($("#xsmtpComptibilityBox").attr("checked") == "true"){
- gXimfmailIdentity.setBoolAttribute("ximfmail_xsmtp_compatibility_on",true);
- }else{
- gXimfmailIdentity.setBoolAttribute("ximfmail_xsmtp_compatibility_on",false);
- }
+/* ***** 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
+ * global variables\r
+ */\r
+var gJSLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].createInstance(Components.interfaces.mozIJSSubScriptLoader); \r
+var gXimfmailIdentity=null;\r
+gJSLoader.loadSubScript("chrome://ximfmail/content/jquery.js");\r
+gJSLoader.loadSubScript("chrome://ximfmail/content/controler-ximfmail.js");\r
+gJSLoader.loadSubScript("chrome://ximfmail/content/constant-ximfmail.js");\r
+\r
+\r
+/* \r
+ * new theme selection : load instances of theme\r
+ */\r
+function onCommandTheme(){ \r
+ var themeRef = $("#listTheme").attr("value"); \r
+ ChangeRefAttrRdfElement("instanceCompose", themeRef);\r
+ InitRDFMenuList("instanceComposeList"); \r
+ ChangeRefAttrRdfElement("instanceTreeThread", themeRef);\r
+ InitRDFMenuList("instanceTreeThreadList");\r
+ ChangeRefAttrRdfElement("instanceMailPanel", themeRef);\r
+ InitRDFMenuList("instanceMailPanelList");\r
+};\r
+\r
+\r
+/*\r
+ * load pref ximfmail settings\r
+ */ \r
+function onInit(aPageId, aServerId){\r
+ \r
+ if(gXimfmailIdentity == null){\r
+ // no account id (local folder)\r
+ $("#checkListTheme").attr("checked", "false");\r
+ UseXimfmail();\r
+ $("#checkListTheme").attr("disabled", "true"); \r
+ return; \r
+ }\r
+ $("#checkListTheme").removeAttr("disabled");\r
+ \r
+ //get XIMF instances of profile for account\r
+ CreateXimfmailCatalog();\r
+ var listInstances = document.getElementById("listThemPopup"); \r
+ listInstances.database.AddDataSource(gXimfCatalog.getDSCatalog()); \r
+ listInstances.builder.rebuild();\r
+ \r
+ //alert("Informations compte : \r\n\n" + aPageId + "\r\n"+ aServerId + "\r\n" + gXimfIdentity + "\r\n" + gXimfAccount.incomingServer.key);\r
+ UpdateRDFListWithPref(gXimfmailIdentity.key,"ximfmail_theme_ref","listTheme");\r
+ onCommandTheme();\r
+ UpdateRDFListWithPref(gXimfmailIdentity.key,"ximfmail_instance_compose_ref","instanceComposeList");\r
+ UpdateRDFListWithPref(gXimfmailIdentity.key,XIMF_PREF_IDENTITY_TREETHREAD_REF,"instanceTreeThreadList");\r
+ UpdateRDFListWithPref(gXimfmailIdentity.key,XIMF_PREF_IDENTITY_MAIL_PANEL_REF,"instanceMailPanelList");\r
+ \r
+ // determine if user uses ximfmail \r
+ if(gXimfmailIdentity.getBoolAttribute(XIMF_PREF_IDENTITY_USE_XIMFMAIL)){\r
+ $("#checkListTheme").attr("checked", "true");\r
+ }else{\r
+ $("#checkListTheme").attr("checked", "false");\r
+ }\r
+ \r
+ $("#listTheme").bind('command', onCommandTheme);\r
+ $("#checkListTheme").click(UseXimfmail);\r
+ UseXimfmail();\r
+ \r
+ // determine if user wants XSMTP compatibility\r
+ $("#xsmtpComptibilityBox").attr("checked", gXimfmailIdentity.getBoolAttribute("ximfmail_xsmtp_compatibility_on"));\r
+ //$("#secureHeadersRuleBox").attr("checked", gXimfmailIdentity.getBoolAttribute("ximfmail_secure_header_on"));\r
+ //$("#signMsgAlwaysRuleBox").attr("checked", gXimfmailIdentity.getBoolAttribute("ximfmail_sign_message_always_on"));\r
+\r
+}\r
+\r
+/*\r
+ * \r
+ */ \r
+function UseXimfmail(){\r
+ //IsDisableXimfmailManager("checkListTheme","isUsingXimfail");\r
+ //alert("UseXimfmail " +idCheckElement+" "+idBroadcaster );\r
+ if($("#checkListTheme").attr("checked") == "true"){\r
+ $("#isUsingXimfail").attr("disabled","false"); \r
+ return false; \r
+ }else{ \r
+ $("#isUsingXimfail").attr("disabled","true");\r
+ return true;\r
+ } \r
+}\r
+ \r
+/*\r
+ * get pref settings\r
+ */\r
+function onPreInit(account, accountValues){\r
+ gXimfmailIdentity = account.defaultIdentity; \r
+}\r
+\r
+/*\r
+ * save all changes on this page\r
+ */\r
+function onSave(){\r
+ if(gXimfmailIdentity == null)return;\r
+ // save ximfmail selection to preferences\r
+ SetXimfmailPref(gXimfmailIdentity.key, "ximfmail_theme_ref", $("#listTheme").attr("value"));\r
+ SetXimfmailPref(gXimfmailIdentity.key, "ximfmail_theme_name", $("#listTheme").attr("label"));\r
+ SetXimfmailPref(gXimfmailIdentity.key, "ximfmail_instance_compose_ref", $("#instanceComposeList").attr("value")); \r
+ gXimfmailIdentity.setCharAttribute(XIMF_PREF_IDENTITY_TREETHREAD_REF,$("#instanceTreeThreadList").attr("value"));\r
+ gXimfmailIdentity.setCharAttribute(XIMF_PREF_IDENTITY_MAIL_PANEL_REF,$("#instanceMailPanelList").attr("value"));\r
+ \r
+ if($("#checkListTheme").attr("checked") == "true"){ \r
+ gXimfmailIdentity.setBoolAttribute(XIMF_PREF_IDENTITY_USE_XIMFMAIL,true);\r
+ try{CreateSecurityLabelXml()}catch(e){}\r
+ }else{ \r
+ gXimfmailIdentity.setBoolAttribute(XIMF_PREF_IDENTITY_USE_XIMFMAIL,false);\r
+ }\r
+ \r
+ if($("#xsmtpComptibilityBox").attr("checked") == "true"){\r
+ gXimfmailIdentity.setBoolAttribute("ximfmail_xsmtp_compatibility_on",true); \r
+ }else{\r
+ gXimfmailIdentity.setBoolAttribute("ximfmail_xsmtp_compatibility_on",false);\r
+ } \r
}
\ No newline at end of file
-<?xml version="1.0"?>
-<!-- ***** 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 ***** -->
-
-<?xml-stylesheet href="chrome://messenger/skin/accountManage.css" type="text/css"?>
-<!DOCTYPE page SYSTEM "chrome://ximfmail/locale/ximfmail.dtd">
-<page
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- class="color-dialog" onload="parent.onPanelLoaded('am-ximfmail.xul');"
- orient="vertical">
-
- <script type="application/javascript" src="chrome://ximfmail/content/ximfmail.js" />
- <script type="application/javascript" src="chrome://ximfmail/content/am-ximfmail.js" />
-
- <broadcasterset>
- <broadcaster id="isUsingXimfail" disabled="true"/>
- </broadcasterset>
-
- <dialogheader title="&ximfmail.am.dialogTitle;" />
- <description>&ximfmail.am.description;
- </description>
- <vbox id="am-ximfmailBox">
- <separator />
- <hbox>
- <checkbox id="checkListTheme" label="&ximfmail.am.themeChoice;" />
- <menulist id="listTheme" observes="isUsingXimfail" flex="1">
- <menupopup
- datasources="rdf:null"
- ref="http://www.ximfmail.com/catalog"
- id="listThemPopup">
- <template>
- <rule>
- <conditions>
- <content uri="?list" />
- <member container="?list"
- child="?elt" />
- <triple subject="?elt"
- predicate="http://www.ximfmail.com/RDF#refSeq"
- object="?refSeq" />
- <triple subject="?elt"
- predicate="http://www.ximfmail.com/RDF#name" object="?name" />
- </conditions>
- <action>
- <menuitem uri="?elt" value="?refSeq"
- label="?name" />
- </action>
- </rule>
- </template>
- </menupopup>
- </menulist>
- </hbox>
- <groupbox flex="1">
- <caption>
- <label value="&ximfmail.am.instanceGroup.message;" />
- </caption>
- <grid flex="1">
- <columns>
- <column id="col1" />
- <column id="col2" flex="1"/>
- </columns>
- <rows>
- <row>
- <label value="&ximfmail.am.instanceComposeChoice;" />
- <menulist id="instanceComposeList" observes="isUsingXimfail" flex="1">
- <menupopup id="instanceCompose"
- datasources="rdf:null" ref="">
- <template id="tplInstanceMenu">
- <rule>
- <conditions>
- <content uri="?list" />
- <member container="?list"
- child="?elt" />
- <triple subject="?elt"
- predicate="http://www.ximfmail.com/RDF#ximfVersion"
- object="?ximfVersion" />
- <triple subject="?elt"
- predicate="http://www.ximfmail.com/RDF#instance"
- object="?name" />
- <triple subject="?elt"
- predicate="http://www.ximfmail.com/RDF#instanceLabel"
- object="?label" />
- </conditions>
- <action>
- <menuitem uri="?elt" value="?elt" label="?label"/>
- </action>
- </rule>
- </template>
- </menupopup>
- </menulist>
- </row>
- <row>
- <label value="&ximfmail.am.instanceTreeThreadChoice;" />
- <menulist id="instanceTreeThreadList" observes="isUsingXimfail" flex="1">
- <menupopup
- id="instanceTreeThread"
- datasources="rdf:null"
- ref=""
- template="tplInstanceMenu" />
- </menulist>
- </row>
- <row>
- <label value="&ximfmail.am.instanceMailPanelChoice;" />
- <menulist id="instanceMailPanelList" observes="isUsingXimfail" flex="1">
- <menupopup
- id="instanceMailPanel"
- datasources="rdf:null"
- ref=""
- template="tplInstanceMenu" />
- </menulist>
- </row>
- </rows>
- </grid>
- <!--
- <checkbox id="ximfAdvancedReceivedMsg" label="afficher les entetes" observes="isUsingXimfail" />
- -->
- <checkbox id="xsmtpComptibilityBox" label="&ximfmail.am.xsmtpCompatibilityCheck;" observes="isUsingXimfail" />
- <!--
- <checkbox id="secureHeadersRuleBox" label="&ximfmail.am.secureHeadersRuleCheck;" observes="isUsingXimfail" />
- <checkbox id="signMsgAlwaysRuleBox" label="&ximfmail.am.signMsgAlwaysRuleCheck;" observes="isUsingXimfail" />
- -->
- </groupbox>
-
- </vbox>
+<?xml version="1.0"?>\r
+<!-- ***** 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
+<?xml-stylesheet href="chrome://messenger/skin/accountManage.css" type="text/css"?>\r
+<!DOCTYPE page SYSTEM "chrome://ximfmail/locale/ximfmail.dtd">\r
+<page\r
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"\r
+ class="color-dialog" onload="parent.onPanelLoaded('am-ximfmail.xul');"\r
+ orient="vertical">\r
+\r
+ <script type="application/javascript" src="chrome://ximfmail/content/ximfmail.js" />\r
+ <script type="application/javascript" src="chrome://ximfmail/content/am-ximfmail.js" />\r
+ \r
+ <broadcasterset>\r
+ <broadcaster id="isUsingXimfail" disabled="true"/>\r
+ </broadcasterset>\r
+\r
+ <dialogheader title="&ximfmail.am.dialogTitle;" />\r
+ <description>&ximfmail.am.description;\r
+ </description>\r
+ <vbox id="am-ximfmailBox">\r
+ <separator />\r
+ <hbox>\r
+ <checkbox id="checkListTheme" label="&ximfmail.am.themeChoice;" />\r
+ <menulist id="listTheme" observes="isUsingXimfail" flex="1">\r
+ <menupopup\r
+ datasources="rdf:null" \r
+ ref="http://www.ximfmail.com/catalog"\r
+ id="listThemPopup">\r
+ <template>\r
+ <rule>\r
+ <conditions>\r
+ <content uri="?list" />\r
+ <member container="?list"\r
+ child="?elt" />\r
+ <triple subject="?elt"\r
+ predicate="http://www.ximfmail.com/RDF#refSeq"\r
+ object="?refSeq" />\r
+ <triple subject="?elt"\r
+ predicate="http://www.ximfmail.com/RDF#name" object="?name" />\r
+ </conditions>\r
+ <action>\r
+ <menuitem uri="?elt" value="?refSeq"\r
+ label="?name" />\r
+ </action>\r
+ </rule>\r
+ </template>\r
+ </menupopup>\r
+ </menulist> \r
+ </hbox>\r
+ <groupbox flex="1">\r
+ <caption>\r
+ <label value="&ximfmail.am.instanceGroup.message;" />\r
+ </caption>\r
+ <grid flex="1">\r
+ <columns>\r
+ <column id="col1" />\r
+ <column id="col2" flex="1"/>\r
+ </columns>\r
+ <rows>\r
+ <row>\r
+ <label value="&ximfmail.am.instanceComposeChoice;" />\r
+ <menulist id="instanceComposeList" observes="isUsingXimfail" flex="1">\r
+ <menupopup id="instanceCompose"\r
+ datasources="rdf:null" ref="">\r
+ <template id="tplInstanceMenu">\r
+ <rule>\r
+ <conditions>\r
+ <content uri="?list" />\r
+ <member container="?list"\r
+ child="?elt" />\r
+ <triple subject="?elt"\r
+ predicate="http://www.ximfmail.com/RDF#ximfVersion"\r
+ object="?ximfVersion" />\r
+ <triple subject="?elt"\r
+ predicate="http://www.ximfmail.com/RDF#instance"\r
+ object="?name" /> \r
+ <triple subject="?elt"\r
+ predicate="http://www.ximfmail.com/RDF#instanceLabel"\r
+ object="?label" /> \r
+ <triple subject="?elt"\r
+ predicate="http://www.ximfmail.com/RDF#active"\r
+ object="true" /> \r
+ </conditions>\r
+ <action>\r
+ <menuitem uri="?elt" value="?elt" label="?label"/> \r
+ </action>\r
+ </rule>\r
+ </template>\r
+ </menupopup>\r
+ </menulist>\r
+ </row> \r
+ <row>\r
+ <label value="&ximfmail.am.instanceTreeThreadChoice;" />\r
+ <menulist id="instanceTreeThreadList" observes="isUsingXimfail" flex="1">\r
+ <menupopup \r
+ id="instanceTreeThread"\r
+ datasources="rdf:null"\r
+ ref=""\r
+ template="tplInstanceMenu" />\r
+ </menulist>\r
+ </row>\r
+ <row>\r
+ <label value="&ximfmail.am.instanceMailPanelChoice;" />\r
+ <menulist id="instanceMailPanelList" observes="isUsingXimfail" flex="1">\r
+ <menupopup \r
+ id="instanceMailPanel"\r
+ datasources="rdf:null"\r
+ ref=""\r
+ template="tplInstanceMenu" />\r
+ </menulist>\r
+ </row>\r
+ </rows>\r
+ </grid>\r
+ <!-- \r
+ <checkbox id="ximfAdvancedReceivedMsg" label="afficher les entetes" observes="isUsingXimfail" />\r
+ -->\r
+ <checkbox id="xsmtpComptibilityBox" label="&ximfmail.am.xsmtpCompatibilityCheck;" observes="isUsingXimfail" />\r
+ <!-- \r
+ <checkbox id="secureHeadersRuleBox" label="&ximfmail.am.secureHeadersRuleCheck;" observes="isUsingXimfail" />\r
+ <checkbox id="signMsgAlwaysRuleBox" label="&ximfmail.am.signMsgAlwaysRuleCheck;" observes="isUsingXimfail" />\r
+ --> \r
+ </groupbox>\r
+ \r
+ </vbox>\r
</page>
\ No newline at end of file
-
-#ximf-date-picker-title{
- color: #FFFFFF;
- font-weight: bold;
-}
-
-#oe-date-picker-overlay-box
-{
- color: black;
- background-color : #F8F8F8;
- font-size : 12px;
- border : 4px solid #7090b0;
-}
-
-
-#oe-date-picker-year-controls-box
-{
- border : 2px solid #7090b0;
- -moz-box-align : center;
- -moz-box-pack : center;
- background-color : #7090b0
-}
-
-#oe-date-picker-year-title-text
-{
- color: #FFFFFF;
- font-weight: bold;
- font-size:1.5em;
-}
-
-#oe-date-picker-currenttime-text
-{
- list-style-image:url('chrome://ximfmail/content/calendar/date-n.png');
-
-}
-
-#oe-date-picker-currenttime-text:hover
-{
- list-style-image:url('chrome://ximfmail/content/calendar/date-h.png');
-
-}
-
-
-#oe-date-picker-year-previous-button
-{
- list-style-image: url("chrome://ximfmail/content/calendar/left_arrow.png");
- width:1.5em;
- height:1.5em;
-}
-
-#oe-date-picker-year-previous-button:hover
-{
- list-style-image: url("chrome://ximfmail/content/calendar/left_arrow_hov.png");
- width:1.5em;
- height:1.5em;
-}
-
-#oe-date-picker-year-previous-jump-button
-{
- list-style-image: url("chrome://ximfmail/content/calendar/left_dblarrow.png");
- width:1.5em;
- height:1.5em;
-}
-
-#oe-date-picker-year-previous-jump-button:hover
-{
- list-style-image: url("chrome://ximfmail/content/calendar/left_dblarrow_hov.png");
- width:1.5em;
- height:1.5em;
-}
-
-#oe-date-picker-year-next-jump-button
-{
- list-style-image : url("chrome://ximfmail/content/calendar/right_dblarrow.png");
- width:1.5em;
- height:1.5em;
-}
-
-#oe-date-picker-year-next-jump-button:hover
-{
- list-style-image : url("chrome://ximfmail/content/calendar/right_dblarrow_hov.png");
- width:1.5em;
- height:1.5em;
-}
-
-#oe-date-picker-year-next-button
-{
- list-style-image : url("chrome://ximfmail/content/calendar/right_arrow.png");
- width:1.5em;
- height:1.5em;
-}
-
-#oe-date-picker-year-next-button:hover
-{
- list-style-image : url("chrome://ximfmail/content/calendar/right_arrow_hov.png");
- width:1.5em;
- height:1.5em;
-}
-
-#oe-date-picker-year-next-button-box
-{
- -moz-box-pack : end;
-}
-
-#oe-date-picker-year-grid
-{
- border-top : 1px solid #2085c4;
- border-left : 1px solid #2085c4;
- margin : 1px;
-}
-
-#ximfmail-date-picker-hour-grid
-{
- border-top : 1px solid #2085c4;
- border-left : 1px solid #2085c4;
- margin : 1px;
-}
-
-#ximfmail-date-picker-min-grid
-{
- margin : 1px;
-}
-
-.oe-date-picker-year-month-box-class
-{
- -moz-box-align : center;
- border-right : 1px solid #2085c4;
- border-bottom : 1px solid #2085c4;
- background-color : #E9E9E9;
-}
-
-
-.oe-date-picker-year-month-box-class:hover
-{
- background-color : #C9E8F1;
-}
-
-.oe-date-picker-year-month-box-class[selected="true"]
-{
- background-color : #6699CC;
-}
-
-
-.oe-date-picker-month-day-number-class
-{
- margin : 1px;
-}
-
-.oe-date-picker-month-day-number-class[selected="true"]
-{
-
- background-color : #6699CC;
-}
-
-#oe-date-picker-month-grid
-{
- margin : 1px;
-}
-
-#start-date-button
-{
- border: 0px;
- list-style-image : url("chrome://ximfmail/content/calendar/calendar-down.gif");
- margin: 0px;
- padding: 0px;
- max-width: 36px;
-}
-
-#start-date-button:hover
-{
- margin: 0px;
- padding: 0px;
- list-style-image : url("chrome://ximfmail/content/calendar/calendar-up.gif");
-}
-
-.oe-date-picker-month-day-box-class
-{
- min-width : 25px;
- min-height : 15px;
- background-color : #FFFFFF;
-}
-
-.oe-date-picker-month-day-box-class[selected="true"]
-{
- background-color : #6699CC;
-}
-
-.oe-date-picker-month-day-box-class:hover
-{
- background-color : #FFFF99;
-}
-
-.oe-date-picker-month-day-box-class
-{
- -moz-box-align : center;
- border-right : 1px solid #E2E2E2;
- border-bottom : 1px solid #E2E2E2;
- border-top : 1px solid #E2E2E2;
- border-left : 1px solid #E2E2E2;
-}
-
-.oe-date-picker-month-days-header-class
-{
- margin : 0px;
- padding : 0px;
-}
-
-.oe-date-picker-month-days-header-class-red
-{
- color : #FF0000;
-}
-
-#oe-date-picker-month-days-header-box
-{
- margin : 0px 0px;
-}
-
-.oe-date-picker-month-days-box-header-class
-{
- -moz-box-align : center;
-}
-
-#ximf-date-picker-end-controls-box
-{
- border : 2px solid #7090b0;
- -moz-box-align : center;
- -moz-box-pack : center;
- background-color : #7090b0
-}
-
-#ximf-date-picker-ok-control-box
-{
- list-style-image : url("chrome://ximfmail/content/calendar/ok.png");
-
-}
-
-#ximf-date-picker-ok-control-box:hover
-{
- list-style-image : url("chrome://ximfmail/content/calendar/ok_hov.png");
-
-}
-
-#ximf-date-picker-head-controls-box
-{
- border : 2px solid #7090b0;
- -moz-box-align : center;
- -moz-box-pack : center;
- background-color : #7090b0
-}
-
-#ximf-date-picker-cancel-control-box
-{
- list-style-image : url("chrome://ximfmail/content/calendar/button_cancel_20x20.png");
-
-}
-
-#ximf-date-picker-cancel-control-box:hover
-{
- list-style-image : url("chrome://ximfmail/content/calendar/button_cancel_hov_20x20.png");
-
-}
-
+\r
+#ximf-date-picker-title{\r
+ color: #FFFFFF;\r
+ font-weight: bold;\r
+}\r
+\r
+#oe-date-picker-overlay-box\r
+{\r
+ color: black;\r
+ background-color : #F8F8F8;\r
+ font-size : 12px;\r
+ border : 4px solid #7090b0; \r
+}\r
+\r
+ \r
+#oe-date-picker-year-controls-box\r
+{\r
+ border : 2px solid #7090b0; \r
+ -moz-box-align : center;\r
+ -moz-box-pack : center;\r
+ background-color : #7090b0\r
+}\r
+\r
+#oe-date-picker-year-title-text\r
+{\r
+ color: #FFFFFF;\r
+ font-weight: bold;\r
+ font-size:1.5em;\r
+}\r
+\r
+#oe-date-picker-currenttime-text\r
+{\r
+ list-style-image:url('chrome://ximfmail/content/calendar/date-n.png');\r
+ \r
+}\r
+\r
+#oe-date-picker-currenttime-text:hover\r
+{\r
+ list-style-image:url('chrome://ximfmail/content/calendar/date-h.png');\r
+ \r
+}\r
+\r
+\r
+#oe-date-picker-year-previous-button\r
+{\r
+ list-style-image: url("chrome://ximfmail/content/calendar/left_arrow.png");\r
+ width:1.5em;\r
+ height:1.5em;\r
+}\r
+\r
+#oe-date-picker-year-previous-button:hover\r
+{\r
+ list-style-image: url("chrome://ximfmail/content/calendar/left_arrow_hov.png");\r
+ width:1.5em;\r
+ height:1.5em;\r
+}\r
+\r
+#oe-date-picker-year-previous-jump-button\r
+{\r
+ list-style-image: url("chrome://ximfmail/content/calendar/left_dblarrow.png");\r
+ width:1.5em;\r
+ height:1.5em;\r
+}\r
+\r
+#oe-date-picker-year-previous-jump-button:hover\r
+{\r
+ list-style-image: url("chrome://ximfmail/content/calendar/left_dblarrow_hov.png");\r
+ width:1.5em;\r
+ height:1.5em;\r
+}\r
+\r
+#oe-date-picker-year-next-jump-button\r
+{\r
+ list-style-image : url("chrome://ximfmail/content/calendar/right_dblarrow.png");\r
+ width:1.5em;\r
+ height:1.5em;\r
+}\r
+\r
+#oe-date-picker-year-next-jump-button:hover\r
+{\r
+ list-style-image : url("chrome://ximfmail/content/calendar/right_dblarrow_hov.png");\r
+ width:1.5em;\r
+ height:1.5em;\r
+}\r
+\r
+#oe-date-picker-year-next-button\r
+{\r
+ list-style-image : url("chrome://ximfmail/content/calendar/right_arrow.png");\r
+ width:1.5em;\r
+ height:1.5em;\r
+}\r
+\r
+#oe-date-picker-year-next-button:hover\r
+{\r
+ list-style-image : url("chrome://ximfmail/content/calendar/right_arrow_hov.png");\r
+ width:1.5em;\r
+ height:1.5em;\r
+}\r
+\r
+#oe-date-picker-year-next-button-box\r
+{\r
+ -moz-box-pack : end;\r
+}\r
+\r
+#oe-date-picker-year-grid\r
+{\r
+ border-top : 1px solid #2085c4; \r
+ border-left : 1px solid #2085c4; \r
+ margin : 1px;\r
+}\r
+\r
+#ximfmail-date-picker-hour-grid\r
+{\r
+ border-top : 1px solid #2085c4; \r
+ border-left : 1px solid #2085c4; \r
+ margin : 1px;\r
+}\r
+\r
+#ximfmail-date-picker-min-grid\r
+{ \r
+ margin : 1px;\r
+}\r
+ \r
+.oe-date-picker-year-month-box-class\r
+{\r
+ -moz-box-align : center;\r
+ border-right : 1px solid #2085c4; \r
+ border-bottom : 1px solid #2085c4;\r
+ background-color : #E9E9E9;\r
+}\r
+\r
+\r
+.oe-date-picker-year-month-box-class:hover\r
+{\r
+ background-color : #C9E8F1;\r
+}\r
+\r
+.oe-date-picker-year-month-box-class[selected="true"]\r
+{\r
+ background-color : #6699CC;\r
+}\r
+\r
+\r
+.oe-date-picker-month-day-number-class\r
+{\r
+ margin : 1px;\r
+}\r
+\r
+.oe-date-picker-month-day-number-class[selected="true"]\r
+{\r
+\r
+ background-color : #6699CC;\r
+}\r
+\r
+#oe-date-picker-month-grid\r
+{\r
+ margin : 1px;\r
+}\r
+\r
+#start-date-button\r
+{\r
+ border: 0px;\r
+ list-style-image : url("chrome://ximfmail/content/calendar/calendar-down.gif");\r
+ margin: 0px;\r
+ padding: 0px;\r
+ max-width: 36px;\r
+}\r
+\r
+#start-date-button:hover\r
+{\r
+ margin: 0px;\r
+ padding: 0px;\r
+ list-style-image : url("chrome://ximfmail/content/calendar/calendar-up.gif");\r
+}\r
+\r
+.oe-date-picker-month-day-box-class\r
+{\r
+ min-width : 25px;\r
+ min-height : 15px;\r
+ background-color : #FFFFFF;\r
+}\r
+\r
+.oe-date-picker-month-day-box-class[selected="true"]\r
+{\r
+ background-color : #6699CC;\r
+}\r
+\r
+.oe-date-picker-month-day-box-class:hover\r
+{\r
+ background-color : #FFFF99;\r
+}\r
+\r
+.oe-date-picker-month-day-box-class\r
+{\r
+ -moz-box-align : center;\r
+ border-right : 1px solid #E2E2E2; \r
+ border-bottom : 1px solid #E2E2E2;\r
+ border-top : 1px solid #E2E2E2; \r
+ border-left : 1px solid #E2E2E2;\r
+}\r
+\r
+.oe-date-picker-month-days-header-class\r
+{\r
+ margin : 0px;\r
+ padding : 0px;\r
+}\r
+\r
+.oe-date-picker-month-days-header-class-red\r
+{\r
+ color : #FF0000;\r
+}\r
+\r
+#oe-date-picker-month-days-header-box\r
+{\r
+ margin : 0px 0px;\r
+}\r
+\r
+.oe-date-picker-month-days-box-header-class\r
+{\r
+ -moz-box-align : center;\r
+}\r
+\r
+#ximf-date-picker-end-controls-box\r
+{\r
+ border : 2px solid #7090b0; \r
+ -moz-box-align : center;\r
+ -moz-box-pack : center;\r
+ background-color : #7090b0\r
+}\r
+\r
+#ximf-date-picker-ok-control-box\r
+{\r
+ list-style-image : url("chrome://ximfmail/content/calendar/ok.png");\r
+\r
+}\r
+\r
+#ximf-date-picker-ok-control-box:hover\r
+{\r
+ list-style-image : url("chrome://ximfmail/content/calendar/ok_hov.png");\r
+\r
+}\r
+\r
+#ximf-date-picker-head-controls-box\r
+{\r
+ border : 2px solid #7090b0; \r
+ -moz-box-align : center;\r
+ -moz-box-pack : center;\r
+ background-color : #7090b0\r
+}\r
+\r
+#ximf-date-picker-cancel-control-box\r
+{\r
+ list-style-image : url("chrome://ximfmail/content/calendar/button_cancel_20x20.png");\r
+\r
+}\r
+\r
+#ximf-date-picker-cancel-control-box:hover\r
+{\r
+ list-style-image : url("chrome://ximfmail/content/calendar/button_cancel_hov_20x20.png");\r
+\r
+}\r
+\r
-/* ***** 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 ***** */
-var gJSLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].createInstance(Components.interfaces.mozIJSSubScriptLoader);
-var gConsole = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
-gJSLoader.loadSubScript("chrome://ximfmail/content/jquery.js");
-gJSLoader.loadSubScript("chrome://ximfmail/content/ximfmail.js");
-
-var _XIMF_ATT_XVALUE = "ximfvalue";
-
-var gDlgTreeXimf_maxItem = null;
-var gDlgTreeXimf_current_selection = null;
-var gDlgTreeXimf_current_separator = null;
-var gXmlDatasFilePath = null;
-var gRdfTempo = null;
-
-
-var gSelectedDate = null;
-var gSelectedDayItem = null;
-var gSelectedMonthItem = null; // dom month
-var gSelectedHourItem = null;
-var gSelectedMinItem = null;
-var gTitleDlg = null;
-/*
- window.arguments = [];
- args[0] id de la textbox à enrichir
- args[1] date courant affichee
-*/
-var gBoxOpener = null; // display date
-$(document).ready(function(){
-
- var gArgs = window.arguments;
- if(gArgs[0].length <= 0) return;
- // load background datas
- gBoxOpener = gArgs[0][0];
- gTitleDlg = gArgs[0][2];
-
- if(gBoxOpener){
- gSelectedDate = parseDate(gArgs[0][1]);
- }else{
- adjustCurrentDate();
- }
-
- UpdateCalendar();
-
-});
-
-/*
- *
- */
-function clickOk(){
-
- var date = ConvertDateForDisplay();
- window.opener.document.getElementById(gBoxOpener).value = date;
- window.opener.document.getElementById(gBoxOpener).setAttribute(_XIMF_ATT_XVALUE, gSelectedDate.toGMTString());
- window.close();
- return true;
-}
-
-/*
- *
- */
-function clickCancel(){
- window.close();
- return false;
-}
-
-/*
- *
- */
-function adjustCurrentDate(){
- gSelectedDate = new Date();
-
- // minutes %5
- gSelectedDate.setMinutes(parseInt(Math.round(gSelectedDate.getMinutes()/5)*5));
- UpdateCalendar();
-}
-
-function ConvertDateForDisplay(){
- var displayDate = null;
- var date = new Date();
- if( gSelectedDate ){ date = gSelectedDate;}
- try{
- //displayDate = date.getDate() + "/" + (date.getMonth()+1) + "/" + date.getFullYear() + " " + date.getHours() + ":" + date.getMinutes();
- // day
- if(date.getDate()>=10){
- displayDate = date.getDate();
- }else{
- displayDate = "0"+date.getDate();
- }
-
- //month
- if((date.getMonth()+1)>=10){
- displayDate += "/" + (date.getMonth()+1);
- }else{
- displayDate += "/0" + (date.getMonth()+1);
- }
-
- //year
- displayDate += "/" + date.getFullYear() + " ";
-
- // hour
- if(date.getHours()>=10){
- displayDate += "" + date.getHours();
- }else{
- displayDate += "0" + date.getHours();
- }
-
- //minutes
- displayDate += ":";
- if(date.getMinutes()>=10){
- displayDate += date.getMinutes();
- }else{
- displayDate += "0" + date.getMinutes();
- }
- }catch( e ){
-
- }
- return displayDate;
-}
-
-
-function UpdateCalendar(){
- try{
- // Set up the picker, called when the popup pops
- // get the start date from the popup value attribute and select it
- var startDate = gSelectedDate;
-
- if(startDate){
- gOriginalDate = new Date( startDate );
- gSelectedDate = new Date( startDate );
- }else{
- gOriginalDate = new Date();
- gSelectedDate = new Date();
- gSelectedDate.setMinutes(Math.round((gSelectedDate.getMinutes()/5))*5);
- gOriginalDate.setMinutes(Math.round((gOriginalDate.getMinutes()/5))*5);
- }
-
- // draw the year based on the selected date
- redrawYear();
-
- // draw the month based on the selected date
- var month = gSelectedDate.getMonth() + 1;
- var selectedMonthBoxItem = document.getElementById("oe-date-picker-year-month-" + month + "-box" );
- selectMonthItem( selectedMonthBoxItem );
-
- // draw in the days for the selected date
- redrawDays();
-
- //EADS - draw in hours and minutes for selected date
- var hour = gSelectedDate.getHours();
- var selectedHoursBoxItem = document.getElementById("ximfmail-date-picker-hour-box-" + hour );
- selectHoursItem(selectedHoursBoxItem);
-
- var min = gSelectedDate.getMinutes();
- var selectedMinutesBoxItem = null;
- if(min%5 != 0)
- selectedMinutesBoxItem = document.getElementById("ximfmail-date-picker-min-box-" + (Math.round(min/5)*5) );
- else
- selectedMinutesBoxItem = document.getElementById("ximfmail-date-picker-min-box-" + min );
- selectMinutesItem(selectedMinutesBoxItem);
-
- //title calendar
- $("#ximf-date-picker-title").attr("value", gTitleDlg.substring(0,gTitleDlg.lastIndexOf(":")));
- }catch(e){}
-}
-
-function clickDay(newDayItem, newDayItemNumber){
- // Called when a day is clicked, close the picker and call the client's oncommand
- // get the clicked day
- if( gSelectedDayItem == newDayItem )
- return;
-
- // update new selection
- newDayItem.setAttribute("selected",true);
- if(gSelectedDayItem){
- gSelectedDayItem.removeAttribute("selected");
- }
- gSelectedDayItem = newDayItem;
-
- var dayNumberItem = document.getElementById("oe-date-picker-month-day-text-" + newDayItemNumber );
- var dayNumber = dayNumberItem.getAttribute( "value" );
- // they may have clicked an unfilled day, if so ignore it and leave the picker up
- if( dayNumber != "" ){
- selectDayItem(newDayItem);
- // set the selected date to what they cliked on
- gSelectedDate.setDate( dayNumber );
- }
-}
-
-
-/*
- *
- */
-function clickMonth(newMonthItem, newMonthNumber){
- // Called when a month box is clicked
- // already selected, return
- if( gSelectedMonthItem == newMonthItem )
- return;
-
- // update new selection
- newMonthItem.setAttribute("selected",true);
- if(gSelectedMonthItem){
- gSelectedMonthItem.removeAttribute("selected");
- }
- gSelectedMonthItem = newMonthItem;
-
-
- // Avoid problems when changing months if the date is at the end of the month
- // i.e. if date is 31 march and you do a setmonth to april, the month would
- // actually be set to may, beacause april only has 30 days.
- // This is why we keep the original date around.
- var oldDate = gSelectedDate.getDate();
- var yearNumber = gSelectedDate.getFullYear();
-
- var pastLastDate = new Date( yearNumber, newMonthNumber-1, 32 );
- var lastDayOfMonth = 32 - pastLastDate.getDate();
-
- if( oldDate > lastDayOfMonth ){
- gSelectedDate.setDate(lastDayOfMonth);
- }
-
- // update the selected date
- gSelectedDate.setMonth( newMonthNumber - 1 );
-
- // select Month
- selectMonthItem( newMonthItem );
-
- // redraw days
- redrawDays();
-}
-
-/*
- *
- */
-function previousYearCommand(increment){
- // Called when previous Year button is clicked
- // update the selected date
-
- var oldYear = gSelectedDate.getFullYear();
- gSelectedDate.setFullYear( oldYear - increment );
-
- // redraw the year and the days
- redrawYear();
- redrawDays();
-}
-
-/*
- *
- */
-function nextYearCommand(increment){
- // Called when next Year button is clicked
- // update the selected date
-
- var oldYear = gSelectedDate.getFullYear();
- gSelectedDate.setFullYear( oldYear + increment );
-
- // redraw the year and the days
- redrawYear();
- redrawDays();
-}
-
-/*
- *
- */
-function redrawYear(){
- var yearTitleItem = document.getElementById("oe-date-picker-year-title-text");
- yearTitleItem.setAttribute( "value", gSelectedDate.getFullYear() );
-}
-
-/*
- *
- */
-function selectMonthItem(newMonthItem){
- // Select a month box
- // clear old selection, if there is one
- if( gSelectedMonthItem != null ){
- gSelectedMonthItem.removeAttribute("selected");
- }
-
- // Set the selected attribute, used to give it a different style
- newMonthItem.setAttribute( "selected" , true );
-
- // Remember new selection
- gSelectedMonthItem = newMonthItem;
-}
-
-/*
- *
- */
-function selectDayItem(newDayItem){
- // Select a day box
- // clear old selection, if there is one
-
- if( gSelectedDayItem != null ){
- gSelectedDayItem.removeAttribute("selected");
- }
-
- if( newDayItem != null ){
- // Set the selected attribute, used to give it a different style
- newDayItem.setAttribute( "selected" , true );
- }
-
- // Remember new selection
- gSelectedDayItem = newDayItem;
-}
-
-/*
- *
- */
-function redrawDays(){
- // Redraw day numbers based on the selected date
- // Write in all the day numbers
- var firstDate = new Date( gSelectedDate.getFullYear(), gSelectedDate.getMonth(), 1 );
- var firstDayOfWeek = firstDate.getDay();
-
- //get last Day Of Month
- var pastLastDate = new Date( gSelectedDate.getFullYear(), gSelectedDate.getMonth(), 32 );
- var lastDayOfMonth = 32 - pastLastDate.getDate();
-
- // clear the selected day item
- selectDayItem( null );
-
- // redraw each day bax in the 7 x 6 grid
- var dayNumber = 1;
- for( var dayIndex = 0; dayIndex < 42; ++dayIndex ){
- // get the day text box
- var dayNumberItem = document.getElementById("oe-date-picker-month-day-text-" + (dayIndex + 1) );
-
- // if it is an unfilled day ( before first or after last ), just set its value to "",
- // and don't increment the day number.
- if( dayIndex < firstDayOfWeek || dayNumber > lastDayOfMonth )
- {
- dayNumberItem.setAttribute( "value" , "" );
- }else{
- // set the value to the day number
- dayNumberItem.setAttribute( "value" , dayNumber );
-
- // draw the day as selected
- if( dayNumber == gSelectedDate.getDate() ){
- var dayNumberBoxItem = document.getElementById( "oe-date-picker-month-day-" + (dayIndex + 1) + "-box" );
- selectDayItem( dayNumberBoxItem );
- }
-
- // advance the day number
- ++dayNumber;
- }
- }
-}
-
-/*
- *
- */
-function parseDate(datestr){
- //var datestr = _input.value;
- try{
- if( datestr != "" ){
- var reg=new RegExp("[ / :]+", "g"); //eads
- var parts = datestr.split(reg);
- if( parts.length >= 5 ){
- //var d = new Date(month, day, year, hour, minutes, seconds);
- //return new Date(parseInt(parts[1]-1),parseInt(parts[0]),parseInt(parts[2]),parseInt(parts[3]),parseInt(parts[4]),0);
- //alert("SPLIT DATE\nmonth : "+parts[1] + "\n day : " + parts[0] +"\n year : "+ parts[2] +"\n hour : "+ parts[3] +"\n min : "+ parts[4]);
- var new_date = new Date();
- new_date.setDate(parseInt(parts[0]));
- new_date.setMonth(parseInt(parts[1]-1));
- new_date.setFullYear(parseInt(parts[2]));
- new_date.setHours(parseInt(parts[3]));
- new_date.setMinutes(parseInt(parts[4]));
- new_date.setSeconds(0);
- return new_date;
- }
- }
- }catch(e){}
- return null;
-}
-
-/*
- *
- */
-function clickHour(newHoursItem,newHourItemNumber){
- if( gSelectedHourItem == newHoursItem ) return;
- selectHoursItem(newHoursItem);
- /*
- // update new selection
- newHoursItem.setAttribute("selected",true);
- if(gSelectedHourItem){
- gSelectedHourItem.removeAttribute("selected");
- }
- gSelectedHourItem = newHoursItem;
- */
-
- gSelectedDate.setHours(parseInt(newHourItemNumber));
-}
-
-/*
- *
- */
-function selectHoursItem(newHoursItem){
- // Select a month box
- // clear old selection, if there is one
- if( gSelectedHourItem != null ){
- gSelectedHourItem.removeAttribute( "selected" );
- }
-
- // Set the selected attribute, used to give it a different style
- newHoursItem.setAttribute( "selected" , true );
-
- // Remember new selection
- gSelectedHourItem = newHoursItem;
-}
-
-/*
- *
- */
-function clickMin(newMinItem,newMinItemNumber){
- if( gSelectedMinItem == newMinItem ) return;
- // update new selection
- selectMinutesItem(newMinItem);
- /*newMinItem.setAttribute("selected",true);
-
- if(gSelectedMinItem){
- gSelectedMinItem.removeAttribute("selected");
- }
- gSelectedMinItem = newMinItem;
- */
- gSelectedDate.setMinutes(parseInt(newMinItemNumber));
-
-}
-
-/*
- *
- */
-function selectMinutesItem(newMinutesItem){
- // Select a month box
- // clear old selection, if there is one
- if( gSelectedMinItem != null ){
- gSelectedMinItem.removeAttribute( "selected" );
- }
-
- // Set the selected attribute, used to give it a different style
- newMinutesItem.setAttribute( "selected" , true );
-
- // Remember new selection
- gSelectedMinItem = newMinutesItem;
+/* ***** 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
+var gJSLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].createInstance(Components.interfaces.mozIJSSubScriptLoader);\r
+var gConsole = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);\r
+gJSLoader.loadSubScript("chrome://ximfmail/content/jquery.js");\r
+gJSLoader.loadSubScript("chrome://ximfmail/content/ximfmail.js");\r
+\r
+var _XIMF_ATT_XVALUE = "ximfvalue";\r
+ \r
+var gDlgTreeXimf_maxItem = null;\r
+var gDlgTreeXimf_current_selection = null;\r
+var gDlgTreeXimf_current_separator = null;\r
+var gXmlDatasFilePath = null;\r
+var gRdfTempo = null;\r
+\r
+\r
+var gSelectedDate = null;\r
+var gSelectedDayItem = null;\r
+var gSelectedMonthItem = null; // dom month\r
+var gSelectedHourItem = null;\r
+var gSelectedMinItem = null;\r
+var gTitleDlg = null;\r
+/*\r
+ window.arguments = [];\r
+ args[0] id de la textbox à enrichir\r
+ args[1] date courant affichee \r
+*/\r
+var gBoxOpener = null; // display date\r
+$(document).ready(function(){\r
+ \r
+ var gArgs = window.arguments;\r
+ if(gArgs[0].length <= 0) return;\r
+ // load background datas\r
+ gBoxOpener = gArgs[0][0];\r
+ gTitleDlg = gArgs[0][2];\r
+ \r
+ if(gBoxOpener){\r
+ gSelectedDate = parseDate(gArgs[0][1]);\r
+ }else{\r
+ adjustCurrentDate(); \r
+ } \r
+ \r
+ UpdateCalendar();\r
+ \r
+}); \r
+\r
+/*\r
+ * \r
+ */\r
+function clickOk(){ \r
+ \r
+ var date = ConvertDateForDisplay(); \r
+ window.opener.document.getElementById(gBoxOpener).value = date; \r
+ window.opener.document.getElementById(gBoxOpener).setAttribute(_XIMF_ATT_XVALUE, gSelectedDate.toGMTString()); \r
+ window.close();\r
+ return true;\r
+}\r
+\r
+/*\r
+ * \r
+ */\r
+function clickCancel(){\r
+ window.close();\r
+ return false; \r
+}\r
+\r
+/*\r
+ * \r
+ */\r
+function adjustCurrentDate(){\r
+ gSelectedDate = new Date();\r
+ \r
+ // minutes %5 \r
+ gSelectedDate.setMinutes(parseInt(Math.round(gSelectedDate.getMinutes()/5)*5, 10)); \r
+ UpdateCalendar(); \r
+}\r
+\r
+function ConvertDateForDisplay(){\r
+ var displayDate = null;\r
+ var date = new Date();\r
+ if( gSelectedDate ){ date = gSelectedDate;}\r
+ try{ \r
+ //displayDate = date.getDate() + "/" + (date.getMonth()+1) + "/" + date.getFullYear() + " " + date.getHours() + ":" + date.getMinutes();\r
+ // day\r
+ if(date.getDate()>=10){\r
+ displayDate = date.getDate();\r
+ }else{\r
+ displayDate = "0"+date.getDate();\r
+ }\r
+ \r
+ //month\r
+ if((date.getMonth()+1)>=10){\r
+ displayDate += "/" + (date.getMonth()+1);\r
+ }else{\r
+ displayDate += "/0" + (date.getMonth()+1);\r
+ }\r
+ \r
+ //year\r
+ displayDate += "/" + date.getFullYear() + " ";\r
+ \r
+ // hour\r
+ if(date.getHours()>=10){\r
+ displayDate += "" + date.getHours();\r
+ }else{\r
+ displayDate += "0" + date.getHours();\r
+ }\r
+ \r
+ //minutes\r
+ displayDate += ":";\r
+ if(date.getMinutes()>=10){\r
+ displayDate += date.getMinutes();\r
+ }else{\r
+ displayDate += "0" + date.getMinutes();\r
+ } \r
+ }catch( e ){\r
+ \r
+ }\r
+ return displayDate;\r
+}\r
+ \r
+\r
+function UpdateCalendar(){\r
+ try{ \r
+ // Set up the picker, called when the popup pops\r
+ // get the start date from the popup value attribute and select it \r
+ var startDate = gSelectedDate; \r
+ \r
+ if(startDate){ \r
+ gOriginalDate = new Date( startDate );\r
+ gSelectedDate = new Date( startDate );\r
+ }else{\r
+ gOriginalDate = new Date();\r
+ gSelectedDate = new Date();\r
+ gSelectedDate.setMinutes(Math.round((gSelectedDate.getMinutes()/5))*5); \r
+ gOriginalDate.setMinutes(Math.round((gOriginalDate.getMinutes()/5))*5); \r
+ }\r
+ \r
+ // draw the year based on the selected date\r
+ redrawYear();\r
+ \r
+ // draw the month based on the selected date\r
+ var month = gSelectedDate.getMonth() + 1;\r
+ var selectedMonthBoxItem = document.getElementById("oe-date-picker-year-month-" + month + "-box" );\r
+ selectMonthItem( selectedMonthBoxItem );\r
+ \r
+ // draw in the days for the selected date\r
+ redrawDays();\r
+ \r
+ //EADS - draw in hours and minutes for selected date\r
+ var hour = gSelectedDate.getHours();\r
+ var selectedHoursBoxItem = document.getElementById("ximfmail-date-picker-hour-box-" + hour );\r
+ selectHoursItem(selectedHoursBoxItem);\r
+ \r
+ var min = gSelectedDate.getMinutes();\r
+ var selectedMinutesBoxItem = null;\r
+ if(min%5 != 0)\r
+ selectedMinutesBoxItem = document.getElementById("ximfmail-date-picker-min-box-" + (Math.round(min/5)*5) );\r
+ else\r
+ selectedMinutesBoxItem = document.getElementById("ximfmail-date-picker-min-box-" + min );\r
+ selectMinutesItem(selectedMinutesBoxItem); \r
+ \r
+ //title calendar\r
+ $("#ximf-date-picker-title").attr("value", gTitleDlg.substring(0,gTitleDlg.lastIndexOf(":")));\r
+ }catch(e){}\r
+}\r
+\r
+function clickDay(newDayItem, newDayItemNumber){\r
+ // Called when a day is clicked, close the picker and call the client's oncommand\r
+ // get the clicked day\r
+ if( gSelectedDayItem == newDayItem )\r
+ return;\r
+ \r
+ // update new selection\r
+ newDayItem.setAttribute("selected",true);\r
+ if(gSelectedDayItem){\r
+ gSelectedDayItem.removeAttribute("selected");\r
+ }\r
+ gSelectedDayItem = newDayItem;\r
+ \r
+ var dayNumberItem = document.getElementById("oe-date-picker-month-day-text-" + newDayItemNumber );\r
+ var dayNumber = dayNumberItem.getAttribute( "value" );\r
+ // they may have clicked an unfilled day, if so ignore it and leave the picker up\r
+ if( dayNumber != "" ){ \r
+ selectDayItem(newDayItem);\r
+ // set the selected date to what they cliked on\r
+ gSelectedDate.setDate( dayNumber );\r
+ }\r
+}\r
+\r
+\r
+/*\r
+ * \r
+ */\r
+function clickMonth(newMonthItem, newMonthNumber){\r
+ // Called when a month box is clicked \r
+ // already selected, return \r
+ if( gSelectedMonthItem == newMonthItem )\r
+ return;\r
+ \r
+ // update new selection\r
+ newMonthItem.setAttribute("selected",true);\r
+ if(gSelectedMonthItem){\r
+ gSelectedMonthItem.removeAttribute("selected");\r
+ }\r
+ gSelectedMonthItem = newMonthItem;\r
+ \r
+ \r
+ // Avoid problems when changing months if the date is at the end of the month\r
+ // i.e. if date is 31 march and you do a setmonth to april, the month would\r
+ // actually be set to may, beacause april only has 30 days.\r
+ // This is why we keep the original date around.\r
+ var oldDate = gSelectedDate.getDate();\r
+ var yearNumber = gSelectedDate.getFullYear();\r
+\r
+ var pastLastDate = new Date( yearNumber, newMonthNumber-1, 32 );\r
+ var lastDayOfMonth = 32 - pastLastDate.getDate(); \r
+\r
+ if( oldDate > lastDayOfMonth ){\r
+ gSelectedDate.setDate(lastDayOfMonth);\r
+ }\r
+\r
+ // update the selected date\r
+ gSelectedDate.setMonth( newMonthNumber - 1 );\r
+\r
+ // select Month\r
+ selectMonthItem( newMonthItem );\r
+\r
+ // redraw days\r
+ redrawDays();\r
+}\r
+\r
+/*\r
+ * \r
+ */\r
+function previousYearCommand(increment){\r
+ // Called when previous Year button is clicked \r
+ // update the selected date\r
+\r
+ var oldYear = gSelectedDate.getFullYear(); \r
+ gSelectedDate.setFullYear( oldYear - increment ); \r
+\r
+ // redraw the year and the days\r
+ redrawYear();\r
+ redrawDays();\r
+}\r
+\r
+/*\r
+ * \r
+ */\r
+function nextYearCommand(increment){\r
+ // Called when next Year button is clicked \r
+ // update the selected date\r
+\r
+ var oldYear = gSelectedDate.getFullYear(); \r
+ gSelectedDate.setFullYear( oldYear + increment ); \r
+\r
+ // redraw the year and the days\r
+ redrawYear();\r
+ redrawDays();\r
+}\r
+\r
+/*\r
+ * \r
+ */\r
+function redrawYear(){\r
+ var yearTitleItem = document.getElementById("oe-date-picker-year-title-text");\r
+ yearTitleItem.setAttribute( "value", gSelectedDate.getFullYear() );\r
+}\r
+\r
+/*\r
+ * \r
+ */\r
+function selectMonthItem(newMonthItem){\r
+ // Select a month box \r
+ // clear old selection, if there is one\r
+ if( gSelectedMonthItem != null ){\r
+ gSelectedMonthItem.removeAttribute("selected");\r
+ }\r
+\r
+ // Set the selected attribute, used to give it a different style\r
+ newMonthItem.setAttribute( "selected" , true );\r
+\r
+ // Remember new selection\r
+ gSelectedMonthItem = newMonthItem;\r
+}\r
+\r
+/*\r
+ * \r
+ */\r
+function selectDayItem(newDayItem){\r
+ // Select a day box \r
+ // clear old selection, if there is one\r
+\r
+ if( gSelectedDayItem != null ){\r
+ gSelectedDayItem.removeAttribute("selected");\r
+ }\r
+\r
+ if( newDayItem != null ){\r
+ // Set the selected attribute, used to give it a different style\r
+ newDayItem.setAttribute( "selected" , true );\r
+ }\r
+ \r
+ // Remember new selection\r
+ gSelectedDayItem = newDayItem;\r
+}\r
+\r
+/*\r
+ * \r
+ */\r
+function redrawDays(){\r
+ // Redraw day numbers based on the selected date\r
+ // Write in all the day numbers \r
+ var firstDate = new Date( gSelectedDate.getFullYear(), gSelectedDate.getMonth(), 1 );\r
+ var firstDayOfWeek = firstDate.getDay();\r
+ \r
+ //get last Day Of Month \r
+ var pastLastDate = new Date( gSelectedDate.getFullYear(), gSelectedDate.getMonth(), 32 );\r
+ var lastDayOfMonth = 32 - pastLastDate.getDate(); \r
+ \r
+ // clear the selected day item \r
+ selectDayItem( null );\r
+ \r
+ // redraw each day bax in the 7 x 6 grid\r
+ var dayNumber = 1;\r
+ for( var dayIndex = 0; dayIndex < 42; ++dayIndex ){\r
+ // get the day text box\r
+ var dayNumberItem = document.getElementById("oe-date-picker-month-day-text-" + (dayIndex + 1) );\r
+ \r
+ // if it is an unfilled day ( before first or after last ), just set its value to "",\r
+ // and don't increment the day number.\r
+ if( dayIndex < firstDayOfWeek || dayNumber > lastDayOfMonth )\r
+ {\r
+ dayNumberItem.setAttribute( "value" , "" ); \r
+ }else{\r
+ // set the value to the day number\r
+ dayNumberItem.setAttribute( "value" , dayNumber );\r
+ \r
+ // draw the day as selected\r
+ if( dayNumber == gSelectedDate.getDate() ){\r
+ var dayNumberBoxItem = document.getElementById( "oe-date-picker-month-day-" + (dayIndex + 1) + "-box" );\r
+ selectDayItem( dayNumberBoxItem );\r
+ }\r
+ \r
+ // advance the day number\r
+ ++dayNumber; \r
+ }\r
+ }\r
+}\r
+\r
+/*\r
+ * \r
+ */\r
+function parseDate(datestr){\r
+ //var datestr = _input.value; \r
+ try{\r
+ if( datestr != "" ){\r
+ var reg=new RegExp("[ / :]+", "g"); //eads\r
+ var parts = datestr.split(reg); \r
+ if( parts.length >= 5 ){ \r
+ //var d = new Date(month, day, year, hour, minutes, seconds);\r
+ //return new Date(parseInt(parts[1]-1),parseInt(parts[0]),parseInt(parts[2]),parseInt(parts[3]),parseInt(parts[4]),0);\r
+ //alert("SPLIT DATE\nmonth : "+parts[1] + "\n day : " + parts[0] +"\n year : "+ parts[2] +"\n hour : "+ parts[3] +"\n min : "+ parts[4]);\r
+ var new_date = new Date();\r
+ new_date.setDate(parseInt(parts[0], 10));\r
+ new_date.setMonth(parseInt(parts[1]-1, 10));\r
+ new_date.setFullYear(parseInt(parts[2], 10));\r
+ new_date.setHours(parseInt(parts[3], 10));\r
+ new_date.setMinutes(parseInt(parts[4], 10));\r
+ new_date.setSeconds(0);\r
+ return new_date; \r
+ }\r
+ }\r
+ }catch(e){}\r
+ return null;\r
+}\r
+\r
+/*\r
+ * \r
+ */\r
+function clickHour(newHoursItem,newHourItemNumber){\r
+ if( gSelectedHourItem == newHoursItem ) return;\r
+ selectHoursItem(newHoursItem);\r
+ /*\r
+ // update new selection\r
+ newHoursItem.setAttribute("selected",true);\r
+ if(gSelectedHourItem){\r
+ gSelectedHourItem.removeAttribute("selected");\r
+ }\r
+ gSelectedHourItem = newHoursItem;\r
+ */\r
+ \r
+ gSelectedDate.setHours(parseInt(newHourItemNumber, 10)); \r
+}\r
+\r
+/*\r
+ * \r
+ */\r
+function selectHoursItem(newHoursItem){\r
+ // Select a month box \r
+ // clear old selection, if there is one\r
+ if( gSelectedHourItem != null ){\r
+ gSelectedHourItem.removeAttribute( "selected" );\r
+ }\r
+\r
+ // Set the selected attribute, used to give it a different style\r
+ newHoursItem.setAttribute( "selected" , true );\r
+\r
+ // Remember new selection\r
+ gSelectedHourItem = newHoursItem;\r
+}\r
+\r
+/*\r
+ * \r
+ */\r
+function clickMin(newMinItem,newMinItemNumber){ \r
+ if( gSelectedMinItem == newMinItem ) return;\r
+ // update new selection\r
+ selectMinutesItem(newMinItem);\r
+ /*newMinItem.setAttribute("selected",true);\r
+ \r
+ if(gSelectedMinItem){\r
+ gSelectedMinItem.removeAttribute("selected");\r
+ }\r
+ gSelectedMinItem = newMinItem;\r
+ */\r
+ gSelectedDate.setMinutes(parseInt(newMinItemNumber, 10));\r
+ \r
+}\r
+\r
+/*\r
+ * \r
+ */\r
+function selectMinutesItem(newMinutesItem){\r
+ // Select a month box \r
+ // clear old selection, if there is one\r
+ if( gSelectedMinItem != null ){\r
+ gSelectedMinItem.removeAttribute( "selected" );\r
+ }\r
+\r
+ // Set the selected attribute, used to give it a different style\r
+ newMinutesItem.setAttribute( "selected" , true );\r
+\r
+ // Remember new selection\r
+ gSelectedMinItem = newMinutesItem;\r
}
\ No newline at end of file
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- ***** 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 ***** -->
-
-<?xml-stylesheet href="chrome://ximfmail/content/calendar/calendar.css" type="text/css"?>
-<!DOCTYPE overlay SYSTEM "chrome://ximfmail/locale/datepicker.dtd">
-
-<window id="datetimepicker_dialog"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" >
-
- <script type="application/javascript" src="chrome://ximfmail/content/calendar/dialogCalendar-ximfmail.js" />
-
-
- <vbox id="oe-date-picker-overlay-box" >
- <hbox id="ximf-date-picker-head-controls-box">
- <box>
- <label id="ximf-date-picker-title" />
- </box>
- <box flex="1"/>
- <box>
- <image id="ximf-date-picker-cancel-control-box" onclick="clickCancel()"/>
- </box>
- </hbox>
- <hbox id="oe-date-picker-year-controls-box" >
- <box flex="1">
- <image id="oe-date-picker-year-previous-jump-button" onclick="previousYearCommand(10)"/>
- <image id="oe-date-picker-year-previous-button" onclick="previousYearCommand(1)"/>
- </box>
- <label id="oe-date-picker-year-title-text" value="" />
- <box flex="1" id="oe-date-picker-year-next-button-box" >
- <image id="oe-date-picker-year-next-button" onclick="nextYearCommand(1)"/>
- <image id="oe-date-picker-year-next-jump-button" onclick="nextYearCommand(10)"/>
- </box>
- </hbox>
- <grid id="oe-date-picker-year-grid" flex="1">
- <columns>
- <column class="oe-date-picker-year-column-class" flex="1"/>
- <column class="oe-date-picker-year-column-class" flex="1"/>
- <column class="oe-date-picker-year-column-class" flex="1"/>
- <column class="oe-date-picker-year-column-class" flex="1"/>
- </columns>
- <rows >
- <row flex="1">
- <vbox class="oe-date-picker-year-month-box-class" id="oe-date-picker-year-month-1-box" onclick="clickMonth(this, 1)" >
- <spacer flex="1" />
- <box ><label class="oe-date-picker-year-month-name-class" value="&month.1.MMM;" /></box>
- <spacer flex="1" />
- </vbox>
- <vbox class="oe-date-picker-year-month-box-class" id="oe-date-picker-year-month-2-box" onclick="clickMonth(this, 2)" >
- <spacer flex="1" />
- <box><label class="oe-date-picker-year-month-name-class" value="&month.2.MMM;" /></box>
- <spacer flex="1" />
- </vbox>
- <vbox class="oe-date-picker-year-month-box-class" id="oe-date-picker-year-month-3-box" onclick="clickMonth(this, 3)" >
- <spacer flex="1" />
- <box><label class="oe-date-picker-year-month-name-class" value="&month.3.MMM;" /></box>
- <spacer flex="1" />
- </vbox>
- <vbox class="oe-date-picker-year-month-box-class" id="oe-date-picker-year-month-4-box" onclick="clickMonth(this, 4)" >
- <spacer flex="1" />
- <box><label class="oe-date-picker-year-month-name-class" value="&month.4.MMM;" /></box>
- <spacer flex="1" />
- </vbox>
- </row>
- <row flex="1">
- <vbox class="oe-date-picker-year-month-box-class" id="oe-date-picker-year-month-5-box" onclick="clickMonth(this, 5)" >
- <spacer flex="1" />
- <box><label class="oe-date-picker-year-month-name-class" value="&month.5.MMM;" /></box>
- <spacer flex="1" />
- </vbox>
- <vbox class="oe-date-picker-year-month-box-class" id="oe-date-picker-year-month-6-box" onclick="clickMonth(this, 6)" >
- <spacer flex="1" />
- <box><label class="oe-date-picker-year-month-name-class" value="&month.6.MMM;" /></box>
- <spacer flex="1" />
- </vbox>
- <vbox class="oe-date-picker-year-month-box-class" id="oe-date-picker-year-month-7-box" onclick="clickMonth(this, 7)" >
- <spacer flex="1" />
- <box><label class="oe-date-picker-year-month-name-class" value="&month.7.MMM;" /></box>
- <spacer flex="1" />
- </vbox>
- <vbox class="oe-date-picker-year-month-box-class" id="oe-date-picker-year-month-8-box" onclick="clickMonth(this, 8)" >
- <spacer flex="1" />
- <box><label class="oe-date-picker-year-month-name-class" value="&month.8.MMM;" /></box>
- <spacer flex="1" />
- </vbox>
- </row>
- <row flex="1" >
- <vbox class="oe-date-picker-year-month-box-class" id="oe-date-picker-year-month-9-box" onclick="clickMonth(this, 9)" >
- <spacer flex="1" />
- <box><label class="oe-date-picker-year-month-name-class" value="&month.9.MMM;" /></box>
- <spacer flex="1" />
- </vbox>
- <vbox class="oe-date-picker-year-month-box-class" id="oe-date-picker-year-month-10-box" onclick="clickMonth(this, 10)" >
- <spacer flex="1" />
- <box><label class="oe-date-picker-year-month-name-class" value="&month.10.MMM;" /></box>
- <spacer flex="1" />
- </vbox>
- <vbox class="oe-date-picker-year-month-box-class" id="oe-date-picker-year-month-11-box" onclick="clickMonth(this, 11)" >
- <spacer flex="1" />
- <box><label class="oe-date-picker-year-month-name-class" value="&month.11.MMM;" /></box>
- <spacer flex="1" />
- </vbox>
- <vbox class="oe-date-picker-year-month-box-class" id="oe-date-picker-year-month-12-box" onclick="clickMonth(this, 12)" >
- <spacer flex="1" />
- <box><label class="oe-date-picker-year-month-name-class" value="&month.12.MMM;" /></box>
- <spacer flex="1" />
- </vbox>
- </row>
- </rows>
- </grid>
- <box id="oe-date-picker-month-grid-box" flex="1">
- <grid id="oe-date-picker-month-grid" flex="1">
- <columns>
- <column flex="1"/>
- <column flex="1"/>
- <column flex="1"/>
- <column flex="1"/>
- <column flex="1"/>
- <column flex="1"/>
- <column flex="1"/>
- <column flex="1"/>
- </columns>
- <rows>
- <row id="oe-date-picker-month-days-header-box">
- <vbox class="oe-date-picker-month-days-header-class-red" id="oe-date-picker-month-day-1-header-box">
- <label class="oe-date-picker-month-days-header-class" value="&day.1.DDD;" />
- </vbox>
- <vbox class="oe-date-picker-month-days-box-header-class" id="oe-date-picker-month-day-2-header-box">
- <label class="oe-date-picker-month-days-header-class" value="&day.2.DDD;" />
- </vbox>
- <vbox class="oe-date-picker-month-days-box-header-class" id="oe-date-picker-month-day-3-header-box">
- <label class="oe-date-picker-month-days-header-class" value="&day.3.DDD;" />
- </vbox>
- <vbox class="oe-date-picker-month-days-box-header-class" id="oe-date-picker-month-day-4-header-box">
- <label class="oe-date-picker-month-days-header-class" value="&day.4.DDD;" />
- </vbox>
- <vbox class="oe-date-picker-month-days-box-header-class" id="oe-date-picker-month-day-5-header-box">
- <label class="oe-date-picker-month-days-header-class" value="&day.5.DDD;" />
- </vbox>
- <vbox class="oe-date-picker-month-days-box-header-class" id="oe-date-picker-month-day-6-header-box">
- <label class="oe-date-picker-month-days-header-class" value="&day.6.DDD;" />
- </vbox>
- <vbox class="oe-date-picker-month-days-box-header-class" id="oe-date-picker-month-day-7-header-box">
- <label class="oe-date-picker-month-days-header-class" value="&day.7.DDD;" />
- </vbox>
- </row>
- <row>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-1-box" onclick="clickDay(this,1)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-1" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-2-box" onclick="clickDay(this,2)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-2" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-3-box" onclick="clickDay(this,3)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-3" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-4-box" onclick="clickDay(this,4)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-4" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-5-box" onclick="clickDay(this,5)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-5" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-6-box" onclick="clickDay(this,6)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-6" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-7-box" onclick="clickDay(this,7)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-7" value="" />
- </vbox>
- </row>
- <row>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-8-box" onclick="clickDay(this,8)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-8" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-9-box" onclick="clickDay(this,9)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-9" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-10-box" onclick="clickDay(this,10)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-10" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-11-box" onclick="clickDay(this,11)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-11" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-12-box" onclick="clickDay(this,12)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-12" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-13-box" onclick="clickDay(this,13)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-13" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-14-box" onclick="clickDay(this,14)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-14" value="" />
- </vbox>
- </row>
- <row>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-15-box" onclick="clickDay(this,15)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-15" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-16-box" onclick="clickDay(this,16)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-16" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-17-box" onclick="clickDay(this,17)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-17" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-18-box" onclick="clickDay(this,18)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-18" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-19-box" onclick="clickDay(this,19)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-19" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-20-box" onclick="clickDay(this,20)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-20" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-21-box" onclick="clickDay(this,21)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-21" value="" />
- </vbox>
- </row>
- <row>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-22-box" onclick="clickDay(this,22)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-22" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-23-box" onclick="clickDay(this,23)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-23" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-24-box" onclick="clickDay(this,24)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-24" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-25-box" onclick="clickDay(this,25)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-25" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-26-box" onclick="clickDay(this,26)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-26" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-27-box" onclick="clickDay(this,27)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-27" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-28-box" onclick="clickDay(this,28)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-28" value="" />
- </vbox>
- </row>
- <row>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-29-box" onclick="clickDay(this,29)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-29" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-30-box" onclick="clickDay(this,30)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-30" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-31-box" onclick="clickDay(this,31)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-31" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-32-box" onclick="clickDay(this,32)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-32" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-33-box" onclick="clickDay(this,33)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-33" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-34-box" onclick="clickDay(this,34)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-34" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-35-box" onclick="clickDay(this,35)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-35" value="" />
- </vbox>
- </row>
- <row>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-36-box" onclick="clickDay(this,36)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-36" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-37-box" onclick="clickDay(this,37)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-37" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-38-box" onclick="clickDay(this,38)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-38" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-39-box" onclick="clickDay(this,39)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-39" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-40-box" onclick="clickDay(this,40)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-40" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-41-box" onclick="clickDay(this,41)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-41" value="" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-42-box" onclick="clickDay(this,42)">
- <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-42" value="" />
- </vbox>
- </row>
- </rows>
- </grid>
- </box>
- <separator />
- <hbox><label value="&hour.label;"/></hbox>
- <grid flex="1" id="ximfmail-date-picker-hour-grid">
- <columns>
- <column class="oe-date-picker-year-column-class" flex="1"/>
- <column class="oe-date-picker-year-column-class" flex="1"/>
- <column class="oe-date-picker-year-column-class" flex="1"/>
- <column class="oe-date-picker-year-column-class" flex="1"/>
- <column class="oe-date-picker-year-column-class" flex="1"/>
- <column class="oe-date-picker-year-column-class" flex="1"/>
- <column class="oe-date-picker-year-column-class" flex="1"/>
- <column class="oe-date-picker-year-column-class" flex="1"/>
- </columns>
- <rows>
- <row flex="1" id="ximfmail-date-picker-hour-12-header-box">
- <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-0" onclick="clickHour(this,0)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-0" value=" 00 " />
- </vbox>
- <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-1" onclick="clickHour(this,1)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-1" value=" 01 " />
- </vbox>
- <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-2" onclick="clickHour(this,2)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-2" value=" 02 " />
- </vbox>
- <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-3" onclick="clickHour(this,3)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-3" value=" 03 " />
- </vbox>
- <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-4" onclick="clickHour(this,4)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-4" value=" 04 " />
- </vbox>
- <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-5" onclick="clickHour(this,5)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-5" value=" 05 " />
- </vbox>
- <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-6" onclick="clickHour(this,6)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-6" value=" 06 " />
- </vbox>
- <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-7" onclick="clickHour(this,7)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-7" value=" 07 " />
- </vbox>
- <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-8" onclick="clickHour(this,8)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-8" value=" 08 " />
- </vbox>
- <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-9" onclick="clickHour(this,9)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-9" value=" 09 " />
- </vbox>
- <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-10" onclick="clickHour(this,10)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-10" value=" 10 " />
- </vbox>
- <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-11" onclick="clickHour(this,11)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-11" value=" 11 " />
- </vbox>
- </row>
- <row flex="1" id="ximfmail-date-picker-hour-24-header-box">
- <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-12" onclick="clickHour(this,12)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-12" value=" 12 " />
- </vbox>
- <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-13" onclick="clickHour(this,13)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-13" value=" 13 " />
- </vbox>
- <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-14" onclick="clickHour(this,14)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-14" value=" 14 " />
- </vbox>
- <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-15" onclick="clickHour(this,15)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-15" value=" 15 " />
- </vbox>
- <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-16" onclick="clickHour(this,16)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-16" value=" 16 " />
- </vbox>
- <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-17" onclick="clickHour(this,17)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-17" value=" 17 " />
- </vbox>
- <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-18" onclick="clickHour(this,18)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-18" value=" 18 " />
- </vbox>
- <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-19" onclick="clickHour(this,19)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-19" value=" 19 " />
- </vbox>
- <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-20" onclick="clickHour(this,20)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-20" value=" 20 " />
- </vbox>
- <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-21" onclick="clickHour(this,21)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-21" value=" 21 " />
- </vbox>
- <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-22" onclick="clickHour(this,22)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-22" value=" 22 " />
- </vbox>
- <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-23" onclick="clickHour(this,23)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-23" value=" 23 " />
- </vbox>
- </row>
- </rows>
- </grid>
- <hbox><label value="&min.label;"/></hbox>
- <grid flex="1" id="ximfmail-date-picker-min-grid">
- <columns>
- <column flex="1"/>
- <column flex="1"/>
- <column flex="1"/>
- <column flex="1"/>
- <column flex="1"/>
- <column flex="1"/>
- </columns>
- <rows>
- <row id="ximfmail-date-picker-min-line1-header-box">
- <vbox class="oe-date-picker-month-day-box-class" id="ximfmail-date-picker-min-box-0" onclick="clickMin(this,0)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-min-text-0" value=":00" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="ximfmail-date-picker-min-box-5" onclick="clickMin(this,5)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-min-text-5" value=":05" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="ximfmail-date-picker-min-box-10" onclick="clickMin(this,10)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-min-text-10" value=":10" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="ximfmail-date-picker-min-box-15" onclick="clickMin(this,15)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-min-text-15" value=":15" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="ximfmail-date-picker-min-box-20" onclick="clickMin(this,20)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-min-text-20" value=":20" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="ximfmail-date-picker-min-box-25" onclick="clickMin(this,25)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-min-text-25" value=":25" />
- </vbox>
- </row>
- <row id="ximfmail-date-picker-min-line2-header-box">
- <vbox class="oe-date-picker-month-day-box-class" id="ximfmail-date-picker-min-box-30" onclick="clickMin(this,30)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-min-text-30" value=":30" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="ximfmail-date-picker-min-box-35" onclick="clickMin(this,35)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-min-text-35" value=":35" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="ximfmail-date-picker-min-box-40" onclick="clickMin(this,40)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-min-text-40" value=":40" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="ximfmail-date-picker-min-box-45" onclick="clickMin(this,45)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-min-text-45" value=":45" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="ximfmail-date-picker-min-box-50" onclick="clickMin(this,50)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-min-text-50" value=":50" />
- </vbox>
- <vbox class="oe-date-picker-month-day-box-class" id="ximfmail-date-picker-min-box-55" onclick="clickMin(this,55)">
- <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-min-text-55" value=":55" />
- </vbox>
- </row>
- </rows>
- </grid>
- <hbox id="ximf-date-picker-end-controls-box">
- <box>
- <image id="oe-date-picker-currenttime-text" onclick="adjustCurrentDate()" />
- </box>
- <box flex="1" />
- <box>
- <image id="ximf-date-picker-ok-control-box" onclick="clickOk()"/>
- </box>
- </hbox>
- </vbox>
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!-- ***** 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
+<?xml-stylesheet href="chrome://ximfmail/content/calendar/calendar.css" type="text/css"?>\r
+<!DOCTYPE overlay SYSTEM "chrome://ximfmail/locale/datepicker.dtd">\r
+\r
+<window id="datetimepicker_dialog" \r
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" >\r
+ \r
+ <script type="application/javascript" src="chrome://ximfmail/content/calendar/dialogCalendar-ximfmail.js" />\r
+ \r
+ \r
+ <vbox id="oe-date-picker-overlay-box" > \r
+ <hbox id="ximf-date-picker-head-controls-box">\r
+ <box> \r
+ <label id="ximf-date-picker-title" />\r
+ </box> \r
+ <box flex="1"/>\r
+ <box> \r
+ <image id="ximf-date-picker-cancel-control-box" onclick="clickCancel()"/>\r
+ </box>\r
+ </hbox>\r
+ <hbox id="oe-date-picker-year-controls-box" >\r
+ <box flex="1">\r
+ <image id="oe-date-picker-year-previous-jump-button" onclick="previousYearCommand(10)"/> \r
+ <image id="oe-date-picker-year-previous-button" onclick="previousYearCommand(1)"/> \r
+ </box>\r
+ <label id="oe-date-picker-year-title-text" value="" /> \r
+ <box flex="1" id="oe-date-picker-year-next-button-box" >\r
+ <image id="oe-date-picker-year-next-button" onclick="nextYearCommand(1)"/>\r
+ <image id="oe-date-picker-year-next-jump-button" onclick="nextYearCommand(10)"/>\r
+ </box> \r
+ </hbox> \r
+ <grid id="oe-date-picker-year-grid" flex="1">\r
+ <columns>\r
+ <column class="oe-date-picker-year-column-class" flex="1"/>\r
+ <column class="oe-date-picker-year-column-class" flex="1"/>\r
+ <column class="oe-date-picker-year-column-class" flex="1"/>\r
+ <column class="oe-date-picker-year-column-class" flex="1"/>\r
+ </columns>\r
+ <rows >\r
+ <row flex="1">\r
+ <vbox class="oe-date-picker-year-month-box-class" id="oe-date-picker-year-month-1-box" onclick="clickMonth(this, 1)" >\r
+ <spacer flex="1" />\r
+ <box ><label class="oe-date-picker-year-month-name-class" value="&month.1.MMM;" /></box> \r
+ <spacer flex="1" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-year-month-box-class" id="oe-date-picker-year-month-2-box" onclick="clickMonth(this, 2)" >\r
+ <spacer flex="1" />\r
+ <box><label class="oe-date-picker-year-month-name-class" value="&month.2.MMM;" /></box> \r
+ <spacer flex="1" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-year-month-box-class" id="oe-date-picker-year-month-3-box" onclick="clickMonth(this, 3)" >\r
+ <spacer flex="1" />\r
+ <box><label class="oe-date-picker-year-month-name-class" value="&month.3.MMM;" /></box> \r
+ <spacer flex="1" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-year-month-box-class" id="oe-date-picker-year-month-4-box" onclick="clickMonth(this, 4)" >\r
+ <spacer flex="1" />\r
+ <box><label class="oe-date-picker-year-month-name-class" value="&month.4.MMM;" /></box> \r
+ <spacer flex="1" />\r
+ </vbox> \r
+ </row> \r
+ <row flex="1">\r
+ <vbox class="oe-date-picker-year-month-box-class" id="oe-date-picker-year-month-5-box" onclick="clickMonth(this, 5)" >\r
+ <spacer flex="1" />\r
+ <box><label class="oe-date-picker-year-month-name-class" value="&month.5.MMM;" /></box> \r
+ <spacer flex="1" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-year-month-box-class" id="oe-date-picker-year-month-6-box" onclick="clickMonth(this, 6)" >\r
+ <spacer flex="1" />\r
+ <box><label class="oe-date-picker-year-month-name-class" value="&month.6.MMM;" /></box> \r
+ <spacer flex="1" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-year-month-box-class" id="oe-date-picker-year-month-7-box" onclick="clickMonth(this, 7)" >\r
+ <spacer flex="1" />\r
+ <box><label class="oe-date-picker-year-month-name-class" value="&month.7.MMM;" /></box> \r
+ <spacer flex="1" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-year-month-box-class" id="oe-date-picker-year-month-8-box" onclick="clickMonth(this, 8)" >\r
+ <spacer flex="1" />\r
+ <box><label class="oe-date-picker-year-month-name-class" value="&month.8.MMM;" /></box> \r
+ <spacer flex="1" />\r
+ </vbox> \r
+ </row> \r
+ <row flex="1" >\r
+ <vbox class="oe-date-picker-year-month-box-class" id="oe-date-picker-year-month-9-box" onclick="clickMonth(this, 9)" >\r
+ <spacer flex="1" />\r
+ <box><label class="oe-date-picker-year-month-name-class" value="&month.9.MMM;" /></box> \r
+ <spacer flex="1" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-year-month-box-class" id="oe-date-picker-year-month-10-box" onclick="clickMonth(this, 10)" >\r
+ <spacer flex="1" />\r
+ <box><label class="oe-date-picker-year-month-name-class" value="&month.10.MMM;" /></box> \r
+ <spacer flex="1" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-year-month-box-class" id="oe-date-picker-year-month-11-box" onclick="clickMonth(this, 11)" >\r
+ <spacer flex="1" />\r
+ <box><label class="oe-date-picker-year-month-name-class" value="&month.11.MMM;" /></box> \r
+ <spacer flex="1" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-year-month-box-class" id="oe-date-picker-year-month-12-box" onclick="clickMonth(this, 12)" >\r
+ <spacer flex="1" />\r
+ <box><label class="oe-date-picker-year-month-name-class" value="&month.12.MMM;" /></box> \r
+ <spacer flex="1" />\r
+ </vbox> \r
+ </row> \r
+ </rows>\r
+ </grid>\r
+ <box id="oe-date-picker-month-grid-box" flex="1">\r
+ <grid id="oe-date-picker-month-grid" flex="1">\r
+ <columns>\r
+ <column flex="1"/>\r
+ <column flex="1"/>\r
+ <column flex="1"/>\r
+ <column flex="1"/>\r
+ <column flex="1"/>\r
+ <column flex="1"/>\r
+ <column flex="1"/>\r
+ <column flex="1"/>\r
+ </columns>\r
+ <rows>\r
+ <row id="oe-date-picker-month-days-header-box">\r
+ <vbox class="oe-date-picker-month-days-header-class-red" id="oe-date-picker-month-day-1-header-box">\r
+ <label class="oe-date-picker-month-days-header-class" value="&day.1.DDD;" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-days-box-header-class" id="oe-date-picker-month-day-2-header-box">\r
+ <label class="oe-date-picker-month-days-header-class" value="&day.2.DDD;" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-days-box-header-class" id="oe-date-picker-month-day-3-header-box">\r
+ <label class="oe-date-picker-month-days-header-class" value="&day.3.DDD;" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-days-box-header-class" id="oe-date-picker-month-day-4-header-box">\r
+ <label class="oe-date-picker-month-days-header-class" value="&day.4.DDD;" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-days-box-header-class" id="oe-date-picker-month-day-5-header-box">\r
+ <label class="oe-date-picker-month-days-header-class" value="&day.5.DDD;" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-days-box-header-class" id="oe-date-picker-month-day-6-header-box">\r
+ <label class="oe-date-picker-month-days-header-class" value="&day.6.DDD;" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-days-box-header-class" id="oe-date-picker-month-day-7-header-box">\r
+ <label class="oe-date-picker-month-days-header-class" value="&day.7.DDD;" />\r
+ </vbox> \r
+ </row>\r
+ <row>\r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-1-box" onclick="clickDay(this,1)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-1" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-2-box" onclick="clickDay(this,2)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-2" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-3-box" onclick="clickDay(this,3)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-3" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-4-box" onclick="clickDay(this,4)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-4" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-5-box" onclick="clickDay(this,5)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-5" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-6-box" onclick="clickDay(this,6)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-6" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-7-box" onclick="clickDay(this,7)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-7" value="" />\r
+ </vbox> \r
+ </row>\r
+ <row>\r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-8-box" onclick="clickDay(this,8)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-8" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-9-box" onclick="clickDay(this,9)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-9" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-10-box" onclick="clickDay(this,10)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-10" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-11-box" onclick="clickDay(this,11)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-11" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-12-box" onclick="clickDay(this,12)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-12" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-13-box" onclick="clickDay(this,13)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-13" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-14-box" onclick="clickDay(this,14)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-14" value="" />\r
+ </vbox> \r
+ </row>\r
+ <row>\r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-15-box" onclick="clickDay(this,15)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-15" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-16-box" onclick="clickDay(this,16)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-16" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-17-box" onclick="clickDay(this,17)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-17" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-18-box" onclick="clickDay(this,18)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-18" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-19-box" onclick="clickDay(this,19)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-19" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-20-box" onclick="clickDay(this,20)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-20" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-21-box" onclick="clickDay(this,21)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-21" value="" />\r
+ </vbox> \r
+ </row> \r
+ <row>\r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-22-box" onclick="clickDay(this,22)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-22" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-23-box" onclick="clickDay(this,23)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-23" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-24-box" onclick="clickDay(this,24)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-24" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-25-box" onclick="clickDay(this,25)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-25" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-26-box" onclick="clickDay(this,26)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-26" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-27-box" onclick="clickDay(this,27)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-27" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-28-box" onclick="clickDay(this,28)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-28" value="" />\r
+ </vbox> \r
+ </row> \r
+ <row>\r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-29-box" onclick="clickDay(this,29)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-29" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-30-box" onclick="clickDay(this,30)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-30" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-31-box" onclick="clickDay(this,31)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-31" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-32-box" onclick="clickDay(this,32)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-32" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-33-box" onclick="clickDay(this,33)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-33" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-34-box" onclick="clickDay(this,34)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-34" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-35-box" onclick="clickDay(this,35)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-35" value="" />\r
+ </vbox> \r
+ </row> \r
+ <row>\r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-36-box" onclick="clickDay(this,36)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-36" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-37-box" onclick="clickDay(this,37)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-37" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-38-box" onclick="clickDay(this,38)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-38" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-39-box" onclick="clickDay(this,39)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-39" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-40-box" onclick="clickDay(this,40)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-40" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-41-box" onclick="clickDay(this,41)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-41" value="" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="oe-date-picker-month-day-42-box" onclick="clickDay(this,42)">\r
+ <label class="oe-date-picker-month-day-number-class" id="oe-date-picker-month-day-text-42" value="" />\r
+ </vbox> \r
+ </row> \r
+ </rows>\r
+ </grid>\r
+ </box>\r
+ <separator />\r
+ <hbox><label value="&hour.label;"/></hbox>\r
+ <grid flex="1" id="ximfmail-date-picker-hour-grid">\r
+ <columns>\r
+ <column class="oe-date-picker-year-column-class" flex="1"/>\r
+ <column class="oe-date-picker-year-column-class" flex="1"/>\r
+ <column class="oe-date-picker-year-column-class" flex="1"/>\r
+ <column class="oe-date-picker-year-column-class" flex="1"/>\r
+ <column class="oe-date-picker-year-column-class" flex="1"/>\r
+ <column class="oe-date-picker-year-column-class" flex="1"/>\r
+ <column class="oe-date-picker-year-column-class" flex="1"/>\r
+ <column class="oe-date-picker-year-column-class" flex="1"/>\r
+ </columns>\r
+ <rows>\r
+ <row flex="1" id="ximfmail-date-picker-hour-12-header-box">\r
+ <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-0" onclick="clickHour(this,0)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-0" value=" 00 " />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-1" onclick="clickHour(this,1)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-1" value=" 01 " />\r
+ </vbox>\r
+ <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-2" onclick="clickHour(this,2)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-2" value=" 02 " />\r
+ </vbox>\r
+ <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-3" onclick="clickHour(this,3)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-3" value=" 03 " />\r
+ </vbox>\r
+ <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-4" onclick="clickHour(this,4)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-4" value=" 04 " />\r
+ </vbox>\r
+ <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-5" onclick="clickHour(this,5)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-5" value=" 05 " />\r
+ </vbox>\r
+ <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-6" onclick="clickHour(this,6)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-6" value=" 06 " />\r
+ </vbox>\r
+ <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-7" onclick="clickHour(this,7)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-7" value=" 07 " />\r
+ </vbox>\r
+ <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-8" onclick="clickHour(this,8)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-8" value=" 08 " />\r
+ </vbox>\r
+ <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-9" onclick="clickHour(this,9)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-9" value=" 09 " />\r
+ </vbox>\r
+ <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-10" onclick="clickHour(this,10)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-10" value=" 10 " />\r
+ </vbox>\r
+ <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-11" onclick="clickHour(this,11)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-11" value=" 11 " />\r
+ </vbox> \r
+ </row>\r
+ <row flex="1" id="ximfmail-date-picker-hour-24-header-box"> \r
+ <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-12" onclick="clickHour(this,12)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-12" value=" 12 " />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-13" onclick="clickHour(this,13)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-13" value=" 13 " />\r
+ </vbox>\r
+ <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-14" onclick="clickHour(this,14)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-14" value=" 14 " />\r
+ </vbox>\r
+ <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-15" onclick="clickHour(this,15)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-15" value=" 15 " />\r
+ </vbox>\r
+ <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-16" onclick="clickHour(this,16)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-16" value=" 16 " />\r
+ </vbox>\r
+ <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-17" onclick="clickHour(this,17)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-17" value=" 17 " />\r
+ </vbox>\r
+ <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-18" onclick="clickHour(this,18)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-18" value=" 18 " />\r
+ </vbox>\r
+ <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-19" onclick="clickHour(this,19)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-19" value=" 19 " />\r
+ </vbox>\r
+ <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-20" onclick="clickHour(this,20)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-20" value=" 20 " />\r
+ </vbox>\r
+ <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-21" onclick="clickHour(this,21)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-21" value=" 21 " />\r
+ </vbox>\r
+ <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-22" onclick="clickHour(this,22)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-22" value=" 22 " />\r
+ </vbox>\r
+ <vbox class="oe-date-picker-year-month-box-class" id="ximfmail-date-picker-hour-box-23" onclick="clickHour(this,23)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-hour-text-23" value=" 23 " />\r
+ </vbox> \r
+ </row>\r
+ </rows>\r
+ </grid> \r
+ <hbox><label value="&min.label;"/></hbox>\r
+ <grid flex="1" id="ximfmail-date-picker-min-grid">\r
+ <columns>\r
+ <column flex="1"/>\r
+ <column flex="1"/>\r
+ <column flex="1"/>\r
+ <column flex="1"/>\r
+ <column flex="1"/>\r
+ <column flex="1"/> \r
+ </columns>\r
+ <rows>\r
+ <row id="ximfmail-date-picker-min-line1-header-box">\r
+ <vbox class="oe-date-picker-month-day-box-class" id="ximfmail-date-picker-min-box-0" onclick="clickMin(this,0)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-min-text-0" value=":00" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="ximfmail-date-picker-min-box-5" onclick="clickMin(this,5)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-min-text-5" value=":05" />\r
+ </vbox>\r
+ <vbox class="oe-date-picker-month-day-box-class" id="ximfmail-date-picker-min-box-10" onclick="clickMin(this,10)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-min-text-10" value=":10" />\r
+ </vbox>\r
+ <vbox class="oe-date-picker-month-day-box-class" id="ximfmail-date-picker-min-box-15" onclick="clickMin(this,15)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-min-text-15" value=":15" />\r
+ </vbox>\r
+ <vbox class="oe-date-picker-month-day-box-class" id="ximfmail-date-picker-min-box-20" onclick="clickMin(this,20)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-min-text-20" value=":20" />\r
+ </vbox>\r
+ <vbox class="oe-date-picker-month-day-box-class" id="ximfmail-date-picker-min-box-25" onclick="clickMin(this,25)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-min-text-25" value=":25" />\r
+ </vbox> \r
+ </row>\r
+ <row id="ximfmail-date-picker-min-line2-header-box">\r
+ <vbox class="oe-date-picker-month-day-box-class" id="ximfmail-date-picker-min-box-30" onclick="clickMin(this,30)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-min-text-30" value=":30" />\r
+ </vbox>\r
+ <vbox class="oe-date-picker-month-day-box-class" id="ximfmail-date-picker-min-box-35" onclick="clickMin(this,35)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-min-text-35" value=":35" />\r
+ </vbox> \r
+ <vbox class="oe-date-picker-month-day-box-class" id="ximfmail-date-picker-min-box-40" onclick="clickMin(this,40)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-min-text-40" value=":40" />\r
+ </vbox>\r
+ <vbox class="oe-date-picker-month-day-box-class" id="ximfmail-date-picker-min-box-45" onclick="clickMin(this,45)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-min-text-45" value=":45" />\r
+ </vbox>\r
+ <vbox class="oe-date-picker-month-day-box-class" id="ximfmail-date-picker-min-box-50" onclick="clickMin(this,50)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-min-text-50" value=":50" />\r
+ </vbox>\r
+ <vbox class="oe-date-picker-month-day-box-class" id="ximfmail-date-picker-min-box-55" onclick="clickMin(this,55)">\r
+ <label class="oe-date-picker-month-day-number-class" id="ximfmail-date-picker-min-text-55" value=":55" />\r
+ </vbox> \r
+ </row>\r
+ </rows>\r
+ </grid> \r
+ <hbox id="ximf-date-picker-end-controls-box">\r
+ <box> \r
+ <image id="oe-date-picker-currenttime-text" onclick="adjustCurrentDate()" />\r
+ </box> \r
+ <box flex="1" />\r
+ <box> \r
+ <image id="ximf-date-picker-ok-control-box" onclick="clickOk()"/>\r
+ </box>\r
+ </hbox>\r
+ </vbox> \r
</window>
\ No newline at end of file
-/* ***** 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 ***** */
-
-
-var SMTP_VERSION="0.0";
-var SMTP_INSTANCE="smtp";
-var LATIN_CHARSET = "ISO-8859-1";
-
-var XIMF_PREF_IDENTITY_USE_XIMFMAIL = "ximfmail_on";
-var XIMF_PREF_IDENTITY_TREETHREAD_REF = "ximfmail_instance_treethread_ref";
-var XIMF_PREF_IDENTITY_MAIL_PANEL_REF = "ximfmail_instance_mail_panel_ref";
-var PREF_DEFAULT_CHARSET = "mailnews.view_default_charset";
-var PREF_MAILNEWS_DEFAULT_CHARSET = "view_default_charset";
-var PREF_MAILNEWS = "mailnews";
-var PREF_MSGWINDOW_REFRESH = "ximfmail.msgwindow.hdr";
-
-/*
- * Schema xml elements, attributes...
- */
-var XIMF_VERSION_HEADER = "X-XIMF-Version";
-var _XIMF_ATT_XVALUE = "ximfvalue";
-var _XIMF_ATT_TEC_VALUE = "ximftecvalue";
-var _XIMF_ATT_MAX_ITEMS = "ximfmaxitems";
-var _XIMF_ATT_IS_MULTISET = "ismultiset";
-var _XIMF_ATT_REF_BOX = "ximfreftextbox";
-var _XIMF_ATT_REF_HEADER = "refheader";
-var _XIMF_ATT_LINK_POPUP_BOX = "linkpopupbox";
-var _XIMF_ATT_CONCAT_ID = "ximfconcatid";
-var _XIMF_ATT_SEPARATOR = "ximfseparator";
-var _XIMF_ATT_TEC_SEPARATOR = "ximftecseparator";
-var _XIMF_DEFAULT_SEPARATOR = ";";
-var _XIMF_ELT_DATEPICKER = "datepicker";
-
-var XIMF_HEADER_RFC_VERSION = "x-ximf-version";
-var XIMF_HEADER_INSTANCE_VERSION = "x-instance-version";
-var XIMF_HEADER_INSTANCE_NAME = "x-instance-name";
-
-
-//
-var DEFAULT_XIMF_VERSION = "1.0";
-var DEFAULT_XIMF_NAME = "XIMF_BASIC";
-var XIMF_VERSION_HEADER = "X-XIMF-Version";
-var XIMF_NAME_HEADER = "X-XIMF-NAME";
-var XIMF_ENDLINE = "\r\n"; // Windows CRLF
-var XIMF_SEPARATOR_HEADER = ": ";
-
-var XIMFMAIL_SECURE_HEADERS_XML_FILE = "secureHeadersMail.xml";
-var XIMFMAIL_SECURITY_LABEL_XML_DIR = "securityLabel";
-var XIMFMAIL_SECURITY_LABEL_XML_FILE = "ximfmailSecurityLabels.xml";
-
+/* ***** 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
+var SMTP_VERSION="0.0";\r
+var SMTP_INSTANCE="smtp";\r
+var LATIN_CHARSET = "ISO-8859-1";\r
+\r
+var XIMF_PREF_IDENTITY_USE_XIMFMAIL = "ximfmail_on";\r
+var XIMF_PREF_IDENTITY_TREETHREAD_REF = "ximfmail_instance_treethread_ref";\r
+var XIMF_PREF_IDENTITY_MAIL_PANEL_REF = "ximfmail_instance_mail_panel_ref";\r
+var PREF_DEFAULT_CHARSET = "mailnews.view_default_charset";\r
+var PREF_MAILNEWS_DEFAULT_CHARSET = "view_default_charset";\r
+var PREF_MAILNEWS = "mailnews";\r
+var PREF_MSGWINDOW_REFRESH = "ximfmail.msgwindow.hdr";\r
+\r
+/*\r
+ * Schema xml elements, attributes...\r
+ */\r
+var XIMF_VERSION_HEADER = "X-XIMF-Version";\r
+var _XIMF_ATT_XVALUE = "ximfvalue";\r
+var _XIMF_ATT_TEC_VALUE = "ximftecvalue";\r
+var _XIMF_ATT_MAX_ITEMS = "ximfmaxitems";\r
+var _XIMF_ATT_IS_MULTISET = "ismultiset";\r
+var _XIMF_ATT_REF_BOX = "ximfreftextbox";\r
+var _XIMF_ATT_REF_HEADER = "refheader";\r
+var _XIMF_ATT_LINK_POPUP_BOX = "linkpopupbox";\r
+var _XIMF_ATT_CONCAT_ID = "ximfconcatid";\r
+var _XIMF_ATT_SEPARATOR = "ximfseparator";\r
+var _XIMF_ATT_TEC_SEPARATOR = "ximftecseparator";\r
+var _XIMF_DEFAULT_SEPARATOR = ";";\r
+var _XIMF_ELT_DATEPICKER = "datepicker";\r
+\r
+var XIMF_HEADER_RFC_VERSION = "x-ximf-version";\r
+var XIMF_HEADER_INSTANCE_VERSION = "x-instance-version";\r
+var XIMF_HEADER_INSTANCE_NAME = "x-instance-name";\r
+\r
+\r
+//\r
+var DEFAULT_XIMF_VERSION = "1.0";\r
+var DEFAULT_XIMF_NAME = "XIMF_BASIC";\r
+var XIMF_VERSION_HEADER = "X-XIMF-Version";\r
+var XIMF_NAME_HEADER = "X-XIMF-NAME";\r
+var XIMF_ENDLINE = "\r\n"; // Windows CRLF\r
+var XIMF_SEPARATOR_HEADER = ": ";\r
+\r
+var XIMFMAIL_SECURE_HEADERS_XML_FILE = "secureHeadersMail.xml";\r
+var XIMFMAIL_SECURITY_LABEL_XML_DIR = "securityLabel";\r
+var XIMFMAIL_SECURITY_LABEL_XML_FILE = "ximfmailSecurityLabels.xml";\r
+\r
-/* ***** 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 ***** */
-
-/*
- * global variables
- */
-var gConsole = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
-var gJSLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].createInstance(Components.interfaces.mozIJSSubScriptLoader);
-gJSLoader.loadSubScript("chrome://ximfmail/content/jquery.js");
-
-
-/*
- *
- */
- function IsXimfailActivated(identity){
- //alert(identity + "(ximfmail_on) = " + GetXimfmailPref(identity,"ximfmail_on"));
- //if(GetXimfmailPref(identity,"ximfmail_on") == "true")
- if(identity.getBoolAttribute("ximfmail_on"))
- return true;
- else
- return false;
- }
-
-/*
- * get value of ximfmail user preference
- */
-function GetXimfmailPref(idIdentity,key){
- var prefValue = "";
- var ximfmailPrefBranch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("mail.identity." + idIdentity + ".");
- if(ximfmailPrefBranch.prefHasUserValue(key))
- prefValue = ximfmailPrefBranch.getCharPref(key);
- return prefValue;
-}
-
-/*
- * set value of ximfmail user preference
- */
-function SetXimfmailPref(idIdentity,key,value){
- try{
- gConsole.logStringMessage("[ximfmail - SetXimfmailPref] key "+key+" : "+value);
-
- var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
- var ximfmailPrefBranch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("mail.identity." + idIdentity + ".");
- ximfmailPrefBranch.setCharPref(key,value);
- prefSvc.savePrefFile(null);
- }catch(e){
- gConsole.logStringMessage("[ximfmail - SetXimfmailPref] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);
- }
-}
-
-function ResetXimfmailPref(idIdentity,key){
- var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
- var ximfmailPrefBranch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("mail.identity." + idIdentity + ".");
- ximfmailPrefBranch.ClearUserPref(key);
- prefSvc.savePrefFile(null);
-}
-
-
-/*
- * set value to reference attribute of xul element
- * used for RDF resource
- * idElement : id of xul element
- * refValue : value of ref attribute
- */
-function ChangeRefAttrRdfElement(idElement,refValue){
- //$("#"+idElement).attr("ref",refValue);
-
- var list = document.getElementById(idElement);
- list.database.AddDataSource(gXimfCatalog.getDSCatalog());
- list.setAttribute("ref",refValue);
- list.builder.rebuild();
-
-}
-
-/*
- * init default menulist xul element with first menuitem
- * idMenuList : id of menulist xul element
- */
-function InitRDFMenuList(idMenuList){
- var itemlist = $("#"+ idMenuList +" > menupopup > menuitem");
- $("#"+idMenuList).attr("value",$(itemlist[0]).attr("value"));
- $("#"+idMenuList).attr("label",$(itemlist[0]).attr("label"));
-}
-
-/*
- * display user pref value in menulist if exists
- * manage RDF Catalog list in accountWizard, accountManager
- * identity : user identity key
- * idPref : user preference key
- * idList : id of menulist xul element
- */
-function UpdateRDFListWithPref(identity, idPref,idList){
- var pref = GetXimfmailPref(identity,idPref);
- if(pref){
- var themeList = $("#"+idList+" > menupopup > menuitem");
- for(var i=0; i<themeList.length; i++){
- if( pref == $(themeList[i]).attr("value")){
- $("#"+idList).attr("value",$(themeList[i]).attr("value"));
- $("#"+idList).attr("label",$(themeList[i]).attr("label"));
- }
- }
- }
+/* ***** 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
+ * global variables\r
+ */\r
+var gConsole = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);\r
+var gJSLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].createInstance(Components.interfaces.mozIJSSubScriptLoader);\r
+gJSLoader.loadSubScript("chrome://ximfmail/content/jquery.js");\r
+\r
+\r
+/*\r
+ * \r
+ */ \r
+ function IsXimfailActivated(identity){\r
+ //alert(identity + "(ximfmail_on) = " + GetXimfmailPref(identity,"ximfmail_on"));\r
+ //if(GetXimfmailPref(identity,"ximfmail_on") == "true")\r
+ if(identity.getBoolAttribute("ximfmail_on"))\r
+ return true;\r
+ else\r
+ return false;\r
+ }\r
+ \r
+/*\r
+ * get value of ximfmail user preference \r
+ */\r
+function GetXimfmailPref(idIdentity,key){\r
+ var prefValue = ""; \r
+ var ximfmailPrefBranch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("mail.identity." + idIdentity + ".");\r
+ if(ximfmailPrefBranch.prefHasUserValue(key)) \r
+ prefValue = ximfmailPrefBranch.getCharPref(key); \r
+ return prefValue;\r
+}\r
+\r
+/*\r
+ * set value of ximfmail user preference\r
+ */\r
+function SetXimfmailPref(idIdentity,key,value){ \r
+ try{\r
+ gConsole.logStringMessage("[ximfmail - SetXimfmailPref] key "+key+" : "+value);\r
+ \r
+ var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);\r
+ var ximfmailPrefBranch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("mail.identity." + idIdentity + ".");\r
+ ximfmailPrefBranch.setCharPref(key,value);\r
+ prefSvc.savePrefFile(null);\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - SetXimfmailPref] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);\r
+ }\r
+}\r
+\r
+function ResetXimfmailPref(idIdentity,key){ \r
+ var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);\r
+ var ximfmailPrefBranch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("mail.identity." + idIdentity + ".");\r
+ ximfmailPrefBranch.ClearUserPref(key);\r
+ prefSvc.savePrefFile(null);\r
+}\r
+\r
+\r
+/*\r
+ * set value to reference attribute of xul element\r
+ * used for RDF resource\r
+ * idElement : id of xul element\r
+ * refValue : value of ref attribute\r
+ */\r
+function ChangeRefAttrRdfElement(idElement,refValue){\r
+ //$("#"+idElement).attr("ref",refValue);\r
+ \r
+ var list = document.getElementById(idElement); \r
+ list.database.AddDataSource(gXimfCatalog.getDSCatalog()); \r
+ list.setAttribute("ref",refValue);\r
+ list.builder.rebuild();\r
+ \r
+}\r
+\r
+/*\r
+ * init default menulist xul element with first menuitem \r
+ * idMenuList : id of menulist xul element\r
+ */\r
+function InitRDFMenuList(idMenuList){\r
+ var itemlist = $("#"+ idMenuList +" > menupopup > menuitem"); \r
+ $("#"+idMenuList).attr("value",$(itemlist[0]).attr("value"));\r
+ $("#"+idMenuList).attr("label",$(itemlist[0]).attr("label"));\r
+}\r
+\r
+/*\r
+ * display user pref value in menulist if exists\r
+ * manage RDF Catalog list in accountWizard, accountManager\r
+ * identity : user identity key\r
+ * idPref : user preference key\r
+ * idList : id of menulist xul element\r
+ */\r
+function UpdateRDFListWithPref(identity, idPref,idList){\r
+ var pref = GetXimfmailPref(identity,idPref);\r
+ if(pref){\r
+ var themeList = $("#"+idList+" > menupopup > menuitem");\r
+ for(var i=0; i<themeList.length; i++){ \r
+ if( pref == $(themeList[i]).attr("value")){\r
+ $("#"+idList).attr("value",$(themeList[i]).attr("value"));\r
+ $("#"+idList).attr("label",$(themeList[i]).attr("label")); \r
+ }\r
+ }\r
+ }\r
}
\ No newline at end of file
-#datepicker-button{
- list-style-image:url('chrome://ximfmail/content/datepicker/date-n.png');
- max-width:20px;
- min-width:20px;
- width:20px;
- padding:0px;
- margin:0px;
- border-style: none;
- -moz-box-pack:center;
- -moz-box-align:center;
- -moz-outline-width: 0px !important;
- -moz-border-top-colors: none !important;
- -moz-border-right-colors: none !important;
- -moz-border-bottom-colors: none !important;
- -moz-border-left-colors: none !important;
- -moz-appearance: none !important;
-}
-#datepicker-button:hover{
- list-style-image:url('chrome://ximfmail/content/datepicker/date-h.png');
-}
-
-#oe-date-picker-overlay-box
-{
- color: black;
- background-color : #F8F8F8;
- font-size : 10px;
-}
-
-
-#oe-date-picker-year-controls-box
-{
- border : 2px solid #7090b0;
- -moz-box-align : center;
- -moz-box-pack : center;
- background-color : #7090b0
-}
-
-#oe-date-picker-year-title-text
-{
- color: #FFFFFF;
- font-weight: bold;
- font-size:1.5em;
-}
-
-#oe-date-picker-currenttime-text
-{
- list-style-image:url('chrome://ximfmail/content/datepicker/date-n.png');
-
-}
-
-#oe-date-picker-currenttime-text:hover
-{
- list-style-image:url('chrome://ximfmail/content/datepicker/date-h.png');
-
-}
-
-
-#oe-date-picker-year-previous-button
-{
- list-style-image: url("chrome://ximfmail/content/datepicker/left_arrow.png");
- width:1.5em;
- height:1.5em;
-}
-
-#oe-date-picker-year-previous-button:hover
-{
- list-style-image: url("chrome://ximfmail/content/datepicker/left_arrow_hov.png");
- width:1.5em;
- height:1.5em;
-}
-
-#oe-date-picker-year-previous-jump-button
-{
- list-style-image: url("chrome://ximfmail/content/datepicker/left_dblarrow.png");
- width:1.5em;
- height:1.5em;
-}
-
-#oe-date-picker-year-previous-jump-button:hover
-{
- list-style-image: url("chrome://ximfmail/content/datepicker/left_dblarrow_hov.png");
- width:1.5em;
- height:1.5em;
-}
-
-#oe-date-picker-year-next-jump-button
-{
- list-style-image : url("chrome://ximfmail/content/datepicker/right_dblarrow.png");
- width:1.5em;
- height:1.5em;
-}
-
-#oe-date-picker-year-next-jump-button:hover
-{
- list-style-image : url("chrome://ximfmail/content/datepicker/right_dblarrow_hov.png");
- width:1.5em;
- height:1.5em;
-}
-
-#oe-date-picker-year-next-button
-{
- list-style-image : url("chrome://ximfmail/content/datepicker/right_arrow.png");
- width:1.5em;
- height:1.5em;
-}
-
-#oe-date-picker-year-next-button:hover
-{
- list-style-image : url("chrome://ximfmail/content/datepicker/right_arrow_hov.png");
- width:1.5em;
- height:1.5em;
-}
-
-#oe-date-picker-year-next-button-box
-{
- -moz-box-pack : end;
-}
-
-#oe-date-picker-year-grid
-{
- border-top : 1px solid #2085c4;
- border-left : 1px solid #2085c4;
- margin-top : 1px;
- margin-right : 1px;
-}
-
-#ximfmail-date-picker-hour-grid
-{
- border-top : 1px solid #2085c4;
- border-left : 1px solid #2085c4;
- margin-top : 1px;
- margin-right : 1px;
-}
-
-.oe-date-picker-year-month-box-class
-{
- -moz-box-align : center;
- border-right : 1px solid #2085c4;
- border-bottom : 1px solid #2085c4;
- background-color : #E9E9E9;
-}
-
-
-.oe-date-picker-year-month-box-class:hover
-{
- background-color : #C9E8F1;
-}
-
-.oe-date-picker-year-month-box-class[selected="true"]
-{
- background-color : #6699CC;
-}
-
-
-.oe-date-picker-month-day-number-class
-{
- margin : 1px;
-}
-
-.oe-date-picker-month-day-number-class[selected="true"]
-{
-
- background-color : #6699CC;
-}
-
-#oe-date-picker-month-grid
-{
- margin-right : 0px;
- margin-bottom : 0px;
-}
-
-#start-date-button
-{
- border: 0px;
- list-style-image : url("chrome://ximfmail/content/datepicker/calendar-down.gif");
- margin: 0px;
- padding: 0px;
- max-width: 36px;
-}
-
-#start-date-button:hover
-{
- margin: 0px;
- padding: 0px;
- list-style-image : url("chrome://ximfmail/content/datepicker/calendar-up.gif");
-}
-
-.oe-date-picker-month-day-box-class
-{
- min-width : 25px;
- min-height : 15px;
- background-color : #FFFFFF;
-}
-
-.oe-date-picker-month-day-box-class[selected="true"]
-{
- background-color : #6699CC;
-}
-
-.oe-date-picker-month-day-box-class:hover
-{
- background-color : #FFFF99;
-}
-
-.oe-date-picker-month-day-box-class
-{
- -moz-box-align : center;
- border-right : 1px solid #E2E2E2;
- border-bottom : 1px solid #E2E2E2;
- border-top : 1px solid #E2E2E2;
- border-left : 1px solid #E2E2E2;
-}
-
-.oe-date-picker-month-days-header-class
-{
- margin : 0px;
- padding : 0px;
-}
-
-.oe-date-picker-month-days-header-class-red
-{
- color : #FF0000;
-}
-
-#oe-date-picker-month-days-header-box
-{
- margin : 0px 0px;
-}
-
-.oe-date-picker-month-days-box-header-class
-{
- -moz-box-align : center;
-}
-
-#ximf-date-picker-end-controls-box
-{
- border : 2px solid #7090b0;
- -moz-box-align : center;
- -moz-box-pack : center;
- background-color : #7090b0
-}
-
-#ximf-date-picker-ok-control-box
-{
- list-style-image : url("chrome://ximfmail/content/datepicker/ok.png");
-
-}
-
-#ximf-date-picker-ok-control-box:hover
-{
- list-style-image : url("chrome://ximfmail/content/datepicker/ok_hov.png");
-
+#datepicker-button{\r
+ list-style-image:url('chrome://ximfmail/content/datepicker/date-n.png');\r
+ max-width:20px;\r
+ min-width:20px;\r
+ width:20px;\r
+ padding:0px;\r
+ margin:0px;\r
+ border-style: none;\r
+ -moz-box-pack:center;\r
+ -moz-box-align:center;\r
+ -moz-outline-width: 0px !important;\r
+ -moz-border-top-colors: none !important;\r
+ -moz-border-right-colors: none !important;\r
+ -moz-border-bottom-colors: none !important;\r
+ -moz-border-left-colors: none !important;\r
+ -moz-appearance: none !important;\r
+}\r
+#datepicker-button:hover{\r
+ list-style-image:url('chrome://ximfmail/content/datepicker/date-h.png');\r
+}\r
+\r
+#oe-date-picker-overlay-box\r
+{\r
+ color: black;\r
+ background-color : #F8F8F8;\r
+ font-size : 10px;\r
+}\r
+\r
+ \r
+#oe-date-picker-year-controls-box\r
+{\r
+ border : 2px solid #7090b0; \r
+ -moz-box-align : center;\r
+ -moz-box-pack : center;\r
+ background-color : #7090b0\r
+}\r
+\r
+#oe-date-picker-year-title-text\r
+{\r
+ color: #FFFFFF;\r
+ font-weight: bold;\r
+ font-size:1.5em;\r
+}\r
+\r
+#oe-date-picker-currenttime-text\r
+{\r
+ list-style-image:url('chrome://ximfmail/content/datepicker/date-n.png');\r
+ \r
+}\r
+\r
+#oe-date-picker-currenttime-text:hover\r
+{\r
+ list-style-image:url('chrome://ximfmail/content/datepicker/date-h.png');\r
+ \r
+}\r
+\r
+\r
+#oe-date-picker-year-previous-button\r
+{\r
+ list-style-image: url("chrome://ximfmail/content/datepicker/left_arrow.png");\r
+ width:1.5em;\r
+ height:1.5em;\r
+}\r
+\r
+#oe-date-picker-year-previous-button:hover\r
+{\r
+ list-style-image: url("chrome://ximfmail/content/datepicker/left_arrow_hov.png");\r
+ width:1.5em;\r
+ height:1.5em;\r
+}\r
+\r
+#oe-date-picker-year-previous-jump-button\r
+{\r
+ list-style-image: url("chrome://ximfmail/content/datepicker/left_dblarrow.png");\r
+ width:1.5em;\r
+ height:1.5em;\r
+}\r
+\r
+#oe-date-picker-year-previous-jump-button:hover\r
+{\r
+ list-style-image: url("chrome://ximfmail/content/datepicker/left_dblarrow_hov.png");\r
+ width:1.5em;\r
+ height:1.5em;\r
+}\r
+\r
+#oe-date-picker-year-next-jump-button\r
+{\r
+ list-style-image : url("chrome://ximfmail/content/datepicker/right_dblarrow.png");\r
+ width:1.5em;\r
+ height:1.5em;\r
+}\r
+\r
+#oe-date-picker-year-next-jump-button:hover\r
+{\r
+ list-style-image : url("chrome://ximfmail/content/datepicker/right_dblarrow_hov.png");\r
+ width:1.5em;\r
+ height:1.5em;\r
+}\r
+\r
+#oe-date-picker-year-next-button\r
+{\r
+ list-style-image : url("chrome://ximfmail/content/datepicker/right_arrow.png");\r
+ width:1.5em;\r
+ height:1.5em;\r
+}\r
+\r
+#oe-date-picker-year-next-button:hover\r
+{\r
+ list-style-image : url("chrome://ximfmail/content/datepicker/right_arrow_hov.png");\r
+ width:1.5em;\r
+ height:1.5em;\r
+}\r
+\r
+#oe-date-picker-year-next-button-box\r
+{\r
+ -moz-box-pack : end;\r
+}\r
+\r
+#oe-date-picker-year-grid\r
+{\r
+ border-top : 1px solid #2085c4; \r
+ border-left : 1px solid #2085c4; \r
+ margin-top : 1px;\r
+ margin-right : 1px;\r
+}\r
+\r
+#ximfmail-date-picker-hour-grid\r
+{\r
+ border-top : 1px solid #2085c4; \r
+ border-left : 1px solid #2085c4; \r
+ margin-top : 1px;\r
+ margin-right : 1px;\r
+}\r
+\r
+.oe-date-picker-year-month-box-class\r
+{\r
+ -moz-box-align : center;\r
+ border-right : 1px solid #2085c4; \r
+ border-bottom : 1px solid #2085c4;\r
+ background-color : #E9E9E9;\r
+}\r
+\r
+\r
+.oe-date-picker-year-month-box-class:hover\r
+{\r
+ background-color : #C9E8F1;\r
+}\r
+\r
+.oe-date-picker-year-month-box-class[selected="true"]\r
+{\r
+ background-color : #6699CC;\r
+}\r
+\r
+\r
+.oe-date-picker-month-day-number-class\r
+{\r
+ margin : 1px;\r
+}\r
+\r
+.oe-date-picker-month-day-number-class[selected="true"]\r
+{\r
+\r
+ background-color : #6699CC;\r
+}\r
+\r
+#oe-date-picker-month-grid\r
+{\r
+ margin-right : 0px;\r
+ margin-bottom : 0px;\r
+}\r
+\r
+#start-date-button\r
+{\r
+ border: 0px;\r
+ list-style-image : url("chrome://ximfmail/content/datepicker/calendar-down.gif");\r
+ margin: 0px;\r
+ padding: 0px;\r
+ max-width: 36px;\r
+}\r
+\r
+#start-date-button:hover\r
+{\r
+ margin: 0px;\r
+ padding: 0px;\r
+ list-style-image : url("chrome://ximfmail/content/datepicker/calendar-up.gif");\r
+}\r
+\r
+.oe-date-picker-month-day-box-class\r
+{\r
+ min-width : 25px;\r
+ min-height : 15px;\r
+ background-color : #FFFFFF;\r
+}\r
+\r
+.oe-date-picker-month-day-box-class[selected="true"]\r
+{\r
+ background-color : #6699CC;\r
+}\r
+\r
+.oe-date-picker-month-day-box-class:hover\r
+{\r
+ background-color : #FFFF99;\r
+}\r
+\r
+.oe-date-picker-month-day-box-class\r
+{\r
+ -moz-box-align : center;\r
+ border-right : 1px solid #E2E2E2; \r
+ border-bottom : 1px solid #E2E2E2;\r
+ border-top : 1px solid #E2E2E2; \r
+ border-left : 1px solid #E2E2E2;\r
+}\r
+\r
+.oe-date-picker-month-days-header-class\r
+{\r
+ margin : 0px;\r
+ padding : 0px;\r
+}\r
+\r
+.oe-date-picker-month-days-header-class-red\r
+{\r
+ color : #FF0000;\r
+}\r
+\r
+#oe-date-picker-month-days-header-box\r
+{\r
+ margin : 0px 0px;\r
+}\r
+\r
+.oe-date-picker-month-days-box-header-class\r
+{\r
+ -moz-box-align : center;\r
+}\r
+\r
+#ximf-date-picker-end-controls-box\r
+{\r
+ border : 2px solid #7090b0; \r
+ -moz-box-align : center;\r
+ -moz-box-pack : center;\r
+ background-color : #7090b0\r
+}\r
+\r
+#ximf-date-picker-ok-control-box\r
+{\r
+ list-style-image : url("chrome://ximfmail/content/datepicker/ok.png");\r
+\r
+}\r
+\r
+#ximf-date-picker-ok-control-box:hover\r
+{\r
+ list-style-image : url("chrome://ximfmail/content/datepicker/ok_hov.png");\r
+\r
}
\ No newline at end of file
-<?xml version="1.0"?>
-<!DOCTYPE bindings
-[
- <!ENTITY % dtd1 SYSTEM "chrome://ximfmail/locale/datepicker.dtd" > %dtd1;
-
-]>
-<bindings
- xmlns="http://www.mozilla.org/xbl"
- xmlns:html="http://www.w3.org/1999/xhtml"
- xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- xmlns:xbl="http://www.mozilla.org/xbl">
-
- <binding id="datepicker" extends="xul:box">
- <resources>
- <stylesheet src="chrome://ximfmail/content/datepicker/datepicker.css"/>
- <script src="util.js"/>
- </resources>
-
- <content>
- <xul:hbox class="textbox-input-box" flex="1" style="padding-right: 3px;" xbl:inherits="context">
- <xul:hbox align="center" pack="center" flex="1">
- <xul:textbox maxlength="17" anonid="input" flex="1"
- xbl:inherits="class=txtclass,id,context,width,disabled,onfocus,onblur,value,type,maxlength,size,readonly,tabindex,accesskey"/>
- </xul:hbox>
- <xul:hbox pack="center" align="center" flex="0">
- <xul:button id="datepicker-button" oncommand="openPopup(this)" position="after_start" />
- </xul:hbox>
-
- <xul:popup onpopupshowing="popupshowing(this)"
- anonid="oe-date-picker-popup"
- position="start_before"
- oncommand="format(this, 'oe-date-picker-text-box')" value="">
- <xul:vbox id="oe-date-picker-overlay-box" >
- <xul:hbox id="oe-date-picker-year-controls-box" >
- <xul:box flex="1">
- <xul:image id="oe-date-picker-year-previous-jump-button" onclick="previousYearCommand(10)"/>
- <xul:image id="oe-date-picker-year-previous-button" onclick="previousYearCommand(1)"/>
- </xul:box>
- <xul:label id="oe-date-picker-year-title-text" anonid="oe-date-picker-year-title-text" value="" />
- <xul:box flex="1" id="oe-date-picker-year-next-button-box" >
- <xul:image id="oe-date-picker-year-next-button" onclick="nextYearCommand(1)"/>
- <xul:image id="oe-date-picker-year-next-jump-button" onclick="nextYearCommand(10)"/>
- </xul:box>
- </xul:hbox>
-
- <xul:grid id="oe-date-picker-year-grid" flex="1">
- <xul:columns>
- <xul:column class="oe-date-picker-year-column-class" flex="1"/>
- <xul:column class="oe-date-picker-year-column-class" flex="1"/>
- <xul:column class="oe-date-picker-year-column-class" flex="1"/>
- <xul:column class="oe-date-picker-year-column-class" flex="1"/>
- </xul:columns>
- <xul:rows >
- <xul:row flex="1" >
- <xul:vbox class="oe-date-picker-year-month-box-class"
- anonid="oe-date-picker-year-month-1-box"
- onclick="clickMonth(this, 1)" >
- <xul:spacer flex="1" />
- <xul:box ><xul:label class="oe-date-picker-year-month-name-class" value="&month.1.MMM;" /></xul:box>
- <xul:spacer flex="1" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="oe-date-picker-year-month-2-box" onclick="clickMonth(this, 2)" >
- <xul:spacer flex="1" />
- <xul:box><xul:label class="oe-date-picker-year-month-name-class" value="&month.2.MMM;" /></xul:box>
- <xul:spacer flex="1" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="oe-date-picker-year-month-3-box" onclick="clickMonth(this, 3)" >
- <xul:spacer flex="1" />
- <xul:box><xul:label class="oe-date-picker-year-month-name-class" value="&month.3.MMM;" /></xul:box>
- <xul:spacer flex="1" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="oe-date-picker-year-month-4-box" onclick="clickMonth(this, 4)" >
- <xul:spacer flex="1" />
- <xul:box><xul:label class="oe-date-picker-year-month-name-class" value="&month.4.MMM;" /></xul:box>
- <xul:spacer flex="1" />
- </xul:vbox>
- </xul:row>
- <xul:row flex="1" >
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="oe-date-picker-year-month-5-box" onclick="clickMonth(this, 5)" >
- <xul:spacer flex="1" />
- <xul:box><xul:label class="oe-date-picker-year-month-name-class" value="&month.5.MMM;" /></xul:box>
- <xul:spacer flex="1" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="oe-date-picker-year-month-6-box" onclick="clickMonth(this, 6)" >
- <xul:spacer flex="1" />
- <xul:box><xul:label class="oe-date-picker-year-month-name-class" value="&month.6.MMM;" /></xul:box>
- <xul:spacer flex="1" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="oe-date-picker-year-month-7-box" onclick="clickMonth(this, 7)" >
- <xul:spacer flex="1" />
- <xul:box><xul:label class="oe-date-picker-year-month-name-class" value="&month.7.MMM;" /></xul:box>
- <xul:spacer flex="1" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="oe-date-picker-year-month-8-box" onclick="clickMonth(this, 8)" >
- <xul:spacer flex="1" />
- <xul:box><xul:label class="oe-date-picker-year-month-name-class" value="&month.8.MMM;" /></xul:box>
- <xul:spacer flex="1" />
- </xul:vbox>
- </xul:row>
- <xul:row flex="1" >
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="oe-date-picker-year-month-9-box" onclick="clickMonth(this, 9)" >
- <xul:spacer flex="1" />
- <xul:box><xul:label class="oe-date-picker-year-month-name-class" value="&month.9.MMM;" /></xul:box>
- <xul:spacer flex="1" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="oe-date-picker-year-month-10-box" onclick="clickMonth(this, 10)" >
- <xul:spacer flex="1" />
- <xul:box><xul:label class="oe-date-picker-year-month-name-class" value="&month.10.MMM;" /></xul:box>
- <xul:spacer flex="1" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="oe-date-picker-year-month-11-box" onclick="clickMonth(this, 11)" >
- <xul:spacer flex="1" />
- <xul:box><xul:label class="oe-date-picker-year-month-name-class" value="&month.11.MMM;" /></xul:box>
- <xul:spacer flex="1" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-year-month-box-class"
- anonid="oe-date-picker-year-month-12-box"
- onclick="clickMonth(this, 12)" >
- <xul:spacer flex="1" />
- <xul:box><xul:label class="oe-date-picker-year-month-name-class" value="&month.12.MMM;" /></xul:box>
- <xul:spacer flex="1" />
- </xul:vbox>
- </xul:row>
-
-
- </xul:rows>
-
- </xul:grid>
-
- <xul:box id="oe-date-picker-month-grid-box" flex="1">
-
- <xul:grid id="oe-date-picker-month-grid" flex="1">
- <xul:columns>
- <xul:column flex="1"/>
- <xul:column flex="1"/>
- <xul:column flex="1"/>
- <xul:column flex="1"/>
- <xul:column flex="1"/>
- <xul:column flex="1"/>
- <xul:column flex="1"/>
- <xul:column flex="1"/>
- </xul:columns>
- <xul:rows>
-
- <xul:row id="oe-date-picker-month-days-header-box">
- <xul:vbox class="oe-date-picker-month-days-header-class-red" anonid="oe-date-picker-month-day-1-header-box">
- <xul:label class="oe-date-picker-month-days-header-class" value="&day.1.DDD;" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-days-box-header-class" anonid="oe-date-picker-month-day-2-header-box">
- <xul:label class="oe-date-picker-month-days-header-class" value="&day.2.DDD;" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-days-box-header-class" anonid="oe-date-picker-month-day-3-header-box">
- <xul:label class="oe-date-picker-month-days-header-class" value="&day.3.DDD;" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-days-box-header-class" anonid="oe-date-picker-month-day-4-header-box">
- <xul:label class="oe-date-picker-month-days-header-class" value="&day.4.DDD;" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-days-box-header-class" anonid="oe-date-picker-month-day-5-header-box">
- <xul:label class="oe-date-picker-month-days-header-class" value="&day.5.DDD;" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-days-box-header-class" anonid="oe-date-picker-month-day-6-header-box">
- <xul:label class="oe-date-picker-month-days-header-class" value="&day.6.DDD;" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-days-box-header-class" anonid="oe-date-picker-month-day-7-header-box">
- <xul:label class="oe-date-picker-month-days-header-class" value="&day.7.DDD;" />
- </xul:vbox>
- </xul:row>
-
- <xul:row>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-1-box" onclick="clickDay(this,1)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-1" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-2-box" onclick="clickDay(this,2)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-2" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-3-box" onclick="clickDay(this,3)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-3" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-4-box" onclick="clickDay(this,4)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-4" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-5-box" onclick="clickDay(this,5)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-5" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-6-box" onclick="clickDay(this,6)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-6" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-7-box" onclick="clickDay(this,7)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-7" value="" />
- </xul:vbox>
- </xul:row>
-
- <xul:row>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-8-box" onclick="clickDay(this,8)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-8" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-9-box" onclick="clickDay(this,9)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-9" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-10-box" onclick="clickDay(this,10)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-10" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-11-box" onclick="clickDay(this,11)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-11" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-12-box" onclick="clickDay(this,12)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-12" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-13-box" onclick="clickDay(this,13)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-13" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-14-box" onclick="clickDay(this,14)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-14" value="" />
- </xul:vbox>
- </xul:row>
-
- <xul:row>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-15-box" onclick="clickDay(this,15)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-15" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-16-box" onclick="clickDay(this,16)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-16" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-17-box" onclick="clickDay(this,17)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-17" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-18-box" onclick="clickDay(this,18)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-18" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-19-box" onclick="clickDay(this,19)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-19" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-20-box" onclick="clickDay(this,20)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-20" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-21-box" onclick="clickDay(this,21)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-21" value="" />
- </xul:vbox>
- </xul:row>
-
- <xul:row>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-22-box" onclick="clickDay(this,22)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-22" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-23-box" onclick="clickDay(this,23)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-23" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-24-box" onclick="clickDay(this,24)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-24" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-25-box" onclick="clickDay(this,25)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-25" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-26-box" onclick="clickDay(this,26)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-26" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-27-box" onclick="clickDay(this,27)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-27" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-28-box" onclick="clickDay(this,28)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-28" value="" />
- </xul:vbox>
- </xul:row>
-
- <xul:row>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-29-box" onclick="clickDay(this,29)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-29" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-30-box" onclick="clickDay(this,30)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-30" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-31-box" onclick="clickDay(this,31)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-31" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-32-box" onclick="clickDay(this,32)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-32" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-33-box" onclick="clickDay(this,33)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-33" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-34-box" onclick="clickDay(this,34)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-34" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-35-box" onclick="clickDay(this,35)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-35" value="" />
- </xul:vbox>
- </xul:row>
-
- <xul:row>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-36-box" onclick="clickDay(this,36)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-36" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-37-box" onclick="clickDay(this,37)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-37" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-38-box" onclick="clickDay(this,38)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-38" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-39-box" onclick="clickDay(this,39)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-39" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-40-box" onclick="clickDay(this,40)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-40" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-41-box" onclick="clickDay(this,41)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-41" value="" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-42-box" onclick="clickDay(this,42)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-42" value="" />
- </xul:vbox>
- </xul:row>
-
- </xul:rows>
- </xul:grid>
- </xul:box>
-
- <!-- EADS MODIFICATIONS -->
- <!--
- <xul:hbox>
- <xul:label value="TIME : " />
- <xul:radiogroup orient="horizontal">
- <xul:radio id="time12" label="12" onclick="clickHourRange(12)"/>
- <xul:radio id="time24" label="24" onclick="clickHourRange(24)" selected="true"/>
- </xul:radiogroup>
- </xul:hbox>
- -->
- <xul:separator />
- <xul:hbox><xul:label value="Heure"/></xul:hbox>
- <xul:grid flex="1" id="ximfmail-date-picker-hour-grid">
- <xul:columns>
- <xul:column class="oe-date-picker-year-column-class" flex="1"/>
- <xul:column class="oe-date-picker-year-column-class" flex="1"/>
- <xul:column class="oe-date-picker-year-column-class" flex="1"/>
- <xul:column class="oe-date-picker-year-column-class" flex="1"/>
- <xul:column class="oe-date-picker-year-column-class" flex="1"/>
- <xul:column class="oe-date-picker-year-column-class" flex="1"/>
- <xul:column class="oe-date-picker-year-column-class" flex="1"/>
- <xul:column class="oe-date-picker-year-column-class" flex="1"/>
- </xul:columns>
-
- <xul:rows>
- <!--
- <xul:row flex="1">
- <xul:vbox class="oe-date-picker-year-month-box-class">
- <xul:label value="Hour"/>
- </xul:vbox>
- </xul:row>
- -->
- <xul:row flex="1" anonid="ximfmail-date-picker-hour-12-header-box">
-
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-0" onclick="clickHour(this,0)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-0" value="00" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-1" onclick="clickHour(this,1)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-1" value="01" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-2" onclick="clickHour(this,2)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-2" value="02" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-3" onclick="clickHour(this,3)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-3" value="03" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-4" onclick="clickHour(this,4)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-4" value="04" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-5" onclick="clickHour(this,5)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-5" value="05" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-6" onclick="clickHour(this,6)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-6" value="06" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-7" onclick="clickHour(this,7)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-7" value="07" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-8" onclick="clickHour(this,8)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-8" value="08" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-9" onclick="clickHour(this,9)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-9" value="09" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-10" onclick="clickHour(this,10)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-10" value="10" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-11" onclick="clickHour(this,11)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-11" value="11" />
- </xul:vbox>
- </xul:row>
- <xul:row flex="1" anonid="ximfmail-date-picker-hour-24-header-box">
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-12" onclick="clickHour(this,12)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-12" value="12" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-13" onclick="clickHour(this,13)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-13" value="13" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-14" onclick="clickHour(this,14)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-14" value="14" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-15" onclick="clickHour(this,15)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-15" value="15" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-16" onclick="clickHour(this,16)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-16" value="16" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-17" onclick="clickHour(this,17)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-17" value="17" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-18" onclick="clickHour(this,18)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-18" value="18" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-19" onclick="clickHour(this,19)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-19" value="19" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-20" onclick="clickHour(this,20)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-20" value="20" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-21" onclick="clickHour(this,21)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-21" value="21" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-22" onclick="clickHour(this,22)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-22" value="22" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-23" onclick="clickHour(this,23)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-23" value="23" />
- </xul:vbox>
- </xul:row>
- </xul:rows>
- </xul:grid>
- <xul:hbox><xul:label value="Minutes"/></xul:hbox>
- <xul:grid flex="1">
- <xul:columns>
- <xul:column flex="1"/>
- <xul:column flex="1"/>
- <xul:column flex="1"/>
- <xul:column flex="1"/>
- <xul:column flex="1"/>
- <xul:column flex="1"/>
- </xul:columns>
- <xul:rows>
- <!--
- <xul:row>
- <xul:vbox class="oe-date-picker-month-day-box-class">
- <xul:label value="Min" />
- </xul:vbox>
- </xul:row>
- -->
- <xul:row id="ximfmail-date-picker-min-line1-header-box">
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="ximfmail-date-picker-min-box-0" onclick="clickMin(this,0)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-min-text-0" value=":00" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="ximfmail-date-picker-min-box-5" onclick="clickMin(this,5)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-min-text-5" value=":05" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="ximfmail-date-picker-min-box-10" onclick="clickMin(this,10)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-min-text-10" value=":10" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="ximfmail-date-picker-min-box-15" onclick="clickMin(this,15)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-min-text-15" value=":15" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="ximfmail-date-picker-min-box-20" onclick="clickMin(this,20)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-min-text-20" value=":20" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="ximfmail-date-picker-min-box-25" onclick="clickMin(this,25)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-min-text-25" value=":25" />
- </xul:vbox>
- </xul:row>
- <xul:row id="ximfmail-date-picker-min-line2-header-box">
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="ximfmail-date-picker-min-box-30" onclick="clickMin(this,30)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-min-text-30" value=":30" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="ximfmail-date-picker-min-box-35" onclick="clickMin(this,35)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-min-text-35" value=":35" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="ximfmail-date-picker-min-box-40" onclick="clickMin(this,40)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-min-text-40" value=":40" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="ximfmail-date-picker-min-box-45" onclick="clickMin(this,45)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-min-text-45" value=":45" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="ximfmail-date-picker-min-box-50" onclick="clickMin(this,50)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-min-text-50" value=":50" />
- </xul:vbox>
- <xul:vbox class="oe-date-picker-month-day-box-class" anonid="ximfmail-date-picker-min-box-55" onclick="clickMin(this,55)">
- <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-min-text-55" value=":55" />
- </xul:vbox>
- </xul:row>
- </xul:rows>
- </xul:grid>
- <xul:hbox id="ximf-date-picker-end-controls-box">
- <xul:box>
- <xul:image id="oe-date-picker-currenttime-text" onclick="setToday()" /></xul:box>
- <xul:box flex="1" />
- <xul:box> <xul:image id="ximf-date-picker-ok-control-box" onclick="clickOk()"/>
- </xul:box>
- </xul:hbox>
- </xul:vbox>
- </xul:popup>
- </xul:hbox>
- </content>
-
- <implementation>
- <constructor>
- <![CDATA[
- // The popup window containing the picker
- this.gPopup = null
-
- // The original starting date and currently selected date
- this.gOriginalDate = null;
- this.gSelectedDate = null;
-
- // selected items
- this.gSelectedMonthItem = null;
- this.gSelectedDayItem = null;
-
- this._input = document.getAnonymousElementByAttribute( this, "anonid", "input");
-
- var defaultDate = this.date;
- if( defaultDate )
- this.date = defaultDate;
-
- //EADS DS
- this.gSelectedHoursItem = null;
- this.gSelectedMinutesItem = null;
- ]]>
- </constructor>
- <property name="date">
- <getter>
- if( this.hasAttribute( "date" ) ){
- var val = this.getAttribute( "date" );
- if( val == "now" )
- return new Date();
- else
- return new Date( val );
- }
- else
- return null;
- </getter>
- <setter>
- if( val == "now" ){
- this.setDate( new Date() );
- this.setAttribute( "date", "now" );
- }
- else{
- this.setDate( val );
- this.setAttribute( "date", val.getTime() );
- }
- </setter>
- </property>
- <property name="disabled">
- <getter>
- return this._input.disabled;
- </getter>
- <setter>
- this.setAttribute( "disabled", val );
- this._input.disabled = val;
- </setter>
- </property>
-
- <!-- see keypress example from mozilla/toolkit/content/widgets/autocomplete.xml -->
- <method name="onKeyPress">
- <parameter name="aEvent"/>
- <body><![CDATA[
- //XXX: this is so bogus...
- if (aEvent.getPreventDefault())
- return false;
-
- if (aEvent.keyCode || aEvent.charCode <= 32 || aEvent.altKey ||
- aEvent.ctrlKey || aEvent.metaKey)
- return true; // No printable char pressed, not a potential accesskey
-
- var key = aEvent.which;
- var keychar = String.fromCharCode( aEvent.which );//String.fromCharCode(key);
-
- // control keys
- if ((key==null) || (key==0) || (key==8) ||
- (key==9) || (key==13) || (key==27) ){
- return true;
- }
-
- // numbers and a single decimal
- if ((("-/0123456789").indexOf(keychar) > -1)){
- return true;
- }
-
- // blocking event
- aEvent.stopPropagation();
- aEvent.preventDefault();
- return false;
- ]]>
- </body>
- </method>
- <method name="popupshowing">
- <parameter name="popup"/>
- <body><![CDATA[
- // Set up the picker, called when the popup pops
- this.gPopup = popup;
-
- // get the start date from the popup value attribute and select it
- var startDate = this.gPopup.value;
-
- if(startDate){
- this.gOriginalDate = new Date( startDate );
- this.gSelectedDate = new Date( startDate );
- }else{
- this.gOriginalDate = new Date();
- this.gSelectedDate = new Date();
- this.gSelectedDate.setMinutes(Math.round((this.gSelectedDate.getMinutes()/5))*5);
- this.gOriginalDate.setMinutes(Math.round((this.gOriginalDate.getMinutes()/5))*5);
- }
-
- // draw the year based on the selected date
- this.redrawYear();
-
- // draw the month based on the selected date
- var month = this.gSelectedDate.getMonth() + 1;
- var selectedMonthBoxItem = document.getAnonymousElementByAttribute( this, "anonid", "oe-date-picker-year-month-" + month + "-box" );
- this.selectMonthItem( selectedMonthBoxItem );
-
- // draw in the days for the selected date
- this.redrawDays();
-
- //EADS - draw in hours and minutes for selected date
- var hour = this.gSelectedDate.getHours();
- var selectedHoursBoxItem = document.getAnonymousElementByAttribute( this, "anonid", "ximfmail-date-picker-hour-box-" + hour );
- this.selectHoursItem(selectedHoursBoxItem);
-
- var min = this.gSelectedDate.getMinutes();
- var selectedMinutesBoxItem = null;
- if(min%5 != 0)
- selectedMinutesBoxItem = document.getAnonymousElementByAttribute( this, "anonid", "ximfmail-date-picker-min-box-" + (Math.round(min/5)*5) );
- else
- selectedMinutesBoxItem = document.getAnonymousElementByAttribute( this, "anonid", "ximfmail-date-picker-min-box-" + min );
- this.selectMinutesItem(selectedMinutesBoxItem);
- ]]></body>
- </method>
-
- <method name="clickDay">
- <parameter name="newDayItem"/>
- <parameter name="newDayItemNumber"/>
- <body><![CDATA[
- // Called when a day is clicked, close the picker and call the client's oncommand
- // get the clicked day
-
- var dayNumberItem = document.getAnonymousElementByAttribute( this, "anonid", "oe-date-picker-month-day-text-" + newDayItemNumber );
-
- var dayNumber = dayNumberItem.getAttribute( "value" );
-
- // they may have clicked an unfilled day, if so ignore it and leave the picker up
-
- if( dayNumber != "" ){
- this.selectDayItem(newDayItem);
- // set the selected date to what they cliked on
- this.gSelectedDate.setDate( dayNumber );
- this.selectDate();
-
- }
- ]]></body>
- </method>
- <method name="selectDate">
- <body><![CDATA[
- // We copy the picked date to avoid problems with changing the Date object in place
-
- var pickedDate = new Date( this.gSelectedDate );
-
- // put the selected date in the popup item's value property
-
- this.gPopup.value = pickedDate;
-
- // get the client oncommand function, call it if there is one
-
- var commandEventMethod = this.gPopup.getAttribute( "oncommand" );
-
- if( commandEventMethod != null )
- {
- // set up a variable date, that will be avaialable from within the
- // client method
-
- var date = pickedDate;
-
- // Make the function a member of the popup before calling it so that
- // 'this' will be the popup
-
- this.gPopup._input = this._input; // save the input
- var input = this._input;
-
- this.gPopup.oeDatePickerFunction = function(){
- var datePopup = this;
- var newDate = datePopup.value;
- var day = newDate.getDate();
- if(day < 10){day = "0" + day;}
- var month = newDate.getMonth() + 1;
- if(month < 10){month = "0" + month;}
- var hour = newDate.getHours();
- if(hour < 10){hour = "0"+ hour;}
- var min = newDate.getMinutes();
- if(min < 10){min = "0" + min;}
-
- this._input.value = day + "/" + month + "/" + newDate.getFullYear() + " " + hour + ":" + min;
-
- };
-
- this.gPopup.oeDatePickerFunction();
- }
-
- // close the popup
- //this.gPopup.closePopup();
- ]]></body>
- </method>
- <method name="clickMonth">
- <parameter name="newMonthItem"/>
- <parameter name="newMonthNumber"/>
- <body><![CDATA[
- // Called when a month box is clicked
- // already selected, return
- if( this.gSelectedMonthItem == newMonthItem )
- return;
-
- // Avoid problems when changing months if the date is at the end of the month
- // i.e. if date is 31 march and you do a setmonth to april, the month would
- // actually be set to may, beacause april only has 30 days.
- // This is why we keep the original date around.
-
- var oldDate = this.gSelectedDate.getDate();
- var yearNumber = this.gSelectedDate.getFullYear();
-
- var pastLastDate = new Date( yearNumber, newMonthNumber-1, 32 );
- var lastDayOfMonth = 32 - pastLastDate.getDate();
-
- if( oldDate > lastDayOfMonth ){
- this.gSelectedDate.setDate(lastDayOfMonth);
- }
-
- // update the selected date
- this.gSelectedDate.setMonth( newMonthNumber - 1 );
-
- // select Month
- this.selectMonthItem( newMonthItem );
-
- // redraw days
- this.redrawDays();
- this.selectDate();
- ]]></body>
- </method>
- <method name="previousYearCommand">
- <parameter name="increment"/>
- <body><![CDATA[
- // Called when previous Year button is clicked
- // update the selected date
-
- var oldYear = this.gSelectedDate.getFullYear();
- this.gSelectedDate.setFullYear( oldYear - increment );
-
- // redraw the year and the days
- this.redrawYear();
- this.redrawDays();
- this.selectDate();
- ]]></body>
- </method>
- <method name="setToday">
- <body><![CDATA[
- this.gSelectedDate = new Date();
-
- // redraw the year and the days
- this.redrawYear();
- this.redrawDays();
-
- //select new month item
- var newMonth = this.gSelectedDate.getMonth();
- var monthItem = document.getAnonymousElementByAttribute( this, "anonid", "oe-date-picker-year-month-" + (newMonth+1) + "-box");
- this.selectMonthItem(monthItem);
-
- // select new hours item
- var newHour = this.gSelectedDate.getHours();
- var hourNumberItem = document.getAnonymousElementByAttribute( this, "anonid", "ximfmail-date-picker-hour-box-" + newHour );
- this.selectHoursItem(hourNumberItem);
-
- // select new minutes item
- this.gSelectedDate.setMinutes(Math.round((this.gSelectedDate.getMinutes()/5))*5);
- var newMinutes = this.gSelectedDate.getMinutes();
- var minutesNumberItem = document.getAnonymousElementByAttribute( this, "anonid", "ximfmail-date-picker-min-box-" + newMinutes );
- this.selectMinutesItem(minutesNumberItem);
-
- this.selectDate();
- ]]></body>
- </method>
- <method name="nextYearCommand">
- <parameter name="increment"/>
- <body><![CDATA[
- // Called when next Year button is clicked
- // update the selected date
-
- var oldYear = this.gSelectedDate.getFullYear();
- this.gSelectedDate.setFullYear( oldYear + increment );
-
- // redraw the year and the days
- this.redrawYear();
- this.redrawDays();
- this.selectDate();
- ]]></body>
- </method>
- <method name="redrawYear">
- <body><![CDATA[
- var yearTitleItem = document.getAnonymousElementByAttribute( this, "anonid", "oe-date-picker-year-title-text" );
- yearTitleItem.setAttribute( "value", this.gSelectedDate.getFullYear() );
- ]]></body>
- </method>
-
- <method name="selectMonthItem">
- <parameter name="newMonthItem"/>
- <body><![CDATA[
- // Select a month box
- // clear old selection, if there is one
- if( this.gSelectedMonthItem != null ){
- this.gSelectedMonthItem.setAttribute( "selected" , false );
- }
-
- // Set the selected attribute, used to give it a different style
- newMonthItem.setAttribute( "selected" , true );
-
- // Remember new selection
- this.gSelectedMonthItem = newMonthItem;
- ]]></body>
- </method>
- <method name="selectDayItem">
- <parameter name="newDayItem"/>
- <body><![CDATA[
- // Select a day box
- // clear old selection, if there is one
-
- if( this.gSelectedDayItem != null ){
- this.gSelectedDayItem.setAttribute( "selected" , false );
- }
-
- if( newDayItem != null ){
- // Set the selected attribute, used to give it a different style
- newDayItem.setAttribute( "selected" , true );
- }
- // Remember new selection
- this.gSelectedDayItem = newDayItem;
- ]]></body>
- </method>
- <method name="redrawDays">
- <body><![CDATA[
- // Redraw day numbers based on the selected date
- // Write in all the day numbers
-
- var firstDate = new Date( this.gSelectedDate.getFullYear(), this.gSelectedDate.getMonth(), 1 );
- var firstDayOfWeek = firstDate.getDay();
-
- //get last Day Of Month
- var pastLastDate = new Date( this.gSelectedDate.getFullYear(), this.gSelectedDate.getMonth(), 32 );
- var lastDayOfMonth = 32 - pastLastDate.getDate();
-
- // clear the selected day item
- this.selectDayItem( null );
-
- // redraw each day bax in the 7 x 6 grid
-
- var dayNumber = 1;
-
- for( var dayIndex = 0; dayIndex < 42; ++dayIndex )
- {
- // get the day text box
-
- var dayNumberItem = document.getAnonymousElementByAttribute( this, "anonid", "oe-date-picker-month-day-text-" + (dayIndex + 1) );
-
- // if it is an unfilled day ( before first or after last ), just set its value to "",
- // and don't increment the day number.
-
- if( dayIndex < firstDayOfWeek || dayNumber > lastDayOfMonth )
- {
- dayNumberItem.setAttribute( "value" , "" );
- }
- else
- {
- // set the value to the day number
-
- dayNumberItem.setAttribute( "value" , dayNumber );
-
- // draw the day as selected
- if( dayNumber == this.gSelectedDate.getDate() )
- {
- var dayNumberBoxItem = document.getAnonymousElementByAttribute( this, "anonid", "oe-date-picker-month-day-" + (dayIndex + 1) + "-box" );
- this.selectDayItem( dayNumberBoxItem );
- }
-
- // advance the day number
-
- ++dayNumber;
- }
- }
- ]]></body>
- </method>
-
- <method name="openPopup">
- <parameter name="button"/>
- <body><![CDATA[
- var datestr = this._input.value;
- var datePickerPopup = document.getAnonymousElementByAttribute( this, "anonid", "oe-date-picker-popup" );
- var date = this.parseDate( datestr );
- if( !date )
- date = new Date();
-
- datePickerPopup.setAttribute( "value", date );
- // XXX: is there a better way to offset the popup then hard coding 25?
- //datePickerPopup.showPopup( button, button.boxObject.screenX,(button.boxObject.screenY + 25), "popup" );
- datePickerPopup.showPopup( button, -1, -1, "popup" );
- ]]></body>
- </method>
- <method name="parseDate">
- <parameter name="datestr"/>
- <body><![CDATA[
- //var datestr = this._input.value;
- try{
- if( datestr != "" ){
- var reg=new RegExp("[ / :]+", "g"); //eads
- var parts = datestr.split(reg);
- if( parts.length >= 5 ){
- //var d = new Date(month, day, year, hour, minutes, seconds);
- //return new Date(parseInt(parts[1]-1),parseInt(parts[0]),parseInt(parts[2]),parseInt(parts[3]),parseInt(parts[4]),0);
- alert("SPLIT DATE\nmonth : "+parts[1] + "\n day : " + parts[0] +"\n year : "+ parts[2] +"\n hour : "+ parts[3] +"\n min : "+ parts[4]);
- var new_date = new Date();
- new_date.setDate(parseInt(parts[0]));
- new_date.setMonth(parseInt(parts[1]-1));
- new_date.setFullYear(parseInt(parts[2]));
- new_date.setHours(parseInt(parts[3]));
- new_date.setMinutes(parseInt(parts[4]));
- new_date.setSeconds(0);
- return new_date;
- }
- }
- }catch(e){}
- return null;
- ]]></body>
- </method>
-
- <method name="getDate">
- <body><![CDATA[
- return this.parseDate( this._input.value );
- ]]></body>
- </method>
- <method name="setDate">
- <parameter name="date"/>
- <body><![CDATA[
- if( !date )
- return;
-
- try{
- this.gSelectedDate = date;
- this._input.value = date.getDate() + "/" + (date.getMonth()+1) + "/" + date.getFullYear() + " " + date.getHours() + ":" + date.getMinutes();
- }catch( e ){
- // try parsing the date as a string
- this.gSelectedDate = this.parseDate( date );
- if( this.gSelectedDate )
- this._input.value = date;
- else{
- dump( "Date is invalid: " + date + "\n" );
- alert( "Date is invalid: " + date + "\n" );
- return;
- }
- }
- if( this.gPopup ){
- // redraw the year and the days
- this.redrawYear();
- this.redrawDays();
- this.selectDate();
- }
- ]]></body>
- </method>
- <property name="value">
- <getter>
- return this.getDate();
- </getter>
- <setter>
- this.setDate(val);
- </setter>
- </property>
- <!-- EADS BEGIN -->
- <method name="clickHour">
- <parameter name="newHoursItem"/>
- <parameter name="newHourItemNumber"/>
- <body><![CDATA[
- var hourNumberItem = document.getAnonymousElementByAttribute( this, "anonid", "ximfmail-date-picker-hour-text-" + newHourItemNumber );
- var hourNumber = hourNumberItem.getAttribute( "value" );
- // they may have clicked an unfilled day, if so ignore it and leave the picker up
- if( hourNumber != "" ){
-
- this.selectHoursItem(newHoursItem);
-
- //bug on 8 and 9 ParseInt hourNumber
- //alert(hourNumber +" .. " + parseInt(hourNumber)+">>"+this.gSelectedDate.getHours());
-
- var iHour = 0; parseInt(hourNumber);
- if(hourNumber=="08"){
- iHour = 8;
- }else{
- if(hourNumber=="09"){
- iHour = 9;
- }else{
- iHour = parseInt(hourNumber);
- }
- }
-
- this.gSelectedDate.setHours(iHour);
- this.selectDate();
-
- }
- ]]></body>
- </method>
- <method name="selectHoursItem">
- <parameter name="newHoursItem"/>
- <body><![CDATA[
- // Select a month box
- // clear old selection, if there is one
- if( this.gSelectedHoursItem != null ){
- this.gSelectedHoursItem.setAttribute( "selected" , false );
- }
-
- // Set the selected attribute, used to give it a different style
- newHoursItem.setAttribute( "selected" , true );
-
- // Remember new selection
- this.gSelectedHoursItem = newHoursItem;
- ]]></body>
- </method>
- <method name="clickMin">
- <parameter name="newMinItem"/>
- <parameter name="newMinItemNumber"/>
- <body><![CDATA[
- var minItem = document.getAnonymousElementByAttribute( this, "anonid", "ximfmail-date-picker-min-text-" + newMinItemNumber );
- var minNumber = minItem.getAttribute( "value" );
-
- // they may have clicked an unfilled day, if so ignore it and leave the picker up
- if( minNumber != "" ){
- //
- this.selectMinutesItem(newMinItem);
- //
-
- this.gSelectedDate.setMinutes(parseInt(newMinItemNumber));
- this.selectDate();
- }
- ]]></body>
- </method>
-
- <method name="selectMinutesItem">
- <parameter name="newMinutesItem"/>
- <body><![CDATA[
- // Select a month box
- // clear old selection, if there is one
- if( this.gSelectedMinutesItem != null ){
- this.gSelectedMinutesItem.setAttribute( "selected" , false );
- }
-
- // Set the selected attribute, used to give it a different style
- newMinutesItem.setAttribute( "selected" , true );
-
- // Remember new selection
- this.gSelectedMinutesItem = newMinutesItem;
- ]]></body>
- </method>
- <method name="clickOk">
- <body><![CDATA[
- this.selectDate();
- this.gPopup.hidePopup();
- ]]></body>
- </method>
-
- <method name="clickHourRange">
- <parameter name="newValueNumber"/>
- <body><![CDATA[
- var rowItem = document.getAnonymousElementByAttribute( this, "anonid", "ximfmail-date-picker-hour-24-header-box" );
- if(newValueNumber == "12"){
- //rowItem.setAttribute("hidden","true");
- rowItem.style.display="none";
- }else{
- //rowItem.setAttribute("hidden","false");
- rowItem.style.display="";
- }
- ]]></body>
- </method>
- <!-- EADS END -->
- </implementation>
- <handlers>
- <handler event="keypress" phase="capturing" action="return this.onKeyPress(event);"/>
- </handlers>
- </binding>
-</bindings>
+<?xml version="1.0"?>\r
+<!DOCTYPE bindings \r
+[\r
+ <!ENTITY % dtd1 SYSTEM "chrome://ximfmail/locale/datepicker.dtd" > %dtd1; \r
+ \r
+]>\r
+<bindings \r
+ xmlns="http://www.mozilla.org/xbl"\r
+ xmlns:html="http://www.w3.org/1999/xhtml"\r
+ xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"\r
+ xmlns:xbl="http://www.mozilla.org/xbl">\r
+\r
+ <binding id="datepicker" extends="xul:box">\r
+ <resources>\r
+ <stylesheet src="chrome://ximfmail/content/datepicker/datepicker.css"/>\r
+ <script src="util.js"/>\r
+ </resources>\r
+\r
+ <content>\r
+ <xul:hbox class="textbox-input-box" flex="1" style="padding-right: 3px;" xbl:inherits="context">\r
+ <xul:hbox align="center" pack="center" flex="1">\r
+ <xul:textbox maxlength="17" anonid="input" flex="1" \r
+ xbl:inherits="class=txtclass,id,context,width,disabled,onfocus,onblur,value,type,maxlength,size,readonly,tabindex,accesskey"/> \r
+ </xul:hbox>\r
+ <xul:hbox pack="center" align="center" flex="0">\r
+ <xul:button id="datepicker-button" oncommand="openPopup(this)" position="after_start" />\r
+ </xul:hbox>\r
+\r
+ <xul:popup onpopupshowing="popupshowing(this)" \r
+ anonid="oe-date-picker-popup" \r
+ position="start_before" \r
+ oncommand="format(this, 'oe-date-picker-text-box')" value="">\r
+ <xul:vbox id="oe-date-picker-overlay-box" > \r
+ <xul:hbox id="oe-date-picker-year-controls-box" >\r
+ <xul:box flex="1">\r
+ <xul:image id="oe-date-picker-year-previous-jump-button" onclick="previousYearCommand(10)"/> \r
+ <xul:image id="oe-date-picker-year-previous-button" onclick="previousYearCommand(1)"/> \r
+ </xul:box>\r
+ <xul:label id="oe-date-picker-year-title-text" anonid="oe-date-picker-year-title-text" value="" /> \r
+ <xul:box flex="1" id="oe-date-picker-year-next-button-box" >\r
+ <xul:image id="oe-date-picker-year-next-button" onclick="nextYearCommand(1)"/>\r
+ <xul:image id="oe-date-picker-year-next-jump-button" onclick="nextYearCommand(10)"/>\r
+ </xul:box> \r
+ </xul:hbox> \r
+ \r
+ <xul:grid id="oe-date-picker-year-grid" flex="1">\r
+ <xul:columns>\r
+ <xul:column class="oe-date-picker-year-column-class" flex="1"/>\r
+ <xul:column class="oe-date-picker-year-column-class" flex="1"/>\r
+ <xul:column class="oe-date-picker-year-column-class" flex="1"/>\r
+ <xul:column class="oe-date-picker-year-column-class" flex="1"/>\r
+ </xul:columns>\r
+ <xul:rows >\r
+ <xul:row flex="1" >\r
+ <xul:vbox class="oe-date-picker-year-month-box-class" \r
+ anonid="oe-date-picker-year-month-1-box" \r
+ onclick="clickMonth(this, 1)" >\r
+ <xul:spacer flex="1" />\r
+ <xul:box ><xul:label class="oe-date-picker-year-month-name-class" value="&month.1.MMM;" /></xul:box> \r
+ <xul:spacer flex="1" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="oe-date-picker-year-month-2-box" onclick="clickMonth(this, 2)" >\r
+ <xul:spacer flex="1" />\r
+ <xul:box><xul:label class="oe-date-picker-year-month-name-class" value="&month.2.MMM;" /></xul:box> \r
+ <xul:spacer flex="1" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="oe-date-picker-year-month-3-box" onclick="clickMonth(this, 3)" >\r
+ <xul:spacer flex="1" />\r
+ <xul:box><xul:label class="oe-date-picker-year-month-name-class" value="&month.3.MMM;" /></xul:box> \r
+ <xul:spacer flex="1" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="oe-date-picker-year-month-4-box" onclick="clickMonth(this, 4)" >\r
+ <xul:spacer flex="1" />\r
+ <xul:box><xul:label class="oe-date-picker-year-month-name-class" value="&month.4.MMM;" /></xul:box> \r
+ <xul:spacer flex="1" />\r
+ </xul:vbox> \r
+ </xul:row> \r
+ <xul:row flex="1" >\r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="oe-date-picker-year-month-5-box" onclick="clickMonth(this, 5)" >\r
+ <xul:spacer flex="1" />\r
+ <xul:box><xul:label class="oe-date-picker-year-month-name-class" value="&month.5.MMM;" /></xul:box> \r
+ <xul:spacer flex="1" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="oe-date-picker-year-month-6-box" onclick="clickMonth(this, 6)" >\r
+ <xul:spacer flex="1" />\r
+ <xul:box><xul:label class="oe-date-picker-year-month-name-class" value="&month.6.MMM;" /></xul:box> \r
+ <xul:spacer flex="1" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="oe-date-picker-year-month-7-box" onclick="clickMonth(this, 7)" >\r
+ <xul:spacer flex="1" />\r
+ <xul:box><xul:label class="oe-date-picker-year-month-name-class" value="&month.7.MMM;" /></xul:box> \r
+ <xul:spacer flex="1" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="oe-date-picker-year-month-8-box" onclick="clickMonth(this, 8)" >\r
+ <xul:spacer flex="1" />\r
+ <xul:box><xul:label class="oe-date-picker-year-month-name-class" value="&month.8.MMM;" /></xul:box> \r
+ <xul:spacer flex="1" />\r
+ </xul:vbox> \r
+ </xul:row> \r
+ <xul:row flex="1" >\r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="oe-date-picker-year-month-9-box" onclick="clickMonth(this, 9)" >\r
+ <xul:spacer flex="1" />\r
+ <xul:box><xul:label class="oe-date-picker-year-month-name-class" value="&month.9.MMM;" /></xul:box> \r
+ <xul:spacer flex="1" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="oe-date-picker-year-month-10-box" onclick="clickMonth(this, 10)" >\r
+ <xul:spacer flex="1" />\r
+ <xul:box><xul:label class="oe-date-picker-year-month-name-class" value="&month.10.MMM;" /></xul:box> \r
+ <xul:spacer flex="1" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="oe-date-picker-year-month-11-box" onclick="clickMonth(this, 11)" >\r
+ <xul:spacer flex="1" />\r
+ <xul:box><xul:label class="oe-date-picker-year-month-name-class" value="&month.11.MMM;" /></xul:box> \r
+ <xul:spacer flex="1" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-year-month-box-class" \r
+ anonid="oe-date-picker-year-month-12-box" \r
+ onclick="clickMonth(this, 12)" >\r
+ <xul:spacer flex="1" />\r
+ <xul:box><xul:label class="oe-date-picker-year-month-name-class" value="&month.12.MMM;" /></xul:box> \r
+ <xul:spacer flex="1" />\r
+ </xul:vbox> \r
+ </xul:row> \r
+ \r
+ \r
+ </xul:rows>\r
+ \r
+ </xul:grid>\r
+ \r
+ <xul:box id="oe-date-picker-month-grid-box" flex="1">\r
+ \r
+ <xul:grid id="oe-date-picker-month-grid" flex="1">\r
+ <xul:columns>\r
+ <xul:column flex="1"/>\r
+ <xul:column flex="1"/>\r
+ <xul:column flex="1"/>\r
+ <xul:column flex="1"/>\r
+ <xul:column flex="1"/>\r
+ <xul:column flex="1"/>\r
+ <xul:column flex="1"/>\r
+ <xul:column flex="1"/>\r
+ </xul:columns>\r
+ <xul:rows>\r
+ \r
+ <xul:row id="oe-date-picker-month-days-header-box">\r
+ <xul:vbox class="oe-date-picker-month-days-header-class-red" anonid="oe-date-picker-month-day-1-header-box">\r
+ <xul:label class="oe-date-picker-month-days-header-class" value="&day.1.DDD;" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-days-box-header-class" anonid="oe-date-picker-month-day-2-header-box">\r
+ <xul:label class="oe-date-picker-month-days-header-class" value="&day.2.DDD;" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-days-box-header-class" anonid="oe-date-picker-month-day-3-header-box">\r
+ <xul:label class="oe-date-picker-month-days-header-class" value="&day.3.DDD;" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-days-box-header-class" anonid="oe-date-picker-month-day-4-header-box">\r
+ <xul:label class="oe-date-picker-month-days-header-class" value="&day.4.DDD;" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-days-box-header-class" anonid="oe-date-picker-month-day-5-header-box">\r
+ <xul:label class="oe-date-picker-month-days-header-class" value="&day.5.DDD;" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-days-box-header-class" anonid="oe-date-picker-month-day-6-header-box">\r
+ <xul:label class="oe-date-picker-month-days-header-class" value="&day.6.DDD;" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-days-box-header-class" anonid="oe-date-picker-month-day-7-header-box">\r
+ <xul:label class="oe-date-picker-month-days-header-class" value="&day.7.DDD;" />\r
+ </xul:vbox> \r
+ </xul:row>\r
+ \r
+ <xul:row>\r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-1-box" onclick="clickDay(this,1)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-1" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-2-box" onclick="clickDay(this,2)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-2" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-3-box" onclick="clickDay(this,3)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-3" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-4-box" onclick="clickDay(this,4)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-4" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-5-box" onclick="clickDay(this,5)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-5" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-6-box" onclick="clickDay(this,6)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-6" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-7-box" onclick="clickDay(this,7)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-7" value="" />\r
+ </xul:vbox> \r
+ </xul:row>\r
+ \r
+ <xul:row>\r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-8-box" onclick="clickDay(this,8)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-8" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-9-box" onclick="clickDay(this,9)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-9" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-10-box" onclick="clickDay(this,10)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-10" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-11-box" onclick="clickDay(this,11)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-11" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-12-box" onclick="clickDay(this,12)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-12" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-13-box" onclick="clickDay(this,13)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-13" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-14-box" onclick="clickDay(this,14)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-14" value="" />\r
+ </xul:vbox> \r
+ </xul:row>\r
+ \r
+ <xul:row>\r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-15-box" onclick="clickDay(this,15)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-15" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-16-box" onclick="clickDay(this,16)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-16" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-17-box" onclick="clickDay(this,17)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-17" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-18-box" onclick="clickDay(this,18)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-18" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-19-box" onclick="clickDay(this,19)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-19" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-20-box" onclick="clickDay(this,20)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-20" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-21-box" onclick="clickDay(this,21)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-21" value="" />\r
+ </xul:vbox> \r
+ </xul:row>\r
+ \r
+ <xul:row>\r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-22-box" onclick="clickDay(this,22)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-22" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-23-box" onclick="clickDay(this,23)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-23" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-24-box" onclick="clickDay(this,24)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-24" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-25-box" onclick="clickDay(this,25)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-25" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-26-box" onclick="clickDay(this,26)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-26" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-27-box" onclick="clickDay(this,27)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-27" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-28-box" onclick="clickDay(this,28)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-28" value="" />\r
+ </xul:vbox> \r
+ </xul:row>\r
+ \r
+ <xul:row>\r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-29-box" onclick="clickDay(this,29)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-29" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-30-box" onclick="clickDay(this,30)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-30" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-31-box" onclick="clickDay(this,31)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-31" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-32-box" onclick="clickDay(this,32)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-32" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-33-box" onclick="clickDay(this,33)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-33" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-34-box" onclick="clickDay(this,34)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-34" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-35-box" onclick="clickDay(this,35)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-35" value="" />\r
+ </xul:vbox> \r
+ </xul:row>\r
+ \r
+ <xul:row>\r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-36-box" onclick="clickDay(this,36)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-36" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-37-box" onclick="clickDay(this,37)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-37" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-38-box" onclick="clickDay(this,38)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-38" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-39-box" onclick="clickDay(this,39)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-39" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-40-box" onclick="clickDay(this,40)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-40" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-41-box" onclick="clickDay(this,41)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-41" value="" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="oe-date-picker-month-day-42-box" onclick="clickDay(this,42)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="oe-date-picker-month-day-text-42" value="" />\r
+ </xul:vbox> \r
+ </xul:row>\r
+ \r
+ </xul:rows>\r
+ </xul:grid>\r
+ </xul:box>\r
+ \r
+ <!-- EADS MODIFICATIONS -->\r
+ <!-- \r
+ <xul:hbox>\r
+ <xul:label value="TIME : " />\r
+ <xul:radiogroup orient="horizontal">\r
+ <xul:radio id="time12" label="12" onclick="clickHourRange(12)"/>\r
+ <xul:radio id="time24" label="24" onclick="clickHourRange(24)" selected="true"/>\r
+ </xul:radiogroup> \r
+ </xul:hbox>\r
+ -->\r
+ <xul:separator />\r
+ <xul:hbox><xul:label value="Heure"/></xul:hbox>\r
+ <xul:grid flex="1" id="ximfmail-date-picker-hour-grid">\r
+ <xul:columns>\r
+ <xul:column class="oe-date-picker-year-column-class" flex="1"/>\r
+ <xul:column class="oe-date-picker-year-column-class" flex="1"/>\r
+ <xul:column class="oe-date-picker-year-column-class" flex="1"/>\r
+ <xul:column class="oe-date-picker-year-column-class" flex="1"/>\r
+ <xul:column class="oe-date-picker-year-column-class" flex="1"/>\r
+ <xul:column class="oe-date-picker-year-column-class" flex="1"/>\r
+ <xul:column class="oe-date-picker-year-column-class" flex="1"/>\r
+ <xul:column class="oe-date-picker-year-column-class" flex="1"/>\r
+ </xul:columns>\r
+ \r
+ <xul:rows>\r
+ <!-- \r
+ <xul:row flex="1">\r
+ <xul:vbox class="oe-date-picker-year-month-box-class">\r
+ <xul:label value="Hour"/>\r
+ </xul:vbox> \r
+ </xul:row>\r
+ --> \r
+ <xul:row flex="1" anonid="ximfmail-date-picker-hour-12-header-box">\r
+ \r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-0" onclick="clickHour(this,0)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-0" value="00" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-1" onclick="clickHour(this,1)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-1" value="01" />\r
+ </xul:vbox>\r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-2" onclick="clickHour(this,2)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-2" value="02" />\r
+ </xul:vbox>\r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-3" onclick="clickHour(this,3)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-3" value="03" />\r
+ </xul:vbox>\r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-4" onclick="clickHour(this,4)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-4" value="04" />\r
+ </xul:vbox>\r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-5" onclick="clickHour(this,5)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-5" value="05" />\r
+ </xul:vbox>\r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-6" onclick="clickHour(this,6)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-6" value="06" />\r
+ </xul:vbox>\r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-7" onclick="clickHour(this,7)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-7" value="07" />\r
+ </xul:vbox>\r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-8" onclick="clickHour(this,8)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-8" value="08" />\r
+ </xul:vbox>\r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-9" onclick="clickHour(this,9)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-9" value="09" />\r
+ </xul:vbox>\r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-10" onclick="clickHour(this,10)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-10" value="10" />\r
+ </xul:vbox>\r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-11" onclick="clickHour(this,11)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-11" value="11" />\r
+ </xul:vbox> \r
+ </xul:row>\r
+ <xul:row flex="1" anonid="ximfmail-date-picker-hour-24-header-box"> \r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-12" onclick="clickHour(this,12)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-12" value="12" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-13" onclick="clickHour(this,13)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-13" value="13" />\r
+ </xul:vbox>\r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-14" onclick="clickHour(this,14)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-14" value="14" />\r
+ </xul:vbox>\r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-15" onclick="clickHour(this,15)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-15" value="15" />\r
+ </xul:vbox>\r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-16" onclick="clickHour(this,16)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-16" value="16" />\r
+ </xul:vbox>\r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-17" onclick="clickHour(this,17)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-17" value="17" />\r
+ </xul:vbox>\r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-18" onclick="clickHour(this,18)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-18" value="18" />\r
+ </xul:vbox>\r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-19" onclick="clickHour(this,19)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-19" value="19" />\r
+ </xul:vbox>\r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-20" onclick="clickHour(this,20)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-20" value="20" />\r
+ </xul:vbox>\r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-21" onclick="clickHour(this,21)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-21" value="21" />\r
+ </xul:vbox>\r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-22" onclick="clickHour(this,22)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-22" value="22" />\r
+ </xul:vbox>\r
+ <xul:vbox class="oe-date-picker-year-month-box-class" anonid="ximfmail-date-picker-hour-box-23" onclick="clickHour(this,23)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-hour-text-23" value="23" />\r
+ </xul:vbox> \r
+ </xul:row>\r
+ </xul:rows>\r
+ </xul:grid> \r
+ <xul:hbox><xul:label value="Minutes"/></xul:hbox>\r
+ <xul:grid flex="1">\r
+ <xul:columns>\r
+ <xul:column flex="1"/>\r
+ <xul:column flex="1"/>\r
+ <xul:column flex="1"/>\r
+ <xul:column flex="1"/>\r
+ <xul:column flex="1"/>\r
+ <xul:column flex="1"/> \r
+ </xul:columns>\r
+ <xul:rows>\r
+ <!-- \r
+ <xul:row>\r
+ <xul:vbox class="oe-date-picker-month-day-box-class">\r
+ <xul:label value="Min" />\r
+ </xul:vbox>\r
+ </xul:row>\r
+ -->\r
+ <xul:row id="ximfmail-date-picker-min-line1-header-box">\r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="ximfmail-date-picker-min-box-0" onclick="clickMin(this,0)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-min-text-0" value=":00" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="ximfmail-date-picker-min-box-5" onclick="clickMin(this,5)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-min-text-5" value=":05" />\r
+ </xul:vbox>\r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="ximfmail-date-picker-min-box-10" onclick="clickMin(this,10)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-min-text-10" value=":10" />\r
+ </xul:vbox>\r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="ximfmail-date-picker-min-box-15" onclick="clickMin(this,15)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-min-text-15" value=":15" />\r
+ </xul:vbox>\r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="ximfmail-date-picker-min-box-20" onclick="clickMin(this,20)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-min-text-20" value=":20" />\r
+ </xul:vbox>\r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="ximfmail-date-picker-min-box-25" onclick="clickMin(this,25)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-min-text-25" value=":25" />\r
+ </xul:vbox> \r
+ </xul:row>\r
+ <xul:row id="ximfmail-date-picker-min-line2-header-box">\r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="ximfmail-date-picker-min-box-30" onclick="clickMin(this,30)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-min-text-30" value=":30" />\r
+ </xul:vbox>\r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="ximfmail-date-picker-min-box-35" onclick="clickMin(this,35)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-min-text-35" value=":35" />\r
+ </xul:vbox> \r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="ximfmail-date-picker-min-box-40" onclick="clickMin(this,40)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-min-text-40" value=":40" />\r
+ </xul:vbox>\r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="ximfmail-date-picker-min-box-45" onclick="clickMin(this,45)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-min-text-45" value=":45" />\r
+ </xul:vbox>\r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="ximfmail-date-picker-min-box-50" onclick="clickMin(this,50)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-min-text-50" value=":50" />\r
+ </xul:vbox>\r
+ <xul:vbox class="oe-date-picker-month-day-box-class" anonid="ximfmail-date-picker-min-box-55" onclick="clickMin(this,55)">\r
+ <xul:label class="oe-date-picker-month-day-number-class" anonid="ximfmail-date-picker-min-text-55" value=":55" />\r
+ </xul:vbox> \r
+ </xul:row>\r
+ </xul:rows>\r
+ </xul:grid> \r
+ <xul:hbox id="ximf-date-picker-end-controls-box">\r
+ <xul:box> \r
+ <xul:image id="oe-date-picker-currenttime-text" onclick="setToday()" /></xul:box> \r
+ <xul:box flex="1" />\r
+ <xul:box> <xul:image id="ximf-date-picker-ok-control-box" onclick="clickOk()"/>\r
+ </xul:box>\r
+ </xul:hbox>\r
+ </xul:vbox> \r
+ </xul:popup>\r
+ </xul:hbox>\r
+ </content>\r
+\r
+ <implementation>\r
+ <constructor>\r
+ <![CDATA[\r
+ // The popup window containing the picker\r
+ this.gPopup = null\r
+ \r
+ // The original starting date and currently selected date\r
+ this.gOriginalDate = null; \r
+ this.gSelectedDate = null; \r
+ \r
+ // selected items\r
+ this.gSelectedMonthItem = null;\r
+ this.gSelectedDayItem = null; \r
+ \r
+ this._input = document.getAnonymousElementByAttribute( this, "anonid", "input");\r
+ \r
+ var defaultDate = this.date;\r
+ if( defaultDate )\r
+ this.date = defaultDate;\r
+ \r
+ //EADS DS\r
+ this.gSelectedHoursItem = null;\r
+ this.gSelectedMinutesItem = null;\r
+ ]]>\r
+ </constructor> \r
+ <property name="date">\r
+ <getter>\r
+ if( this.hasAttribute( "date" ) ){\r
+ var val = this.getAttribute( "date" );\r
+ if( val == "now" )\r
+ return new Date();\r
+ else\r
+ return new Date( val );\r
+ }\r
+ else\r
+ return null;\r
+ </getter>\r
+ <setter>\r
+ if( val == "now" ){\r
+ this.setDate( new Date() );\r
+ this.setAttribute( "date", "now" );\r
+ }\r
+ else{\r
+ this.setDate( val );\r
+ this.setAttribute( "date", val.getTime() );\r
+ }\r
+ </setter>\r
+ </property>\r
+ <property name="disabled">\r
+ <getter>\r
+ return this._input.disabled;\r
+ </getter>\r
+ <setter>\r
+ this.setAttribute( "disabled", val );\r
+ this._input.disabled = val;\r
+ </setter>\r
+ </property>\r
+\r
+ <!-- see keypress example from mozilla/toolkit/content/widgets/autocomplete.xml -->\r
+ <method name="onKeyPress">\r
+ <parameter name="aEvent"/>\r
+ <body><![CDATA[\r
+ //XXX: this is so bogus...\r
+ if (aEvent.getPreventDefault())\r
+ return false;\r
+\r
+ if (aEvent.keyCode || aEvent.charCode <= 32 || aEvent.altKey || \r
+ aEvent.ctrlKey || aEvent.metaKey)\r
+ return true; // No printable char pressed, not a potential accesskey\r
+\r
+ var key = aEvent.which;\r
+ var keychar = String.fromCharCode( aEvent.which );//String.fromCharCode(key);\r
+\r
+ // control keys\r
+ if ((key==null) || (key==0) || (key==8) || \r
+ (key==9) || (key==13) || (key==27) ){\r
+ return true;\r
+ }\r
+\r
+ // numbers and a single decimal\r
+ if ((("-/0123456789").indexOf(keychar) > -1)){\r
+ return true;\r
+ }\r
+ \r
+ // blocking event\r
+ aEvent.stopPropagation();\r
+ aEvent.preventDefault();\r
+ return false;\r
+ ]]>\r
+ </body>\r
+ </method>\r
+ <method name="popupshowing">\r
+ <parameter name="popup"/>\r
+ <body><![CDATA[\r
+ // Set up the picker, called when the popup pops\r
+ this.gPopup = popup;\r
+\r
+ // get the start date from the popup value attribute and select it \r
+ var startDate = this.gPopup.value; \r
+ \r
+ if(startDate){ \r
+ this.gOriginalDate = new Date( startDate );\r
+ this.gSelectedDate = new Date( startDate );\r
+ }else{\r
+ this.gOriginalDate = new Date();\r
+ this.gSelectedDate = new Date();\r
+ this.gSelectedDate.setMinutes(Math.round((this.gSelectedDate.getMinutes()/5))*5); \r
+ this.gOriginalDate.setMinutes(Math.round((this.gOriginalDate.getMinutes()/5))*5); \r
+ }\r
+ \r
+ // draw the year based on the selected date\r
+ this.redrawYear();\r
+\r
+ // draw the month based on the selected date\r
+ var month = this.gSelectedDate.getMonth() + 1;\r
+ var selectedMonthBoxItem = document.getAnonymousElementByAttribute( this, "anonid", "oe-date-picker-year-month-" + month + "-box" );\r
+ this.selectMonthItem( selectedMonthBoxItem );\r
+\r
+ // draw in the days for the selected date\r
+ this.redrawDays();\r
+ \r
+ //EADS - draw in hours and minutes for selected date\r
+ var hour = this.gSelectedDate.getHours();\r
+ var selectedHoursBoxItem = document.getAnonymousElementByAttribute( this, "anonid", "ximfmail-date-picker-hour-box-" + hour );\r
+ this.selectHoursItem(selectedHoursBoxItem);\r
+ \r
+ var min = this.gSelectedDate.getMinutes();\r
+ var selectedMinutesBoxItem = null;\r
+ if(min%5 != 0)\r
+ selectedMinutesBoxItem = document.getAnonymousElementByAttribute( this, "anonid", "ximfmail-date-picker-min-box-" + (Math.round(min/5)*5) );\r
+ else\r
+ selectedMinutesBoxItem = document.getAnonymousElementByAttribute( this, "anonid", "ximfmail-date-picker-min-box-" + min );\r
+ this.selectMinutesItem(selectedMinutesBoxItem); \r
+ ]]></body>\r
+ </method>\r
+ \r
+ <method name="clickDay">\r
+ <parameter name="newDayItem"/>\r
+ <parameter name="newDayItemNumber"/>\r
+ <body><![CDATA[\r
+ // Called when a day is clicked, close the picker and call the client's oncommand\r
+ // get the clicked day\r
+ \r
+ var dayNumberItem = document.getAnonymousElementByAttribute( this, "anonid", "oe-date-picker-month-day-text-" + newDayItemNumber );\r
+\r
+ var dayNumber = dayNumberItem.getAttribute( "value" );\r
+\r
+ // they may have clicked an unfilled day, if so ignore it and leave the picker up\r
+\r
+ if( dayNumber != "" ){ \r
+ this.selectDayItem(newDayItem);\r
+ // set the selected date to what they cliked on\r
+ this.gSelectedDate.setDate( dayNumber ); \r
+ this.selectDate();\r
+\r
+ }\r
+ ]]></body>\r
+ </method>\r
+ <method name="selectDate">\r
+ <body><![CDATA[\r
+ // We copy the picked date to avoid problems with changing the Date object in place\r
+ \r
+ var pickedDate = new Date( this.gSelectedDate );\r
+\r
+ // put the selected date in the popup item's value property\r
+\r
+ this.gPopup.value = pickedDate;\r
+\r
+ // get the client oncommand function, call it if there is one\r
+\r
+ var commandEventMethod = this.gPopup.getAttribute( "oncommand" );\r
+\r
+ if( commandEventMethod != null )\r
+ {\r
+ // set up a variable date, that will be avaialable from within the \r
+ // client method\r
+\r
+ var date = pickedDate;\r
+\r
+ // Make the function a member of the popup before calling it so that \r
+ // 'this' will be the popup\r
+\r
+ this.gPopup._input = this._input; // save the input\r
+ var input = this._input;\r
+\r
+ this.gPopup.oeDatePickerFunction = function(){\r
+ var datePopup = this;\r
+ var newDate = datePopup.value;\r
+ var day = newDate.getDate();\r
+ if(day < 10){day = "0" + day;}\r
+ var month = newDate.getMonth() + 1;\r
+ if(month < 10){month = "0" + month;}\r
+ var hour = newDate.getHours();\r
+ if(hour < 10){hour = "0"+ hour;}\r
+ var min = newDate.getMinutes();\r
+ if(min < 10){min = "0" + min;}\r
+\r
+ this._input.value = day + "/" + month + "/" + newDate.getFullYear() + " " + hour + ":" + min;\r
+ \r
+ };\r
+ \r
+ this.gPopup.oeDatePickerFunction();\r
+ }\r
+\r
+ // close the popup\r
+ //this.gPopup.closePopup();\r
+ ]]></body>\r
+ </method>\r
+ <method name="clickMonth">\r
+ <parameter name="newMonthItem"/>\r
+ <parameter name="newMonthNumber"/>\r
+ <body><![CDATA[\r
+ // Called when a month box is clicked \r
+ // already selected, return\r
+ if( this.gSelectedMonthItem == newMonthItem )\r
+ return;\r
+\r
+ // Avoid problems when changing months if the date is at the end of the month\r
+ // i.e. if date is 31 march and you do a setmonth to april, the month would\r
+ // actually be set to may, beacause april only has 30 days.\r
+ // This is why we keep the original date around.\r
+\r
+ var oldDate = this.gSelectedDate.getDate();\r
+ var yearNumber = this.gSelectedDate.getFullYear();\r
+\r
+ var pastLastDate = new Date( yearNumber, newMonthNumber-1, 32 );\r
+ var lastDayOfMonth = 32 - pastLastDate.getDate(); \r
+\r
+ if( oldDate > lastDayOfMonth ){\r
+ this.gSelectedDate.setDate(lastDayOfMonth);\r
+ }\r
+\r
+ // update the selected date\r
+ this.gSelectedDate.setMonth( newMonthNumber - 1 );\r
+\r
+ // select Month\r
+ this.selectMonthItem( newMonthItem );\r
+\r
+ // redraw days\r
+ this.redrawDays();\r
+ this.selectDate();\r
+ ]]></body>\r
+ </method>\r
+ <method name="previousYearCommand">\r
+ <parameter name="increment"/>\r
+ <body><![CDATA[\r
+ // Called when previous Year button is clicked \r
+ // update the selected date\r
+\r
+ var oldYear = this.gSelectedDate.getFullYear(); \r
+ this.gSelectedDate.setFullYear( oldYear - increment ); \r
+\r
+ // redraw the year and the days\r
+ this.redrawYear();\r
+ this.redrawDays();\r
+ this.selectDate();\r
+ ]]></body>\r
+ </method>\r
+ <method name="setToday">\r
+ <body><![CDATA[\r
+ this.gSelectedDate = new Date();\r
+\r
+ // redraw the year and the days\r
+ this.redrawYear();\r
+ this.redrawDays();\r
+ \r
+ //select new month item\r
+ var newMonth = this.gSelectedDate.getMonth(); \r
+ var monthItem = document.getAnonymousElementByAttribute( this, "anonid", "oe-date-picker-year-month-" + (newMonth+1) + "-box");\r
+ this.selectMonthItem(monthItem); \r
+ \r
+ // select new hours item \r
+ var newHour = this.gSelectedDate.getHours(); \r
+ var hourNumberItem = document.getAnonymousElementByAttribute( this, "anonid", "ximfmail-date-picker-hour-box-" + newHour );\r
+ this.selectHoursItem(hourNumberItem);\r
+ \r
+ // select new minutes item\r
+ this.gSelectedDate.setMinutes(Math.round((this.gSelectedDate.getMinutes()/5))*5); \r
+ var newMinutes = this.gSelectedDate.getMinutes(); \r
+ var minutesNumberItem = document.getAnonymousElementByAttribute( this, "anonid", "ximfmail-date-picker-min-box-" + newMinutes );\r
+ this.selectMinutesItem(minutesNumberItem); \r
+ \r
+ this.selectDate();\r
+ ]]></body>\r
+ </method>\r
+ <method name="nextYearCommand">\r
+ <parameter name="increment"/>\r
+ <body><![CDATA[\r
+ // Called when next Year button is clicked \r
+ // update the selected date\r
+\r
+ var oldYear = this.gSelectedDate.getFullYear(); \r
+ this.gSelectedDate.setFullYear( oldYear + increment ); \r
+\r
+ // redraw the year and the days\r
+ this.redrawYear();\r
+ this.redrawDays();\r
+ this.selectDate();\r
+ ]]></body>\r
+ </method>\r
+ <method name="redrawYear">\r
+ <body><![CDATA[\r
+ var yearTitleItem = document.getAnonymousElementByAttribute( this, "anonid", "oe-date-picker-year-title-text" );\r
+ yearTitleItem.setAttribute( "value", this.gSelectedDate.getFullYear() );\r
+ ]]></body>\r
+ </method>\r
+\r
+ <method name="selectMonthItem">\r
+ <parameter name="newMonthItem"/>\r
+ <body><![CDATA[\r
+ // Select a month box \r
+ // clear old selection, if there is one\r
+ if( this.gSelectedMonthItem != null ){\r
+ this.gSelectedMonthItem.setAttribute( "selected" , false );\r
+ }\r
+\r
+ // Set the selected attribute, used to give it a different style\r
+ newMonthItem.setAttribute( "selected" , true );\r
+\r
+ // Remember new selection\r
+ this.gSelectedMonthItem = newMonthItem;\r
+ ]]></body>\r
+ </method>\r
+ <method name="selectDayItem">\r
+ <parameter name="newDayItem"/>\r
+ <body><![CDATA[\r
+ // Select a day box \r
+ // clear old selection, if there is one\r
+\r
+ if( this.gSelectedDayItem != null ){\r
+ this.gSelectedDayItem.setAttribute( "selected" , false );\r
+ }\r
+\r
+ if( newDayItem != null ){\r
+ // Set the selected attribute, used to give it a different style\r
+ newDayItem.setAttribute( "selected" , true );\r
+ }\r
+ // Remember new selection\r
+ this.gSelectedDayItem = newDayItem;\r
+ ]]></body>\r
+ </method>\r
+ <method name="redrawDays">\r
+ <body><![CDATA[\r
+ // Redraw day numbers based on the selected date\r
+ // Write in all the day numbers\r
+ \r
+ var firstDate = new Date( this.gSelectedDate.getFullYear(), this.gSelectedDate.getMonth(), 1 );\r
+ var firstDayOfWeek = firstDate.getDay();\r
+ \r
+ //get last Day Of Month \r
+ var pastLastDate = new Date( this.gSelectedDate.getFullYear(), this.gSelectedDate.getMonth(), 32 );\r
+ var lastDayOfMonth = 32 - pastLastDate.getDate(); \r
+ \r
+ // clear the selected day item \r
+ this.selectDayItem( null );\r
+ \r
+ // redraw each day bax in the 7 x 6 grid\r
+ \r
+ var dayNumber = 1;\r
+ \r
+ for( var dayIndex = 0; dayIndex < 42; ++dayIndex )\r
+ {\r
+ // get the day text box\r
+ \r
+ var dayNumberItem = document.getAnonymousElementByAttribute( this, "anonid", "oe-date-picker-month-day-text-" + (dayIndex + 1) );\r
+ \r
+ // if it is an unfilled day ( before first or after last ), just set its value to "",\r
+ // and don't increment the day number.\r
+ \r
+ if( dayIndex < firstDayOfWeek || dayNumber > lastDayOfMonth )\r
+ {\r
+ dayNumberItem.setAttribute( "value" , "" ); \r
+ }\r
+ else\r
+ {\r
+ // set the value to the day number\r
+ \r
+ dayNumberItem.setAttribute( "value" , dayNumber );\r
+ \r
+ // draw the day as selected\r
+ if( dayNumber == this.gSelectedDate.getDate() ) \r
+ {\r
+ var dayNumberBoxItem = document.getAnonymousElementByAttribute( this, "anonid", "oe-date-picker-month-day-" + (dayIndex + 1) + "-box" );\r
+ this.selectDayItem( dayNumberBoxItem );\r
+ }\r
+ \r
+ // advance the day number\r
+ \r
+ ++dayNumber; \r
+ }\r
+ }\r
+ ]]></body>\r
+ </method>\r
+\r
+ <method name="openPopup">\r
+ <parameter name="button"/>\r
+ <body><![CDATA[\r
+ var datestr = this._input.value;\r
+ var datePickerPopup = document.getAnonymousElementByAttribute( this, "anonid", "oe-date-picker-popup" );\r
+ var date = this.parseDate( datestr );\r
+ if( !date )\r
+ date = new Date();\r
+\r
+ datePickerPopup.setAttribute( "value", date );\r
+ // XXX: is there a better way to offset the popup then hard coding 25?\r
+ //datePickerPopup.showPopup( button, button.boxObject.screenX,(button.boxObject.screenY + 25), "popup" );\r
+ datePickerPopup.showPopup( button, -1, -1, "popup" );\r
+ ]]></body>\r
+ </method>\r
+ <method name="parseDate">\r
+ <parameter name="datestr"/>\r
+ <body><![CDATA[\r
+ //var datestr = this._input.value; \r
+ try{\r
+ if( datestr != "" ){\r
+ var reg=new RegExp("[ / :]+", "g"); //eads\r
+ var parts = datestr.split(reg); \r
+ if( parts.length >= 5 ){ \r
+ //var d = new Date(month, day, year, hour, minutes, seconds);\r
+ //return new Date(parseInt(parts[1]-1),parseInt(parts[0]),parseInt(parts[2]),parseInt(parts[3]),parseInt(parts[4]),0);\r
+ alert("SPLIT DATE\nmonth : "+parts[1] + "\n day : " + parts[0] +"\n year : "+ parts[2] +"\n hour : "+ parts[3] +"\n min : "+ parts[4]);\r
+ var new_date = new Date();\r
+ new_date.setDate(parseInt(parts[0], 10));\r
+ new_date.setMonth(parseInt(parts[1]-1, 10));\r
+ new_date.setFullYear(parseInt(parts[2], 10));\r
+ new_date.setHours(parseInt(parts[3], 10));\r
+ new_date.setMinutes(parseInt(parts[4], 10));\r
+ new_date.setSeconds(0);\r
+ return new_date; \r
+ }\r
+ }\r
+ }catch(e){}\r
+ return null;\r
+ ]]></body>\r
+ </method>\r
+\r
+ <method name="getDate">\r
+ <body><![CDATA[\r
+ return this.parseDate( this._input.value );\r
+ ]]></body>\r
+ </method>\r
+ <method name="setDate">\r
+ <parameter name="date"/>\r
+ <body><![CDATA[\r
+ if( !date )\r
+ return;\r
+\r
+ try{\r
+ this.gSelectedDate = date;\r
+ this._input.value = date.getDate() + "/" + (date.getMonth()+1) + "/" + date.getFullYear() + " " + date.getHours() + ":" + date.getMinutes();\r
+ }catch( e ){\r
+ // try parsing the date as a string \r
+ this.gSelectedDate = this.parseDate( date );\r
+ if( this.gSelectedDate )\r
+ this._input.value = date;\r
+ else{\r
+ dump( "Date is invalid: " + date + "\n" );\r
+ alert( "Date is invalid: " + date + "\n" );\r
+ return;\r
+ }\r
+ }\r
+ if( this.gPopup ){\r
+ // redraw the year and the days\r
+ this.redrawYear();\r
+ this.redrawDays();\r
+ this.selectDate();\r
+ }\r
+ ]]></body>\r
+ </method>\r
+ <property name="value">\r
+ <getter>\r
+ return this.getDate();\r
+ </getter>\r
+ <setter>\r
+ this.setDate(val);\r
+ </setter>\r
+ </property>\r
+ <!-- EADS BEGIN -->\r
+ <method name="clickHour">\r
+ <parameter name="newHoursItem"/>\r
+ <parameter name="newHourItemNumber"/>\r
+ <body><![CDATA[ \r
+ var hourNumberItem = document.getAnonymousElementByAttribute( this, "anonid", "ximfmail-date-picker-hour-text-" + newHourItemNumber );\r
+ var hourNumber = hourNumberItem.getAttribute( "value" ); \r
+ // they may have clicked an unfilled day, if so ignore it and leave the picker up\r
+ if( hourNumber != "" ){ \r
+ \r
+ this.selectHoursItem(newHoursItem);\r
+ \r
+ //bug on 8 and 9 ParseInt hourNumber\r
+ //alert(hourNumber +" .. " + parseInt(hourNumber)+">>"+this.gSelectedDate.getHours());\r
+ \r
+ //var iHour = 0; parseInt(hourNumber);\r
+ //if(hourNumber=="08"){\r
+ // iHour = 8;\r
+ //}else{\r
+ // if(hourNumber=="09"){\r
+ // iHour = 9;\r
+ // }else{\r
+ // iHour = parseInt(hourNumber);\r
+ // }\r
+ //}\r
+ \r
+ //this.gSelectedDate.setHours(iHour);\r
+ this.gSelectedDate.setHours(parseInt(hourNumber, 10)); \r
+ this.selectDate();\r
+ \r
+ }\r
+ ]]></body>\r
+ </method>\r
+ <method name="selectHoursItem">\r
+ <parameter name="newHoursItem"/>\r
+ <body><![CDATA[\r
+ // Select a month box \r
+ // clear old selection, if there is one\r
+ if( this.gSelectedHoursItem != null ){\r
+ this.gSelectedHoursItem.setAttribute( "selected" , false );\r
+ }\r
+\r
+ // Set the selected attribute, used to give it a different style\r
+ newHoursItem.setAttribute( "selected" , true );\r
+\r
+ // Remember new selection\r
+ this.gSelectedHoursItem = newHoursItem;\r
+ ]]></body>\r
+ </method>\r
+ <method name="clickMin">\r
+ <parameter name="newMinItem"/>\r
+ <parameter name="newMinItemNumber"/>\r
+ <body><![CDATA[ \r
+ var minItem = document.getAnonymousElementByAttribute( this, "anonid", "ximfmail-date-picker-min-text-" + newMinItemNumber );\r
+ var minNumber = minItem.getAttribute( "value" );\r
+ \r
+ // they may have clicked an unfilled day, if so ignore it and leave the picker up\r
+ if( minNumber != "" ){\r
+ //\r
+ this.selectMinutesItem(newMinItem);\r
+ //\r
+ \r
+ this.gSelectedDate.setMinutes(parseInt(newMinItemNumber, 10)); \r
+ this.selectDate(); \r
+ }\r
+ ]]></body>\r
+ </method>\r
+\r
+ <method name="selectMinutesItem">\r
+ <parameter name="newMinutesItem"/>\r
+ <body><![CDATA[\r
+ // Select a month box \r
+ // clear old selection, if there is one\r
+ if( this.gSelectedMinutesItem != null ){\r
+ this.gSelectedMinutesItem.setAttribute( "selected" , false );\r
+ }\r
+\r
+ // Set the selected attribute, used to give it a different style\r
+ newMinutesItem.setAttribute( "selected" , true );\r
+\r
+ // Remember new selection\r
+ this.gSelectedMinutesItem = newMinutesItem;\r
+ ]]></body>\r
+ </method> \r
+ <method name="clickOk">\r
+ <body><![CDATA[\r
+ this.selectDate();\r
+ this.gPopup.hidePopup();\r
+ ]]></body>\r
+ </method>\r
+ \r
+ <method name="clickHourRange"> \r
+ <parameter name="newValueNumber"/>\r
+ <body><![CDATA[\r
+ var rowItem = document.getAnonymousElementByAttribute( this, "anonid", "ximfmail-date-picker-hour-24-header-box" );\r
+ if(newValueNumber == "12"){ \r
+ //rowItem.setAttribute("hidden","true");\r
+ rowItem.style.display="none";\r
+ }else{\r
+ //rowItem.setAttribute("hidden","false");\r
+ rowItem.style.display="";\r
+ }\r
+ ]]></body>\r
+ </method>\r
+ <!-- EADS END -->\r
+ </implementation> \r
+ <handlers> \r
+ <handler event="keypress" phase="capturing" action="return this.onKeyPress(event);"/>\r
+ </handlers>\r
+ </binding>\r
+</bindings>\r
-/* ***** 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 ***** */
-
-
-/*
- window.arguments = [];
- args[0] header label
- args[1] header XIMF
- args[2] list of label values
- args[3] list of XIMF values
- args[4] label separator
- args[5] XIMF separator
-*/
-function OnDisplayInformations(){
- var gArgs = window.arguments;
- var xSeparator = null;
- var NB_CHARACTERS = 45;
-
- if(gArgs[0].length > 0){
- var title = gArgs[0][0];
- var xHdr = gArgs[0][1];
- var val = gArgs[0][2];
- var xval = gArgs[0][3];
- }
-
- if(gArgs[0].length == 5){
- var xSeparator = gArgs[0][4];
- }
-
- //add complete header to description
- document.getElementById("ximfheaderName").value = title.substring(0,title.lastIndexOf(":"));
- if(!xSeparator){
- document.getElementById("ximfheaderValue").value = val;
- }else{
- var reg=new RegExp("["+xSeparator+"]+", "g");
- document.getElementById("ximfheaderValue").value = val.replace(reg,"\n");
- }
-}
-
-function doOK()
-{
- return true;
-}
-
-function doCancel()
-{
- return 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
+/*\r
+ window.arguments = [];\r
+ args[0] header label\r
+ args[1] header XIMF\r
+ args[2] list of label values\r
+ args[3] list of XIMF values \r
+ args[4] label separator\r
+ args[5] XIMF separator\r
+*/\r
+function OnDisplayInformations(){\r
+ var gArgs = window.arguments;\r
+ var xSeparator = null;\r
+ var NB_CHARACTERS = 45; \r
+ \r
+ if(gArgs[0].length > 0){\r
+ var title = gArgs[0][0]; \r
+ var xHdr = gArgs[0][1];\r
+ var val = gArgs[0][2];\r
+ var xval = gArgs[0][3]; \r
+ }\r
+ \r
+ if(gArgs[0].length == 5){\r
+ var xSeparator = gArgs[0][4];\r
+ }\r
+ \r
+ //add complete header to description\r
+ document.getElementById("ximfheaderName").value = title.substring(0,title.lastIndexOf(":"));\r
+ if(!xSeparator){ \r
+ document.getElementById("ximfheaderValue").value = val;\r
+ }else{ \r
+ var reg=new RegExp("["+xSeparator+"]+", "g");\r
+ document.getElementById("ximfheaderValue").value = val.replace(reg,"\n");\r
+ }\r
+}\r
+\r
+function doOK()\r
+{ \r
+ return true;\r
+}\r
+\r
+function doCancel()\r
+{\r
+ return true;\r
+}\r
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- ***** 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 ***** -->
-
-<!DOCTYPE overlay SYSTEM "chrome://ximfmail/locale/ximfmail.dtd">
-<?xml-stylesheet href="chrome://ximfmail/skin" type="text/css"?>
-<dialog id="ximfmail-dialog-hdrInfo" title="&dlgheader.hdrInfo.descr;"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- buttons="accept"
- buttonlabelaccept="OK"
- ondialogaccept="return doOK();"
- onload="OnDisplayInformations();">
- <script type="application/javascript" src="chrome://ximfmail/content/dialogHdrInfo-ximfmail.js" />
- <vbox flex="1">
- <label id="ximfheaderName"/>
- <vbox id="box-ilkheaderValue" flex="1">
- <spacer flex="1"/>
- <textbox id="ximfheaderValue" rows="5" readonly="true" multiline="true" flex="1"/>
- </vbox>
- </vbox>
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!-- ***** 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
+<!DOCTYPE overlay SYSTEM "chrome://ximfmail/locale/ximfmail.dtd">\r
+<?xml-stylesheet href="chrome://ximfmail/skin" type="text/css"?>\r
+<dialog id="ximfmail-dialog-hdrInfo" title="&dlgheader.hdrInfo.descr;" \r
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" \r
+ buttons="accept" \r
+ buttonlabelaccept="OK"\r
+ ondialogaccept="return doOK();"\r
+ onload="OnDisplayInformations();"> \r
+ <script type="application/javascript" src="chrome://ximfmail/content/dialogHdrInfo-ximfmail.js" /> \r
+ <vbox flex="1"> \r
+ <label id="ximfheaderName"/> \r
+ <vbox id="box-ilkheaderValue" flex="1"> \r
+ <spacer flex="1"/> \r
+ <textbox id="ximfheaderValue" rows="5" readonly="true" multiline="true" flex="1"/> \r
+ </vbox> \r
+ </vbox>\r
</dialog>
\ No newline at end of file
--- /dev/null
+var XIMF_DIALOG_TREE_RDF_ROOT_URI = "http://www.ximfmail.com/dialogtree/datas";\r
+var XIMF_DIALOG_TREE_PREDICATE_COLUMN_0 = "http://www.ximfmail.com/RDF#column0";\r
+var XIMF_DIALOG_TREE_PREDICATE_COLUMN_1 = "http://www.ximfmail.com/RDF#column1";\r
+\r
+function Indexage(){\r
+ this.A = -1;\r
+ this.B = -1;\r
+ this.C = -1;\r
+ this.D = -1;\r
+ this.E = -1;\r
+ this.F = -1;\r
+ this.G = -1;\r
+ this.H = -1;\r
+ this.I = -1;\r
+ this.J = -1;\r
+ this.K = -1;\r
+ this.L = -1;\r
+ this.M = -1;\r
+ this.N = -1;\r
+ this.O = -1;\r
+ this.P = -1;\r
+ this.Q = -1;\r
+ this.R = -1;\r
+ this.S = -1;\r
+ this.T = -1;\r
+ this.U = -1;\r
+ this.V = -1;\r
+ this.W = -1;\r
+ this.X = -1;\r
+ this.Y = -1;\r
+ this.Z = -1;\r
+};\r
+/*\r
+ * \r
+ */\r
+function DialogTreeRDFSourceClass()\r
+{\r
+ // private:\r
+ var _rdfService = null;\r
+ var _rdfCUtils = null;\r
+ var _treeProjectsDatasource = null; \r
+ var _treeProjectsRefURI = null;\r
+ var _SeqRDFC_data = null;\r
+ \r
+ // public:\r
+ if(typeof DialogTreeRDFSourceClass.initialized == "undefined")\r
+ {\r
+ //init\r
+ DialogTreeRDFSourceClass.prototype.initialize = function(dataSource, strURI)\r
+ {\r
+ try{\r
+ gConsole.logStringMessage("[ximfmail - DialogTreeRDFClass ] \n ");\r
+ // ref : attribut of tree. use to save all data in the same dataSource \r
+ _treeProjectsRefURI = strURI;\r
+ \r
+ // init RDF service\r
+ _rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);\r
+ \r
+ // init data source\r
+ if(null == _treeProjectsDatasource)\r
+ {\r
+ _treeProjectsDatasource = dataSource; \r
+ }\r
+ \r
+ // init RDF Container Utils\r
+ _rdfCUtils = Components.classes["@mozilla.org/rdf/container-utils;1"].createInstance(Components.interfaces.nsIRDFContainerUtils);\r
+\r
+ // Init seq Container data source\r
+ var seqNode = _rdfService.GetResource(_treeProjectsRefURI);\r
+ _SeqRDFC_data = _rdfCUtils.MakeSeq(_treeProjectsDatasource, seqNode);\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - DialogTreeRDFClass ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber); \r
+ }\r
+ }\r
+ \r
+ //\r
+ DialogTreeRDFSourceClass.prototype.getEntriesCount = function()\r
+ {\r
+ if(_SeqRDFC_data){\r
+ return _SeqRDFC_data.GetCount();\r
+ }else{\r
+ return 0;\r
+ }\r
+ }\r
+ //\r
+ DialogTreeRDFSourceClass.prototype.getDataSource=function()\r
+ {\r
+ return _treeProjectsDatasource;\r
+ };\r
+ \r
+ DialogTreeRDFSourceClass.prototype.getDataEntry = function(uri,predicate){\r
+ try\r
+ { \r
+ var data = ""; \r
+ var resource = _rdfService.GetResource(uri); \r
+ var targets = _treeProjectsDatasource.ArcLabelsOut(resource);\r
+ while (targets.hasMoreElements())\r
+ { \r
+ var newpredicate = targets.getNext();\r
+ if (newpredicate instanceof Components.interfaces.nsIRDFResource)\r
+ { \r
+ var target = _treeProjectsDatasource.GetTarget(resource, newpredicate, true);\r
+ if (target instanceof Components.interfaces.nsIRDFLiteral)\r
+ {\r
+ if(newpredicate.Value == predicate)\r
+ data = target.Value;\r
+ }\r
+ }\r
+ }\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - DialogTreeRDFSourceClass ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber); \r
+ }\r
+ return data;\r
+ };\r
+ \r
+ \r
+ DialogTreeRDFSourceClass.prototype.getEntryByPos = function(beggin, nbr)\r
+ {\r
+ var arrayResult = [];\r
+ try\r
+ {\r
+ var seq = _SeqRDFC_data.GetElements();\r
+ var currentData = 0;\r
+ while (seq.hasMoreElements())\r
+ {\r
+ var element = seq.getNext();\r
+ if (element instanceof Components.interfaces.nsIRDFResource)\r
+ {\r
+ if(currentData >= beggin && currentData <= beggin+nbr)\r
+ {\r
+ var col0 = this.getDataEntry(element.ValueUTF8,XIMF_DIALOG_TREE_PREDICATE_COLUMN_0);\r
+ var col1 = this.getDataEntry(element.ValueUTF8,XIMF_DIALOG_TREE_PREDICATE_COLUMN_1);\r
+ \r
+ arrayResult.push([col0,col1]);\r
+ }\r
+ }\r
+ currentData++;\r
+ }\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - getSeachText ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber); \r
+ }\r
+ return arrayResult;\r
+ \r
+ };\r
+ \r
+ //\r
+ DialogTreeRDFSourceClass.prototype.getEntryByText = function(textToFind, nbr, curpos)\r
+ {\r
+ var arrayResult = [];\r
+ var beggin = _SeqRDFC_data.GetCount();\r
+ try\r
+ {\r
+ var seq = _SeqRDFC_data.GetElements();\r
+ var currentData = 0;\r
+ while (seq.hasMoreElements())\r
+ {\r
+ var element = seq.getNext();\r
+ if (element instanceof Components.interfaces.nsIRDFResource)\r
+ {\r
+ if(curpos <= currentData)\r
+ {\r
+ var col0 = this.getDataEntry(element.ValueUTF8,XIMF_DIALOG_TREE_PREDICATE_COLUMN_0);\r
+ if(beggin == _SeqRDFC_data.GetCount())\r
+ if(col0.toUpperCase().indexOf(textToFind.toUpperCase()) != -1)\r
+ beggin = currentData;\r
+ \r
+ if(currentData >= beggin && currentData <= beggin+nbr)\r
+ {\r
+ var col1 = this.getDataEntry(element.ValueUTF8,XIMF_DIALOG_TREE_PREDICATE_COLUMN_1);\r
+ arrayResult.push([col0,col1]);\r
+ }\r
+ }\r
+ }\r
+ currentData++;\r
+ }\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - getSeachText ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber); \r
+ }\r
+ return [arrayResult,beggin];\r
+ };\r
+ \r
+ DialogTreeRDFSourceClass.prototype.getIndex = function()\r
+ {\r
+ var arrayResult = [];\r
+ var beggin = -1;\r
+ var indexAZ = new Indexage();\r
+ try\r
+ {\r
+ var seq = _SeqRDFC_data.GetElements();\r
+ var currentData = 0;\r
+ while (seq.hasMoreElements())\r
+ {\r
+ var element = seq.getNext();\r
+ if (element instanceof Components.interfaces.nsIRDFResource)\r
+ {\r
+ var col0 = this.getDataEntry(element.ValueUTF8,XIMF_DIALOG_TREE_PREDICATE_COLUMN_0);\r
+ if(indexAZ[col0[0].toUpperCase()] == -1)\r
+ {\r
+ indexAZ[col0[0].toUpperCase()] = currentData;\r
+ }\r
+ }\r
+ currentData++;\r
+ }\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - getIndex ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber); \r
+ }\r
+ return indexAZ;\r
+ };\r
+ // object initialisation\r
+ DialogTreeRDFSourceClass.initialized = true;\r
+ } \r
+}\r
+\r
+/*\r
+ * \r
+ */\r
+function DialogTreeRDFClass()\r
+{\r
+ // private:\r
+ var _rdfService = null;\r
+ var _rdfCUtils = null;\r
+ var _treeProjectsDatasource = null; \r
+ var _treeProjectsRefURI = null;\r
+ var _SeqRDFC_data = null;\r
+ var _RdfDataSourceOrigin = null;\r
+ var _indexAZ = null;\r
+ \r
+ // public:\r
+ if(typeof DialogTreeRDFClass.initialized == "undefined")\r
+ {\r
+ //init\r
+ DialogTreeRDFClass.prototype.initialize = function(dataSource, strURI)\r
+ {\r
+ try{\r
+ // ref : attribut of tree. use to save all data in the same dataSource \r
+ _treeProjectsRefURI = XIMF_DIALOG_TREE_RDF_ROOT_URI;\r
+ \r
+ // init RDF service\r
+ _rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);\r
+ \r
+ // init data source\r
+ if(null == _treeProjectsDatasource)\r
+ {\r
+ _treeProjectsDatasource = _rdfService.GetDataSource("rdf:in-memory-datasource");\r
+ _treeProjectsDatasource.QueryInterface(Components.interfaces.nsIRDFInMemoryDataSource); \r
+ }\r
+ \r
+ // init RDF Container Utils\r
+ _rdfCUtils = Components.classes["@mozilla.org/rdf/container-utils;1"].createInstance(Components.interfaces.nsIRDFContainerUtils);\r
+\r
+ // Init seq Container data source\r
+ var seqNode = _rdfService.GetResource(_treeProjectsRefURI);\r
+ _SeqRDFC_data = _rdfCUtils.MakeSeq(_treeProjectsDatasource, seqNode);\r
+ \r
+ _RdfDataSourceOrigin = new DialogTreeRDFSourceClass();\r
+ _RdfDataSourceOrigin.initialize(dataSource, strURI);\r
+ \r
+ _indexAZ = _RdfDataSourceOrigin.getIndex();\r
+ \r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - DialogTreeRDFClass ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber); \r
+ }\r
+ }\r
+ \r
+ //\r
+ DialogTreeRDFClass.prototype.getEntriesCount = function()\r
+ {\r
+ if(_SeqRDFC_data){\r
+ return _SeqRDFC_data.GetCount();\r
+ }else{\r
+ return 0;\r
+ }\r
+ }\r
+ //\r
+ DialogTreeRDFClass.prototype.getDataSource=function()\r
+ {\r
+ return _treeProjectsDatasource;\r
+ };\r
+ \r
+ DialogTreeRDFClass.prototype.addEntryDisplay = function(entry, index)\r
+ {\r
+ // append resource element to sequence\r
+ //[DN,name,type]\r
+ var col0 = entry[0];\r
+ var col1 = entry[1];\r
+ \r
+ var newURI = _treeProjectsRefURI + "/data" + index ;\r
+ var newResource = _rdfService.GetResource(newURI); \r
+ _SeqRDFC_data.AppendElement(newResource);\r
+ \r
+ // save user informations \r
+ if(col0)\r
+ {\r
+ _treeProjectsDatasource.Assert(newResource, \r
+ _rdfService.GetResource(XIMF_DIALOG_TREE_PREDICATE_COLUMN_0), \r
+ _rdfService.GetLiteral(col0), \r
+ true);\r
+ }\r
+ \r
+ if(col1)\r
+ {\r
+ _treeProjectsDatasource.Assert(newResource, \r
+ _rdfService.GetResource(XIMF_DIALOG_TREE_PREDICATE_COLUMN_1), \r
+ _rdfService.GetLiteral(col1), \r
+ true);\r
+ }\r
+ };\r
+ \r
+ \r
+ DialogTreeRDFClass.prototype.getDataEntry = function(uri,predicate)\r
+ {\r
+ try{ \r
+ _RdfDataSourceOrigin.getDataEntry(uri,predicate);\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - DialogTreeRDFClass ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber); \r
+ }\r
+ return data;\r
+ };\r
+ \r
+ DialogTreeRDFClass.prototype.removeAllDisplay = function()\r
+ {\r
+ try\r
+ {\r
+ if(_SeqRDFC_data)\r
+ {\r
+ var numEntri = _SeqRDFC_data.GetCount();\r
+ for (var indexCur = numEntri; indexCur >0; indexCur--)\r
+ {\r
+ _SeqRDFC_data.RemoveElementAt(indexCur,true);\r
+ }\r
+ }\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - DialogTreeRDFClass ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber); \r
+ }\r
+ };\r
+ \r
+ //\r
+ DialogTreeRDFClass.prototype.updateDisplay = function(curpos,maxPos)\r
+ {\r
+ //\r
+ var colFoundArray = [];\r
+ var maxEntry = _RdfDataSourceOrigin.getEntriesCount();\r
+ \r
+ if(curpos+maxPos > maxEntry)\r
+ curpos = maxEntry-maxPos;\r
+ \r
+ colFoundArray = _RdfDataSourceOrigin.getEntryByPos(curpos, maxPos);\r
+\r
+ this.removeAllDisplay();\r
+ \r
+ for(var currItem=0;currItem<colFoundArray.length;currItem++)\r
+ {\r
+ this.addEntryDisplay(colFoundArray[currItem], currItem);\r
+ }\r
+ $("#ximfmail.treedialog").attr("hidevscroll","true");\r
+ };\r
+ \r
+ //\r
+ DialogTreeRDFClass.prototype.updateDisplayByText = function(textToFind,maxPos,curpos)\r
+ {\r
+ //\r
+ var colFoundArray = [];\r
+ var index = _indexAZ[textToFind[0].toUpperCase()];\r
+ \r
+ if(index == -1)\r
+ return -1;\r
+ \r
+ if(textToFind.length == 1)\r
+ {\r
+ if(index==curpos) \r
+ return -1;\r
+ \r
+ this.updateDisplay(index,maxPos);\r
+ return index;\r
+ }\r
+ \r
+ var maxEntry = _RdfDataSourceOrigin.getEntriesCount();\r
+ if(index+maxPos > maxEntry)\r
+ index = maxEntry-maxPos-1;\r
+ \r
+ var result = _RdfDataSourceOrigin.getEntryByText(textToFind, maxPos, index);\r
+ colFoundArray = result[0];\r
+ \r
+ if(colFoundArray.length == 0)\r
+ return -1;\r
+\r
+ this.removeAllDisplay();\r
+ \r
+ for(var currItem=0;currItem<colFoundArray.length;currItem++)\r
+ {\r
+ this.addEntryDisplay(colFoundArray[currItem], currItem);\r
+ }\r
+ $("#ximfmail.treedialog").attr("hidevscroll","true");\r
+ \r
+ return result[1];\r
+ };\r
+ \r
+ //\r
+ DialogTreeRDFClass.prototype.getMaxEntry = function()\r
+ {\r
+ //\r
+ var remoteCount = 0;\r
+\r
+ remoteCount = _RdfDataSourceOrigin.getEntriesCount();\r
+\r
+ return remoteCount;\r
+ };\r
+ \r
+ // object initialisation\r
+ DialogTreeRDFClass.initialized = true;\r
+ } \r
+}
\ No newline at end of file
-/* ***** 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 ***** */
-
-var gJSLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].createInstance(Components.interfaces.mozIJSSubScriptLoader);
-var gConsole = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
-
-
-var gDlgTreeXimf_maxItem_alert = "";
-var gDlgTreeXimf_current_selection = null;
-var gDlgTreeXimf_current_separator = null;
-var gTitleDlg = "";
-
-function XimfDataSource(){
- this._id; // xml file name path
- this._dataSource;
- this._refDataSource;
-}
-
-
-
-
-
-var gArgsOpener = null;
-
-$(document).ready(function(){
- var gArgs = window.arguments;
- if(gArgs[0].length <= 0) return;
-
- // load event manager
- $("#ximfmail_dTreeAdd").bind("command",OnPushAddSelection);
- $("#iTreechildDialog").dblclick(OnPushAddSelection);
- $("#ximfmail_dTreeDel").bind("command",OnPushDelSelection);
- $("#ximfmail_dTreeRaz").bind("command",OnPushRazSelection);
-
- // load background datas
- try{
- gArgsOpener = gArgs[0]; // gArgs[0] is an XimfmailTreedialogArgs object - XimfmailTreedialogArgs class description at ximfmail.js file
- }catch(e){
- gConsole.logStringMessage("[ximfmail - ready ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- return;
- }
-
- // create alert message
- if(parseInt(gArgsOpener.maxItemsSelected) > 1){
- gDlgTreeXimf_maxItem_alert = gArgsOpener.maxItemsSelected + " "+ getIlkProperties("ximfmail.dialog.editor.warning.nbrows");
- }else{
- if(parseInt(gArgsOpener.maxItemsSelected) == 1){
- gDlgTreeXimf_maxItem_alert = gArgsOpener.maxItemsSelected + " "+ getIlkProperties("ximfmail.dialog.editor.warning.nbrows.one");
- }
- }
-
- try{
- //set main title
- var sTitle = gArgsOpener.title;
- if(sTitle.indexOf(":") != -1){
- sTitle = sTitle.substring(0,sTitle.lastIndexOf(":"));
- }
- $("#treeDialogHeader").attr("title",sTitle);
- $("#treeDialogHeader").attr("description",gDlgTreeXimf_maxItem_alert);
-
- //set title columns
- $("#iCol0").attr("label",gArgsOpener.titleColKey);
- $("#iCol1").attr("label",gArgsOpener.titleColLabel);
-
- }catch(e){
- gConsole.logStringMessage("[ximfmail - AddCurrentSelection ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+ e.lineNumber);
- }
-
- setTimeout("LoadXmlDatas()", 50);
-});
-
-/*
- * attach RDF Source to local tree
- */
-function LoadXmlDatas(){
- try{
- //
- var tree = document.getElementById("iTreechildDialog");
- tree.database.AddDataSource(gArgsOpener.dataSource);
- tree.setAttribute("ref",gArgsOpener.refdataSource);
- tree.builder.rebuild();
- //
- AddCurrentSelection();
- }catch(e){
- gConsole.logStringMessage("[ximfmail - LoadXmlDatas ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- }
-}
-
-function AddCurrentSelection(){
- // load current selected values
- if(gArgsOpener.currentKeys.length > 0){
- /*var reg = null;
- if(gDlgTreeXimf_current_separator){
- reg=new RegExp("["+gDlgTreeXimf_current_separator+"]+", "g");
- }else{
- reg=new RegExp("[;,]+", "g");
- }
- var arrayItems = gDlgTreeXimf_current_selection.split(reg);
- */
- var list = document.getElementById("ximfmail_selection");
- for (var i=0; i<gArgsOpener.currentKeys.length; i++) {
- if(gArgsOpener.currentLabels[i]!=""){
- var item = list.appendItem(gArgsOpener.currentKeys[i]);
- if(gArgsOpener.currentKeys[i]!=""){
- item.setAttribute("tooltiptext",gArgsOpener.currentLabels[i]);
- }
- }
- }
- }
-}
-
-function OnPushAddSelection(){
- try{
- var tree = document.getElementById("ximfmail.treedialog");
- var list = document.getElementById("ximfmail_selection");
- var start = new Object();
- var end = new Object();
- var numRanges = tree.view.selection.getRangeCount();
-
-
- for (var t=0; t<numRanges; t++){
- tree.view.selection.getRangeAt(t,start,end);
- for (var v=start.value; v<=end.value; v++){
- if(gArgsOpener.maxItemsSelected){
- var nbItems = $("#ximfmail_selection listitem");
- if(nbItems.length >= gArgsOpener.maxItemsSelected){
- ximfAlert(gDlgTreeXimf_maxItem_alert);
- return;
- }
- }
- var item = list.appendItem(tree.view.getCellText(v, tree.columns.getColumnAt(0))); //list.appendItem(label,value)
- item.tooltipText=tree.view.getCellText(v, tree.columns.getColumnAt(1));
- }
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - OnPushAddSelection ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- }
-}
-
-function OnPushDelSelection(){
- var list = document.getElementById("ximfmail_selection");
- list.removeItemAt( list.selectedIndex );
-}
-
-function OnPushRazSelection(){
- var list = document.getElementById("ximfmail_selection");
- var count = $("#ximfmail_selection listitem");
- for(var i=count.length; i>0; --i){
- list.removeItemAt(i-1);
- }
-}
-
-
-
-function doOK(){
- // get current selection
- var list = $("#ximfmail_selection listitem");
- for(var idx_list = 0; idx_list < list.length;++idx_list){
- var currentItem = list[idx_list].getAttribute("label");
- var currentTooltip = list[idx_list].getAttribute("tooltiptext");
- if(currentItem != ""){
- gArgsOpener.retKeys.push(currentItem);
- gArgsOpener.retLabels.push(currentTooltip);
- }
- }
- return true;
-}
-
-/*
- *
- */
-function doCancel()
-{
- gArgsOpener.retIsCancel=true;
-}
-
-function getTreeSelection(){
- var list="";
- var tree = document.getElementById("ximfmail.treedialog");
- var start = new Object();
- var end = new Object();
- var numRanges = tree.view.selection.getRangeCount();
-
- for (var t=0; t<numRanges; t++){
- tree.view.selection.getRangeAt(t,start,end);
- for (var v=start.value; v<=end.value; v++){
- if(list!="")
- list+=",";
- list += tree.view.getCellText(v, tree.columns.getColumnAt(0));
- }
- }
- return list;
-}
-
-
-
-
-///BEGIN TEST
-function OnSelectTreeData(evt){
- //alert("OnSelectTreeData");
- var elt = evt.currentTarget;
- //var tree = document.getElementById("ximfmail.tree");
- if(elt.view){
- //alert("index = " + elt.view.selection.currentIndex);
-
- // on select
- var cellIndex = 0;
- var cellText = elt.view.getCellText(elt.currentIndex, elt.columns.getColumnAt(cellIndex));
- //alert("cellText: "+cellText);
- }
-
- var row = new Object();
- var col = new Object();
- var child = new Object();
-
- //elt.firstChild.treeBoxObject.getCellAt(event.clientX, event.clientY, row, col, child);
- elt.treeBoxObject.getCellAt(evt.clientX, evt.clientY, row, col, child);
- var idMatch;
- try {
- idMatch = col.value.element.getAttribute('id');
- } catch (error) {
- idMatch = col.value;
- }
- //alert(row.value + " : " + idMatch);
- //return {row: row.value, col: idMatch};
-}
-
-function OnClickTreeData(evt){
- //alert("OnSelectTreeData");
- var elt = evt.currentTarget;
- var row = new Object();
- var col = new Object();
- var child = new Object();
- //elt.firstChild.treeBoxObject.getCellAt(event.clientX, event.clientY, row, col, child);
- elt.treeBoxObject.getCellAt(evt.clientX, evt.clientY, row, col, child);
- var idMatch;
- try {
- idMatch = col.value.element.getAttribute('id');
- } catch (error) {
- idMatch = col.value;
- }
- //alert(row.value + " : " + idMatch);
- //return {row: row.value, col: idMatch};
-}
+/* ***** 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
+var gJSLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].createInstance(Components.interfaces.mozIJSSubScriptLoader);\r
+var gConsole = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);\r
+ \r
+\r
+var gDlgTreeXimf_maxItem_alert = "";\r
+var gDlgTreeXimf_current_selection = null;\r
+var gDlgTreeXimf_current_separator = null;\r
+var gTitleDlg = "";\r
+\r
+function XimfDataSource(){\r
+ this._id; // xml file name path\r
+ this._dataSource;\r
+ this._refDataSource; \r
+}\r
+\r
+// RDF list\r
+var gMaxDataList = 15;\r
+var gCurposList = -1;\r
+var gIDTimeoutList = null;\r
+var gIDTimeoutListSearch = null;\r
+var gSearchText = "";\r
+var gRDFList = null;\r
+\r
+\r
+var gArgsOpener = null;\r
+\r
+$(document).ready(function(){\r
+ var gArgs = window.arguments;\r
+ if(gArgs[0].length <= 0) return;\r
+\r
+ // load event manager\r
+ $("#ximfmail_dTreeAdd").bind("command",OnPushAddSelection);\r
+ $("#iTreechildDialog").dblclick(OnPushAddSelection);\r
+ $("#ximfmail_dTreeDel").bind("command",OnPushDelSelection);\r
+ $("#ximfmail_dTreeRaz").bind("command",OnPushRazSelection);\r
+ \r
+ // event for scroll \r
+ $("#ximfmailTreeDialogScroll").mousemove(OnClickScrollTreeList);\r
+ $("#ximfmailTreeDialogScroll").click(OnClickScrollTreeList);\r
+ $("#iTreechildDialog").mousemove(OnClickScrollTreeList);\r
+ $(window).resize(OnClickScrollTreeList);\r
+ \r
+ document.getElementById("iTreechildDialog").addEventListener('DOMMouseScroll', OnScrollTreeList, false);\r
+ $("#ximfmail.treedialog").keypress(OnKeyPressScrollTreeList);\r
+ $("#ximfmailTreeDialogDisplaybox").keypress(OnKeyPressScrollTreeList);\r
+ \r
+ // load background datas\r
+ try{\r
+ gArgsOpener = gArgs[0]; // gArgs[0] is an XimfmailTreedialogArgs object - XimfmailTreedialogArgs class description at ximfmail.js file\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - ready ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);\r
+ return;\r
+ }\r
+ \r
+ // create alert message \r
+ if(parseInt(gArgsOpener.maxItemsSelected, 10) > 1){\r
+ gDlgTreeXimf_maxItem_alert = gArgsOpener.maxItemsSelected + " "+ getIlkProperties("ximfmail.dialog.editor.warning.nbrows");\r
+ }else{\r
+ if(parseInt(gArgsOpener.maxItemsSelected, 10) == 1){\r
+ gDlgTreeXimf_maxItem_alert = gArgsOpener.maxItemsSelected + " "+ getIlkProperties("ximfmail.dialog.editor.warning.nbrows.one");\r
+ }\r
+ }\r
+ \r
+ try{\r
+ //set main title \r
+ var sTitle = gArgsOpener.title; \r
+ if(sTitle.indexOf(":") != -1){\r
+ sTitle = sTitle.substring(0,sTitle.lastIndexOf(":"));\r
+ } \r
+ $("#treeDialogHeader").attr("title",sTitle);\r
+ $("#treeDialogHeader").attr("description",gDlgTreeXimf_maxItem_alert);\r
+ \r
+ //set title columns\r
+ $("#iCol0").attr("label",gArgsOpener.titleColKey);\r
+ $("#iCol1").attr("label",gArgsOpener.titleColLabel);\r
+ \r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - AddCurrentSelection ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+ e.lineNumber);\r
+ }\r
+ \r
+ LoadXmlDatas(); \r
+});\r
+\r
+/*\r
+ * attach RDF Source to local tree\r
+ */\r
+function LoadXmlDatas(){\r
+ try{ \r
+ //\r
+ var tree = document.getElementById("iTreechildDialog");\r
+ \r
+ gRDFList = new DialogTreeRDFClass();\r
+ gRDFList.initialize(gArgsOpener.dataSource, gArgsOpener.refdataSource);\r
+ \r
+ tree.database.AddDataSource(gRDFList.getDataSource()); \r
+ //tree.setAttribute("ref",gArgsOpener.refdataSource); \r
+ tree.builder.rebuild();\r
+ \r
+ OnClickScrollTreeList(0);\r
+ \r
+ //\r
+ AddCurrentSelection();\r
+ }catch(e){ \r
+ gConsole.logStringMessage("[ximfmail - LoadXmlDatas ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);\r
+ } \r
+}\r
+\r
+function AddCurrentSelection(){\r
+ // load current selected values\r
+ if(gArgsOpener.currentKeys.length > 0){\r
+ /*var reg = null; \r
+ if(gDlgTreeXimf_current_separator){\r
+ reg=new RegExp("["+gDlgTreeXimf_current_separator+"]+", "g"); \r
+ }else{\r
+ reg=new RegExp("[;,]+", "g");\r
+ }\r
+ var arrayItems = gDlgTreeXimf_current_selection.split(reg); \r
+ */\r
+ var list = document.getElementById("ximfmail_selection");\r
+ for (var i=0; i<gArgsOpener.currentKeys.length; i++) {\r
+ if(gArgsOpener.currentLabels[i]!=""){\r
+ var item = list.appendItem(gArgsOpener.currentKeys[i]);\r
+ if(gArgsOpener.currentKeys[i]!=""){\r
+ item.setAttribute("tooltiptext",gArgsOpener.currentLabels[i]);\r
+ }\r
+ } \r
+ }\r
+ } \r
+}\r
+\r
+function OnPushAddSelection(){\r
+ try{ \r
+ var tree = document.getElementById("ximfmail.treedialog");\r
+ var list = document.getElementById("ximfmail_selection");\r
+ var start = new Object();\r
+ var end = new Object();\r
+ var numRanges = tree.view.selection.getRangeCount();\r
+ \r
+ \r
+ for (var t=0; t<numRanges; t++){\r
+ tree.view.selection.getRangeAt(t,start,end);\r
+ for (var v=start.value; v<=end.value; v++){ \r
+ if(gArgsOpener.maxItemsSelected){ \r
+ var nbItems = $("#ximfmail_selection listitem"); \r
+ if(nbItems.length >= gArgsOpener.maxItemsSelected){\r
+ ximfAlert(gDlgTreeXimf_maxItem_alert); \r
+ return;\r
+ }\r
+ } \r
+ var item = list.appendItem(tree.view.getCellText(v, tree.columns.getColumnAt(0))); //list.appendItem(label,value)\r
+ item.tooltipText=tree.view.getCellText(v, tree.columns.getColumnAt(1));\r
+ }\r
+ }\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - OnPushAddSelection ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);\r
+ }\r
+}\r
+\r
+function OnPushDelSelection(){\r
+ var list = document.getElementById("ximfmail_selection");\r
+ list.removeItemAt( list.selectedIndex );\r
+}\r
+\r
+function OnPushRazSelection(){\r
+ var list = document.getElementById("ximfmail_selection");\r
+ var count = $("#ximfmail_selection listitem"); \r
+ for(var i=count.length; i>0; --i){\r
+ list.removeItemAt(i-1);\r
+ }\r
+}\r
+\r
+\r
+\r
+function doOK(){\r
+ // get current selection \r
+ var list = $("#ximfmail_selection listitem"); \r
+ for(var idx_list = 0; idx_list < list.length;++idx_list){\r
+ var currentItem = list[idx_list].getAttribute("label");\r
+ var currentTooltip = list[idx_list].getAttribute("tooltiptext");\r
+ if(currentItem != ""){\r
+ gArgsOpener.retKeys.push(currentItem); \r
+ gArgsOpener.retLabels.push(currentTooltip);\r
+ }\r
+ } \r
+ return true;\r
+}\r
+\r
+/*\r
+ * \r
+ */\r
+function doCancel()\r
+{\r
+ gArgsOpener.retIsCancel=true; \r
+}\r
+\r
+function getTreeSelection(){\r
+ var list="";\r
+ var tree = document.getElementById("ximfmail.treedialog");\r
+ var start = new Object();\r
+ var end = new Object();\r
+ var numRanges = tree.view.selection.getRangeCount();\r
+\r
+ for (var t=0; t<numRanges; t++){\r
+ tree.view.selection.getRangeAt(t,start,end);\r
+ for (var v=start.value; v<=end.value; v++){\r
+ if(list!="")\r
+ list+=",";\r
+ list += tree.view.getCellText(v, tree.columns.getColumnAt(0));\r
+ }\r
+ }\r
+ return list;\r
+}\r
+\r
+\r
+\r
+\r
+///BEGIN TEST\r
+function OnSelectTreeData(evt){\r
+ //alert("OnSelectTreeData");\r
+ var elt = evt.currentTarget;\r
+ //var tree = document.getElementById("ximfmail.tree");\r
+ if(elt.view){\r
+ //alert("index = " + elt.view.selection.currentIndex);\r
+ \r
+ // on select\r
+ var cellIndex = 0;\r
+ var cellText = elt.view.getCellText(elt.currentIndex, elt.columns.getColumnAt(cellIndex));\r
+ //alert("cellText: "+cellText);\r
+ } \r
+ \r
+ var row = new Object();\r
+ var col = new Object();\r
+ var child = new Object();\r
+ \r
+ //elt.firstChild.treeBoxObject.getCellAt(event.clientX, event.clientY, row, col, child);\r
+ elt.treeBoxObject.getCellAt(evt.clientX, evt.clientY, row, col, child);\r
+ var idMatch;\r
+ try {\r
+ idMatch = col.value.element.getAttribute('id');\r
+ } catch (error) {\r
+ idMatch = col.value;\r
+ }\r
+ //alert(row.value + " : " + idMatch);\r
+ //return {row: row.value, col: idMatch}; \r
+}\r
+\r
+function OnClickTreeData(evt){\r
+ //alert("OnSelectTreeData");\r
+ var elt = evt.currentTarget; \r
+ var row = new Object();\r
+ var col = new Object();\r
+ var child = new Object();\r
+ //elt.firstChild.treeBoxObject.getCellAt(event.clientX, event.clientY, row, col, child);\r
+ elt.treeBoxObject.getCellAt(evt.clientX, evt.clientY, row, col, child);\r
+ var idMatch;\r
+ try {\r
+ idMatch = col.value.element.getAttribute('id');\r
+ } catch (error) {\r
+ idMatch = col.value;\r
+ }\r
+ //alert(row.value + " : " + idMatch);\r
+ //return {row: row.value, col: idMatch}; \r
+}\r
+\r
+\r
+/* for to scroll */\r
+function OnClickScrollTreeList(evt)\r
+{\r
+ try\r
+ {\r
+ if(parseInt($("#ximfmailTreeDialogScroll").attr("maxpos"), 10) <=0)\r
+ return;\r
+ var treeResult = document.getElementById("ximfmail.treedialog");\r
+ $("#iTreechildDialog").attr("hidevscroll","true");\r
+ var curpos = 0;\r
+ \r
+ curpos = parseInt($("#ximfmailTreeDialogScroll").attr("curpos"), 10);\r
+ var pageLength = gMaxDataList;\r
+ try{\r
+ pageLength = treeResult.boxObject.getPageLength();\r
+ if(0 == pageLength)\r
+ pageLength = gMaxDataList;\r
+ }catch(e){pageLength = gMaxDataList;}\r
+ \r
+ /*gConsole.logStringMessage("gCurposList=" + gCurposList + " curpos=" + curpos+ " gMaxDataList=" + gMaxDataList\r
+ + " pageLength=" + pageLength+ " gRDFList.getEntriesCount()=" + gRDFList.getEntriesCount());*/\r
+ \r
+ if(gCurposList != curpos || gMaxDataList != pageLength \r
+ || gMaxDataList != gRDFList.getEntriesCount()\r
+ || evt == 0)\r
+ {\r
+ window.setCursor("wait");\r
+ gMaxDataList = pageLength;\r
+ var maxEntry = parseInt(gRDFList.getMaxEntry(), 10);\r
+ \r
+ gRDFList.updateDisplay(curpos,gMaxDataList-1);\r
+ var maxpos = gMaxDataList;\r
+ \r
+ if(maxEntry - gMaxDataList >= 0)\r
+ maxpos = maxEntry - gMaxDataList;\r
+ else\r
+ maxpos = -1;\r
+ \r
+ if(maxEntry < gMaxDataList)\r
+ gMaxDataList = maxEntry;\r
+ $("#ximfmailTreeDialogScroll").attr("maxpos",maxpos);\r
+ \r
+ gCurposList = curpos;\r
+ \r
+ if(maxEntry == 0 || maxpos <= 0) \r
+ {\r
+ $("#ximfmailTreeDialogScroll").attr("hidden","true");\r
+ gMaxDataList = maxEntry;\r
+ }\r
+ else\r
+ $("#ximfmailTreeDialogScroll").removeAttr("hidden");\r
+ \r
+ if(treeResult.database != null)\r
+ {\r
+ treeResult.database.AddDataSource(gRDFList.getDataSource());\r
+ treeResult.builder.rebuild();\r
+ clearTimeout(gIDTimeoutList);\r
+ gIDTimeoutList = setTimeout(OnClickScrollTreeList,100,1);\r
+ }\r
+ }\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - OnClickScrollTreeList ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);\r
+ }\r
+ window.setCursor("auto");\r
+}\r
+\r
+function OnScrollTreeList(event)\r
+{\r
+ window.setCursor("wait");\r
+ try\r
+ {\r
+ var curpos = parseInt($("#ximfmailTreeDialogScroll").attr("curpos"), 10);\r
+ var addPos = 0;\r
+ if(event.detail == -3)\r
+ addPos = -3;\r
+ else if(event.detail == 3)\r
+ addPos = 3;\r
+ curpos += addPos;\r
+ var maxpos = parseInt(gRDFList.getMaxEntry(), 10) - gMaxDataList;\r
+ \r
+ if(curpos<0)\r
+ curpos = 0;\r
+ if(curpos>maxpos)\r
+ curpos = maxpos;\r
+ \r
+ $("#ximfmailTreeDialogScroll").attr("curpos", curpos);\r
+ OnClickScrollTreeList(0);\r
+ }\r
+ catch(e)\r
+ {\r
+ gConsole.logStringMessage("[ximfmail - OnScrollTreeList ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);\r
+ }\r
+ window.setCursor("auto");\r
+}\r
+\r
+function OnKeyPressScrollTreeList(event)\r
+{\r
+ window.setCursor("wait");\r
+ gConsole.logStringMessage("[ximfmail - OnKeyPressScrollTreeList ] enter");\r
+ try\r
+ {\r
+ var curpos = parseInt($("#ximfmailTreeDialogScroll").attr("curpos"), 10);\r
+ var addPos = 0;\r
+ var maxEntry = parseInt(gRDFList.getMaxEntry(), 10);\r
+ var maxpos = maxEntry - gMaxDataList;\r
+ var textToFind = "";\r
+ \r
+ switch(event.keyCode)\r
+ {\r
+ case 33:\r
+ // page up\r
+ addPos = 1-gMaxDataList;\r
+ break;\r
+ \r
+ case 34:\r
+ // page down\r
+ addPos = gMaxDataList-1;\r
+ break;\r
+ \r
+ case 35:\r
+ // end\r
+ addPos = 0;\r
+ curpos = maxpos;\r
+ break;\r
+ \r
+ case 36:\r
+ // beggin\r
+ addPos = 0;\r
+ curpos = 0;\r
+ break; \r
+ \r
+ case 38:\r
+ // up\r
+ addPos = -1;\r
+ break;\r
+ \r
+ case 40:\r
+ // down\r
+ addPos = 1;\r
+ break;\r
+ \r
+ default:\r
+ if(event.charCode ==0)\r
+ {\r
+ window.setCursor("auto");\r
+ return;\r
+ }\r
+ else\r
+ textToFind = String.fromCharCode(event.charCode);\r
+ }\r
+ \r
+ if("" == textToFind)\r
+ {\r
+ curpos += addPos;\r
+ \r
+ if(curpos<0)\r
+ curpos = 0;\r
+ if(curpos>maxpos)\r
+ curpos = maxpos;\r
+ \r
+ $("#ximfmailTreeDialogScroll").attr("curpos", curpos);\r
+ OnClickScrollTreeList(0);\r
+ }\r
+ else\r
+ {\r
+ clearTimeout(gIDTimeoutListSearch);\r
+ gSearchText += textToFind;\r
+ var curposAfter = gRDFList.updateDisplayByText(gSearchText,gMaxDataList,curpos);\r
+ if(curposAfter == -1)\r
+ {\r
+ gSearchText = "";\r
+ window.setCursor("auto");\r
+ return;\r
+ }\r
+ else\r
+ {\r
+ var maxpos = gMaxDataList;\r
+ if(maxEntry - gMaxDataList >= 0)\r
+ maxpos = maxEntry - gMaxDataList;\r
+ else\r
+ maxpos = -1;\r
+ \r
+ if(maxEntry < gMaxDataList)\r
+ gMaxDataList = maxEntry;\r
+ \r
+ $("#ximfmailTreeDialogScroll").attr("maxpos",maxpos);\r
+ $("#ximfmailTreeDialogScroll").attr("curpos", curposAfter);\r
+ OnClickScrollTreeList(0);\r
+ \r
+ gIDTimeoutListSearch = setTimeout(resetSearchText,2000);\r
+ }\r
+ }\r
+ \r
+ }\r
+ catch(e)\r
+ {\r
+ gConsole.logStringMessage("[ximfmail - OnKeyPressScrollTreeList ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);\r
+ }\r
+ window.setCursor("auto");\r
+}\r
+\r
+function resetSearchText()\r
+{\r
+ gSearchText = "";\r
+ gIDTimeoutListSearch = null;\r
+}\r
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- ***** 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 ***** -->
-
-<!DOCTYPE overlay SYSTEM "chrome://ximfmail/locale/ximfmail.dtd">
-<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
-
-<!-- onload="window.sizeToContent();" -->
-<dialog id="treedialog" title=""
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- buttons="accept,cancel"
- buttonlabelcancel="&treedialog.buttonlabelcancel;"
- buttonlabelaccept="&treedialog.buttonlabelaccept;"
- ondialogaccept="return doOK();"
- ondialogcancel="return doCancel();">
- <script type="application/javascript" src="chrome://ximfmail/content/jquery.js" />
- <script type="application/javascript" src="chrome://ximfmail/content/ximfmail.js" />
- <script type="application/javascript" src="chrome://ximfmail/content/constant-ximfmail.js" />
- <script type="application/javascript" src="chrome://ximfmail/content/dialogTree-ximfmail.js" />
-
- <hbox id="ximfmailTreeDialogBox" flex="1" style="height:400px; width:800px;">
- <vbox id="ximfmailTreeDialogDisplaybox" flex="1">
- <tree id="ximfmail.treedialog" flex="1" enableColumnDrag="true" flags="dont-build-content">
- <treecols>
- <treecol id="iCol0" label="&ximfmail.dialogtree.title.col0;" primary="true" persist="hidden ordinal width sortDirection" flex="1"/>
- <splitter class="tree-splitter"/>
- <treecol id="iCol1" label="&ximfmail.dialogtree.title.col1;" persist="hidden ordinal width sortDirection" flex="2" />
- <splitter class="tree-splitter"/>
- </treecols>
- <treechildren flex="1"
- id="iTreechildDialog"
- datasources="rdf:null"
- ref="">
- <template>
- <treeitem uri="?uri">
- <treerow>
- <treecell label="rdf:http://www.ximfmail.com/RDF#column0"/>
- <treecell label="rdf:http://www.ximfmail.com/RDF#column1"/>
- </treerow>
- </treeitem>
- </template>
- </treechildren>
- </tree>
- </vbox>
- <vbox id="ximfmailTreeDialogButtonbox">
- <spacer flex="1"/>
- <button id="ximfmail_dTreeAdd" image="chrome://ximfmail/content/resource/arrow_right.png" tooltiptext="add selection"/>
- <button id="ximfmail_dTreeDel" image="chrome://ximfmail/content/resource/arrow_left.png" tooltiptext="delete item" />
- <button id="ximfmail_dTreeRaz" image="chrome://ximfmail/content/resource/clear_right_list.png" tooltiptext="delete complete selection"/>
- <spacer flex="1"/>
- </vbox>
- <listbox id="ximfmail_selection" style="width:200px;">
- </listbox>
- </hbox>
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!-- ***** 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
+<!DOCTYPE overlay SYSTEM "chrome://ximfmail/locale/ximfmail.dtd">\r
+<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>\r
+\r
+<!-- onload="window.sizeToContent();" -->\r
+<dialog id="treedialog" title="" \r
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" \r
+ buttons="accept,cancel" \r
+ buttonlabelcancel="&treedialog.buttonlabelcancel;"\r
+ buttonlabelaccept="&treedialog.buttonlabelaccept;"\r
+ ondialogaccept="return doOK();"\r
+ ondialogcancel="return doCancel();">\r
+ <script type="application/javascript" src="chrome://ximfmail/content/jquery.js" /> \r
+ <script type="application/javascript" src="chrome://ximfmail/content/ximfmail.js" /> \r
+ <script type="application/javascript" src="chrome://ximfmail/content/constant-ximfmail.js" /> \r
+ <script type="application/javascript" src="chrome://ximfmail/content/dialogTree-ximfmail.js" /> \r
+ <script type="application/javascript" src="chrome://ximfmail/content/dialogTree-rdf-ximfmail.js" />\r
+ \r
+ <hbox id="ximfmailTreeDialogBox" flex="1" style="height:400px; width:800px;"> \r
+ <hbox id="ximfmailTreeDialogDisplaybox" flex="1"> \r
+ <tree id="ximfmail.treedialog" flex="1" enableColumnDrag="true" \r
+ flags="dont-build-content">\r
+ <treecols> \r
+ <treecol id="iCol0" label="&ximfmail.dialogtree.title.col0;" primary="true" persist="hidden ordinal width sortDirection" flex="1"/>\r
+ <splitter class="tree-splitter"/>\r
+ <treecol id="iCol1" label="&ximfmail.dialogtree.title.col1;" persist="hidden ordinal width sortDirection" flex="2" />\r
+ <splitter class="tree-splitter"/> \r
+ </treecols> \r
+ <treechildren flex="1"\r
+ id="iTreechildDialog"\r
+ datasources="rdf:null"\r
+ ref="http://www.ximfmail.com/dialogtree/datas">\r
+ <template>\r
+ <treeitem uri="?uri">\r
+ <treerow>\r
+ <treecell label="rdf:http://www.ximfmail.com/RDF#column0"/>\r
+ <treecell label="rdf:http://www.ximfmail.com/RDF#column1"/>\r
+ </treerow>\r
+ </treeitem>\r
+ </template>\r
+ </treechildren>\r
+ </tree>\r
+ <scrollbar id="ximfmailTreeDialogScroll" curpos="0" maxpos="50" orient="vertical" /> \r
+ </hbox>\r
+ <vbox id="ximfmailTreeDialogButtonbox">\r
+ <spacer flex="1"/>\r
+ <button id="ximfmail_dTreeAdd" image="chrome://ximfmail/content/resource/arrow_right.png" tooltiptext="add selection"/>\r
+ <button id="ximfmail_dTreeDel" image="chrome://ximfmail/content/resource/arrow_left.png" tooltiptext="delete item" />\r
+ <button id="ximfmail_dTreeRaz" image="chrome://ximfmail/content/resource/clear_right_list.png" tooltiptext="delete complete selection"/> \r
+ <spacer flex="1"/>\r
+ </vbox>\r
+ <listbox id="ximfmail_selection" style="width:200px;"> \r
+ </listbox> \r
+ </hbox>\r
</dialog>
\ No newline at end of file
-/* ***** 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 ***** */
-var gJSLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].createInstance(Components.interfaces.mozIJSSubScriptLoader);
-var gConsole = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
-gJSLoader.loadSubScript("chrome://ximfmail/content/jquery.js");
-gJSLoader.loadSubScript("chrome://ximfmail/content/ximfmail.js");
-
-var gBoxOpener = null;
-var gXimfMaxItems = null;
-var gXimfMinItems = null;
-var gXimfSeparator = null;
-var gCurrentText = null;
-var gEditorElt = null; //textbox elment
-var gTitleDlg = null;
-var gDlgEditorXimf_maxItem_alert = "";
-
-/*
- window.arguments = [];
- args[0] id of textbox
- args[1] text
- args[2] separator value
- args[3] max items to write
- args[4] min items to write
-*/
-$(document).ready(function(){
- var gArgs = window.arguments;
- if(gArgs[0].length < 5){
- ximfAlert("error nbargs = "+gArgs[0].length)
- return;}
-
- // load background datas
- gBoxOpener = gArgs[0][0];
- gCurrentText = gArgs[0][1];
- gXimfSeparator = gArgs[0][2];
- gXimfMaxItems = gArgs[0][3];
- gXimfMinItems = gArgs[0][4];
- gTitleDlg = gArgs[0][5];
- //
- gEditorElt = document.getElementById("textbox-editor");
- gConsole.logStringMessage("[ximfmail - dialogEditor ] \n id of textbox :" + gArgs[0][0] + "\n separator value: " + gArgs[0][2] + "\n max items to write: "+ gArgs[0][3] + "\n min items to write: " +gArgs[0][4]);
-
- if(parseInt(gXimfMaxItems) > 1){
- gDlgEditorXimf_maxItem_alert = gXimfMaxItems + " "+ getIlkProperties("ximfmail.dialog.editor.warning.nbrows");
- $("#textbox-editor").attr("style","width:400px;height:100px");
- }else{
- gDlgEditorXimf_maxItem_alert = gXimfMaxItems + "1 "+ getIlkProperties("ximfmail.dialog.editor.warning.nbrows.one");
- $("#textbox-editor").attr("maxrows","1");
- }
- RefreshEditor();
-
- // event observer
- $("#textbox-editor").keypress(onCheck);
-});
-
-/*
- *
- */
-function doOK()
-{
- if(!gEditorElt) return false;
- if(gXimfMinItems){
- if( getWritedRowsCount() < parseInt(gXimfMinItems)){
- ximfAlert("not enough item");
- }
- }
-
- var newvalue = "";
- if(!gXimfSeparator){
- newvalue = gEditorElt.value;
- }else{
- var reg=new RegExp("\n", "g");
- //newvalue = gEditorElt.value.replace(reg , gXimfSeparator);
- var arrayValue = gEditorElt.value.split(reg);
- var nbElements = arrayValue.length;
- if(parseInt(gXimfMaxItems)<arrayValue.length){
- nbElements = parseInt(gXimfMaxItems);
- ximfAlert(gDlgEditorXimf_maxItem_alert);
- }
- for(var i=0 ; i<nbElements ; ++i){
- if(arrayValue[i]!=""){
- if(i==0)
- newvalue = arrayValue[i];
- else
- newvalue += gXimfSeparator + arrayValue[i];
- }
- }
- }
-
-
- //remove last separator
- if(newvalue.lastIndexOf(gXimfSeparator)+1 == newvalue.length){
- newvalue = newvalue.substring(0,newvalue.lastIndexOf(gXimfSeparator));
- }
-
- window.opener.document.getElementById(gBoxOpener).value = newvalue;
- window.opener.document.getElementById(gBoxOpener).setAttribute("ximfvalue", newvalue);
- window.opener.document.getElementById(gBoxOpener).setAttribute("tooltiptext", newvalue);
- return true;
-}
-
-
-function doCancel()
-{
- return true;
-}
-
-
-/*
- *
- */
-function onCheck(aEvent){
- if(!gEditorElt) return false;
- var key = aEvent.which;
- switch(key){
- case 13: // key=="\n"
- if( getWritedRowsCount() >= parseInt(gXimfMaxItems)){
- ximfAlert(gDlgEditorXimf_maxItem_alert);
- var reg = new RegExp("\n", "g");
- var artxt = gEditorElt.value.split(reg);
- var newText = "";
- for(var i=0 ; i < gXimfMaxItems; ++i){
- if(i < artxt.length){
- if(gXimfMaxItems-1 == i){
- newText += artxt[i];
- }else{
- newText += artxt[i] + "\n";
- }
- }
- }
- gEditorElt.value = newText;
- }
- case 8: // backspace
- case 0: // delete
- break;
- default:
- if( getWritedRowsCount() > parseInt(gXimfMaxItems)){
- ximfAlert(gDlgEditorXimf_maxItem_alert);
- return false;
- }
- }
- /*
- // check for entries items
- if(key == 13){ // key=="\n"
- if( getWritedRowsCount() >= parseInt(gXimfMaxItems)){
- alert(gDlgEditorXimf_maxItem_alert);
- var reg = new RegExp("\n", "g");
- var artxt = gEditorElt.value.split(reg);
- var newText = "";
- for(var i=0 ; i < gXimfMaxItems; ++i){
- if(i < artxt.length){
- if(gXimfMaxItems-1 == i){
- newText += artxt[i];
- }else{
- newText += artxt[i] + "\n";
- }
- }
- }
- gEditorElt.value = newText;
- }
- }
- else{
- if( getWritedRowsCount() > parseInt(gXimfMaxItems)){
- alert(gDlgEditorXimf_maxItem_alert);
- return false;
- }
- }*/
- return true;
-}
-
-function getWritedRowsCount(){
- var nblines = 0;
- var reg=new RegExp("\n", "g");
- var nbvalue = gEditorElt.value.split(reg);
- return nbvalue.length;
-}
-/*
- *
- */
-function RefreshEditor(){
- if(!gEditorElt) return;
-
- // title box
- $("#editorDialogHeader").attr("title",gTitleDlg);
- $("#editorDialogHeader").attr("description",gDlgEditorXimf_maxItem_alert);
-
- // text value
- if(!gXimfSeparator){
- gEditorElt.setAttribute("multiline","false");
- gEditorElt.value = gCurrentText;
- }else{
- try{
- gEditorElt.setAttribute("multiline","true");
- if(gCurrentText){
- var reg=new RegExp(gXimfSeparator, "g");
- var multitxt = gCurrentText.replace(reg , "\n");
- //gEditorElt.setAttribute("value",multitxt+"\n");
- gEditorElt.setAttribute("value",multitxt);
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - RefreshEditor ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+ e.lineNumber);
- }
- }
+/* ***** 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
+var gJSLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].createInstance(Components.interfaces.mozIJSSubScriptLoader);\r
+var gConsole = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);\r
+gJSLoader.loadSubScript("chrome://ximfmail/content/jquery.js");\r
+gJSLoader.loadSubScript("chrome://ximfmail/content/ximfmail.js");\r
+\r
+var gBoxOpener = null;\r
+var gXimfMaxItems = null;\r
+var gXimfMinItems = null;\r
+var gXimfSeparator = null;\r
+var gCurrentText = null;\r
+var gEditorElt = null; //textbox elment\r
+var gTitleDlg = null;\r
+var gDlgEditorXimf_maxItem_alert = "";\r
+\r
+/*\r
+ window.arguments = [];\r
+ args[0] id of textbox \r
+ args[1] text\r
+ args[2] separator value \r
+ args[3] max items to write\r
+ args[4] min items to write\r
+*/\r
+$(document).ready(function(){ \r
+ var gArgs = window.arguments;\r
+ if(gArgs[0].length < 5){ \r
+ ximfAlert("error nbargs = "+gArgs[0].length)\r
+ return;} \r
+ \r
+ // load background datas\r
+ gBoxOpener = gArgs[0][0];\r
+ gCurrentText = gArgs[0][1];\r
+ gXimfSeparator = gArgs[0][2];\r
+ gXimfMaxItems = gArgs[0][3];\r
+ gXimfMinItems = gArgs[0][4]; \r
+ gTitleDlg = gArgs[0][5];\r
+ //\r
+ gEditorElt = document.getElementById("textbox-editor"); \r
+ gConsole.logStringMessage("[ximfmail - dialogEditor ] \n id of textbox :" + gArgs[0][0] + "\n separator value: " + gArgs[0][2] + "\n max items to write: "+ gArgs[0][3] + "\n min items to write: " +gArgs[0][4]); \r
+ \r
+ if(parseInt(gXimfMaxItems, 10) > 1){\r
+ gDlgEditorXimf_maxItem_alert = gXimfMaxItems + " "+ getIlkProperties("ximfmail.dialog.editor.warning.nbrows"); \r
+ $("#textbox-editor").attr("style","width:400px;height:100px"); \r
+ }else{ \r
+ gDlgEditorXimf_maxItem_alert = gXimfMaxItems + "1 "+ getIlkProperties("ximfmail.dialog.editor.warning.nbrows.one");\r
+ $("#textbox-editor").attr("maxrows","1");\r
+ }\r
+ RefreshEditor();\r
+ \r
+ // event observer\r
+ $("#textbox-editor").keypress(onCheck); \r
+}); \r
+\r
+/*\r
+ * \r
+ */\r
+function doOK()\r
+{\r
+ if(!gEditorElt) return false;\r
+ if(gXimfMinItems){\r
+ if( getWritedRowsCount() < parseInt(gXimfMinItems, 10)){\r
+ ximfAlert("not enough item");\r
+ }\r
+ }\r
+ \r
+ var newvalue = "";\r
+ if(!gXimfSeparator){ \r
+ newvalue = gEditorElt.value; \r
+ }else{ \r
+ var reg=new RegExp("\n", "g");\r
+ //newvalue = gEditorElt.value.replace(reg , gXimfSeparator);\r
+ var arrayValue = gEditorElt.value.split(reg); \r
+ var nbElements = arrayValue.length;\r
+ if(parseInt(gXimfMaxItems, 10)<arrayValue.length){\r
+ nbElements = parseInt(gXimfMaxItems, 10);\r
+ ximfAlert(gDlgEditorXimf_maxItem_alert);\r
+ } \r
+ for(var i=0 ; i<nbElements ; ++i){\r
+ if(arrayValue[i]!=""){\r
+ if(i==0)\r
+ newvalue = arrayValue[i];\r
+ else\r
+ newvalue += gXimfSeparator + arrayValue[i]; \r
+ } \r
+ }\r
+ }\r
+ \r
+ \r
+ //remove last separator \r
+ if(newvalue.lastIndexOf(gXimfSeparator)+1 == newvalue.length){\r
+ newvalue = newvalue.substring(0,newvalue.lastIndexOf(gXimfSeparator));\r
+ } \r
+ \r
+ window.opener.document.getElementById(gBoxOpener).value = newvalue;\r
+ window.opener.document.getElementById(gBoxOpener).setAttribute("ximfvalue", newvalue); \r
+ window.opener.document.getElementById(gBoxOpener).setAttribute("tooltiptext", newvalue);\r
+ return true;\r
+}\r
+\r
+\r
+function doCancel()\r
+{\r
+ return true;\r
+}\r
+\r
+\r
+/*\r
+ * \r
+ */\r
+function onCheck(aEvent){\r
+ if(!gEditorElt) return false;\r
+ var key = aEvent.which; \r
+ switch(key){\r
+ case 13: // key=="\n" \r
+ if( getWritedRowsCount() >= parseInt(gXimfMaxItems, 10)){\r
+ ximfAlert(gDlgEditorXimf_maxItem_alert); \r
+ var reg = new RegExp("\n", "g");\r
+ var artxt = gEditorElt.value.split(reg);\r
+ var newText = "";\r
+ for(var i=0 ; i < gXimfMaxItems; ++i){\r
+ if(i < artxt.length){\r
+ if(gXimfMaxItems-1 == i){\r
+ newText += artxt[i];\r
+ }else{\r
+ newText += artxt[i] + "\n";\r
+ }\r
+ }\r
+ }\r
+ gEditorElt.value = newText; \r
+ }\r
+ case 8: // backspace\r
+ case 0: // delete\r
+ break;\r
+ default:\r
+ if( getWritedRowsCount() > parseInt(gXimfMaxItems, 10)){\r
+ ximfAlert(gDlgEditorXimf_maxItem_alert); \r
+ return false;\r
+ }\r
+ }\r
+ /*\r
+ // check for entries items \r
+ if(key == 13){ // key=="\n" \r
+ if( getWritedRowsCount() >= parseInt(gXimfMaxItems, 10)){\r
+ alert(gDlgEditorXimf_maxItem_alert); \r
+ var reg = new RegExp("\n", "g");\r
+ var artxt = gEditorElt.value.split(reg);\r
+ var newText = "";\r
+ for(var i=0 ; i < gXimfMaxItems; ++i){\r
+ if(i < artxt.length){\r
+ if(gXimfMaxItems-1 == i){\r
+ newText += artxt[i];\r
+ }else{\r
+ newText += artxt[i] + "\n";\r
+ }\r
+ }\r
+ }\r
+ gEditorElt.value = newText; \r
+ }\r
+ }\r
+ else{\r
+ if( getWritedRowsCount() > parseInt(gXimfMaxItems, 10)){\r
+ alert(gDlgEditorXimf_maxItem_alert); \r
+ return false;\r
+ }\r
+ }*/\r
+ return true;\r
+}\r
+\r
+function getWritedRowsCount(){\r
+ var nblines = 0;\r
+ var reg=new RegExp("\n", "g");\r
+ var nbvalue = gEditorElt.value.split(reg);\r
+ return nbvalue.length;\r
+}\r
+/*\r
+ * \r
+ */\r
+function RefreshEditor(){\r
+ if(!gEditorElt) return;\r
+\r
+ // title box\r
+ $("#editorDialogHeader").attr("title",gTitleDlg); \r
+ $("#editorDialogHeader").attr("description",gDlgEditorXimf_maxItem_alert);\r
+ \r
+ // text value\r
+ if(!gXimfSeparator){\r
+ gEditorElt.setAttribute("multiline","false");\r
+ gEditorElt.value = gCurrentText; \r
+ }else{\r
+ try{ \r
+ gEditorElt.setAttribute("multiline","true");\r
+ if(gCurrentText){ \r
+ var reg=new RegExp(gXimfSeparator, "g"); \r
+ var multitxt = gCurrentText.replace(reg , "\n"); \r
+ //gEditorElt.setAttribute("value",multitxt+"\n");\r
+ gEditorElt.setAttribute("value",multitxt);\r
+ } \r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - RefreshEditor ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+ e.lineNumber); \r
+ } \r
+ }\r
}
\ No newline at end of file
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- ***** 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 ***** -->
-
-<!DOCTYPE overlay SYSTEM "chrome://ximfmail/locale/ximfmail.dtd">
-<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
-
-<!-- onload="window.sizeToContent();" -->
-<dialog id="treedialog" title=""
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- buttons="accept,cancel"
- buttonlabelcancel="&treedialog.buttonlabelcancel;"
- buttonlabelaccept="&treedialog.buttonlabelaccept;"
- ondialogaccept="return doOK();"
- ondialogcancel="return doCancel();">
- <script type="application/javascript" src="chrome://ximfmail/content/ximfmail.js" />
- <script type="application/javascript" src="chrome://ximfmail/content/editor/dialogEditor-ximfmail.js" />
- <dialogheader id="editorDialogHeader" />
- <textbox id="textbox-editor" maxrows="30" style="width:400px;" flex="1"/>
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!-- ***** 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
+<!DOCTYPE overlay SYSTEM "chrome://ximfmail/locale/ximfmail.dtd">\r
+<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>\r
+\r
+<!-- onload="window.sizeToContent();" -->\r
+<dialog id="treedialog" title="" \r
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" \r
+ buttons="accept,cancel" \r
+ buttonlabelcancel="&treedialog.buttonlabelcancel;"\r
+ buttonlabelaccept="&treedialog.buttonlabelaccept;"\r
+ ondialogaccept="return doOK();"\r
+ ondialogcancel="return doCancel();">\r
+ <script type="application/javascript" src="chrome://ximfmail/content/ximfmail.js" />\r
+ <script type="application/javascript" src="chrome://ximfmail/content/editor/dialogEditor-ximfmail.js" /> \r
+ <dialogheader id="editorDialogHeader" />\r
+ <textbox id="textbox-editor" maxrows="30" style="width:400px;" flex="1"/>\r
</dialog>
\ No newline at end of file
-/*
- * jQuery 1.2.6 - New Wave Javascript
- *
- * Copyright (c) 2008 John Resig (jquery.com)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * $Date: 2009-11-05 14:00:08 +0100 (jeu., 05 nov. 2009) $
- * $Rev: 40578 $
- */
-(function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else
-return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.6",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else
-return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else
-selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else
-return(this[0].value||"").replace(/\r/g,"");}return undefined;}if(value.constructor==Number)value+='';return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else
-this.value=value;});},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else
-return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script"))scripts=scripts.add(elem);else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else
-jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){var src=target[name],copy=options[name];if(target===copy)continue;if(deep&©&&typeof copy=="object"&&!copy.nodeType)target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined)target[name]=copy;}return target;};var expando="jQuery"+now(),uuid=0,windowData={},exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{};jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/^[\s[]?function/.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else
-script.appendChild(document.createTextNode(data));head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!==undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length==undefined){for(name in object)if(callback.apply(object[name],args)===false)break;}else
-for(;i<length;)if(callback.apply(object[i++],args)===false)break;}else{if(length==undefined){for(name in object)if(callback.call(object[name],name,object[name])===false)break;}else
-for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else
-jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)stack.unshift(a);for(;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(computedStyle&&computedStyle.getPropertyValue(name))||"";for(i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem+='';if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else
-ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(name in elem&¬xml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem[name]=value;}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))return elem.getAttributeNode(name).nodeValue;return elem[name];}if(msie&¬xml&&name=="style")return jQuery.attr(elem.style,"cssText",value);if(set)elem.setAttribute(name,""+value);var attr=msie&¬xml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)ret[0]=array;else
-while(i)ret[--i]=array[i];}return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]===elem)return i;return-1;},merge:function(first,second){var i=0,elem,pos=first.length;if(jQuery.browser.msie){while(elem=second[i++])if(elem.nodeType!=8)first[pos++]=elem;}else
-while(elem=second[i++])first[pos++]=elem;return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv!=!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!=null)ret[ret.length]=value;}return ret.concat.apply([],ret);}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered)return jQuery.event.handle.apply(arguments.callee.elem,arguments);});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else
-for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}data[0].type=type;if(exclusive)data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}return val;},fix:function(event){if(event[expando]==true)return event;var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--)event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||now();if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i<args.length)jQuery.event.proxy(fn,args[i++]);return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else
-jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!='string')return this._load(url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);else
-xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else
-jQuery.handleError(s,xhr,status);complete();if(s.async)xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr){xhr.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(filter)data=filter(data,type);if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else
-for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else
-s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return opt.complete.call(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else
+/*\r
+ * jQuery 1.2.6 - New Wave Javascript\r
+ *\r
+ * Copyright (c) 2008 John Resig (jquery.com)\r
+ * Dual licensed under the MIT (MIT-LICENSE.txt)\r
+ * and GPL (GPL-LICENSE.txt) licenses.\r
+ *\r
+ * $Date: 2009-11-05 14:00:08 +0100 (jeu., 05 nov. 2009) $\r
+ * $Rev: 40578 $\r
+ */\r
+(function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else\r
+return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.6",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else\r
+return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else\r
+selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else\r
+return(this[0].value||"").replace(/\r/g,"");}return undefined;}if(value.constructor==Number)value+='';return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else\r
+this.value=value;});},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else\r
+return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script"))scripts=scripts.add(elem);else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else\r
+jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){var src=target[name],copy=options[name];if(target===copy)continue;if(deep&©&&typeof copy=="object"&&!copy.nodeType)target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined)target[name]=copy;}return target;};var expando="jQuery"+now(),uuid=0,windowData={},exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{};jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/^[\s[]?function/.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else\r
+script.appendChild(document.createTextNode(data));head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!==undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length==undefined){for(name in object)if(callback.apply(object[name],args)===false)break;}else\r
+for(;i<length;)if(callback.apply(object[i++],args)===false)break;}else{if(length==undefined){for(name in object)if(callback.call(object[name],name,object[name])===false)break;}else\r
+for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else\r
+jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)stack.unshift(a);for(;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(computedStyle&&computedStyle.getPropertyValue(name))||"";for(i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem+='';if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else\r
+ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(name in elem&¬xml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem[name]=value;}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))return elem.getAttributeNode(name).nodeValue;return elem[name];}if(msie&¬xml&&name=="style")return jQuery.attr(elem.style,"cssText",value);if(set)elem.setAttribute(name,""+value);var attr=msie&¬xml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)ret[0]=array;else\r
+while(i)ret[--i]=array[i];}return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]===elem)return i;return-1;},merge:function(first,second){var i=0,elem,pos=first.length;if(jQuery.browser.msie){while(elem=second[i++])if(elem.nodeType!=8)first[pos++]=elem;}else\r
+while(elem=second[i++])first[pos++]=elem;return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv!=!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!=null)ret[ret.length]=value;}return ret.concat.apply([],ret);}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered)return jQuery.event.handle.apply(arguments.callee.elem,arguments);});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else\r
+for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}data[0].type=type;if(exclusive)data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}return val;},fix:function(event){if(event[expando]==true)return event;var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--)event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||now();if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i<args.length)jQuery.event.proxy(fn,args[i++]);return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else\r
+jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!='string')return this._load(url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);else\r
+xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else\r
+jQuery.handleError(s,xhr,status);complete();if(s.async)xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr){xhr.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(filter)data=filter(data,type);if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else\r
+for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else\r
+s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return opt.complete.call(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else\r
e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.call(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",jQuery.makeArray(array));}return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].call(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=now();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done)this.options.complete.call(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0;}return results;};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br);};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0);};});})();
\ No newline at end of file
--- /dev/null
+/* ***** 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 ***** */
+var gConsole = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
+var gJSLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].createInstance(Components.interfaces.mozIJSSubScriptLoader);
+gJSLoader.loadSubScript("chrome://ximfmail/content/constant-ximfmail.js");
+
+
+/**
+Get message source
+@param {nsIMsgDBHdr} header
+@param {function} callbackFunction Function to call when data are received: callbackFunction(header, receivedData, callbackParam)
+@param callbackParam Parameter of callbackFunction
+@return {string} Message source or <b>false</b> if an error occurs
+*/
+function XimfmailGetMessage(mailUri, callbackFunction, callbackParam){
+ if (!mailUri) return;
+ var streamListener = {
+ QueryInterface: function(aIID) {
+ if (aIID.equals(Components.interfaces.nsISupports)
+ || aIID.equals(Components.interfaces.nsIStreamListener))
+ return this;
+ throw Components.results.NS_NOINTERFACE;
+ },
+ data: "",
+ isDataComplete: false,
+ onStartRequest: function(request, context) {},
+ onDataAvailable: function(request, context, inputStream, offset, available) {
+ if(!this.isDataComplete ){
+ var stream = Components.classes["@mozilla.org/scriptableinputstream;1"].createInstance(Components.interfaces.nsIScriptableInputStream);
+ stream.init(inputStream);
+ this.data += stream.read(available);
+ stream.close();
+ stream = null;
+
+ // parse headers only
+ var idxEnd = this.data.indexOf("\r\n\r\n",0); // * CRLF DOS : "\r\n"
+ if(idxEnd == -1) idxEnd = this.data.indexOf("\n\n",0); // * CRLF UNIX : "\n"
+ if(idxEnd == -1) idxEnd = this.data.indexOf("\r\r",0); //CRLF OS : "\r"
+ if(idxEnd != -1) this.isDataComplete = true; // msgSrc = msgSrc.substr(0,idxEnd); //dbg gConsole.logStringMessage("[smime - MessageAnalyser - succes getting mime headers : ] \n" + msgSrc);
+ }
+ },
+ onStopRequest: function(request, context, status) {
+ if (Components.isSuccessCode(status)) {
+ callbackFunction( this.data, mailUri, callbackParam);
+ } else {
+ srv.errorSrv("notifyListener.getMsgSrc - "+mailUri+" - Error: "+status);
+ }
+ }
+ }
+
+ gConsole.logStringMessage("[ximfmail - XimfmailGetMessage ]");
+ $("#ximfmailMailPanel").attr("collapsed","true"); // XIMF headers ihm
+ $("#ximfmail-custom-panel").attr("collapsed","true"); //XIMF account profile type ihm
+ $("#ximfHeadBox").attr("collapsed","true"); // XIMF pictures ihm
+ var pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch(null);
+ pref = pref.QueryInterface(Components.interfaces.nsIPrefBranch2);
+ if(pref.getBoolPref("mailnews.headers.showXimfmail")){
+ // parse message to get XIMF headers
+ var cmessenger = Components.classes["@mozilla.org/messenger;1"].createInstance(Components.interfaces.nsIMessenger);
+ var msgSvc = cmessenger.messageServiceFromURI(mailUri);
+ try { msgSvc.streamMessage(mailUri, streamListener, null, null, false, null); } catch (ex) { return false; }
+ }else{
+ DeleteXimfHeaders();
+ }
+}
+
+/*
+ * Set Ximf headers of message to array
+ *
+ *
+ */
+function XimfmailParseMessage(msgSrc){
+ var separator = new RegExp("\\r\\n|\\r|\\n", "i");// end line
+ var tab = msgSrc.split(separator);
+ var currentXimfHdrArray = [];
+ // filter on IMF headers - append data to array
+ var reg_folding = new RegExp("( )","g");
+ var reg_folding2 = new RegExp("(\t)","g");
+ var idxTab=0;
+
+ for(idxTab=0; idxTab<tab.length; ++idxTab){
+ var header_line = tab[idxTab];
+ // search for long header fields (folding) - RFC 2822
+ if(header_line[0]!= " "){
+ try{
+ while( idxTab < tab.length ){
+ var next_line = tab[idxTab+1];
+ if(next_line){
+ if(next_line[0] == " " || next_line[0] == "\t"){
+ header_line += next_line; //next_line.toLowerCase();
+ header_line = header_line.replace(reg_folding," ");
+ header_line = header_line.replace(reg_folding2,"");
+ ++idxTab;
+ }else{ break; }
+ }else{ break; }
+ }
+ }catch(e){}
+ }
+ //gConsole.logStringMessage("[ximfmail - createXimfHdrArray - decode header line : ] \n" + header_line);
+
+ // fill _ximfHdrArray
+ //var lowcaseTmp = header_line.toLowerCase();
+
+ var lowcaseTmp = header_line; //String_from_utf8(header_line).toLowerCase();
+ if(lowcaseTmp.indexOf(":")!=-1){
+ var xhdr = new Object;
+ xhdr._hdrName = lowcaseTmp.substring(0,lowcaseTmp.indexOf(": ",0));
+ xhdr._hdrValue = lowcaseTmp.substring(lowcaseTmp.indexOf(": ",lowcaseTmp)+2);
+
+ // decode MIME Header
+ xhdr._hdrValue = DecodeMimeXimfheader(xhdr._hdrValue);
+
+ currentXimfHdrArray.push(xhdr);
+ //gConsole.logStringMessage("[ximfmail - MessageAnalyser - push : ] \n" + xhdr._hdrName + " :: "+xhdr._hdrValue);
+ }
+ }
+
+ return currentXimfHdrArray;
+}
+
+
+/*
+ * Ximf headers of current message
+ */
+function XimfmailMesssage(){
+ this._mailUri = null;
+ this._instanceMsgXimf = null;
+ this._current_definition = null;
+ this._currentXimfHdrArray = [];
+ if(typeof XimfmailMesssage.initialized == "undefined"){
+ // set uri of message
+ XimfmailMesssage.prototype.set = function(uri){
+ try{
+ if(!uri) return;
+ if(this._mailUri == uri) return;
+ this._mailUri = uri;
+ }catch(e){
+ gConsole.logStringMessage("[ximfmail - XimfmailMesssage.set ] " + e +"\nline : " + e.lineNumber + " : "+ e + "\nfile : "+ Error().fileName);
+ }
+ return false;
+ };
+ //
+ XimfmailMesssage.prototype.init = function(uri,headerArray){
+ try{
+ if(!uri) return;
+ if(this._mailUri == uri) return;
+ this._mailUri = uri;
+ this._instanceMsgXimf = null;
+
+ this._currentXimfHdrArray=headerArray;
+
+ // get account XIMF definition
+ var prefBranch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch(null);
+ this._current_definition = "";
+ if(prefBranch.prefHasUserValue("mailnews.instance.mailpanel")){
+ if(prefBranch.prefHasUserValue("mailnews.theme.mailpanel"))
+ this._current_definition = prefBranch.getCharPref("mailnews.theme.mailpanel");
+ }else{
+ gConsole.logStringMessage("DBG [ximfmail - XimfmailMesssage.init ] no ximf preferences ");
+ return false;
+ }
+
+ var uriXimfInstance = this.hasXimfHeaders(this._current_definition);
+ if(uriXimfInstance){
+ gConsole.logStringMessage("DBG [ximfmail - XimfmailMesssage.init ] mail instance : " + uriXimfInstance);
+ this._instanceMsgXimf = uriXimfInstance;
+ return true;
+ }else{
+ return false;
+ }
+
+
+ }catch(e){
+ gConsole.logStringMessage("[ximfmail - XimfmailMesssage.init ] " + e +"\nline : " + e.lineNumber + " : "+ e + "\nfile : "+ Error().fileName);
+ }
+ return false;
+ };
+
+
+ // check message with XimfmailCatalog
+ XimfmailMesssage.prototype.hasXimfHeaders = function(currentDefinition){
+ try{
+ var sversion = null;
+ var sname = null;
+
+ sversion = this.getHeaderValue(XIMF_VERSION_HEADER);
+ sname = this.getHeaderValue(XIMF_NAME_HEADER);
+ gConsole.logStringMessage("DBG [ximfmail - MessageAnalyser - hasXimfHeaders ] \ndefinition uri = "+ currentDefinition +"\nXIMF version = "+ sversion+"\nXIMF name = "+sname );
+
+ //if(gXimfCatalog && sname && sversion)
+ if(!sname) return null;
+
+ // check currentDefinition in XimfmailCatalog
+ CreateXimfmailCatalog();
+ uriInstanceXimf = gXimfCatalog.getInstanceUri(currentDefinition,sname,sversion);
+
+ }catch(e){
+ gConsole.logStringMessage("[ximfmail - XimfmailMesssage.hasXimfHeaders ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
+ }
+
+ return uriInstanceXimf;
+ };
+
+ // get XIMF value from message
+ XimfmailMesssage.prototype.getHeaderValue = function(headerName){
+ var value = null;
+ try{
+ var tmpHead = null;
+ for(var idx_xHdrArray = 0 ; idx_xHdrArray < this._currentXimfHdrArray.length ; ++idx_xHdrArray){
+ tmpHead = this._currentXimfHdrArray[idx_xHdrArray]._hdrName;
+ if(headerName.toLowerCase() == tmpHead.toLowerCase()){
+ value = this._currentXimfHdrArray[idx_xHdrArray]._hdrValue;
+ break;
+ }
+ }
+ }catch(e){
+ gConsole.logStringMessage("[ximfmail - XimfmailMesssage.getValue ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
+ }
+ return value;
+ };
+
+ // get XIMF value from message
+ XimfmailMesssage.prototype.getCompleteArray = function(){
+ return this._currentXimfHdrArray();
+ };
+ // set XIMF value to message
+ XimfmailMesssage.prototype.setXimfHeader = function(headerName,headerValue){
+ try{
+ var isNewHeader = true;
+ for(var idx_xHdrArray = 0 ; idx_xHdrArray < this._currentXimfHdrArray.length ; ++idx_xHdrArray){
+ var tmpHead = this._currentXimfHdrArray[idx_xHdrArray]._hdrName;
+ if(tmpHead.toLowerCase() == headerName.toLowerCase()){
+ this._currentXimfHdrArray[idx_xHdrArray]._hdrValue = headerValue;
+ isNewHeader = false;
+ break;
+ }
+ }
+ if(isNewHeader){
+ var xhdr = new Object;
+ xhdr._hdrName = headerName;
+ xhdr._hdrValue = headerValue;
+ this._currentXimfHdrArray.push(xhdr);
+ }
+ }catch(e){
+ gConsole.logStringMessage("[ximfmail - XimfmailMesssage.setXimfHeader ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
+ }
+ };
+ XimfmailMesssage.initialized = true;
+ }
+}
\ No newline at end of file
* ***** END LICENSE BLOCK ***** */
var gConsole = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
-var gXimfHeaders = null;
//
window.addEventListener('messagepane-loaded', InitXimfailMsgWindow, true);
-
-
+
/*
* Create a message listener
*/
-var gIdTimeOut = null;
-function InitXimfailMsgWindow(){
+function InitXimfailMsgWindow(){
+ //
gMessageListeners.push({
onStartHeaders: function (){
+
},
- onEndHeaders: function(){
+ onEndHeaders: function(){
+ var uriMsg = null;
+ if (gMessageDisplay.isDummy){
+ // displayed message from disk
+ uriMsg = gMessageDisplay.displayedUri;
+ gConsole.logStringMessage("[ximfmail - InitXimfailMsgWindow.onEndHeaders ]\ndisplayed message from disk - url = "+uriMsg);
+ }else{
+ // get uri of selected message
+ var msgDBHdr = gFolderDisplay.selectedMessage;
+ if(msgDBHdr) uriMsg = msgDBHdr.folder.getUriForMsg(msgDBHdr);
+ }
+ XimfmailGetMessage(uriMsg,XimfmailParseAndOpenMesssage);
},
onEndAttachments: function (){
- if(gIdTimeOut != null)
- clearTimeout(gIdTimeOut);
- gIdTimeOut = setTimeout("ParseMsgXimfHeaders()",500);
- },
+ }
});
}
/*
* Get Extended headers of messages and display known instances
*/
-function ParseMsgXimfHeaders() {
+function XimfmailParseAndOpenMesssage(msgSrc,uriSrc){
+ var currentXimfHdrArray = XimfmailParseMessage(msgSrc);
try{
- gConsole.logStringMessage("[ximfmail - ParseMsgXimfHeaders ]");
- var msgDBHdr = gFolderDisplay.selectedMessage;
- if(!msgDBHdr){
- gConsole.logStringMessage("[ximfmail - ParseMsgXimfHeaders ] no message selected");
- return;
- }
-
- $("#ximfmailMailPanel").attr("collapsed","true"); // XIMF headers ihm
- $("#ximfmail-custom-panel").attr("collapsed","true"); //XIMF account profile type ihm
- $("#ximfHeadBox").attr("collapsed","true"); // XIMF pictures ihm
- var pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch(null);
- pref = pref.QueryInterface(Components.interfaces.nsIPrefBranch2);
- if(pref.getBoolPref("mailnews.headers.showXimfmail")){
- gXimfHeaders = new XimfmailDbMsg();
- var folderPaneElt = document.getElementById('folderPaneBox');
- if(folderPaneElt){
- gXimfHeaders.set(msgDBHdr.folder.getUriForMsg(msgDBHdr));
- // is read message opened in new tab
- if(folderPaneElt.hasAttribute("collapsed")){
- $("#ximfmail-custom-panel").attr("collapsed","true");
- if(ShowXimfmailPanel()){
- $("#ximfmailMailPanel").removeAttr("collapsed");
+ if(currentXimfHdrArray.length > 0){
+ var ximfMsg = new XimfmailMesssage();
+ if(ximfMsg.init(uriSrc,currentXimfHdrArray)){
+ //alert("XimfmailParseMesssage uriSrc = " + uriSrc +" \n valid ximfmail message")
+ var folderPaneElt = document.getElementById('folderPaneBox');
+ if(folderPaneElt){
+ // is read message opened in new tab
+ if(folderPaneElt.hasAttribute("collapsed")){
+ $("#ximfmail-custom-panel").attr("collapsed","true");
+ if(ShowXimfmailPanel(ximfMsg)){
+ $("#ximfmailMailPanel").removeAttr("collapsed");
+ }
+ }else{
+ $("#ximfmail-custom-panel").removeAttr("collapsed");
}
- }else{
- $("#ximfmail-custom-panel").removeAttr("collapsed");
- }
- }else{
- //if (window.arguments[0] instanceof Components.interfaces.nsIMsgDBHdr){
- // message is displayed in new window
- //var msgHdr = window.arguments[0];
- $("#ximfmail-custom-panel").removeAttr("collapsed");
- CreateXimfmailCatalog();
- gXimfHeaders.set(msgDBHdr.folder.getUriForMsg(msgDBHdr));
- if(ShowXimfmailPanel())
- $("#ximfmailMailPanel").removeAttr("collapsed");
- //if(ShowExpandedHeaders())
- // $("#ximfHeadBox").removeAttr("collapsed");
+ }else{
+ //alert("XimfmailParseMesssage - new window - uriSrc = " + uriSrc +" \n valid ximfmail message")
+ // message is displayed in new window
+ $("#ximfmail-custom-panel").removeAttr("collapsed");
+ if(ShowXimfmailPanel(ximfMsg)) $("#ximfmailMailPanel").removeAttr("collapsed");
+ }
+ // common elements to display
+ if(ShowExpandedHeaders(ximfMsg)){
+ $("#ximfHeadBox").removeAttr("collapsed");
+ }
}
- // common elements to display
- if(ShowExpandedHeaders()){
- $("#ximfHeadBox").removeAttr("collapsed");
- }
- }else{
- DeleteXimfHeaders();
- }
+ }
}catch(e){
- gConsole.logStringMessage("[ximfmail - ParseMsgXimfHeaders ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);
+ gConsole.logStringMessage("XimfmailParseAndOpenMesssage error:"+e);
}
-}
+};
/*
}catch(e){}
}
-/*
- * Ximf headers of current message
- */
-function XimfmailDbMsg(){
- this._mailUri = null;
- this._msgAnalyser = null;
- this._instanceMsgXimf = null;
-
- // parse and save ximf headers message
- this.set = function(uri){
- try{
- if(!uri) return;
- if(this._mailUri == uri) return;
- this._mailUri = uri;
- this._instanceMsgXimf = null;
- this._msgAnalyser=null;
-
- // get account XIMF definition
- var prefBranch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch(null);
- var current_definition = "";
- if(prefBranch.prefHasUserValue("mailnews.instance.mailpanel")){
- if(prefBranch.prefHasUserValue("mailnews.theme.mailpanel"))
- current_definition = prefBranch.getCharPref("mailnews.theme.mailpanel");
- }else{
- gConsole.logStringMessage("DBG [ximfmail - XimfmailDbMsg.set ] no ximf preferences ");
- }
-
- // search for template XIMF
- this._msgAnalyser = new XimfMessageAnalyser();
- this._msgAnalyser.setOriginalURI(this._mailUri);
- this._msgAnalyser.createXimfHdrArray();
- var uriXimfInstance = this._msgAnalyser.hasXimfHeaders(current_definition);
- if(uriXimfInstance){
- gConsole.logStringMessage("DBG [ximfmail - XimfmailDbMsg.set ] mail instance : " + uriXimfInstance);
- this._instanceMsgXimf = uriXimfInstance;
- return true;
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - XimfmailDbMsg.reload ] " + e +"\nline : " + e.lineNumber + " : "+ e + "\nfile : "+ Error().fileName);
- }
- return false;
- };
-
- // get XIMF value from message
- this.getValue = function(headerName){
- return this._msgAnalyser.getHeaderValue(headerName);
- };
-
- // get XIMF value from message
- this.getCompleteArray = function(){
- return this._msgAnalyser.getCompleteArray();
- };
-
- this.setXimfHeader = function(headerName,value){
- this._msgAnalyser.setHeaderValue(headerName,value);
- };
-}
/*
* Dom document manipulations
}catch(e){}
};
-// set label and ximfvalue of ximf linked element
-function ComputeXimfElementLinked(ximfelement,idPanel){
+/*
+ * Set label and ximfvalue of ximf linked element
+ *
+ * @ximfMesssage : ximfmailMesssage object
+ */
+function ComputeXimfElementLinked(ximfelement,idPanel,ximfMessage){
try{
var xHeader = $("label[id='"+$(ximfelement).attr("refheader")+"']").attr("ximfheader");
- var ximfValue = gXimfHeaders.getValue(xHeader);
+ var ximfValue = ximfMessage.getHeaderValue(xHeader);
if(ximfValue){
// search for value and comlete display box
$(ximfelement).attr("refpanel",idPanel);
if(linkpopup){
var targetpopup = $("panel[id='"+linkpopup+"']");
$("textbox[id='" + targetpopup[0].getAttribute("ximfreftextbox")+"']").attr("refpanel",linkpopup);
- ComputeXimfElementLinked($("textbox[id='" + targetpopup[0].getAttribute("ximfreftextbox")+"']"),targetpopup[0].id);
+ ComputeXimfElementLinked($("textbox[id='" + targetpopup[0].getAttribute("ximfreftextbox")+"']"),targetpopup[0].id,ximfMessage);
}
}
}
}
// load ximf headers in DOM documents
-function ShowXimfmailPanel(){
- if(!gXimfHeaders._instanceMsgXimf){ return false; }
+function ShowXimfmailPanel(ximfmailMesssage){
try{
// create DOM panel using compose message template xslt
if(gXimfCatalog){
- $("#ximfmailMailPanelTitle").attr("value",gXimfCatalog.getNameInstance(gXimfHeaders._instanceMsgXimf));
+ $("#ximfmailMailPanelTitle").attr("value",gXimfCatalog.getNameInstance(ximfmailMesssage._instanceMsgXimf));
}else{
$("#ximfmailMailPanelTitle").attr("value","XIMFMAIL");
}
$("#ximfmailMailHeadersTablist").empty();
- var composeDom = CreateDOMWithXimfInstance(gXimfHeaders._instanceMsgXimf,"chrome://theme_ximfmail/content/messengerCompose-ximfmail.xsl");
+ var composeDom = CreateDOMWithXimfInstance(ximfmailMesssage._instanceMsgXimf,"chrome://theme_ximfmail/content/messengerCompose-ximfmail.xsl");
$("#ximfmailMailHeadersTablist").append(composeDom);
$("#ximfmailMailPanel").attr("hidden","true");
for(var idx_xheader_dom=0; idx_xheader_dom<xheader_dom.length; ++idx_xheader_dom){
try{
//gConsole.logStringMessage("[ximfmail - XimfMsgComposeView - search value for textbox : " + xheader_dom[idx_xheader_dom].getAttribute("ximfheader"));
- var ximfValue = gXimfHeaders.getValue(xheader_dom[idx_xheader_dom].getAttribute("ximfheader"));
+ var ximfValue = ximfmailMesssage.getHeaderValue(xheader_dom[idx_xheader_dom].getAttribute("ximfheader"));
if(ximfValue){
// search for value and comlete display box
var display_box = $("textbox[refheader='" + xheader_dom[idx_xheader_dom].getAttribute("id") + "']");
if(linkpopup){
var targetpopup = $("panel[id='"+linkpopup+"']");
- ComputeXimfElementLinked($("textbox[id='" + targetpopup[0].getAttribute("ximfreftextbox")+"']"),targetpopup[0].id);
+ ComputeXimfElementLinked($("textbox[id='" + targetpopup[0].getAttribute("ximfreftextbox")+"']"),targetpopup[0].id,ximfmailMesssage);
}
}
}
var ximfLabelId = $("textbox[id='"+oriTxtboxId+"']").attr("refheader");
if(ximfLabelId){
//gConsole.logStringMessage("[ximfmail - XimfMsgComposeView - search value for freetext :" + $("label[id='"+ximfLabelId+"']").attr("ximfheader")+"\nid ="+ximfLabelId);
- var ximfValue = gXimfHeaders.getValue($("label[id='"+ximfLabelId+"']").attr("ximfheader"));
+ var ximfValue = ximfmailMesssage.getHeaderValue($("label[id='"+ximfLabelId+"']").attr("ximfheader"));
if(ximfValue){
try{
// ximfValue is in Array
var refHeader = xheader_dom[idx_xheader_dom].getAttribute("refheader");
if(refHeader){
//gConsole.logStringMessage("[ximfmail - XimfMsgComposeView - search value for freetext :" + $("label[id='"+ximfLabelId+"']").attr("ximfheader")+"\nid ="+ximfLabelId);
- var ximfValue = gXimfHeaders.getValue($("label[id='"+refHeader+"']").attr("ximfheader"));
+ var ximfValue = ximfmailMesssage.getHeaderValue($("label[id='"+refHeader+"']").attr("ximfheader"));
if(ximfValue){
try{
// ximfValue is in Array
var refHeader = xheader_dom[idx_xheader_dom].getAttribute("refheader");
if(refHeader){
//gConsole.logStringMessage("[ximfmail - XimfMsgComposeView - search value for freetext :" + $("label[id='"+ximfLabelId+"']").attr("ximfheader")+"\nid ="+ximfLabelId);
- var ximfValue = gXimfHeaders.getValue($("label[id='"+refHeader+"']").attr("ximfheader"));
+ var ximfValue = ximfmailMesssage.getHeaderValue($("label[id='"+refHeader+"']").attr("ximfheader"));
if(ximfValue){
//alert($("label[id='"+refHeader+"']").attr("ximfheader")+" :: "+ximfValue)
xheader_dom[idx_xheader_dom].setAttribute("ximfvalue", ximfValue);
}
// insert security pictures...
-function ShowExpandedHeaders(){
+function ShowExpandedHeaders(ximfmailMesssage){
try{
// ximfmail elements to display pictures
var imgClassification = document.getElementById("ximfSecurityClassificationLabelImg");
var imgCategory = document.getElementById("ximfCategoryClassificationLabelImg");
// selected message has no XIMF headers
- if(!gXimfHeaders._instanceMsgXimf){
+ if(!ximfmailMesssage._instanceMsgXimf){
// remove all ximfmail pictures
if(imgClassification) imgClassification.setAttribute("src","");
if(imgCategory) imgCategory.setAttribute("src","");
if(imgClassification){
imgClassification.setAttribute("src","");
var reg=new RegExp("[&]+", "g");
- var picturesClassifArray = CreateRulesArray(gXimfHeaders._instanceMsgXimf,"ximf:classificationPictures");
+ var picturesClassifArray = CreateRulesArray(ximfmailMesssage._instanceMsgXimf,"ximf:classificationPictures");
for(var iHdr=0; iHdr<picturesClassifArray.length ; ++iHdr){
var headerRef = picturesClassifArray[iHdr]._headerRef;
- var valueRef = gXimfHeaders.getValue(headerRef);
+ var valueRef = ximfmailMesssage.getHeaderValue(headerRef);
if(valueRef){
for(var idxPix = 0 ; idxPix < picturesClassifArray.length ; ++idxPix){
var tabPictureValueRef =picturesClassifArray[idxPix]._valueRef.split(reg);
if(imgCategory){
imgCategory.setAttribute("src","");
var reg=new RegExp("[&]+", "g");
- var picturesCategorArray = CreateRulesArray(gXimfHeaders._instanceMsgXimf,"ximf:categoryPictures");
+ var picturesCategorArray = CreateRulesArray(ximfmailMesssage._instanceMsgXimf,"ximf:categoryPictures");
for(var iHdr=0; iHdr<picturesCategorArray.length ; ++iHdr){
var headerRef = picturesCategorArray[iHdr]._headerRef;
- var valueRef = gXimfHeaders.getValue(headerRef);
+ var valueRef = ximfmailMesssage.getHeaderValue(headerRef);
if(valueRef){
for(var idxPix = 0 ; idxPix < picturesCategorArray.length ; ++idxPix){
var tabPictureValueRef = picturesCategorArray[idxPix]._valueRef.split(reg);
// secure headers signature are present in message, isn't it?
// this rule is applied only on ximf messages with same instance of current account
try{
- secureHdrsArray = CreateRulesArray(gXimfHeaders._instanceMsgXimf,"ximfsecureHeaders");
+ secureHdrsArray = CreateRulesArray(ximfmailMesssage._instanceMsgXimf,"ximfsecureHeaders");
if(secureHdrsArray.length > 0){
var smimeBox = document.getElementById("smimeBox")
if(smimeBox.hasAttribute("collapsed")){
<?xml-stylesheet href="chrome://ximfmail/skin" type="text/css"?>
<!DOCTYPE overlay SYSTEM "chrome://ximfmail/locale/ximfmail.dtd">
-<overlay id="ximfMessengerOverlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
- <script type="application/javascript" src="chrome://ximfmail/content/jquery.js" />
- <script type="application/javascript" src="chrome://ximfmail/content/controler-ximfmail.js" />
- <script type="application/javascript" src="chrome://ximfmail/content/constant-ximfmail.js" />
- <script type="application/javascript" src="chrome://ximfmail/content/ximfmail.js" />
- <script type="application/javascript" src="chrome://ximfmail/content/messageAnalyser-ximfmail.js" />
- <script type="application/javascript" src="chrome://ximfmail/content/messageWindow-ov-ximfmail.js" />
-
- <!-- Display Ximf pictures in message of new window-->
- <!-- Display Ximf pictures in message -->
- <rows id="expandedHeaderRows">
- <row id="ximfHeadBox" insertbefore="expandedfromRow" collapsed="true">
- <label value=""/>
- <hbox>
- <image id="ximfSecurityClassificationLabelImg"/>
- <spacer flex="1"/>
- <image id="ximfCategoryClassificationLabelImg"/>
- <spacer flex="1"/>
- </hbox>
- </row>
- </rows>
-
- <!-- Display Ximf headers in message of new window -->
- <vbox id="messagepanebox">
+<overlay id="ximfMessengerOverlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">\r
+ \r
+ <script type="application/javascript" src="chrome://ximfmail/content/jquery.js" />\r
+ <script type="application/javascript" src="chrome://ximfmail/content/controler-ximfmail.js" />\r
+ <script type="application/javascript" src="chrome://ximfmail/content/constant-ximfmail.js" />\r
+ <script type="application/javascript" src="chrome://ximfmail/content/ximfmail.js" />\r
+ <script type="application/javascript" src="chrome://ximfmail/content/messageAnalyser-ximfmail.js" />\r
+ <script type="application/javascript" src="chrome://ximfmail/content/messageWindow-ov-ximfmail.js" />\r
+\r
+ <!-- Display Ximf pictures in message of new window-->\r
+ <!-- Display Ximf pictures in message --> \r
+ <rows id="expandedHeaderRows">\r
+ <row id="ximfHeadBox" insertbefore="expandedfromRow" collapsed="true">\r
+ <label value=""/>\r
+ <hbox>\r
+ <image id="ximfSecurityClassificationLabelImg"/>\r
+ <spacer flex="1"/> \r
+ <image id="ximfCategoryClassificationLabelImg"/>\r
+ <spacer flex="1"/> \r
+ </hbox> \r
+ </row>\r
+ </rows>\r
+ \r
+ <vbox id="messagepanebox"> \r
+ <!-- Display Ximf headers in message of new window -->
<vbox id="ximfmailMailPanel" insertafter="msgHeaderView" collapsed="true">
<hbox id="ximfmailMailPanelFocusBar" class="ximfmailFocusBar" flex="1" align="center">
<button class="ximfmailButton" id="ximfmailComposeMessageMaximize" tooltiptext="&ximfmail.compose.focus;" accesskey="+" hidden="true" />
-/* ***** 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 ***** */
-// global variables
-var gCurrentIdentity=null;
-var gPreviousIdentity=null;
-var gComposeMsgByMenuitem=false;
-var gXimfThreadTree = null;
-
-var gConsole = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
-var gXBranch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch(null);
-
-var gChromeXslMsgCompose = "chrome://theme_ximfmail/content/messengerCompose-ximfmail.xsl";
-var gChromeXslTreeRcv = "chrome://theme_ximfmail/content/threadTree-ximfmail.xsl";
-
-
-/*
- * init ximfmail on main panel
- */
-$(document).ready(function(){
- // init ximfmail operations
- CreateXimfmailCatalog();
- gXimfThreadTree = new XimfThreadTree();
- var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
- observerService.addObserver(XimfThreadTreeDBViewObserver, "MsgCreateDBView", false);
-
- OnSelectfolderPane();
-
- // event manager
- $("#folderTree").select(OnSelectfolderPane);
- //optional-for technical informations $("#threadTree").select(OnSelectMsg);
- //opening message event
- $("#threadTree").dblclick(OnOpenMsg);
- $("#cmd_openMessage").bind("command",OnOpenMsg);
- $("#key_openMessage").bind("command",OnOpenMsg);
- $("#threadTree").keypress(OnOpenMsgWithKey);
- //
- $("#threadTree").click(UpdateThreadPane);
- $("#button-newmsg").mousedown(OnSelectfolderPane); // load instances
- $("#button-newmsg").bind('command', OnComposeDefaultMsg); // use default instance
- $("#button-reply").mousedown(OnSelectfolderPane);
- $("#button-reply").bind('command', OnComposeDefaultMsg);
- $("#button-replyall").mousedown(OnSelectfolderPane);
- $("#button-replyall").bind('command', OnComposeDefaultMsg);
- $("#button-forward").mousedown(OnSelectfolderPane);
- $("#button-forward").bind('command', OnComposeDefaultMsg);
- $("#threadTree").bind('select', OnSelectMsg);
-
- // Security Labels compatibility (RFC2634)
- try{CreateSecurityLabelXml()}catch(e){}
-});
-
-
-/*
- * save state of custom columns
- */
-function UpdateThreadPane(){
- if(gXimfThreadTree){
- gXimfThreadTree.saveColumnToHide();
- }
-}
-
-
-
-/*
- *
- */
-function OnOpenMsgWithKey(evt){ if(evt.keyCode == 13){OnOpenMsg();}}
-function OnOpenMsg(){
- if(!gCurrentIdentity) return false;
- if (IsXimfailActivated(gCurrentIdentity)){
- pref.setBoolPref("mailnews.headers.showXimfmail",true);
- // flag on new open message requested
- try{
- if(!pref.getBoolPref(PREF_MSGWINDOW_REFRESH)){
- pref.setBoolPref(PREF_MSGWINDOW_REFRESH,true);
- }else{
- pref.setBoolPref(PREF_MSGWINDOW_REFRESH,false);
- }
- }catch(e){pref.setBoolPref(PREF_MSGWINDOW_REFRESH,true);}
- }else{
- pref.setBoolPref("mailnews.headers.showXimfmail",false);
- }
- return true;
-}
-
-/*
- *
- */
-function OnSelectMsg(){
- try{
- if(!gCurrentIdentity) return false;
- if (IsXimfailActivated(gCurrentIdentity)){
- pref.setBoolPref("mailnews.headers.showXimfmail",true);
- }else{
- pref.setBoolPref("mailnews.headers.showXimfmail",false);
- }
- }catch(error){
- gConsole.logStringMessage("ximfmail error - on select message : " + error);
- }
-}
-
-/*
- * define instance ximf to use
- */
-function OnCommandComposeMsgXimfmail(event){
- gComposeMsgByMenuitem=true;
- var pathXmlXimf = event.currentTarget.getAttribute("value");
- gXBranch.setCharPref("ximfmail.composeMsg.instance",pathXmlXimf);
- var prefXsmtpCompatibility = GetXimfmailPref(gCurrentIdentity.key, "ximfmail_xsmtp_compatibility");
- if(prefXsmtpCompatibility == "true"){
- gXBranch.setCharPref("ximfmail.composeMsg.xsmtp_on","true");
- }
-}
-
-/*
- * Inspect account user
- */
-function OnSelectfolderPane(){
- try{
- GetCurrentUser();
-
- if(!gCurrentIdentity){
- gConsole.logStringMessage("[ximfmail - OnSelectfolderPane ] gCurrentIdentity invalid");
- return;
- }
-
- // custom-panel update
- var title = GetXimfmailPref(gCurrentIdentity.key, "ximfmail_theme_name");
- $("#title-custom").attr("value",title);
-
- // load context of currentUser
- var refRdf = GetXimfmailPref(gCurrentIdentity.key,"ximfmail_theme_ref");
-
- ChangeRefAttrRdfElement("menupopup-newmsg", refRdf);
-
- // mailpanel instance : to display received/send messages
- var mailInstance = GetXimfmailPref(gCurrentIdentity.key, "ximfmail_instance_mail_panel_ref");
- gXBranch.setCharPref("mailnews.instance.mailpanel",mailInstance);
- var mailTheme = GetXimfmailPref(gCurrentIdentity.key, "ximfmail_theme_ref");
- gXBranch.setCharPref("mailnews.theme.mailpanel",mailTheme);
-
- // is ximfail context used
- if (IsXimfailActivated(gCurrentIdentity)){
- pref.setBoolPref("mailnews.headers.showXimfmail",true);
- $("#menupopup-newmsg").attr("datasources","chrome://theme_ximfmail/content/ximfCatalog.rdf");
- $("#menupopup-newmsg menuitem").attr("hidden","false");
- $("#ximfmail-custom-panel").attr("hidden","false");
- }else{
- pref.setBoolPref("mailnews.headers.showXimfmail",false);
- $("#menupopup-newmsg").attr("datasources","");
- $("#menupopup-newmsg menuitem").attr("hidden","true");
- $("#ximfmail-custom-panel").attr("hidden","true");
- }
-
- // load custom tree
- if( gPreviousIdentity != gCurrentIdentity){
- gPreviousIdentity = gCurrentIdentity;
- if(gXimfThreadTree){
- gXimfThreadTree.createThreadTree();
- gXimfThreadTree.addCustomColumnHandler();
- }
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - OnSelectfolderPane ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
-
- }
-}
-
-/*
- *
- */
-function OnComposeDefaultMsg(evt){
- //alert("OnComposeDefaultMsg")
- if(!gComposeMsgByMenuitem){
- //alert("OnComposeInstanceMsg : " + $("#menupopup-newmsg").attr("ref"));
- //var prefCompose = GetXimfmailPref(gCurrentIdentity.key, "ximfmail_instance_compose_ref");
-
- var idButton = evt.currentTarget.id;
- var prefKey = "";
- if(idButton == "button-newmsg") prefKey = "ximfmail_instance_compose_ref";
- if(idButton == "button-reply") prefKey = "ximfmail_instance_answer_ref";
- if(idButton == "button-replyall") prefKey = "ximfmail_instance_answer_ref";
- if(idButton == "button-forward") prefKey = "ximfmail_instance_forward_ref";
-
- if (IsXimfailActivated(gCurrentIdentity)){
- gXBranch.setCharPref("ximfmail.composeMsg.instance",GetXimfmailPref(gCurrentIdentity.key, prefKey));
- }else{
- gXBranch.setCharPref("ximfmail.composeMsg.instance","");
- }
- }
- gComposeMsgByMenuitem=false;
-}
-
-/*
- * Get account user settings
- */
- function GetCurrentUser() {
- var folder=GetFirstSelectedMsgFolder();
- var identity = null;
- var server;
-
- try {
- if (folder){
- // Get the incoming server associated with this uri.
- server = folder.server;
- identity = getIdentityForServer(server);
- }
- }catch (ex){
- gConsole.logStringMessage("ximfmail error - failed to get an identity to pre-select: " + error);
- return "";
- }
- if(identity){
- gCurrentIdentity=identity;
- var prefName="mail.identity."+identity.key+".useremail";
- try{
- if(gXBranch.prefHasUserValue( prefName ))
- return gXBranch.getCharPref(prefName);
- }catch(exp){
- gConsole.logStringMessage("ximfmail error - failed to get the prefence account type : " + error);
- }
- }
-}
+/* ***** 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
+// global variables\r
+var gCurrentIdentity = null;\r
+var gPreviousIdentity = null;\r
+var gComposeMsgByMenuitem = false;\r
+var gXimfThreadTree = null;\r
+\r
+var gConsole = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);\r
+var gXBranch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch(null);\r
+\r
+var gChromeXslMsgCompose = "chrome://theme_ximfmail/content/messengerCompose-ximfmail.xsl";\r
+var gChromeXslTreeRcv = "chrome://theme_ximfmail/content/threadTree-ximfmail.xsl";\r
+\r
+\r
+/*\r
+ * init ximfmail on main panel\r
+ */\r
+$(document).ready(function(){\r
+ // init ximfmail operations\r
+ CreateXimfmailCatalog(); \r
+ gXimfThreadTree = new XimfThreadTree();\r
+ var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);\r
+ observerService.addObserver(XimfThreadTreeDBViewObserver, "MsgCreateDBView", false); \r
+\r
+ OnSelectfolderPane();\r
+\r
+ // event manager\r
+ $("#folderTree").select(OnSelectfolderPane);\r
+ //optional-for technical informations $("#threadTree").select(OnSelectMsg);\r
+ //opening message event\r
+ $("#threadTree").dblclick(OnOpenMsg); \r
+ $("#cmd_openMessage").bind("command",OnOpenMsg);\r
+ $("#key_openMessage").bind("command",OnOpenMsg);\r
+ $("#threadTree").keypress(OnOpenMsgWithKey); \r
+ //\r
+ $("#threadTree").click(UpdateThreadPane);\r
+ $("#button-newmsg").mousedown(OnSelectfolderPane); // load instances \r
+ $("#button-newmsg").bind('command', OnComposeDefaultMsg); // use default instance \r
+ $("#button-reply").mousedown(OnSelectfolderPane);\r
+ $("#button-reply").bind('command', OnComposeDefaultMsg);\r
+ $("#button-replyall").mousedown(OnSelectfolderPane);\r
+ $("#button-replyall").bind('command', OnComposeDefaultMsg);\r
+ $("#button-forward").mousedown(OnSelectfolderPane);\r
+ $("#button-forward").bind('command', OnComposeDefaultMsg); \r
+ $("#threadTree").bind('select', OnSelectMsg);\r
+ \r
+ // Security Labels compatibility (RFC2634)\r
+ try{CreateSecurityLabelXml();}catch(e){}\r
+});\r
+\r
+\r
+/*\r
+ * save state of custom columns\r
+ */\r
+function UpdateThreadPane(){\r
+ if(gXimfThreadTree){ \r
+ gXimfThreadTree.saveColumnToHide();\r
+ }\r
+}\r
+\r
+ \r
+\r
+/*\r
+ * \r
+ */\r
+function OnOpenMsgWithKey(evt){ if(evt.keyCode == 13){OnOpenMsg();}}\r
+function OnOpenMsg(){\r
+ if(!gCurrentIdentity) return false; \r
+ if (IsXimfailActivated(gCurrentIdentity)){ \r
+ pref.setBoolPref("mailnews.headers.showXimfmail",true); \r
+ // flag on new open message requested\r
+ try{ \r
+ if(!pref.getBoolPref(PREF_MSGWINDOW_REFRESH)){\r
+ pref.setBoolPref(PREF_MSGWINDOW_REFRESH,true); \r
+ }else{\r
+ pref.setBoolPref(PREF_MSGWINDOW_REFRESH,false); \r
+ }\r
+ }catch(e){pref.setBoolPref(PREF_MSGWINDOW_REFRESH,true);}\r
+ }else{\r
+ pref.setBoolPref("mailnews.headers.showXimfmail",false); \r
+ }\r
+ return true; \r
+}\r
+\r
+/*\r
+ * \r
+ */\r
+function OnSelectMsg(){\r
+ try{\r
+ if(!gCurrentIdentity) return false; \r
+ if (IsXimfailActivated(gCurrentIdentity)){ \r
+ pref.setBoolPref("mailnews.headers.showXimfmail",true);\r
+ }else{\r
+ pref.setBoolPref("mailnews.headers.showXimfmail",false); \r
+ }\r
+ }catch(error){\r
+ gConsole.logStringMessage("ximfmail error - on select message : " + error);\r
+ }\r
+}\r
+\r
+/*\r
+ * define instance ximf to use\r
+ */ \r
+function OnCommandComposeMsgXimfmail(event){\r
+ gComposeMsgByMenuitem=true; \r
+ var pathXmlXimf = event.currentTarget.getAttribute("value"); \r
+ gXBranch.setCharPref("ximfmail.composeMsg.instance",pathXmlXimf); \r
+ var prefXsmtpCompatibility = GetXimfmailPref(gCurrentIdentity.key, "ximfmail_xsmtp_compatibility");\r
+ if(prefXsmtpCompatibility == "true"){ \r
+ gXBranch.setCharPref("ximfmail.composeMsg.xsmtp_on","true");\r
+ } \r
+}\r
+\r
+/*\r
+ * Inspect account user\r
+ */ \r
+function OnSelectfolderPane(){\r
+ try{\r
+ GetCurrentUser();\r
+ \r
+ if(!gCurrentIdentity){\r
+ gConsole.logStringMessage("[ximfmail - OnSelectfolderPane ] gCurrentIdentity invalid");\r
+ return;\r
+ } \r
+ \r
+ // custom-panel update\r
+ var title = GetXimfmailPref(gCurrentIdentity.key, "ximfmail_theme_name"); \r
+ $("#title-custom").attr("value",title); \r
+ \r
+ // load context of currentUser \r
+ var refRdf = GetXimfmailPref(gCurrentIdentity.key,"ximfmail_theme_ref"); \r
+ \r
+ ChangeRefAttrRdfElement("menupopup-newmsg", refRdf);\r
+ \r
+ // mailpanel instance : to display received/send messages\r
+ var mailInstance = GetXimfmailPref(gCurrentIdentity.key, "ximfmail_instance_mail_panel_ref");\r
+ gXBranch.setCharPref("mailnews.instance.mailpanel",mailInstance);\r
+ var mailTheme = GetXimfmailPref(gCurrentIdentity.key, "ximfmail_theme_ref");\r
+ gXBranch.setCharPref("mailnews.theme.mailpanel",mailTheme);\r
+\r
+ // is ximfail context used \r
+ if (IsXimfailActivated(gCurrentIdentity)){ \r
+ pref.setBoolPref("mailnews.headers.showXimfmail",true);\r
+ $("#menupopup-newmsg").attr("datasources","chrome://theme_ximfmail/content/ximfCatalog.rdf");\r
+ $("#menupopup-newmsg menuitem").attr("hidden","false");\r
+ $("#ximfmail-custom-panel").attr("hidden","false"); \r
+ }else{\r
+ pref.setBoolPref("mailnews.headers.showXimfmail",false);\r
+ $("#menupopup-newmsg").attr("datasources","");\r
+ $("#menupopup-newmsg menuitem").attr("hidden","true");\r
+ $("#ximfmail-custom-panel").attr("hidden","true"); \r
+ }\r
+ \r
+ // load custom tree\r
+ if( gPreviousIdentity != gCurrentIdentity){ \r
+ gPreviousIdentity = gCurrentIdentity;\r
+ if(gXimfThreadTree){ \r
+ gXimfThreadTree.createThreadTree();\r
+ gXimfThreadTree.addCustomColumnHandler();\r
+ }\r
+ }\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - OnSelectfolderPane ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber); \r
+\r
+ }\r
+}\r
+\r
+/*\r
+ * \r
+ */ \r
+function OnComposeDefaultMsg(evt){\r
+ //alert("OnComposeDefaultMsg")\r
+ if(!gComposeMsgByMenuitem){\r
+ //alert("OnComposeInstanceMsg : " + $("#menupopup-newmsg").attr("ref"));\r
+ //var prefCompose = GetXimfmailPref(gCurrentIdentity.key, "ximfmail_instance_compose_ref");\r
+ \r
+ var idButton = evt.currentTarget.id;\r
+ var prefKey = ""; \r
+ if(idButton == "button-newmsg") prefKey = "ximfmail_instance_compose_ref";\r
+ if(idButton == "button-reply") prefKey = "ximfmail_instance_answer_ref";\r
+ if(idButton == "button-replyall") prefKey = "ximfmail_instance_answer_ref";\r
+ if(idButton == "button-forward") prefKey = "ximfmail_instance_forward_ref";\r
+ \r
+ if (IsXimfailActivated(gCurrentIdentity)){ \r
+ gXBranch.setCharPref("ximfmail.composeMsg.instance",GetXimfmailPref(gCurrentIdentity.key, prefKey));\r
+ }else{\r
+ gXBranch.setCharPref("ximfmail.composeMsg.instance",""); \r
+ } \r
+ }\r
+ gComposeMsgByMenuitem=false; \r
+}\r
+\r
+/*\r
+ * Get account user settings\r
+ */\r
+ function GetCurrentUser() { \r
+ var folder=GetFirstSelectedMsgFolder();\r
+ var identity = null; \r
+ var server;\r
+ \r
+ try {\r
+ if (folder){\r
+ // Get the incoming server associated with this uri.\r
+ server = folder.server; \r
+ identity = getIdentityForServer(server);\r
+ } \r
+ }catch (ex){\r
+ gConsole.logStringMessage("ximfmail error - failed to get an identity to pre-select: " + error);\r
+ return "";\r
+ }\r
+ if(identity){\r
+ gCurrentIdentity=identity;\r
+ var prefName="mail.identity."+identity.key+".useremail";\r
+ try{\r
+ if(gXBranch.prefHasUserValue( prefName ))\r
+ return gXBranch.getCharPref(prefName); \r
+ }catch(exp){ \r
+ gConsole.logStringMessage("ximfmail error - failed to get the prefence account type : " + error);\r
+ }\r
+ } \r
+}\r
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- ***** 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 ***** -->
-
-<?xml-stylesheet href="chrome://ximfmail/skin" type="text/css"?>
-<!DOCTYPE overlay SYSTEM "chrome://ximfmail/locale/ximfmail.dtd">
-<overlay id="ximfMessengerOverlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
- <script type="application/javascript" src="chrome://ximfmail/content/jquery.js" />
- <script type="application/javascript" src="chrome://ximfmail/content/constant-ximfmail.js" />
- <script type="application/javascript" src="chrome://ximfmail/content/controler-ximfmail.js" />
- <script type="application/javascript" src="chrome://ximfmail/content/ximfmail.js" />
- <script type="application/javascript" src="chrome://ximfmail/content/messageAnalyser-ximfmail.js" />
- <script type="application/javascript" src="chrome://ximfmail/content/messageWindow-ov-ximfmail.js" />
- <script type="application/javascript" src="chrome://ximfmail/content/threadTree-ximfmail.js" />
- <script type="application/javascript" src="chrome://ximfmail/content/messenger-ov-ximfmail.js" />
-
- <!-- pane of messages received -->
- <tree id="threadTree">
- <treecols id="threadCols">
- </treecols>
- </tree>
-
- <!-- messages box -->
- <box id="messagesBox" >
- <hbox id="ximfmail-custom-panel" class="ximfmailFocusBar" insertafter="threadpane-splitter" collapsed="true">
- <label id="title-custom"/>
- <separator flex="1"/>
- </hbox>
- </box>
-
- <!-- toolbar button Compose New Message -->
- <toolbarbutton id="button-newmsg" type="menu-button" >
- <menupopup id="menupopup-newmsg"
- datasources="chrome://theme_ximfmail/content/ximfCatalog.rdf"
- ref="" >
- <template>
- <rule>
- <conditions>
- <content uri="?list" />
- <member container="?list" child="?elt" />
- <triple subject="?elt"
- predicate="http://www.ximfmail.com/RDF#instance" object="?name" />
- <triple subject="?elt"
- predicate="http://www.ximfmail.com/RDF#pathSchema"
- object="?pathSchema" />
- <triple subject="?elt"
- predicate="http://www.ximfmail.com/RDF#pathIhm"
- object="?pathIhm" />
- <triple subject="?elt"
- predicate="http://www.ximfmail.com/RDF#pathDictionary"
- object="?pathDictionary" />
- <triple subject="?elt"
- predicate="http://www.ximfmail.com/RDF#instanceLabel"
- object="?label" />
- </conditions>
- <action>
- <menuitem uri="?elt"
- value="?elt"
- label="?label"
- pathSchema="?pathSchema"
- pathDictionary="?pathDictionary"
- pathIhm="?pathIhm"
- observes="isXimfailActivated"
- oncommand="OnCommandComposeMsgXimfmail(event);"/>
- </action>
- </rule>
- </template>
- </menupopup>
- </toolbarbutton>
-
- <!-- Display Ximf headers in single message -->
- <vbox id="singlemessage">
- <vbox id="ximfmailMailPanel" insertafter="msgHeaderView" collapsed="true">
-
- <hbox id="ximfmailMailPanelFocusBar" class="ximfmailFocusBar" flex="1" align="center">
- <button class="ximfmailButton" id="ximfmailComposeMessageMaximize" tooltiptext="&ximfmail.compose.focus;" accesskey="+" hidden="true" />
- <button class="ximfmailButton" id="ximfmailComposeMessageMinimize" tooltiptext="&ximfmail.compose.unfocus;" accesskey="-" />
- <label id="ximfmailMailPanelTitle" value="&ximfmail.compose.headerTab;"/>
- <image id="ximfmailComposeMessageLogo"/>
- <spacer flex="1" />
- </hbox>
- <hbox id="ximfMailTable" >
- <tabbox id="ximfmailMailHeadersTablist" flex="1"/>
- </hbox>
- </vbox>
- </vbox>
- <!-- Display Ximf pictures in message -->
- <rows id="expandedHeaderRows">
- <row id="ximfHeadBox" insertbefore="expandedfromRow" collapsed="true">
- <label value=""/>
- <hbox>
- <image id="ximfSecurityClassificationLabelImg"/>
- <spacer flex="1"/>
- <image id="ximfCategoryClassificationLabelImg"/>
- <spacer flex="1"/>
- </hbox>
- </row>
- </rows>
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!-- ***** 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
+<?xml-stylesheet href="chrome://ximfmail/skin" type="text/css"?>\r
+<!DOCTYPE overlay SYSTEM "chrome://ximfmail/locale/ximfmail.dtd">\r
+<overlay id="ximfMessengerOverlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">\r
+ \r
+ <script type="application/javascript" src="chrome://ximfmail/content/jquery.js" /> \r
+ <script type="application/javascript" src="chrome://ximfmail/content/constant-ximfmail.js" />\r
+ <script type="application/javascript" src="chrome://ximfmail/content/controler-ximfmail.js" />\r
+ <script type="application/javascript" src="chrome://ximfmail/content/ximfmail.js" />\r
+ <script type="application/javascript" src="chrome://ximfmail/content/messageAnalyser-ximfmail.js" />\r
+ <script type="application/javascript" src="chrome://ximfmail/content/messageWindow-ov-ximfmail.js" />\r
+ <script type="application/javascript" src="chrome://ximfmail/content/threadTree-ximfmail.js" />\r
+ <script type="application/javascript" src="chrome://ximfmail/content/messenger-ov-ximfmail.js" />\r
+\r
+ <!-- pane of messages received -->\r
+ <tree id="threadTree">\r
+ <treecols id="threadCols"> \r
+ </treecols>\r
+ </tree>\r
+ \r
+ <!-- messages box -->\r
+ <box id="messagesBox" >\r
+ <hbox id="ximfmail-custom-panel" class="ximfmailFocusBar" insertafter="threadpane-splitter" collapsed="true">\r
+ <label id="title-custom"/>\r
+ <separator flex="1"/>\r
+ </hbox>\r
+ </box>\r
+ \r
+ <!-- toolbar button Compose New Message -->\r
+ <toolbarbutton id="button-newmsg" type="menu-button" >\r
+ <menupopup id="menupopup-newmsg"\r
+ datasources="chrome://theme_ximfmail/content/ximfCatalog.rdf"\r
+ ref="" >\r
+ <template>\r
+ <rule>\r
+ <conditions>\r
+ <content uri="?list" />\r
+ <member container="?list" child="?elt" /> \r
+ <triple subject="?elt"\r
+ predicate="http://www.ximfmail.com/RDF#instance" object="?name" />\r
+ <triple subject="?elt"\r
+ predicate="http://www.ximfmail.com/RDF#pathSchema" \r
+ object="?pathSchema" />\r
+ <triple subject="?elt"\r
+ predicate="http://www.ximfmail.com/RDF#pathIhm" \r
+ object="?pathIhm" />\r
+ <triple subject="?elt"\r
+ predicate="http://www.ximfmail.com/RDF#pathDictionary" \r
+ object="?pathDictionary" />\r
+ <triple subject="?elt"\r
+ predicate="http://www.ximfmail.com/RDF#instanceLabel"\r
+ object="?label" /> \r
+ <triple subject="?elt"\r
+ predicate="http://www.ximfmail.com/RDF#active"\r
+ object="true" />\r
+ </conditions>\r
+ <action> \r
+ <menuitem uri="?elt" \r
+ value="?elt"\r
+ label="?label" \r
+ pathSchema="?pathSchema"\r
+ pathDictionary="?pathDictionary"\r
+ pathIhm="?pathIhm" \r
+ observes="isXimfailActivated" \r
+ oncommand="OnCommandComposeMsgXimfmail(event);"/>\r
+ </action>\r
+ </rule>\r
+ </template>\r
+ </menupopup>\r
+ </toolbarbutton> \r
+ \r
+ <!-- Display Ximf headers in single message -->\r
+ <vbox id="singlemessage">\r
+ <vbox id="ximfmailMailPanel" insertafter="msgHeaderView" collapsed="true">\r
+ \r
+ <hbox id="ximfmailMailPanelFocusBar" class="ximfmailFocusBar" flex="1" align="center">\r
+ <button class="ximfmailButton" id="ximfmailComposeMessageMaximize" tooltiptext="&ximfmail.compose.focus;" accesskey="+" hidden="true" />\r
+ <button class="ximfmailButton" id="ximfmailComposeMessageMinimize" tooltiptext="&ximfmail.compose.unfocus;" accesskey="-" />\r
+ <label id="ximfmailMailPanelTitle" value="&ximfmail.compose.headerTab;"/>\r
+ <image id="ximfmailComposeMessageLogo"/> \r
+ <spacer flex="1" />\r
+ </hbox> \r
+ <hbox id="ximfMailTable" > \r
+ <tabbox id="ximfmailMailHeadersTablist" flex="1"/>\r
+ </hbox> \r
+ </vbox>\r
+ </vbox>\r
+ <!-- Display Ximf pictures in message --> \r
+ <rows id="expandedHeaderRows">\r
+ <row id="ximfHeadBox" insertbefore="expandedfromRow" collapsed="true">\r
+ <label value=""/>\r
+ <hbox>\r
+ <image id="ximfSecurityClassificationLabelImg"/>\r
+ <spacer flex="1"/> \r
+ <image id="ximfCategoryClassificationLabelImg"/>\r
+ <spacer flex="1"/> \r
+ </hbox> \r
+ </row>\r
+ </rows>\r
</overlay>
\ No newline at end of file
-/* ***** 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 ***** */
+/* ***** 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
-var gConsole = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
-var gPrefBranch = null;
-var gCurrentInstance = "";
+var gConsole = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);\r
+var gPrefBranch = null;\r
+var gCurrentInstance = "";\r
+\r
-
-/* Init ximfmail document */
-window.addEventListener("compose-window-init", XimfmailComposeInit, true);
-//window.addEventListener("compose-window-reopen", XimfmailReOpen, true); function XimfmailReOpen(){alert("compose-window-reopen")}
-
-/*
- * (Re)open message composer with XIMF instance
- */
-function XimfmailComposeInit(){
- // ximfmail not requested
- if(!gPrefBranch) gPrefBranch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch(null);
- if(!gPrefBranch.getBoolPref("mailnews.headers.showXimfmail")){
- $("#isUsingXimfail").attr("hidden","true");
+/* Init ximfmail document */ \r
+window.addEventListener("compose-window-init", XimfmailComposeInit, true);\r
+//window.addEventListener("compose-window-reopen", XimfmailReOpen, true); function XimfmailReOpen(){alert("compose-window-reopen")}\r
+\r
+/*\r
+ * (Re)open message composer with XIMF instance\r
+ */\r
+function XimfmailComposeInit(){\r
+ // ximfmail not requested\r
+ if(!gPrefBranch) gPrefBranch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch(null);\r
+ if(!gPrefBranch.getBoolPref("mailnews.headers.showXimfmail")){ \r
+ $("#isUsingXimfail").attr("hidden","true");\r
$("#ximfmailComposeMessageHeadersTablist").empty();
- try{
+ try{\r
//remove ximf events ...
HideSendMessageElements(true);
- $("#addressingWidget").unbind("command",SpecialXimfRule_CheckAddress);
+ $("#addressingWidget").unbind("command",SpecialXimfRule_CheckAddress); \r
ReloadSecurityAccess();
- }catch(e){}
- }else{
- CreateXimfmailCatalog();
- $("#isUsingXimfail").attr("hidden","false");
-
- // observer on sending message
- var ximfmailObserverSvc = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
- ximfmailObserverSvc.addObserver(ximfmailOnSend, "mail:composeOnSend", false);
-
- // I can't catch event on completely initialized compose message, so loop on gCurrentIdentity loaded
- setTimeout("XimfmailStartup()", 50);
- }
-}
-
-
-var gMaxTimeoutXimfmail=0;
-function XimfmailStartup(){
- if(!gCurrentIdentity){
- if(gMaxTimeoutXimfmail<20){
- setTimeout("XimfmailStartup()", 100);
- ++gMaxTimeoutXimfmail;
- }
- return;
- }
-
- var currentInstance = null;
- var current_definition = null;
- //is Template or Draft message
- var typeMsg = -1;
- try{
- // get current definition and default instance of account loaded
- currentInstance = gPrefBranch.getCharPref("ximfmail.composeMsg.instance");
- current_definition = gPrefBranch.getCharPref("mailnews.theme.mailpanel");
- var args = window.arguments[0];
- if(args){
- typeMsg = args.type;
- }else{
- if(gMsgCompose) typeMsg = gMsgCompose.type;
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - XimfmailStartup ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- }
-
- try{
- switch(typeMsg){
- case nsIMsgCompType.Draft:
+ }catch(e){}\r
+ }else{\r
+ CreateXimfmailCatalog(); \r
+ $("#isUsingXimfail").attr("hidden","false");\r
+ \r
+ // observer on sending message\r
+ var ximfmailObserverSvc = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);\r
+ ximfmailObserverSvc.addObserver(ximfmailOnSend, "mail:composeOnSend", false); \r
+ \r
+ // I can't catch event on completely initialized compose message, so loop on gCurrentIdentity loaded\r
+ setTimeout("XimfmailStartup()", 50);\r
+ } \r
+}\r
+\r
+\r
+var gMaxTimeoutXimfmail=0;\r
+function XimfmailStartup(){\r
+ if(!gCurrentIdentity){ \r
+ if(gMaxTimeoutXimfmail<20){\r
+ setTimeout("XimfmailStartup()", 100);\r
+ ++gMaxTimeoutXimfmail;\r
+ }\r
+ return;\r
+ }\r
+ \r
+ var currentInstance = null;\r
+ var current_definition = null;\r
+ //is Template or Draft message\r
+ var typeMsg = -1;\r
+ try{\r
+ // get current definition and default instance of account loaded \r
+ currentInstance = gPrefBranch.getCharPref("ximfmail.composeMsg.instance");\r
+ current_definition = gPrefBranch.getCharPref("mailnews.theme.mailpanel"); \r
+ var args = window.arguments[0]; \r
+ if(args){\r
+ typeMsg = args.type;\r
+ }else{ \r
+ if(gMsgCompose) typeMsg = gMsgCompose.type; \r
+ }\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - XimfmailStartup ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber); \r
+ }\r
+ \r
+ try{ \r
+ switch(typeMsg){ \r
+ case nsIMsgCompType.Draft:\r
case nsIMsgCompType.Template:
- case nsIMsgCompType.Reply:
- case nsIMsgCompType.ReplyAll:
- case nsIMsgCompType.ReplyToSender:
- case nsIMsgCompType.ForwardInline:
- case nsIMsgCompType.ForwardAsAttachment:
- //alert("typeMsg = " + args.type + "\nUri of message : " + args.originalMsgURI);
- gJSLoader.loadSubScript("chrome://ximfmail/content/messageAnalyser-ximfmail.js");
-
- var msgAnalyser = new XimfMessageAnalyser();
-
- // search for template XIMF
- if( args){
- msgAnalyser.setOriginalURI(args.originalMsgURI);
- }else{
- if(gMsgCompose) msgAnalyser.setOriginalURI(gMsgCompose.originalMsgURI);
- }
- msgAnalyser.createXimfHdrArray();
-
- // get instance of message
- var uriXimfInstance = msgAnalyser.hasXimfHeaders(current_definition);
- if(uriXimfInstance){
- currentInstance = uriXimfInstance;
- LoadXimfmailPanel(currentInstance);
- ComputeWithForm(msgAnalyser);
- }else{
- $("#ximfmailComposeMessageHeadersTablist").empty();
- $("#ximfmailComposeMessageTitle").attr("value","");
- $("#isUsingXimfail").attr("hidden","false");
- gXimfHdrs=null;
- //remove ximf events ...
- HideSendMessageElements(true);
- $("#addressingWidget").unbind("command",SpecialXimfRule_CheckAddress);
- ReloadSecurityAccess();
- }
- break;
- default :
- LoadXimfmailPanel(currentInstance);
- break;
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - XimfmailStartup ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);
- }
- //gConsole.logStringMessage("DBG [ximfmail - messengerCompose - XimfmailStartup ] \n XIMF instance : "+ currentInstance + "\n XIMF definition : " + current_definition);
-}
-
-/*
- *
- */
-function LoadXimfmailPanel(currentInstance){
- try{
- //reset old ihm
- $("#ximfmailComposeMessageHeadersTablist").empty();
- ReloadSecurityAccess(); // reload security user functions
- }catch(e){}
- gConsole.logStringMessage("DBG [ximfmail - messengerCompose - LoadXimfmailPanel ] \n XIMF instance : "+ currentInstance);
- if(currentInstance){
- InsertXimfmailComposer(currentInstance);
- gCurrentInstance = currentInstance;
- // ximfmail composer is initialized, event-it
- var event = document.createEvent('Events');
- event.initEvent('compose-ximfmail-init', false, true);
- document.getElementById("msgcomposeWindow").dispatchEvent(event);
+ case nsIMsgCompType.Reply:\r
+ case nsIMsgCompType.ReplyAll:\r
+ case nsIMsgCompType.ReplyToSender: \r
+ case nsIMsgCompType.ForwardInline: \r
+ case nsIMsgCompType.ForwardAsAttachment: \r
+ var uriMsg = null;\r
+ if( args){\r
+ uriMsg = args.originalMsgURI; \r
+ }else{\r
+ if(gMsgCompose) uriMsg = gMsgCompose.originalMsgURI; \r
+ }\r
+ XimfmailGetMessage(uriMsg,XimfmailParseAndUpdateComposeMesssage); \r
+ break;\r
+ default : \r
+ LoadXimfmailPanel(currentInstance); \r
+ break;\r
+ }\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - XimfmailStartup ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber); \r
+ } \r
+ //gConsole.logStringMessage("DBG [ximfmail - messengerCompose - XimfmailStartup ] \n XIMF instance : "+ currentInstance + "\n XIMF definition : " + current_definition);\r
+}\r
+\r
+/*\r
+ * Get Extended headers of messages and display known instances\r
+ */\r
+function XimfmailParseAndUpdateComposeMesssage(msgSrc,uriSrc){\r
+ var currentXimfHdrArray = XimfmailParseMessage(msgSrc);\r
+ var ximfMsg = new XimfmailMesssage();\r
+ if(ximfMsg.init(uriSrc,currentXimfHdrArray)){\r
+ LoadXimfmailPanel(ximfMsg._instanceMsgXimf);\r
+ ComputeWithForm(ximfMsg);\r
+ }else{\r
+ $("#ximfmailComposeMessageHeadersTablist").empty();\r
+ $("#ximfmailComposeMessageTitle").attr("value","");\r
+ $("#isUsingXimfail").attr("hidden","false");\r
+ //remove ximf events ...\r
+ HideSendMessageElements(true);\r
+ $("#addressingWidget").unbind("command",SpecialXimfRule_CheckAddress);\r
+ ReloadSecurityAccess();\r
+ }\r
+}\r
+\r
+/*\r
+ * \r
+ */\r
+function LoadXimfmailPanel(currentInstance){ \r
+ try{\r
+ //reset old ihm\r
+ $("#ximfmailComposeMessageHeadersTablist").empty();\r
+ ReloadSecurityAccess(); // reload security user functions\r
+ }catch(e){}\r
+ gConsole.logStringMessage("DBG [ximfmail - messengerCompose - LoadXimfmailPanel ] \n XIMF instance : "+ currentInstance);\r
+ if(currentInstance){\r
+ InsertXimfmailComposer(currentInstance);\r
+ gCurrentInstance = currentInstance;\r
+ // ximfmail composer is initialized, event-it \r
+ var event = document.createEvent('Events');\r
+ event.initEvent('compose-ximfmail-init', false, true);\r
+ document.getElementById("msgcomposeWindow").dispatchEvent(event);\r
}
-}
-
-
-/*
- *
- */
-var ximfmailOnSend = {
- observe: function(subject, topic, data) {
- if(!gCurrentIdentity) return;
- try{
- var msgCompFields = gMsgCompose.compFields;
- var charSet = null;
- charSet = msgCompFields.characterSet;
- if(!charSet){
- charSet == msgCompFields.defaultCharacterSet;
- }
-
- var currCompfieldsotherHeaders = msgCompFields.otherRandomHeaders;
- var addCompfieldsotherHeaders = "";
- //alert("currCompfieldsotherHeaders = " + currCompfieldsotherHeaders)
- // insert extended headers in sending message
- var headersToSend = ReadMimeHeadersSelection( XIMF_ENDLINE, charSet);
- if(msgCompFields && headersToSend){
- //msgCompFields.otherRandomHeaders += headersToSend;
- addCompfieldsotherHeaders += headersToSend;
- }
-
- // apply xsmtp rules instances
- if(gCurrentIdentity.getBoolAttribute("ximfmail_xsmtp_compatibility_on")){
- var xsmtpHeadersToSend = ReadXsmptHeadersTranslation(XIMF_SEPARATOR_HEADER, XIMF_ENDLINE,charSet);
- if(msgCompFields && xsmtpHeadersToSend){
- //msgCompFields.otherRandomHeaders += xsmtpHeadersToSend;
- addCompfieldsotherHeaders += xsmtpHeadersToSend;
- gConsole.logStringMessage("[ximfmail - ximfmailOnSend ] \n compatibility xsmtp process");
- }
- }
-
- // add ximf headers 1 time - copy last XIMF entries
- if(currCompfieldsotherHeaders.length <= 0 ){
- msgCompFields.otherRandomHeaders = addCompfieldsotherHeaders;
- }else{
- var regCRLF = new RegExp(XIMF_ENDLINE, "g");
- var arrayAddCompfieldsotherHeaders = addCompfieldsotherHeaders.split(regCRLF);
- var arrayCurrCompfieldsotherHeaders = currCompfieldsotherHeaders.split(regCRLF);
- for(i=0 ; i<arrayAddCompfieldsotherHeaders.length ; ++i){
- var tmpAdd = arrayAddCompfieldsotherHeaders[i].slice(0,arrayAddCompfieldsotherHeaders[i].indexOf(":",0));
- if(tmpAdd !=""){
- for(j=0 ; j<arrayCurrCompfieldsotherHeaders.length ; ++j){
- var tmpCurr = arrayCurrCompfieldsotherHeaders[j].slice(0,arrayCurrCompfieldsotherHeaders[j].indexOf(":",0));
- if(tmpCurr != ""){
- if(tmpCurr == tmpAdd){
- arrayCurrCompfieldsotherHeaders[j] = arrayAddCompfieldsotherHeaders[i];
- arrayAddCompfieldsotherHeaders[i] = "";
- break;
- }
- }
- }
- }
- }
-
- //update new selection
- var arrayAddCompfieldsotherHeaders2 = new Array();
+}\r
+\r
+\r
+/*\r
+ * \r
+ */\r
+var ximfmailOnSend = { \r
+ observe: function(subject, topic, data) { \r
+ if(!gCurrentIdentity) return; \r
+ try{\r
+ var msgCompFields = gMsgCompose.compFields; \r
+ var charSet = null;\r
+ charSet = msgCompFields.characterSet;\r
+ if(!charSet){\r
+ charSet == msgCompFields.defaultCharacterSet;\r
+ }\r
+ \r
+ var currCompfieldsotherHeaders = msgCompFields.otherRandomHeaders;\r
+ var addCompfieldsotherHeaders = "";\r
+ //alert("currCompfieldsotherHeaders = " + currCompfieldsotherHeaders)\r
+ // insert extended headers in sending message\r
+ var headersToSend = ReadMimeHeadersSelection( XIMF_ENDLINE, charSet);\r
+ if(msgCompFields && headersToSend){ \r
+ //msgCompFields.otherRandomHeaders += headersToSend; \r
+ addCompfieldsotherHeaders += headersToSend;\r
+ }\r
+ \r
+ // apply xsmtp rules instances\r
+ if(gCurrentIdentity.getBoolAttribute("ximfmail_xsmtp_compatibility_on")){ \r
+ var xsmtpHeadersToSend = ReadXsmptHeadersTranslation(XIMF_SEPARATOR_HEADER, XIMF_ENDLINE,charSet);\r
+ if(msgCompFields && xsmtpHeadersToSend){\r
+ //msgCompFields.otherRandomHeaders += xsmtpHeadersToSend;\r
+ addCompfieldsotherHeaders += xsmtpHeadersToSend;\r
+ gConsole.logStringMessage("[ximfmail - ximfmailOnSend ] \n compatibility xsmtp process");\r
+ }\r
+ }\r
+ \r
+ // add ximf headers 1 time - copy last XIMF entries\r
+ if(currCompfieldsotherHeaders.length <= 0 ){\r
+ msgCompFields.otherRandomHeaders = addCompfieldsotherHeaders;\r
+ }else{\r
+ var regCRLF = new RegExp(XIMF_ENDLINE, "g"); \r
+ var arrayAddCompfieldsotherHeaders = addCompfieldsotherHeaders.split(regCRLF);\r
+ var arrayCurrCompfieldsotherHeaders = currCompfieldsotherHeaders.split(regCRLF);\r
+ for(i=0 ; i<arrayAddCompfieldsotherHeaders.length ; ++i){\r
+ var tmpAdd = arrayAddCompfieldsotherHeaders[i].slice(0,arrayAddCompfieldsotherHeaders[i].indexOf(":",0));\r
+ if(tmpAdd !=""){\r
+ for(j=0 ; j<arrayCurrCompfieldsotherHeaders.length ; ++j){\r
+ var tmpCurr = arrayCurrCompfieldsotherHeaders[j].slice(0,arrayCurrCompfieldsotherHeaders[j].indexOf(":",0));\r
+ if(tmpCurr != ""){\r
+ if(tmpCurr == tmpAdd){ \r
+ arrayCurrCompfieldsotherHeaders[j] = arrayAddCompfieldsotherHeaders[i];\r
+ arrayAddCompfieldsotherHeaders[i] = "";\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ \r
+ //update new selection\r
+ var arrayAddCompfieldsotherHeaders2 = new Array();\r
for(i=0 ; i<arrayAddCompfieldsotherHeaders.length ; ++i){;
- if(arrayAddCompfieldsotherHeaders[i]!= ""){
- arrayAddCompfieldsotherHeaders2.push(arrayAddCompfieldsotherHeaders[i]);
- }
- }
- // insert header
- msgCompFields.otherRandomHeaders = arrayCurrCompfieldsotherHeaders.join(XIMF_ENDLINE);
- if(arrayAddCompfieldsotherHeaders2.length>0){
- msgCompFields.otherRandomHeaders += arrayAddCompfieldsotherHeaders2.join(XIMF_ENDLINE);
- }
- }
-
- // append Security labels
- AppendESSSecuityLabel();
- }catch(e){
- gConsole.logStringMessage("[ximfmail - XimfmailStartup ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- }
- }
+ if(arrayAddCompfieldsotherHeaders[i]!= ""){\r
+ arrayAddCompfieldsotherHeaders2.push(arrayAddCompfieldsotherHeaders[i]);\r
+ }\r
+ } \r
+ // insert header \r
+ msgCompFields.otherRandomHeaders = arrayCurrCompfieldsotherHeaders.join(XIMF_ENDLINE);\r
+ if(arrayAddCompfieldsotherHeaders2.length>0){\r
+ msgCompFields.otherRandomHeaders += arrayAddCompfieldsotherHeaders2.join(XIMF_ENDLINE);\r
+ }\r
+ }\r
+ \r
+ // append Security labels\r
+ AppendESSSecuityLabel(); \r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - XimfmailStartup ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber); \r
+ } \r
+ }\r
};
\ No newline at end of file
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- ***** 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 ***** -->
-
-<!-- Feuilles de style -->
-<?xml-stylesheet href="chrome://ximfmail/skin" type="text/css"?>
-
-<!-- Internationalisation -->
-<!DOCTYPE overlay SYSTEM "chrome://ximfmail/locale/ximfmail.dtd">
-
-<overlay id="ov-composeMsg"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- xmlns:html="http://www.w3.org/1999/xhtml">
-
- <script type="application/javascript" src="chrome://ximfmail/content/jquery.js" />
- <script type="application/javascript" src="chrome://ximfmail/content/messengerCompose-ov-ximfmail.js" />
- <script type="application/javascript" src="chrome://ximfmail/content/constant-ximfmail.js" />
- <script type="application/javascript" src="chrome://ximfmail/content/ximfmail.js" />
- <script type="application/javascript" src="chrome://ximfmail/content/ximfDataSource.js" />
- <script type="application/javascript" src="chrome://ximfmail/content/messengerComposeHeaders-ximfmail.js" />
- <script type="application/javascript" src="chrome://ximfmail/content/ximfSpecial.js" />
- <script type="application/javascript" src="chrome://messenger/content/messengercompose/addressingWidgetOverlay.js"/>
-
- <broadcasterset>
- <broadcaster id="isShowingXimfail" hidden="false"/>
- <broadcaster id="isUsingXimfail" hidden="false"/>
- </broadcasterset>
- <toolbox id="headers-box">
- <toolbar insertbefore="FormatToolbar">
- <vbox id="ximfmailComposeMessagePanel" observes="isUsingXimfail" flex="1">
- <hbox id="ximfmailComposeMessageFocusBar" class="ximfmailFocusBar" flex="1" align="center">
- <button class="ximfmailButton" id="ximfmailComposeMessageMaximize" tooltiptext="&ximfmail.compose.focus;" accesskey="+" hidden="true" />
- <button class="ximfmailButton" id="ximfmailComposeMessageMinimize" tooltiptext="&ximfmail.compose.unfocus;" accesskey="-" />
- <image id="ximfmailComposeMessageLogo"/>
- <label id="ximfmailComposeMessageTitle" value="&ximfmail.compose.headerTab;" />
- <spacer flex="1" />
- </hbox>
- <tabbox id="ximfmailComposeMessageHeadersTablist" observes="isShowingXimfail" handleCtrlTab="true" eventnode="parent"/>
- </vbox>
- </toolbar>
- </toolbox>
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!-- ***** 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
+<!-- Feuilles de style -->\r
+<?xml-stylesheet href="chrome://ximfmail/skin" type="text/css"?>\r
+\r
+<!-- Internationalisation -->\r
+<!DOCTYPE overlay SYSTEM "chrome://ximfmail/locale/ximfmail.dtd">\r
+\r
+<overlay id="ov-composeMsg"\r
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"\r
+ xmlns:html="http://www.w3.org/1999/xhtml"> \r
+ \r
+ <script type="application/javascript" src="chrome://ximfmail/content/jquery.js" />\r
+ <script type="application/javascript" src="chrome://ximfmail/content/messengerCompose-ov-ximfmail.js" /> \r
+ <script type="application/javascript" src="chrome://ximfmail/content/constant-ximfmail.js" />\r
+ <script type="application/javascript" src="chrome://ximfmail/content/ximfmail.js" /> \r
+ <script type="application/javascript" src="chrome://ximfmail/content/ximfDataSource.js" />\r
+ <script type="application/javascript" src="chrome://ximfmail/content/messageAnalyser-ximfmail.js" />\r
+ <script type="application/javascript" src="chrome://ximfmail/content/messengerComposeHeaders-ximfmail.js" /> \r
+ <script type="application/javascript" src="chrome://ximfmail/content/ximfSpecial.js" /> \r
+ <script type="application/javascript" src="chrome://messenger/content/messengercompose/addressingWidgetOverlay.js"/>\r
+ \r
+ <broadcasterset>\r
+ <broadcaster id="isShowingXimfail" hidden="false"/>\r
+ <broadcaster id="isUsingXimfail" hidden="false"/>\r
+ </broadcasterset>\r
+ <toolbox id="headers-box">\r
+ <toolbar insertbefore="FormatToolbar">\r
+ <vbox id="ximfmailComposeMessagePanel" observes="isUsingXimfail" flex="1">\r
+ <hbox id="ximfmailComposeMessageFocusBar" class="ximfmailFocusBar" flex="1" align="center">\r
+ <button class="ximfmailButton" id="ximfmailComposeMessageMaximize" tooltiptext="&ximfmail.compose.focus;" accesskey="+" hidden="true" />\r
+ <button class="ximfmailButton" id="ximfmailComposeMessageMinimize" tooltiptext="&ximfmail.compose.unfocus;" accesskey="-" />\r
+ <image id="ximfmailComposeMessageLogo"/>\r
+ <label id="ximfmailComposeMessageTitle" value="&ximfmail.compose.headerTab;" /> \r
+ <spacer flex="1" />\r
+ </hbox> \r
+ <tabbox id="ximfmailComposeMessageHeadersTablist" observes="isShowingXimfail" handleCtrlTab="true" eventnode="parent"/> \r
+ </vbox>\r
+ </toolbar> \r
+ </toolbox>\r
</overlay>
\ No newline at end of file
-/* ***** 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 ***** */
-
-var gChromeXslMsgCompose = "chrome://theme_ximfmail/content/messengerCompose-ximfmail.xsl";
-var gChromeXslSecureHeaders = "chrome://theme_ximfmail/content/secureHeaders-ximfmail.xsl";
-var gChromeXslSecurityLabel = "chrome://theme_ximfmail/content/securityLabel-ximfmail.xsl";
-var gChomeXulXimfTreeDialog = "chrome://ximfmail/content/dialogTree-ximfmail.xul";
-var gChomeXulXimfCalendarDialog = "chrome://ximfmail/content/calendar/dialogCalendar-ximfmail.xul";
-var gChomeXulXimfEditorDialog = "chrome://ximfmail/content/editor/dialogEditor-ximfmail.xul";
-
-//
-function onclosepanel(){
- try{
- //alert('onclosepanel ' + evt.currentTarget.id)
- //var a = document.getElementById("search");
- var lisitem = $("#search-panel checkbox");
- var resString = "";
- for(i=0;i<lisitem.length;++i){
- if(lisitem[i].hasAttribute("checked"))
- resString += $(lisitem[i]).attr("label")+ " | ";
- }
- var b = document.getElementById("txtpanel");
- b.value = resString;
- }catch(e){
- alert("e = " + e)
- }
-}
-
-
-var gXimfHdrs = null;
-//
-function XimfmailInstanceHeaders(){
- //private:
- var _instance = null;
- var _ximfHdrArray = [];
- var _xsmtpHdrArray = [];
- var _eSSSecurityLabelHdrArray = [];
- var _ximfAssociatedHdrArray = [];
- var _ximfSpecialRulesArray = []; //FT 3504
-
- //public:
- if(typeof XimfmailInstanceHeaders.initialized == "undefined"){
- //
- XimfmailInstanceHeaders.prototype.init = function(ximfInstanceResource){
- _instance = ximfInstanceResource;
- _xsmtpHdrArray = CreateRulesArray(_instance,"ximf:compatibility");
- _ximfAssociatedHdrArray = CreateRulesArray(_instance, "ximf:association");
- _ximfSpecialRulesArray = CreateRulesArray(_instance, "ximf:special"); //FT 3504
- };
- //
- XimfmailInstanceHeaders.prototype.getXimfInstanceResource = function(){
- return _instance;
- };
- //
- XimfmailInstanceHeaders.prototype.getXimfHdrArray = function(){
- return _ximfHdrArray;
- };
- //
- XimfmailInstanceHeaders.prototype.getXsmtpHdrArray = function(){
- return _xsmtpHdrArray;
- };
- //
- XimfmailInstanceHeaders.prototype.getXimfAssociatedHdrArray = function(){
- return _ximfAssociatedHdrArray;
- };
- //
- XimfmailInstanceHeaders.prototype.getESSSecurityLabelHdrArray = function(){
- return _eSSSecurityLabelHdrArray;
- };
- //FT 3504
- XimfmailInstanceHeaders.prototype.getSpecialRulesArray = function(){
- return _ximfSpecialRulesArray;
- };
- //
- XimfmailInstanceHeaders.prototype.loadXimfSecurityRules = function(){
- var isSigned = false;
- // secure headers
- try{
- // create XMLFile at temp directory with rules datas
- var secureHdrArray = [];
- secureHdrArray = CreateRulesArray(_instance,"ximf:secureHeaders");
- if(secureHdrArray.length > 0){
- var signHeaders = CreateDOMWithXimfInstance(_instance,gChromeXslSecureHeaders);
- if(signHeaders){
- var file = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile); // get profile folder
- var serializer = new XMLSerializer();
- var foStream = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);
-
- file.append(XIMFMAIL_SECURE_HEADERS_XML_FILE);
- foStream.init(file, 0x02 | 0x08 | 0x20, 0664, 0); // write, create, truncate
- serializer.serializeToStream(signHeaders, foStream, ""); // rememeber, doc is the DOM tree
- foStream.close();
-
- // set folder datas
- gCurrentIdentity.setCharAttribute("secureheaders.folderdata",file.path);
-
- // sign message with secure headers
- gCurrentIdentity.setBoolAttribute("secureheaders.checked",true);
- $("#idItemSecureHeaders_1").attr("checked","true");
- $("#idItemSecureHeaders_2").attr("checked","true");
- $("#idItemSecureHeaders_1").attr("disabled","true");
- $("#idItemSecureHeaders_2").attr("disabled","true");
- if(!isSigned){
- toggleSignMessage();// signMessage(); // from file msgCompSMIMIEOverlay.js
- isSigned = true
- }
- $("#menu_securitySign1").attr("disabled","true");
- $("#menu_securitySign2").attr("disabled","true");
-
- gConsole.logStringMessage("ximfmail - loadSecurityRules - secureHeaders on ");
- }
- }else{
- gConsole.logStringMessage("ximfmail - loadSecurityRules - secureHeaders off ");
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - loadSecurityRules - secureHeaders] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);
- }
- // Security Labels
- try{
- // create XMLFile at temp directory with rules datas
- _eSSSecurityLabelHdrArray = CreateRulesArray(_instance,"ximf:securityLabel");
- if(_eSSSecurityLabelHdrArray.length > 0){
- $("#menu_securityLabelDialog1").attr("checked","true");
- $("#menu_securityLabelDialog2").attr("checked","true");
- $("#menu_securityLabelDialog1").attr("disabled","true");
- $("#menu_securityLabelDialog2").attr("disabled","true");
-
- if(!isSigned){
- toggleSignMessage(); // from file msgCompSMIMIEOverlay.js
- isSigned = true;
- }
- if(gSMFields){
- gSMFields.securityClassification = -1;
- gSMFields.privacyMark = "";
- gSMFields.securityCategories = "";
- }
- gConsole.logStringMessage("ximfmail - loadSecurityRules - securityLabels on ");
- }else{
- gConsole.logStringMessage("ximfmail - loadSecurityRules - securityLabels off ");
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - loadSecurityRules - securityLabel] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);
- }
- };
- // init object
- XimfmailInstanceHeaders.initialized = true;
- }
-}
-
-//
-function XimfDataSource(){
- this._id; // xml file name path
- this._dataSource;
- this._refDataSource;
-}
-
-//
-function InsertXimfmailComposer(currentInstance){
- try{
- if(gXimfHdrs){gXimfHdrs = null;}
-
- gXimfHdrs = new XimfmailInstanceHeaders();
- gXimfHdrs.init(currentInstance);
- gXimfHdrs.loadXimfSecurityRules();
-
- // ihm init
- ResetXimfhdrsDom();
- InsertXimfhdrsDom(gXimfHdrs.getXimfInstanceResource(), gChromeXslMsgCompose);
-
- // controler init
- LoadXimfhdrsEventObserver();
- ExecuteXimfHdrsDefaultValuesRule();
- InitSpecialXimfRules();
- CheckXimfhdrsSelection();
- }catch(e){
- gConsole.logStringMessage("[ximfmail - InsertXimfmailComposer ] " + e +"\nline : " + e.lineNumber + " : "+ e + "\nfile : "+ Error().fileName);
- }
-}
-
-/*
- * DOM MANIPULATIONS OF XIMFMAIL ELEMENTS
- */
-function ResetXimfhdrsDom(){
- // delete old ximf items
- $("#ximfmailComposeMessageHeadersTablist").empty();
-}
-
-function InsertXimfhdrsDom(ximfInstanceResource, urlXslTemplate){
- // append to document ximfmail panel ihm
- if(!ximfInstanceResource){
- $("#isUsingXimfail").attr("hidden","true");
- return;
- }
- $("#isUsingXimfail").attr("hidden","false");
-
- if(gXimfCatalog){
- $("#ximfmailComposeMessageTitle").attr("value",gXimfCatalog.getLabelInstance(ximfInstanceResource));
- }else{
- $("#ximfmailComposeMessageTitle").attr("value","XIMFMAIL");
- $("#ximfmailComposeMessageTitle").attr("tooltiptext",ximfInstanceResource);
- }
-
- try{
- // Add XSLT result in MessengerCompose window
- $("#ximfmailComposeMessageHeadersTablist").append(CreateDOMWithXimfInstance(ximfInstanceResource, urlXslTemplate));
- }catch(e){
- // TODO : alert user of xslt problem
- ("#isUsingXimfail").attr("hidden","false");
- }
-
- // custom panels where maxitem=1 and contains composed elements
- var arrPanel = $("panel[ximfmaxitem='1']");
- for(i=0;i<arrPanel.length;++i){
- // checkboxes are used
- var chkboxes = $("panel[id='"+arrPanel[i].id+"'] checkbox");
- if(chkboxes.length>=1){
- var mnuitems = $("panel[id='"+arrPanel[i].id+"'] menuitem");
- for(j=0;j<mnuitems.length;++j){
- var chkbx = document.createElement("checkbox");
- $(chkbx).attr("id",$(mnuitems[j]).attr("id"));
- $(chkbx).attr("label",$(mnuitems[j]).attr("label"));
- $(chkbx).attr("ximfvalue",$(mnuitems[j]).attr("ximfvalue"));
- $(chkbx).attr("ximftextbox",$(mnuitems[j]).attr("ximftextbox"));
- if(mnuitems[j].hasAttribute("ximftecvalue"))$(chkbx).attr("ximftecvalue",$(mnuitems[j]).attr("ximftecvalue"));
- $(mnuitems[j].parentNode).append(chkbx);
- $(mnuitems[j]).remove();
- }
- }
-
- }
-
- // custom input boxes
- try{
- var inputPopupList = $("textbox[class='ximfInputbox']");
- for(var i = 0; i < inputPopupList.length; ++i){
- var padre = inputPopupList[i].parentNode;
- if(padre.nodeName=="popup"){
- padre.setAttribute("position", "overlap");
- //padre.setAttribute("style", "min-width : 250px; background-color:#5cacea; "); //#48a2e7;
- }
- }
- }catch(err){}
-
- // internationalisation of ximfmail context popup
- try{
- var gBundle = Components.classes["@mozilla.org/intl/stringbundle;1"].getService(Components.interfaces.nsIStringBundleService);
- var stringBundle = gBundle.createBundle("chrome://ximfmail/locale/ximfmail.properties");
- var contextMenuList = $("menuitem[class='ximfContext']");
- for(var i=0; i<contextMenuList.length; ++i){
- var ilabel = contextMenuList[i].getAttribute("label");
- var sLabel = stringBundle.GetStringFromName(ilabel);
- if(sLabel!=""){
- contextMenuList[i].setAttribute("label",sLabel);
- }
- }
- }catch(err){}
-
- // Custom Ximf Headers Dom
- CustomXimfhdrsInputBox();
- CustomXimfhdrsButton();
- CustomXimfhdrsTreeDialog(); // append DOM elements to access external datas
-}
-
-/*
-* change ximtextbox elements to edit box
-*/
-function CustomXimfhdrsInputBox(){
- var listEditorClass = $("popup > textbox[class='ximfInputbox']");
- for(var i = 0 ; i<listEditorClass.length ; ++i){
- try{
- var idTxtBox = listEditorClass[i].getAttribute("ximfreftextbox");
- var inputbox = $("textbox[id='"+idTxtBox+"'][class]");
- if(inputbox[0].getAttribute("class") != "ximfDatetime"){
- var editor_button = $("textbox[id='"+idTxtBox+"']>button");
- editor_button[0].setAttribute("class","ximfmailButtonTxt ximfEditor");
- editor_button[0].setAttribute("tooltiptext",getIlkProperties("ximfmail.composer.editor.image"));
- editor_button[0].setAttribute("refbox",inputbox[0].getAttribute("id"));
-
- inputbox[0].setAttribute("ximfmaxitems", listEditorClass[i].getAttribute("ximfmaxitems"));
- inputbox[0].setAttribute("ximfminitems", listEditorClass[i].getAttribute("ximfminitems"));
- inputbox[0].setAttribute("ximseparator", listEditorClass[i].getAttribute("ximseparator"));
- inputbox[0].setAttribute("tabindex",parseInt(i)+100);
- inputbox[0].setAttribute("class","ximfEditor");
- inputbox[0].removeAttribute("popup");
- inputbox[0].removeAttribute("readonly");
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - modifyEditorBox ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);
- }
- }
-
- try{
- // remove popup of free text
- $("textbox[class='ximfEditor'] ~ popup").remove();
- }catch(e){
- gConsole.logStringMessage("[ximfmail - CustomXimfhdrsInputBox ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+ e.lineNumber);
- }
-}
-
-/*
- * Add international tooltiptext to button
- */
-function CustomXimfhdrsButton(){
- var listCalendarClass = $("button[class*='ximfDatepicker']");
- for(var i = 0 ; i<listCalendarClass.length ; ++i){
- try{
- listCalendarClass[i].setAttribute("tooltiptext",getIlkProperties("ximfmail.composer.calendar.image"));
- }catch(e){
- gConsole.logStringMessage("[ximfmail - customizeCalendarBox ] \n " + e + "\nfile : " + Error().fileName+"\nline : " + e.lineNumber);
- }
- }
- var listPopupClass = $("button[class*='ximfPopup']");
- for(var i = 0 ; i<listPopupClass.length ; ++i){
- try{
- listPopupClass[i].setAttribute("tooltiptext",getIlkProperties("ximfmail.composer.popup.image"));
- }catch(e){
- gConsole.logStringMessage("[ximfmail - customizeCalendarBox ] \n " + e + "\nfile : " + Error().fileName+"\nline : " + e.lineNumber);
- }
- }
-}
-
-/*
- * Add informations to load ximfTreeDialog
- */
-function CustomXimfhdrsTreeDialog(){
- var listTreeClass = $("box[class='ximfTreeDialog']");
- for(var i = 0; i<listTreeClass.length;++i){
- try{
- var idTxtBox = listTreeClass[i].getAttribute("refBox");
-
- // create DOM element to acces External Tree Dialog
- var data_button = $("textbox[id='"+idTxtBox+"']>button");
- data_button[0].setAttribute("class", "ximfmailButtonTxt ximfTreeDialog");// insert image in DOM
- data_button[0].setAttribute("id","image-"+idTxtBox);
- data_button[0].setAttribute("refBox",idTxtBox);
- data_button[0].setAttribute("refExternal",listTreeClass[i].getAttribute("refExternal"));
- data_button[0].setAttribute("tooltiptext",getIlkProperties("ximfmail.composer.treedlg.image"));
-
- $("textbox[id='"+idTxtBox+"']").attr("refExternal",listTreeClass[i].getAttribute("refExternal"));
- $("textbox[id='"+idTxtBox+"']").attr("refBox",idTxtBox);
- $("textbox[id='"+idTxtBox+"']").removeAttr("popup");
- }catch(e){
- gConsole.logStringMessage("[ximfmail - createButtonsOfExternDatas ] \n " + e + "\nfile : " + Error().fileName+"\nline : " + e.lineNumber);
- }
- }
-}
-
-
-/*
- * Switch On / Off Ximf DOM
- */
-function ToogleXimfhdrsPanel(){
- if($("#isShowingXimfail").attr("hidden") == "true"){
- $("#isShowingXimfail").attr("hidden","false");
- $("#ximfmailComposeMessageMaximize").attr("hidden","true");
- $("#ximfmailComposeMessageMinimize").attr("hidden","false");
-
- // set focus on first tab
- try{
- var tbox = $("#ximfmailComposeMessageHeadersTablist textbox[class='ximfEditor']");
- if(tbox){
- $(tbox[0]).click();
- }
- }catch(e){}
- try{
- var tab = $("#ximfmailComposeMessageHeadersTablist tab");
- if(tab){
- $(tab[0]).click();
- }
- }catch(e){}
- }else{
- $("#isShowingXimfail").attr("hidden","true");
- $("#ximfmailComposeMessageMaximize").attr("hidden","false");
- $("#ximfmailComposeMessageMinimize").attr("hidden","true");
- }
-};
-
-/*
- * manage DOM elements to send message
- */
-function HideSendMessageElements(isToSend){
- if(!isToSend){
- // ihm to unactive sending message
- //$("#ximfmailComposeMessageState").attr("class","ximfmailUnacceptState");
- $("#button-send").attr("disabled", "true");
- // $("menuitem[key='key_send']").attr("disabled", "true");
- $("#menu_File menuitem[command='cmd_sendNow']").attr("hidden", "true");
- $("#menu_File menuitem[key='key_sendLater']").attr("hidden", "true");
- }else{
- // ihm to active sending message
- //$("#ximfmailComposeMessageState").attr("class","ximfmailAcceptState");
- $("#button-send").removeAttr("disabled");
- // $("menuitem[key='key_send']").removeAttr("disabled");
- $("#menu_File menuitem[command='cmd_sendNow']").removeAttr("hidden");
- $("#menu_File menuitem[key='key_sendLater']").removeAttr("hidden");
- }
-};
-
-/*
- * Open Window to select external datas
- */
- var _dataSourceArray = []; // array of ximfHdr : _ximfHdrArray[ximfHdr]
- function OpenTreeDialog(element){
- var keyCat = element.getAttribute("refExternal");
- var refBox = element.getAttribute("refBox");
- var idxDatasSource = -1;
- var rdfdataSource = null;
- var refRdfdataSource = null;
-
- // get/create RDF sources
- try{
- for(var idx_dataSourceArray = 0; idx_dataSourceArray < _dataSourceArray.length ; ++idx_dataSourceArray){
- if(keyCat == _dataSourceArray[idx_dataSourceArray]._id){
- idxDatasSource = idx_dataSourceArray;
- //alert("datasource exist : "+_dataSourceArray[idxDatasSource]._id + "idxDatasSource = " + idxDatasSource);
- }
- }
- if(idxDatasSource >= 0){
- //alert("attach datasource "+_dataSourceArray[idxDatasSource]._refDataSource);
- rdfdataSource = _dataSourceArray[idxDatasSource]._dataSource;
- refRdfdataSource = _dataSourceArray[idxDatasSource]._refDataSource;
- }else{
- // get xml schema from profile instance directory
- var sCompletePath = getFilePathInProfile("extensions/"+gXimfCatalog.getSchemaInstance(gXimfHdrs.getXimfInstanceResource()));
- sCompletePath = sCompletePath.substring(0, sCompletePath.lastIndexOf("\\")+1) + keyCat;
- var dir = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
- dir.initWithPath( sCompletePath );
- if(!dir.exists()){return;}
-
- // create and save datasource
- xDataSource = new XimfDataSource();
- xDataSource._id = keyCat;
- var res = CreateRdfDatasSource(sCompletePath);
- rdfdataSource = res._dataSource;
- xDataSource._dataSource = rdfdataSource;
- refRdfdataSource = res._refDataSource;
- xDataSource._refDataSource = refRdfdataSource;
-
- //alert("new datasource "+refRdfdataSource);
- _dataSourceArray.push(xDataSource);
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - addExternDatas ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+ e.lineNumber);
- }
-
- // push datas to new dialog window
- try{
- // get informations of datas to load
- var eltTxtBox = document.getElementById(refBox);
- var separator = eltTxtBox.getAttribute(_XIMF_ATT_SEPARATOR)
- //args.push(eltTxtBox.getAttribute(_XIMF_ATT_XVALUE));
- var header = document.getElementById(eltTxtBox.getAttribute("refheader"));
-
- // set informations of datas to load
- var args = new XimfmailTreedialogArgs();
- args.dataSource = rdfdataSource;
- args.refdataSource = refRdfdataSource;
- args.title = header.getAttribute("value");
- args.maxItemsSelected = eltTxtBox.getAttribute(_XIMF_ATT_MAX_ITEMS);
-
- // push current selection
- if(eltTxtBox.value){
- try{
- var currentValue = eltTxtBox.value;
- if(args.maxItemsSelected > 1 && separator !="" ){
- var reg = new RegExp("["+separator+"]+", "g");
- var arrayItems = currentValue.split(reg);
- for(var i=0 ; i<arrayItems.length;++i){
- if(arrayItems[i] != "") args.currentKeys.push(arrayItems[i]);
- }
- }else{
- //
- args.currentKeys.push(currentValue);
- if($(eltTxtBox).attr("tooltiptext")){
- args.currentLabels.push($(eltTxtBox).attr("tooltiptext"));
- }
- }
- }catch(ex){
- gConsole.logStringMessage("[ximfmail - OpenTreeDialogBox_Svc ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);
- }
- }
-
- // open dialog
- window.openDialog(gChomeXulXimfTreeDialog,"showmore", "chrome,resizable,centerscreen,modal",args);
-
- if(args.retIsCancel){
- gConsole.logStringMessage("[ximfmail - OpenTreeDialogBox_Svc ] selection has been canceled !");
- return;
- }
-
- // get for user selection
- if(args.retKeys.length > 1){
- var value = "";
- for(var i=0 ; i < args.retKeys.length ; ++i){
- if(value == ""){
- value = args.retKeys[i];
- }else{
- value = value + separator + args.retKeys[i];
- }
- }
- // set new list values
- eltTxtBox.value = value;
- $(eltTxtBox).attr("ximfvalue",value);
- $(eltTxtBox).attr("tooltiptext","");
- }else{
- if(args.retKeys[0]){
- eltTxtBox.value = args.retKeys[0];
- $(eltTxtBox).attr("ximfvalue",args.retKeys[0]); // used for mandatories headers control rules
- $(eltTxtBox).attr("tooltiptext",args.retLabels[0]);
- }else{
- eltTxtBox.value = "";
- $(eltTxtBox).attr("ximfvalue","");
- $(eltTxtBox).attr("tooltiptext","");
- }
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - addExternDatas ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+ e.lineNumber);
- }
-}
-
-/*
- * Open window to select datetime
- */
-function OpenCalendarDialog(button){
- try{
- // get informations of datas to load
- var args = [];
- var idBox = button.getAttribute("refBox");
- var ebox = document.getElementById(idBox);
- args.push(idBox); // args[0] : id de la textbox a enrichir
- args.push(ebox.getAttribute("value")); // displayed date
- args.push($("label[id='"+ebox.getAttribute("refheader")+"']").attr("value"));
-
- // open dialog
- window.openDialog(gChomeXulXimfCalendarDialog,"showmore", "chrome,resizable,centerscreen,modal",args);
- }catch(e){
- gConsole.logStringMessage("[ximfmail - openCalendarDialogBox ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+ e.lineNumber);
- }
-}
-
-/*
- * Open window text editor
- */
-function OpenEditorDialog(button){
- try{
- var args=[];
- var idBox = button.getAttribute("refbox");
- args.push(idBox);
-
- var ebox = document.getElementById(idBox);
- if(ebox){
- args.push(ebox.value);
- args.push(ebox.getAttribute("ximfseparator"));
- args.push(ebox.getAttribute("ximfmaxitems"));
- args.push(ebox.getAttribute("ximfminitems"));
- args.push($("label[id='"+ebox.getAttribute("refheader")+"']").attr("value"));
- window.openDialog(gChomeXulXimfEditorDialog,"showmore", "chrome,resizable,centerscreen,modal",args);
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - openEditorDialogBox ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+ e.lineNumber);
- }
-}
-
-/*
- * Open window with complete informations of ximf header
- */
-function OpenInfoDialog(idBox){
- // get informations of datas to load
- var args = [];
- var txtBox = document.getElementById(idBox);
- var hLabel = document.getElementById(txtBox.getAttribute("refheader"));
- args.push(hLabel.getAttribute("value")); // args[0] : id de la textbox a enrichir
- args.push(hLabel.getAttribute("ximfheader")); // args[1] : ref du catalogue a charger
- args.push(txtBox.value); // args[2] : titre de la dialogbox
- args.push(txtBox.getAttribute("ximfvalue")); // args[3] : description de la dialogbox
- if(txtBox.hasAttribute("ximfseparator")){
- args.push(txtBox.getAttribute("ximfseparator"));
- }
- // open dialog
- window.openDialog("chrome://ximfmail/content/dialogHdrInfo-ximfmail.xul","showmore", "chrome,resizable,centerscreen,modal",args);
-}
-// END DOM FUNCTIONS
-
-/*
- * EVENT MANAGER OF XIMFMAIL ELEMENTS
- */
-function LoadXimfhdrsEventObserver(){
- // animation on ximfmail panel
- $("#ximfmailComposeMessageMaximize").bind("command",OnClickXimfhdrsBar);
- $("#ximfmailComposeMessageMinimize").bind("command",OnClickXimfhdrsBar);
- $("#ximfmailComposeMessageFocusBar").dblclick(OnClickXimfhdrsBar);
-
- // command events on ximfmail elements
- $("button[class='ximfButton']").bind("command",OnSelectButtonPopup);
- $("menuitem[class='ximfOkSet']").bind("command",OnSelectCheckPopup);
- $("textbox[class='XimfTextboxDisplay']").mouseover(OnHoverTextbox);
- $("menuitem[class='ximfContext']").bind("command",OnSelectContextBox);
- $("button[class*='ximfEraser']").bind("command",OnClickEraser);
- $("button[class*='ximfTreeDialog']").bind("command",OnClickTreeDialogButton);
- $("button[class*='ximfDatepicker']").bind("command",OnClickDatepicker);
- $("textbox[class='ximfEditor']").click(OnXimfhdrsEditor);
- $("textbox[class='ximfEditor']").bind("change",OnCheckXimfhdrsEditor);
- $("button[class*='ximfEditor']").bind("command",OnClickEditorButton);
-
- // get complete information of ximf hdr
- $("button[class*='ximfDetail']").bind("command",function(evt){
- OpenInfoDialog($(evt.currentTarget).attr("refLabel"));
- });
-
- // open panel under ximfmail textbox
- $("button[class*='ximfPopup']").bind("command",function(evt){
- var panel = document.getElementById($(evt.currentTarget).attr("refpanel"));
- $("#"+panel.id+" richlistitem").removeAttr("selected");
- $("#"+panel.id+" richlistitem").removeAttr("current");
- panel.openPopup(evt.currentTarget.parentNode, "after_start", 0, 0, false, false);
- });
-
- // menuitem selected for 1 entry header
- $("menuitem[class*='ximfItem']").bind("command",function(evt){
- ComputeXimfhdrsMenuItem(evt.currentTarget);
- var box = document.getElementById($(evt.currentTarget).attr("ximftextbox"));
- document.getElementById($(box).attr("refpanel")).hidePopup();
- });
-
- // keyboard event on panel
- $("panel").bind("keyup",function(evt){
- if(evt.keyCode == 13){
- var panel = evt.currentTarget;
- var richlistitem = $("#" + evt.currentTarget.id + " richlistitem");
- for(i=0;i<richlistitem.length;++i){
- if(richlistitem[i].selected){
- var nodes = richlistitem[i].childNodes;
- for(j=0;j<nodes.length;++j){
- if(nodes[j].localName=="menuitem"){
- ComputeXimfhdrsMenuItem(nodes[j]);
- var box = document.getElementById($(nodes[j]).attr("ximftextbox"));
- XimfailComposeCanClose();
- document.getElementById($(box).attr("refpanel")).hidePopup();
- return;
- }
- }
- }
- }
- document.getElementById(evt.currentTarget.id).hidePopup();
- }
- });
-
- // checkbox panel is selected
- $("panel checkbox").bind("command",function(evt){
- ComputePanelOfCheckboxSelection(evt.currentTarget.id)});
-
- // check richlistitem where ximfchild=true (ximf computestring)
- $("panel").bind("popuphiding",function(evt){
- var CompstringItem = $("#" + evt.currentTarget.id + " richlistitem[ximfchild='true']");
- for(i=0; i<CompstringItem.length; ++i){
- var chk1 = CompstringItem[i].firstElementChild;
- if(chk1.localName == "checkbox"){
- if(chk1.checked){
- if(!IsAcceptableXimfCompstring(chk1.id)){
- chk1.checked = false;
- chk1.removeAttribute("ximfchild");
- ComputePanelOfCheckboxSelection(chk1.id);
- }
- }
- }
- }
-
- });
-
- // panel can accept more than 1 entry for header
- $("panel").bind("popuphidden",function(evt){
- if(parseInt($(evt.currentTarget).attr("ximfmaxitem")) > 1 ){
- // if panel has XIMF multiset implementation, don't compute it
- var multisetPanel = $("#" + evt.currentTarget.id + " button[class='ximfButton']");
- if(multisetPanel.length <=0){
- ComputeXimfhdrsMultivaluePanel(evt.currentTarget.id);
- }
- }else{
- var nbChk = $("#" + evt.currentTarget.id + " checkbox");
- if(nbChk.length > 0 )ComputeXimfhdrsMultivaluePanel(evt.currentTarget.id);
- }
- XimfailComposeCanClose();
- });
-
- // panel - first entry must be selected before selecting composed item
- $("panel").bind("popupshown",function(evt){
- if(parseInt($(evt.currentTarget).attr("ximfmaxitem")) <= 1 ) return;
- var richitems = $("#" + evt.currentTarget.id + " richlistbox" ).children("richlistitem");
- for(i=0 ; i<richitems.length; ++i){
- var chk1 = richitems[i].firstElementChild;
- if(chk1.localName == "checkbox"){
- if(!chk1.checked){
- var eltsChild = richitems[i].getElementsByTagName("checkbox");
- for(j=0 ; j < eltsChild.length; ++j){
- $(eltsChild[j]).attr("disabled","true");
- }
- $(chk1).attr("disabled","false");//.removeAttr("disabled");
- }
- }
- }
- });
-
- // remove css style from mouse item selections
- $("#ximfmailComposeMessageHeadersTablist richlistitem").mouseout(function(evt){
- if(evt.currentTarget.hasAttribute("selected"))
- $(evt.currentTarget).removeAttr("selected");
- });
-
- // get document tab control, set focus to ximfmail tabbox
- $(document).bind("keypress",function(evt){
- if(evt.keyCode == 9 && evt.target.id=="msgSubject"){ // 9: tabuklation keycode
- if(document.getElementById("ximfmailComposeMessageMinimize").hasAttribute("hidden")){
- $("#ximfmailComposeMessageMaximize").focus();
- }else{
- $("#ximfmailComposeMessageMinimize").focus();
- }
- }
- });
-};
-
-function OnClickXimfhdrsBar(evt){
- ToogleXimfhdrsPanel();
-};
-
-
-function OnSelectButtonPopup(evt){
- ComputeXimfhdrsButtonPopup(evt.currentTarget);
-};
-
-function OnSelectCheckPopup(evt){
- ComputeXimfhdrsCheckPopup(evt.currentTarget);
-};
-
-
-function OnClickEraser(evt){
- EraseAndComputeXimfhdrsTextbox(document.getElementById(evt.currentTarget.id).getAttribute("refValue"), false);
- CheckXimfhdrsSelection();// valid document state
-};
-
-function OnClickTreeDialogButton(evt){
- OpenTreeDialog(evt.currentTarget);
- XimfailComposeCanClose();
-};
-
-function OnClickDatepicker(evt){
- OpenCalendarDialog(evt.currentTarget);
- XimfailComposeCanClose();
-};
-
-function OnClickEditorButton(evt){
- OpenEditorDialog(evt.currentTarget);
- CheckXimfhdrsSelection();
- XimfailComposeCanClose();
-};
-
-
-function OnXimfhdrsEditor(evt){
- var id = evt.currentTarget.id;
- var bx = document.getElementById(id);
- bx.focus();
-};
-
-
-function OnHoverTextbox(evt){
- try{
- elt = evt.currentTarget;
- tooltext = elt.value;
- if(tooltext != ""){
- elt.setAttribute("tooltiptext",tooltext);
- }else{
- elt.removeAttribute("tooltiptext");
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - OnHoverXimfTextbox ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- }
-}
-
-/*
- * Display context menu Ximfmail
- */
-function OnSelectContextBox(evt){
- try{
- idBox = evt.currentTarget.getAttribute("idbox");
- var eltTextbox = document.getElementById(idBox);
- switch(parseInt(evt.currentTarget.getAttribute("idx"))){
- case 1:
- // erase all selected values
- EraseAndComputeXimfhdrsTextbox(eltTextbox.id, true);
- break;
- case 2:
- // display datas of current XIMF header
- if(eltTextbox.value != ""){
- OpenInfoDialog(idBox);
- }
- break;
- default:
- gConsole.logStringMessage("[ximfmail warning OnSelectXimfmailContextBox] \n unknown choice : "+eltTextbox.getAttribute("idx"));
- break;
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - OnSelectXimfmailContextBox ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);
- }
-}
-
-function OnCheckXimfhdrsEditor(evt){
- try{
- //alert(evt.currentTarget.id)
- var domElt = evt.currentTarget;
- var maxItems = domElt.getAttribute("ximfmaxitems");
- var separatorItem = domElt.getAttribute("ximfseparator");
- var labelHeader = document.getElementById(domElt.getAttribute("refheader")).getAttribute("value");
- if(maxItems==""){return;}
- var dlgEditorXimf_maxItem_alert = maxItems + " "+ getIlkProperties("ximfmail.dialog.editor.warning.nbrows");
- var arrayItem = domElt.value.split(separatorItem);
- var nbItems = arrayItem.length;
- if(parseInt(maxItems)<arrayItem.length){
- nbItems = parseInt(maxItems);
- ximfAlert(labelHeader,dlgEditorXimf_maxItem_alert);
- var newvalue = "";
- for(var i=0 ; i<nbItems ; ++i){
- if(arrayItem[i]!=""){
- if(i==0)
- newvalue = arrayItem[i];
- else
- newvalue += separatorItem + arrayItem[i];
- }
- }
- domElt.value = newvalue;
- domElt.inputField = newvalue;
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - OnCheckXimfhdrsEditor ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);
- }
-}
-
-// END EVENT FUNCTIONS
-
-
-/*
- * COMPUTE XIMFMAIL ELEMENTS AND UPDATE DOM
- */
-function CheckXimfhdrsSelection(){
- try{
- var isRuleOk=true;
- // apply generic rules
- if(!ExecuteXimfHdrsAssociationRule()){isRuleOk=false; }
- if(!ExecuteXimfHdrsMandatoryRule()){isRuleOk=false; }
- AppendESSSecuityLabel();
- HideSendMessageElements(isRuleOk);
- }catch(e){
- gConsole.logStringMessage("[ximfmail - IsReadyToSend ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- }
-}
-
-/*
- * Update Ximf header selected from multi choice panel
- */
-function ComputeXimfhdrsMultivaluePanel(idPanel){
- try{
- var panel = document.getElementById(idPanel);
- var ximfSeparator = $(panel).attr("ximfseparator");
- var ximfTecSeparator = $(panel).attr("ximftecseparator");
- var selectionObject = new Object;
- selectionObject.value = "";
- selectionObject.ximfvalue = "";
- selectionObject.ximftecvalue = "";
- var listRichBox = panel.getElementsByTagName("richlistbox");
- var childnodes = listRichBox[0].childNodes;
-
- //
- for(var i = 0 ; i < childnodes.length ; i++){
- if(childnodes[i].localName == "richlistitem"){
- var selectionItem = GetXimfSelectionOfRichlistitem(childnodes[i],ximfSeparator,ximfTecSeparator);
- if(selectionItem){
- if(selectionItem.value != ""){
- if(selectionObject.value == ""){
- selectionObject.value = selectionItem.value;
- selectionObject.ximfvalue = selectionItem.ximfvalue;
- if(selectionItem.ximftecvalue != "") selectionObject.ximftecvalue = selectionItem.ximftecvalue;
- }else{
- selectionObject.value += ximfSeparator + selectionItem.value;
- selectionObject.ximfvalue += ximfSeparator + selectionItem.ximfvalue;
- if(selectionItem.ximftecvalue != "") selectionObject.ximftecvalue += ximfTecSeparator + selectionItem.ximftecvalue;
- }
-
- }
- }
- }
- }
-
- // save selection to ximfhdr textbox
- var hdrTextbox = document.getElementById($(panel).attr("ximfreftextbox"));
- hdrTextbox.value = selectionObject.value;
- $(hdrTextbox).attr("ximfvalue",selectionObject.ximfvalue);
- $(hdrTextbox).attr("ximfseparator",ximfSeparator);
- if(selectionObject.ximftecvalue != ""){
- $(hdrTextbox).attr("ximftecvalue",selectionObject.ximftecvalue);
- $(hdrTextbox).attr("ximftecseparator",ximfTecSeparator);
- }
-
- }catch(e){
- gConsole.logStringMessage("[ximfmail - ComputeXimfhdrsMultivaluePanel ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+ e.lineNumber);
- }
-}
-
-
-/*
- * Get XIMF informations of composed element
- */
-function GetXimfSelectionOfRichlistitem(richItem,cSeparator,cTecSeparator){
- var selectionObject = new Object;
- selectionObject.value = "";
- selectionObject.ximfvalue = "";
- selectionObject.ximftecvalue = "";
- selectionObject.separator = "";
- selectionObject.tecseparator = "";
- try{
- var childnodes = richItem.childNodes;
-
- // single element to decode
- if(childnodes.length == 1){
- return GetXimfValuesOfRichlistItem(childnodes[0]);
- }
-
- // multi element to decode
- if(!GetXimfValuesOfRichlistItem(childnodes[0])) return selectionObject;
- // create array of user informations
- var arrItems = new Array();
- for(var i=0 ; i < childnodes.length ; i++){
- if(childnodes[i].localName == "vbox"){
- var childnodes2 = childnodes[i].childNodes;
- for(var j=0 ; j < childnodes2.length ; j++){
- var item = GetXimfValuesOfRichlistItem(childnodes2[j].firstChild);
- if(item){
- arrItems.push(item);
- }
- }
- }
- var item = GetXimfValuesOfRichlistItem(childnodes[i]);
- if(item){
- arrItems.push(item);
- }
- }
-
- // format Ximf informations
- if(arrItems.length > 1){
- for(var i = arrItems.length-1 ; i >= 0 ; --i){
- var cConcatId = arrItems[i].concatid;
- // get element with id cConcatId
- // concat linked values and create formated information
- if(arrItems[i].concatid != arrItems[i].id){
- for(var j = 0 ; j < arrItems.length ; ++j){
- if(arrItems[j].id == cConcatId){
- if(selectionObject.value == ""){
- selectionObject.value = arrItems[j].value + arrItems[j].separator + arrItems[i].value;
- selectionObject.ximfvalue = arrItems[j].ximfvalue + arrItems[j].separator + arrItems[i].ximfvalue;
- if(arrItems[j].ximftecvalue != "")
- selectionObject.ximftecvalue = arrItems[j].ximftecvalue + arrItems[j].tecseparator + arrItems[i].ximftecvalue;
- }else{
- selectionObject.value += cSeparator + arrItems[j].value + arrItems[j].separator + arrItems[i].value;
- selectionObject.ximfvalue += cSeparator + arrItems[j].ximfvalue + arrItems[j].separator + arrItems[i].ximfvalue;
- if(arrItems[j].ximftecvalue != "")
- selectionObject.ximftecvalue += cTecSeparator + arrItems[j].ximftecvalue + arrItems[j].tecseparator + arrItems[i].ximftecvalue;
- }
- arrItems.splice(i,1); // erase array element
- break;
- }
- }
- }
- }
- }else{
- // case 1 item is used in item selection
- if(arrItems[0].value != ""){
- selectionObject.value += arrItems[0].value;
- selectionObject.ximfvalue += arrItems[0].ximfvalue;
- if(arrItems[0].ximftecvalue != "")
- selectionObject.ximftecvalue += arrItems[0].ximftecvalue;
- }
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - GetXimfSelectionOfRichlistitem ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);
- }
- return selectionObject;
-}
-
-/*
- * get iformations of element selected by user
- */
-function GetXimfValuesOfRichlistItem(richItem){
- var oItem = new Object;
- oItem.id = "";
- oItem.concatid = "";
- oItem.value = "";
- oItem.ximfvalue = "";
- oItem.ximftecvalue = "";
- oItem.separator = "";
- oItem.tecseparator = "";
-
- try{
- switch(richItem.localName){
- case "checkbox" :
- if(richItem.hasAttribute("checked")){
- oItem.value = richItem.getAttribute("label");
- oItem.ximfvalue = richItem.getAttribute("ximfvalue");
- if(richItem.hasAttribute("ximftecvalue")) oItem.ximftecvalue = richItem.getAttribute("ximftecvalue");
- if(richItem.hasAttribute("ximfseparator")) oItem.separator = richItem.getAttribute("ximfseparator");
- if(richItem.hasAttribute("ximftecseparator")) oItem.tecseparator = richItem.getAttribute("ximftecseparator");
- if(richItem.hasAttribute("id")) oItem.id = richItem.getAttribute("id");
- if(richItem.hasAttribute("ximfconcatid")) oItem.concatid = richItem.getAttribute("ximfconcatid");
- }
- break;
- case "textbox" :
- if(richItem.value != ""){
- oItem.value = richItem.value;
- oItem.ximfvalue = richItem.value;
- if(richItem.hasAttribute("ximfseparator")) oItem.separator = richItem.getAttribute("ximfseparator");
- if(richItem.hasAttribute("id")) oItem.id = richItem.getAttribute("id");
- if(richItem.hasAttribute("ximfconcatid")) oItem.concatid = richItem.getAttribute("ximfconcatid");
- }
- break;
- }
-
- if(oItem.value == "") oItem = null;
-
- }catch(e){
- gConsole.logStringMessage("[ximfmail - GetXimfSelectionOfRichlistitem ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- }
- return oItem;
-}
-
-/*
- * Update Ximf header selected from single choice panel
- */
-function ComputeXimfhdrsMenuItem(menuitem){
- try{
- var iMaxItems = 0;
- var sXimfseparator = _XIMF_DEFAULT_SEPARATOR;
- var eltTextbox = document.getElementById(menuitem.getAttribute("ximftextbox"));
-
- // CheckXimfhdrsSelection for list with finished elements number
- if(eltTextbox.hasAttribute(_XIMF_ATT_MAX_ITEMS) ){
- iMaxItems = parseInt(eltTextbox.getAttribute(_XIMF_ATT_MAX_ITEMS),10);
- }
-
- // CheckXimfhdrsSelection for separator value
- if(eltTextbox.hasAttribute(_XIMF_ATT_SEPARATOR) ){
- sXimfseparator = eltTextbox.getAttribute(_XIMF_ATT_SEPARATOR);
- }
-
- // CheckXimfhdrsSelection for concated values
- var sConcatVal="";
- var sConcatXimfVal="";
- var sConcatTecVal="";
- var sContentSeparator = _XIMF_DEFAULT_SEPARATOR;
- var sContenTecSeparator = _XIMF_DEFAULT_SEPARATOR;
- if(menuitem.hasAttribute(_XIMF_ATT_CONCAT_ID)){
- //
- if(menuitem.hasAttribute(_XIMF_ATT_SEPARATOR)){
- sContentSeparator = menuitem.getAttribute(_XIMF_ATT_SEPARATOR);
- }else{
- if(menuitem.parentNode.hasAttribute(_XIMF_ATT_SEPARATOR)){
- sContentSeparator = menuitem.parentNode.getAttribute(_XIMF_ATT_SEPARATOR);
- }
- }
- //
- if(menuitem.hasAttribute(_XIMF_ATT_TEC_SEPARATOR)){
- sContenTecSeparator = menuitem.getAttribute(_XIMF_ATT_TEC_SEPARATOR);
- }else{
- if(menuitem.parentNode.hasAttribute(_XIMF_ATT_TEC_SEPARATOR)){
- sContenTecSeparator = menuitem.parentNode.getAttribute(_XIMF_ATT_TEC_SEPARATOR);
- }
- }
-
- var sIds = menuitem.getAttribute(_XIMF_ATT_CONCAT_ID);
- var reg=new RegExp("[+]+", "g");
- var arrayIds = sIds.split(reg);
- for (var i=0; i<arrayIds.length; i++) {
- try{
- var cElt = document.getElementById(arrayIds[i]);
- if(cElt){
- if(sConcatVal == ""){
- sConcatVal = cElt.getAttribute("label");
- sConcatXimfVal = cElt.getAttribute(_XIMF_ATT_XVALUE);
- sConcatTecVal = cElt.getAttribute(_XIMF_ATT_TEC_VALUE);
- }else{
- sConcatVal = sConcatVal + sContentSeparator + cElt.getAttribute("label");
- sConcatXimfVal = sConcatXimfVal + sContentSeparator + cElt.getAttribute(_XIMF_ATT_XVALUE);
- sConcatTecVal = sConcatTecVal + sContenTecSeparator + cElt.getAttribute(_XIMF_ATT_TEC_VALUE);
- }
- }
- }catch(e){}
- }
- }
-
- // replace existing value if exits
- var sOldximfvalue = eltTextbox.getAttribute(_XIMF_ATT_XVALUE);
- eltTextbox.value = sConcatVal + menuitem.getAttribute("label");
- eltTextbox.setAttribute(_XIMF_ATT_XVALUE, sConcatXimfVal + menuitem.getAttribute(_XIMF_ATT_XVALUE));
-
- // watch for technical value
- if(menuitem.hasAttribute(_XIMF_ATT_TEC_VALUE)){
- eltTextbox.setAttribute(_XIMF_ATT_TEC_VALUE, sConcatTecVal + menuitem.getAttribute(_XIMF_ATT_TEC_VALUE));
- }
-
- //erase old linkPopup case and new selection
- if(sOldximfvalue!=""){
- if(sOldximfvalue != menuitem.getAttribute(_XIMF_ATT_XVALUE)){
- var sOldlinkpopup = $("panel[id='"+ eltTextbox.getAttribute("refpanel")+"'] menuitem[ximfvalue='"+sOldximfvalue+"']").attr(_XIMF_ATT_LINK_POPUP_BOX);
- EraseAndComputeXimfhdrsTextbox($("panel[id='"+ sOldlinkpopup +"']").attr(_XIMF_ATT_REF_BOX));
- // delete popup link in textbox
- $("textbox[id='" + $("panel[id='"+ sOldlinkpopup +"']").attr(_XIMF_ATT_REF_BOX) + "']").removeAttr("refpanel");
- $("textbox[id='" + $("panel[id='"+ sOldlinkpopup +"']")+ " button").removeAttr("refpanel");
- }
- }
-
- // manage popup of link header
- if(menuitem.hasAttribute(_XIMF_ATT_LINK_POPUP_BOX)){
- var popupset = document.getElementById(menuitem.getAttribute(_XIMF_ATT_LINK_POPUP_BOX));
- var txtbox = document.getElementById(popupset.getAttribute(_XIMF_ATT_REF_BOX));
- txtbox.setAttribute("refpanel",menuitem.getAttribute(_XIMF_ATT_LINK_POPUP_BOX));
- $("textbox[id='" + txtbox.getAttribute("id") + "'] button").attr("refpanel",menuitem.getAttribute(_XIMF_ATT_LINK_POPUP_BOX));
- }
-
- // valid document state
- CheckXimfhdrsSelection();
- }catch(e){
- gConsole.logStringMessage("[ximfmail - OnSelectXimfItem ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- }
-}
-
-/*
- * Update Ximf header selected in menu popup with button
- */
-function ComputeXimfhdrsButtonPopup(button){
- // Add selection and associated values for header from button popup
- try{
- var sXimfValues="";
- var sValues="";
- var sXimfTechnicalValues="";
- var ximfvalue = "";
- var value = "";
- var ximftechnicalvalue="";
- var sContentSeparator = _XIMF_DEFAULT_SEPARATOR;
- var sContenTecSeparator = _XIMF_DEFAULT_SEPARATOR;
- var eltTextbox = document.getElementById(button.getAttribute("ximfreftextbox"));
-
- sXimfValues = eltTextbox.getAttribute(_XIMF_ATT_XVALUE);
- sValues = eltTextbox.value;
- sXimfTechnicalValues = eltTextbox.getAttribute(_XIMF_ATT_TEC_VALUE);
-
- // CheckXimfhdrsSelection for concated values
- if(button.hasAttribute(_XIMF_ATT_CONCAT_ID)){
- var sIds = button.getAttribute(_XIMF_ATT_CONCAT_ID);
- var reg=new RegExp("[+]+", "g");
- var arrayIds = sIds.split(reg);
- for (var i=0; i<arrayIds.length; i++){
- var cElt = document.getElementById(arrayIds[i]);
- if(cElt){
- //
- if(cElt.hasAttribute(_XIMF_ATT_SEPARATOR))
- sContentSeparator = cElt.getAttribute(_XIMF_ATT_SEPARATOR);
- if(cElt.hasAttribute(_XIMF_ATT_TEC_SEPARATOR))
- sContenTecSeparator = cElt.getAttribute(_XIMF_ATT_TEC_SEPARATOR);
-
- //
- if(value == ""){
- value = cElt.getAttribute("label") + sContentSeparator;
- ximfvalue = cElt.getAttribute(_XIMF_ATT_XVALUE) + sContentSeparator;
- ximftechnicalvalue = cElt.getAttribute(_XIMF_ATT_TEC_VALUE) + sContenTecSeparator;
- }else{
- value = value + cElt.getAttribute("label") + sContentSeparator ;
- ximfvalue = ximfvalue + cElt.getAttribute(_XIMF_ATT_XVALUE) + sContentSeparator ;
- ximftechnicalvalue = ximftechnicalvalue + cElt.getAttribute(_XIMF_ATT_TEC_VALUE) + sContenTecSeparator ;
- }
- }
- }
- }
-
- // get default parameters
- if(button.hasAttribute(_XIMF_ATT_SEPARATOR))
- sContentSeparator = button.getAttribute(_XIMF_ATT_SEPARATOR);
-
- if(button.hasAttribute(_XIMF_ATT_TEC_SEPARATOR))
- sContenTecSeparator = button.getAttribute(_XIMF_ATT_TEC_SEPARATOR);
-
- if(sValues != ""){
- sValues = sValues + sContentSeparator + value + button.getAttribute("label");
- sXimfValues = sXimfValues + sContentSeparator + ximfvalue + button.getAttribute(_XIMF_ATT_XVALUE);
- sXimfTechnicalValues = sXimfTechnicalValues + sContenTecSeparator + ximftechnicalvalue + button.getAttribute(_XIMF_ATT_TEC_VALUE);
- }else{
- sValues = value + button.getAttribute("label");
- sXimfValues = ximfvalue + button.getAttribute(_XIMF_ATT_XVALUE);
- sXimfTechnicalValues = ximftechnicalvalue + button.getAttribute(_XIMF_ATT_TEC_VALUE);
- }
-
- // load new values
- eltTextbox.setAttribute(_XIMF_ATT_XVALUE,sXimfValues);
- eltTextbox.value=sValues;
-
- CheckXimfhdrsSelection();
- }catch(e){
- gConsole.logStringMessage("[ximfmail - OnSelectXimfButton ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- }
-}
-
-/*
- * Update Ximf header selected in menu popup with CheckXimfhdrsSelection
- */
-function ComputeXimfhdrsCheckPopup(xulElement){
- //CheckXimfhdrsSelection all selected values and add to ximf box
- try{
- var sXimfValues="";
- var sValues="";
- var sXimfTechnicalValues="";
- var sContentSeparator = _XIMF_DEFAULT_SEPARATOR;
- var sContenTecSeparator = _XIMF_DEFAULT_SEPARATOR;
- var nextElt = null;
- var idTextBox = "";
- var parentElt = null;
- //
- nextElt = xulElement.parentNode;
- var arrayCheckedbox = null;
- while(nextElt){
- if(nextElt.localName == "popup"){
- arrayCheckedbox = $("popup[id='"+nextElt.id+"'] checkbox[class='ximCheckbox'][checked]" );
- //alert("checklist OK !!" + nextElt.id + arrayCheckbox.length);
- // id of parent node
- idTextBox = nextElt.getAttribute('ximfreftextbox');
- parentElt = nextElt;
- // get default parameters
- if(parentElt.hasAttribute(_XIMF_ATT_SEPARATOR))
- sContentSeparator = parentElt.getAttribute(_XIMF_ATT_SEPARATOR);
- if(parentElt.hasAttribute(_XIMF_ATT_TEC_SEPARATOR))
- sContenTecSeparator = parentElt.getAttribute(_XIMF_ATT_TEC_SEPARATOR);
- break;
- }
- nextElt = nextElt.parentNode;
- }
- //alert("arrayCheckedbox.length = " + arrayCheckedbox.length);
- // get value of each checkbox selected
- for( var idx=0 ; idx < arrayCheckedbox.length; ++idx){
- var ximfvalue = "";
- var value = "";
- var ximftechnicalvalue="";
-
- var concatvalue = "";
- var ximfconcatvalue = "";
- var ximfconcattechnicalvalue = "";
-
-
- if(arrayCheckedbox[idx].hasAttribute("label")){
- value = arrayCheckedbox[idx].getAttribute("label");
- }
- if(arrayCheckedbox[idx].hasAttribute(_XIMF_ATT_XVALUE)){
- ximfvalue = arrayCheckedbox[idx].getAttribute(_XIMF_ATT_XVALUE);
- }
- if(arrayCheckedbox[idx].hasAttribute(_XIMF_ATT_TEC_VALUE)){
- ximftechnicalvalue = arrayCheckedbox[idx].getAttribute(_XIMF_ATT_TEC_VALUE);
- }
-
- // search for XIMF ComplexString
- if(arrayCheckedbox[idx].hasAttribute(_XIMF_ATT_CONCAT_ID)){
- var sIds = arrayCheckedbox[idx].getAttribute(_XIMF_ATT_CONCAT_ID);
- var reg=new RegExp("[+]+", "g");
- var arrayIds = sIds.split(reg);
-
- for (var k=0; k<arrayIds.length; ++k) {
- var cElt = document.getElementById(arrayIds[k]);
- if(cElt){
- var sConcatSeparator = _XIMF_DEFAULT_SEPARATOR;
- var sConcatTecSeparator = _XIMF_DEFAULT_SEPARATOR;
- if(cElt.hasAttribute(_XIMF_ATT_SEPARATOR))
- sConcatSeparator = cElt.getAttribute(_XIMF_ATT_SEPARATOR);
- if(cElt.hasAttribute(_XIMF_ATT_TEC_SEPARATOR))
- sConcatTecSeparator = cElt.getAttribute(_XIMF_ATT_TEC_SEPARATOR);
- if(cElt.getAttribute(_XIMF_ATT_XVALUE)){
- if(concatvalue == ""){
- concatvalue = cElt.getAttribute("label") + sConcatSeparator;
- ximfconcatvalue = cElt.getAttribute(_XIMF_ATT_XVALUE) + sConcatSeparator ;
- if(cElt.hasAttribute(_XIMF_ATT_TEC_VALUE)){
- ximfconcattechnicalvalue = cElt.getAttribute(_XIMF_ATT_TEC_VALUE) + sConcatTecSeparator;
- }
- }else{
- concatvalue = concatvalue + cElt.getAttribute("label") + sConcatSeparator;
- ximfconcatvalue = ximfconcatvalue + cElt.getAttribute(_XIMF_ATT_XVALUE) + sConcatSeparator;
- if(cElt.hasAttribute(_XIMF_ATT_TEC_VALUE)){
- ximfconcattechnicalvalue = ximfconcattechnicalvalue + cElt.getAttribute(_XIMF_ATT_TEC_VALUE) + sConcatTecSeparator;
- }
- }
- }
- }
- }
- }
-
- //
- if(sValues != ""){
- sValues = sValues + sContentSeparator + concatvalue + value;
- sXimfValues = sXimfValues + sContentSeparator + ximfconcatvalue + ximfvalue ;
- if(ximfconcattechnicalvalue != "" || ximftechnicalvalue != ""){
- sXimfTechnicalValues = sXimfTechnicalValues + sContenTecSeparator + ximfconcattechnicalvalue + ximftechnicalvalue ;
- }
- }else{
- sValues = concatvalue + value;
- sXimfValues = ximfconcatvalue + ximfvalue;
- if(ximfconcattechnicalvalue != "" || ximftechnicalvalue != ""){
- sXimfTechnicalValues = ximfconcattechnicalvalue + ximftechnicalvalue;
- }
- }
- }
-
- //CheckXimfhdrsSelection for input values
- var arrayTextbox = $("popup[id='"+parentElt.id+"'] textbox[class='ximfInputbox']" );
- //alert("arrayTextbox.length = " + arrayTextbox.length);
- for( var idx=0 ; idx < arrayTextbox.length; ++idx){
- var ximfvalue = "";
- var value = "";
- var concatvalue = "";
- var ximfconcatvalue = "";
-
- // search for XIMF ComplexString
- if(arrayTextbox[idx].hasAttribute(_XIMF_ATT_CONCAT_ID)){
- var sIds = arrayTextbox[idx].getAttribute(_XIMF_ATT_CONCAT_ID);
- var reg=new RegExp("[+]+", "g");
- var arrayIds = sIds.split(reg);
-
- for (var k=0; k<arrayIds.length; ++k) {
- var cElt = document.getElementById(arrayIds[k]);
- if(cElt){
- var sConcatSeparator = _XIMF_DEFAULT_SEPARATOR;
- var sConcatTecSeparator = _XIMF_DEFAULT_SEPARATOR;
- if(cElt.hasAttribute(_XIMF_ATT_SEPARATOR))
- sConcatSeparator = cElt.getAttribute(_XIMF_ATT_SEPARATOR);
- if(cElt.hasAttribute(_XIMF_ATT_TEC_SEPARATOR))
- sConcatTecSeparator = cElt.getAttribute(_XIMF_ATT_TEC_SEPARATOR);
-
- if(cElt.getAttribute("label")){
- if(concatvalue == ""){
- concatvalue = cElt.getAttribute("label") + sConcatSeparator;
- ximfconcatvalue = cElt.getAttribute(_XIMF_ATT_XVALUE) + sConcatSeparator ;
- ximfconcattechnicalvalue = cElt.getAttribute(_XIMF_ATT_TEC_VALUE);
- }else{
- concatvalue = concatvalue + cElt.getAttribute("label") + sConcatSeparator;
- ximfconcatvalue = ximfconcatvalue + cElt.getAttribute(_XIMF_ATT_XVALUE) + sConcatSeparator;
- ximfconcattechnicalvalue = ximfconcattechnicalvalue + sConcatTecSeparator + cElt.getAttribute(_XIMF_ATT_TEC_VALUE) ;
- }
- }
- }
- }
- }
-
- // save edit entry
- var sInValues = arrayTextbox[idx].value;
- var reg=new RegExp("[\n]+", "g");
- var arrayValues = sInValues.split(reg);
- var valuelist = "";
- var valueXimflist = "";
- for (var i=0; i<arrayValues.length; ++i) {
- if(arrayValues[i] != ""){
- if(valuelist == ""){
- valuelist = concatvalue + arrayValues[i];
- valueXimflist = ximfconcatvalue + arrayValues[i];
- }else{
- valuelist = valuelist + sContentSeparator + concatvalue + arrayValues[i];
- valueXimflist = valueXimflist + sContentSeparator + ximfconcatvalue + arrayValues[i];
- }
- }
- }
-
- // add new edit entry
- if(valuelist!=""){
- if(sValues != ""){
- sValues = sValues + sContentSeparator + valuelist;
- sXimfValues = sXimfValues + sContentSeparator + valueXimflist ;
- }else{
- sValues = valuelist;
- sXimfValues = valueXimflist;
- }
- // technical values
- if(ximfconcattechnicalvalue!=""){
- if(sXimfTechnicalValues!=""){
- sXimfTechnicalValues = sXimfTechnicalValues + sContenTecSeparator + ximfconcattechnicalvalue ;
- }else{
- sXimfTechnicalValues = ximfconcattechnicalvalue;
- }
- }
- }
- }
-
- // set values to textbox
- var txt = document.getElementById(idTextBox);
- txt.value = sValues;
- txt.setAttribute("ximfvalue",sXimfValues);
- txt.setAttribute(_XIMF_ATT_TEC_VALUE,sXimfTechnicalValues);
- txt.setAttribute(_XIMF_ATT_SEPARATOR,sContentSeparator);
- txt.setAttribute(_XIMF_ATT_TEC_SEPARATOR,sContenTecSeparator);
- CheckXimfhdrsSelection();
- }catch(e){
- }
-};
-
-
-/*
- * Check elements of panel and update accessibility of elements
- */
-function ComputePanelOfCheckboxSelection(idCheckbox){
- try{
- // get informations of panel
- var pnl = document.getElementById(idCheckbox);
- while(pnl.localName != "panel"){
- pnl = pnl.parentNode;
- }
-
- // check for selected item number
- var nbItems = $(pnl).attr("ximfmaxitem");
- var richitems = $("#" + pnl.id + " richlistbox" ).children("richlistitem");
- var nbchkedboxes = 0;
- for(i=0 ; i<richitems.length; ++i){
- var chk1 = richitems[i].firstElementChild;
- if(chk1.localName == "checkbox"){
- if(chk1.checked){
- var eltsChild = richitems[i].getElementsByTagName("checkbox");
- var cptChk = 0;
- for(j=0 ; j < eltsChild.length; ++j){
- if(eltsChild[j].hasAttribute("checked")) cptChk++;
- }
- nbchkedboxes = nbchkedboxes + cptChk;
- if(cptChk > 1) nbchkedboxes = nbchkedboxes - 1;
-
- // Compstring flag, if true, child value must be filled
- var ximfChild = false;
- if(richitems[i].hasAttribute("ximfchild"))
- if(richitems[i].getAttribute("ximfchild")=="true")
- $(chk1).attr("ximfchild","true");
- }else{
- $(chk1).removeAttr("ximfchild");
- }
- }
- }
-
- var chkboxes = $("#" + pnl.id + " checkbox" );
- // enable/disable items that can be selected
- if(nbchkedboxes < nbItems){
- // other items can be selected
- $(chkboxes).attr("disabled","false");//.removeAttr("disabled");
- for(i=0 ; i<richitems.length; ++i){
- var chk1 = richitems[i].firstElementChild;
- if(chk1.localName == "checkbox"){
- if(!chk1.checked){
-
- var eltsChild = richitems[i].getElementsByTagName("checkbox");
- for(j=0 ; j < eltsChild.length; ++j){
- $(eltsChild[j]).removeAttr("checked");
- $(eltsChild[j]).attr("disabled","true");
- }
- $(chk1).attr("disabled","false");//.removeAttr("disabled");
- }
- }
- }
- }else{
- // max selection is selected, disable others items
- for(i=0 ; i<richitems.length; ++i){
- var chk1 = richitems[i].firstElementChild;
- if(chk1.localName == "checkbox"){
- var eltsChild = richitems[i].getElementsByTagName("checkbox");
- if(!chk1.checked){
- $(chk1).removeAttr("ximfchild");
- for(j=0 ; j < eltsChild.length; ++j){
- $(eltsChild[j]).removeAttr("checked");
- $(eltsChild[j]).attr("disabled","true");
- }
- }else{
- // disable composed items
- if(eltsChild.length > 1){
- var intCpt = 0;
- for(j=0 ; j < eltsChild.length; ++j){
- if(eltsChild[j].hasAttribute("checked")) intCpt++;
- }
- switch(intCpt){
- case 1:
- for(j=0 ; j < eltsChild.length; ++j){
- $(eltsChild[j]).attr("disabled","false");//.removeAttr("disabled");
- }
- chk1.checked = true;
- break;
- case 2:
- for(j=0 ; j < eltsChild.length; ++j){
- if(!eltsChild[j].hasAttribute("checked"))
- $(eltsChild[j]).attr("disabled","true");
- }
- break;
- }
- }
- }
- }
- }
- }
- XimfailComposeCanClose();
- }catch(e){
- gConsole.logStringMessage("[ximfmail - ComputePanelOfCheckboxSelection ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);
- }
-}
-
-
-/*
- * Check item group - more than 1 element must be selected
- */
-function IsAcceptableXimfCompstring(idCompstring){
- try{
- var isAcceptableCompstring = false;
- //
- var siblingElement = document.getElementById(idCompstring).nextElementSibling;
- if(siblingElement){
- if(siblingElement.localName == "textbox"){
- if(siblingElement.value !="") isAcceptableCompstring = true;
- }else{
- // search for textboxes
- var childTxtboxList = siblingElement.getElementsByTagName("textbox");
- for(i=0 ; i<childTxtboxList.length ; ++i){
- if(childTxtboxList[i].value !=""){
- isAcceptableCompstring = true;
- break;
- }
- }
-
- if(!isAcceptableCompstring){
- // search for checkboxes
- var childCheckBoxList = siblingElement.getElementsByTagName("checkbox");
- for(i=0 ; i<childCheckBoxList.length ; ++i){
- if(childCheckBoxList[i].checked){
- isAcceptableCompstring = true;
- break;
- }
- }
- }
- }
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - IsAcceptableXimfCompstring ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);
- }
- return isAcceptableCompstring;
-}
-
-/*
- * Delete all values of ximfmail element
- */
- function EraseAndComputeXimfhdrsTextbox(idTextBox){
- try{
- var eltTextbox = document.getElementById(idTextBox);
-
- // datepicker case
- if(eltTextbox.localName == _XIMF_ELT_DATEPICKER){
- eltTextbox._input.value = "";
- eltTextbox.gPopup.value = null;
- return;
- }
-
- eltTextbox.value = "";
- eltTextbox.setAttribute(_XIMF_ATT_XVALUE,"");
- if(eltTextbox.hasAttribute(_XIMF_ATT_TEC_VALUE)){
- eltTextbox.setAttribute(_XIMF_ATT_TEC_VALUE,"");
- }
-
- // raz panel selections
- $("panel[id='"+ eltTextbox.getAttribute("refpanel")+"'] checkbox").removeAttr("checked");
- $("panel[id='"+ eltTextbox.getAttribute("refpanel")+"'] checkbox").removeAttr("disabled");
- var listTxtbox = $("panel[id='"+ eltTextbox.getAttribute("refpanel")+"'] textbox");
- for(i=0;i<listTxtbox.length;++i)listTxtbox[i].value="";
-
- // delete repanel of linked values
- menu_link = $("panel[id='"+ eltTextbox.getAttribute("refpanel")+"'] menuitem[linkpopupbox]");
- if(menu_link.length > 0){
- for(i=0 ; i<menu_link.length ; ++i) {
- try{
- var popupset = document.getElementById($(menu_link[i]).attr("linkpopupbox"));
- var txtbox = document.getElementById(popupset.getAttribute(_XIMF_ATT_REF_BOX));
- EraseAndComputeXimfhdrsTextbox(popupset.getAttribute(_XIMF_ATT_REF_BOX));
- txtbox.setAttribute("refpanel","");
- $("textbox[id='"+popupset.getAttribute(_XIMF_ATT_REF_BOX)+"'] button").attr("refpanel","");
- }catch(e){}
- }
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - eraseXimfmailTextbox ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);
- }
-}
-
-/*
- * Compute DOM with datas (used to load draft or template message)
-*/
-function ComputeWithForm(ximfMessageAnalyser){
- if (!ximfMessageAnalyser instanceof XimfMessageAnalyser){
- gConsole.logStringMessage("[ximfmail - XimfMsgComposeView - refreshDatas] \n parameter of refreshDatas ust be a XimfMessageAnalyser object");
- return false;
- }
-
- // compute free text type
- // compute time type
- // compute menus type
- try{
- var xheader_dom = $("label[ximfheader]");
-
- for(var idx_xheader_dom=0; idx_xheader_dom<xheader_dom.length; ++idx_xheader_dom){
- var display_box = null;
- try{
- //gConsole.logStringMessage("[ximfmail - XimfMsgComposeView - search value for textbox : " + xheader_dom[idx_xheader_dom].getAttribute("ximfheader"));
- var ximfValue = ximfMessageAnalyser.getHeaderValue(xheader_dom[idx_xheader_dom].getAttribute("ximfheader"));
- if(ximfValue){
- // search for value and complete display box
- var display_box_list = $("textbox[refheader='" + xheader_dom[idx_xheader_dom].getAttribute("id") + "']");
-
- if(!display_box_list) continue;
- for(var i = 0 ; i < display_box_list.length ; ++i){
- if(display_box_list[i].nodeName == "textbox"){
- display_box = display_box_list[i];
- }
- }
- if(!display_box) continue;
-
- // default values
- $(display_box).attr("value",ximfValue);
- $(display_box).attr("ximfvalue",ximfValue);
- $(display_box).attr("tooltiptext",ximfValue);
-
- // menuitem value (ilk, linkpopup...)
- var menu_item = $("panel[id='"+$(display_box).attr("refpanel")+"'] menuitem");
- if(menu_item.length > 0){
- for(var idx_menu_item = 0 ; idx_menu_item < menu_item.length ; ++idx_menu_item){
- try{
- var current_ximfvalue = menu_item[idx_menu_item].getAttribute("ximfvalue");
- var valuemsg = String_trim(ximfValue.toLowerCase());
- var valueref = String_trim(current_ximfvalue.toLowerCase());
- if( valuemsg.indexOf(valueref, 0) != -1 ){
-
- //linkpopup manager
- var linkpopup = menu_item[idx_menu_item].getAttribute("linkpopupbox");
- if(linkpopup){
- var targetpopup = $("panel[id='"+linkpopup+"']");
- $("textbox[id='" + targetpopup[0].getAttribute("ximfreftextbox")+"']").attr("refpanel",linkpopup);
- $("textbox[id='" + targetpopup[0].getAttribute("ximfreftextbox")+"'] button[class*='ximfPopup']").attr("refpanel",linkpopup);
- }
-
- //insert values in textbox
- $(display_box).attr("ximfvalue",current_ximfvalue);
- $(display_box).attr("tooltiptext",menu_item[idx_menu_item].getAttribute("label"));
- display_box.inputField.value = menu_item[idx_menu_item].getAttribute("label");
- //technical value is associated
- try{
- var xtcval = menu_item[idx_menu_item].getAttribute("ximftecvalue");
- if(xtcval){
- display_box.setAttribute("ximftecvalue",xtcval);
- }
- }catch(err){}
- }
- }catch(err){
- gConsole.logStringMessage("[ximfmail - XimfMsgComposeView - refreshDatas ] \n " + err + "\nfile : " + Error().fileName+"\nline : "+err.lineNumber);
- }
- }
- }
-
-
- // checkbox value (ilk, linkpopup...)
- var check_item = $("panel[id='"+$(display_box).attr("refpanel")+"'] checkbox");
- if(check_item.length > 0){
- var newximfvalue = "";
- var newtooltiptex = "";
- var newlabel = "";
- var newximftecvalue = "";
- var xSeparator = $("panel[id='"+$(display_box).attr("refpanel")+"']").attr("ximfseparator");
- var xTecSeparator = $("panel[id='"+$(display_box).attr("refpanel")+"']").attr("ximftecseparator");
- var arrayValue = []
-
- if(xSeparator){
- var reg=new RegExp("["+xSeparator+"]+", "g");
- arrayValue = ximfValue.split(reg);
- }else{
- arrayValue.push(ximfValue);
- }
- for(var idx_arrayValue=0 ; idx_arrayValue<arrayValue.length ; ++idx_arrayValue){
- var isarrayValueAppend = false;
- for(var idx_check_item = 0 ; idx_check_item < check_item.length ; ++idx_check_item){
- try{
- var current_ximfvalue = check_item[idx_check_item].getAttribute("ximfvalue");
- var valuemsg = arrayValue[idx_arrayValue].toLowerCase();
- var valueref = current_ximfvalue.toLowerCase();
- if( valuemsg == valueref){
- isarrayValueAppend = true;
- //
- check_item[idx_check_item].setAttribute("checked",true);
- //linkpopup manager
- var linkpopup = check_item[idx_check_item].getAttribute("linkpopupbox");
- if(linkpopup){
- var targetpopup = $("panel[id='"+linkpopup+"']");
- $("textbox[id='" + targetpopup[0].getAttribute("ximfreftextbox")+"']").attr("refpanel",linkpopup);
- }
-
- // save values
- if(xSeparator && newlabel!=""){
- newlabel += xSeparator + check_item[idx_check_item].getAttribute("label");
- }else{
- newlabel = check_item[idx_check_item].getAttribute("label");
- }
- if(xSeparator && newximfvalue!=""){
- newximfvalue += xSeparator + current_ximfvalue;
- }else{
- newximfvalue = current_ximfvalue;
- }
- if(xSeparator && newtooltiptex!=""){
- newtooltiptex += xSeparator + check_item[idx_check_item].getAttribute("label");
- }else{
- newtooltiptex = check_item[idx_check_item].getAttribute("label");
- }
-
- //technical value is associated
- var xtcval = check_item[idx_check_item].getAttribute("ximftecvalue");
- if(xtcval){
- if(xTecSeparator && newximftecvalue!=""){
- newximftecvalue += xTecSeparator + xtcval;
- }else{
- newximftecvalue = xtcval;
- }
- }
- }
- }catch(err){
- gConsole.logStringMessage("[ximfmail - XimfMsgComposeView - refreshDatas ] \n " + err + "\nfile : " + Error().fileName+"\nline : "+err.lineNumber);
- }
- }
- if(!isarrayValueAppend && arrayValue[idx_arrayValue]!=""){
- if(xSeparator && newlabel!=""){
- newlabel += xSeparator + arrayValue[idx_arrayValue];
- }else{
- newlabel = arrayValue[idx_arrayValue];
- }
- if(xSeparator && newximfvalue!=""){
- newximfvalue += xSeparator + arrayValue[idx_arrayValue];
- }else{
- newximfvalue = arrayValue[idx_arrayValue];
- }
- if(xSeparator && newtooltiptex!=""){
- newtooltiptex += xSeparator + arrayValue[idx_arrayValue];
- }else{
- newtooltiptex = arrayValue[idx_arrayValue];
- }
- }
- }
-
- //insert values in textbox
- if(newximfvalue!="") $(display_box).attr("ximfvalue",newximfvalue);
- if(newtooltiptex!="") $(display_box).attr("tooltiptext",newtooltiptex);
- if(newlabel!="") display_box.inputField.value = newlabel;
- if(newximftecvalue!="") $(display_box).attr("ximftecvalue",newximftecvalue);
- if(xTecSeparator!="") $(display_box).attr("ximftecseparator",xTecSeparator);
- if(xSeparator!="") $(display_box).attr("ximfseparator",xSeparator);
- }
-
- // button value (ilk, linkpopup...)
- var button_item = $("panel[id='"+$(display_box).attr("refpanel")+"'] button");
- if(button_item.length > 0){
- for(var idx_button_item = 0 ; idx_button_item < button_item.length ; ++idx_button_item){
- try{
- var current_ximfvalue = button_item[idx_button_item].getAttribute("ximfvalue");
- if(current_ximfvalue != ""){
- var valuemsg = String_trim(ximfValue.toLowerCase());
- var valueref = String_trim(current_ximfvalue.toLowerCase());
- if( valuemsg.indexOf(valueref, 0) != -1 ){
-
- //linkpopup manager
- var linkpopup = button_item[idx_button_item].getAttribute("linkpopupbox");
- if(linkpopup){
- var targetpopup = $("panel[id='"+linkpopup+"']");
- $("textbox[id='" + targetpopup[0].getAttribute("ximfreftextbox")+"']").attr("refpanel",linkpopup);
- }
-
- //insert values in textbox
- $(display_box).attr("ximfvalue",current_ximfvalue);
- $(display_box).attr("tooltiptext",button_item[idx_button_item].getAttribute("label"));
- display_box.inputField.value = button_item[idx_button_item].getAttribute("label");
-
- //technical value is associated
- try{
- var xtcval = button_item[idx_button_item].getAttribute("ximftecvalue");
- if(xtcval){
- $(display_box).attr("ximftecvalue",xtcval);
- }
- }catch(err){}
- }
- }
- }catch(err){
- gConsole.logStringMessage("[ximfmail - XimfMsgComposeView - refreshDatas ] \n " + err + "\nfile : " + Error().fileName+"\nline : "+err.lineNumber);
- }
- }
- }
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - XimfMsgComposeView - refreshDatas ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);
- }
- }
-
- // load free text values
- xheader_dom = $("textbox[class='ximfEditor']");
- for(var idx_xheader_dom=0; idx_xheader_dom<xheader_dom.length; ++idx_xheader_dom){
- try{
- var oriTxtboxId = xheader_dom[idx_xheader_dom].getAttribute("ximfreftextbox");
- var ximfLabelId = $("textbox[id='"+oriTxtboxId+"']").attr("refheader");
- if(ximfLabelId){
- //gConsole.logStringMessage("[ximfmail - XimfMsgComposeView - search value for freetext :" + $("label[id='"+ximfLabelId+"']").attr("ximfheader")+"\nid ="+ximfLabelId);
- var ximfValue = ximfMessageAnalyser.getHeaderValue($("label[id='"+ximfLabelId+"']").attr("ximfheader"));
- if(ximfValue){
- xheader_dom[idx_xheader_dom].setAttribute("value",ximfValue);
- }
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - XimfMsgComposeView - refreshDatas] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);
- }
- }
-
- // load address values
- xheader_dom = $("ximfaddress");
- for(var idx_xheader_dom=0; idx_xheader_dom<xheader_dom.length; ++idx_xheader_dom){
- try{
- var refHeader = xheader_dom[idx_xheader_dom].getAttribute(_XIMF_ATT_REF_HEADER);
- if(refHeader){
- //gConsole.logStringMessage("[ximfmail - XimfMsgComposeView - search value for freetext :" + $("label[id='"+ximfLabelId+"']").attr("ximfheader")+"\nid ="+ximfLabelId);
- var ximfValue = ximfMessageAnalyser.getHeaderValue($("label[id='"+refHeader+"']").attr("ximfheader"));
- if(ximfValue){
- xheader_dom[idx_xheader_dom].listaddress = ximfValue;
- //alert("load address values \n"+ximfValue+"\n"+xheader_dom[idx_xheader_dom].listaddress);
- }
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - XimfMsgComposeView - refreshDatas] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);
- }
- }
-
- // load datetime values
- xheader_dom = $("textbox[class='ximfDatetime']");
- for(var idx_xheader_dom=0; idx_xheader_dom<xheader_dom.length; ++idx_xheader_dom){
- try{
- var refHeader = xheader_dom[idx_xheader_dom].getAttribute(_XIMF_ATT_REF_HEADER);
- if(refHeader){
- //gConsole.logStringMessage("[ximfmail - XimfMsgComposeView - search value for freetext :" + $("label[id='"+ximfLabelId+"']").attr("ximfheader")+"\nid ="+ximfLabelId);
- var ximfValue = ximfMessageAnalyser.getHeaderValue($("label[id='"+refHeader+"']").attr("ximfheader"));
- if(ximfValue){
- //alert($("label[id='"+refHeader+"']").attr("ximfheader")+" :: "+ximfValue)
- var thisDate = ConvertZTimeToLocal(ximfValue);
- if(!thisDate) thisDate = ximfValue;
- // load date
- xheader_dom[idx_xheader_dom].setAttribute("value",thisDate );
- xheader_dom[idx_xheader_dom].setAttribute("ximfvalue", ximfValue);
- }
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - XimfMsgComposeView - refreshDatas] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);
- }
- }
- CheckXimfhdrsSelection();
- }catch(e){
- gConsole.logStringMessage("[ximfmail - XimfMsgComposeView - refreshDatas] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);
- }
-}
-
-// END COMPUTE FUNCTIONS
-
-
-/*
- * XIMF RULES AND DOM
- */
-function ExecuteXimfHdrsMandatoryRule(){
- var isRuleOk=true;
- /*
- var mandatoriesHdrs = $("label[ximfmandatory='true']");
- for(var i=0; i<mandatoriesHdrs.length; ++i){
- if($("textbox[refheader='"+mandatoriesHdrs[i].getAttribute("id")+"']").attr("ximfvalue") == ""){
- mandatoriesHdrs[i].setAttribute("style","color:red;");
- isRuleOk = false;
- }else{
- mandatoriesHdrs[i].setAttribute("style","color:black;");
- }
- }*/
-
- //color tab container
- var panelHdrs = $("tabpanel[class='ximfpane']");
- for(var idx_panelHdrs = 0 ; idx_panelHdrs < panelHdrs.length ; ++idx_panelHdrs){
- //raz tab element
- idXimfPanel = panelHdrs[idx_panelHdrs].getAttribute("id");
- idXimfTap = "tab" + idXimfPanel;
- var cTab = $("tab[id='"+ idXimfTap +"']");
- cTab[0].removeAttribute("ismandatory");
- // CheckXimfhdrsSelection for mandatory elements
- var mandatoriesHdrs = $("tabpanel[id='"+ idXimfPanel + "'] label[ximfmandatory='true']");
- for(var i=0; i<mandatoriesHdrs.length; ++i){
- if($("textbox[refheader='"+mandatoriesHdrs[i].getAttribute("id")+"']").attr("ximfvalue") == ""){
- mandatoriesHdrs[i].setAttribute("style","color:#b20000;");
- cTab[0].setAttribute("ismandatory","true");
- isRuleOk = false;
- }else{
- mandatoriesHdrs[i].setAttribute("style","color:inherit;");
- }
- }
- }
- return isRuleOk;
-}
-
-/*
- * XIMF RULES AND DOM
- */
-function ExecuteXimfHdrsAssociationRule(){
- var isRuleOk=true;
- var isAlertDisplayed=false;
- var associateArray = gXimfHdrs.getXimfAssociatedHdrArray();
- if(!associateArray) return isRuleOk;
-
- // label to prompt
- // internationalisation
- var sAlertLabel = "";
- try{
- var gBundle = Components.classes["@mozilla.org/intl/stringbundle;1"].getService(Components.interfaces.nsIStringBundleService);
- var stringBundle = gBundle.createBundle("chrome://ximfmail/locale/ximfmail.properties");
- sAlertLabel = stringBundle.GetStringFromName("ximf-association-alert-label");
- }catch(err){sAlertLabel = "Datas will be deleted!"}
-
- var reg=new RegExp("[&]+", "g");
- for(var i=0; i<associateArray.length; ++i){
- var headerRef = $("label[ximfheader='"+associateArray[i]._headerRef+"']").attr("id");
- var valueRef = $("textbox[refheader='"+headerRef+"']").attr("ximfvalue");
-
- var headerName = $("label[ximfheader='"+associateArray[i]._headerName+"']").attr("id");
- var valueName = $("textbox[refheader='"+headerName+"']").attr("ximfvalue");
-
- var tabAssociateValueRef =associateArray[i]._valueRef.split(reg);
- var tabAssociateValueName =associateArray[i]._valueName.split(reg);
-
- var idTextbox = $("textbox[refheader='"+headerName+"']").attr("id");
- var tabItems = $("panel[ximfreftextbox='"+idTextbox+"'] menuitem");// list of menuitems
-
- if(valueRef !=""){
- for(var j=0; j<tabAssociateValueRef.length; ++j){
- if(valueRef == tabAssociateValueRef[j]){
- if(tabAssociateValueName[j].lastIndexOf(valueName) == -1 ){
-
- if(valueName != "" && !isAlertDisplayed){
- // ask for delete datas
- ximfAlert(sAlertLabel);
- isAlertDisplayed = true;
- }
-
- EraseAndComputeXimfhdrsTextbox($("textbox[refheader='"+headerName+"']").attr("id"));
- }
- for(var idx_tabItems=0; idx_tabItems<tabItems.length; ++idx_tabItems){
- if(tabAssociateValueName[j].lastIndexOf(tabItems[idx_tabItems].getAttribute("ximfvalue")) == -1){
- tabItems[idx_tabItems].setAttribute("disabled","true");
- tabItems[idx_tabItems].parentNode.setAttribute("ximfenable","false"); // css style
- }else{
- tabItems[idx_tabItems].removeAttribute("disabled");
- tabItems[idx_tabItems].parentNode.setAttribute("ximfenable","true"); // css style
- }
- }
- }
- }
- }else{
- for(var idx_tabItems=0; idx_tabItems<tabItems.length; ++idx_tabItems){
- tabItems[idx_tabItems].setAttribute("disabled","true");
- tabItems[idx_tabItems].parentNode.setAttribute("ximfenable","false"); // css style
-
- if(valueName != "" && !isAlertDisplayed){
- // ask for delete datas
- ximfAlert(sAlertLabel);
- isAlertDisplayed = true;
- }
- EraseAndComputeXimfhdrsTextbox($("textbox[refheader='"+headerName+"']").attr("id"));
-
- }
- }
- }
- return isRuleOk;
-}
-
-/*
- * XIMF RULES AND DOM : manage default values
- */
-function ExecuteXimfHdrsDefaultValuesRule(){
-
- try{
- // get default value in ximfHdr
- var textboxXimfHdrs = $("textbox[class='XimfTextboxDisplay']");
- for(var i=0; i<textboxXimfHdrs.length; ++i){
- try{
- var refDefaultItemHdr = $("panel[id='" + $(textboxXimfHdrs[i]).attr("refpanel") + "']").attr("ximfdefault");
- if(refDefaultItemHdr && $(textboxXimfHdrs[i]).attr("ximfvalue") == "" ){
- var item = $("#"+refDefaultItemHdr);
- if(item.length > 0){
- $(textboxXimfHdrs[i]).attr("ximfvalue",$(item[0]).attr("ximfvalue"));
- textboxXimfHdrs[i].value = $(item[0]).attr("label");
- var techvalue=$(item[0]).attr("ximftecvalue");
- if(techvalue){
- $(textboxXimfHdrs[i]).attr("ximftecvalue",techvalue);
- }
- }else{
- $(textboxXimfHdrs[i]).attr("ximfvalue",refDefaultItemHdr);
- textboxXimfHdrs[i].value = refDefaultItemHdr;
- }
- }
- }catch(err){}
- }
- }catch(err){
- gConsole.logStringMessage("[ximfmail - ExecuteXimfHdrsDefaultValuesRule ] \n " + err + "\nfile : " + Error().fileName+"\nline : "+err.lineNumber);
- }
-
-
-}
-
-/*
- * Init non generic rules
- * FT 3504
- */
-function InitSpecialXimfRules(){
- try{
- // load special rules
- var specialRulesArray = gXimfHdrs.getSpecialRulesArray();
- for(var i=0 ; i < specialRulesArray.length ; ++i){
- // search for ximf value
- var nameHeader = specialRulesArray[i]._headerName;
- var refHeader = specialRulesArray[i]._headerRef;
- var targetName = specialRulesArray[i]._targetName;
-
- switch(targetName){
- case XIMF_RULE_TARGET_NAME_MANDATORY_HEADERS:
- gConsole.logStringMessage("[ximfmail - InitSpecialXimfRules ] load special rule " + targetName);
- SpecialMandatoryHeaders(nameHeader,refHeader);
- break;
- default: break;
- }
- //alert("refHeader = " + refHeader + "\nnameHeader = " + nameHeader+"\ntargetName = " + targetName);
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - InitSpecialXimfRules ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);
- }
-}
-
-/*
- *
- */
-function AppendESSSecuityLabel (){
- var essArray = gXimfHdrs.getESSSecurityLabelHdrArray();
- if(!essArray) return;
- if(essArray.length <= 0) return;
-
- if(!gSMFields) return;
- try{
- var essLabels = CreateDOMWithXimfInstance(gXimfHdrs.getXimfInstanceResource(),gChromeXslSecurityLabel);
- }catch(e){
- gConsole.logStringMessage("[ximfmail - AppendESSSecuityLabel ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);
- return false;
- }
- try{
- var ximftexboxArray = $("#ximfmailComposeMessageHeadersTablist textbox");
- var ximfhiddenlabelArray = $("#ximfmailComposeMessageHeadersTablist label[class='ximfHiddenHeader']");
- var elt = null;
- for(var i=0 ; i < essArray.length ; ++i){
- // search for ximf value
- var sXimfValue = null;
- var sXimfLabel = null;
- var sXimfSeparator = null;
- var sXimfTecSeparator = null;
- var refHeader = essArray[i]._headerRef;
- var refValue = essArray[i]._valueRef;
- var nameValue = essArray[i]._valueName;
-
- for(var j=0 ; j < ximftexboxArray.length; ++j ){
- var sXimfHeader = $("label[id='" + ximftexboxArray[j].getAttribute(_XIMF_ATT_REF_HEADER) + "']").attr("ximfheader");
-
- if(refHeader == sXimfHeader){
- sXimfValue = ximftexboxArray[j].getAttribute(_XIMF_ATT_XVALUE);
- sXimfSeparator = ximftexboxArray[j].getAttribute(_XIMF_ATT_SEPARATOR);
- break;
- }
-
- //technical header case
- sXimfHeader = $("label[id='" + ximftexboxArray[j].getAttribute(_XIMF_ATT_REF_HEADER) + "']").attr("ximftecheader");
- if(refHeader == sXimfHeader){
- sXimfValue = ximftexboxArray[j].getAttribute(_XIMF_ATT_TEC_VALUE);
- sXimfSeparator = ximftexboxArray[j].getAttribute(_XIMF_ATT_SEPARATOR);
- sXimfLabel = ximftexboxArray[j].getAttribute(_XIMF_ATT_XVALUE);
- sXimfTecSeparator = ximftexboxArray[j].getAttribute(_XIMF_ATT_TEC_SEPARATOR);
- break;
- }
- }
- if(!sXimfValue){
- for(var idx_ximfhiddenlabelArray=0 ; idx_ximfhiddenlabelArray < ximfhiddenlabelArray.length; ++idx_ximfhiddenlabelArray ){
- var sXimfHeader = ximfhiddenlabelArray[idx_ximfhiddenlabelArray].getAttribute("ximfheader");
- if(refHeader == sXimfHeader){
- sXimfValue = ximfhiddenlabelArray[idx_ximfhiddenlabelArray].getAttribute(_XIMF_ATT_XVALUE);
- sXimfSeparator = ximfhiddenlabelArray[idx_ximfhiddenlabelArray].getAttribute(_XIMF_ATT_SEPARATOR);
- break;
- }
- }
- }
-
- //search valueName if refValue defined
- if(refValue){
- var reg=new RegExp("[&]+", "g");
- var arrayRefValue = refValue.split(reg);
- var arrayNameValue = nameValue.split(reg);
- for (var idxArrayRefValue=0; idxArrayRefValue<arrayRefValue.length; ++idxArrayRefValue){
- if(arrayRefValue[idxArrayRefValue] == sXimfValue){
- if (arrayNameValue[idxArrayRefValue]){
- sXimfValue = arrayNameValue[idxArrayRefValue];
- break;
- }
- }
- }
- }
-
- // add label to sign it
- switch(essArray[i]._headerName){
- case "SecurityPolicyIdentifier": //Security Policy Identifier
- //gConsole.logStringMessage("SecurityPolicyIdentifier = "+sXimfValue);
- if(sXimfValue == ""){
- gSMFields.securityClassification = -1;
- gSMFields.privacyMark = "";
- gSMFields.securityCategories = "";
- }else{
- gSMFields.securityPolicyIdentifier = sXimfValue;
- if(essLabels){
- elt = essLabels.childNodes[0].getElementsByTagName("securityPolicyIdentifier");
- elt[0].setAttribute("value",sXimfValue);
- if(sXimfLabel){
- elt[0].setAttribute("label",sXimfLabel);
- }else{
- elt[0].setAttribute("label",sXimfValue);
- }
- }
- }
- break;
- case "SecurityClassification":
- // Security Classification
- // gConsole.logStringMessage("SecurityClassification = "+sXimfValue);
- // values must be 0,1,2,3,4 or 5 (RFC 2634)
- // gConsole.logStringMessage("SecurityCategory = "+sXimfValue);
- if(sXimfValue == ""){ break; }
- if(sXimfValue >= 0 && sXimfValue <= 5){
- gSMFields.securityClassification = sXimfValue;
- if(essLabels){
- elt = essLabels.childNodes[0].getElementsByTagName("securityClassification");
- var item = elt[0].getElementsByTagName("item");
- for(var k=0; k<item.length; ++k){
- if(item[k].getAttribute("value") == sXimfValue){
- item[k].setAttribute("ximf",sXimfLabel);
- }
- }
- }
- }else{
- gSMFields.securityClassification = -1;
- }
- break;
- case "ESSPrivacyMark": // Privacy Mark
- //gConsole.logStringMessage("ESSPrivacyMark = "+sXimfValue);
- gSMFields.privacyMark = sXimfValue;
- if(essLabels){
- elt = essLabels.childNodes[0].getElementsByTagName("privacyMark");
- var item = elt[0].getElementsByTagName("item");
- item[0].setAttribute("value",sXimfValue);
- }
- break;
- case "SecurityCategory":
- // Security Categories
- // format to load : oid|type|value name e.g. 0.0.0|1|value|0.0.0.1|2|value
- var categories = "";
- var regtec = new RegExp("["+sXimfTecSeparator+"]+", "g");
- var reg = new RegExp("["+sXimfSeparator+"]+", "g");
- //var regtec = new RegExp("[;,]+", "g");
-
- if(sXimfValue!=""){
- var tab_XimfValue = sXimfValue.split(regtec);
- if(sXimfLabel){
- var tab_XimfLabel = sXimfLabel.split(reg);
- for(var idx_tab_XimfValue=0; idx_tab_XimfValue<tab_XimfValue.length; ++idx_tab_XimfValue){
- try{
- if(tab_XimfValue[idx_tab_XimfValue]!="" && tab_XimfLabel[idx_tab_XimfValue]!=""){
- if(categories != ""){
- categories += "|";
- }
- //ximftecvalue = "oid,value"
- var regOidValueSep = ","; // FT INT_FT4041 - var regOidValueSep = new RegExp("(,)","g");
- var tmp = tab_XimfValue[idx_tab_XimfValue];
- var oid = tmp.slice(0,tmp.indexOf(regOidValueSep,0));
- var value = tmp.slice(tmp.indexOf(regOidValueSep,0)+1,tmp.length);
- //alert("tmp=" + tmp + "\ntmp.indexOf(regOidValueSep) = " + tmp.indexOf(regOidValueSep)+"\n>>oid = "+oid+"\nvalue = " + value)
-
- if(value){
- var type = null;
-
- if(essLabels){
- var elt = essLabels.childNodes[0].getElementsByTagName("securityCategories");
- //var item = elt[0].getElementsByTagName("item"); // create item...
- // get type form rules definition
- type = $(elt).attr("type");
- if(!type) type = "2"; // fefault value as integer
-
- // add values to xml file
- // <item oid="" type="" value="" label=""/>
- var item = document.createElement("item");
- item.setAttribute("oid",oid);
- item.setAttribute("type",type);
- item.setAttribute("value",value);
- item.setAttribute("label",tab_XimfLabel[idx_tab_XimfValue]);
- $(elt).append(item);
- }
- categories += oid + "|" + type + "|" + value;
- }
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - AppendESSSecuityLabel - SecurityCategory] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);
- }
- }
- }
- }
- if(categories != "")
- gConsole.logStringMessage("SecurityCategories = " + categories);
- gSMFields.securityCategories = categories;
- break;
- default:
- break;
- }
- }
- } catch (e) {
- gConsole.logStringMessage("[ximfmail - AppendESSSecuityLabel ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);
- }
-
- try{
- /*
- // create file es XIMFMAIL_SECURITY_LABEL_XML_FILE
- if(essLabels){
- // create securityLabel directory
- var essfile = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile); // get profile folder
- var serializer = new XMLSerializer();
- var foStream = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);
-
- essfile.append(XIMFMAIL_SECURITY_LABEL_XML_DIR);
- try{essfile.create(essfile.DIRECTORY_TYPE,0);}catch(err){}
- essfile.append(XIMFMAIL_SECURITY_LABEL_XML_FILE);
-
- foStream.init(essfile, 0x02 | 0x08 | 0x20, 0664, 0); // write, create, truncate
- serializer.serializeToStream(essLabels, foStream, ""); // rememeber, doc is the DOM tree
- foStream.close();
- }
- * */
- }catch(e){}
-
-
- try{
- // call external trustedBird functions
- securityLabelSetUIStatusBar(gSMFields.securityPolicyIdentifier, gSMFields.securityClassification);
- if (!gSMFields.signMessage) signMessage();
- }catch(e){}
-}
-
-/*
- * Check for changes to document and allow saving before closing
- */
-function XimfailComposeCanClose(){
- try{
- if(gContentChanged == true) return;
- var charSet = null;
- if(gMsgCompose){
- charSet = gMsgCompose.compFields.characterSet;
- if(!charSet) charSet == msgCompFields.defaultCharacterSet;
- }
- var ximfmailMimeSelection = ReadMimeHeadersSelection( XIMF_ENDLINE, charSet);
- if(ximfmailMimeSelection.length > 0) gContentChanged = true; // used xith ComposeCanClose()
- } catch (e) {
- gConsole.logStringMessage("[ximfmail - XimfailComposeCanClose ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+ e.lineNumber);
- }
-}
-
-/*
- * READ XIMFMAIL DOM SELECTION
- */
-function ReadMimeHeadersSelection( headersSeparator, charSet){
- var sCompleteList="";
-
- // insert XIMF-NAME - name of instance
- var ximfName = DEFAULT_XIMF_NAME;
- if(gXimfCatalog){
- ximfName = gXimfCatalog.getNameInstance(gXimfHdrs.getXimfInstanceResource());
- }
- try{
- // FT INT_FT3970
- if(ximfName.toLowerCase() == SMTP_INSTANCE){
- gConsole.logStringMessage("[ximfmail - ximfmailOnSend ] Send non XIMF message - instance " + ximfName);
- return sCompleteList;
- }
- }catch(e){}
- sCompleteList += EncodeMimeXimfheader(XIMF_NAME_HEADER, ximfName, charSet) + headersSeparator;
-
- // insert XIMF-Version - B4521
- var ximfVersion = DEFAULT_XIMF_VERSION;
- if(gXimfCatalog){
- ximfVersion = gXimfCatalog.getVersionInstance(gXimfHdrs.getXimfInstanceResource());
- }
- sCompleteList += EncodeMimeXimfheader(XIMF_VERSION_HEADER, ximfVersion, charSet) + headersSeparator;
-
-
- // send hidden headers elements
- var arrayValues = $("label[class='ximfHiddenHeader']");
- if(arrayValues){
- for(var idx=0; idx<=arrayValues.length; idx++){
- try {
- if(arrayValues[idx].getAttribute(_XIMF_ATT_XVALUE)){
- sCompleteList += EncodeMimeXimfheader($(arrayValues[idx]).attr("ximfheader"), $(arrayValues[idx]).attr(_XIMF_ATT_XVALUE), charSet) + headersSeparator;
- }
- } catch (e) {
- gConsole.logStringMessage("[ximfmail - ximfmailOnSend ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- }
- }
- }
-
- // send textbox elements
- arrayValues = $("textbox[class='XimfTextboxDisplay']");
- if(arrayValues){
- for(var idx=0; idx<=arrayValues.length; idx++){
- try {
- if($(arrayValues[idx]).attr(_XIMF_ATT_XVALUE)){
- sCompleteList += EncodeMimeXimfheader($("#"+$(arrayValues[idx]).attr(_XIMF_ATT_REF_HEADER)).attr("ximfheader"), $(arrayValues[idx]).attr(_XIMF_ATT_XVALUE), charSet) + headersSeparator;
- if($(arrayValues[idx]).attr(_XIMF_ATT_TEC_VALUE)){
- sCompleteList += EncodeMimeXimfheader($("#"+$(arrayValues[idx]).attr(_XIMF_ATT_REF_HEADER)).attr("ximftecheader"), $(arrayValues[idx]).attr(_XIMF_ATT_TEC_VALUE), charSet) + headersSeparator;
- }
- }
- } catch (e) {
- gConsole.logStringMessage("[ximfmail - ximfmailOnSend ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- }
- }
- }
-
- // send editor elements
- try{
- arrayValues = $("textbox[class='ximfEditor']");
- if(arrayValues){
- for( idx=0; idx<=arrayValues.length; idx++){
- if(arrayValues[idx].value){
- try{
- sCompleteList += EncodeMimeXimfheader($("#"+$(arrayValues[idx]).attr(_XIMF_ATT_REF_HEADER)).attr("ximfheader"), arrayValues[idx].value, charSet) + headersSeparator;
- } catch (e) {
- gConsole.logStringMessage("[ximfmail - ximfmailOnSend ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- }
- }
- }
- }
- }catch(e){
-
- }
-
- // send datetime elements
- try{
- //arrayValues = $("#ximfmailComposeMessagePanel " + _XIMF_ELT_DATEPICKER);
- arrayValues = $("textbox[class='ximfDatetime']");
- if(arrayValues){
- for( idx=0; idx<=arrayValues.length; idx++){
- if(arrayValues[idx].value){
- try{
- sCompleteList += EncodeMimeXimfheader($("#"+$(arrayValues[idx]).attr(_XIMF_ATT_REF_HEADER)).attr("ximfheader"), arrayValues[idx].getAttribute(_XIMF_ATT_XVALUE), charSet) + headersSeparator;
- } catch (e) {
- //alert(e)
- gConsole.logStringMessage("[ximfmail - ximfmailOnSend ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- }
- }
- }
- }
- }catch(e){}
-
- // send ximfaddress elements
- try{
- arrayValues = $("#ximfmailComposeMessagePanel ximfaddress");
- if(arrayValues){
- for( idx=0; idx<=arrayValues.length; idx++){
- if(arrayValues[idx].listaddress != ""){
- try{
- sCompleteList += EncodeMimeXimfheader($("#"+$(arrayValues[idx]).attr(_XIMF_ATT_REF_HEADER)).attr("ximfheader"), arrayValues[idx].listaddress, charSet) + headersSeparator;
-
- } catch (e) {
- gConsole.logStringMessage("[ximfmail - ximfmailOnSend ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- }
- }
- }
- }
- }catch(e){}
- //alert ("getHeadersSelection \n" + sCompleteList);
- return sCompleteList;
-}
-
-
-function ReadXsmptHeadersTranslation(headerValueSeparator, headersSeparator,charSet){
- var sCompleteList = "";
- var xsmtpArray = gXimfHdrs.getXsmtpHdrArray();
- if(!xsmtpArray) return;
- // create mandatory xsmpt headers
- //this.AddMandatoryXsmtpHeader();
- try{
- for(var i=0 ; i < xsmtpArray.length ; ++i){
- if(!xsmtpArray[i]._headerRef){
- sCompleteList += EncodeMimeXimfheader(xsmtpArray[i]._headerName, xsmtpArray[i]._valueName, charSet) + headersSeparator;
- }
- }
- } catch (e) {
- gConsole.logStringMessage("[ximfmail - AddMandatoryXsmtpHeader ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- }
-
- // Copy and convert XIMF headers to XSMTP headers
- var ximftexboxArray = $("textbox[class='XimfTextboxDisplay']["+_XIMF_ATT_XVALUE+"]");
- for(var i = 0 ; i < ximftexboxArray.length; ++i ){
- var sXimfHeader = $("label[class='ximfHeaderLabel'][id='" + ximftexboxArray[i].getAttribute(_XIMF_ATT_REF_HEADER) + "']").attr("ximfheader");
- var sXimfValue = ximftexboxArray[i].getAttribute(_XIMF_ATT_XVALUE);
-
- if(sXimfValue != ""){
- //this.AddXsmtpHeader(sXimfHeader,sXimfValue);
- try{
- for(var j=0 ; j < xsmtpArray.length ; ++j){
- //alert(this._ArrayheadersCompatibility[i]._headerRef +" -- "+ ximfHeader);
-
- if(xsmtpArray[j]._headerRef == sXimfHeader){
- //alert(this._ArrayheadersCompatibility[i]._headerRef +" -- "+ ximfHeader);
- var xvalue = sXimfValue; // default, copy of XIMF value
- // get for values references
- var reg=new RegExp("[&]+", "g");
- if(xsmtpArray[j]._valueRef){
- var arrayValRefs = xsmtpArray[j]._valueRef.split(reg);
- var arrayVals = xsmtpArray[j]._valueName.split(reg);
- for (var k=0; k<arrayValRefs.length; ++k){
- if(arrayValRefs[k] == sXimfValue){
- if (arrayVals[k]){
- xvalue = arrayVals[k];
- break;
- }
- }
- }
- }else{
- if(xsmtpArray[j]._valueName)
- var xvalue = xsmtpArray[j]._valueName; // default, copy of XIMF value
- }
-
- // append line to headers
- sCompleteList += EncodeMimeXimfheader(xsmtpArray[j]._headerName, xvalue, charSet) + headersSeparator;
- }
- }
- } catch (e) {
- gConsole.logStringMessage("[ximfmail - AddXsmtpHeader ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+ e.lineNumber);
- }
- } //if
- }
- return sCompleteList;
-}
-
-/*
- * Security rules are only valid for XIMFMAIL Instances
- */
-function ReloadSecurityAccess(){
- // access secure headers
- gCurrentIdentity.setBoolAttribute("secureheaders.checked",false);
- $("#idItemSecureHeaders_1").removeAttr("checked");
- $("#idItemSecureHeaders_2").removeAttr("checked");
- $("#idItemSecureHeaders_1").removeAttr("disabled");
- $("#idItemSecureHeaders_2").removeAttr("disabled");
- $("#menu_securitySign1").removeAttr("disabled");
- $("#menu_securitySign2").removeAttr("disabled");
-
- // access security label
- $("#menu_securityLabelDialog1").removeAttr("checked");
- $("#menu_securityLabelDialog2").removeAttr("checked");
- $("#menu_securityLabelDialog1").removeAttr("disabled");
- $("#menu_securityLabelDialog2").removeAttr("disabled");
+/* ***** 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
+var gChromeXslMsgCompose = "chrome://theme_ximfmail/content/messengerCompose-ximfmail.xsl";\r
+var gChromeXslSecureHeaders = "chrome://theme_ximfmail/content/secureHeaders-ximfmail.xsl";\r
+var gChromeXslSecurityLabel = "chrome://theme_ximfmail/content/securityLabel-ximfmail.xsl";\r
+var gChomeXulXimfTreeDialog = "chrome://ximfmail/content/dialogTree-ximfmail.xul"; \r
+var gChomeXulXimfCalendarDialog = "chrome://ximfmail/content/calendar/dialogCalendar-ximfmail.xul";\r
+var gChomeXulXimfEditorDialog = "chrome://ximfmail/content/editor/dialogEditor-ximfmail.xul";\r
+\r
+//\r
+function onclosepanel(){\r
+ try{\r
+ //alert('onclosepanel ' + evt.currentTarget.id)\r
+ //var a = document.getElementById("search");\r
+ var lisitem = $("#search-panel checkbox");\r
+ var resString = ""; \r
+ for(i=0;i<lisitem.length;++i){\r
+ if(lisitem[i].hasAttribute("checked"))\r
+ resString += $(lisitem[i]).attr("label")+ " | ";\r
+ }\r
+ var b = document.getElementById("txtpanel");\r
+ b.value = resString;\r
+ }catch(e){\r
+ alert("e = " + e)\r
+ } \r
+}\r
+\r
+\r
+var gXimfHdrs = null; \r
+// \r
+function XimfmailInstanceHeaders(){\r
+ //private:\r
+ var _instance = null; \r
+ var _ximfHdrArray = [];\r
+ var _xsmtpHdrArray = []; \r
+ var _eSSSecurityLabelHdrArray = [];\r
+ var _ximfAssociatedHdrArray = [];\r
+ var _ximfSpecialRulesArray = []; //FT 3504\r
+ \r
+ //public:\r
+ if(typeof XimfmailInstanceHeaders.initialized == "undefined"){ \r
+ //\r
+ XimfmailInstanceHeaders.prototype.init = function(ximfInstanceResource){\r
+ _instance = ximfInstanceResource; \r
+ _xsmtpHdrArray = CreateRulesArray(_instance,"ximf:compatibility");\r
+ _ximfAssociatedHdrArray = CreateRulesArray(_instance, "ximf:association"); \r
+ _ximfSpecialRulesArray = CreateRulesArray(_instance, "ximf:special"); //FT 3504 \r
+ }; \r
+ // \r
+ XimfmailInstanceHeaders.prototype.getXimfInstanceResource = function(){ \r
+ return _instance; \r
+ };\r
+ //\r
+ XimfmailInstanceHeaders.prototype.getXimfHdrArray = function(){ \r
+ return _ximfHdrArray;\r
+ };\r
+ //\r
+ XimfmailInstanceHeaders.prototype.getXsmtpHdrArray = function(){ \r
+ return _xsmtpHdrArray; \r
+ };\r
+ //\r
+ XimfmailInstanceHeaders.prototype.getXimfAssociatedHdrArray = function(){ \r
+ return _ximfAssociatedHdrArray; \r
+ };\r
+ //\r
+ XimfmailInstanceHeaders.prototype.getESSSecurityLabelHdrArray = function(){ \r
+ return _eSSSecurityLabelHdrArray; \r
+ };\r
+ //FT 3504\r
+ XimfmailInstanceHeaders.prototype.getSpecialRulesArray = function(){ \r
+ return _ximfSpecialRulesArray; \r
+ };\r
+ // \r
+ XimfmailInstanceHeaders.prototype.loadXimfSecurityRules = function(){\r
+ var isSigned = false;\r
+ \r
+ // get secure state from prefs\r
+ if (gSMFields) isSigned = gSMFields.signMessage; \r
+\r
+ // secure headers \r
+ try{\r
+ // create XMLFile at temp directory with rules datas\r
+ var secureHdrArray = [];\r
+ secureHdrArray = CreateRulesArray(_instance,"ximf:secureHeaders"); \r
+ if(secureHdrArray.length > 0){\r
+ var signHeaders = CreateDOMWithXimfInstance(_instance,gChromeXslSecureHeaders); \r
+ if(signHeaders){\r
+ var file = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile); // get profile folder\r
+ var serializer = new XMLSerializer();\r
+ var foStream = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);\r
+ \r
+ file.append(XIMFMAIL_SECURE_HEADERS_XML_FILE);\r
+ foStream.init(file, 0x02 | 0x08 | 0x20, 0664, 0); // write, create, truncate\r
+ serializer.serializeToStream(signHeaders, foStream, ""); // rememeber, doc is the DOM tree\r
+ foStream.close();\r
+ \r
+ // set folder datas \r
+ gCurrentIdentity.setCharAttribute("secureheaders.folderdata",file.path);\r
+ \r
+ // sign message with secure headers\r
+ gCurrentIdentity.setBoolAttribute("secureheaders.checked",true);\r
+ $("#idItemSecureHeaders_1").attr("checked","true"); \r
+ $("#idItemSecureHeaders_2").attr("checked","true"); \r
+ $("#idItemSecureHeaders_1").attr("disabled","true");\r
+ $("#idItemSecureHeaders_2").attr("disabled","true"); \r
+ if(!isSigned){\r
+ toggleSignMessage();// signMessage(); // from file msgCompSMIMIEOverlay.js\r
+ isSigned = true;\r
+ } \r
+ $("#menu_securitySign1").attr("disabled","true");\r
+ $("#menu_securitySign2").attr("disabled","true"); \r
+ \r
+ gConsole.logStringMessage("ximfmail - loadSecurityRules - secureHeaders on "); \r
+ }\r
+ }else{\r
+ gConsole.logStringMessage("ximfmail - loadSecurityRules - secureHeaders off ");\r
+ }\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - loadSecurityRules - secureHeaders] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);\r
+ }\r
+ // Security Labels \r
+ try{\r
+ // create XMLFile at temp directory with rules datas\r
+ _eSSSecurityLabelHdrArray = CreateRulesArray(_instance,"ximf:securityLabel");\r
+ if(_eSSSecurityLabelHdrArray.length > 0){ \r
+ $("#menu_securityLabelDialog1").attr("checked","true"); \r
+ $("#menu_securityLabelDialog2").attr("checked","true"); \r
+ $("#menu_securityLabelDialog1").attr("disabled","true");\r
+ $("#menu_securityLabelDialog2").attr("disabled","true");\r
+ \r
+ if(!isSigned){\r
+ toggleSignMessage(); // from file msgCompSMIMIEOverlay.js\r
+ isSigned = true;\r
+ }\r
+ if(gSMFields){\r
+ gSMFields.securityClassification = -1;\r
+ gSMFields.privacyMark = "";\r
+ gSMFields.securityCategories = "";\r
+ }\r
+ gConsole.logStringMessage("ximfmail - loadSecurityRules - securityLabels on "); \r
+ }else{\r
+ gConsole.logStringMessage("ximfmail - loadSecurityRules - securityLabels off "); \r
+ } \r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - loadSecurityRules - securityLabel] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);\r
+ } \r
+ };\r
+ // init object\r
+ XimfmailInstanceHeaders.initialized = true;\r
+ }\r
+}\r
+\r
+//\r
+function XimfDataSource(){\r
+ this._id; // xml file name path\r
+ this._dataSource;\r
+ this._refDataSource; \r
+}\r
+\r
+//\r
+function InsertXimfmailComposer(currentInstance){\r
+ try{\r
+ if(gXimfHdrs){gXimfHdrs = null;}\r
+ \r
+ gXimfHdrs = new XimfmailInstanceHeaders();\r
+ gXimfHdrs.init(currentInstance);\r
+ gXimfHdrs.loadXimfSecurityRules();\r
+ \r
+ // ihm init \r
+ ResetXimfhdrsDom();\r
+ InsertXimfhdrsDom(gXimfHdrs.getXimfInstanceResource(), gChromeXslMsgCompose);\r
+ \r
+ // controler init \r
+ LoadXimfhdrsEventObserver(); \r
+ ExecuteXimfHdrsDefaultValuesRule(); \r
+ InitSpecialXimfRules();\r
+ CheckXimfhdrsSelection();\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - InsertXimfmailComposer ] " + e +"\nline : " + e.lineNumber + " : "+ e + "\nfile : "+ Error().fileName);\r
+ }\r
+}\r
+\r
+/*\r
+ * DOM MANIPULATIONS OF XIMFMAIL ELEMENTS\r
+ */\r
+function ResetXimfhdrsDom(){\r
+ // delete old ximf items\r
+ $("#ximfmailComposeMessageHeadersTablist").empty();\r
+}\r
+ \r
+function InsertXimfhdrsDom(ximfInstanceResource, urlXslTemplate){\r
+ // append to document ximfmail panel ihm \r
+ if(!ximfInstanceResource){\r
+ $("#isUsingXimfail").attr("hidden","true");\r
+ return;\r
+ }\r
+ $("#isUsingXimfail").attr("hidden","false");\r
+ \r
+ if(gXimfCatalog){\r
+ $("#ximfmailComposeMessageTitle").attr("value",gXimfCatalog.getLabelInstance(ximfInstanceResource));\r
+ }else{\r
+ $("#ximfmailComposeMessageTitle").attr("value","XIMFMAIL");\r
+ $("#ximfmailComposeMessageTitle").attr("tooltiptext",ximfInstanceResource);\r
+ } \r
+ \r
+ try{\r
+ // Add XSLT result in MessengerCompose window \r
+ $("#ximfmailComposeMessageHeadersTablist").append(CreateDOMWithXimfInstance(ximfInstanceResource, urlXslTemplate));\r
+ }catch(e){\r
+ // TODO : alert user of xslt problem\r
+ ("#isUsingXimfail").attr("hidden","false");\r
+ } \r
+ \r
+ // custom panels where maxitem=1 and contains composed elements\r
+ var arrPanel = $("panel[ximfmaxitem='1']");\r
+ for(i=0;i<arrPanel.length;++i){ \r
+ // checkboxes are used\r
+ var chkboxes = $("panel[id='"+arrPanel[i].id+"'] checkbox"); \r
+ if(chkboxes.length>=1){ \r
+ var mnuitems = $("panel[id='"+arrPanel[i].id+"'] menuitem");\r
+ for(j=0;j<mnuitems.length;++j){\r
+ var chkbx = document.createElement("checkbox");\r
+ $(chkbx).attr("id",$(mnuitems[j]).attr("id"));\r
+ $(chkbx).attr("label",$(mnuitems[j]).attr("label"));\r
+ $(chkbx).attr("ximfvalue",$(mnuitems[j]).attr("ximfvalue"));\r
+ $(chkbx).attr("ximftextbox",$(mnuitems[j]).attr("ximftextbox"));\r
+ if(mnuitems[j].hasAttribute("ximftecvalue"))$(chkbx).attr("ximftecvalue",$(mnuitems[j]).attr("ximftecvalue"));\r
+ $(mnuitems[j].parentNode).append(chkbx);\r
+ $(mnuitems[j]).remove(); \r
+ }\r
+ }\r
+ \r
+ }\r
+ \r
+ // custom input boxes\r
+ try{ \r
+ var inputPopupList = $("textbox[class='ximfInputbox']");\r
+ for(var i = 0; i < inputPopupList.length; ++i){ \r
+ var padre = inputPopupList[i].parentNode;\r
+ if(padre.nodeName=="popup"){\r
+ padre.setAttribute("position", "overlap");\r
+ //padre.setAttribute("style", "min-width : 250px; background-color:#5cacea; "); //#48a2e7;\r
+ } \r
+ } \r
+ }catch(err){}\r
+ \r
+ // internationalisation of ximfmail context popup\r
+ try{ \r
+ var gBundle = Components.classes["@mozilla.org/intl/stringbundle;1"].getService(Components.interfaces.nsIStringBundleService);\r
+ var stringBundle = gBundle.createBundle("chrome://ximfmail/locale/ximfmail.properties"); \r
+ var contextMenuList = $("menuitem[class='ximfContext']");\r
+ for(var i=0; i<contextMenuList.length; ++i){\r
+ var ilabel = contextMenuList[i].getAttribute("label");\r
+ var sLabel = stringBundle.GetStringFromName(ilabel);\r
+ if(sLabel!=""){\r
+ contextMenuList[i].setAttribute("label",sLabel);\r
+ }\r
+ }\r
+ }catch(err){}\r
+ \r
+ // Custom Ximf Headers Dom\r
+ CustomXimfhdrsInputBox(); \r
+ CustomXimfhdrsButton(); \r
+ CustomXimfhdrsTreeDialog(); // append DOM elements to access external datas \r
+} \r
+\r
+/*\r
+* change ximtextbox elements to edit box\r
+*/\r
+function CustomXimfhdrsInputBox(){ \r
+ var listEditorClass = $("popup > textbox[class='ximfInputbox']");\r
+ for(var i = 0 ; i<listEditorClass.length ; ++i){ \r
+ try{\r
+ var idTxtBox = listEditorClass[i].getAttribute("ximfreftextbox");\r
+ var inputbox = $("textbox[id='"+idTxtBox+"'][class]");\r
+ if(inputbox[0].getAttribute("class") != "ximfDatetime"){ \r
+ var editor_button = $("textbox[id='"+idTxtBox+"']>button");\r
+ editor_button[0].setAttribute("class","ximfmailButtonTxt ximfEditor"); \r
+ editor_button[0].setAttribute("tooltiptext",getIlkProperties("ximfmail.composer.editor.image"));\r
+ editor_button[0].setAttribute("refbox",inputbox[0].getAttribute("id")); \r
+ \r
+ inputbox[0].setAttribute("ximfmaxitems", listEditorClass[i].getAttribute("ximfmaxitems"));\r
+ inputbox[0].setAttribute("ximfminitems", listEditorClass[i].getAttribute("ximfminitems"));\r
+ inputbox[0].setAttribute("ximseparator", listEditorClass[i].getAttribute("ximseparator"));\r
+ inputbox[0].setAttribute("tabindex",parseInt(i, 10)+100);\r
+ inputbox[0].setAttribute("class","ximfEditor"); \r
+ inputbox[0].removeAttribute("popup");\r
+ inputbox[0].removeAttribute("readonly");\r
+ }\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - modifyEditorBox ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber); \r
+ } \r
+ }\r
+ \r
+ try{\r
+ // remove popup of free text\r
+ $("textbox[class='ximfEditor'] ~ popup").remove();\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - CustomXimfhdrsInputBox ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+ e.lineNumber); \r
+ } \r
+} \r
+ \r
+/*\r
+ * Add international tooltiptext to button \r
+ */ \r
+function CustomXimfhdrsButton(){ \r
+ var listCalendarClass = $("button[class*='ximfDatepicker']");\r
+ for(var i = 0 ; i<listCalendarClass.length ; ++i){\r
+ try{ \r
+ listCalendarClass[i].setAttribute("tooltiptext",getIlkProperties("ximfmail.composer.calendar.image"));\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - customizeCalendarBox ] \n " + e + "\nfile : " + Error().fileName+"\nline : " + e.lineNumber); \r
+ } \r
+ } \r
+ var listPopupClass = $("button[class*='ximfPopup']");\r
+ for(var i = 0 ; i<listPopupClass.length ; ++i){\r
+ try{ \r
+ listPopupClass[i].setAttribute("tooltiptext",getIlkProperties("ximfmail.composer.popup.image"));\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - customizeCalendarBox ] \n " + e + "\nfile : " + Error().fileName+"\nline : " + e.lineNumber); \r
+ } \r
+ }\r
+}\r
+\r
+/*\r
+ * Add informations to load ximfTreeDialog\r
+ */ \r
+function CustomXimfhdrsTreeDialog(){ \r
+ var listTreeClass = $("box[class='ximfTreeDialog']"); \r
+ for(var i = 0; i<listTreeClass.length;++i){\r
+ try{\r
+ var idTxtBox = listTreeClass[i].getAttribute("refBox"); \r
+ \r
+ // create DOM element to acces External Tree Dialog \r
+ var data_button = $("textbox[id='"+idTxtBox+"']>button");\r
+ data_button[0].setAttribute("class", "ximfmailButtonTxt ximfTreeDialog");// insert image in DOM\r
+ data_button[0].setAttribute("id","image-"+idTxtBox); \r
+ data_button[0].setAttribute("refBox",idTxtBox);\r
+ data_button[0].setAttribute("refExternal",listTreeClass[i].getAttribute("refExternal"));\r
+ data_button[0].setAttribute("tooltiptext",getIlkProperties("ximfmail.composer.treedlg.image"));\r
+ \r
+ $("textbox[id='"+idTxtBox+"']").attr("refExternal",listTreeClass[i].getAttribute("refExternal"));\r
+ $("textbox[id='"+idTxtBox+"']").attr("refBox",idTxtBox);\r
+ $("textbox[id='"+idTxtBox+"']").removeAttr("popup");\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - createButtonsOfExternDatas ] \n " + e + "\nfile : " + Error().fileName+"\nline : " + e.lineNumber); \r
+ } \r
+ }\r
+} \r
+ \r
+ \r
+/*\r
+ * Switch On / Off Ximf DOM\r
+ */\r
+function ToogleXimfhdrsPanel(){ \r
+ if($("#isShowingXimfail").attr("hidden") == "true"){\r
+ $("#isShowingXimfail").attr("hidden","false");\r
+ $("#ximfmailComposeMessageMaximize").attr("hidden","true"); \r
+ $("#ximfmailComposeMessageMinimize").attr("hidden","false"); \r
+ \r
+ // set focus on first tab\r
+ try{\r
+ var tbox = $("#ximfmailComposeMessageHeadersTablist textbox[class='ximfEditor']"); \r
+ if(tbox){\r
+ $(tbox[0]).click();\r
+ }\r
+ }catch(e){} \r
+ try{ \r
+ var tab = $("#ximfmailComposeMessageHeadersTablist tab");\r
+ if(tab){\r
+ $(tab[0]).click(); \r
+ }\r
+ }catch(e){} \r
+ }else{\r
+ $("#isShowingXimfail").attr("hidden","true");\r
+ $("#ximfmailComposeMessageMaximize").attr("hidden","false"); \r
+ $("#ximfmailComposeMessageMinimize").attr("hidden","true"); \r
+ }\r
+}; \r
+\r
+/*\r
+ * manage DOM elements to send message\r
+ */\r
+function HideSendMessageElements(isToSend){\r
+ if(!isToSend){\r
+ // ihm to unactive sending message\r
+ //$("#ximfmailComposeMessageState").attr("class","ximfmailUnacceptState");\r
+ $("#button-send").attr("disabled", "true"); \r
+ // $("menuitem[key='key_send']").attr("disabled", "true");\r
+ $("#menu_File menuitem[command='cmd_sendNow']").attr("hidden", "true");\r
+ $("#menu_File menuitem[key='key_sendLater']").attr("hidden", "true"); \r
+ }else{\r
+ // ihm to active sending message\r
+ //$("#ximfmailComposeMessageState").attr("class","ximfmailAcceptState");\r
+ $("#button-send").removeAttr("disabled");\r
+ // $("menuitem[key='key_send']").removeAttr("disabled");\r
+ $("#menu_File menuitem[command='cmd_sendNow']").removeAttr("hidden");\r
+ $("#menu_File menuitem[key='key_sendLater']").removeAttr("hidden"); \r
+ }\r
+};\r
+\r
+/*\r
+ * Open Window to select external datas\r
+ */\r
+ var _dataSourceArray = []; // array of ximfHdr : _ximfHdrArray[ximfHdr]\r
+ function OpenTreeDialog(element){\r
+ var keyCat = element.getAttribute("refExternal"); \r
+ var refBox = element.getAttribute("refBox");\r
+ var idxDatasSource = -1;\r
+ var rdfdataSource = null;\r
+ var refRdfdataSource = null; \r
+ \r
+ // get/create RDF sources\r
+ try{ \r
+ for(var idx_dataSourceArray = 0; idx_dataSourceArray < _dataSourceArray.length ; ++idx_dataSourceArray){\r
+ if(keyCat == _dataSourceArray[idx_dataSourceArray]._id){\r
+ idxDatasSource = idx_dataSourceArray;\r
+ //alert("datasource exist : "+_dataSourceArray[idxDatasSource]._id + "idxDatasSource = " + idxDatasSource);\r
+ }\r
+ }\r
+ if(idxDatasSource >= 0){\r
+ //alert("attach datasource "+_dataSourceArray[idxDatasSource]._refDataSource); \r
+ rdfdataSource = _dataSourceArray[idxDatasSource]._dataSource;\r
+ refRdfdataSource = _dataSourceArray[idxDatasSource]._refDataSource;\r
+ }else{ \r
+ // get xml schema from profile instance directory \r
+ var sCompletePath = getFilePathInProfile("extensions/"+gXimfCatalog.getSchemaInstance(gXimfHdrs.getXimfInstanceResource()));\r
+ sCompletePath = sCompletePath.substring(0, sCompletePath.lastIndexOf("\\")+1) + keyCat; \r
+ var dir = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);\r
+ dir.initWithPath( sCompletePath ); \r
+ if(!dir.exists()){return;}\r
+ \r
+ // create and save datasource\r
+ xDataSource = new XimfDataSource();\r
+ xDataSource._id = keyCat; \r
+ var res = CreateRdfDatasSource(sCompletePath);\r
+ rdfdataSource = res._dataSource;\r
+ xDataSource._dataSource = rdfdataSource; \r
+ refRdfdataSource = res._refDataSource;\r
+ xDataSource._refDataSource = refRdfdataSource;\r
+ \r
+ //alert("new datasource "+refRdfdataSource); \r
+ _dataSourceArray.push(xDataSource);\r
+ } \r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - addExternDatas ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+ e.lineNumber); \r
+ }\r
+ \r
+ // push datas to new dialog window \r
+ try{ \r
+ // get informations of datas to load \r
+ var eltTxtBox = document.getElementById(refBox);\r
+ var separator = eltTxtBox.getAttribute(_XIMF_ATT_SEPARATOR) \r
+ //args.push(eltTxtBox.getAttribute(_XIMF_ATT_XVALUE)); \r
+ var header = document.getElementById(eltTxtBox.getAttribute("refheader"));\r
+ \r
+ // set informations of datas to load\r
+ var args = new XimfmailTreedialogArgs(); \r
+ args.dataSource = rdfdataSource;\r
+ args.refdataSource = refRdfdataSource;\r
+ args.title = header.getAttribute("value");\r
+ args.maxItemsSelected = eltTxtBox.getAttribute(_XIMF_ATT_MAX_ITEMS);\r
+ \r
+ // push current selection \r
+ if(eltTxtBox.value){\r
+ try{\r
+ var currentValue = eltTxtBox.value;\r
+ if(args.maxItemsSelected > 1 && separator !="" ){\r
+ var reg = new RegExp("["+separator+"]+", "g"); \r
+ var arrayItems = currentValue.split(reg);\r
+ for(var i=0 ; i<arrayItems.length;++i){\r
+ if(arrayItems[i] != "") args.currentKeys.push(arrayItems[i]); \r
+ }\r
+ }else{\r
+ // \r
+ args.currentKeys.push(currentValue);\r
+ if($(eltTxtBox).attr("tooltiptext")){\r
+ args.currentLabels.push($(eltTxtBox).attr("tooltiptext"));\r
+ }\r
+ }\r
+ }catch(ex){\r
+ gConsole.logStringMessage("[ximfmail - OpenTreeDialogBox_Svc ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber); \r
+ }\r
+ } \r
+ \r
+ // open dialog \r
+ window.openDialog(gChomeXulXimfTreeDialog,"showmore", "chrome,resizable,centerscreen,modal",args);\r
+ \r
+ if(args.retIsCancel){\r
+ gConsole.logStringMessage("[ximfmail - OpenTreeDialogBox_Svc ] selection has been canceled !"); \r
+ return; \r
+ }\r
+ \r
+ // get for user selection\r
+ if(args.retKeys.length > 1){ \r
+ var value = "";\r
+ for(var i=0 ; i < args.retKeys.length ; ++i){\r
+ if(value == ""){\r
+ value = args.retKeys[i];\r
+ }else{\r
+ value = value + separator + args.retKeys[i];\r
+ }\r
+ }\r
+ // set new list values\r
+ eltTxtBox.value = value;\r
+ $(eltTxtBox).attr("ximfvalue",value); \r
+ $(eltTxtBox).attr("tooltiptext",""); \r
+ }else{\r
+ if(args.retKeys[0]){\r
+ eltTxtBox.value = args.retKeys[0];\r
+ $(eltTxtBox).attr("ximfvalue",args.retKeys[0]); // used for mandatories headers control rules\r
+ $(eltTxtBox).attr("tooltiptext",args.retLabels[0]); \r
+ }else{\r
+ eltTxtBox.value = "";\r
+ $(eltTxtBox).attr("ximfvalue",""); \r
+ $(eltTxtBox).attr("tooltiptext",""); \r
+ }\r
+ }\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - addExternDatas ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+ e.lineNumber); \r
+ } \r
+}\r
+\r
+/*\r
+ * Open window to select datetime\r
+ */\r
+function OpenCalendarDialog(button){\r
+ try{\r
+ // get informations of datas to load \r
+ var args = []; \r
+ var idBox = button.getAttribute("refBox");\r
+ var ebox = document.getElementById(idBox);\r
+ args.push(idBox); // args[0] : id de la textbox a enrichir\r
+ args.push(ebox.value); // displayed date\r
+ args.push($("label[id='"+ebox.getAttribute("refheader")+"']").attr("value"));\r
+\r
+ // open dialog \r
+ window.openDialog(gChomeXulXimfCalendarDialog,"showmore", "chrome,resizable,centerscreen,modal",args);\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - openCalendarDialogBox ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+ e.lineNumber); \r
+ } \r
+}\r
+\r
+/*\r
+ * Open window text editor\r
+ */\r
+function OpenEditorDialog(button){\r
+ try{\r
+ var args=[];\r
+ var idBox = button.getAttribute("refbox");\r
+ args.push(idBox);\r
+ \r
+ var ebox = document.getElementById(idBox);\r
+ if(ebox){\r
+ args.push(ebox.value); \r
+ args.push(ebox.getAttribute("ximfseparator")); \r
+ args.push(ebox.getAttribute("ximfmaxitems"));\r
+ args.push(ebox.getAttribute("ximfminitems")); \r
+ args.push($("label[id='"+ebox.getAttribute("refheader")+"']").attr("value"));\r
+ window.openDialog(gChomeXulXimfEditorDialog,"showmore", "chrome,resizable,centerscreen,modal",args);\r
+ }\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - openEditorDialogBox ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+ e.lineNumber); \r
+ }\r
+}\r
+\r
+/*\r
+ * Open window with complete informations of ximf header\r
+ */\r
+function OpenInfoDialog(idBox){ \r
+ // get informations of datas to load \r
+ var args = [];\r
+ var txtBox = document.getElementById(idBox);\r
+ var hLabel = document.getElementById(txtBox.getAttribute("refheader"));\r
+ args.push(hLabel.getAttribute("value")); // args[0] : id de la textbox a enrichir\r
+ args.push(hLabel.getAttribute("ximfheader")); // args[1] : ref du catalogue a charger\r
+ args.push(txtBox.value); // args[2] : titre de la dialogbox\r
+ args.push(txtBox.getAttribute("ximfvalue")); // args[3] : description de la dialogbox \r
+ if(txtBox.hasAttribute("ximfseparator")){\r
+ args.push(txtBox.getAttribute("ximfseparator"));\r
+ }\r
+ // open dialog \r
+ window.openDialog("chrome://ximfmail/content/dialogHdrInfo-ximfmail.xul","showmore", "chrome,resizable,centerscreen,modal",args);\r
+}\r
+// END DOM FUNCTIONS\r
+\r
+/*\r
+ * EVENT MANAGER OF XIMFMAIL ELEMENTS\r
+ */ \r
+function LoadXimfhdrsEventObserver(){ \r
+ // animation on ximfmail panel\r
+ $("#ximfmailComposeMessageMaximize").bind("command",OnClickXimfhdrsBar);\r
+ $("#ximfmailComposeMessageMinimize").bind("command",OnClickXimfhdrsBar);\r
+ $("#ximfmailComposeMessageFocusBar").dblclick(OnClickXimfhdrsBar);\r
+ \r
+ // command events on ximfmail elements \r
+ $("button[class='ximfButton']").bind("command",OnSelectButtonPopup); \r
+ $("menuitem[class='ximfOkSet']").bind("command",OnSelectCheckPopup); \r
+ $("textbox[class='XimfTextboxDisplay']").mouseover(OnHoverTextbox);\r
+ $("menuitem[class='ximfContext']").bind("command",OnSelectContextBox); \r
+ $("button[class*='ximfEraser']").bind("command",OnClickEraser); \r
+ $("button[class*='ximfTreeDialog']").bind("command",OnClickTreeDialogButton);\r
+ $("button[class*='ximfDatepicker']").bind("command",OnClickDatepicker); \r
+ $("textbox[class='ximfEditor']").click(OnXimfhdrsEditor);\r
+ $("textbox[class='ximfEditor']").bind("change",OnCheckXimfhdrsEditor); \r
+ $("button[class*='ximfEditor']").bind("command",OnClickEditorButton);\r
+ \r
+ // get complete information of ximf hdr\r
+ $("button[class*='ximfDetail']").bind("command",function(evt){\r
+ OpenInfoDialog($(evt.currentTarget).attr("refLabel")); \r
+ });\r
+ \r
+ // open panel under ximfmail textbox \r
+ $("button[class*='ximfPopup']").bind("command",function(evt){\r
+ var panel = document.getElementById($(evt.currentTarget).attr("refpanel")); \r
+ $("#"+panel.id+" richlistitem").removeAttr("selected"); \r
+ $("#"+panel.id+" richlistitem").removeAttr("current");\r
+ panel.openPopup(evt.currentTarget.parentNode, "after_start", 0, 0, false, false);\r
+ });\r
+ \r
+ // menuitem selected for 1 entry header \r
+ $("menuitem[class*='ximfItem']").bind("command",function(evt){ \r
+ ComputeXimfhdrsMenuItem(evt.currentTarget); \r
+ var box = document.getElementById($(evt.currentTarget).attr("ximftextbox")); \r
+ document.getElementById($(box).attr("refpanel")).hidePopup();\r
+ }); \r
+ \r
+ // keyboard event on panel \r
+ $("panel").bind("keyup",function(evt){ \r
+ if(evt.keyCode == 13){ \r
+ var panel = evt.currentTarget; \r
+ var richlistitem = $("#" + evt.currentTarget.id + " richlistitem");\r
+ for(i=0;i<richlistitem.length;++i){\r
+ if(richlistitem[i].selected){\r
+ var nodes = richlistitem[i].childNodes;\r
+ for(j=0;j<nodes.length;++j){\r
+ if(nodes[j].localName=="menuitem"){\r
+ ComputeXimfhdrsMenuItem(nodes[j]);\r
+ var box = document.getElementById($(nodes[j]).attr("ximftextbox"));\r
+ XimfailComposeCanClose();\r
+ document.getElementById($(box).attr("refpanel")).hidePopup();\r
+ return;\r
+ }\r
+ } \r
+ }\r
+ }\r
+ document.getElementById(evt.currentTarget.id).hidePopup();\r
+ } \r
+ });\r
+ \r
+ // checkbox panel is selected\r
+ $("panel checkbox").bind("command",function(evt){\r
+ ComputePanelOfCheckboxSelection(evt.currentTarget.id)});\r
+\r
+ // check richlistitem where ximfchild=true (ximf computestring)\r
+ $("panel").bind("popuphiding",function(evt){\r
+ var CompstringItem = $("#" + evt.currentTarget.id + " richlistitem[ximfchild='true']");\r
+ for(i=0; i<CompstringItem.length; ++i){\r
+ var chk1 = CompstringItem[i].firstElementChild;\r
+ if(chk1.localName == "checkbox"){\r
+ if(chk1.checked){ \r
+ if(!IsAcceptableXimfCompstring(chk1.id)){\r
+ chk1.checked = false;\r
+ chk1.removeAttribute("ximfchild");\r
+ ComputePanelOfCheckboxSelection(chk1.id);\r
+ } \r
+ }\r
+ }\r
+ }\r
+ \r
+ });\r
+ \r
+ // panel can accept more than 1 entry for header\r
+ $("panel").bind("popuphidden",function(evt){\r
+ if(parseInt($(evt.currentTarget).attr("ximfmaxitem"), 10) > 1 ){\r
+ // if panel has XIMF multiset implementation, don't compute it\r
+ var multisetPanel = $("#" + evt.currentTarget.id + " button[class='ximfButton']");\r
+ if(multisetPanel.length <=0){\r
+ ComputeXimfhdrsMultivaluePanel(evt.currentTarget.id);\r
+ }\r
+ }else{\r
+ var nbChk = $("#" + evt.currentTarget.id + " checkbox");\r
+ if(nbChk.length > 0 )ComputeXimfhdrsMultivaluePanel(evt.currentTarget.id); \r
+ }\r
+ XimfailComposeCanClose();\r
+ }); \r
+ \r
+ // panel - first entry must be selected before selecting composed item\r
+ $("panel").bind("popupshown",function(evt){\r
+ if(parseInt($(evt.currentTarget).attr("ximfmaxitem"), 10) <= 1 ) return;\r
+ var richitems = $("#" + evt.currentTarget.id + " richlistbox" ).children("richlistitem"); \r
+ for(i=0 ; i<richitems.length; ++i){\r
+ var chk1 = richitems[i].firstElementChild;\r
+ if(chk1.localName == "checkbox"){\r
+ if(!chk1.checked){\r
+ var eltsChild = richitems[i].getElementsByTagName("checkbox"); \r
+ for(j=0 ; j < eltsChild.length; ++j){\r
+ $(eltsChild[j]).attr("disabled","true");\r
+ }\r
+ $(chk1).attr("disabled","false");//.removeAttr("disabled"); \r
+ }\r
+ }\r
+ }\r
+ }); \r
+ \r
+ // remove css style from mouse item selections\r
+ $("#ximfmailComposeMessageHeadersTablist richlistitem").mouseout(function(evt){\r
+ if(evt.currentTarget.hasAttribute("selected"))\r
+ $(evt.currentTarget).removeAttr("selected");\r
+ });\r
+\r
+ // get document tab control, set focus to ximfmail tabbox\r
+ $(document).bind("keypress",function(evt){\r
+ if(evt.keyCode == 9 && evt.target.id=="msgSubject"){ // 9: tabuklation keycode\r
+ if(document.getElementById("ximfmailComposeMessageMinimize").hasAttribute("hidden")){\r
+ $("#ximfmailComposeMessageMaximize").focus();\r
+ }else{\r
+ $("#ximfmailComposeMessageMinimize").focus();\r
+ }\r
+ }\r
+ }); \r
+}; \r
+\r
+function OnClickXimfhdrsBar(evt){\r
+ ToogleXimfhdrsPanel(); \r
+};\r
+\r
+\r
+function OnSelectButtonPopup(evt){\r
+ ComputeXimfhdrsButtonPopup(evt.currentTarget); \r
+};\r
+\r
+function OnSelectCheckPopup(evt){ \r
+ ComputeXimfhdrsCheckPopup(evt.currentTarget); \r
+};\r
+\r
+\r
+function OnClickEraser(evt){ \r
+ EraseAndComputeXimfhdrsTextbox(document.getElementById(evt.currentTarget.id).getAttribute("refValue"), false);\r
+ CheckXimfhdrsSelection();// valid document state\r
+};\r
+ \r
+function OnClickTreeDialogButton(evt){ \r
+ OpenTreeDialog(evt.currentTarget);\r
+ XimfailComposeCanClose();\r
+}; \r
+\r
+function OnClickDatepicker(evt){ \r
+ OpenCalendarDialog(evt.currentTarget);\r
+ XimfailComposeCanClose();\r
+}; \r
+\r
+function OnClickEditorButton(evt){\r
+ OpenEditorDialog(evt.currentTarget);\r
+ CheckXimfhdrsSelection();\r
+ XimfailComposeCanClose();\r
+}; \r
+\r
+\r
+function OnXimfhdrsEditor(evt){ \r
+ var id = evt.currentTarget.id; \r
+ var bx = document.getElementById(id);\r
+ bx.focus(); \r
+};\r
+\r
+\r
+function OnHoverTextbox(evt){\r
+ try{\r
+ elt = evt.currentTarget;\r
+ tooltext = elt.value; \r
+ if(tooltext != ""){ \r
+ elt.setAttribute("tooltiptext",tooltext);\r
+ }else{\r
+ elt.removeAttribute("tooltiptext");\r
+ }\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - OnHoverXimfTextbox ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber); \r
+ }\r
+}\r
+\r
+/*\r
+ * Display context menu Ximfmail\r
+ */\r
+function OnSelectContextBox(evt){\r
+ try{ \r
+ idBox = evt.currentTarget.getAttribute("idbox"); \r
+ var eltTextbox = document.getElementById(idBox);\r
+ switch(parseInt(evt.currentTarget.getAttribute("idx"), 10)){ \r
+ case 1:\r
+ // erase all selected values\r
+ EraseAndComputeXimfhdrsTextbox(eltTextbox.id, true);\r
+ break;\r
+ case 2:\r
+ // display datas of current XIMF header \r
+ if(eltTextbox.value != ""){\r
+ OpenInfoDialog(idBox);\r
+ }\r
+ break; \r
+ default:\r
+ gConsole.logStringMessage("[ximfmail warning OnSelectXimfmailContextBox] \n unknown choice : "+eltTextbox.getAttribute("idx"));\r
+ break;\r
+ }\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - OnSelectXimfmailContextBox ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber); \r
+ }\r
+}\r
+ \r
+function OnCheckXimfhdrsEditor(evt){\r
+ try{\r
+ //alert(evt.currentTarget.id)\r
+ var domElt = evt.currentTarget;\r
+ var maxItems = domElt.getAttribute("ximfmaxitems"); \r
+ var separatorItem = domElt.getAttribute("ximfseparator"); \r
+ var labelHeader = document.getElementById(domElt.getAttribute("refheader")).getAttribute("value"); \r
+ if(maxItems==""){return;} \r
+ var dlgEditorXimf_maxItem_alert = maxItems + " "+ getIlkProperties("ximfmail.dialog.editor.warning.nbrows"); \r
+ var arrayItem = domElt.value.split(separatorItem); \r
+ var nbItems = arrayItem.length;\r
+ if(parseInt(maxItems, 10)<arrayItem.length){\r
+ nbItems = parseInt(maxItems, 10);\r
+ ximfAlert(labelHeader,dlgEditorXimf_maxItem_alert); \r
+ var newvalue = ""; \r
+ for(var i=0 ; i<nbItems ; ++i){\r
+ if(arrayItem[i]!=""){\r
+ if(i==0)\r
+ newvalue = arrayItem[i];\r
+ else\r
+ newvalue += separatorItem + arrayItem[i]; \r
+ } \r
+ }\r
+ domElt.value = newvalue;\r
+ domElt.inputField = newvalue;\r
+ } \r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - OnCheckXimfhdrsEditor ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber); \r
+ }\r
+}\r
+\r
+// END EVENT FUNCTIONS\r
+\r
+\r
+/*\r
+ * COMPUTE XIMFMAIL ELEMENTS AND UPDATE DOM\r
+ */\r
+function CheckXimfhdrsSelection(){ \r
+ try{ \r
+ var isRuleOk=true;\r
+ // apply generic rules \r
+ if(!ExecuteXimfHdrsAssociationRule()){isRuleOk=false; } \r
+ if(!ExecuteXimfHdrsMandatoryRule()){isRuleOk=false; } \r
+ AppendESSSecuityLabel(); \r
+ HideSendMessageElements(isRuleOk); \r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - IsReadyToSend ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber); \r
+ }\r
+}\r
+\r
+/*\r
+ * Update Ximf header selected from multi choice panel\r
+ */\r
+function ComputeXimfhdrsMultivaluePanel(idPanel){\r
+ try{\r
+ var panel = document.getElementById(idPanel);\r
+ var ximfSeparator = $(panel).attr("ximfseparator");\r
+ var ximfTecSeparator = $(panel).attr("ximftecseparator");\r
+ var selectionObject = new Object;\r
+ selectionObject.value = "";\r
+ selectionObject.ximfvalue = "";\r
+ selectionObject.ximftecvalue = ""; \r
+ var listRichBox = panel.getElementsByTagName("richlistbox");\r
+ var childnodes = listRichBox[0].childNodes;\r
+ \r
+ //\r
+ for(var i = 0 ; i < childnodes.length ; i++){ \r
+ if(childnodes[i].localName == "richlistitem"){\r
+ var selectionItem = GetXimfSelectionOfRichlistitem(childnodes[i],ximfSeparator,ximfTecSeparator);\r
+ if(selectionItem){ \r
+ if(selectionItem.value != ""){\r
+ if(selectionObject.value == ""){\r
+ selectionObject.value = selectionItem.value;\r
+ selectionObject.ximfvalue = selectionItem.ximfvalue;\r
+ if(selectionItem.ximftecvalue != "") selectionObject.ximftecvalue = selectionItem.ximftecvalue;\r
+ }else{\r
+ selectionObject.value += ximfSeparator + selectionItem.value;\r
+ selectionObject.ximfvalue += ximfSeparator + selectionItem.ximfvalue;\r
+ if(selectionItem.ximftecvalue != "") selectionObject.ximftecvalue += ximfTecSeparator + selectionItem.ximftecvalue;\r
+ }\r
+ \r
+ }\r
+ }\r
+ }\r
+ }\r
+ \r
+ // save selection to ximfhdr textbox\r
+ var hdrTextbox = document.getElementById($(panel).attr("ximfreftextbox"));\r
+ hdrTextbox.value = selectionObject.value;\r
+ $(hdrTextbox).attr("ximfvalue",selectionObject.ximfvalue); \r
+ $(hdrTextbox).attr("ximfseparator",ximfSeparator);\r
+ if(selectionObject.ximftecvalue != ""){\r
+ $(hdrTextbox).attr("ximftecvalue",selectionObject.ximftecvalue);\r
+ $(hdrTextbox).attr("ximftecseparator",ximfTecSeparator);\r
+ } \r
+ \r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - ComputeXimfhdrsMultivaluePanel ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+ e.lineNumber); \r
+ } \r
+}\r
+\r
+\r
+/*\r
+ * Get XIMF informations of composed element\r
+ */\r
+function GetXimfSelectionOfRichlistitem(richItem,cSeparator,cTecSeparator){\r
+ var selectionObject = new Object;\r
+ selectionObject.value = "";\r
+ selectionObject.ximfvalue = "";\r
+ selectionObject.ximftecvalue = "";\r
+ selectionObject.separator = "";\r
+ selectionObject.tecseparator = "";\r
+ try{\r
+ var childnodes = richItem.childNodes;\r
+ \r
+ // single element to decode\r
+ if(childnodes.length == 1){\r
+ return GetXimfValuesOfRichlistItem(childnodes[0]);\r
+ } \r
+ \r
+ // multi element to decode\r
+ if(!GetXimfValuesOfRichlistItem(childnodes[0])) return selectionObject;\r
+ // create array of user informations\r
+ var arrItems = new Array(); \r
+ for(var i=0 ; i < childnodes.length ; i++){\r
+ if(childnodes[i].localName == "vbox"){\r
+ var childnodes2 = childnodes[i].childNodes; \r
+ for(var j=0 ; j < childnodes2.length ; j++){\r
+ var item = GetXimfValuesOfRichlistItem(childnodes2[j].firstChild);\r
+ if(item){\r
+ arrItems.push(item);\r
+ } \r
+ }\r
+ }\r
+ var item = GetXimfValuesOfRichlistItem(childnodes[i]);\r
+ if(item){\r
+ arrItems.push(item);\r
+ } \r
+ }\r
+ \r
+ // format Ximf informations \r
+ if(arrItems.length > 1){\r
+ for(var i = arrItems.length-1 ; i >= 0 ; --i){\r
+ var cConcatId = arrItems[i].concatid;\r
+ // get element with id cConcatId\r
+ // concat linked values and create formated information\r
+ if(arrItems[i].concatid != arrItems[i].id){\r
+ for(var j = 0 ; j < arrItems.length ; ++j){\r
+ if(arrItems[j].id == cConcatId){\r
+ if(selectionObject.value == ""){ \r
+ selectionObject.value = arrItems[j].value + arrItems[j].separator + arrItems[i].value;\r
+ selectionObject.ximfvalue = arrItems[j].ximfvalue + arrItems[j].separator + arrItems[i].ximfvalue; \r
+ if(arrItems[j].ximftecvalue != "")\r
+ selectionObject.ximftecvalue = arrItems[j].ximftecvalue + arrItems[j].tecseparator + arrItems[i].ximftecvalue;\r
+ }else{\r
+ selectionObject.value += cSeparator + arrItems[j].value + arrItems[j].separator + arrItems[i].value;\r
+ selectionObject.ximfvalue += cSeparator + arrItems[j].ximfvalue + arrItems[j].separator + arrItems[i].ximfvalue; \r
+ if(arrItems[j].ximftecvalue != "")\r
+ selectionObject.ximftecvalue += cTecSeparator + arrItems[j].ximftecvalue + arrItems[j].tecseparator + arrItems[i].ximftecvalue;\r
+ }\r
+ arrItems.splice(i,1); // erase array element\r
+ break; \r
+ }\r
+ }\r
+ }\r
+ }\r
+ }else{\r
+ // case 1 item is used in item selection\r
+ if(arrItems[0].value != ""){\r
+ selectionObject.value += arrItems[0].value;\r
+ selectionObject.ximfvalue += arrItems[0].ximfvalue; \r
+ if(arrItems[0].ximftecvalue != "")\r
+ selectionObject.ximftecvalue += arrItems[0].ximftecvalue;\r
+ } \r
+ } \r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - GetXimfSelectionOfRichlistitem ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber); \r
+ }\r
+ return selectionObject; \r
+}\r
+\r
+/*\r
+ * get iformations of element selected by user \r
+ */\r
+function GetXimfValuesOfRichlistItem(richItem){\r
+ var oItem = new Object;\r
+ oItem.id = "";\r
+ oItem.concatid = "";\r
+ oItem.value = "";\r
+ oItem.ximfvalue = "";\r
+ oItem.ximftecvalue = "";\r
+ oItem.separator = "";\r
+ oItem.tecseparator = "";\r
+ \r
+ try{ \r
+ switch(richItem.localName){\r
+ case "checkbox" :\r
+ if(richItem.hasAttribute("checked")){ \r
+ oItem.value = richItem.getAttribute("label");\r
+ oItem.ximfvalue = richItem.getAttribute("ximfvalue");\r
+ if(richItem.hasAttribute("ximftecvalue")) oItem.ximftecvalue = richItem.getAttribute("ximftecvalue");\r
+ if(richItem.hasAttribute("ximfseparator")) oItem.separator = richItem.getAttribute("ximfseparator");\r
+ if(richItem.hasAttribute("ximftecseparator")) oItem.tecseparator = richItem.getAttribute("ximftecseparator");\r
+ if(richItem.hasAttribute("id")) oItem.id = richItem.getAttribute("id");\r
+ if(richItem.hasAttribute("ximfconcatid")) oItem.concatid = richItem.getAttribute("ximfconcatid"); \r
+ } \r
+ break;\r
+ case "textbox" :\r
+ if(richItem.value != ""){ \r
+ oItem.value = richItem.value;\r
+ oItem.ximfvalue = richItem.value; \r
+ if(richItem.hasAttribute("ximfseparator")) oItem.separator = richItem.getAttribute("ximfseparator"); \r
+ if(richItem.hasAttribute("id")) oItem.id = richItem.getAttribute("id");\r
+ if(richItem.hasAttribute("ximfconcatid")) oItem.concatid = richItem.getAttribute("ximfconcatid");\r
+ } \r
+ break;\r
+ }\r
+ \r
+ if(oItem.value == "") oItem = null;\r
+ \r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - GetXimfSelectionOfRichlistitem ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber); \r
+ }\r
+ return oItem; \r
+}\r
+\r
+/*\r
+ * Update Ximf header selected from single choice panel\r
+ */\r
+function ComputeXimfhdrsMenuItem(menuitem){\r
+ try{\r
+ var iMaxItems = 0;\r
+ var sXimfseparator = _XIMF_DEFAULT_SEPARATOR;\r
+ var eltTextbox = document.getElementById(menuitem.getAttribute("ximftextbox")); \r
+ \r
+ // CheckXimfhdrsSelection for list with finished elements number\r
+ if(eltTextbox.hasAttribute(_XIMF_ATT_MAX_ITEMS) ){\r
+ iMaxItems = parseInt(eltTextbox.getAttribute(_XIMF_ATT_MAX_ITEMS),10);\r
+ }\r
+ \r
+ // CheckXimfhdrsSelection for separator value \r
+ if(eltTextbox.hasAttribute(_XIMF_ATT_SEPARATOR) ){\r
+ sXimfseparator = eltTextbox.getAttribute(_XIMF_ATT_SEPARATOR);\r
+ }\r
+ \r
+ // CheckXimfhdrsSelection for concated values\r
+ var sConcatVal="";\r
+ var sConcatXimfVal="";\r
+ var sConcatTecVal="";\r
+ var sContentSeparator = _XIMF_DEFAULT_SEPARATOR; \r
+ var sContenTecSeparator = _XIMF_DEFAULT_SEPARATOR;\r
+ if(menuitem.hasAttribute(_XIMF_ATT_CONCAT_ID)){ \r
+ //\r
+ if(menuitem.hasAttribute(_XIMF_ATT_SEPARATOR)){\r
+ sContentSeparator = menuitem.getAttribute(_XIMF_ATT_SEPARATOR);\r
+ }else{\r
+ if(menuitem.parentNode.hasAttribute(_XIMF_ATT_SEPARATOR)){\r
+ sContentSeparator = menuitem.parentNode.getAttribute(_XIMF_ATT_SEPARATOR); \r
+ }\r
+ } \r
+ //\r
+ if(menuitem.hasAttribute(_XIMF_ATT_TEC_SEPARATOR)){\r
+ sContenTecSeparator = menuitem.getAttribute(_XIMF_ATT_TEC_SEPARATOR);\r
+ }else{\r
+ if(menuitem.parentNode.hasAttribute(_XIMF_ATT_TEC_SEPARATOR)){\r
+ sContenTecSeparator = menuitem.parentNode.getAttribute(_XIMF_ATT_TEC_SEPARATOR); \r
+ }\r
+ }\r
+ \r
+ var sIds = menuitem.getAttribute(_XIMF_ATT_CONCAT_ID);\r
+ var reg=new RegExp("[+]+", "g");\r
+ var arrayIds = sIds.split(reg);\r
+ for (var i=0; i<arrayIds.length; i++) {\r
+ try{ \r
+ var cElt = document.getElementById(arrayIds[i]);\r
+ if(cElt){\r
+ if(sConcatVal == ""){ \r
+ sConcatVal = cElt.getAttribute("label");\r
+ sConcatXimfVal = cElt.getAttribute(_XIMF_ATT_XVALUE);\r
+ sConcatTecVal = cElt.getAttribute(_XIMF_ATT_TEC_VALUE);\r
+ }else{\r
+ sConcatVal = sConcatVal + sContentSeparator + cElt.getAttribute("label");\r
+ sConcatXimfVal = sConcatXimfVal + sContentSeparator + cElt.getAttribute(_XIMF_ATT_XVALUE);\r
+ sConcatTecVal = sConcatTecVal + sContenTecSeparator + cElt.getAttribute(_XIMF_ATT_TEC_VALUE);\r
+ }\r
+ }\r
+ }catch(e){}\r
+ }\r
+ }\r
+ \r
+ // replace existing value if exits \r
+ var sOldximfvalue = eltTextbox.getAttribute(_XIMF_ATT_XVALUE);\r
+ eltTextbox.value = sConcatVal + menuitem.getAttribute("label"); \r
+ eltTextbox.setAttribute(_XIMF_ATT_XVALUE, sConcatXimfVal + menuitem.getAttribute(_XIMF_ATT_XVALUE));\r
+ \r
+ // watch for technical value\r
+ if(menuitem.hasAttribute(_XIMF_ATT_TEC_VALUE)){ \r
+ eltTextbox.setAttribute(_XIMF_ATT_TEC_VALUE, sConcatTecVal + menuitem.getAttribute(_XIMF_ATT_TEC_VALUE));\r
+ }\r
+ \r
+ //erase old linkPopup case and new selection\r
+ if(sOldximfvalue!=""){\r
+ if(sOldximfvalue != menuitem.getAttribute(_XIMF_ATT_XVALUE)){ \r
+ var sOldlinkpopup = $("panel[id='"+ eltTextbox.getAttribute("refpanel")+"'] menuitem[ximfvalue='"+sOldximfvalue+"']").attr(_XIMF_ATT_LINK_POPUP_BOX);\r
+ EraseAndComputeXimfhdrsTextbox($("panel[id='"+ sOldlinkpopup +"']").attr(_XIMF_ATT_REF_BOX));\r
+ // delete popup link in textbox\r
+ $("textbox[id='" + $("panel[id='"+ sOldlinkpopup +"']").attr(_XIMF_ATT_REF_BOX) + "']").removeAttr("refpanel");\r
+ $("textbox[id='" + $("panel[id='"+ sOldlinkpopup +"']")+ " button").removeAttr("refpanel");\r
+ } \r
+ } \r
+ \r
+ // manage popup of link header\r
+ if(menuitem.hasAttribute(_XIMF_ATT_LINK_POPUP_BOX)){ \r
+ var popupset = document.getElementById(menuitem.getAttribute(_XIMF_ATT_LINK_POPUP_BOX));\r
+ var txtbox = document.getElementById(popupset.getAttribute(_XIMF_ATT_REF_BOX));\r
+ txtbox.setAttribute("refpanel",menuitem.getAttribute(_XIMF_ATT_LINK_POPUP_BOX));\r
+ $("textbox[id='" + txtbox.getAttribute("id") + "'] button").attr("refpanel",menuitem.getAttribute(_XIMF_ATT_LINK_POPUP_BOX)); \r
+ } \r
+ \r
+ // valid document state\r
+ CheckXimfhdrsSelection(); \r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - OnSelectXimfItem ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber); \r
+ } \r
+}\r
+\r
+/*\r
+ * Update Ximf header selected in menu popup with button\r
+ */\r
+function ComputeXimfhdrsButtonPopup(button){\r
+ // Add selection and associated values for header from button popup \r
+ try{\r
+ var sXimfValues="";\r
+ var sValues=""; \r
+ var sXimfTechnicalValues="";\r
+ var ximfvalue = "";\r
+ var value = "";\r
+ var ximftechnicalvalue="";\r
+ var sContentSeparator = _XIMF_DEFAULT_SEPARATOR; \r
+ var sContenTecSeparator = _XIMF_DEFAULT_SEPARATOR; \r
+ var eltTextbox = document.getElementById(button.getAttribute("ximfreftextbox"));\r
+ \r
+ sXimfValues = eltTextbox.getAttribute(_XIMF_ATT_XVALUE);\r
+ sValues = eltTextbox.value;\r
+ sXimfTechnicalValues = eltTextbox.getAttribute(_XIMF_ATT_TEC_VALUE);\r
+ \r
+ // CheckXimfhdrsSelection for concated values \r
+ if(button.hasAttribute(_XIMF_ATT_CONCAT_ID)){ \r
+ var sIds = button.getAttribute(_XIMF_ATT_CONCAT_ID);\r
+ var reg=new RegExp("[+]+", "g");\r
+ var arrayIds = sIds.split(reg);\r
+ for (var i=0; i<arrayIds.length; i++){ \r
+ var cElt = document.getElementById(arrayIds[i]); \r
+ if(cElt){\r
+ //\r
+ if(cElt.hasAttribute(_XIMF_ATT_SEPARATOR))\r
+ sContentSeparator = cElt.getAttribute(_XIMF_ATT_SEPARATOR);\r
+ if(cElt.hasAttribute(_XIMF_ATT_TEC_SEPARATOR))\r
+ sContenTecSeparator = cElt.getAttribute(_XIMF_ATT_TEC_SEPARATOR);\r
+\r
+ //\r
+ if(value == ""){ \r
+ value = cElt.getAttribute("label") + sContentSeparator;\r
+ ximfvalue = cElt.getAttribute(_XIMF_ATT_XVALUE) + sContentSeparator;\r
+ ximftechnicalvalue = cElt.getAttribute(_XIMF_ATT_TEC_VALUE) + sContenTecSeparator;\r
+ }else{\r
+ value = value + cElt.getAttribute("label") + sContentSeparator ;\r
+ ximfvalue = ximfvalue + cElt.getAttribute(_XIMF_ATT_XVALUE) + sContentSeparator ;\r
+ ximftechnicalvalue = ximftechnicalvalue + cElt.getAttribute(_XIMF_ATT_TEC_VALUE) + sContenTecSeparator ;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ \r
+ // get default parameters\r
+ if(button.hasAttribute(_XIMF_ATT_SEPARATOR))\r
+ sContentSeparator = button.getAttribute(_XIMF_ATT_SEPARATOR);\r
+ \r
+ if(button.hasAttribute(_XIMF_ATT_TEC_SEPARATOR))\r
+ sContenTecSeparator = button.getAttribute(_XIMF_ATT_TEC_SEPARATOR); \r
+ \r
+ if(sValues != ""){\r
+ sValues = sValues + sContentSeparator + value + button.getAttribute("label"); \r
+ sXimfValues = sXimfValues + sContentSeparator + ximfvalue + button.getAttribute(_XIMF_ATT_XVALUE);\r
+ sXimfTechnicalValues = sXimfTechnicalValues + sContenTecSeparator + ximftechnicalvalue + button.getAttribute(_XIMF_ATT_TEC_VALUE);\r
+ }else{\r
+ sValues = value + button.getAttribute("label");\r
+ sXimfValues = ximfvalue + button.getAttribute(_XIMF_ATT_XVALUE);\r
+ sXimfTechnicalValues = ximftechnicalvalue + button.getAttribute(_XIMF_ATT_TEC_VALUE);\r
+ } \r
+ \r
+ // load new values\r
+ eltTextbox.setAttribute(_XIMF_ATT_XVALUE,sXimfValues);\r
+ eltTextbox.value=sValues;\r
+ \r
+ CheckXimfhdrsSelection();\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - OnSelectXimfButton ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber); \r
+ }\r
+}\r
+\r
+/*\r
+ * Update Ximf header selected in menu popup with CheckXimfhdrsSelection\r
+ */\r
+function ComputeXimfhdrsCheckPopup(xulElement){\r
+ //CheckXimfhdrsSelection all selected values and add to ximf box\r
+ try{\r
+ var sXimfValues="";\r
+ var sValues="";\r
+ var sXimfTechnicalValues="";\r
+ var sContentSeparator = _XIMF_DEFAULT_SEPARATOR; \r
+ var sContenTecSeparator = _XIMF_DEFAULT_SEPARATOR;\r
+ var nextElt = null;\r
+ var idTextBox = "";\r
+ var parentElt = null;\r
+ //\r
+ nextElt = xulElement.parentNode; \r
+ var arrayCheckedbox = null;\r
+ while(nextElt){\r
+ if(nextElt.localName == "popup"){ \r
+ arrayCheckedbox = $("popup[id='"+nextElt.id+"'] checkbox[class='ximCheckbox'][checked]" ); \r
+ //alert("checklist OK !!" + nextElt.id + arrayCheckbox.length);\r
+ // id of parent node\r
+ idTextBox = nextElt.getAttribute('ximfreftextbox'); \r
+ parentElt = nextElt;\r
+ // get default parameters\r
+ if(parentElt.hasAttribute(_XIMF_ATT_SEPARATOR))\r
+ sContentSeparator = parentElt.getAttribute(_XIMF_ATT_SEPARATOR);\r
+ if(parentElt.hasAttribute(_XIMF_ATT_TEC_SEPARATOR))\r
+ sContenTecSeparator = parentElt.getAttribute(_XIMF_ATT_TEC_SEPARATOR); \r
+ break;\r
+ }\r
+ nextElt = nextElt.parentNode;\r
+ }\r
+ //alert("arrayCheckedbox.length = " + arrayCheckedbox.length);\r
+ // get value of each checkbox selected\r
+ for( var idx=0 ; idx < arrayCheckedbox.length; ++idx){\r
+ var ximfvalue = "";\r
+ var value = "";\r
+ var ximftechnicalvalue=""; \r
+ \r
+ var concatvalue = "";\r
+ var ximfconcatvalue = "";\r
+ var ximfconcattechnicalvalue = "";\r
+ \r
+ \r
+ if(arrayCheckedbox[idx].hasAttribute("label")){\r
+ value = arrayCheckedbox[idx].getAttribute("label");\r
+ }\r
+ if(arrayCheckedbox[idx].hasAttribute(_XIMF_ATT_XVALUE)){\r
+ ximfvalue = arrayCheckedbox[idx].getAttribute(_XIMF_ATT_XVALUE);\r
+ } \r
+ if(arrayCheckedbox[idx].hasAttribute(_XIMF_ATT_TEC_VALUE)){\r
+ ximftechnicalvalue = arrayCheckedbox[idx].getAttribute(_XIMF_ATT_TEC_VALUE);\r
+ } \r
+ \r
+ // search for XIMF ComplexString \r
+ if(arrayCheckedbox[idx].hasAttribute(_XIMF_ATT_CONCAT_ID)){\r
+ var sIds = arrayCheckedbox[idx].getAttribute(_XIMF_ATT_CONCAT_ID);\r
+ var reg=new RegExp("[+]+", "g");\r
+ var arrayIds = sIds.split(reg);\r
+ \r
+ for (var k=0; k<arrayIds.length; ++k) { \r
+ var cElt = document.getElementById(arrayIds[k]);\r
+ if(cElt){\r
+ var sConcatSeparator = _XIMF_DEFAULT_SEPARATOR;\r
+ var sConcatTecSeparator = _XIMF_DEFAULT_SEPARATOR;\r
+ if(cElt.hasAttribute(_XIMF_ATT_SEPARATOR))\r
+ sConcatSeparator = cElt.getAttribute(_XIMF_ATT_SEPARATOR);\r
+ if(cElt.hasAttribute(_XIMF_ATT_TEC_SEPARATOR))\r
+ sConcatTecSeparator = cElt.getAttribute(_XIMF_ATT_TEC_SEPARATOR);\r
+ if(cElt.getAttribute(_XIMF_ATT_XVALUE)){ \r
+ if(concatvalue == ""){ \r
+ concatvalue = cElt.getAttribute("label") + sConcatSeparator;\r
+ ximfconcatvalue = cElt.getAttribute(_XIMF_ATT_XVALUE) + sConcatSeparator ;\r
+ if(cElt.hasAttribute(_XIMF_ATT_TEC_VALUE)){\r
+ ximfconcattechnicalvalue = cElt.getAttribute(_XIMF_ATT_TEC_VALUE) + sConcatTecSeparator;\r
+ }\r
+ }else{\r
+ concatvalue = concatvalue + cElt.getAttribute("label") + sConcatSeparator;\r
+ ximfconcatvalue = ximfconcatvalue + cElt.getAttribute(_XIMF_ATT_XVALUE) + sConcatSeparator;\r
+ if(cElt.hasAttribute(_XIMF_ATT_TEC_VALUE)){\r
+ ximfconcattechnicalvalue = ximfconcattechnicalvalue + cElt.getAttribute(_XIMF_ATT_TEC_VALUE) + sConcatTecSeparator;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ \r
+ // \r
+ if(sValues != ""){\r
+ sValues = sValues + sContentSeparator + concatvalue + value; \r
+ sXimfValues = sXimfValues + sContentSeparator + ximfconcatvalue + ximfvalue ;\r
+ if(ximfconcattechnicalvalue != "" || ximftechnicalvalue != ""){\r
+ sXimfTechnicalValues = sXimfTechnicalValues + sContenTecSeparator + ximfconcattechnicalvalue + ximftechnicalvalue ;\r
+ }\r
+ }else{\r
+ sValues = concatvalue + value; \r
+ sXimfValues = ximfconcatvalue + ximfvalue;\r
+ if(ximfconcattechnicalvalue != "" || ximftechnicalvalue != ""){ \r
+ sXimfTechnicalValues = ximfconcattechnicalvalue + ximftechnicalvalue;\r
+ }\r
+ }\r
+ }\r
+ \r
+ //CheckXimfhdrsSelection for input values\r
+ var arrayTextbox = $("popup[id='"+parentElt.id+"'] textbox[class='ximfInputbox']" ); \r
+ //alert("arrayTextbox.length = " + arrayTextbox.length);\r
+ for( var idx=0 ; idx < arrayTextbox.length; ++idx){\r
+ var ximfvalue = "";\r
+ var value = ""; \r
+ var concatvalue = "";\r
+ var ximfconcatvalue = ""; \r
+ \r
+ // search for XIMF ComplexString \r
+ if(arrayTextbox[idx].hasAttribute(_XIMF_ATT_CONCAT_ID)){\r
+ var sIds = arrayTextbox[idx].getAttribute(_XIMF_ATT_CONCAT_ID);\r
+ var reg=new RegExp("[+]+", "g");\r
+ var arrayIds = sIds.split(reg);\r
+ \r
+ for (var k=0; k<arrayIds.length; ++k) { \r
+ var cElt = document.getElementById(arrayIds[k]);\r
+ if(cElt){\r
+ var sConcatSeparator = _XIMF_DEFAULT_SEPARATOR;\r
+ var sConcatTecSeparator = _XIMF_DEFAULT_SEPARATOR;\r
+ if(cElt.hasAttribute(_XIMF_ATT_SEPARATOR))\r
+ sConcatSeparator = cElt.getAttribute(_XIMF_ATT_SEPARATOR);\r
+ if(cElt.hasAttribute(_XIMF_ATT_TEC_SEPARATOR))\r
+ sConcatTecSeparator = cElt.getAttribute(_XIMF_ATT_TEC_SEPARATOR);\r
+ \r
+ if(cElt.getAttribute("label")){ \r
+ if(concatvalue == ""){ \r
+ concatvalue = cElt.getAttribute("label") + sConcatSeparator;\r
+ ximfconcatvalue = cElt.getAttribute(_XIMF_ATT_XVALUE) + sConcatSeparator ;\r
+ ximfconcattechnicalvalue = cElt.getAttribute(_XIMF_ATT_TEC_VALUE);\r
+ }else{\r
+ concatvalue = concatvalue + cElt.getAttribute("label") + sConcatSeparator;\r
+ ximfconcatvalue = ximfconcatvalue + cElt.getAttribute(_XIMF_ATT_XVALUE) + sConcatSeparator;\r
+ ximfconcattechnicalvalue = ximfconcattechnicalvalue + sConcatTecSeparator + cElt.getAttribute(_XIMF_ATT_TEC_VALUE) ;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ \r
+ // save edit entry \r
+ var sInValues = arrayTextbox[idx].value;\r
+ var reg=new RegExp("[\n]+", "g");\r
+ var arrayValues = sInValues.split(reg);\r
+ var valuelist = ""; \r
+ var valueXimflist = "";\r
+ for (var i=0; i<arrayValues.length; ++i) { \r
+ if(arrayValues[i] != ""){\r
+ if(valuelist == ""){ \r
+ valuelist = concatvalue + arrayValues[i];\r
+ valueXimflist = ximfconcatvalue + arrayValues[i]; \r
+ }else{\r
+ valuelist = valuelist + sContentSeparator + concatvalue + arrayValues[i];\r
+ valueXimflist = valueXimflist + sContentSeparator + ximfconcatvalue + arrayValues[i];\r
+ }\r
+ } \r
+ } \r
+ \r
+ // add new edit entry \r
+ if(valuelist!=""){\r
+ if(sValues != ""){\r
+ sValues = sValues + sContentSeparator + valuelist; \r
+ sXimfValues = sXimfValues + sContentSeparator + valueXimflist ; \r
+ }else{\r
+ sValues = valuelist; \r
+ sXimfValues = valueXimflist;\r
+ }\r
+ // technical values\r
+ if(ximfconcattechnicalvalue!=""){\r
+ if(sXimfTechnicalValues!=""){\r
+ sXimfTechnicalValues = sXimfTechnicalValues + sContenTecSeparator + ximfconcattechnicalvalue ;\r
+ }else{\r
+ sXimfTechnicalValues = ximfconcattechnicalvalue;\r
+ }\r
+ }\r
+ }\r
+ } \r
+ \r
+ // set values to textbox\r
+ var txt = document.getElementById(idTextBox);\r
+ txt.value = sValues;\r
+ txt.setAttribute("ximfvalue",sXimfValues);\r
+ txt.setAttribute(_XIMF_ATT_TEC_VALUE,sXimfTechnicalValues); \r
+ txt.setAttribute(_XIMF_ATT_SEPARATOR,sContentSeparator);\r
+ txt.setAttribute(_XIMF_ATT_TEC_SEPARATOR,sContenTecSeparator);\r
+ CheckXimfhdrsSelection();\r
+ }catch(e){\r
+ }\r
+};\r
+\r
+\r
+/*\r
+ * Check elements of panel and update accessibility of elements\r
+ */\r
+function ComputePanelOfCheckboxSelection(idCheckbox){\r
+ try{\r
+ // get informations of panel \r
+ var pnl = document.getElementById(idCheckbox);\r
+ while(pnl.localName != "panel"){\r
+ pnl = pnl.parentNode;\r
+ } \r
+ \r
+ // check for selected item number\r
+ var nbItems = $(pnl).attr("ximfmaxitem"); \r
+ var richitems = $("#" + pnl.id + " richlistbox" ).children("richlistitem"); \r
+ var nbchkedboxes = 0; \r
+ for(i=0 ; i<richitems.length; ++i){\r
+ var chk1 = richitems[i].firstElementChild; \r
+ if(chk1.localName == "checkbox"){ \r
+ if(chk1.checked){\r
+ var eltsChild = richitems[i].getElementsByTagName("checkbox");\r
+ var cptChk = 0;\r
+ for(j=0 ; j < eltsChild.length; ++j){\r
+ if(eltsChild[j].hasAttribute("checked")) cptChk++;\r
+ }\r
+ nbchkedboxes = nbchkedboxes + cptChk;\r
+ if(cptChk > 1) nbchkedboxes = nbchkedboxes - 1;\r
+ \r
+ // Compstring flag, if true, child value must be filled\r
+ var ximfChild = false; \r
+ if(richitems[i].hasAttribute("ximfchild"))\r
+ if(richitems[i].getAttribute("ximfchild")=="true") \r
+ $(chk1).attr("ximfchild","true"); \r
+ }else{\r
+ $(chk1).removeAttr("ximfchild");\r
+ }\r
+ }\r
+ }\r
+ \r
+ var chkboxes = $("#" + pnl.id + " checkbox" );\r
+ // enable/disable items that can be selected\r
+ if(nbchkedboxes < nbItems){\r
+ // other items can be selected \r
+ $(chkboxes).attr("disabled","false");//.removeAttr("disabled"); \r
+ for(i=0 ; i<richitems.length; ++i){\r
+ var chk1 = richitems[i].firstElementChild;\r
+ if(chk1.localName == "checkbox"){\r
+ if(!chk1.checked){\r
+ \r
+ var eltsChild = richitems[i].getElementsByTagName("checkbox"); \r
+ for(j=0 ; j < eltsChild.length; ++j){\r
+ $(eltsChild[j]).removeAttr("checked");\r
+ $(eltsChild[j]).attr("disabled","true"); \r
+ }\r
+ $(chk1).attr("disabled","false");//.removeAttr("disabled"); \r
+ }\r
+ }\r
+ }\r
+ }else{\r
+ // max selection is selected, disable others items \r
+ for(i=0 ; i<richitems.length; ++i){\r
+ var chk1 = richitems[i].firstElementChild;\r
+ if(chk1.localName == "checkbox"){\r
+ var eltsChild = richitems[i].getElementsByTagName("checkbox"); \r
+ if(!chk1.checked){ \r
+ $(chk1).removeAttr("ximfchild"); \r
+ for(j=0 ; j < eltsChild.length; ++j){ \r
+ $(eltsChild[j]).removeAttr("checked"); \r
+ $(eltsChild[j]).attr("disabled","true"); \r
+ }\r
+ }else{\r
+ // disable composed items\r
+ if(eltsChild.length > 1){\r
+ var intCpt = 0; \r
+ for(j=0 ; j < eltsChild.length; ++j){ \r
+ if(eltsChild[j].hasAttribute("checked")) intCpt++;\r
+ }\r
+ switch(intCpt){\r
+ case 1:\r
+ for(j=0 ; j < eltsChild.length; ++j){\r
+ $(eltsChild[j]).attr("disabled","false");//.removeAttr("disabled");\r
+ }\r
+ chk1.checked = true;\r
+ break;\r
+ case 2:\r
+ for(j=0 ; j < eltsChild.length; ++j){\r
+ if(!eltsChild[j].hasAttribute("checked")) \r
+ $(eltsChild[j]).attr("disabled","true");\r
+ }\r
+ break;\r
+ } \r
+ }\r
+ }\r
+ } \r
+ } \r
+ }\r
+ XimfailComposeCanClose(); \r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - ComputePanelOfCheckboxSelection ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber); \r
+ } \r
+}\r
+\r
+\r
+/*\r
+ * Check item group - more than 1 element must be selected\r
+ */\r
+function IsAcceptableXimfCompstring(idCompstring){\r
+ try{ \r
+ var isAcceptableCompstring = false;\r
+ // \r
+ var siblingElement = document.getElementById(idCompstring).nextElementSibling;\r
+ if(siblingElement){\r
+ if(siblingElement.localName == "textbox"){ \r
+ if(siblingElement.value !="") isAcceptableCompstring = true; \r
+ }else{\r
+ // search for textboxes\r
+ var childTxtboxList = siblingElement.getElementsByTagName("textbox");\r
+ for(i=0 ; i<childTxtboxList.length ; ++i){\r
+ if(childTxtboxList[i].value !=""){\r
+ isAcceptableCompstring = true;\r
+ break;\r
+ }\r
+ }\r
+ \r
+ if(!isAcceptableCompstring){\r
+ // search for checkboxes\r
+ var childCheckBoxList = siblingElement.getElementsByTagName("checkbox");\r
+ for(i=0 ; i<childCheckBoxList.length ; ++i){\r
+ if(childCheckBoxList[i].checked){\r
+ isAcceptableCompstring = true;\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - IsAcceptableXimfCompstring ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber); \r
+ } \r
+ return isAcceptableCompstring;\r
+}\r
+\r
+/*\r
+ * Delete all values of ximfmail element\r
+ */\r
+ function EraseAndComputeXimfhdrsTextbox(idTextBox){ \r
+ try{\r
+ var eltTextbox = document.getElementById(idTextBox);\r
+ \r
+ // datepicker case\r
+ if(eltTextbox.localName == _XIMF_ELT_DATEPICKER){\r
+ eltTextbox._input.value = "";\r
+ eltTextbox.gPopup.value = null;\r
+ return;\r
+ }\r
+ \r
+ eltTextbox.value = "";\r
+ eltTextbox.setAttribute(_XIMF_ATT_XVALUE,""); \r
+ if(eltTextbox.hasAttribute(_XIMF_ATT_TEC_VALUE)){\r
+ eltTextbox.setAttribute(_XIMF_ATT_TEC_VALUE,"");\r
+ }\r
+ \r
+ // raz panel selections\r
+ $("panel[id='"+ eltTextbox.getAttribute("refpanel")+"'] checkbox").removeAttr("checked");\r
+ $("panel[id='"+ eltTextbox.getAttribute("refpanel")+"'] checkbox").removeAttr("disabled");\r
+ var listTxtbox = $("panel[id='"+ eltTextbox.getAttribute("refpanel")+"'] textbox");\r
+ for(i=0;i<listTxtbox.length;++i)listTxtbox[i].value="";\r
+ \r
+ // delete repanel of linked values \r
+ menu_link = $("panel[id='"+ eltTextbox.getAttribute("refpanel")+"'] menuitem[linkpopupbox]");\r
+ if(menu_link.length > 0){\r
+ for(i=0 ; i<menu_link.length ; ++i) { \r
+ try{\r
+ var popupset = document.getElementById($(menu_link[i]).attr("linkpopupbox"));\r
+ var txtbox = document.getElementById(popupset.getAttribute(_XIMF_ATT_REF_BOX));\r
+ EraseAndComputeXimfhdrsTextbox(popupset.getAttribute(_XIMF_ATT_REF_BOX));\r
+ txtbox.setAttribute("refpanel","");\r
+ $("textbox[id='"+popupset.getAttribute(_XIMF_ATT_REF_BOX)+"'] button").attr("refpanel","");\r
+ }catch(e){}\r
+ }\r
+ } \r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - eraseXimfmailTextbox ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber); \r
+ }\r
+}\r
+\r
+/*\r
+ * Compute DOM with datas (used to load draft or template message)\r
+*/\r
+function ComputeWithForm(ximfMessage){ \r
+ if (!ximfMessage instanceof XimfmailMesssage){\r
+ gConsole.logStringMessage("[ximfmail - ComputeWithForm ] \n parameter of refreshDatas must be a ximfMessage object");\r
+ return false; \r
+ }\r
+ \r
+ // compute free text type\r
+ // compute time type\r
+ // compute menus type \r
+ try{\r
+ var xheader_dom = $("label[ximfheader]"); \r
+ \r
+ for(var idx_xheader_dom=0; idx_xheader_dom<xheader_dom.length; ++idx_xheader_dom){\r
+ var display_box = null;\r
+ try{\r
+ //gConsole.logStringMessage("[ximfmail - XimfMsgComposeView - search value for textbox : " + xheader_dom[idx_xheader_dom].getAttribute("ximfheader")); \r
+ var ximfValue = ximfMessage.getHeaderValue(xheader_dom[idx_xheader_dom].getAttribute("ximfheader"));\r
+ if(ximfValue){ \r
+ // search for value and complete display box\r
+ var display_box_list = $("textbox[refheader='" + xheader_dom[idx_xheader_dom].getAttribute("id") + "']");\r
+ \r
+ if(!display_box_list) continue;\r
+ for(var i = 0 ; i < display_box_list.length ; ++i){\r
+ if(display_box_list[i].nodeName == "textbox"){\r
+ display_box = display_box_list[i];\r
+ }\r
+ }\r
+ if(!display_box) continue;\r
+ \r
+ // default values \r
+ $(display_box).attr("value",ximfValue);\r
+ $(display_box).attr("ximfvalue",ximfValue);\r
+ $(display_box).attr("tooltiptext",ximfValue);\r
+\r
+ // menuitem value (ilk, linkpopup...)\r
+ var menu_item = $("panel[id='"+$(display_box).attr("refpanel")+"'] menuitem");\r
+ if(menu_item.length > 0){ \r
+ for(var idx_menu_item = 0 ; idx_menu_item < menu_item.length ; ++idx_menu_item){\r
+ try{\r
+ var current_ximfvalue = menu_item[idx_menu_item].getAttribute("ximfvalue"); \r
+ var valuemsg = String_trim(ximfValue.toLowerCase());\r
+ var valueref = String_trim(current_ximfvalue.toLowerCase()); \r
+ if( valuemsg.indexOf(valueref, 0) != -1 ){\r
+ \r
+ //linkpopup manager \r
+ var linkpopup = menu_item[idx_menu_item].getAttribute("linkpopupbox");\r
+ if(linkpopup){ \r
+ var targetpopup = $("panel[id='"+linkpopup+"']");\r
+ $("textbox[id='" + targetpopup[0].getAttribute("ximfreftextbox")+"']").attr("refpanel",linkpopup);\r
+ $("textbox[id='" + targetpopup[0].getAttribute("ximfreftextbox")+"'] button[class*='ximfPopup']").attr("refpanel",linkpopup);\r
+ }\r
+ \r
+ //insert values in textbox \r
+ $(display_box).attr("ximfvalue",current_ximfvalue);\r
+ $(display_box).attr("tooltiptext",menu_item[idx_menu_item].getAttribute("label"));\r
+ display_box.inputField.value = menu_item[idx_menu_item].getAttribute("label");\r
+ //technical value is associated\r
+ try{ \r
+ var xtcval = menu_item[idx_menu_item].getAttribute("ximftecvalue");\r
+ if(xtcval){ \r
+ display_box.setAttribute("ximftecvalue",xtcval);\r
+ }\r
+ }catch(err){}\r
+ }\r
+ }catch(err){\r
+ gConsole.logStringMessage("[ximfmail - XimfMsgComposeView - refreshDatas ] \n " + err + "\nfile : " + Error().fileName+"\nline : "+err.lineNumber); \r
+ }\r
+ }\r
+ }\r
+ \r
+ \r
+ // checkbox value (ilk, linkpopup...) \r
+ var check_item = $("panel[id='"+$(display_box).attr("refpanel")+"'] checkbox");\r
+ if(check_item.length > 0){ \r
+ var newximfvalue = "";\r
+ var newtooltiptex = "";\r
+ var newlabel = "";\r
+ var newximftecvalue = "";\r
+ var xSeparator = $("panel[id='"+$(display_box).attr("refpanel")+"']").attr("ximfseparator");\r
+ var xTecSeparator = $("panel[id='"+$(display_box).attr("refpanel")+"']").attr("ximftecseparator"); \r
+ var arrayValue = []\r
+ \r
+ if(xSeparator){ \r
+ var reg=new RegExp("["+xSeparator+"]+", "g"); \r
+ arrayValue = ximfValue.split(reg);\r
+ }else{\r
+ arrayValue.push(ximfValue);\r
+ } \r
+ for(var idx_arrayValue=0 ; idx_arrayValue<arrayValue.length ; ++idx_arrayValue){ \r
+ var isarrayValueAppend = false;\r
+ for(var idx_check_item = 0 ; idx_check_item < check_item.length ; ++idx_check_item){ \r
+ try{\r
+ var current_ximfvalue = check_item[idx_check_item].getAttribute("ximfvalue"); \r
+ var valuemsg = arrayValue[idx_arrayValue].toLowerCase();\r
+ var valueref = current_ximfvalue.toLowerCase(); \r
+ if( valuemsg == valueref){\r
+ isarrayValueAppend = true; \r
+ // \r
+ check_item[idx_check_item].setAttribute("checked",true); \r
+ //linkpopup manager \r
+ var linkpopup = check_item[idx_check_item].getAttribute("linkpopupbox");\r
+ if(linkpopup){ \r
+ var targetpopup = $("panel[id='"+linkpopup+"']");\r
+ $("textbox[id='" + targetpopup[0].getAttribute("ximfreftextbox")+"']").attr("refpanel",linkpopup);\r
+ }\r
+ \r
+ // save values\r
+ if(xSeparator && newlabel!=""){\r
+ newlabel += xSeparator + check_item[idx_check_item].getAttribute("label");\r
+ }else{\r
+ newlabel = check_item[idx_check_item].getAttribute("label");\r
+ }\r
+ if(xSeparator && newximfvalue!=""){\r
+ newximfvalue += xSeparator + current_ximfvalue; \r
+ }else{\r
+ newximfvalue = current_ximfvalue;\r
+ }\r
+ if(xSeparator && newtooltiptex!=""){\r
+ newtooltiptex += xSeparator + check_item[idx_check_item].getAttribute("label"); \r
+ }else{\r
+ newtooltiptex = check_item[idx_check_item].getAttribute("label");\r
+ }\r
+ \r
+ //technical value is associated\r
+ var xtcval = check_item[idx_check_item].getAttribute("ximftecvalue");\r
+ if(xtcval){ \r
+ if(xTecSeparator && newximftecvalue!=""){\r
+ newximftecvalue += xTecSeparator + xtcval; \r
+ }else{\r
+ newximftecvalue = xtcval;\r
+ } \r
+ } \r
+ }\r
+ }catch(err){\r
+ gConsole.logStringMessage("[ximfmail - XimfMsgComposeView - refreshDatas ] \n " + err + "\nfile : " + Error().fileName+"\nline : "+err.lineNumber); \r
+ }\r
+ }\r
+ if(!isarrayValueAppend && arrayValue[idx_arrayValue]!=""){ \r
+ if(xSeparator && newlabel!=""){\r
+ newlabel += xSeparator + arrayValue[idx_arrayValue];\r
+ }else{\r
+ newlabel = arrayValue[idx_arrayValue];\r
+ }\r
+ if(xSeparator && newximfvalue!=""){\r
+ newximfvalue += xSeparator + arrayValue[idx_arrayValue]; \r
+ }else{\r
+ newximfvalue = arrayValue[idx_arrayValue];\r
+ }\r
+ if(xSeparator && newtooltiptex!=""){\r
+ newtooltiptex += xSeparator + arrayValue[idx_arrayValue]; \r
+ }else{\r
+ newtooltiptex = arrayValue[idx_arrayValue];\r
+ }\r
+ }\r
+ }\r
+ \r
+ //insert values in textbox\r
+ if(newximfvalue!="") $(display_box).attr("ximfvalue",newximfvalue);\r
+ if(newtooltiptex!="") $(display_box).attr("tooltiptext",newtooltiptex);\r
+ if(newlabel!="") display_box.inputField.value = newlabel; \r
+ if(newximftecvalue!="") $(display_box).attr("ximftecvalue",newximftecvalue);\r
+ if(xTecSeparator!="") $(display_box).attr("ximftecseparator",xTecSeparator);\r
+ if(xSeparator!="") $(display_box).attr("ximfseparator",xSeparator);\r
+ }\r
+ \r
+ // button value (ilk, linkpopup...) \r
+ var button_item = $("panel[id='"+$(display_box).attr("refpanel")+"'] button"); \r
+ if(button_item.length > 0){ \r
+ for(var idx_button_item = 0 ; idx_button_item < button_item.length ; ++idx_button_item){\r
+ try{\r
+ var current_ximfvalue = button_item[idx_button_item].getAttribute("ximfvalue"); \r
+ if(current_ximfvalue != ""){ \r
+ var valuemsg = String_trim(ximfValue.toLowerCase());\r
+ var valueref = String_trim(current_ximfvalue.toLowerCase()); \r
+ if( valuemsg.indexOf(valueref, 0) != -1 ){\r
+ \r
+ //linkpopup manager \r
+ var linkpopup = button_item[idx_button_item].getAttribute("linkpopupbox");\r
+ if(linkpopup){ \r
+ var targetpopup = $("panel[id='"+linkpopup+"']");\r
+ $("textbox[id='" + targetpopup[0].getAttribute("ximfreftextbox")+"']").attr("refpanel",linkpopup);\r
+ }\r
+ \r
+ //insert values in textbox \r
+ $(display_box).attr("ximfvalue",current_ximfvalue);\r
+ $(display_box).attr("tooltiptext",button_item[idx_button_item].getAttribute("label"));\r
+ display_box.inputField.value = button_item[idx_button_item].getAttribute("label");\r
+ \r
+ //technical value is associated\r
+ try{ \r
+ var xtcval = button_item[idx_button_item].getAttribute("ximftecvalue");\r
+ if(xtcval){ \r
+ $(display_box).attr("ximftecvalue",xtcval);\r
+ }\r
+ }catch(err){}\r
+ }\r
+ }\r
+ }catch(err){\r
+ gConsole.logStringMessage("[ximfmail - XimfMsgComposeView - refreshDatas ] \n " + err + "\nfile : " + Error().fileName+"\nline : "+err.lineNumber); \r
+ }\r
+ }\r
+ } \r
+ }\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - XimfMsgComposeView - refreshDatas ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber); \r
+ }\r
+ }\r
+ \r
+ // load free text values\r
+ xheader_dom = $("textbox[class='ximfEditor']"); \r
+ for(var idx_xheader_dom=0; idx_xheader_dom<xheader_dom.length; ++idx_xheader_dom){\r
+ try{\r
+ var oriTxtboxId = xheader_dom[idx_xheader_dom].getAttribute("ximfreftextbox"); \r
+ var ximfLabelId = $("textbox[id='"+oriTxtboxId+"']").attr("refheader");\r
+ if(ximfLabelId){\r
+ //gConsole.logStringMessage("[ximfmail - XimfMsgComposeView - search value for freetext :" + $("label[id='"+ximfLabelId+"']").attr("ximfheader")+"\nid ="+ximfLabelId); \r
+ var ximfValue = ximfMessage.getHeaderValue($("label[id='"+ximfLabelId+"']").attr("ximfheader")); \r
+ if(ximfValue){ \r
+ xheader_dom[idx_xheader_dom].setAttribute("value",ximfValue);\r
+ } \r
+ } \r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - XimfMsgComposeView - refreshDatas] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber); \r
+ } \r
+ }\r
+ \r
+ // load address values\r
+ xheader_dom = $("ximfaddress"); \r
+ for(var idx_xheader_dom=0; idx_xheader_dom<xheader_dom.length; ++idx_xheader_dom){\r
+ try{\r
+ var refHeader = xheader_dom[idx_xheader_dom].getAttribute(_XIMF_ATT_REF_HEADER); \r
+ if(refHeader){\r
+ //gConsole.logStringMessage("[ximfmail - XimfMsgComposeView - search value for freetext :" + $("label[id='"+ximfLabelId+"']").attr("ximfheader")+"\nid ="+ximfLabelId); \r
+ var ximfValue = ximfMessage.getHeaderValue($("label[id='"+refHeader+"']").attr("ximfheader")); \r
+ if(ximfValue){ \r
+ xheader_dom[idx_xheader_dom].listaddress = ximfValue;\r
+ //alert("load address values \n"+ximfValue+"\n"+xheader_dom[idx_xheader_dom].listaddress); \r
+ } \r
+ } \r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - XimfMsgComposeView - refreshDatas] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber); \r
+ } \r
+ }\r
+ \r
+ // load datetime values \r
+ xheader_dom = $("textbox[class='ximfDatetime']"); \r
+ for(var idx_xheader_dom=0; idx_xheader_dom<xheader_dom.length; ++idx_xheader_dom){\r
+ try{\r
+ var refHeader = xheader_dom[idx_xheader_dom].getAttribute(_XIMF_ATT_REF_HEADER); \r
+ if(refHeader){\r
+ //gConsole.logStringMessage("[ximfmail - XimfMsgComposeView - search value for freetext :" + $("label[id='"+ximfLabelId+"']").attr("ximfheader")+"\nid ="+ximfLabelId); \r
+ var ximfValue = ximfMessage.getHeaderValue($("label[id='"+refHeader+"']").attr("ximfheader")); \r
+ if(ximfValue){\r
+ //alert($("label[id='"+refHeader+"']").attr("ximfheader")+" :: "+ximfValue)\r
+ var thisDate = ConvertZTimeToLocal(ximfValue); \r
+ if(!thisDate) thisDate = ximfValue; \r
+ // load date\r
+ xheader_dom[idx_xheader_dom].setAttribute("value",thisDate );\r
+ xheader_dom[idx_xheader_dom].setAttribute("ximfvalue", ximfValue); \r
+ } \r
+ } \r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - XimfMsgComposeView - refreshDatas] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber); \r
+ } \r
+ }\r
+ CheckXimfhdrsSelection(); \r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - XimfMsgComposeView - refreshDatas] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber); \r
+ }\r
+}\r
+\r
+// END COMPUTE FUNCTIONS\r
+\r
+\r
+/*\r
+ * XIMF RULES AND DOM\r
+ */\r
+function ExecuteXimfHdrsMandatoryRule(){\r
+ var isRuleOk=true;\r
+ /*\r
+ var mandatoriesHdrs = $("label[ximfmandatory='true']");\r
+ for(var i=0; i<mandatoriesHdrs.length; ++i){\r
+ if($("textbox[refheader='"+mandatoriesHdrs[i].getAttribute("id")+"']").attr("ximfvalue") == ""){\r
+ mandatoriesHdrs[i].setAttribute("style","color:red;"); \r
+ isRuleOk = false;\r
+ }else{\r
+ mandatoriesHdrs[i].setAttribute("style","color:black;"); \r
+ }\r
+ }*/\r
+ \r
+ //color tab container\r
+ var panelHdrs = $("tabpanel[class='ximfpane']");\r
+ for(var idx_panelHdrs = 0 ; idx_panelHdrs < panelHdrs.length ; ++idx_panelHdrs){\r
+ //raz tab element\r
+ idXimfPanel = panelHdrs[idx_panelHdrs].getAttribute("id");\r
+ idXimfTap = "tab" + idXimfPanel;\r
+ var cTab = $("tab[id='"+ idXimfTap +"']");\r
+ cTab[0].removeAttribute("ismandatory");\r
+ // CheckXimfhdrsSelection for mandatory elements\r
+ var mandatoriesHdrs = $("tabpanel[id='"+ idXimfPanel + "'] label[ximfmandatory='true']");\r
+ for(var i=0; i<mandatoriesHdrs.length; ++i){\r
+ if($("textbox[refheader='"+mandatoriesHdrs[i].getAttribute("id")+"']").attr("ximfvalue") == ""){\r
+ mandatoriesHdrs[i].setAttribute("style","color:#b20000;"); \r
+ cTab[0].setAttribute("ismandatory","true"); \r
+ isRuleOk = false; \r
+ }else{\r
+ mandatoriesHdrs[i].setAttribute("style","color:inherit;"); \r
+ }\r
+ }\r
+ }\r
+ return isRuleOk;\r
+}\r
+ \r
+/*\r
+ * XIMF RULES AND DOM\r
+ */\r
+function ExecuteXimfHdrsAssociationRule(){\r
+ var isRuleOk=true;\r
+ var isAlertDisplayed=false;\r
+ var associateArray = gXimfHdrs.getXimfAssociatedHdrArray();\r
+ if(!associateArray) return isRuleOk;\r
+ \r
+ // label to prompt\r
+ // internationalisation\r
+ var sAlertLabel = "";\r
+ try{ \r
+ var gBundle = Components.classes["@mozilla.org/intl/stringbundle;1"].getService(Components.interfaces.nsIStringBundleService);\r
+ var stringBundle = gBundle.createBundle("chrome://ximfmail/locale/ximfmail.properties"); \r
+ sAlertLabel = stringBundle.GetStringFromName("ximf-association-alert-label");\r
+ }catch(err){sAlertLabel = "Datas will be deleted!"} \r
+ \r
+ var reg=new RegExp("[&]+", "g");\r
+ for(var i=0; i<associateArray.length; ++i){ \r
+ var headerRef = $("label[ximfheader='"+associateArray[i]._headerRef+"']").attr("id");\r
+ var valueRef = $("textbox[refheader='"+headerRef+"']").attr("ximfvalue");\r
+ \r
+ var headerName = $("label[ximfheader='"+associateArray[i]._headerName+"']").attr("id");\r
+ var valueName = $("textbox[refheader='"+headerName+"']").attr("ximfvalue");\r
+ \r
+ var tabAssociateValueRef =associateArray[i]._valueRef.split(reg);\r
+ var tabAssociateValueName =associateArray[i]._valueName.split(reg);\r
+ \r
+ var idTextbox = $("textbox[refheader='"+headerName+"']").attr("id");\r
+ var tabItems = $("panel[ximfreftextbox='"+idTextbox+"'] menuitem");// list of menuitems\r
+ \r
+ if(valueRef !=""){ \r
+ for(var j=0; j<tabAssociateValueRef.length; ++j){ \r
+ if(valueRef == tabAssociateValueRef[j]){ \r
+ if(tabAssociateValueName[j].lastIndexOf(valueName) == -1 ){\r
+ \r
+ if(valueName != "" && !isAlertDisplayed){\r
+ // ask for delete datas\r
+ ximfAlert(sAlertLabel);\r
+ isAlertDisplayed = true; \r
+ } \r
+ \r
+ EraseAndComputeXimfhdrsTextbox($("textbox[refheader='"+headerName+"']").attr("id")); \r
+ }\r
+ for(var idx_tabItems=0; idx_tabItems<tabItems.length; ++idx_tabItems){\r
+ if(tabAssociateValueName[j].lastIndexOf(tabItems[idx_tabItems].getAttribute("ximfvalue")) == -1){\r
+ tabItems[idx_tabItems].setAttribute("disabled","true");\r
+ tabItems[idx_tabItems].parentNode.setAttribute("ximfenable","false"); // css style\r
+ }else{\r
+ tabItems[idx_tabItems].removeAttribute("disabled"); \r
+ tabItems[idx_tabItems].parentNode.setAttribute("ximfenable","true"); // css style\r
+ } \r
+ }\r
+ }\r
+ }\r
+ }else{\r
+ for(var idx_tabItems=0; idx_tabItems<tabItems.length; ++idx_tabItems){\r
+ tabItems[idx_tabItems].setAttribute("disabled","true");\r
+ tabItems[idx_tabItems].parentNode.setAttribute("ximfenable","false"); // css style\r
+ \r
+ if(valueName != "" && !isAlertDisplayed){\r
+ // ask for delete datas\r
+ ximfAlert(sAlertLabel); \r
+ isAlertDisplayed = true;\r
+ }\r
+ EraseAndComputeXimfhdrsTextbox($("textbox[refheader='"+headerName+"']").attr("id"));\r
+ \r
+ } \r
+ }\r
+ }\r
+ return isRuleOk; \r
+}\r
+\r
+/*\r
+ * XIMF RULES AND DOM : manage default values\r
+ */\r
+function ExecuteXimfHdrsDefaultValuesRule(){\r
+ \r
+ try{ \r
+ // get default value in ximfHdr\r
+ var textboxXimfHdrs = $("textbox[class='XimfTextboxDisplay']"); \r
+ for(var i=0; i<textboxXimfHdrs.length; ++i){\r
+ try{\r
+ var refDefaultItemXimfHdr = $("panel[id='" + $(textboxXimfHdrs[i]).attr("refpanel") + "']").attr("ximfdefault"); \r
+ if(refDefaultItemXimfHdr && $(textboxXimfHdrs[i]).attr("ximfvalue") == "" ){\r
+ var item = $("#"+refDefaultItemXimfHdr);\r
+ if(item.length > 0){\r
+ $(textboxXimfHdrs[i]).attr("ximfvalue",$(item[0]).attr("ximfvalue"));\r
+ textboxXimfHdrs[i].value = $(item[0]).attr("label"); \r
+ var techvalue=$(item[0]).attr("ximftecvalue");\r
+ if(techvalue){ \r
+ $(textboxXimfHdrs[i]).attr("ximftecvalue",techvalue);\r
+ }\r
+ }else{\r
+ $(textboxXimfHdrs[i]).attr("ximfvalue",refDefaultItemXimfHdr);\r
+ textboxXimfHdrs[i].value = refDefaultItemXimfHdr;\r
+ }\r
+ }\r
+ }catch(err){}\r
+ } \r
+ }catch(err){\r
+ gConsole.logStringMessage("[ximfmail - ExecuteXimfHdrsDefaultValuesRule ] \n " + err + "\nfile : " + Error().fileName+"\nline : "+err.lineNumber);\r
+ } \r
+ \r
+ \r
+}\r
+\r
+/*\r
+ * Init non generic rules\r
+ * FT 3504\r
+ */\r
+function InitSpecialXimfRules(){ \r
+ try{\r
+ // load special rules\r
+ var specialRulesArray = gXimfHdrs.getSpecialRulesArray();\r
+ for(var i=0 ; i < specialRulesArray.length ; ++i){\r
+ // search for ximf value \r
+ var nameHeader = specialRulesArray[i]._headerName; \r
+ var refHeader = specialRulesArray[i]._headerRef;\r
+ var targetName = specialRulesArray[i]._targetName;\r
+ \r
+ switch(targetName){\r
+ case XIMF_RULE_TARGET_NAME_MANDATORY_HEADERS:\r
+ gConsole.logStringMessage("[ximfmail - InitSpecialXimfRules ] load special rule " + targetName);\r
+ SpecialMandatoryHeaders(nameHeader,refHeader);\r
+ break;\r
+ default: break;\r
+ }\r
+ //alert("refHeader = " + refHeader + "\nnameHeader = " + nameHeader+"\ntargetName = " + targetName);\r
+ } \r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - InitSpecialXimfRules ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);\r
+ }\r
+}\r
+\r
+/*\r
+ * \r
+ */\r
+function AppendESSSecuityLabel (){\r
+ var essArray = gXimfHdrs.getESSSecurityLabelHdrArray();\r
+ if(!essArray) return;\r
+ if(essArray.length <= 0) return;\r
+ \r
+ if(!gSMFields) return;\r
+ try{\r
+ var essLabels = CreateDOMWithXimfInstance(gXimfHdrs.getXimfInstanceResource(),gChromeXslSecurityLabel); \r
+ }catch(e){ \r
+ gConsole.logStringMessage("[ximfmail - AppendESSSecuityLabel ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);\r
+ return false;\r
+ } \r
+ try{ \r
+ var ximftexboxArray = $("#ximfmailComposeMessageHeadersTablist textbox");\r
+ var ximfhiddenlabelArray = $("#ximfmailComposeMessageHeadersTablist label[class='ximfHiddenHeader']");\r
+ var elt = null; \r
+ for(var i=0 ; i < essArray.length ; ++i){\r
+ // search for ximf value \r
+ var sXimfValue = null;\r
+ var sXimfLabel = null;\r
+ var sXimfSeparator = null;\r
+ var sXimfTecSeparator = null;\r
+ var refHeader = essArray[i]._headerRef; \r
+ var refValue = essArray[i]._valueRef;\r
+ var nameValue = essArray[i]._valueName; \r
+ \r
+ for(var j=0 ; j < ximftexboxArray.length; ++j ){\r
+ var sXimfHeader = $("label[id='" + ximftexboxArray[j].getAttribute(_XIMF_ATT_REF_HEADER) + "']").attr("ximfheader");\r
+ \r
+ if(refHeader == sXimfHeader){\r
+ sXimfValue = ximftexboxArray[j].getAttribute(_XIMF_ATT_XVALUE);\r
+ sXimfSeparator = ximftexboxArray[j].getAttribute(_XIMF_ATT_SEPARATOR); \r
+ break;\r
+ }\r
+ \r
+ //technical header case\r
+ sXimfHeader = $("label[id='" + ximftexboxArray[j].getAttribute(_XIMF_ATT_REF_HEADER) + "']").attr("ximftecheader");\r
+ if(refHeader == sXimfHeader){\r
+ sXimfValue = ximftexboxArray[j].getAttribute(_XIMF_ATT_TEC_VALUE);\r
+ sXimfSeparator = ximftexboxArray[j].getAttribute(_XIMF_ATT_SEPARATOR);\r
+ sXimfLabel = ximftexboxArray[j].getAttribute(_XIMF_ATT_XVALUE);\r
+ sXimfTecSeparator = ximftexboxArray[j].getAttribute(_XIMF_ATT_TEC_SEPARATOR); \r
+ break;\r
+ }\r
+ }\r
+ if(!sXimfValue){\r
+ for(var idx_ximfhiddenlabelArray=0 ; idx_ximfhiddenlabelArray < ximfhiddenlabelArray.length; ++idx_ximfhiddenlabelArray ){\r
+ var sXimfHeader = ximfhiddenlabelArray[idx_ximfhiddenlabelArray].getAttribute("ximfheader");\r
+ if(refHeader == sXimfHeader){\r
+ sXimfValue = ximfhiddenlabelArray[idx_ximfhiddenlabelArray].getAttribute(_XIMF_ATT_XVALUE);\r
+ sXimfSeparator = ximfhiddenlabelArray[idx_ximfhiddenlabelArray].getAttribute(_XIMF_ATT_SEPARATOR); \r
+ break;\r
+ } \r
+ }\r
+ } \r
+ \r
+ //search valueName if refValue defined\r
+ if(refValue){\r
+ var reg=new RegExp("[&]+", "g");\r
+ var arrayRefValue = refValue.split(reg);\r
+ var arrayNameValue = nameValue.split(reg); \r
+ for (var idxArrayRefValue=0; idxArrayRefValue<arrayRefValue.length; ++idxArrayRefValue){ \r
+ if(arrayRefValue[idxArrayRefValue] == sXimfValue){\r
+ if (arrayNameValue[idxArrayRefValue]){ \r
+ sXimfValue = arrayNameValue[idxArrayRefValue]; \r
+ break;\r
+ }\r
+ } \r
+ }\r
+ }\r
+ \r
+ // add label to sign it\r
+ switch(essArray[i]._headerName){\r
+ case "SecurityPolicyIdentifier": //Security Policy Identifier\r
+ //gConsole.logStringMessage("SecurityPolicyIdentifier = "+sXimfValue); \r
+ if(sXimfValue == ""){ \r
+ gSMFields.securityClassification = -1;\r
+ gSMFields.privacyMark = "";\r
+ gSMFields.securityCategories = "";\r
+ }else{\r
+ gSMFields.securityPolicyIdentifier = sXimfValue;\r
+ if(essLabels){\r
+ elt = essLabels.childNodes[0].getElementsByTagName("securityPolicyIdentifier");\r
+ elt[0].setAttribute("value",sXimfValue);\r
+ if(sXimfLabel){\r
+ elt[0].setAttribute("label",sXimfLabel);\r
+ }else{\r
+ elt[0].setAttribute("label",sXimfValue);\r
+ }\r
+ } \r
+ }\r
+ break;\r
+ case "SecurityClassification": \r
+ // Security Classification\r
+ // gConsole.logStringMessage("SecurityClassification = "+sXimfValue);\r
+ // values must be 0,1,2,3,4 or 5 (RFC 2634)\r
+ // gConsole.logStringMessage("SecurityCategory = "+sXimfValue); \r
+ if(sXimfValue == ""){ break; }\r
+ if(sXimfValue >= 0 && sXimfValue <= 5){\r
+ gSMFields.securityClassification = sXimfValue;\r
+ if(essLabels){\r
+ elt = essLabels.childNodes[0].getElementsByTagName("securityClassification");\r
+ var item = elt[0].getElementsByTagName("item");\r
+ for(var k=0; k<item.length; ++k){\r
+ if(item[k].getAttribute("value") == sXimfValue){ \r
+ item[k].setAttribute("ximf",sXimfLabel);\r
+ }\r
+ }\r
+ } \r
+ }else{\r
+ gSMFields.securityClassification = -1;\r
+ } \r
+ break;\r
+ case "ESSPrivacyMark": // Privacy Mark \r
+ //gConsole.logStringMessage("ESSPrivacyMark = "+sXimfValue);\r
+ gSMFields.privacyMark = sXimfValue;\r
+ if(essLabels){\r
+ elt = essLabels.childNodes[0].getElementsByTagName("privacyMark");\r
+ var item = elt[0].getElementsByTagName("item");\r
+ item[0].setAttribute("value",sXimfValue); \r
+ }\r
+ break;\r
+ case "SecurityCategory": \r
+ // Security Categories \r
+ // format to load : oid|type|value name e.g. 0.0.0|1|value|0.0.0.1|2|value \r
+ var categories = "";\r
+ var regtec = new RegExp("["+sXimfTecSeparator+"]+", "g");\r
+ var reg = new RegExp("["+sXimfSeparator+"]+", "g");\r
+ //var regtec = new RegExp("[;,]+", "g");\r
+ \r
+ if(sXimfValue!=""){\r
+ var tab_XimfValue = sXimfValue.split(regtec); \r
+ if(sXimfLabel){ \r
+ var tab_XimfLabel = sXimfLabel.split(reg); \r
+ for(var idx_tab_XimfValue=0; idx_tab_XimfValue<tab_XimfValue.length; ++idx_tab_XimfValue){\r
+ try{\r
+ if(tab_XimfValue[idx_tab_XimfValue]!="" && tab_XimfLabel[idx_tab_XimfValue]!=""){\r
+ if(categories != ""){\r
+ categories += "|";\r
+ }\r
+ //ximftecvalue = "oid,value"\r
+ var regOidValueSep = ","; // FT INT_FT4041 - var regOidValueSep = new RegExp("(,)","g");\r
+ var tmp = tab_XimfValue[idx_tab_XimfValue];\r
+ var oid = tmp.slice(0,tmp.indexOf(regOidValueSep,0));\r
+ var value = tmp.slice(tmp.indexOf(regOidValueSep,0)+1,tmp.length);\r
+ //alert("tmp=" + tmp + "\ntmp.indexOf(regOidValueSep) = " + tmp.indexOf(regOidValueSep)+"\n>>oid = "+oid+"\nvalue = " + value)\r
+ \r
+ if(value){ \r
+ var type = null; \r
+ \r
+ if(essLabels){\r
+ var elt = essLabels.childNodes[0].getElementsByTagName("securityCategories");\r
+ //var item = elt[0].getElementsByTagName("item"); // create item...\r
+ // get type form rules definition\r
+ type = $(elt).attr("type");\r
+ if(!type) type = "2"; // fefault value as integer\r
+ \r
+ // add values to xml file\r
+ // <item oid="" type="" value="" label=""/>\r
+ var item = document.createElement("item");\r
+ item.setAttribute("oid",oid);\r
+ item.setAttribute("type",type);\r
+ item.setAttribute("value",value);\r
+ item.setAttribute("label",tab_XimfLabel[idx_tab_XimfValue]); \r
+ $(elt).append(item); \r
+ } \r
+ categories += oid + "|" + type + "|" + value; \r
+ }\r
+ }\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - AppendESSSecuityLabel - SecurityCategory] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);\r
+ } \r
+ }\r
+ }\r
+ } \r
+ if(categories != "")\r
+ gConsole.logStringMessage("SecurityCategories = " + categories);\r
+ gSMFields.securityCategories = categories; \r
+ break;\r
+ default:\r
+ break; \r
+ } \r
+ }\r
+ } catch (e) {\r
+ gConsole.logStringMessage("[ximfmail - AppendESSSecuityLabel ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);\r
+ }\r
+ \r
+ try{\r
+ /*\r
+ // create file es XIMFMAIL_SECURITY_LABEL_XML_FILE \r
+ if(essLabels){ \r
+ // create securityLabel directory\r
+ var essfile = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile); // get profile folder\r
+ var serializer = new XMLSerializer();\r
+ var foStream = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);\r
+ \r
+ essfile.append(XIMFMAIL_SECURITY_LABEL_XML_DIR);\r
+ try{essfile.create(essfile.DIRECTORY_TYPE,0);}catch(err){} \r
+ essfile.append(XIMFMAIL_SECURITY_LABEL_XML_FILE);\r
+ \r
+ foStream.init(essfile, 0x02 | 0x08 | 0x20, 0664, 0); // write, create, truncate\r
+ serializer.serializeToStream(essLabels, foStream, ""); // rememeber, doc is the DOM tree\r
+ foStream.close();\r
+ }\r
+ * */\r
+ }catch(e){}\r
+ \r
+ \r
+ try{\r
+ // call external trustedBird functions\r
+ securityLabelSetUIStatusBar(gSMFields.securityPolicyIdentifier, gSMFields.securityClassification); \r
+ if (!gSMFields.signMessage) signMessage();\r
+ }catch(e){} \r
+}\r
+\r
+/*\r
+ * Check for changes to document and allow saving before closing \r
+ */ \r
+function XimfailComposeCanClose(){\r
+ try{\r
+ if(gContentChanged == true) return;\r
+ var charSet = null;\r
+ if(gMsgCompose){\r
+ charSet = gMsgCompose.compFields.characterSet;\r
+ if(!charSet) charSet == msgCompFields.defaultCharacterSet;\r
+ }\r
+ var ximfmailMimeSelection = ReadMimeHeadersSelection( XIMF_ENDLINE, charSet);\r
+ if(ximfmailMimeSelection.length > 0) gContentChanged = true; // used xith ComposeCanClose() \r
+ } catch (e) {\r
+ gConsole.logStringMessage("[ximfmail - XimfailComposeCanClose ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+ e.lineNumber);\r
+ }\r
+} \r
+ \r
+/*\r
+ * READ XIMFMAIL DOM SELECTION \r
+ */ \r
+function ReadMimeHeadersSelection( headersSeparator, charSet){\r
+ var sCompleteList="";\r
+ \r
+ // insert XIMF-NAME - name of instance\r
+ var ximfName = DEFAULT_XIMF_NAME;\r
+ if(gXimfCatalog){\r
+ ximfName = gXimfCatalog.getNameInstance(gXimfHdrs.getXimfInstanceResource());\r
+ } \r
+ try{\r
+ // FT INT_FT3970\r
+ if(ximfName.toLowerCase() == SMTP_INSTANCE){ \r
+ gConsole.logStringMessage("[ximfmail - ximfmailOnSend ] Send non XIMF message - instance " + ximfName);\r
+ return sCompleteList;\r
+ }\r
+ }catch(e){} \r
+ sCompleteList += EncodeMimeXimfheader(XIMF_NAME_HEADER, ximfName, charSet) + headersSeparator;\r
+\r
+ // insert XIMF-Version - B4521\r
+ var ximfVersion = DEFAULT_XIMF_VERSION;\r
+ if(gXimfCatalog){\r
+ ximfVersion = gXimfCatalog.getVersionInstance(gXimfHdrs.getXimfInstanceResource());\r
+ }\r
+ sCompleteList += EncodeMimeXimfheader(XIMF_VERSION_HEADER, ximfVersion, charSet) + headersSeparator;\r
+ \r
+ \r
+ // send hidden headers elements\r
+ var arrayValues = $("label[class='ximfHiddenHeader']");\r
+ if(arrayValues){ \r
+ for(var idx=0; idx<=arrayValues.length; idx++){\r
+ try { \r
+ if(arrayValues[idx].getAttribute(_XIMF_ATT_XVALUE)){ \r
+ sCompleteList += EncodeMimeXimfheader($(arrayValues[idx]).attr("ximfheader"), $(arrayValues[idx]).attr(_XIMF_ATT_XVALUE), charSet) + headersSeparator; \r
+ }\r
+ } catch (e) {\r
+ gConsole.logStringMessage("[ximfmail - ximfmailOnSend ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber); \r
+ } \r
+ }\r
+ }\r
+ \r
+ // send textbox elements\r
+ arrayValues = $("textbox[class='XimfTextboxDisplay']");\r
+ if(arrayValues){ \r
+ for(var idx=0; idx<=arrayValues.length; idx++){\r
+ try { \r
+ if($(arrayValues[idx]).attr(_XIMF_ATT_XVALUE)){\r
+ sCompleteList += EncodeMimeXimfheader($("#"+$(arrayValues[idx]).attr(_XIMF_ATT_REF_HEADER)).attr("ximfheader"), $(arrayValues[idx]).attr(_XIMF_ATT_XVALUE), charSet) + headersSeparator;\r
+ if($(arrayValues[idx]).attr(_XIMF_ATT_TEC_VALUE)){ \r
+ sCompleteList += EncodeMimeXimfheader($("#"+$(arrayValues[idx]).attr(_XIMF_ATT_REF_HEADER)).attr("ximftecheader"), $(arrayValues[idx]).attr(_XIMF_ATT_TEC_VALUE), charSet) + headersSeparator;\r
+ } \r
+ }\r
+ } catch (e) {\r
+ gConsole.logStringMessage("[ximfmail - ximfmailOnSend ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber); \r
+ } \r
+ }\r
+ }\r
+\r
+ // send editor elements \r
+ try{ \r
+ arrayValues = $("textbox[class='ximfEditor']");\r
+ if(arrayValues){\r
+ for( idx=0; idx<=arrayValues.length; idx++){ \r
+ if(arrayValues[idx].value){\r
+ try{\r
+ sCompleteList += EncodeMimeXimfheader($("#"+$(arrayValues[idx]).attr(_XIMF_ATT_REF_HEADER)).attr("ximfheader"), arrayValues[idx].value, charSet) + headersSeparator; \r
+ } catch (e) {\r
+ gConsole.logStringMessage("[ximfmail - ximfmailOnSend ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);\r
+ } \r
+ }\r
+ }\r
+ }\r
+ }catch(e){\r
+ \r
+ } \r
+\r
+ // send datetime elements\r
+ try{\r
+ //arrayValues = $("#ximfmailComposeMessagePanel " + _XIMF_ELT_DATEPICKER); \r
+ arrayValues = $("textbox[class='ximfDatetime']"); \r
+ if(arrayValues){ \r
+ for( idx=0; idx<=arrayValues.length; idx++){ \r
+ if(arrayValues[idx].value){ \r
+ try{\r
+ sCompleteList += EncodeMimeXimfheader($("#"+$(arrayValues[idx]).attr(_XIMF_ATT_REF_HEADER)).attr("ximfheader"), arrayValues[idx].getAttribute(_XIMF_ATT_XVALUE), charSet) + headersSeparator; \r
+ } catch (e) {\r
+ //alert(e)\r
+ gConsole.logStringMessage("[ximfmail - ximfmailOnSend ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);\r
+ } \r
+ }\r
+ }\r
+ }\r
+ }catch(e){}\r
+ \r
+ // send ximfaddress elements\r
+ try{\r
+ arrayValues = $("#ximfmailComposeMessagePanel ximfaddress");\r
+ if(arrayValues){ \r
+ for( idx=0; idx<=arrayValues.length; idx++){ \r
+ if(arrayValues[idx].listaddress != ""){\r
+ try{\r
+ sCompleteList += EncodeMimeXimfheader($("#"+$(arrayValues[idx]).attr(_XIMF_ATT_REF_HEADER)).attr("ximfheader"), arrayValues[idx].listaddress, charSet) + headersSeparator;\r
+ \r
+ } catch (e) {\r
+ gConsole.logStringMessage("[ximfmail - ximfmailOnSend ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);\r
+ } \r
+ }\r
+ }\r
+ }\r
+ }catch(e){}\r
+ //alert ("getHeadersSelection \n" + sCompleteList);\r
+ return sCompleteList;\r
+}\r
+\r
+ \r
+function ReadXsmptHeadersTranslation(headerValueSeparator, headersSeparator,charSet){\r
+ var sCompleteList = "";\r
+ var xsmtpArray = gXimfHdrs.getXsmtpHdrArray();\r
+ if(!xsmtpArray) return;\r
+ // create mandatory xsmpt headers\r
+ //this.AddMandatoryXsmtpHeader();\r
+ try{ \r
+ for(var i=0 ; i < xsmtpArray.length ; ++i){\r
+ if(!xsmtpArray[i]._headerRef){\r
+ sCompleteList += EncodeMimeXimfheader(xsmtpArray[i]._headerName, xsmtpArray[i]._valueName, charSet) + headersSeparator;\r
+ }\r
+ } \r
+ } catch (e) {\r
+ gConsole.logStringMessage("[ximfmail - AddMandatoryXsmtpHeader ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);\r
+ }\r
+ \r
+ // Copy and convert XIMF headers to XSMTP headers\r
+ var ximftexboxArray = $("textbox[class='XimfTextboxDisplay']["+_XIMF_ATT_XVALUE+"]");\r
+ for(var i = 0 ; i < ximftexboxArray.length; ++i ){\r
+ var sXimfHeader = $("label[class='ximfHeaderLabel'][id='" + ximftexboxArray[i].getAttribute(_XIMF_ATT_REF_HEADER) + "']").attr("ximfheader");\r
+ var sXimfValue = ximftexboxArray[i].getAttribute(_XIMF_ATT_XVALUE);\r
+ \r
+ if(sXimfValue != ""){\r
+ //this.AddXsmtpHeader(sXimfHeader,sXimfValue);\r
+ try{ \r
+ for(var j=0 ; j < xsmtpArray.length ; ++j){\r
+ //alert(this._ArrayheadersCompatibility[i]._headerRef +" -- "+ ximfHeader);\r
+ \r
+ if(xsmtpArray[j]._headerRef == sXimfHeader){\r
+ //alert(this._ArrayheadersCompatibility[i]._headerRef +" -- "+ ximfHeader);\r
+ var xvalue = sXimfValue; // default, copy of XIMF value \r
+ // get for values references\r
+ var reg=new RegExp("[&]+", "g");\r
+ if(xsmtpArray[j]._valueRef){\r
+ var arrayValRefs = xsmtpArray[j]._valueRef.split(reg);\r
+ var arrayVals = xsmtpArray[j]._valueName.split(reg);\r
+ for (var k=0; k<arrayValRefs.length; ++k){ \r
+ if(arrayValRefs[k] == sXimfValue){\r
+ if (arrayVals[k]){ \r
+ xvalue = arrayVals[k];\r
+ break;\r
+ }\r
+ } \r
+ }\r
+ }else{\r
+ if(xsmtpArray[j]._valueName)\r
+ var xvalue = xsmtpArray[j]._valueName; // default, copy of XIMF value \r
+ }\r
+ \r
+ // append line to headers\r
+ sCompleteList += EncodeMimeXimfheader(xsmtpArray[j]._headerName, xvalue, charSet) + headersSeparator; \r
+ }\r
+ } \r
+ } catch (e) {\r
+ gConsole.logStringMessage("[ximfmail - AddXsmtpHeader ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+ e.lineNumber);\r
+ }\r
+ } //if \r
+ }\r
+ return sCompleteList;\r
+}\r
+\r
+/*\r
+ * Security rules are only valid for XIMFMAIL Instances\r
+ */\r
+function ReloadSecurityAccess(){\r
+ // access secure headers\r
+ gCurrentIdentity.setBoolAttribute("secureheaders.checked",false);\r
+ $("#idItemSecureHeaders_1").removeAttr("checked"); \r
+ $("#idItemSecureHeaders_2").removeAttr("checked"); \r
+ $("#idItemSecureHeaders_1").removeAttr("disabled");\r
+ $("#idItemSecureHeaders_2").removeAttr("disabled"); \r
+ $("#menu_securitySign1").removeAttr("disabled");\r
+ $("#menu_securitySign2").removeAttr("disabled");\r
+ \r
+ // access security label\r
+ $("#menu_securityLabelDialog1").removeAttr("checked"); \r
+ $("#menu_securityLabelDialog2").removeAttr("checked"); \r
+ $("#menu_securityLabelDialog1").removeAttr("disabled");\r
+ $("#menu_securityLabelDialog2").removeAttr("disabled"); \r
}
\ No newline at end of file
-addEventListener('load', onDialogOpenedXimf, true);
-function onDialogOpenedXimf(){
- try{
- var pkiParams = window.arguments[0].QueryInterface(Components.interfaces.nsIPKIParamBlock);
- params = pkiParams.QueryInterface(Components.interfaces.nsIDialogParamBlock);
- gSignatureStatus = params.GetInt(1);
- if(gSignatureStatus == -1){
- var gBundle = Components.classes["@mozilla.org/intl/stringbundle;1"].getService(Components.interfaces.nsIStringBundleService);
- var stringBundle = gBundle.createBundle("chrome://ximfmail/locale/ximfmail.properties");
- var sLabel = stringBundle.GetStringFromName("ximfmail.securityinfo.warning");
- var labelItem = document.getElementById("signatureLabel");
- labelItem.value = sLabel;
- labelItem.setAttribute("style","color:#b20000");
- }
- }catch(e){}
+addEventListener('load', onDialogOpenedXimf, true);\r
+function onDialogOpenedXimf(){\r
+ try{\r
+ var pkiParams = window.arguments[0].QueryInterface(Components.interfaces.nsIPKIParamBlock);\r
+ params = pkiParams.QueryInterface(Components.interfaces.nsIDialogParamBlock);\r
+ gSignatureStatus = params.GetInt(1);\r
+ if(gSignatureStatus == -1){\r
+ var gBundle = Components.classes["@mozilla.org/intl/stringbundle;1"].getService(Components.interfaces.nsIStringBundleService);\r
+ var stringBundle = gBundle.createBundle("chrome://ximfmail/locale/ximfmail.properties"); \r
+ var sLabel = stringBundle.GetStringFromName("ximfmail.securityinfo.warning"); \r
+ var labelItem = document.getElementById("signatureLabel");\r
+ labelItem.value = sLabel;\r
+ labelItem.setAttribute("style","color:#b20000");\r
+ }\r
+ }catch(e){}\r
}
\ No newline at end of file
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- ***** 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 ***** -->
-
-<?xml-stylesheet href="chrome://ximfmail/skin" type="text/css"?>
-<!DOCTYPE overlay SYSTEM "chrome://ximfmail/locale/ximfmail.dtd">
-
-<overlay id="ximfmailMsgReadSecureityInfoOverlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <script type="application/javascript" src="chrome://ximfmail/content/msgReadSecurityInfo-ov-ximfmail.js" />
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!-- ***** 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
+<?xml-stylesheet href="chrome://ximfmail/skin" type="text/css"?>\r
+<!DOCTYPE overlay SYSTEM "chrome://ximfmail/locale/ximfmail.dtd">\r
+\r
+<overlay id="ximfmailMsgReadSecureityInfoOverlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">\r
+ <script type="application/javascript" src="chrome://ximfmail/content/msgReadSecurityInfo-ov-ximfmail.js" />\r
</overlay>
\ No newline at end of file
-/* ***** 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
var _rdfService = null;
var _dsCatalog = null;
var _urlCatalog = null
- var _instanceCounter = 0; // instance counter for index RDF file
+
// public:
if(typeof XimfCatalog.initialized == "undefined"){
}catch(e){
gConsole.logStringMessage("[ximfmail - XimfCatalog ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
}
+ return null;
};
/*
* create catalog with profile xml informations
*/
- XimfCatalog.prototype.registerXimfmailProfileNode = function(domProfile){
+ XimfCatalog.prototype.registerXimfmailProfileNode = function(domProfile,aclLevel){
try{
// default title of smtp message
var smtpXimfVersion = DEFAULT_XIMF_VERSION;
// add datas from xml profile to RDF file
// Create theme List
var themeTag = domProfile.getElementsByTagName("theme");
- var theme = "";
- if(themeTag.length > 0){
+ var theme = "";
+ var uriThemeDefinition = "http://www.ximfmail.com/catalog/" + themeTag[0].getAttribute("name");
+ if(themeTag.length > 0){
+ //var adate = new Date();
+ //theme = themeTag[0].getAttribute("name")+"-" + parseInt(adate.getTime())+ parseInt(Math.round(Math.random()*1000));
theme = themeTag[0].getAttribute("name");
- var newURI = "http://www.ximfmail.com/catalog/" + theme;
- RDFC.AppendElement(_rdfService.GetResource(newURI));
- _dsCatalog.Assert(_rdfService.GetResource(newURI),
- _rdfService.GetResource("http://www.ximfmail.com/RDF#name"),
- _rdfService.GetLiteral(theme), true);
+ var newURI = "http://www.ximfmail.com/catalog/" + theme;
- _dsCatalog.Assert(_rdfService.GetResource(newURI),
- _rdfService.GetResource("http://www.ximfmail.com/RDF#refSeq"),
- _rdfService.GetLiteral("http://www.ximfmail.com/catalog/instance_"+theme), true);
- }
+ // get acl default level
+ var defaultacl=-1;
+ if(themeTag[0].hasAttribute("defaultacl")){
+ defaultacl = themeTag[0].getAttribute("defaultacl");
+ gConsole.logStringMessage("[ximfmail - XimfCatalog.registerXimfmailProfileNode ] Default ACL level of profile " + newURI + " : " + defaultacl);
+ }
+
+ if( RDFC.IndexOf(_rdfService.GetResource(newURI)) == -1){
+ RDFC.AppendElement(_rdfService.GetResource(newURI));
+
+ _dsCatalog.Assert(_rdfService.GetResource(newURI),
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#name"),
+ _rdfService.GetLiteral(theme), true);
+ _dsCatalog.Assert(_rdfService.GetResource(newURI),
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#refSeq"),
+ _rdfService.GetLiteral("http://www.ximfmail.com/catalog/instance_"+theme), true);
+
+ _dsCatalog.Assert(_rdfService.GetResource(newURI),
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#defaultacl"),
+ _rdfService.GetLiteral(defaultacl), true);
+
+ }else{
+ _dsCatalog.Change(_rdfService.GetResource(newURI),
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#name"),
+ _rdfService.GetLiteral( this.getTarget(newURI,"http://www.ximfmail.com/RDF#name")),
+ _rdfService.GetLiteral(theme));
+
+ _dsCatalog.Change(_rdfService.GetResource(newURI),
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#refSeq"),
+ _rdfService.GetLiteral(this.getTarget(newURI,"http://www.ximfmail.com/RDF#refSeq")),
+ _rdfService.GetLiteral("http://www.ximfmail.com/catalog/instance_"+theme));
+
+ _dsCatalog.Change(_rdfService.GetResource(newURI),
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#defaultacl"),
+ _rdfService.GetLiteral(this.getTarget(newURI,"http://www.ximfmail.com/RDF#defaultacl")),
+ _rdfService.GetLiteral(defaultacl));
+ }
+
+
+ }
- // Create instance List
- var seqNode = _rdfService.GetResource("http://www.ximfmail.com/catalog/instance_"+theme);
- RDFCUtils.MakeSeq(_dsCatalog, seqNode);
- RDFC.Init(_dsCatalog, seqNode);
+ // Create instance List
+ var RDFCI = RDFCUtils.MakeSeq(_dsCatalog, _rdfService.GetResource("http://www.ximfmail.com/catalog/instance_"+theme));
+
+ // create definitions entries
var instanceTag = themeTag[0].getElementsByTagName("instance");
//alert(instanceTag.length + " instances in profile xml " + theme)
+
var sValue="";
- var bHasSmtpInstance=false;
- // create definitions entries
+ var bHasSmtpInstance=false;
for(var i = 0; i < instanceTag.length; i++){
try{
// default instance message, continue
continue;
}
}catch(e){}
- //alert("instance : " + schemaTag[0].getAttribute("name") +" && "+ schemaTag[0].textContent);
// append resource element to sequence
- var newURI = "http://www.ximfmail.com/catalog/instance_"+theme +"/" + (i + 1 + _instanceCounter);
- RDFC.AppendElement(_rdfService.GetResource(newURI));
-
+ var newURI = "http://www.ximfmail.com/catalog/instance_"+theme +"/"+instanceTag[i].getAttribute("name");
+ var newResource = _rdfService.GetResource(newURI);
+ var isNewItem = false;
+
+ if( RDFCI.IndexOf(newResource) == -1){
+ RDFCI.AppendElement(newResource);
+ isNewItem = true;
+ }
+
// append ximfVersion of instance
- _dsCatalog.Assert(_rdfService.GetResource(newURI),
- _rdfService.GetResource("http://www.ximfmail.com/RDF#ximfVersion"),
- _rdfService.GetLiteral(instanceTag[i].getAttribute("ximfVersion")), true);
+ if(isNewItem){
+ _dsCatalog.Assert(newResource,
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#ximfVersion"),
+ _rdfService.GetLiteral(instanceTag[i].getAttribute("ximfVersion")), true);
+ }else{
+ _dsCatalog.Change(newResource,
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#ximfVersion"),
+ _rdfService.GetLiteral(this.getTarget(newURI,"http://www.ximfmail.com/RDF#ximfVersion")),
+ _rdfService.GetLiteral(instanceTag[i].getAttribute("ximfVersion")));
+ }
// append name of instance
- _dsCatalog.Assert(_rdfService.GetResource(newURI),
- _rdfService.GetResource("http://www.ximfmail.com/RDF#instance"),
- _rdfService.GetLiteral(instanceTag[i].getAttribute("name")), true);
+ if(isNewItem){
+ _dsCatalog.Assert(newResource,
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#instance"),
+ _rdfService.GetLiteral(instanceTag[i].getAttribute("name")), true);
+ }else{
+ _dsCatalog.Change(newResource,
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#instance"),
+ _rdfService.GetLiteral(this.getTarget(newURI,"http://www.ximfmail.com/RDF#instance")),
+ _rdfService.GetLiteral(instanceTag[i].getAttribute("name")));
+ }
// append label of instance
try{
var instLabel = instanceTag[i].getAttribute("label");
if(!instLabel) instLabel = instanceTag[i].getAttribute("name");
//gConsole.logStringMessage("instLabel" + instLabel);
- _dsCatalog.Assert(_rdfService.GetResource(newURI),
- _rdfService.GetResource("http://www.ximfmail.com/RDF#instanceLabel"),
- _rdfService.GetLiteral(instLabel), true);
+ if(isNewItem){
+ _dsCatalog.Assert(newResource,
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#instanceLabel"),
+ _rdfService.GetLiteral(instLabel), true);
+ }else{
+ _dsCatalog.Change(newResource,
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#instanceLabel"),
+ _rdfService.GetLiteral(this.getTarget(newURI,"http://www.ximfmail.com/RDF#instanceLabel")),
+ _rdfService.GetLiteral(instanceTag[i].getAttribute("instanceLabel")));
+ }
}catch(ex){}
// append version of instance
- _dsCatalog.Assert(_rdfService.GetResource(newURI),
- _rdfService.GetResource("http://www.ximfmail.com/RDF#version"),
- _rdfService.GetLiteral(instanceTag[i].getAttribute("version")), true);
-
+ if(isNewItem){
+ _dsCatalog.Assert(newResource,
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#version"),
+ _rdfService.GetLiteral(instanceTag[i].getAttribute("version")), true);
+ }else{
+ _dsCatalog.Change(newResource,
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#version"),
+ _rdfService.GetLiteral(this.getTarget(newURI,"http://www.ximfmail.com/RDF#version")),
+ _rdfService.GetLiteral(instanceTag[i].getAttribute("version")));
+ }
// append id of instance
- try{
- _dsCatalog.Assert(_rdfService.GetResource(newURI),
- _rdfService.GetResource("http://www.ximfmail.com/RDF#id"),
- _rdfService.GetLiteral(instanceTag[i].getAttribute("id")), true);
+ try{
+ if(isNewItem){
+ _dsCatalog.Assert(newResource,
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#id"),
+ _rdfService.GetLiteral(instanceTag[i].getAttribute("id")), true);
+ }else{
+ _dsCatalog.Change(newResource,
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#id"),
+ _rdfService.GetLiteral(this.getTarget(newURI,"http://www.ximfmail.com/RDF#id")),
+ _rdfService.GetLiteral(instanceTag[i].getAttribute("id")));
+ }
}catch(e){
gConsole.logStringMessage("[ximfmail - XimfCatalog.registerXimfmailProfileNode ] \n " + e + "\nfile : " + e.fileName+"\nline : "+e.lineNumber);
}
if(schemaElt){
sValue = schemaElt[0].textContent;
}
- _dsCatalog.Assert(_rdfService.GetResource(newURI),
- _rdfService.GetResource("http://www.ximfmail.com/RDF#pathSchema"),
- _rdfService.GetLiteral(instanceTag[i].getAttribute("directory")+sValue), true);
+ if(isNewItem){
+ _dsCatalog.Assert(newResource,
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#pathSchema"),
+ _rdfService.GetLiteral(instanceTag[i].getAttribute("directory")+sValue), true);
+ }else{
+ _dsCatalog.Change(newResource,
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#pathSchema"),
+ _rdfService.GetLiteral(this.getTarget(newURI,"http://www.ximfmail.com/RDF#pathSchema")),
+ _rdfService.GetLiteral(instanceTag[i].getAttribute("directory")+sValue));
+ }
}catch(e){
gConsole.logStringMessage("[ximfmail - XimfCatalog.registerXimfmailProfileNode ] \n " + e + "\nfile : " + e.fileName+"\nline : "+e.lineNumber);
}
if(ihmElt){
sValue = ihmElt[0].textContent;
}
- _dsCatalog.Assert(_rdfService.GetResource(newURI),
- _rdfService.GetResource("http://www.ximfmail.com/RDF#pathIhm"),
- _rdfService.GetLiteral(instanceTag[i].getAttribute("directory")+sValue), true);
+ if(isNewItem){
+ _dsCatalog.Assert(newResource,
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#pathIhm"),
+ _rdfService.GetLiteral(instanceTag[i].getAttribute("directory")+sValue), true);
+ }else{
+ _dsCatalog.Change(newResource,
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#pathIhm"),
+ _rdfService.GetLiteral(this.getTarget(newURI,"http://www.ximfmail.com/RDF#pathIhm")),
+ _rdfService.GetLiteral(instanceTag[i].getAttribute("directory")+sValue));
+ }
}catch(e){
gConsole.logStringMessage("[ximfmail - XimfCatalog.registerXimfmailProfileNode ] \n " + e + "\nfile : " + e.fileName+"\nline : "+e.lineNumber);
}
if(rulesDico){
sValue = rulesDico[0].textContent;
}
- _dsCatalog.Assert(_rdfService.GetResource(newURI),
- _rdfService.GetResource("http://www.ximfmail.com/RDF#pathRules"),
- _rdfService.GetLiteral(instanceTag[i].getAttribute("directory")+sValue), true);
+ if(isNewItem){
+ _dsCatalog.Assert(newResource,
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#pathRules"),
+ _rdfService.GetLiteral(instanceTag[i].getAttribute("directory")+sValue), true);
+ }else{
+ _dsCatalog.Change(newResource,
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#pathRules"),
+ _rdfService.GetLiteral(this.getTarget(newURI,"http://www.ximfmail.com/RDF#pathRules")),
+ _rdfService.GetLiteral(instanceTag[i].getAttribute("directory")+sValue));
+ }
}catch(e){
gConsole.logStringMessage("[ximfmail - XimfCatalog.registerXimfmailProfileNode ] \n " + e + "\nfile : " + e.fileName+"\nline : "+e.lineNumber);
}
if(ihmDico){
sValue = ihmDico[0].textContent;
}
- _dsCatalog.Assert(_rdfService.GetResource(newURI),
- _rdfService.GetResource("http://www.ximfmail.com/RDF#pathDictionary"),
- _rdfService.GetLiteral(instanceTag[i].getAttribute("directory")+sValue), true);
- }catch(e){
- gConsole.logStringMessage("[ximfmail - XimfCatalog.registerXimfmailProfileNode ] \n " + e + "\nfile : " + e.fileName+"\nline : "+e.lineNumber);
+ if(isNewItem){
+ _dsCatalog.Assert(newResource,
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#pathDictionary"),
+ _rdfService.GetLiteral(instanceTag[i].getAttribute("directory")+sValue), true);
+ }else{
+ _dsCatalog.Change(newResource,
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#pathDictionary"),
+ _rdfService.GetLiteral(this.getTarget(newURI,"http://www.ximfmail.com/RDF#pathDictionary")),
+ _rdfService.GetLiteral(instanceTag[i].getAttribute("directory")+sValue));
}
+ }catch(e){
+ gConsole.logStringMessage("[ximfmail - XimfCatalog.registerXimfmailProfileNode ] \n " + e + "\nfile : " + e.fileName+"\nline : "+e.lineNumber);
+ }
- _dsCatalog.Assert(_rdfService.GetResource(newURI),
- _rdfService.GetResource("http://www.ximfmail.com/RDF#theme"),
- _rdfService.GetLiteral(theme), true);
+ if(isNewItem){
+ _dsCatalog.Assert(newResource,
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#theme"),
+ _rdfService.GetLiteral(theme), true);
+ }else{
+ _dsCatalog.Change(newResource,
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#theme"),
+ _rdfService.GetLiteral(this.getTarget(newURI,"http://www.ximfmail.com/RDF#theme")),
+ _rdfService.GetLiteral(theme));
+ }
+
+ try{
+ // aclLevel of instance to hide/unhide it on account
+ sValue="true";
+ var iAclLevel = -1;
+ var acltag = instanceTag[i].getElementsByTagName("acl");
+ if(acltag.length>0)iAclLevel = acltag[0].textContent;
+ if(aclLevel){
+ if(parseInt(iAclLevel, 10) > parseInt(aclLevel, 10)) sValue = "false";
+ }else{
+ if(parseInt(iAclLevel, 10) > parseInt(this.getTarget(uriThemeDefinition,"http://www.ximfmail.com/RDF#defaultacl"), 10))sValue = "false";
+ }
+
+ if(isNewItem){
+ _dsCatalog.Assert(newResource,
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#active"),
+ _rdfService.GetLiteral(sValue), true);
+ }else{
+ _dsCatalog.Change(newResource,
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#active"),
+ _rdfService.GetLiteral(this.getTarget(newURI,"http://www.ximfmail.com/RDF#active")),
+ _rdfService.GetLiteral(sValue));
+ }
+ }catch(e){
+ gConsole.logStringMessage("[ximfmail - XimfCatalog.registerXimfmailProfileNode ] \n " + e + "\nfile : " + e.fileName+"\nline : "+e.lineNumber);
+ }
}
// insert smtp entry
- if(bHasSmtpInstance){
- var sURI = "http://www.ximfmail.com/catalog/instance_"+theme +"/" + _instanceCounter;
- RDFC.AppendElement(_rdfService.GetResource(sURI));
- _dsCatalog.Assert(_rdfService.GetResource(sURI),_rdfService.GetResource("http://www.ximfmail.com/RDF#ximfVersion"), _rdfService.GetLiteral(smtpXimfVersion), true);
- _dsCatalog.Assert(_rdfService.GetResource(sURI),_rdfService.GetResource("http://www.ximfmail.com/RDF#instance"),_rdfService.GetLiteral(smtpInstance), true);
- _dsCatalog.Assert(_rdfService.GetResource(sURI),_rdfService.GetResource("http://www.ximfmail.com/RDF#version"), _rdfService.GetLiteral(smtpVersion), true);
- _dsCatalog.Assert(_rdfService.GetResource(sURI),_rdfService.GetResource("http://www.ximfmail.com/RDF#pathSchema"),_rdfService.GetLiteral(smtpInstance), true);
- _dsCatalog.Assert(_rdfService.GetResource(sURI),_rdfService.GetResource("http://www.ximfmail.com/RDF#pathIhm"),_rdfService.GetLiteral(smtpInstance), true);
- _dsCatalog.Assert(_rdfService.GetResource(sURI),_rdfService.GetResource("http://www.ximfmail.com/RDF#pathRules"),_rdfService.GetLiteral(smtpInstance), true);
- _dsCatalog.Assert(_rdfService.GetResource(sURI),_rdfService.GetResource("http://www.ximfmail.com/RDF#pathDictionary"),_rdfService.GetLiteral(smtpInstance), true);
- _dsCatalog.Assert(_rdfService.GetResource(sURI),_rdfService.GetResource("http://www.ximfmail.com/RDF#theme"),_rdfService.GetLiteral(smtpInstance), true);
+ if(bHasSmtpInstance){
+ var smtpURI = "http://www.ximfmail.com/catalog/instance_"+theme +"/smtp";
+ var smtpResource = _rdfService.GetResource(smtpURI);
+ RDFCI.AppendElement(smtpResource);
+ _dsCatalog.Assert(smtpResource,_rdfService.GetResource("http://www.ximfmail.com/RDF#ximfVersion"), _rdfService.GetLiteral(smtpXimfVersion), true);
+ _dsCatalog.Assert(smtpResource,_rdfService.GetResource("http://www.ximfmail.com/RDF#instance"),_rdfService.GetLiteral(smtpInstance), true);
+ _dsCatalog.Assert(smtpResource,_rdfService.GetResource("http://www.ximfmail.com/RDF#version"), _rdfService.GetLiteral(smtpVersion), true);
+ _dsCatalog.Assert(smtpResource,_rdfService.GetResource("http://www.ximfmail.com/RDF#pathSchema"),_rdfService.GetLiteral(smtpInstance), true);
+ _dsCatalog.Assert(smtpResource,_rdfService.GetResource("http://www.ximfmail.com/RDF#pathIhm"),_rdfService.GetLiteral(smtpInstance), true);
+ _dsCatalog.Assert(smtpResource,_rdfService.GetResource("http://www.ximfmail.com/RDF#pathRules"),_rdfService.GetLiteral(smtpInstance), true);
+ _dsCatalog.Assert(smtpResource,_rdfService.GetResource("http://www.ximfmail.com/RDF#pathDictionary"),_rdfService.GetLiteral(smtpInstance), true);
+ _dsCatalog.Assert(smtpResource,_rdfService.GetResource("http://www.ximfmail.com/RDF#theme"),_rdfService.GetLiteral(smtpInstance), true);
+ _dsCatalog.Assert(smtpResource, _rdfService.GetResource("http://www.ximfmail.com/RDF#active"), _rdfService.GetLiteral("true"), true);
// append label of instance
- try{
- _dsCatalog.Assert(_rdfService.GetResource(sURI),_rdfService.GetResource("http://www.ximfmail.com/RDF#instanceLabel"),_rdfService.GetLiteral(smtpInstanceLabel), true);
- }catch(ex){}
- // counter instances
- _instanceCounter = _instanceCounter + instanceTag.length + 1;
+ try{
+ _dsCatalog.Assert(smtpResource,_rdfService.GetResource("http://www.ximfmail.com/RDF#instanceLabel"),_rdfService.GetLiteral(smtpInstanceLabel), true);
+ }catch(ex){}
}
// save datas to file DBG
//_dsCatalog.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
gConsole.logStringMessage("[ximfmail - XimfCatalog.registerXimfmailProfileNode ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);
}
};
+ XimfCatalog.prototype.RemoveSeqCatalog = function(seqNode){
+ try{
+ // create RDF resources
+
+ //var seqNode = _rdfService.GetResource("http://www.ximfmail.com/catalog");
+ var rSeqCatalog = null;
+ try{
+ rSeqCatalog = _rdfCUtils.MakeSeq(_dsCatalog, seqNode);
+ }catch(e){
+ gConsole.logStringMessage("[ximfmail - XimfCatalog.registerXimfmailProfileNode ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
+ }
+
+
+
+ if(rSeqCatalog){
+ /*
+ var numEntri = rSeqCatalog.GetCount();
+ for (var indexCur = numEntri; indexCur >0; indexCur--){
+ rSeqCatalog.RemoveElementAt(indexCur,true);
+ alert("remove " + rSeqCatalog)
+ }
+ */
+
+ var tseq = rSeqCatalog.GetElements();
+ alert(seqNode.ValueUTF8+"\nnb elements to remove = " + rSeqCatalog.GetCount())
+ var uriResource = "";
+ while (tseq.hasMoreElements()){
+ var element = tseq.getNext();
+ if (element instanceof Components.interfaces.nsIRDFResource){
+ uriResource = element.ValueUTF8;
+ alert("remove " + uriResource)
+ var resource = _rdfService.GetResource(uriResource);
+ rSeqCatalog.RemoveElementAt(rSeqCatalog.IndexOf(resource),true);
+ }else{
+ alert("remove " + uriResource)
+ }
+ }
+ alert("nb elements = " + rSeqCatalog.GetCount())
+ }
+ }catch(e){
+ alert(e)
+ gConsole.logStringMessage("[ximfmail - XimfCatalog - RemoveSeqCatalog ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
+ }
+ };
+
XimfCatalog.prototype.getNameInstance = function(instance){
return this.getTarget(instance,"http://www.ximfmail.com/RDF#instance");
};
try{
/// get container of instance resources of current definition
var RDFCUtils = Components.classes["@mozilla.org/rdf/container-utils;1"].createInstance(Components.interfaces.nsIRDFContainerUtils);
-
+ //alert("getInstanceUri - ximfDefUri = " + ximfDefUri)
var rs_seqInstance = _rdfService.GetResource(ximfDefUri);
var containerInstances = RDFCUtils.MakeSeq(_dsCatalog, rs_seqInstance);
var children = containerInstances.GetElements();
-/* ***** 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 ***** */
-
- /*
- *
- */
-function XRDFDataSource(){
- this._dataSource;
- this._refDataSource;
-}
-
-
-/*
- * create DataSource RDF with xml file of values
- * xmlDataPath of xml format recognized :
- <ximf:base name="MCA_List">
- <ximf:header>
- <ximf:title>Saaa</ximf:title>
- <description>Subject ....</description>
- <ximf:column>CODE</ximf:column>
- <ximf:column>Description</ximf:column>
- </ximf:header>
- <ximf:tree>
- <ximf:description>
- <ximf:data>ZZZ</ximf:data>
- <ximf:data>My description for this value</ximf:data>
- </ximf:description>
- </ximf:tree>
- </ximf:base>
- */
-function CreateRdfDatasSource(xmlDataPath){
- try{
-
- if(!xmlDataPath) return;
-
- var domProfile = null;
-
- var xDataSource = new XRDFDataSource();
- var xmlDoc = GetXmlDocument(xmlDataPath);
- if(xmlDoc){
- domProfile = xmlDoc.documentElement;
- }else{
- gConsole.logStringMessage("[ximfmail - ximfTreeDialog ] \n " + Error.description + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- return;
- }
-
- // is valid xml document?
- var baseTag = domProfile.getElementsByTagName("ximf:base");
- if(baseTag.length <= 0) return;
-
- // init RDF XPCOM Services
- var _rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
- var _dsCatalog = Components.classes["@mozilla.org/rdf/datasource;1?name=in-memory-datasource"].createInstance(Components.interfaces.nsIRDFDataSource);
- var _rdfCUtils = Components.classes["@mozilla.org/rdf/container-utils;1"].getService(Components.interfaces.nsIRDFContainerUtils);
-
- // parse XML file and create RDF resources
- var tname = baseTag[0].getAttribute("name");
- var baseURI = "http://www.ximfmail.com/catalog/" + tname;
- var datasUri = baseURI + "/datas";
-
- var seqNode = _rdfService.GetResource(datasUri);
- var RDFC_data = null;
- try{
- RDFC_data = _rdfCUtils.MakeSeq(_dsCatalog, seqNode);
-
- }catch(e){
- gConsole.logStringMessage("[ximfmail - XimfTreeData.registerXimfmailProfileNode ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- }
-
- var treeTag = baseTag[0].getElementsByTagName("ximf:tree");
- var instanceTag = treeTag[0].getElementsByTagName("ximf:description");
- for(var i = 0; i < instanceTag.length; ++i){
- // append resource element to sequence
- var newURI = datasUri + "/data" + i;
- //_rdfContainer.AppendElement(_rdfService.GetResource(newURI));
- RDFC_data.AppendElement(_rdfService.GetResource(newURI));
-
- var instanceTagData = instanceTag[i].getElementsByTagName("ximf:data");
- for(var j = 0; j < instanceTagData.length; ++j){
- // append description element
- _dsCatalog.Assert(_rdfService.GetResource(newURI),
- _rdfService.GetResource("http://www.ximfmail.com/RDF#column"+j),
- _rdfService.GetLiteral(instanceTagData[j].textContent), true);
- }
- }
- //create objet result
- //alert("CreateRdfDatasSource new ref : "+datasUri);
- xDataSource._dataSource = _dsCatalog;
- xDataSource._refDataSource = datasUri;
- return xDataSource;
- }catch(e){
- gConsole.logStringMessage("[ximfmail - XimfTreeData.CreateRdfDatasSource ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- }
-}
-
-/*
- * create DataSource RDF with array of values
- * arrayDatas = [[col0][col1][coln], [col0][col1][coln], [col0][col1][coln], ...]
- * nameSvc = title of box selection
- */
-function CreateRdfDatasSource_array(arrayDatas, strTitle){
- try{
- // is valid array document?
- if(arrayDatas.length <= 0){
- return;
- }
-
- // init RDF XPCOM Services
- var xDataSource = new XRDFDataSource();
- var _rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
- var _dsCatalog = Components.classes["@mozilla.org/rdf/datasource;1?name=in-memory-datasource"].createInstance(Components.interfaces.nsIRDFDataSource);
- var _rdfCUtils = Components.classes["@mozilla.org/rdf/container-utils;1"].getService(Components.interfaces.nsIRDFContainerUtils);
-
- // parse XML file and create RDF resources
- var baseURI = "http://www.ximfmail.com/catalog/" + strTitle;
- var datasUri = baseURI + "/datas";
-
- var seqNode = _rdfService.GetResource(datasUri);
- var RDFC_data = null;
- try{
- RDFC_data = _rdfCUtils.MakeSeq(_dsCatalog, seqNode);
-
- }catch(e){
- gConsole.logStringMessage("[ximfmail - XimfTreeData.registerXimfmailProfileNode ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- }
-
- for(var i = 0; i < arrayDatas.length; ++i){
- // append resource element to sequence
- var newURI = datasUri + "/data" + i;
- RDFC_data.AppendElement(_rdfService.GetResource(newURI));
-
- var arrayCols = arrayDatas[i];
- for(var j = 0; j < arrayCols.length; ++j){
- // append description element
- _dsCatalog.Assert(_rdfService.GetResource(newURI),
- _rdfService.GetResource("http://www.ximfmail.com/RDF#column"+j),
- _rdfService.GetLiteral(arrayCols[j]),
- true
- );
- }
- }
-
- //create objet result
- //alert("CreateRdfDatasSource new ref : "+datasUri);
- xDataSource._dataSource = _dsCatalog;
- xDataSource._refDataSource = datasUri;
- return xDataSource;
- }catch(e){
- gConsole.logStringMessage("[ximfmail - XimfTreeData.CreateRdfDatasSource ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- }
-}
+/* ***** 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
+ * \r
+ */\r
+function XRDFDataSource(){ \r
+ this._dataSource;\r
+ this._refDataSource; \r
+}\r
+\r
+\r
+/*\r
+ * create DataSource RDF with xml file of values\r
+ * xmlDataPath of xml format recognized : \r
+ <ximf:base name="MCA_List">\r
+ <ximf:header>\r
+ <ximf:title>Saaa</ximf:title>\r
+ <description>Subject ....</description>\r
+ <ximf:column>CODE</ximf:column>\r
+ <ximf:column>Description</ximf:column>\r
+ </ximf:header>\r
+ <ximf:tree>\r
+ <ximf:description>\r
+ <ximf:data>ZZZ</ximf:data>\r
+ <ximf:data>My description for this value</ximf:data>\r
+ </ximf:description>\r
+ </ximf:tree>\r
+ </ximf:base>\r
+ */\r
+function CreateRdfDatasSource(xmlDataPath){\r
+ try{ \r
+ \r
+ if(!xmlDataPath) return;\r
+ \r
+ var domProfile = null;\r
+ \r
+ var xDataSource = new XRDFDataSource();\r
+ var xmlDoc = GetXmlDocument(xmlDataPath);\r
+ if(xmlDoc){ \r
+ domProfile = xmlDoc.documentElement; \r
+ }else{\r
+ gConsole.logStringMessage("[ximfmail - ximfTreeDialog ] \n " + Error.description + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);\r
+ return;\r
+ }\r
+ \r
+ // is valid xml document?\r
+ var baseTag = domProfile.getElementsByTagName("ximf:base"); \r
+ if(baseTag.length <= 0) return; \r
+ \r
+ // init RDF XPCOM Services \r
+ var _rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService); \r
+ var _dsCatalog = Components.classes["@mozilla.org/rdf/datasource;1?name=in-memory-datasource"].createInstance(Components.interfaces.nsIRDFDataSource);\r
+ var _rdfCUtils = Components.classes["@mozilla.org/rdf/container-utils;1"].getService(Components.interfaces.nsIRDFContainerUtils);\r
+ \r
+ // parse XML file and create RDF resources \r
+ var tname = baseTag[0].getAttribute("name"); \r
+ var baseURI = "http://www.ximfmail.com/catalog/" + tname; \r
+ var datasUri = baseURI + "/datas"; \r
+ \r
+ var seqNode = _rdfService.GetResource(datasUri);\r
+ var RDFC_data = null; \r
+ try{ \r
+ RDFC_data = _rdfCUtils.MakeSeq(_dsCatalog, seqNode);\r
+ \r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - XimfTreeData.registerXimfmailProfileNode ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);\r
+ } \r
+ \r
+ var treeTag = baseTag[0].getElementsByTagName("ximf:tree"); \r
+ var instanceTag = treeTag[0].getElementsByTagName("ximf:description");\r
+ for(var i = 0; i < instanceTag.length; ++i){\r
+ // append resource element to sequence\r
+ var newURI = datasUri + "/data" + i; \r
+ //_rdfContainer.AppendElement(_rdfService.GetResource(newURI));\r
+ RDFC_data.AppendElement(_rdfService.GetResource(newURI));\r
+ \r
+ var instanceTagData = instanceTag[i].getElementsByTagName("ximf:data");\r
+ for(var j = 0; j < instanceTagData.length; ++j){\r
+ // append description element\r
+ _dsCatalog.Assert(_rdfService.GetResource(newURI),\r
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#column"+j),\r
+ _rdfService.GetLiteral(instanceTagData[j].textContent), true); \r
+ }\r
+ }\r
+ //create objet result\r
+ //alert("CreateRdfDatasSource new ref : "+datasUri);\r
+ xDataSource._dataSource = _dsCatalog;\r
+ xDataSource._refDataSource = datasUri;\r
+ return xDataSource; \r
+ }catch(e){ \r
+ gConsole.logStringMessage("[ximfmail - XimfTreeData.CreateRdfDatasSource ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);\r
+ } \r
+}\r
+\r
+/*\r
+ * create DataSource RDF with array of values\r
+ * arrayDatas = [[col0][col1][coln], [col0][col1][coln], [col0][col1][coln], ...]\r
+ * nameSvc = title of box selection\r
+ */\r
+function CreateRdfDatasSource_array(arrayDatas, strTitle){\r
+ try{ \r
+ // is valid array document? \r
+ if(arrayDatas.length <= 0){ \r
+ return;\r
+ } \r
+ \r
+ // init RDF XPCOM Services \r
+ var xDataSource = new XRDFDataSource();\r
+ var _rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService); \r
+ var _dsCatalog = Components.classes["@mozilla.org/rdf/datasource;1?name=in-memory-datasource"].createInstance(Components.interfaces.nsIRDFDataSource);\r
+ var _rdfCUtils = Components.classes["@mozilla.org/rdf/container-utils;1"].getService(Components.interfaces.nsIRDFContainerUtils);\r
+ \r
+ // parse XML file and create RDF resources \r
+ var baseURI = "http://www.ximfmail.com/catalog/" + strTitle; \r
+ var datasUri = baseURI + "/datas"; \r
+ \r
+ var seqNode = _rdfService.GetResource(datasUri);\r
+ var RDFC_data = null; \r
+ try{ \r
+ RDFC_data = _rdfCUtils.MakeSeq(_dsCatalog, seqNode);\r
+ \r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - XimfTreeData.registerXimfmailProfileNode ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);\r
+ } \r
+ \r
+ for(var i = 0; i < arrayDatas.length; ++i){\r
+ // append resource element to sequence\r
+ var newURI = datasUri + "/data" + i; \r
+ RDFC_data.AppendElement(_rdfService.GetResource(newURI));\r
+ \r
+ var arrayCols = arrayDatas[i];\r
+ for(var j = 0; j < arrayCols.length; ++j){\r
+ // append description element\r
+ _dsCatalog.Assert(_rdfService.GetResource(newURI), \r
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#column"+j), \r
+ _rdfService.GetLiteral(arrayCols[j]), \r
+ true\r
+ ); \r
+ }\r
+ }\r
+ \r
+ //create objet result\r
+ //alert("CreateRdfDatasSource new ref : "+datasUri);\r
+ xDataSource._dataSource = _dsCatalog;\r
+ xDataSource._refDataSource = datasUri;\r
+ return xDataSource; \r
+ }catch(e){ \r
+ gConsole.logStringMessage("[ximfmail - XimfTreeData.CreateRdfDatasSource ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);\r
+ } \r
+}\r
-var XIMF_RULE_TARGET_NAME_MANDATORY_HEADERS = "MandatoryHeaders"
-var gSpecialMandatoryHeaders = [];
-
-//
-function SpecialMandatoryHeaders(nameHeader,refHeader){
- //alert("SpecialMandatoryHeaders refHeader = " + refHeader + "\nnameHeader = " + nameHeader);
- if(nameHeader && refHeader){
- var o = new Object();
- o.nameHeader = nameHeader;
- o.refHeader = refHeader;
- gSpecialMandatoryHeaders.push(o);
- }
- $("#addressingWidget").bind("command",SpecialXimfRule_CheckAddress);
- AddEventSpecialMandatoryHeaders();
-}
-
-//
-function AddEventSpecialMandatoryHeaders(){
- $("#addressingWidget textbox").bind("input",function(evt){if(evt.currentTarget.value.length <= 1) SpecialXimfRule_CheckAddress();});
-}
-
-//
-function SpecialXimfRule_CheckAddress(){
- try{
- var menulist = $("#addressingWidget menulist");
- for(var idxSMH = 0 ; idxSMH < gSpecialMandatoryHeaders.length ; ++idxSMH){
- var valueRef = "addr_" + gSpecialMandatoryHeaders[idxSMH].refHeader; //
- var nameHeader = gSpecialMandatoryHeaders[idxSMH].nameHeader;
- var valueRefSelected = false;
-
- for(var i=0;i<menulist.length;++i){
- var valueMenuList = $(menulist[i]).attr("value");
-
- if( valueMenuList == valueRef){//"addr_cc"
- try{
- var id = $(menulist[i]).attr("id");
- var idBox = "addressCol2#" + id.slice(id.indexOf("#")+1,id.length);
- elt = document.getElementById(idBox);
- if(elt.value != ""){
- // Apply specific rule SpecialXimfRule_MandatoryHeadersCC
- //alert("id = " + idBox + "\nvalue = " + elt.value);
- SpecialXimfRule_MandatoryHeaders(nameHeader);
- valueRefSelected = true;
- }
- }catch(ex){}
- break;
- }
- }
-
- // no rules to apply : unregister it
- if(!valueRefSelected){
- //gConsole.logStringMessage("SpecialXimfRule_No_MandatoryHeaders ");
- SpecialXimfRule_No_MandatoryHeaders(nameHeader);
- }
- }
-
- // register new textboxes events
- setTimeout("AddEventSpecialMandatoryHeaders()", 50);
- }catch(e){
- gConsole.logStringMessage("[ximfmail - SpecialXimfRule_CheckAddress ] \n " + err + "\nfile : " + Error().fileName+"\nline : "+err.lineNumber);
- }
-}
-
-//
-function SpecialXimfRule_MandatoryHeaders(nameHeader){
- try{
- //gConsole.logStringMessage("SpecialXimfRule_MandatoryHeaders on " + nameHeader);
- // get headers to mandatory
- var hdrLabel = $("label[ximfheader='"+nameHeader+"']");
- if(hdrLabel){
- hdrLabel[0].setAttribute("ximfmandatory","true");
- CheckXimfhdrsSelection();
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - SpecialXimfRule_MandatoryHeaders ] \n " + err + "\nfile : " + Error().fileName+"\nline : "+err.lineNumber);
- }
-}
-
-//
-function SpecialXimfRule_No_MandatoryHeaders(nameHeader){
- try{
- //gConsole.logStringMessage("SpecialXimfRule_No_MandatoryHeaders on " + nameHeader)
- //get headers to unmandatory
- var hdrLabel = $("label[ximfheader='"+nameHeader+"']");
- if(hdrLabel){
- hdrLabel[0].setAttribute("ximfmandatory","false");
- hdrLabel[0].setAttribute("style","color:inherit;");
- CheckXimfhdrsSelection();
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - SpecialXimfRule_MandatoryHeaders ] \n " + err + "\nfile : " + Error().fileName+"\nline : "+err.lineNumber);
- }
+var XIMF_RULE_TARGET_NAME_MANDATORY_HEADERS = "MandatoryHeaders"\r
+var gSpecialMandatoryHeaders = [];\r
+\r
+//\r
+function SpecialMandatoryHeaders(nameHeader,refHeader){\r
+ //alert("SpecialMandatoryHeaders refHeader = " + refHeader + "\nnameHeader = " + nameHeader);\r
+ if(nameHeader && refHeader){\r
+ var o = new Object();\r
+ o.nameHeader = nameHeader;\r
+ o.refHeader = refHeader;\r
+ gSpecialMandatoryHeaders.push(o);\r
+ }\r
+ $("#addressingWidget").bind("command",SpecialXimfRule_CheckAddress);\r
+ AddEventSpecialMandatoryHeaders();\r
+}\r
+\r
+//\r
+function AddEventSpecialMandatoryHeaders(){\r
+ $("#addressingWidget textbox").bind("input",function(evt){if(evt.currentTarget.value.length <= 1) SpecialXimfRule_CheckAddress();});\r
+}\r
+\r
+//\r
+function SpecialXimfRule_CheckAddress(){ \r
+ try{\r
+ var menulist = $("#addressingWidget menulist"); \r
+ for(var idxSMH = 0 ; idxSMH < gSpecialMandatoryHeaders.length ; ++idxSMH){\r
+ var valueRef = "addr_" + gSpecialMandatoryHeaders[idxSMH].refHeader; //\r
+ var nameHeader = gSpecialMandatoryHeaders[idxSMH].nameHeader;\r
+ var valueRefSelected = false;\r
+ \r
+ for(var i=0;i<menulist.length;++i){\r
+ var valueMenuList = $(menulist[i]).attr("value");\r
+ \r
+ if( valueMenuList == valueRef){//"addr_cc"\r
+ try{ \r
+ var id = $(menulist[i]).attr("id");\r
+ var idBox = "addressCol2#" + id.slice(id.indexOf("#")+1,id.length); \r
+ elt = document.getElementById(idBox);\r
+ if(elt.value != ""){\r
+ // Apply specific rule SpecialXimfRule_MandatoryHeadersCC\r
+ //alert("id = " + idBox + "\nvalue = " + elt.value); \r
+ SpecialXimfRule_MandatoryHeaders(nameHeader);\r
+ valueRefSelected = true; \r
+ }\r
+ }catch(ex){} \r
+ break;\r
+ }\r
+ } \r
+ \r
+ // no rules to apply : unregister it\r
+ if(!valueRefSelected){\r
+ //gConsole.logStringMessage("SpecialXimfRule_No_MandatoryHeaders ");\r
+ SpecialXimfRule_No_MandatoryHeaders(nameHeader);\r
+ }\r
+ }\r
+ \r
+ // register new textboxes events \r
+ setTimeout("AddEventSpecialMandatoryHeaders()", 50);\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - SpecialXimfRule_CheckAddress ] \n " + err + "\nfile : " + Error().fileName+"\nline : "+err.lineNumber);\r
+ } \r
+}\r
+\r
+//\r
+function SpecialXimfRule_MandatoryHeaders(nameHeader){\r
+ try{\r
+ //gConsole.logStringMessage("SpecialXimfRule_MandatoryHeaders on " + nameHeader); \r
+ // get headers to mandatory \r
+ var hdrLabel = $("label[ximfheader='"+nameHeader+"']");\r
+ if(hdrLabel){\r
+ hdrLabel[0].setAttribute("ximfmandatory","true");\r
+ CheckXimfhdrsSelection();\r
+ } \r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - SpecialXimfRule_MandatoryHeaders ] \n " + err + "\nfile : " + Error().fileName+"\nline : "+err.lineNumber);\r
+ } \r
+}\r
+\r
+//\r
+function SpecialXimfRule_No_MandatoryHeaders(nameHeader){\r
+ try{\r
+ //gConsole.logStringMessage("SpecialXimfRule_No_MandatoryHeaders on " + nameHeader)\r
+ //get headers to unmandatory\r
+ var hdrLabel = $("label[ximfheader='"+nameHeader+"']");\r
+ if(hdrLabel){\r
+ hdrLabel[0].setAttribute("ximfmandatory","false");\r
+ hdrLabel[0].setAttribute("style","color:inherit;"); \r
+ CheckXimfhdrsSelection();\r
+ }\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - SpecialXimfRule_MandatoryHeaders ] \n " + err + "\nfile : " + Error().fileName+"\nline : "+err.lineNumber);\r
+ }\r
}
\ No newline at end of file
-/* ***** 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 ***** */
-var gConsole = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
-
-var CHROME_XIMFMAIL_TREEDATA = "chrome://theme_ximfmail/content/ximfTreeData.rdf";
-var gRelativeXimfTreePath = "extensions/{A627B834-BD9F-4b3f-9AF5-347B5A570402}/chrome/content/theme/ximfTreeDataBck.rdf";
-
-/*
- *
- */
-function XimfTreeData(){
- // private:
- var _rdfService = null;
- var _rdfCUtils = null;
-
- var _dsCatalog = null;
- var _rootNode = null;
- var _urlCatalog = CHROME_XIMFMAIL_TREEDATA;
- var _instanceCounter = 0; // instance counter for index RDF file
-
- function init(){
- try{
- if(!_rdfService)
- _rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
-
- if(!_dsCatalog){
- //_dsCatalog = _rdfService.GetDataSource(CHROME_XIMFMAIL_TREEDATA);
- //_dsCatalog.RegisterDataSource();
- _dsCatalog = Components.classes["@mozilla.org/rdf/datasource;1?name=in-memory-datasource"].createInstance(Components.interfaces.nsIRDFDataSource);
- //_dsCatalog = _rdfService.GetDataSource("rdf:ximfTree");
- }
-
-
- //_dsCatalog = Components.classes["@mozilla.org/rdf/datasource;1?name=in-memory-datasource"].createInstance(Components.interfaces.nsIRDFDataSource);
-
- if(!_rdfCUtils)
- _rdfCUtils = Components.classes["@mozilla.org/rdf/container-utils;1"].getService(Components.interfaces.nsIRDFContainerUtils);
- }catch(e){
- gConsole.logStringMessage("[ximfmail - XimfTreeData.init ] \n " + e + "\nfile : " + e.fileName+"\nline : "+e.lineNumber);
- return false;
- }
- return true;
- }
-
- // public:
- if(typeof XimfTreeData.initialized == "undefined"){
- /*
- * read infomations from catalog
- */
- XimfTreeData.prototype.getTarget = function(instance,predicate){
- try{
- init();
- var resource = _rdfService.GetResource(instance);
- var targets = _dsCatalog.ArcLabelsOut(resource);
- while (targets.hasMoreElements()){
- var newpredicate = targets.getNext();
- if (newpredicate instanceof Components.interfaces.nsIRDFResource){
- var target = _dsCatalog.GetTarget(resource, newpredicate, true);
- /*if (target instanceof Components.interfaces.nsIRDFResource){
- alert("Resource is: " + target.Value);
- }else*/
- if (target instanceof Components.interfaces.nsIRDFLiteral){
- //alert(newpredicate.Value + " : \n\r" + target.Value);
- if(newpredicate.Value == predicate)
- return target.Value;
- }
- }
- }
- }catch(e){
- //alert("[XimfTreeData]error instance loading...." + e);
- gConsole.logStringMessage("[ximfmail - XimfTreeData.getTarget ] \n " + e + "\nfile : " + e.fileName+"\nline : "+e.lineNumber);
- }
- };
- /*
- * create catalog with profile xml informations
- */
- XimfTreeData.prototype.registerXimfmailProfileNode = function(domProfile){
- try{
- // create Seq container
- init();
-
- // create our root nodes
- //_rootNode = RDF.GetResource("urn:root");
- //var seqNode = RDF.GetResource("urn:root:seq");
-
- var seqCatalog = _rdfService.GetResource("http://www.ximfmail.com/catalog");
- var RDFC_Cat = null;
- try{
- RDFC_Cat = _rdfCUtils.MakeSeq(_dsCatalog, seqCatalog);
- }catch(e){
- gConsole.logStringMessage("[ximfmail - XimfTreeData.registerXimfmailProfileNode ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- }
-
- //alert("RDFC_Cat count= "+RDFC_Cat.GetCount());
-
- /* */
- var baseTag = domProfile.getElementsByTagName("base");
- if(baseTag.length <= 0) return;
- //alert(baseTag[0].getAttribute("name"))
- var tname = baseTag[0].getAttribute("name");
- var baseURI = "http://www.ximfmail.com/catalog/" + tname;
- //alert("baseURI = " + baseURI);
- //_rdfContainer.AppendElement(_rdfService.GetResource(baseURI));
- try{
- //var RDFC_Cat = Components.classes["@mozilla.org/rdf/container;1"].createInstance(Components.interfaces.nsIRDFContainer);
- //RDFC_Cat.Init(_dsCatalog, seqCatalog);
- RDFC_Cat.AppendElement(_rdfService.GetResource(baseURI));
- }catch(e){
- gConsole.logStringMessage("[ximfmail - XimfTreeData.registerXimfmailProfileNode ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- }
-
- _dsCatalog.Assert(_rdfService.GetResource(baseURI),
- _rdfService.GetResource("http://www.ximfmail.com/RDF#name"),
- _rdfService.GetLiteral(tname), true);
-
-
- _dsCatalog.Assert(_rdfService.GetResource(baseURI),
- _rdfService.GetResource("http://www.ximfmail.com/RDF#dialogheader"),
- _rdfService.GetLiteral(baseURI+"/dialogheader"), true);
-
- _dsCatalog.Assert(_rdfService.GetResource(baseURI),
- _rdfService.GetResource("http://www.ximfmail.com/RDF#datas"),
- _rdfService.GetLiteral(baseURI+"/datas"), true);
-
- // Create dialogheader description
- var dlgUri = baseURI + "/dialogheader";
- var seqNode = _rdfService.GetResource(dlgUri);
- var RDFC_Dgh = null;
- RDFC_Dgh = _rdfCUtils.MakeSeq(_dsCatalog, seqNode);
- //RDFC.Init(_dsCatalog, seqNode);
- RDFC_Dgh.AppendElement(_rdfService.GetResource(dlgUri));
-
- var headerTag = baseTag[0].getElementsByTagName("header");
- // append tiltle element <ximf:title>MCA</ximf:title>
- var title = headerTag[0].getElementsByTagName("title");
- _dsCatalog.Assert(_rdfService.GetResource(dlgUri),
- _rdfService.GetResource("http://www.ximfmail.com/RDF#title"),
- _rdfService.GetLiteral(title[0].textContent), true);
-
- // append description element <ximf:descritpion>Mentions et clés d'attribution</ximf:descritpion>
- var descritpion = headerTag[0].getElementsByTagName("description");
- _dsCatalog.Assert(_rdfService.GetResource(dlgUri),
- _rdfService.GetResource("http://www.ximfmail.com/RDF#description"),
- _rdfService.GetLiteral(descritpion[0].textContent), true);
-
- // append title colonne <ximf:column>clé</ximf:column>
- var columnTag = headerTag[0].getElementsByTagName("column");
- for(var x = 0; x < columnTag.length; ++x){
- // append description element
- _dsCatalog.Assert(_rdfService.GetResource(dlgUri),
- _rdfService.GetResource("http://www.ximfmail.com/RDF#column"+x),
- _rdfService.GetLiteral(columnTag[x].textContent), true);
- }
-
-
- /* */
- // Create datas descritpion
- var datasUri = baseURI + "/datas";
- var seqNode = _rdfService.GetResource(datasUri);
- var RDFC_data = null;
- try{
- RDFC_data = _rdfCUtils.MakeSeq(_dsCatalog, seqNode);
- }catch(e){
- gConsole.logStringMessage("[ximfmail - XimfTreeData.registerXimfmailProfileNode ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- }
- //_rdfContainer.Init(_dsCatalog, seqNode);
- //var RDFC_Dat = Components.classes["@mozilla.org/rdf/container;1"].createInstance(Components.interfaces.nsIRDFContainer);
- //try{
- // RDFC_Dat.Init(_dsCatalog, seqNode);
- //}catch(e){
- // gConsole.logStringMessage("[ximfmail - XimfTreeData.registerXimfmailProfileNode ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- //}
- // add datas from xml profile to RDF file
- var treeTag = baseTag[0].getElementsByTagName("tree");
- var instanceTag = treeTag[0].getElementsByTagName("description");
- for(var i = 0; i < instanceTag.length; ++i){
- // append resource element to sequence
- var newURI = datasUri + "/data" + i;
- //_rdfContainer.AppendElement(_rdfService.GetResource(newURI));
- RDFC_data.AppendElement(_rdfService.GetResource(newURI));
-
- var instanceTagData = instanceTag[i].getElementsByTagName("data");
- for(var j = 0; j < instanceTagData.length; ++j){
- // append description element
- _dsCatalog.Assert(_rdfService.GetResource(newURI),
- _rdfService.GetResource("http://www.ximfmail.com/RDF#column"+j),
- _rdfService.GetLiteral(instanceTagData[j].textContent), true);
- }
- }
-
- //_dsCatalog.RegisterDataSource();
- }catch(e){
- gConsole.logStringMessage("[ximfmail - XimfTreeData.registerXimfmailProfileNode ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- }
-
- // save datas to file
- /*
- _dsCatalog.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
- var rdfXimfTreeDataPath = getFilePathInProfile(gRelativeXimfTreePath);
- _dsCatalog.FlushTo("file:///" + rdfXimfTreeDataPath); */
- };
-
- XimfTreeData.prototype.getTitleHeader = function(key){
- var uri = "http://www.ximfmail.com/catalog/"+ key + "/dialogheader";
- return this.getTarget(uri,"http://www.ximfmail.com/RDF#title");
- };
-
- XimfTreeData.prototype.getDescriptionHeader = function(key){
- var uri = "http://www.ximfmail.com/catalog/"+ key + "/dialogheader";
- return this.getTarget(uri,"http://www.ximfmail.com/RDF#description");
- };
-
- XimfTreeData.prototype.getTitleColumn = function(key,idx){
- var uri = "http://www.ximfmail.com/catalog/"+ key + "/dialogheader";
- return this.getTarget(uri,"http://www.ximfmail.com/RDF#column"+idx);
- };
-
- XimfTreeData.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
+var gConsole = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);\r
+\r
+var CHROME_XIMFMAIL_TREEDATA = "chrome://theme_ximfmail/content/ximfTreeData.rdf";\r
+var gRelativeXimfTreePath = "extensions/{A627B834-BD9F-4b3f-9AF5-347B5A570402}/chrome/content/theme/ximfTreeDataBck.rdf";\r
+\r
+/*\r
+ * \r
+ */\r
+function XimfTreeData(){\r
+ // private:\r
+ var _rdfService = null;\r
+ var _rdfCUtils = null;\r
+ \r
+ var _dsCatalog = null;\r
+ var _rootNode = null;\r
+ var _urlCatalog = CHROME_XIMFMAIL_TREEDATA;\r
+ var _instanceCounter = 0; // instance counter for index RDF file\r
+ \r
+ function init(){\r
+ try{\r
+ if(!_rdfService)\r
+ _rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);\r
+ \r
+ if(!_dsCatalog){\r
+ //_dsCatalog = _rdfService.GetDataSource(CHROME_XIMFMAIL_TREEDATA);\r
+ //_dsCatalog.RegisterDataSource(); \r
+ _dsCatalog = Components.classes["@mozilla.org/rdf/datasource;1?name=in-memory-datasource"].createInstance(Components.interfaces.nsIRDFDataSource);\r
+ //_dsCatalog = _rdfService.GetDataSource("rdf:ximfTree"); \r
+ }\r
+ \r
+ \r
+ //_dsCatalog = Components.classes["@mozilla.org/rdf/datasource;1?name=in-memory-datasource"].createInstance(Components.interfaces.nsIRDFDataSource);\r
+ \r
+ if(!_rdfCUtils)\r
+ _rdfCUtils = Components.classes["@mozilla.org/rdf/container-utils;1"].getService(Components.interfaces.nsIRDFContainerUtils);\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - XimfTreeData.init ] \n " + e + "\nfile : " + e.fileName+"\nline : "+e.lineNumber); \r
+ return false;\r
+ } \r
+ return true;\r
+ }\r
+ \r
+ // public:\r
+ if(typeof XimfTreeData.initialized == "undefined"){\r
+ /*\r
+ * read infomations from catalog\r
+ */\r
+ XimfTreeData.prototype.getTarget = function(instance,predicate){\r
+ try{\r
+ init();\r
+ var resource = _rdfService.GetResource(instance);\r
+ var targets = _dsCatalog.ArcLabelsOut(resource);\r
+ while (targets.hasMoreElements()){ \r
+ var newpredicate = targets.getNext();\r
+ if (newpredicate instanceof Components.interfaces.nsIRDFResource){\r
+ var target = _dsCatalog.GetTarget(resource, newpredicate, true);\r
+ /*if (target instanceof Components.interfaces.nsIRDFResource){\r
+ alert("Resource is: " + target.Value);\r
+ }else*/\r
+ if (target instanceof Components.interfaces.nsIRDFLiteral){\r
+ //alert(newpredicate.Value + " : \n\r" + target.Value);\r
+ if(newpredicate.Value == predicate)\r
+ return target.Value;\r
+ }\r
+ }\r
+ }\r
+ }catch(e){\r
+ //alert("[XimfTreeData]error instance loading...." + e);\r
+ gConsole.logStringMessage("[ximfmail - XimfTreeData.getTarget ] \n " + e + "\nfile : " + e.fileName+"\nline : "+e.lineNumber); \r
+ }\r
+ };\r
+ /*\r
+ * create catalog with profile xml informations\r
+ */\r
+ XimfTreeData.prototype.registerXimfmailProfileNode = function(domProfile){\r
+ try{\r
+ // create Seq container\r
+ init();\r
+ \r
+ // create our root nodes\r
+ //_rootNode = RDF.GetResource("urn:root"); \r
+ //var seqNode = RDF.GetResource("urn:root:seq"); \r
+ \r
+ var seqCatalog = _rdfService.GetResource("http://www.ximfmail.com/catalog");\r
+ var RDFC_Cat = null;\r
+ try{\r
+ RDFC_Cat = _rdfCUtils.MakeSeq(_dsCatalog, seqCatalog); \r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - XimfTreeData.registerXimfmailProfileNode ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);\r
+ } \r
+ \r
+ //alert("RDFC_Cat count= "+RDFC_Cat.GetCount());\r
+ \r
+ /* */\r
+ var baseTag = domProfile.getElementsByTagName("base"); \r
+ if(baseTag.length <= 0) return; \r
+ //alert(baseTag[0].getAttribute("name"))\r
+ var tname = baseTag[0].getAttribute("name"); \r
+ var baseURI = "http://www.ximfmail.com/catalog/" + tname;\r
+ //alert("baseURI = " + baseURI); \r
+ //_rdfContainer.AppendElement(_rdfService.GetResource(baseURI));\r
+ try{\r
+ //var RDFC_Cat = Components.classes["@mozilla.org/rdf/container;1"].createInstance(Components.interfaces.nsIRDFContainer);\r
+ //RDFC_Cat.Init(_dsCatalog, seqCatalog);\r
+ RDFC_Cat.AppendElement(_rdfService.GetResource(baseURI));\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - XimfTreeData.registerXimfmailProfileNode ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);\r
+ }\r
+ \r
+ _dsCatalog.Assert(_rdfService.GetResource(baseURI),\r
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#name"),\r
+ _rdfService.GetLiteral(tname), true); \r
+ \r
+ \r
+ _dsCatalog.Assert(_rdfService.GetResource(baseURI),\r
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#dialogheader"),\r
+ _rdfService.GetLiteral(baseURI+"/dialogheader"), true); \r
+ \r
+ _dsCatalog.Assert(_rdfService.GetResource(baseURI),\r
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#datas"),\r
+ _rdfService.GetLiteral(baseURI+"/datas"), true);\r
+ \r
+ // Create dialogheader description\r
+ var dlgUri = baseURI + "/dialogheader"; \r
+ var seqNode = _rdfService.GetResource(dlgUri); \r
+ var RDFC_Dgh = null; \r
+ RDFC_Dgh = _rdfCUtils.MakeSeq(_dsCatalog, seqNode);\r
+ //RDFC.Init(_dsCatalog, seqNode);\r
+ RDFC_Dgh.AppendElement(_rdfService.GetResource(dlgUri));\r
+ \r
+ var headerTag = baseTag[0].getElementsByTagName("header"); \r
+ // append tiltle element <ximf:title>MCA</ximf:title>\r
+ var title = headerTag[0].getElementsByTagName("title"); \r
+ _dsCatalog.Assert(_rdfService.GetResource(dlgUri),\r
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#title"),\r
+ _rdfService.GetLiteral(title[0].textContent), true);\r
+ \r
+ // append description element <ximf:descritpion>Mentions et clés d'attribution</ximf:descritpion>\r
+ var descritpion = headerTag[0].getElementsByTagName("description");\r
+ _dsCatalog.Assert(_rdfService.GetResource(dlgUri),\r
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#description"),\r
+ _rdfService.GetLiteral(descritpion[0].textContent), true);\r
+ \r
+ // append title colonne <ximf:column>clé</ximf:column>\r
+ var columnTag = headerTag[0].getElementsByTagName("column");\r
+ for(var x = 0; x < columnTag.length; ++x){\r
+ // append description element\r
+ _dsCatalog.Assert(_rdfService.GetResource(dlgUri),\r
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#column"+x),\r
+ _rdfService.GetLiteral(columnTag[x].textContent), true); \r
+ }\r
+ \r
+ \r
+ /* */\r
+ // Create datas descritpion\r
+ var datasUri = baseURI + "/datas";\r
+ var seqNode = _rdfService.GetResource(datasUri);\r
+ var RDFC_data = null; \r
+ try{ \r
+ RDFC_data = _rdfCUtils.MakeSeq(_dsCatalog, seqNode);\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - XimfTreeData.registerXimfmailProfileNode ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);\r
+ } \r
+ //_rdfContainer.Init(_dsCatalog, seqNode);\r
+ //var RDFC_Dat = Components.classes["@mozilla.org/rdf/container;1"].createInstance(Components.interfaces.nsIRDFContainer);\r
+ //try{\r
+ // RDFC_Dat.Init(_dsCatalog, seqNode); \r
+ //}catch(e){\r
+ // gConsole.logStringMessage("[ximfmail - XimfTreeData.registerXimfmailProfileNode ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);\r
+ //}\r
+ // add datas from xml profile to RDF file \r
+ var treeTag = baseTag[0].getElementsByTagName("tree"); \r
+ var instanceTag = treeTag[0].getElementsByTagName("description");\r
+ for(var i = 0; i < instanceTag.length; ++i){\r
+ // append resource element to sequence\r
+ var newURI = datasUri + "/data" + i; \r
+ //_rdfContainer.AppendElement(_rdfService.GetResource(newURI));\r
+ RDFC_data.AppendElement(_rdfService.GetResource(newURI));\r
+ \r
+ var instanceTagData = instanceTag[i].getElementsByTagName("data");\r
+ for(var j = 0; j < instanceTagData.length; ++j){\r
+ // append description element\r
+ _dsCatalog.Assert(_rdfService.GetResource(newURI),\r
+ _rdfService.GetResource("http://www.ximfmail.com/RDF#column"+j),\r
+ _rdfService.GetLiteral(instanceTagData[j].textContent), true); \r
+ }\r
+ }\r
+ \r
+ //_dsCatalog.RegisterDataSource(); \r
+ }catch(e){ \r
+ gConsole.logStringMessage("[ximfmail - XimfTreeData.registerXimfmailProfileNode ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);\r
+ } \r
+ \r
+ // save datas to file \r
+ /*\r
+ _dsCatalog.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);\r
+ var rdfXimfTreeDataPath = getFilePathInProfile(gRelativeXimfTreePath); \r
+ _dsCatalog.FlushTo("file:///" + rdfXimfTreeDataPath); */ \r
+ };\r
+ \r
+ XimfTreeData.prototype.getTitleHeader = function(key){\r
+ var uri = "http://www.ximfmail.com/catalog/"+ key + "/dialogheader";\r
+ return this.getTarget(uri,"http://www.ximfmail.com/RDF#title");\r
+ };\r
+ \r
+ XimfTreeData.prototype.getDescriptionHeader = function(key){\r
+ var uri = "http://www.ximfmail.com/catalog/"+ key + "/dialogheader";\r
+ return this.getTarget(uri,"http://www.ximfmail.com/RDF#description");\r
+ };\r
+ \r
+ XimfTreeData.prototype.getTitleColumn = function(key,idx){\r
+ var uri = "http://www.ximfmail.com/catalog/"+ key + "/dialogheader";\r
+ return this.getTarget(uri,"http://www.ximfmail.com/RDF#column"+idx);\r
+ };\r
+ \r
+ XimfTreeData.initialized = true;\r
+ }\r
}
\ No newline at end of file
-.ximfmail-person-icon {
- margin: 0 3px;
- list-style-image: url("chrome://messenger/skin/addressbook/icons/abcard.png");
-}
-
-.addressingXimfmailCell {
- border-bottom: 1px solid #CACAFF;
- padding: 0px;
-}
+.ximfmail-person-icon {\r
+ margin: 0 3px;\r
+ list-style-image: url("chrome://messenger/skin/addressbook/icons/abcard.png");\r
+}\r
+\r
+.addressingXimfmailCell {\r
+ border-bottom: 1px solid #CACAFF;\r
+ padding: 0px;\r
+}\r
-<?xml version="1.0"?>
-<!DOCTYPE bindings
-[
- <!ENTITY % dtd1 SYSTEM "chrome://ximfmail/locale/datepicker.dtd" > %dtd1;
-
-]>
-<bindings
- xmlns="http://www.mozilla.org/xbl"
- xmlns:html="http://www.w3.org/1999/xhtml"
- xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- xmlns:xbl="http://www.mozilla.org/xbl">
-
- <binding id="ximfaddress">
- <resources>
- <stylesheet src="chrome://ximfmail/content/ximfaddress/ximfaddress.css"/>
- <script src="util.js"/>
- </resources>
- <content>
- <xul:listbox xbl:inherits="id,readonly" rows="3" flex="1" >
- <xul:listcols>
- <xul:listcol id="textcol-addressingXimfmail" flex="1"/>
- </xul:listcols>
- <xul:listitem id="addressingXimfmailItem" allowevents="true" index="0" flex="1">
- <xul:listcell class="addressingXimfmailCell">
- <xul:textbox id="addressingXimfmailTextbox" class="plain textbox-addressingWidget uri-element"
- type="autocomplete" flex="1"
- searchSessions="addrbook" timeout="300" maxrows="4"
- autoFill="true" autoFillAfterMatch="true" forceComplete="true"
- minResultsForPopup="3" ignoreBlurWhileSearching="true">
- <xul:image class="ximfmail-person-icon" onclick="this.parentNode.select();"/>
- </xul:textbox>
- </xul:listcell>
- </xul:listitem>
- </xul:listbox>
- </content>
-
- <implementation>
- <constructor>
- <![CDATA[
- this.gItemCount = 0;
- this.appendListItem();
- this.appendListItem();
- ]]>
- </constructor>
- <!-- append item cell in addresses listbox -->
- <property name="listaddress">
- <getter>
- return this.getListAddress();
- </getter>
- <setter>
- return this.setListAddress(val);
- </setter>
- </property>
- <method name="appendListItem">
- <body><![CDATA[
- var n = document.getAnonymousNodes(this);
- var n1 = n[0].childNodes;
- for(var i=0; i<n1.length; ++i){
- if(n1[i].nodeName == "xul:listitem"){
- var newItem = n1[i].cloneNode(true);
- ++this.gItemCount;
- newItem.setAttribute("index",this.gItemCount);
- n[0].appendChild(newItem);
- break;
- }
- }
- ]]>
- </body>
- </method>
- <method name="getListAddress">
- <body><![CDATA[
- var sListAddress = "";
- var n = document.getAnonymousNodes(this);
- var n1 = n[0].childNodes;
- for(var i=0; i<n1.length; ++i){
- if(n1[i].nodeName == "xul:listitem"){
- var n2 = n1[i].childNodes;
- for(var j=0; j<n2.length; ++j){
- if(n2[j].nodeName == "xul:listcell"){
- var n3 = n2[j].childNodes;
- for(var k=0; k<n3.length; ++k){
- if(n3[k].nodeName == "xul:textbox"){
- if(sListAddress !="" && n3[k].value!="")
- sListAddress += ",";
- sListAddress += n3[k].value;
- }
- }
-
- }
- }
- }
- }
- //alert("XBL Addresses : \n" + sListAddress);
- return sListAddress;
- ]]>
- </body>
- </method>
- <method name="insertItem">
- <parameter name="value"/>
- <body><![CDATA[
- //alert("XBL insertItem " + value);
- var n = document.getAnonymousNodes(this);
- var n1 = n[0].childNodes;
- for(var i=0; i < n1.length ; ++i){
- if(n1[i].nodeName == "xul:listitem"){
- var n2 = n1[i].childNodes;
- for(var j=0; j < n2.length; ++j){
- if(n2[j].nodeName == "xul:listcell"){
- var n3 = n2[j].childNodes;
- for(var k=0; k<n3.length; ++k){
- if(n3[k].nodeName == "xul:textbox"){
- if(n3[k].value == ""){
- n3[k].value = value;
- return;
- }
- }
- }
- }
- }
- }
- }
-
- ]]>
- </body>
- </method>
- <method name="setListAddress">
- <parameter name="completeList"/>
- <body><![CDATA[
- //alert("XBL setListAddress : \n" + completeList);
-
- var reg=new RegExp("[,]+", "g");
- var arrayDest = completeList.split(reg);
-
- // create missing cells
- for(var nbCell = this.gItemCount ; nbCell <= arrayDest.length ; ++nbCell){
- this.appendListItem();
- }
-
- // insert adresses in cells
- for(var idx_arrayDest = 0; idx_arrayDest < arrayDest.length; ++idx_arrayDest){
- this.insertItem(arrayDest[idx_arrayDest]);
- }
- ]]>
- </body>
- </method>
- <!-- see keypress example from mozilla/toolkit/content/widgets/autocomplete.xml -->
- <method name="onKeyPress">
- <parameter name="aEvent"/>
- <body><![CDATA[
- //XXX: this is so bogus...
- if (aEvent.getPreventDefault())
- return false;
-
- switch(aEvent.keyCode) {
- case KeyEvent.DOM_VK_UP:
- //awArrowHit(element, -1);
- break;
- case KeyEvent.DOM_VK_DOWN:
- //awArrowHit(element, 1);
- break;
- case KeyEvent.DOM_VK_RETURN:
- case KeyEvent.DOM_VK_TAB:
- // if the user text contains a comma or a line return, ignore
- /*if (element.value.search(',') != -1){
- var addresses = element.value;
- element.value = ""; // clear out the current line so we don't try to autocomplete it..
- //parseAndAddAddresses(addresses, awGetPopupElement(awGetRowByInputElement(element)).selectedItem.getAttribute("value"));
- }else if (event.keyCode == KeyEvent.DOM_VK_TAB){}
- awTabFromRecipient(element, event); */
- this.appendListItem();
- break;
- }
-
- /*
- if(aEvent.keyCode || aEvent.charCode <= 32 || aEvent.altKey ||
- aEvent.ctrlKey || aEvent.metaKey)
- return true; // No printable char pressed, not a potential accesskey
-
- var key = aEvent.which;
- var keychar = String.fromCharCode( aEvent.which );//String.fromCharCode(key);
-
- // control keys
- if ((key==null) || (key==0) || (key==8) ||
- (key==9) || (key==13) || (key==27) ){
- return true;
- }
-
- // numbers and a single decimal
- if ((("-/0123456789").indexOf(keychar) > -1)){
- return true;
- }
-
- // blocking event
- aEvent.stopPropagation();
- aEvent.preventDefault();
-
- return false;
- */
- ]]>
- </body>
- </method>
-
- </implementation>
- <handlers>
- <handler event="keypress" phase="capturing" action="return this.onKeyPress(event);"/>
- </handlers>
- </binding>
-</bindings>
+<?xml version="1.0"?>\r
+<!DOCTYPE bindings \r
+[\r
+ <!ENTITY % dtd1 SYSTEM "chrome://ximfmail/locale/datepicker.dtd" > %dtd1; \r
+ \r
+]>\r
+<bindings \r
+ xmlns="http://www.mozilla.org/xbl"\r
+ xmlns:html="http://www.w3.org/1999/xhtml"\r
+ xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"\r
+ xmlns:xbl="http://www.mozilla.org/xbl">\r
+\r
+ <binding id="ximfaddress">\r
+ <resources>\r
+ <stylesheet src="chrome://ximfmail/content/ximfaddress/ximfaddress.css"/> \r
+ <script src="util.js"/>\r
+ </resources>\r
+ <content> \r
+ <xul:listbox xbl:inherits="id,readonly" rows="3" flex="1" >\r
+ <xul:listcols> \r
+ <xul:listcol id="textcol-addressingXimfmail" flex="1"/>\r
+ </xul:listcols>\r
+ <xul:listitem id="addressingXimfmailItem" allowevents="true" index="0" flex="1">\r
+ <xul:listcell class="addressingXimfmailCell">\r
+ <xul:textbox id="addressingXimfmailTextbox" class="plain textbox-addressingWidget uri-element"\r
+ type="autocomplete" flex="1" \r
+ searchSessions="addrbook" timeout="300" maxrows="4" \r
+ autoFill="true" autoFillAfterMatch="true" forceComplete="true"\r
+ minResultsForPopup="3" ignoreBlurWhileSearching="true">\r
+ <xul:image class="ximfmail-person-icon" onclick="this.parentNode.select();"/>\r
+ </xul:textbox> \r
+ </xul:listcell> \r
+ </xul:listitem> \r
+ </xul:listbox> \r
+ </content>\r
+\r
+ <implementation>\r
+ <constructor>\r
+ <![CDATA[ \r
+ this.gItemCount = 0;\r
+ this.appendListItem();\r
+ this.appendListItem(); \r
+ ]]>\r
+ </constructor> \r
+ <!-- append item cell in addresses listbox -->\r
+ <property name="listaddress">\r
+ <getter>\r
+ return this.getListAddress();\r
+ </getter>\r
+ <setter> \r
+ return this.setListAddress(val); \r
+ </setter>\r
+ </property> \r
+ <method name="appendListItem"> \r
+ <body><![CDATA[\r
+ var n = document.getAnonymousNodes(this);\r
+ var n1 = n[0].childNodes;\r
+ for(var i=0; i<n1.length; ++i){ \r
+ if(n1[i].nodeName == "xul:listitem"){\r
+ var newItem = n1[i].cloneNode(true);\r
+ ++this.gItemCount; \r
+ newItem.setAttribute("index",this.gItemCount);\r
+ n[0].appendChild(newItem); \r
+ break;\r
+ }\r
+ } \r
+ ]]>\r
+ </body>\r
+ </method>\r
+ <method name="getListAddress"> \r
+ <body><![CDATA[\r
+ var sListAddress = "";\r
+ var n = document.getAnonymousNodes(this);\r
+ var n1 = n[0].childNodes;\r
+ for(var i=0; i<n1.length; ++i){ \r
+ if(n1[i].nodeName == "xul:listitem"){\r
+ var n2 = n1[i].childNodes;\r
+ for(var j=0; j<n2.length; ++j){\r
+ if(n2[j].nodeName == "xul:listcell"){\r
+ var n3 = n2[j].childNodes;\r
+ for(var k=0; k<n3.length; ++k){\r
+ if(n3[k].nodeName == "xul:textbox"){\r
+ if(sListAddress !="" && n3[k].value!="")\r
+ sListAddress += ","; \r
+ sListAddress += n3[k].value;\r
+ }\r
+ }\r
+ \r
+ }\r
+ }\r
+ }\r
+ }\r
+ //alert("XBL Addresses : \n" + sListAddress);\r
+ return sListAddress; \r
+ ]]>\r
+ </body>\r
+ </method>\r
+ <method name="insertItem"> \r
+ <parameter name="value"/> \r
+ <body><![CDATA[\r
+ //alert("XBL insertItem " + value); \r
+ var n = document.getAnonymousNodes(this);\r
+ var n1 = n[0].childNodes;\r
+ for(var i=0; i < n1.length ; ++i){\r
+ if(n1[i].nodeName == "xul:listitem"){\r
+ var n2 = n1[i].childNodes;\r
+ for(var j=0; j < n2.length; ++j){\r
+ if(n2[j].nodeName == "xul:listcell"){\r
+ var n3 = n2[j].childNodes;\r
+ for(var k=0; k<n3.length; ++k){\r
+ if(n3[k].nodeName == "xul:textbox"){\r
+ if(n3[k].value == ""){\r
+ n3[k].value = value;\r
+ return; \r
+ }\r
+ }\r
+ } \r
+ }\r
+ }\r
+ }\r
+ } \r
+ \r
+ ]]> \r
+ </body>\r
+ </method>\r
+ <method name="setListAddress"> \r
+ <parameter name="completeList"/> \r
+ <body><![CDATA[\r
+ //alert("XBL setListAddress : \n" + completeList);\r
+ \r
+ var reg=new RegExp("[,]+", "g"); \r
+ var arrayDest = completeList.split(reg); \r
+ \r
+ // create missing cells\r
+ for(var nbCell = this.gItemCount ; nbCell <= arrayDest.length ; ++nbCell){\r
+ this.appendListItem();\r
+ }\r
+ \r
+ // insert adresses in cells\r
+ for(var idx_arrayDest = 0; idx_arrayDest < arrayDest.length; ++idx_arrayDest){ \r
+ this.insertItem(arrayDest[idx_arrayDest]);\r
+ } \r
+ ]]> \r
+ </body>\r
+ </method>\r
+ <!-- see keypress example from mozilla/toolkit/content/widgets/autocomplete.xml -->\r
+ <method name="onKeyPress">\r
+ <parameter name="aEvent"/>\r
+ <body><![CDATA[\r
+ //XXX: this is so bogus...\r
+ if (aEvent.getPreventDefault())\r
+ return false;\r
+ \r
+ switch(aEvent.keyCode) {\r
+ case KeyEvent.DOM_VK_UP:\r
+ //awArrowHit(element, -1);\r
+ break;\r
+ case KeyEvent.DOM_VK_DOWN:\r
+ //awArrowHit(element, 1);\r
+ break;\r
+ case KeyEvent.DOM_VK_RETURN:\r
+ case KeyEvent.DOM_VK_TAB:\r
+ // if the user text contains a comma or a line return, ignore \r
+ /*if (element.value.search(',') != -1){\r
+ var addresses = element.value;\r
+ element.value = ""; // clear out the current line so we don't try to autocomplete it..\r
+ //parseAndAddAddresses(addresses, awGetPopupElement(awGetRowByInputElement(element)).selectedItem.getAttribute("value"));\r
+ }else if (event.keyCode == KeyEvent.DOM_VK_TAB){}\r
+ awTabFromRecipient(element, event); */ \r
+ this.appendListItem();\r
+ break;\r
+ }\r
+ \r
+ /*\r
+ if(aEvent.keyCode || aEvent.charCode <= 32 || aEvent.altKey || \r
+ aEvent.ctrlKey || aEvent.metaKey)\r
+ return true; // No printable char pressed, not a potential accesskey\r
+\r
+ var key = aEvent.which;\r
+ var keychar = String.fromCharCode( aEvent.which );//String.fromCharCode(key);\r
+\r
+ // control keys\r
+ if ((key==null) || (key==0) || (key==8) || \r
+ (key==9) || (key==13) || (key==27) ){\r
+ return true;\r
+ }\r
+\r
+ // numbers and a single decimal\r
+ if ((("-/0123456789").indexOf(keychar) > -1)){\r
+ return true;\r
+ }\r
+ \r
+ // blocking event\r
+ aEvent.stopPropagation();\r
+ aEvent.preventDefault();\r
+ \r
+ return false;\r
+ */\r
+ ]]>\r
+ </body>\r
+ </method>\r
+\r
+ </implementation> \r
+ <handlers> \r
+ <handler event="keypress" phase="capturing" action="return this.onKeyPress(event);"/>\r
+ </handlers>\r
+ </binding>\r
+</bindings>\r
var gConsole = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
var gJSLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].createInstance(Components.interfaces.mozIJSSubScriptLoader);
+var gXimfCatalog = null;
try{
gJSLoader.loadSubScript("chrome://ximfmail/content/ximfCatalog.js");
- var gXimfCatalog = new XimfCatalog();
+ gXimfCatalog = new XimfCatalog();
}catch(e){
gConsole.logStringMessage("[ximfmail - Load XimfCatalog ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
}
/*
* Load informations of ximf extensions in RDF memory
*/
-function CreateXimfmailCatalog(){
+function CreateXimfmailCatalog(aclLevel){
try{
+ if(!gXimfCatalog) gXimfCatalog = new XimfCatalog();
var extensionPath = getFilePathInProfile("extensions/");
var extensionList = getExtensionsList();
var sCompletePath;
if(dir.exists()){
// get xml profile
var xmlDoc = GetXmlDocument(sCompletePath);
- gXimfCatalog.registerXimfmailProfileNode(xmlDoc.documentElement);
+ gXimfCatalog.registerXimfmailProfileNode(xmlDoc.documentElement,aclLevel);
dump(sCompletePath + " : " + extensionList[i].name);
//alert(sCompletePath + " : " + extensionList[i].name);
}
// get date
new_date = parts[1];
// get month
+ var month = "";
switch(parts[2].toLowerCase()){
case "jan":
new_date += "/01/";
+ month = "0";
break;
case "feb":
new_date += "/02/";
+ month = "1";
break;
case "mar":
new_date += "/03/";
+ month = "2";
break;
case "apr":
new_date += "/04/";
+ month = "3";
break;
case "may":
new_date += "/05/";
+ month = "4";
break;
case "jun":
new_date += "/06/";
+ month = "5";
break;
case "jul":
new_date += "/07/";
+ month = "6";
break;
case "aug":
new_date += "/08/";
+ month = "7";
break;
case "sep":
new_date += "/09/";
+ month = "8";
break;
case "oct":
new_date += "/10/";
+ month = "9";
break;
case "nov":
new_date += "/11/";
+ month = "10";
break;
case "dec":
new_date += "/12/";
+ month = "11";
break;
default : new_date += "/??/";
}
//get year
new_date += parts[3];
//get time, adjust time GMT and LocaleTime
- var cdat = new Date();
+ var cdat = new Date();
+ cdat.setUTCFullYear(parseInt("20"+parts[3], 10));
+ cdat.setUTCMonth(parseInt(month, 10));
+ cdat.setUTCDate(parseInt(parts[1], 10));
+
var hour = parts[4];
var min = parts[5];
try{
}catch(e){}
// get local time
- var time = (parseInt(hour)*60) + parseInt(min) + (cdat.getTimezoneOffset()*-1);
- //gConsole.logStringMessage("DBG [Ximfmail - ConvertZTimeToLocal] Formule \n"+(parseInt(hour)*60)+"+"+parseInt(min)+"+" +cdat.getTimezoneOffset()+"="+time);
+ var time = (parseInt(hour, 10)*60) + parseInt(min, 10) + (cdat.getTimezoneOffset()*-1);
+ //gConsole.logStringMessage("DBG [Ximfmail - ConvertZTimeToLocal] Formule \n"+(parseInt(hour, 10)*60)+"+"+parseInt(min, 10)+"+" +cdat.getTimezoneOffset()+"="+time);
- var hour = parseInt(parseInt(time)/60);
- if(parseInt(min) < 0){
+ var hour = parseInt(parseInt(time, 10)/60, 10);
+ if(parseInt(hour, 10)<=9) hour = "0" + hour;
+ if(parseInt(min, 10) < 0){
}
- if(parseInt(min) < 24){
+ if(parseInt(min, 10) < 24){
}
- var min = parseInt(parseInt(time)%60);
- if(parseInt(min)<=9) min = "0" + min;
+ var min = parseInt(parseInt(time, 10)%60, 10);
+ if(parseInt(min, 10)<=9) min = "0" + min;
new_date += " "+ hour +":"+min;
- //gConsole.logStringMessage("DBG [Ximfmail - ConvertZTimeToLocal] \n"+hour+":"+min+" >> " +time+"\n"+time+"/60 = "+ parseInt(time)/60 + "\n" + time + "%60 = " + parseInt(time)%60);
+ //gConsole.logStringMessage("DBG [Ximfmail - ConvertZTimeToLocal] \n"+hour+":"+min+" >> " +time+"\n"+time+"/60 = "+ parseInt(time, 10)/60 + "\n" + time + "%60 = " + parseInt(time, 10)%60);
return new_date;
}
</xsl:choose>
</xsl:variable>
<xsl:element name="item">
- <xsl:attribute name="value">
+ <xsl:attribute name="value">\r
<xsl:value-of select="@technicalContent" />
</xsl:attribute>
<xsl:attribute name="label">
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- ***** 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 ***** -->
-<xsl:stylesheet version="2.0"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:ximf="http://eads.org/ximf/">
- <xsl:output method="xml" encoding="UTF-8" indent="yes" version="1.0"
- doctype-system="chrome://ximfmail/locale/ximfmail.dtd" />
-
- <xsl:param name="gLang">us</xsl:param>
- <xsl:param name="gIdSeparator">·</xsl:param> <!-- unicode of middle dot -->
-
- <!-- MAIN FUNCTION -->
- <xsl:template match="/">
- <xsl:choose>
- <xsl:when test="/ximf:instance/ximf:ihm">
- <xsl:call-template name="CustomizedIhm" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="DefaultIhm" />
- </xsl:otherwise>
- </xsl:choose>
-
- </xsl:template>
-
- <!-- DEFAULT PANEL -->
- <xsl:template name="DefaultIhm">
- <tabs>
- <tab id="tabdefaultheaders" label="Headers" />
- <tab id="tabpanelinformations" label="Informations" />
- </tabs>
- <tabpanels id="instanceXimfmail">
- <xsl:for-each select="ximf:instance">
- <tabpanel id="defaultheaders">
- <grid>
- <columns>
- <column id="id_col1_{@id}" />
- <column id="id_col2_{@id}" />
- <column id="id_col3_{@id}" />
- <column id="id_col4_{@id}" />
- </columns>
- <rows id="id_rows_{@id}">
- <xsl:for-each select="ximf:header">
- <xsl:call-template name="InsertRow">
- <xsl:with-param name="headerRef" select="@id" />
- </xsl:call-template>
- </xsl:for-each>
- </rows>
- </grid>
- <xsl:call-template name="AddHeadersHidden" />
- </tabpanel>
- <tabpanel id="panelinformations">
- <grid>
- <columns>
- <column id="_col1" />
- <column id="_col2" />
- </columns>
- <rows>
- <row>
- <label value="Instance identifier : " />
- <label value="{@id}" style="color:blue; font-weight:bold;" />
- </row>
- <row>
- <label value="Instance version : " />
- <label value="{@version}" style="color:blue; font-weight:bold;" />
- </row>
- <row>
- <label value="XIMF schema version : " />
- <label value="{@ximfVersion}" style="color:blue; font-weight:bold;" />
- </row>
- </rows>
- </grid>
- </tabpanel>
- </xsl:for-each>
- </tabpanels>
-
- </xsl:template>
-
- <!-- CUSTOM IHM -->
- <xsl:template name="CustomizedIhm">
- <tabs>
- <xsl:for-each select="/ximf:instance/ximf:ihm/ximf:panel">
- <xsl:element name="tab" id="tab{@id}" accesskey="*">
- <xsl:attribute name="id">
- <xsl:value-of select="concat('tab',@id)"/>
- </xsl:attribute>
- <xsl:attribute name="label">
- <xsl:call-template name="getInternational">
- <xsl:with-param name="ilk" select="@ilk" />
- </xsl:call-template>
- </xsl:attribute>
- </xsl:element>
- </xsl:for-each>
- </tabs>
- <tabpanels flex="1">
- <xsl:for-each select="/ximf:instance/ximf:ihm/ximf:panel">
- <tabpanel id="{@id}" class="ximfpane" flex="1">
- <xsl:for-each select="*">
- <xsl:choose>
- <xsl:when test="name()='ximf:groupbox'">
- <groupbox flex="1">
- <xsl:element name="caption">
- <xsl:attribute name="label">
- <xsl:call-template name="getInternational">
- <xsl:with-param name="ilk" select="@ilk" />
- </xsl:call-template>
- </xsl:attribute>
- </xsl:element>
- <xsl:call-template name="CreateGrid">
- <xsl:with-param name="headerSeq" select="." />
- </xsl:call-template>
- </groupbox>
- </xsl:when>
- <xsl:when test="name()='ximf:grid'">
- <xsl:call-template name="CreateGrid">
- <xsl:with-param name="headerSeq" select="." />
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise/>
- </xsl:choose>
- </xsl:for-each>
- <!-- no container defined : create grid-->
- <vbox flex="1">
- <grid flex="1">
- <columns>
- <column id="id_col1_{@id}" />
- <column id="id_col2_{@id}" flex="1"/>
- <column id="id_col3_{@id}" />
- <column id="id_col4_{@id}" />
- </columns>
- <rows id="id_rows_{@id}">
- <xsl:for-each select="ximf:headerRef">
- <xsl:call-template name="InsertRow">
- <xsl:with-param name="headerRef" select="." />
- </xsl:call-template>
- </xsl:for-each>
- </rows>
- </grid >
- </vbox>
- <xsl:if test="position()=1">
- <xsl:call-template name="AddHeadersHidden" />
- </xsl:if>
- </tabpanel>
- </xsl:for-each>
- </tabpanels>
- </xsl:template>
-
- <!-- ****************************************************** -->
- <!-- template to append headers ximf without ihm definition -->
- <xsl:template name="AddHeadersHidden">
- <vbox hidden="true">
- <xsl:for-each select="/ximf:instance/ximf:header">
- <xsl:choose>
- <xsl:when test="string-length(@ilk) > 0">
- </xsl:when>
- <xsl:otherwise>
- <xsl:element name="label">
- <xsl:attribute name="class">ximfHiddenHeader</xsl:attribute>
- <xsl:attribute name="ximfheader"><xsl:value-of select="@headerName" /></xsl:attribute>
- <xsl:attribute name="ximfvalue"><xsl:value-of select="./ximf:string/@content" /></xsl:attribute>
- </xsl:element>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </vbox>
- </xsl:template>
-
-
- <!-- **************************** -->
- <!-- template to create grid ximf -->
- <xsl:template name="CreateGrid">
- <xsl:param name="headerSeq" select="" />
- <grid flex="1" >
- <columns>
- <column id="id_col1_{$headerSeq/@id}" />
- <column id="id_col2_{$headerSeq/@id}" flex="1"/>
- <column id="id_col3_{$headerSeq/@id}" />
- <column id="id_col4_{$headerSeq/@id}" />
- </columns>
- <rows id="id_rows_{$headerSeq/@id}" >
- <xsl:for-each select="$headerSeq/ximf:headerRef">
- <xsl:call-template name="InsertRow">
- <xsl:with-param name="headerRef" select="." />
- </xsl:call-template>
- </xsl:for-each>
- </rows>
- </grid>
- </xsl:template>
-
- <!-- ************************************* -->
- <!-- template to create id of Popup element-->
- <xsl:template name="GetPopupId">
- <xsl:param name="_refNode"/>
- <xsl:param name="_refHeader"/>
- <xsl:choose>
- <xsl:when test="string-length(@id) <= 0">
- <xsl:value-of select="concat($_refHeader,$gIdSeparator,'ximfmailPopup')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="@id"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!--************************************************** -->
- <!-- template to row in grid with ximf header elements -->
- <xsl:template name="InsertRow">
- <xsl:param name="headerRef" select="" />
- <xsl:for-each select="/ximf:instance/ximf:header[$headerRef=@id]">
- <!-- <xsl:variable name="_headerId" select="@id" />-->
- <xsl:variable name="_headerId">
- <xsl:call-template name="GetUNID">
- <xsl:with-param name="_refNode" select="."/>
- </xsl:call-template>
- </xsl:variable>
- <row align="center" flex="1">
-
- <!-- Header name label -->
- <xsl:variable name="_ilkLabel">
- <xsl:call-template name='getInternational'>
- <xsl:with-param name='ilk' select='@ilk' />
- </xsl:call-template>
- </xsl:variable>
- <xsl:element name="label">
- <xsl:attribute name="id"><xsl:value-of select="$_headerId"/></xsl:attribute>
- <xsl:attribute name="class">ximfHeaderLabel</xsl:attribute>
- <xsl:attribute name="value">
- <xsl:value-of select="concat($_ilkLabel,' : ')"/>
- </xsl:attribute>
- <xsl:attribute name="ximfheader"><xsl:value-of select="@headerName" /></xsl:attribute>
- <xsl:if test="string-length(@technicalHeaderName)>0">
- <xsl:attribute name="ximftecheader"><xsl:value-of select="@technicalHeaderName" /></xsl:attribute>
- </xsl:if>
- <xsl:if test="string-length(@isMandatory)>0">
- <xsl:attribute name="ximfmandatory"><xsl:value-of select="@isMandatory" /></xsl:attribute>
- </xsl:if>
- </xsl:element>
-
- <!-- count how many set or multiset -->
- <xsl:variable name="_counterset" select="count(./ximf:set)"/>
- <xsl:variable name="_countermultiset" select="count(./ximf:multiset)"/>
-
- <!-- variables of IDs -->
- <xsl:variable name="idBox" select="concat($_headerId,$gIdSeparator,'ximfvalue')"/>
-
- <!-- Value field elements -->
- <xsl:for-each select="*">
- <xsl:variable name="_idBox" select="concat($_headerId,$gIdSeparator,'ximfmailtextbox')"/>
- <xsl:variable name="_idPopupSet">
- <xsl:call-template name="GetUNID">
- <xsl:with-param name="_refNode" select="."/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="name()='ximf:string'">
- <xsl:if test="@editable='true'">
- <xsl:call-template name="CreateXimfmailTextbox">
- <xsl:with-param name="_refNode" select="." />
- <xsl:with-param name="_refHeader" select="$_headerId" />
- <xsl:with-param name="_refBox" select="$_idBox" />
- <xsl:with-param name="_refPopupBox" select="$_idPopupSet"/>
- </xsl:call-template>
- <popup id="{$_idPopupSet}" ximfreftextbox="{$_idBox}" position="after_start" ignorekeys="true" >
- <xsl:call-template name="CreateInputBox">
- <xsl:with-param name="_refPopupBox" select="$_idPopupSet"/>
- <xsl:with-param name="_refBox" select="$_idBox"/>
- <xsl:with-param name="_refHeader" select="$_headerId" />
- </xsl:call-template>
- </popup>
- </xsl:if>
- </xsl:when>
- <xsl:when test="name()='ximf:set' or name()='ximf:multiset' or name()='ximf:compstring'">
- <!-- if multiple set, just create 1 textbox -->
- <xsl:if test="position()=1">
- <xsl:choose>
- <!-- if multiple set, no default context popupset -->
- <xsl:when test="$_counterset > 1 or $_countermultiset > 1">
- <xsl:call-template name="CreateXimfmailTextbox">
- <xsl:with-param name="_refNode" select="." />
- <xsl:with-param name="_refHeader" select="$_headerId" />
- <xsl:with-param name="_refBox" select="$_idBox" />
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="CreateXimfmailTextbox">
- <xsl:with-param name="_refNode" select="." />
- <xsl:with-param name="_refHeader" select="$_headerId" />
- <xsl:with-param name="_refBox" select="$_idBox" />
- <xsl:with-param name="_refPopupBox" select="$_idPopupSet" />
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
-
- <!-- Create panel element set/multiset -->
- <xsl:if test="name()='ximf:set' or name()='ximf:multiset'">
- <panel id="{$_idPopupSet}" ximfreftextbox="{$_idBox}" ximfmaxitem="1">
- <xsl:if test="@maxItem">
- <xsl:attribute name="ximfmaxitem"><xsl:value-of select="@maxItem" /></xsl:attribute>
- </xsl:if>
- <xsl:if test="@ximfdefault">
- <xsl:attribute name="ximfdefault"><xsl:value-of select="@ximfdefault" /></xsl:attribute>
- </xsl:if>
- <xsl:call-template name="GetFacetsAttribute">
- <xsl:with-param name="_refNode" select="." />
- </xsl:call-template>
- <xsl:call-template name="GetXimfProperties">
- <xsl:with-param name="_refNode" select="." />
- <xsl:with-param name="_refHeader" select="$_headerId" />
- <xsl:with-param name="_refBox" select="$_idBox" />
- </xsl:call-template>
- <arrowscrollbox orient="vertical" style="max-height:400px;">
- <richlistbox>
- <xsl:call-template name="AddSetAndMultisetPanel">
- <xsl:with-param name="_refNode" select="." />
- <xsl:with-param name="_refHeader" select="$_headerId" />
- <xsl:with-param name="_refBox" select="$_idBox" />
- <xsl:with-param name="_refPopupBox" select="$_idPopupSet" />
- <xsl:with-param name="_positionPopup" select="'after_start'" />
- </xsl:call-template>
- </richlistbox>
- </arrowscrollbox>
- </panel>
- </xsl:if>
-
- <!-- Create Popupset compstring -->
- <xsl:if test="name()='ximf:compstring'">
- <popup id="{$_idPopupSet}" ximfreftextbox="{$_idBox}" position="after_start" ignorekeys="true">
- <xsl:call-template name="GetFacetsAttribute">
- <xsl:with-param name="_refNode" select="." />
- </xsl:call-template>
- <xsl:call-template name="CreateMenu">
- <xsl:with-param name="_refNode" select="*"/>
- <xsl:with-param name="_refHeader" select="$_headerId" />
- <xsl:with-param name="_refBox" select="$_idBox" />
- <xsl:with-param name="_refPopupBox" select="$_idPopupSet" />
- </xsl:call-template>
- </popup>
- </xsl:if>
- </xsl:when>
- <xsl:otherwise/>
- </xsl:choose>
- </xsl:for-each>
- </row>
- </xsl:for-each>
- </xsl:template>
-
- <!-- ***************************** -->
- <!-- add fascets attributes of ximf schema -->
- <xsl:template name="GetFacetsAttribute">
- <xsl:param name="_refNode" />
- <xsl:if test="@separator">
- <xsl:attribute name="ximfseparator"><xsl:value-of select="@separator"/></xsl:attribute>
- </xsl:if>
- <xsl:if test="@technicalSeparator">
- <xsl:attribute name="ximftecseparator"><xsl:value-of select="@technicalSeparator"/></xsl:attribute>
- </xsl:if>
- </xsl:template>
-
- <!-- *********************************** -->
- <!-- Create IHM elements of Ximfmail row -->
- <xsl:template name="CreateXimfmailTextbox">
- <xsl:param name="_refNode"/>
- <xsl:param name="_refHeader"/>
- <xsl:param name="_refBox"/>
- <xsl:param name="_refPopupBox"/>
-
- <xsl:variable name="idContextBox" select="concat($_refHeader,$gIdSeparator,'ximfmailTextboxContext')"/>
- <xsl:choose>
- <xsl:when test="/ximf:instance/ximf:header[@id=$_refHeader][@type='date']">
- <textbox flex="1" id="{$_refBox}" refheader="{$_refHeader}" class="ximfDatetime" context="{$idContextBox}" readonly="false">
- <button class="ximfmailButtonTxt ximfDatepicker" refBox="{$_refBox}"/>
- </textbox>
- <xsl:call-template name="AppendToolButtons">
- <xsl:with-param name="refBox" select="$_refBox"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="/ximf:instance/ximf:header[@id=$_refHeader][@type='address']">
- <ximfaddress id="{$_refBox}" refheader="{$_refHeader}" />
- </xsl:when>
- <xsl:otherwise>
- <textbox flex="1" id="{$_refBox}" refheader="{$_refHeader}" class="XimfTextboxDisplay" context="{$idContextBox}" refpanel="{$_refPopupBox}" readonly="false">
- <xsl:if test="string-length($_refNode/@maxItem) > 0">
- <xsl:attribute name="ximfmaxitems"><xsl:value-of select="$_refNode/@maxItem"/></xsl:attribute>
- </xsl:if>
- <xsl:if test="string-length($_refNode/@separator) > 0">
- <xsl:attribute name="ximfseparator"><xsl:value-of select="$_refNode/@separator"/></xsl:attribute>
- </xsl:if>
- <button class="ximfmailButtonTxt ximfPopup" refpanel="{$_refPopupBox}"/>
- </textbox>
- <!-- Eraser image -->
- <xsl:call-template name="AppendToolButtons">
- <xsl:with-param name="refBox" select="$_refBox"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- <!-- Context popupset -->
- <xsl:call-template name="CreateContext">
- <xsl:with-param name="refBox" select="$_refBox"/>
- <xsl:with-param name="idContext" select="$idContextBox"/>
- </xsl:call-template>
- </xsl:template>
-
- <!-- **************************** -->
- <!-- construct or get ID for node -->
- <xsl:template name="GetUNID">
- <xsl:param name="_refNode"/>
- <xsl:choose>
- <xsl:when test="string-length($_refNode/@id)>0">
- <xsl:value-of select="$_refNode/@id" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="concat(generate-id($_refNode/ancestor::ximf:header),$gIdSeparator,generate-id($_refNode),$gIdSeparator,position())" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!-- ************************************** -->
- <!-- create attributes with Ximf properties -->
- <xsl:template name="GetXimfProperties">
- <xsl:param name="_refNode"/>
- <xsl:param name="_refHeader"/>
- <xsl:param name="_refBox"/>
- <xsl:param name="_refPopupBox"/>
-
- <xsl:for-each select="$_refNode">
- <xsl:if test="$_refHeader">
- <xsl:attribute name="ximfrefheader"><xsl:value-of select="$_refHeader"/></xsl:attribute>
- </xsl:if>
- <xsl:if test="$_refBox">
- <xsl:attribute name="ximfreftextbox"><xsl:value-of select="$_refBox"/></xsl:attribute>
- </xsl:if>
- <xsl:if test=".[@maxLength]">
- <xsl:attribute name="ximfmaxlength"><xsl:value-of select="@maxLength"/></xsl:attribute>
- </xsl:if>
- <xsl:if test=".[@minLength]">
- <xsl:attribute name="ximfminlength"><xsl:value-of select="@minLength"/></xsl:attribute>
- </xsl:if>
- <xsl:if test=".[@maxItem]">
- <xsl:attribute name="ximfmaxitem"><xsl:value-of select="@maxItem"/></xsl:attribute>
- </xsl:if>
- <xsl:if test=".[@minItem]">
- <xsl:attribute name="ximfminitem"><xsl:value-of select="@minItem"/></xsl:attribute>
- </xsl:if>
- <xsl:if test=".[@separator]">
- <xsl:attribute name="ximfseparator"><xsl:value-of select="@separator"/></xsl:attribute>
- </xsl:if>
- <xsl:if test=".[@technicalSeparator]">
- <xsl:attribute name="ximftecseparator"><xsl:value-of select="@technicalSeparator"/></xsl:attribute>
- </xsl:if>
-
- </xsl:for-each>
- </xsl:template>
-
-
- <!-- ******************************** -->
- <!-- Manage set and multiset elements -->
- <xsl:template name="AddSetAndMultisetPanel">
- <xsl:param name="_refNode"/>
- <xsl:param name="_refHeader"/>
- <xsl:param name="_refBox"/>
- <xsl:param name="_refPopupBox"/>
- <xsl:param name="_positionPopup" />
- <xsl:param name="_refConcat" />
-
- <!-- <xsl:for-each select="$_setType[$refNode=@id]"> -->
- <xsl:for-each select="$_refNode">
- <xsl:variable name="_setType" select="name()"/>
- <xsl:choose>
- <!-- Reference to another set/multiset -->
- <xsl:when test="string-length(@ref)>0">
- <xsl:variable name="_refHead" select="@ref"/>
- <xsl:choose>
- <xsl:when test="count(//*[@id=$_refHead])>0">
- <xsl:for-each select="//*[@id=$_refHead]">
- <xsl:call-template name="AddSetAndMultisetPanel">
- <xsl:with-param name="_refNode" select="." />
- <xsl:with-param name="_refHeader" select="$_refHeader" />
- <xsl:with-param name="_refBox" select="$_refBox" />
- <xsl:with-param name="_refPopupBox" select="$_refPopupBox" />
- <xsl:with-param name="_positionPopup" select="'after_start'" />
- <xsl:with-param name="_refConcat" select="$_refConcat"/>
- </xsl:call-template>
- </xsl:for-each>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="ManageExternalDatas">
- <xsl:with-param name="_refBox" select="$_refBox" />
- <xsl:with-param name="_refExternal" select="$_refHead"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <!-- can select more than one item -->
- <xsl:when test=" number(@maxItem) > 1" >
- <xsl:choose>
- <xsl:when test="$_setType='ximf:set' and ./*[name()='ximf:string']" >
- <xsl:for-each select="*">
- <xsl:if test="name()='ximf:string'">
- <xsl:call-template name="CreateCheckItem">
- <xsl:with-param name="_refString" select="." />
- <xsl:with-param name="_refHeader" select="$_refHeader" />
- <xsl:with-param name="_refBox" select="$_refBox" />
- <xsl:with-param name="_setType" select="$_setType"/>
- <xsl:with-param name="_refConcat" select="$_refConcat"/>
- </xsl:call-template>
- </xsl:if>
- <xsl:if test="name()='ximf:compstring'">
- <xsl:call-template name="CreateMenu">
- <xsl:with-param name="_refNode" select="."/>
- <xsl:with-param name="_refHeader" select="$_refHeader" />
- <xsl:with-param name="_refBox" select="$_refBox" />
- <xsl:with-param name="_refPopupBox" select="$_refPopupBox" />
- <xsl:with-param name="_refConcat" select="$_refConcat"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:for-each>
- </xsl:when>
- <xsl:when test="$_setType='ximf:multiset' and ./*[name()='ximf:string']" >
- <xsl:for-each select="*">
- <xsl:if test="name()='ximf:string'">
- <xsl:call-template name="CreateButtonItem">
- <xsl:with-param name="_refString" select="." />
- <xsl:with-param name="_refHeader" select="$_refHeader" />
- <xsl:with-param name="_refBox" select="$_refBox" />
- <xsl:with-param name="_setType" select="$_setType"/>
- <xsl:with-param name="_refConcat" select="$_refConcat"/>
- </xsl:call-template>
- </xsl:if>
- <xsl:if test="name()='ximf:compstring'">
- <xsl:call-template name="CreateMenu">
- <xsl:with-param name="_refNode" select="."/>
- <xsl:with-param name="_refHeader" select="$_refHeader" />
- <xsl:with-param name="_refBox" select="$_refBox" />
- <xsl:with-param name="_refPopupBox" select="$_refPopupBox" />
- <xsl:with-param name="_refConcat" select="$_refConcat"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:for-each>
- <!-- </menupopup> -->
- </xsl:when>
- <xsl:when test="$_setType='ximf:multiset' and ./*[name()='ximf:compstring']">
- <!-- <menupopup id="{$_refPopupBox}" position="{$_positionPopup}" ximfreftextbox="{$_refBox}"> xp-->
- <xsl:for-each select="ximf:compstring">
- <xsl:call-template name="CreateMenu">
- <xsl:with-param name="_refNode" select="."/>
- <xsl:with-param name="_refHeader" select="$_refHeader" />
- <xsl:with-param name="_refBox" select="$_refBox" />
- <xsl:with-param name="_refPopupBox" select="$_refPopupBox" />
- <xsl:with-param name="_refConcat" select="$_refConcat"/>
- </xsl:call-template>
- </xsl:for-each>
- <!-- </menupopup> -->
- </xsl:when>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="*[name()='ximf:string'] or *[name()='ximf:compstring']">
- <xsl:choose>
- <xsl:when test="ximf:string[@editable='true']">
- <xsl:call-template name="CreateInputBox">
- <xsl:with-param name="_refPopupBox" select="$_refPopupBox"/>
- <xsl:with-param name="_refBox" select="$_refBox"/>
- <xsl:with-param name="_refConcat" select="$_refConcat"/>
- <!-- <xsl:with-param name="_nbRows" select="@minItem" /> -->
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <!-- <menupopup id="{$_refPopupBox}" position="{$_positionPopup}" ximfreftextbox="{$_refBox}"> xp-->
- <xsl:for-each select="*">
- <xsl:if test="name()='ximf:string'">
- <xsl:call-template name="CreateMenuitem">
- <xsl:with-param name="_refString" select="." />
- <xsl:with-param name="_refHeader" select="$_refHeader" />
- <xsl:with-param name="_refBox" select="$_refBox" />
- <xsl:with-param name="_setType" select="$_setType"/>
- <xsl:with-param name="_refConcat" select="$_refConcat"/>
- </xsl:call-template>
- </xsl:if>
- <xsl:if test="name()='ximf:compstring'">
- <xsl:call-template name="CreateMenu">
- <xsl:with-param name="_refNode" select="*"/>
- <xsl:with-param name="_refHeader" select="$_refHeader" />
- <xsl:with-param name="_refBox" select="$_refBox" />
- <xsl:with-param name="_refPopupBox" select="$_refPopupBox" />
- <xsl:with-param name="_refConcat" select="$_refConcat"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:for-each>
- <!-- </menupopup> -->
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </xsl:template>
-
- <!-- *********************************** -->
- <!-- create popup box for external datas -->
- <xsl:template name="ManageExternalDatas">
- <xsl:param name="_refBox"/>
- <xsl:param name="_refExternal"/>
- <box xtern="1" isset="1" refBox="{$_refBox}" refExternal="{$_refExternal}" class="ximfTreeDialog"/>
- </xsl:template>
-
- <!-- ***************** -->
- <!-- create Input box -->
- <xsl:template name="CreateInputBox">
- <xsl:param name="_refPopupBox"/>
- <xsl:param name="_refBox"/>
- <xsl:param name="_refConcat"/>
- <xsl:param name="_nbRows" select="1"/>
-
- <textbox ximfreftextbox="{$_refBox}" class="ximfInputbox" rows="1" flex="1">
- <xsl:if test="number(@maxItem) > 1"> <!-- input box is in tree of menu -->
- <xsl:attribute name="rows">4</xsl:attribute>
- <xsl:attribute name="ximfmaxitems"><xsl:value-of select="@maxItem" /></xsl:attribute>
- <xsl:attribute name="rows"><xsl:value-of select="@minItem" /></xsl:attribute>
- <xsl:attribute name="multiline">true</xsl:attribute>
- </xsl:if>
- <xsl:if test="number(@minItem) > 1"> <!-- input box is in tree of menu -->
- <xsl:attribute name="rows"><xsl:value-of select="@minItem" /></xsl:attribute>
- <xsl:attribute name="multiline">true</xsl:attribute>
- </xsl:if>
- <xsl:if test="string-length($_refConcat) > 0"> <!-- input box is in tree of menu -->
- <xsl:attribute name="ximfconcatid"><xsl:value-of select="$_refConcat" /></xsl:attribute>
- </xsl:if>
- <xsl:if test="@separator">
- <xsl:attribute name="ximfseparator"><xsl:value-of select="@separator" /></xsl:attribute>
- </xsl:if>
- <button class="ximfmailButtonTxt ximfEditor"/>
- </textbox>
- </xsl:template>
-
- <!-- *********************************** -->
- <!-- Manage Menu and Submenu (compstring nodes) -->
- <xsl:template name="CreateMenu">
- <xsl:param name="_refNode"/>
- <xsl:param name="_refHeader"/>
- <xsl:param name="_refBox"/>
- <xsl:param name="_refPopupBox"/>
- <xsl:param name="_refConcat"/>
-
- <xsl:variable name="_id">
- <xsl:call-template name="GetUNID">
- <xsl:with-param name="_refNode" select="$_refNode"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="_newConcat" select="$_id"/>
- <!-- <xsl:variable name="_newConcat" select="concat($_refConcat,'+',$_id)"/> -->
- <richlistitem align="start" ximfenable="true">
- <xsl:if test=".[@ximfchild]">
- <xsl:attribute name="ximfchild"><xsl:value-of select="@ximfchild" /></xsl:attribute>
- </xsl:if>
- <xsl:element name="checkbox">
- <xsl:attribute name="id"><xsl:value-of select="$_id"/></xsl:attribute>
- <xsl:attribute name="disabled">false</xsl:attribute>
- <xsl:attribute name="ximfconcatid"><xsl:value-of select="$_newConcat"/></xsl:attribute>
- <xsl:attribute name="label">
- <xsl:call-template name="getInternational">
- <xsl:with-param name="ilk" select="@ilk" />
- </xsl:call-template>
- </xsl:attribute>
- <xsl:attribute name="ximfvalue"><xsl:value-of select="@content"/></xsl:attribute>
- <xsl:if test="@technicalContent">
- <xsl:attribute name="ximftecvalue"><xsl:value-of select="@technicalContent" /></xsl:attribute>
- </xsl:if>
- <xsl:call-template name="GetFacetsAttribute">
- <xsl:with-param name="_refNode" select="." />
- </xsl:call-template>
- <xsl:if test="@contentPositionEnd">
- <xsl:attribute name="ximfcompositionend"><xsl:value-of select="@contentPositionEnd" /></xsl:attribute>
- </xsl:if>
- </xsl:element>
- <xsl:for-each select="*">
- <xsl:choose>
- <xsl:when test="name()='ximf:compstring'" >
- <xsl:if test="position()=1">
- <xsl:call-template name="CreateMenu">
- <xsl:with-param name="_refNode" select="."/>
- <xsl:with-param name="_refHeader" select="$_refHeader"/>
- <xsl:with-param name="_refBox" select="$_refBox" />
- <xsl:with-param name="_refConcat" select="$_newConcat"/>
- </xsl:call-template>
- <xsl:for-each select="./following-sibling::*">
- <xsl:call-template name="CreateMenu">
- <xsl:with-param name="_refNode" select="."/>
- <xsl:with-param name="_refHeader" select="$_refHeader"/>
- <xsl:with-param name="_refBox" select="$_refBox" />
- <xsl:with-param name="_refConcat" select="$_newConcat"/>
- </xsl:call-template>
- </xsl:for-each>
- <!-- </xsl:element> -->
- </xsl:if>
- </xsl:when>
- <xsl:when test="name()='ximf:set' or name()='ximf:multiset'">
- <vbox>
- <xsl:call-template name="AddSetAndMultisetPanel">
- <xsl:with-param name="_refNode" select="." />
- <xsl:with-param name="_refHeader" select="$_refHeader" />
- <xsl:with-param name="_refBox" select="$_refBox" />
- <xsl:with-param name="_refPopupBox" select="$_refPopupBox" />
- <xsl:with-param name="_positionPopup" select="'end_before'" />
- <xsl:with-param name="_refConcat" select="$_newConcat"/>
- </xsl:call-template>
- </vbox>
- </xsl:when>
- <xsl:when test="name()='ximf:string'">
- <xsl:choose>
- <xsl:when test="@editable='true'">
- <xsl:call-template name="CreateInputBox">
- <xsl:with-param name="_refPopupBox" select="$_refPopupBox"/>
- <xsl:with-param name="_refBox" select="$_refBox"/>
- <xsl:with-param name="_refHeader" select="$_refHeader" />
- <xsl:with-param name="_refConcat" select="$_newConcat"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="CreateMenuitem">
- <xsl:with-param name="_refString" select="$_refNode" />
- <xsl:with-param name="_refHeader" select="$_refHeader" />
- <xsl:with-param name="_refBox" select="$_refBox" />
- <xsl:with-param name="_refConcat" select="$_newConcat"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- </xsl:choose>
- </xsl:for-each>
- </richlistitem>
- </xsl:template>
-
- <!-- *********************** -->
- <!-- Create menuitem element -->
- <xsl:template name="CreateMenuitem">
- <xsl:param name="_refString"/>
- <xsl:param name="_refHeader"/>
- <xsl:param name="_refBox"/>
- <xsl:param name="_setType"/>
- <xsl:param name="_refConcat"/>
- <xsl:for-each select="$_refString">
- <xsl:variable name="_idmenuitem">
- <xsl:call-template name="GetUNID">
- <xsl:with-param name="_refNode" select="."/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test=".[@editable='true']" >
- <xsl:call-template name="CreateInputBox">
- <xsl:with-param name="_refPopupBox" select="$_idmenuitem"/>
- <xsl:with-param name="_refBox" select="$_refBox"/>
- <xsl:with-param name="_refHeader" select="$_refHeader" />
- <xsl:with-param name="_refConcat" select="$_refConcat"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <richlistitem ximfenable="true">
- <xsl:element name="menuitem">
- <xsl:attribute name="class">ximfItem</xsl:attribute>
- <xsl:attribute name="id"><xsl:value-of select="$_idmenuitem" /></xsl:attribute>
- <xsl:attribute name="label">
- <xsl:call-template name="getInternational">
- <xsl:with-param name="ilk" select="@ilk" />
- </xsl:call-template>
- </xsl:attribute>
- <xsl:attribute name="ximfvalue"><xsl:value-of select="@content" /></xsl:attribute>
- <xsl:attribute name="ximftextbox"><xsl:value-of select="$_refBox" /></xsl:attribute>
- <xsl:if test=".[@technicalContent]">
- <xsl:attribute name="ximftecvalue"><xsl:value-of select="@technicalContent" /></xsl:attribute>
- </xsl:if>
- <xsl:if test="string-length($_refConcat) > 0"> <!-- menuitem is in tree of menu -->
- <xsl:attribute name="ximfconcatid"><xsl:value-of select="$_refConcat" /></xsl:attribute>
- </xsl:if>
- <!-- manage link values -->
- <xsl:if test="./ximf:linkedValue">
- <xsl:attribute name="linkpopupbox"><xsl:value-of select="./ximf:linkedValue/@ref"/></xsl:attribute>
- </xsl:if>
- </xsl:element>
- </richlistitem>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </xsl:template>
-
- <!-- *********************** -->
- <!-- Create checkbox element -->
- <xsl:template name="CreateCheckItem">
- <xsl:param name="_refString"/>
- <xsl:param name="_refHeader"/>
- <xsl:param name="_refBox"/>
- <xsl:param name="_setType"/>
- <xsl:param name="_refConcat"/>
- <xsl:for-each select="$_refString">
- <richlistitem ximfenable="true">
- <xsl:element name="checkbox">
- <xsl:attribute name="class">ximCheckbox</xsl:attribute>
- <xsl:attribute name="disabled">false</xsl:attribute>
- <xsl:attribute name="id">
- <xsl:call-template name="GetUNID">
- <xsl:with-param name="_refNode" select="."/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:attribute name="label">
- <xsl:call-template name="getInternational">
- <xsl:with-param name="ilk" select="@ilk" />
- </xsl:call-template>
- </xsl:attribute>
-
- <xsl:attribute name="ximfvalue"><xsl:value-of select="@content" /></xsl:attribute>
- <xsl:if test=".[@technicalContent]">
- <xsl:attribute name="ximftecvalue"><xsl:value-of select="@technicalContent" /></xsl:attribute>
- </xsl:if>
- <xsl:if test="string-length($_refConcat) > 0"> <!-- menuitem is in tree of menu -->
- <xsl:attribute name="ximfconcatid"><xsl:value-of select="$_refConcat" /></xsl:attribute>
- </xsl:if>
- <!-- manage link values -->
- <xsl:if test="./ximf:linkedValue">
- <xsl:attribute name="linkpopupbox"><xsl:value-of select="./ximf:linkedValue/@ref"/></xsl:attribute>
- </xsl:if>
- </xsl:element>
- </richlistitem>
- </xsl:for-each>
- </xsl:template>
-
- <!-- *********************** -->
- <!-- Create button element -->
- <xsl:template name="CreateButtonItem">
- <xsl:param name="_refString"/>
- <xsl:param name="_refHeader"/>
- <xsl:param name="_refBox"/>
- <xsl:param name="_setType"/>
- <xsl:param name="_refConcat"/>
- <xsl:for-each select="$_refString">
- <xsl:element name="button">
- <xsl:attribute name="class">ximfButton</xsl:attribute>
- <xsl:attribute name="id">
- <xsl:call-template name="GetUNID">
- <xsl:with-param name="_refNode" select="."/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:attribute name="label">
- <xsl:call-template name="getInternational">
- <xsl:with-param name="ilk" select="@ilk" />
- </xsl:call-template>
- </xsl:attribute>
- <xsl:attribute name="ximfvalue"><xsl:value-of select="@content" /></xsl:attribute>
- <xsl:if test=".[@technicalContent]">
- <xsl:attribute name="ximftecvalue"><xsl:value-of select="@technicalContent" /></xsl:attribute>
- </xsl:if>
- <xsl:attribute name="ximfreftextbox"><xsl:value-of select="$_refBox" /></xsl:attribute>
- <xsl:if test="string-length($_refConcat) > 0"> <!-- menuitem is in tree of menu -->
- <xsl:attribute name="ximfconcatid"><xsl:value-of select="$_refConcat" /></xsl:attribute>
- </xsl:if>
- <!-- manage link values -->
- <xsl:if test="./ximf:linkedValue">
- <xsl:attribute name="linkpopupbox"><xsl:value-of select="./ximf:linkedValue/@ref"/></xsl:attribute>
- </xsl:if>
- </xsl:element>
- </xsl:for-each>
- </xsl:template>
-
- <!-- ******************************* -->
- <!-- create context menu for textbox -->
- <xsl:template name="CreateContext">
- <xsl:param name="refBox"/>
- <xsl:param name="idContext"/>
- <popup id="{$idContext}">
- <menuitem class="ximfContext" idx="1" idbox="{$refBox}" label="ximfmail.composer.context.eraseall"/>
- <menuitem class="ximfContext" idx="2" idbox="{$refBox}" label="ximfmail.composer.context.details" />
- </popup>
- </xsl:template>
-
- <!-- ********************** -->
- <!-- insert image of eraser -->
- <xsl:template name="AppendToolButtons">
- <xsl:param name="refBox"/>
- <button
- class="ximfmailButton ximfDetail"
- id="{concat($refBox,$gIdSeparator,'ximfdetail')}"
- refLabel="{$refBox}"/>
- <button
- class="ximfmailButton ximfEraser"
- id="{concat($refBox,$gIdSeparator,'ximferaser')}"
- refValue="{$refBox}"/>
- </xsl:template>
-
- <!-- *********************************************** -->
- <!-- internationalisation of ilk attribute template -->
- <xsl:template name="getInternational">
- <xsl:param name="ilk" />
- <xsl:variable name="value-ilk" select="/ximf:instance/ximf:dictionary/ximf:locale[@lang=$gLang]/ximf:ilk[$ilk=@entity]" />
- <xsl:choose>
- <xsl:when test="string-length($value-ilk) <= 0"><xsl:value-of select="$ilk" /></xsl:when><!-- lire a <= b -->
- <xsl:otherwise><xsl:value-of select="$value-ilk" /></xsl:otherwise>
- </xsl:choose>
- </xsl:template>
+<?xml version="1.0" encoding="UTF-8"?>\r
+\r
+<!-- ***** 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
+<xsl:stylesheet version="2.0"\r
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"\r
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\r
+ xmlns:ximf="http://eads.org/ximf/">\r
+ <xsl:output method="xml" encoding="UTF-8" indent="yes" version="1.0"\r
+ doctype-system="chrome://ximfmail/locale/ximfmail.dtd" />\r
+\r
+ <xsl:param name="gLang">us</xsl:param>\r
+ <xsl:param name="gIdSeparator">·</xsl:param> <!-- unicode of middle dot -->\r
+\r
+ <!-- MAIN FUNCTION -->\r
+ <xsl:template match="/"> \r
+ <xsl:choose>\r
+ <xsl:when test="/ximf:instance/ximf:ihm">\r
+ <xsl:call-template name="CustomizedIhm" /> \r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:call-template name="DefaultIhm" />\r
+ </xsl:otherwise> \r
+ </xsl:choose>\r
+ \r
+ </xsl:template>\r
+\r
+ <!-- DEFAULT PANEL -->\r
+ <xsl:template name="DefaultIhm">\r
+ <tabs>\r
+ <tab id="tabdefaultheaders" label="Headers" />\r
+ <tab id="tabpanelinformations" label="Informations" />\r
+ </tabs>\r
+ <tabpanels id="instanceXimfmail">\r
+ <xsl:for-each select="ximf:instance">\r
+ <tabpanel id="defaultheaders">\r
+ <grid>\r
+ <columns>\r
+ <column id="id_col1_{@id}" />\r
+ <column id="id_col2_{@id}" />\r
+ <column id="id_col3_{@id}" />\r
+ <column id="id_col4_{@id}" /> \r
+ </columns>\r
+ <rows id="id_rows_{@id}"> \r
+ <xsl:for-each select="ximf:header"> \r
+ <xsl:call-template name="InsertRow">\r
+ <xsl:with-param name="headerRef" select="@id" />\r
+ </xsl:call-template> \r
+ </xsl:for-each>\r
+ </rows>\r
+ </grid>\r
+ <xsl:call-template name="AddHeadersHidden" /> \r
+ </tabpanel>\r
+ <tabpanel id="panelinformations">\r
+ <grid>\r
+ <columns>\r
+ <column id="_col1" />\r
+ <column id="_col2" />\r
+ </columns>\r
+ <rows> \r
+ <row>\r
+ <label value="Instance identifier : " />\r
+ <label value="{@id}" style="color:blue; font-weight:bold;" />\r
+ </row>\r
+ <row>\r
+ <label value="Instance version : " />\r
+ <label value="{@version}" style="color:blue; font-weight:bold;" />\r
+ </row>\r
+ <row>\r
+ <label value="XIMF schema version : " />\r
+ <label value="{@ximfVersion}" style="color:blue; font-weight:bold;" />\r
+ </row>\r
+ </rows>\r
+ </grid>\r
+ </tabpanel>\r
+ </xsl:for-each>\r
+ </tabpanels> \r
+ \r
+ </xsl:template>\r
+\r
+ <!-- CUSTOM IHM -->\r
+ <xsl:template name="CustomizedIhm">\r
+ <tabs>\r
+ <xsl:for-each select="/ximf:instance/ximf:ihm/ximf:panel">\r
+ <xsl:element name="tab" id="tab{@id}" accesskey="*"> \r
+ <xsl:attribute name="id">\r
+ <xsl:value-of select="concat('tab',@id)"/> \r
+ </xsl:attribute> \r
+ <xsl:attribute name="label">\r
+ <xsl:call-template name="getInternational">\r
+ <xsl:with-param name="ilk" select="@ilk" /> \r
+ </xsl:call-template> \r
+ </xsl:attribute>\r
+ </xsl:element>\r
+ </xsl:for-each>\r
+ </tabs>\r
+ <tabpanels flex="1">\r
+ <xsl:for-each select="/ximf:instance/ximf:ihm/ximf:panel"> \r
+ <tabpanel id="{@id}" class="ximfpane" flex="1">\r
+ <xsl:for-each select="*">\r
+ <xsl:choose>\r
+ <xsl:when test="name()='ximf:groupbox'">\r
+ <groupbox flex="1">\r
+ <xsl:element name="caption">\r
+ <xsl:attribute name="label"> \r
+ <xsl:call-template name="getInternational">\r
+ <xsl:with-param name="ilk" select="@ilk" /> \r
+ </xsl:call-template> \r
+ </xsl:attribute>\r
+ </xsl:element>\r
+ <xsl:call-template name="CreateGrid">\r
+ <xsl:with-param name="headerSeq" select="." />\r
+ </xsl:call-template> \r
+ </groupbox>\r
+ </xsl:when>\r
+ <xsl:when test="name()='ximf:grid'">\r
+ <xsl:call-template name="CreateGrid">\r
+ <xsl:with-param name="headerSeq" select="." />\r
+ </xsl:call-template>\r
+ </xsl:when> \r
+ <xsl:otherwise/>\r
+ </xsl:choose>\r
+ </xsl:for-each>\r
+ <!-- no container defined : create grid-->\r
+ <vbox flex="1">\r
+ <grid flex="1">\r
+ <columns>\r
+ <column id="id_col1_{@id}" />\r
+ <column id="id_col2_{@id}" flex="1"/>\r
+ <column id="id_col3_{@id}" />\r
+ <column id="id_col4_{@id}" /> \r
+ </columns>\r
+ <rows id="id_rows_{@id}">\r
+ <xsl:for-each select="ximf:headerRef">\r
+ <xsl:call-template name="InsertRow">\r
+ <xsl:with-param name="headerRef" select="." />\r
+ </xsl:call-template>\r
+ </xsl:for-each>\r
+ </rows>\r
+ </grid > \r
+ </vbox> \r
+ <xsl:if test="position()=1">\r
+ <xsl:call-template name="AddHeadersHidden" /> \r
+ </xsl:if> \r
+ </tabpanel>\r
+ </xsl:for-each>\r
+ </tabpanels> \r
+ </xsl:template>\r
+ \r
+ <!-- ****************************************************** -->\r
+ <!-- template to append headers ximf without ihm definition -->\r
+ <xsl:template name="AddHeadersHidden">\r
+ <vbox hidden="true"> \r
+ <xsl:for-each select="/ximf:instance/ximf:header">\r
+ <xsl:choose> \r
+ <xsl:when test="string-length(@ilk) > 0">\r
+ </xsl:when>\r
+ <xsl:otherwise> \r
+ <xsl:element name="label"> \r
+ <xsl:attribute name="class">ximfHiddenHeader</xsl:attribute>\r
+ <xsl:attribute name="ximfheader"><xsl:value-of select="@headerName" /></xsl:attribute>\r
+ <xsl:attribute name="ximfvalue"><xsl:value-of select="./ximf:string/@content" /></xsl:attribute> \r
+ </xsl:element> \r
+ </xsl:otherwise> \r
+ </xsl:choose> \r
+ </xsl:for-each>\r
+ </vbox>\r
+ </xsl:template>\r
+ \r
+ \r
+ <!-- **************************** -->\r
+ <!-- template to create grid ximf -->\r
+ <xsl:template name="CreateGrid">\r
+ <xsl:param name="headerSeq" select="" />\r
+ <grid flex="1" >\r
+ <columns>\r
+ <column id="id_col1_{$headerSeq/@id}" />\r
+ <column id="id_col2_{$headerSeq/@id}" flex="1"/>\r
+ <column id="id_col3_{$headerSeq/@id}" />\r
+ <column id="id_col4_{$headerSeq/@id}" /> \r
+ </columns>\r
+ <rows id="id_rows_{$headerSeq/@id}" >\r
+ <xsl:for-each select="$headerSeq/ximf:headerRef">\r
+ <xsl:call-template name="InsertRow">\r
+ <xsl:with-param name="headerRef" select="." />\r
+ </xsl:call-template>\r
+ </xsl:for-each>\r
+ </rows>\r
+ </grid>\r
+ </xsl:template>\r
+ \r
+ <!-- ************************************* -->\r
+ <!-- template to create id of Popup element-->\r
+ <xsl:template name="GetPopupId">\r
+ <xsl:param name="_refNode"/>\r
+ <xsl:param name="_refHeader"/>\r
+ <xsl:choose>\r
+ <xsl:when test="string-length(@id) <= 0">\r
+ <xsl:value-of select="concat($_refHeader,$gIdSeparator,'ximfmailPopup')"/>\r
+ </xsl:when>\r
+ <xsl:otherwise> \r
+ <xsl:value-of select="@id"/> \r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:template> \r
+ \r
+ <!--************************************************** -->\r
+ <!-- template to row in grid with ximf header elements -->\r
+ <xsl:template name="InsertRow">\r
+ <xsl:param name="headerRef" select="" />\r
+ <xsl:for-each select="/ximf:instance/ximf:header[$headerRef=@id]">\r
+ <!-- <xsl:variable name="_headerId" select="@id" />-->\r
+ <xsl:variable name="_headerId">\r
+ <xsl:call-template name="GetUNID"> \r
+ <xsl:with-param name="_refNode" select="."/> \r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <row align="center" flex="1">\r
+ \r
+ <!-- Header name label -->\r
+ <xsl:variable name="_ilkLabel">\r
+ <xsl:call-template name='getInternational'>\r
+ <xsl:with-param name='ilk' select='@ilk' /> \r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <xsl:element name="label">\r
+ <xsl:attribute name="id"><xsl:value-of select="$_headerId"/></xsl:attribute>\r
+ <xsl:attribute name="class">ximfHeaderLabel</xsl:attribute>\r
+ <xsl:attribute name="value"> \r
+ <xsl:value-of select="concat($_ilkLabel,' : ')"/>\r
+ </xsl:attribute>\r
+ <xsl:attribute name="ximfheader"><xsl:value-of select="@headerName" /></xsl:attribute>\r
+ <xsl:if test="string-length(@technicalHeaderName)>0">\r
+ <xsl:attribute name="ximftecheader"><xsl:value-of select="@technicalHeaderName" /></xsl:attribute>\r
+ </xsl:if>\r
+ <xsl:if test="string-length(@isMandatory)>0">\r
+ <xsl:attribute name="ximfmandatory"><xsl:value-of select="@isMandatory" /></xsl:attribute>\r
+ </xsl:if>\r
+ </xsl:element>\r
+ \r
+ <!-- count how many set or multiset -->\r
+ <xsl:variable name="_counterset" select="count(./ximf:set)"/>\r
+ <xsl:variable name="_countermultiset" select="count(./ximf:multiset)"/>\r
+ \r
+ <!-- variables of IDs -->\r
+ <xsl:variable name="idBox" select="concat($_headerId,$gIdSeparator,'ximfvalue')"/> \r
+ \r
+ <!-- Value field elements --> \r
+ <xsl:for-each select="*">\r
+ <xsl:variable name="_idBox" select="concat($_headerId,$gIdSeparator,'ximfmailtextbox')"/>\r
+ <xsl:variable name="_idPopupSet"> \r
+ <xsl:call-template name="GetUNID"> \r
+ <xsl:with-param name="_refNode" select="."/> \r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <xsl:choose> \r
+ <xsl:when test="name()='ximf:string'"> \r
+ <xsl:if test="@editable='true'">\r
+ <xsl:call-template name="CreateXimfmailTextbox">\r
+ <xsl:with-param name="_refNode" select="." />\r
+ <xsl:with-param name="_refHeader" select="$_headerId" />\r
+ <xsl:with-param name="_refBox" select="$_idBox" /> \r
+ <xsl:with-param name="_refPopupBox" select="$_idPopupSet"/> \r
+ </xsl:call-template>\r
+ <popup id="{$_idPopupSet}" ximfreftextbox="{$_idBox}" position="after_start" ignorekeys="true" >\r
+ <xsl:call-template name="CreateInputBox"> \r
+ <xsl:with-param name="_refPopupBox" select="$_idPopupSet"/>\r
+ <xsl:with-param name="_refBox" select="$_idBox"/>\r
+ <xsl:with-param name="_refHeader" select="$_headerId" /> \r
+ </xsl:call-template>\r
+ </popup>\r
+ </xsl:if> \r
+ </xsl:when> \r
+ <xsl:when test="name()='ximf:set' or name()='ximf:multiset' or name()='ximf:compstring'">\r
+ <!-- if multiple set, just create 1 textbox -->\r
+ <xsl:if test="position()=1"> \r
+ <xsl:choose>\r
+ <!-- if multiple set, no default context popupset -->\r
+ <xsl:when test="$_counterset > 1 or $_countermultiset > 1"> \r
+ <xsl:call-template name="CreateXimfmailTextbox">\r
+ <xsl:with-param name="_refNode" select="." />\r
+ <xsl:with-param name="_refHeader" select="$_headerId" />\r
+ <xsl:with-param name="_refBox" select="$_idBox" /> \r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <xsl:otherwise> \r
+ <xsl:call-template name="CreateXimfmailTextbox">\r
+ <xsl:with-param name="_refNode" select="." />\r
+ <xsl:with-param name="_refHeader" select="$_headerId" />\r
+ <xsl:with-param name="_refBox" select="$_idBox" />\r
+ <xsl:with-param name="_refPopupBox" select="$_idPopupSet" />\r
+ </xsl:call-template>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:if>\r
+ \r
+ <!-- Create panel element set/multiset -->\r
+ <xsl:if test="name()='ximf:set' or name()='ximf:multiset'"> \r
+ <panel id="{$_idPopupSet}" ximfreftextbox="{$_idBox}" ximfmaxitem="1"> \r
+ <xsl:if test="@maxItem">\r
+ <xsl:attribute name="ximfmaxitem"><xsl:value-of select="@maxItem" /></xsl:attribute>\r
+ </xsl:if> \r
+ <xsl:if test="@ximfdefault">\r
+ <xsl:attribute name="ximfdefault"><xsl:value-of select="@ximfdefault" /></xsl:attribute>\r
+ </xsl:if> \r
+ <xsl:call-template name="GetFacetsAttribute">\r
+ <xsl:with-param name="_refNode" select="." />\r
+ </xsl:call-template>\r
+ <xsl:call-template name="GetXimfProperties">\r
+ <xsl:with-param name="_refNode" select="." />\r
+ <xsl:with-param name="_refHeader" select="$_headerId" />\r
+ <xsl:with-param name="_refBox" select="$_idBox" /> \r
+ </xsl:call-template>\r
+ <arrowscrollbox orient="vertical" style="max-height:400px;"> \r
+ <richlistbox> \r
+ <xsl:call-template name="AddSetAndMultisetPanel">\r
+ <xsl:with-param name="_refNode" select="." />\r
+ <xsl:with-param name="_refHeader" select="$_headerId" />\r
+ <xsl:with-param name="_refBox" select="$_idBox" />\r
+ <xsl:with-param name="_refPopupBox" select="$_idPopupSet" />\r
+ <xsl:with-param name="_positionPopup" select="'after_start'" />\r
+ </xsl:call-template>\r
+ </richlistbox>\r
+ </arrowscrollbox>\r
+ </panel>\r
+ </xsl:if>\r
+ \r
+ <!-- Create Popupset compstring -->\r
+ <xsl:if test="name()='ximf:compstring'">\r
+ <popup id="{$_idPopupSet}" ximfreftextbox="{$_idBox}" position="after_start" ignorekeys="true">\r
+ <xsl:call-template name="GetFacetsAttribute">\r
+ <xsl:with-param name="_refNode" select="." />\r
+ </xsl:call-template>\r
+ <xsl:call-template name="CreateMenu">\r
+ <xsl:with-param name="_refNode" select="*"/>\r
+ <xsl:with-param name="_refHeader" select="$_headerId" />\r
+ <xsl:with-param name="_refBox" select="$_idBox" />\r
+ <xsl:with-param name="_refPopupBox" select="$_idPopupSet" /> \r
+ </xsl:call-template>\r
+ </popup>\r
+ </xsl:if>\r
+ </xsl:when>\r
+ <xsl:otherwise/> \r
+ </xsl:choose>\r
+ </xsl:for-each> \r
+ </row>\r
+ </xsl:for-each>\r
+ </xsl:template>\r
+ \r
+ <!-- ***************************** -->\r
+ <!-- add fascets attributes of ximf schema -->\r
+ <xsl:template name="GetFacetsAttribute">\r
+ <xsl:param name="_refNode" />\r
+ <xsl:if test="@separator">\r
+ <xsl:attribute name="ximfseparator"><xsl:value-of select="@separator"/></xsl:attribute>\r
+ </xsl:if>\r
+ <xsl:if test="@technicalSeparator">\r
+ <xsl:attribute name="ximftecseparator"><xsl:value-of select="@technicalSeparator"/></xsl:attribute>\r
+ </xsl:if> \r
+ </xsl:template> \r
+ \r
+ <!-- *********************************** --> \r
+ <!-- Create IHM elements of Ximfmail row -->\r
+ <xsl:template name="CreateXimfmailTextbox"> \r
+ <xsl:param name="_refNode"/>\r
+ <xsl:param name="_refHeader"/>\r
+ <xsl:param name="_refBox"/>\r
+ <xsl:param name="_refPopupBox"/> \r
+ \r
+ <xsl:variable name="idContextBox" select="concat($_refHeader,$gIdSeparator,'ximfmailTextboxContext')"/> \r
+ <xsl:choose>\r
+ <xsl:when test="/ximf:instance/ximf:header[@id=$_refHeader][@type='date']"> \r
+ <textbox flex="1" id="{$_refBox}" refheader="{$_refHeader}" class="ximfDatetime" context="{$idContextBox}" readonly="false">\r
+ <button class="ximfmailButtonTxt ximfDatepicker" refBox="{$_refBox}"/> \r
+ </textbox> \r
+ <xsl:call-template name="AppendToolButtons">\r
+ <xsl:with-param name="refBox" select="$_refBox"/> \r
+ </xsl:call-template> \r
+ </xsl:when>\r
+ <xsl:when test="/ximf:instance/ximf:header[@id=$_refHeader][@type='address']"> \r
+ <ximfaddress id="{$_refBox}" refheader="{$_refHeader}" /> \r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <textbox flex="1" id="{$_refBox}" refheader="{$_refHeader}" class="XimfTextboxDisplay" context="{$idContextBox}" refpanel="{$_refPopupBox}" readonly="false">\r
+ <xsl:if test="string-length($_refNode/@maxItem) > 0">\r
+ <xsl:attribute name="ximfmaxitems"><xsl:value-of select="$_refNode/@maxItem"/></xsl:attribute>\r
+ </xsl:if>\r
+ <xsl:if test="string-length($_refNode/@separator) > 0">\r
+ <xsl:attribute name="ximfseparator"><xsl:value-of select="$_refNode/@separator"/></xsl:attribute>\r
+ </xsl:if> \r
+ <button class="ximfmailButtonTxt ximfPopup" refpanel="{$_refPopupBox}"/> \r
+ </textbox>\r
+ <!-- Eraser image -->\r
+ <xsl:call-template name="AppendToolButtons">\r
+ <xsl:with-param name="refBox" select="$_refBox"/> \r
+ </xsl:call-template>\r
+ </xsl:otherwise>\r
+ </xsl:choose> \r
+ <!-- Context popupset -->\r
+ <xsl:call-template name="CreateContext">\r
+ <xsl:with-param name="refBox" select="$_refBox"/>\r
+ <xsl:with-param name="idContext" select="$idContextBox"/>\r
+ </xsl:call-template>\r
+ </xsl:template>\r
+ \r
+ <!-- **************************** -->\r
+ <!-- construct or get ID for node --> \r
+ <xsl:template name="GetUNID">\r
+ <xsl:param name="_refNode"/>\r
+ <xsl:choose>\r
+ <xsl:when test="string-length($_refNode/@id)>0">\r
+ <xsl:value-of select="$_refNode/@id" /> \r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:value-of select="concat(generate-id($_refNode/ancestor::ximf:header),$gIdSeparator,generate-id($_refNode),$gIdSeparator,position())" /> \r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+ \r
+ <!-- ************************************** -->\r
+ <!-- create attributes with Ximf properties --> \r
+ <xsl:template name="GetXimfProperties">\r
+ <xsl:param name="_refNode"/>\r
+ <xsl:param name="_refHeader"/>\r
+ <xsl:param name="_refBox"/>\r
+ <xsl:param name="_refPopupBox"/>\r
+ \r
+ <xsl:for-each select="$_refNode">\r
+ <xsl:if test="$_refHeader">\r
+ <xsl:attribute name="ximfrefheader"><xsl:value-of select="$_refHeader"/></xsl:attribute>\r
+ </xsl:if>\r
+ <xsl:if test="$_refBox">\r
+ <xsl:attribute name="ximfreftextbox"><xsl:value-of select="$_refBox"/></xsl:attribute>\r
+ </xsl:if>\r
+ <xsl:if test=".[@maxLength]">\r
+ <xsl:attribute name="ximfmaxlength"><xsl:value-of select="@maxLength"/></xsl:attribute>\r
+ </xsl:if>\r
+ <xsl:if test=".[@minLength]"> \r
+ <xsl:attribute name="ximfminlength"><xsl:value-of select="@minLength"/></xsl:attribute>\r
+ </xsl:if>\r
+ <xsl:if test=".[@maxItem]">\r
+ <xsl:attribute name="ximfmaxitem"><xsl:value-of select="@maxItem"/></xsl:attribute>\r
+ </xsl:if>\r
+ <xsl:if test=".[@minItem]">\r
+ <xsl:attribute name="ximfminitem"><xsl:value-of select="@minItem"/></xsl:attribute>\r
+ </xsl:if>\r
+ <xsl:if test=".[@separator]">\r
+ <xsl:attribute name="ximfseparator"><xsl:value-of select="@separator"/></xsl:attribute>\r
+ </xsl:if>\r
+ <xsl:if test=".[@technicalSeparator]">\r
+ <xsl:attribute name="ximftecseparator"><xsl:value-of select="@technicalSeparator"/></xsl:attribute>\r
+ </xsl:if>\r
+ \r
+ </xsl:for-each>\r
+ </xsl:template>\r
+ \r
+ \r
+ <!-- ******************************** --> \r
+ <!-- Manage set and multiset elements -->\r
+ <xsl:template name="AddSetAndMultisetPanel">\r
+ <xsl:param name="_refNode"/>\r
+ <xsl:param name="_refHeader"/>\r
+ <xsl:param name="_refBox"/>\r
+ <xsl:param name="_refPopupBox"/>\r
+ <xsl:param name="_positionPopup" />\r
+ <xsl:param name="_refConcat" />\r
+ \r
+ <!-- <xsl:for-each select="$_setType[$refNode=@id]"> -->\r
+ <xsl:for-each select="$_refNode">\r
+ <xsl:variable name="_setType" select="name()"/> \r
+ <xsl:choose>\r
+ <!-- Reference to another set/multiset -->\r
+ <xsl:when test="string-length(@ref)>0">\r
+ <xsl:variable name="_refHead" select="@ref"/> \r
+ <xsl:choose>\r
+ <xsl:when test="count(//*[@id=$_refHead])>0"> \r
+ <xsl:for-each select="//*[@id=$_refHead]">\r
+ <xsl:call-template name="AddSetAndMultisetPanel">\r
+ <xsl:with-param name="_refNode" select="." />\r
+ <xsl:with-param name="_refHeader" select="$_refHeader" />\r
+ <xsl:with-param name="_refBox" select="$_refBox" />\r
+ <xsl:with-param name="_refPopupBox" select="$_refPopupBox" />\r
+ <xsl:with-param name="_positionPopup" select="'after_start'" /> \r
+ <xsl:with-param name="_refConcat" select="$_refConcat"/> \r
+ </xsl:call-template>\r
+ </xsl:for-each> \r
+ </xsl:when>\r
+ <xsl:otherwise> \r
+ <xsl:call-template name="ManageExternalDatas">\r
+ <xsl:with-param name="_refBox" select="$_refBox" />\r
+ <xsl:with-param name="_refExternal" select="$_refHead"/> \r
+ </xsl:call-template> \r
+ </xsl:otherwise>\r
+ </xsl:choose> \r
+ </xsl:when> \r
+ <!-- can select more than one item -->\r
+ <xsl:when test=" number(@maxItem) > 1" >\r
+ <xsl:choose>\r
+ <xsl:when test="$_setType='ximf:set' and ./*[name()='ximf:string']" >\r
+ <xsl:for-each select="*">\r
+ <xsl:if test="name()='ximf:string'">\r
+ <xsl:call-template name="CreateCheckItem"> \r
+ <xsl:with-param name="_refString" select="." /> \r
+ <xsl:with-param name="_refHeader" select="$_refHeader" />\r
+ <xsl:with-param name="_refBox" select="$_refBox" />\r
+ <xsl:with-param name="_setType" select="$_setType"/>\r
+ <xsl:with-param name="_refConcat" select="$_refConcat"/> \r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ <xsl:if test="name()='ximf:compstring'">\r
+ <xsl:call-template name="CreateMenu"> \r
+ <xsl:with-param name="_refNode" select="."/>\r
+ <xsl:with-param name="_refHeader" select="$_refHeader" />\r
+ <xsl:with-param name="_refBox" select="$_refBox" />\r
+ <xsl:with-param name="_refPopupBox" select="$_refPopupBox" />\r
+ <xsl:with-param name="_refConcat" select="$_refConcat"/> \r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ </xsl:for-each> \r
+ </xsl:when>\r
+ <xsl:when test="$_setType='ximf:multiset' and ./*[name()='ximf:string']" >\r
+ <xsl:for-each select="*">\r
+ <xsl:if test="name()='ximf:string'">\r
+ <xsl:call-template name="CreateButtonItem"> \r
+ <xsl:with-param name="_refString" select="." /> \r
+ <xsl:with-param name="_refHeader" select="$_refHeader" />\r
+ <xsl:with-param name="_refBox" select="$_refBox" />\r
+ <xsl:with-param name="_setType" select="$_setType"/>\r
+ <xsl:with-param name="_refConcat" select="$_refConcat"/> \r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ <xsl:if test="name()='ximf:compstring'">\r
+ <xsl:call-template name="CreateMenu"> \r
+ <xsl:with-param name="_refNode" select="."/>\r
+ <xsl:with-param name="_refHeader" select="$_refHeader" />\r
+ <xsl:with-param name="_refBox" select="$_refBox" />\r
+ <xsl:with-param name="_refPopupBox" select="$_refPopupBox" />\r
+ <xsl:with-param name="_refConcat" select="$_refConcat"/> \r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ </xsl:for-each>\r
+ <!-- </menupopup> --> \r
+ </xsl:when>\r
+ <xsl:when test="$_setType='ximf:multiset' and ./*[name()='ximf:compstring']"> \r
+ <!-- <menupopup id="{$_refPopupBox}" position="{$_positionPopup}" ximfreftextbox="{$_refBox}"> xp--> \r
+ <xsl:for-each select="ximf:compstring"> \r
+ <xsl:call-template name="CreateMenu">\r
+ <xsl:with-param name="_refNode" select="."/>\r
+ <xsl:with-param name="_refHeader" select="$_refHeader" />\r
+ <xsl:with-param name="_refBox" select="$_refBox" />\r
+ <xsl:with-param name="_refPopupBox" select="$_refPopupBox" />\r
+ <xsl:with-param name="_refConcat" select="$_refConcat"/> \r
+ </xsl:call-template> \r
+ </xsl:for-each> \r
+ <!-- </menupopup> -->\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ </xsl:when>\r
+ <xsl:when test="*[name()='ximf:string'] or *[name()='ximf:compstring']">\r
+ <xsl:choose>\r
+ <xsl:when test="ximf:string[@editable='true']"> \r
+ <xsl:call-template name="CreateInputBox"> \r
+ <xsl:with-param name="_refPopupBox" select="$_refPopupBox"/>\r
+ <xsl:with-param name="_refBox" select="$_refBox"/>\r
+ <xsl:with-param name="_refConcat" select="$_refConcat"/> \r
+ <!-- <xsl:with-param name="_nbRows" select="@minItem" /> -->\r
+ </xsl:call-template> \r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <!-- <menupopup id="{$_refPopupBox}" position="{$_positionPopup}" ximfreftextbox="{$_refBox}"> xp--> \r
+ <xsl:for-each select="*">\r
+ <xsl:if test="name()='ximf:string'">\r
+ <xsl:call-template name="CreateMenuitem">\r
+ <xsl:with-param name="_refString" select="." /> \r
+ <xsl:with-param name="_refHeader" select="$_refHeader" />\r
+ <xsl:with-param name="_refBox" select="$_refBox" />\r
+ <xsl:with-param name="_setType" select="$_setType"/> \r
+ <xsl:with-param name="_refConcat" select="$_refConcat"/> \r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ <xsl:if test="name()='ximf:compstring'">\r
+ <xsl:call-template name="CreateMenu">\r
+ <xsl:with-param name="_refNode" select="*"/>\r
+ <xsl:with-param name="_refHeader" select="$_refHeader" />\r
+ <xsl:with-param name="_refBox" select="$_refBox" />\r
+ <xsl:with-param name="_refPopupBox" select="$_refPopupBox" /> \r
+ <xsl:with-param name="_refConcat" select="$_refConcat"/> \r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ </xsl:for-each>\r
+ <!-- </menupopup> -->\r
+ </xsl:otherwise>\r
+ </xsl:choose> \r
+ </xsl:when> \r
+ <xsl:otherwise>\r
+ </xsl:otherwise>\r
+ </xsl:choose> \r
+ </xsl:for-each>\r
+ </xsl:template>\r
+ \r
+ <!-- *********************************** -->\r
+ <!-- create popup box for external datas -->\r
+ <xsl:template name="ManageExternalDatas">\r
+ <xsl:param name="_refBox"/>\r
+ <xsl:param name="_refExternal"/>\r
+ <box xtern="1" isset="1" refBox="{$_refBox}" refExternal="{$_refExternal}" class="ximfTreeDialog"/> \r
+ </xsl:template>\r
+ \r
+ <!-- ***************** -->\r
+ <!-- create Input box -->\r
+ <xsl:template name="CreateInputBox"> \r
+ <xsl:param name="_refPopupBox"/>\r
+ <xsl:param name="_refBox"/>\r
+ <xsl:param name="_refConcat"/>\r
+ <xsl:param name="_nbRows" select="1"/> \r
+ \r
+ <textbox ximfreftextbox="{$_refBox}" class="ximfInputbox" rows="1" flex="1"> \r
+ <xsl:if test="number(@maxItem) > 1"> <!-- input box is in tree of menu -->\r
+ <xsl:attribute name="rows">4</xsl:attribute>\r
+ <xsl:attribute name="ximfmaxitems"><xsl:value-of select="@maxItem" /></xsl:attribute>\r
+ <xsl:attribute name="rows"><xsl:value-of select="@minItem" /></xsl:attribute>\r
+ <xsl:attribute name="multiline">true</xsl:attribute>\r
+ </xsl:if>\r
+ <xsl:if test="number(@minItem) > 1"> <!-- input box is in tree of menu -->\r
+ <xsl:attribute name="rows"><xsl:value-of select="@minItem" /></xsl:attribute> \r
+ <xsl:attribute name="multiline">true</xsl:attribute>\r
+ </xsl:if>\r
+ <xsl:if test="string-length($_refConcat) > 0"> <!-- input box is in tree of menu -->\r
+ <xsl:attribute name="ximfconcatid"><xsl:value-of select="$_refConcat" /></xsl:attribute> \r
+ </xsl:if>\r
+ <xsl:if test="@separator">\r
+ <xsl:attribute name="ximfseparator"><xsl:value-of select="@separator" /></xsl:attribute>\r
+ </xsl:if>\r
+ <button class="ximfmailButtonTxt ximfEditor"/>\r
+ </textbox>\r
+ </xsl:template>\r
+ \r
+ <!-- *********************************** -->\r
+ <!-- Manage Menu and Submenu (compstring nodes) -->\r
+ <xsl:template name="CreateMenu">\r
+ <xsl:param name="_refNode"/>\r
+ <xsl:param name="_refHeader"/>\r
+ <xsl:param name="_refBox"/>\r
+ <xsl:param name="_refPopupBox"/>\r
+ <xsl:param name="_refConcat"/>\r
+ \r
+ <xsl:variable name="_id">\r
+ <xsl:call-template name="GetUNID"> \r
+ <xsl:with-param name="_refNode" select="$_refNode"/> \r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <xsl:variable name="_newConcat" select="$_id"/>\r
+ <!-- <xsl:variable name="_newConcat" select="concat($_refConcat,'+',$_id)"/> -->\r
+ <richlistitem align="start" ximfenable="true">\r
+ <xsl:if test=".[@ximfchild]">\r
+ <xsl:attribute name="ximfchild"><xsl:value-of select="@ximfchild" /></xsl:attribute>\r
+ </xsl:if> \r
+ <xsl:element name="checkbox">\r
+ <xsl:attribute name="id"><xsl:value-of select="$_id"/></xsl:attribute> \r
+ <xsl:attribute name="disabled">false</xsl:attribute>\r
+ <xsl:attribute name="ximfconcatid"><xsl:value-of select="$_newConcat"/></xsl:attribute>\r
+ <xsl:attribute name="label">\r
+ <xsl:call-template name="getInternational">\r
+ <xsl:with-param name="ilk" select="@ilk" /> \r
+ </xsl:call-template>\r
+ </xsl:attribute> \r
+ <xsl:attribute name="ximfvalue"><xsl:value-of select="@content"/></xsl:attribute>\r
+ <xsl:if test="@technicalContent">\r
+ <xsl:attribute name="ximftecvalue"><xsl:value-of select="@technicalContent" /></xsl:attribute>\r
+ </xsl:if> \r
+ <xsl:call-template name="GetFacetsAttribute">\r
+ <xsl:with-param name="_refNode" select="." />\r
+ </xsl:call-template>\r
+ <xsl:if test="@contentPositionEnd">\r
+ <xsl:attribute name="ximfcompositionend"><xsl:value-of select="@contentPositionEnd" /></xsl:attribute>\r
+ </xsl:if>\r
+ </xsl:element> \r
+ <xsl:for-each select="*">\r
+ <xsl:choose>\r
+ <xsl:when test="name()='ximf:compstring'" >\r
+ <xsl:if test="position()=1"> \r
+ <xsl:call-template name="CreateMenu"> \r
+ <xsl:with-param name="_refNode" select="."/>\r
+ <xsl:with-param name="_refHeader" select="$_refHeader"/>\r
+ <xsl:with-param name="_refBox" select="$_refBox" />\r
+ <xsl:with-param name="_refConcat" select="$_newConcat"/>\r
+ </xsl:call-template> \r
+ <xsl:for-each select="./following-sibling::*">\r
+ <xsl:call-template name="CreateMenu"> \r
+ <xsl:with-param name="_refNode" select="."/>\r
+ <xsl:with-param name="_refHeader" select="$_refHeader"/>\r
+ <xsl:with-param name="_refBox" select="$_refBox" />\r
+ <xsl:with-param name="_refConcat" select="$_newConcat"/> \r
+ </xsl:call-template> \r
+ </xsl:for-each> \r
+ <!-- </xsl:element> --> \r
+ </xsl:if>\r
+ </xsl:when>\r
+ <xsl:when test="name()='ximf:set' or name()='ximf:multiset'">\r
+ <vbox>\r
+ <xsl:call-template name="AddSetAndMultisetPanel">\r
+ <xsl:with-param name="_refNode" select="." />\r
+ <xsl:with-param name="_refHeader" select="$_refHeader" />\r
+ <xsl:with-param name="_refBox" select="$_refBox" />\r
+ <xsl:with-param name="_refPopupBox" select="$_refPopupBox" />\r
+ <xsl:with-param name="_positionPopup" select="'end_before'" />\r
+ <xsl:with-param name="_refConcat" select="$_newConcat"/> \r
+ </xsl:call-template>\r
+ </vbox> \r
+ </xsl:when>\r
+ <xsl:when test="name()='ximf:string'">\r
+ <xsl:choose>\r
+ <xsl:when test="@editable='true'">\r
+ <xsl:call-template name="CreateInputBox"> \r
+ <xsl:with-param name="_refPopupBox" select="$_refPopupBox"/>\r
+ <xsl:with-param name="_refBox" select="$_refBox"/>\r
+ <xsl:with-param name="_refHeader" select="$_refHeader" />\r
+ <xsl:with-param name="_refConcat" select="$_newConcat"/> \r
+ </xsl:call-template> \r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:call-template name="CreateMenuitem"> \r
+ <xsl:with-param name="_refString" select="$_refNode" /> \r
+ <xsl:with-param name="_refHeader" select="$_refHeader" />\r
+ <xsl:with-param name="_refBox" select="$_refBox" /> \r
+ <xsl:with-param name="_refConcat" select="$_newConcat"/> \r
+ </xsl:call-template>\r
+ </xsl:otherwise> \r
+ </xsl:choose> \r
+ </xsl:when> \r
+ </xsl:choose> \r
+ </xsl:for-each> \r
+ </richlistitem>\r
+ </xsl:template>\r
+ \r
+ <!-- *********************** -->\r
+ <!-- Create menuitem element -->\r
+ <xsl:template name="CreateMenuitem">\r
+ <xsl:param name="_refString"/>\r
+ <xsl:param name="_refHeader"/>\r
+ <xsl:param name="_refBox"/>\r
+ <xsl:param name="_setType"/> \r
+ <xsl:param name="_refConcat"/> \r
+ <xsl:for-each select="$_refString">\r
+ <xsl:variable name="_idmenuitem">\r
+ <xsl:call-template name="GetUNID">\r
+ <xsl:with-param name="_refNode" select="."/>\r
+ </xsl:call-template>\r
+ </xsl:variable> \r
+ <xsl:choose>\r
+ <xsl:when test=".[@editable='true']" >\r
+ <xsl:call-template name="CreateInputBox"> \r
+ <xsl:with-param name="_refPopupBox" select="$_idmenuitem"/>\r
+ <xsl:with-param name="_refBox" select="$_refBox"/>\r
+ <xsl:with-param name="_refHeader" select="$_refHeader" />\r
+ <xsl:with-param name="_refConcat" select="$_refConcat"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <richlistitem ximfenable="true">\r
+ <xsl:element name="menuitem">\r
+ <xsl:attribute name="class">ximfItem</xsl:attribute>\r
+ <xsl:attribute name="id"><xsl:value-of select="$_idmenuitem" /></xsl:attribute> \r
+ <xsl:attribute name="label">\r
+ <xsl:call-template name="getInternational">\r
+ <xsl:with-param name="ilk" select="@ilk" /> \r
+ </xsl:call-template> \r
+ </xsl:attribute>\r
+ <xsl:attribute name="ximfvalue"><xsl:value-of select="@content" /></xsl:attribute>\r
+ <xsl:attribute name="ximftextbox"><xsl:value-of select="$_refBox" /></xsl:attribute>\r
+ <xsl:if test=".[@technicalContent]">\r
+ <xsl:attribute name="ximftecvalue"><xsl:value-of select="@technicalContent" /></xsl:attribute>\r
+ </xsl:if> \r
+ <xsl:if test="string-length($_refConcat) > 0"> <!-- menuitem is in tree of menu -->\r
+ <xsl:attribute name="ximfconcatid"><xsl:value-of select="$_refConcat" /></xsl:attribute> \r
+ </xsl:if>\r
+ <!-- manage link values -->\r
+ <xsl:if test="./ximf:linkedValue">\r
+ <xsl:attribute name="linkpopupbox"><xsl:value-of select="./ximf:linkedValue/@ref"/></xsl:attribute>\r
+ </xsl:if> \r
+ </xsl:element>\r
+ </richlistitem>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:for-each>\r
+ </xsl:template>\r
+ \r
+ <!-- *********************** -->\r
+ <!-- Create checkbox element -->\r
+ <xsl:template name="CreateCheckItem">\r
+ <xsl:param name="_refString"/>\r
+ <xsl:param name="_refHeader"/>\r
+ <xsl:param name="_refBox"/>\r
+ <xsl:param name="_setType"/> \r
+ <xsl:param name="_refConcat"/> \r
+ <xsl:for-each select="$_refString"> \r
+ <richlistitem ximfenable="true"> \r
+ <xsl:element name="checkbox">\r
+ <xsl:attribute name="class">ximCheckbox</xsl:attribute>\r
+ <xsl:attribute name="disabled">false</xsl:attribute>\r
+ <xsl:attribute name="id">\r
+ <xsl:call-template name="GetUNID">\r
+ <xsl:with-param name="_refNode" select="."/>\r
+ </xsl:call-template>\r
+ </xsl:attribute>\r
+ <xsl:attribute name="label">\r
+ <xsl:call-template name="getInternational">\r
+ <xsl:with-param name="ilk" select="@ilk" /> \r
+ </xsl:call-template> \r
+ </xsl:attribute>\r
+ \r
+ <xsl:attribute name="ximfvalue"><xsl:value-of select="@content" /></xsl:attribute>\r
+ <xsl:if test=".[@technicalContent]">\r
+ <xsl:attribute name="ximftecvalue"><xsl:value-of select="@technicalContent" /></xsl:attribute>\r
+ </xsl:if> \r
+ <xsl:if test="string-length($_refConcat) > 0"> <!-- menuitem is in tree of menu -->\r
+ <xsl:attribute name="ximfconcatid"><xsl:value-of select="$_refConcat" /></xsl:attribute> \r
+ </xsl:if>\r
+ <!-- manage link values -->\r
+ <xsl:if test="./ximf:linkedValue">\r
+ <xsl:attribute name="linkpopupbox"><xsl:value-of select="./ximf:linkedValue/@ref"/></xsl:attribute>\r
+ </xsl:if>\r
+ </xsl:element>\r
+ </richlistitem>\r
+ </xsl:for-each>\r
+ </xsl:template>\r
+ \r
+ <!-- *********************** -->\r
+ <!-- Create button element -->\r
+ <xsl:template name="CreateButtonItem">\r
+ <xsl:param name="_refString"/>\r
+ <xsl:param name="_refHeader"/>\r
+ <xsl:param name="_refBox"/>\r
+ <xsl:param name="_setType"/> \r
+ <xsl:param name="_refConcat"/> \r
+ <xsl:for-each select="$_refString"> \r
+ <xsl:element name="button">\r
+ <xsl:attribute name="class">ximfButton</xsl:attribute>\r
+ <xsl:attribute name="id">\r
+ <xsl:call-template name="GetUNID">\r
+ <xsl:with-param name="_refNode" select="."/>\r
+ </xsl:call-template>\r
+ </xsl:attribute> \r
+ <xsl:attribute name="label">\r
+ <xsl:call-template name="getInternational">\r
+ <xsl:with-param name="ilk" select="@ilk" /> \r
+ </xsl:call-template> \r
+ </xsl:attribute>\r
+ <xsl:attribute name="ximfvalue"><xsl:value-of select="@content" /></xsl:attribute>\r
+ <xsl:if test=".[@technicalContent]">\r
+ <xsl:attribute name="ximftecvalue"><xsl:value-of select="@technicalContent" /></xsl:attribute>\r
+ </xsl:if>\r
+ <xsl:attribute name="ximfreftextbox"><xsl:value-of select="$_refBox" /></xsl:attribute>\r
+ <xsl:if test="string-length($_refConcat) > 0"> <!-- menuitem is in tree of menu -->\r
+ <xsl:attribute name="ximfconcatid"><xsl:value-of select="$_refConcat" /></xsl:attribute> \r
+ </xsl:if>\r
+ <!-- manage link values -->\r
+ <xsl:if test="./ximf:linkedValue">\r
+ <xsl:attribute name="linkpopupbox"><xsl:value-of select="./ximf:linkedValue/@ref"/></xsl:attribute>\r
+ </xsl:if>\r
+ </xsl:element>\r
+ </xsl:for-each>\r
+ </xsl:template>\r
+ \r
+ <!-- ******************************* -->\r
+ <!-- create context menu for textbox -->\r
+ <xsl:template name="CreateContext">\r
+ <xsl:param name="refBox"/>\r
+ <xsl:param name="idContext"/>\r
+ <popup id="{$idContext}"> \r
+ <menuitem class="ximfContext" idx="1" idbox="{$refBox}" label="ximfmail.composer.context.eraseall"/>\r
+ <menuitem class="ximfContext" idx="2" idbox="{$refBox}" label="ximfmail.composer.context.details" /> \r
+ </popup> \r
+ </xsl:template>\r
+ \r
+ <!-- ********************** -->\r
+ <!-- insert image of eraser -->\r
+ <xsl:template name="AppendToolButtons">\r
+ <xsl:param name="refBox"/>\r
+ <button \r
+ class="ximfmailButton ximfDetail" \r
+ id="{concat($refBox,$gIdSeparator,'ximfdetail')}" \r
+ refLabel="{$refBox}"/> \r
+ <button \r
+ class="ximfmailButton ximfEraser" \r
+ id="{concat($refBox,$gIdSeparator,'ximferaser')}" \r
+ refValue="{$refBox}"/>\r
+ </xsl:template>\r
+ \r
+ <!-- *********************************************** -->\r
+ <!-- internationalisation of ilk attribute template -->\r
+ <xsl:template name="getInternational">\r
+ <xsl:param name="ilk" />\r
+ <xsl:variable name="value-ilk" select="/ximf:instance/ximf:dictionary/ximf:locale[@lang=$gLang]/ximf:ilk[$ilk=@entity]" />\r
+ <xsl:choose>\r
+ <xsl:when test="string-length($value-ilk) <= 0"><xsl:value-of select="$ilk" /></xsl:when><!-- lire a <= b --> \r
+ <xsl:otherwise><xsl:value-of select="$value-ilk" /></xsl:otherwise>\r
+ </xsl:choose> \r
+ </xsl:template>\r
</xsl:stylesheet>
\ No newline at end of file
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- ***** 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 ***** -->
-<xsl:stylesheet version="2.0"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:ximf="http://eads.org/ximf/">
- <xsl:output method="xml" encoding="UTF-8" indent="yes" version="1.0" doctype-system="chrome://ximfmail/locale/ximfmail.dtd" />
-
- <!-- MAIN FUNCTION -->
- <xsl:template match="/">
- <xsl:for-each select="/ximf:instance/ximf:rule/ximf:secureHeaders">
- <ximf:signed_headers id="{generate-id(.)}">
- <ximf:headers identity="XIMF_BASIC">
- <xsl:if test="@canonalgo">
- <xsl:attribute name="canonalgo"><xsl:value-of select="@canonalgo" /></xsl:attribute>
- </xsl:if>
- <xsl:for-each select="ximf:aliasHeader">
- <ximf:header name="{@headerName}" status="{@status}" />
- </xsl:for-each>
- </ximf:headers>
- </ximf:signed_headers>
- </xsl:for-each>
- </xsl:template>
+<?xml version="1.0" encoding="UTF-8"?>\r
+\r
+<!-- ***** 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
+<xsl:stylesheet version="2.0"\r
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"\r
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\r
+ xmlns:ximf="http://eads.org/ximf/">\r
+ <xsl:output method="xml" encoding="UTF-8" indent="yes" version="1.0" doctype-system="chrome://ximfmail/locale/ximfmail.dtd" />\r
+ \r
+ <!-- MAIN FUNCTION -->\r
+ <xsl:template match="/"> \r
+ <xsl:for-each select="/ximf:instance/ximf:rule/ximf:secureHeaders"> \r
+ <ximf:signed_headers id="{generate-id(.)}">\r
+ <ximf:headers identity="XIMF_BASIC">\r
+ <xsl:if test="@canonalgo">\r
+ <xsl:attribute name="canonalgo"><xsl:value-of select="@canonalgo" /></xsl:attribute>\r
+ </xsl:if> \r
+ <xsl:for-each select="ximf:aliasHeader">\r
+ <ximf:header name="{@headerName}" status="{@status}" /> \r
+ </xsl:for-each> \r
+ </ximf:headers>\r
+ </ximf:signed_headers>\r
+ </xsl:for-each>\r
+ </xsl:template>\r
</xsl:stylesheet>
\ No newline at end of file
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- ***** 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 ***** -->
-<xsl:stylesheet version="2.0"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:ximf="http://eads.org/ximf/">
- <xsl:output method="xml" encoding="UTF-8" indent="yes" version="1.0" />
- <xsl:template match="/">
- <xsl:for-each select="/ximf:instance/ximf:rule/ximf:securityLabel">
- <securityLabel id="{generate-id(.)}">
- <xsl:for-each select="ximf:aliasHeader">
- <xsl:choose>
- <xsl:when test="@headerName='SecurityPolicyIdentifier'">
- <securityPolicyIdentifier value="" label=""/>
- </xsl:when>
- <xsl:when test="@headerName='SecurityClassification'">
- <securityClassification valueDisplayed="true">
- <item value="0" label="unmarked" />
- <item value="1" label="unclassified" />
- <item value="2" label="restricted" />
- <item value="3" label="confidential" />
- <item value="4" label="secret" />
- <item value="5" label="top-secret" />
- </securityClassification>
- </xsl:when>
- <xsl:when test="@headerName='ESSPrivacyMark'">
- <privacyMark freetext="true">
- <item value="" label=""/>
- </privacyMark>
- </xsl:when>
- <xsl:when test="@headerName='SecurityCategory'" >
- <securityCategories type="{@type}">
- <!-- <item oid="" type="" value="" label=""/> -->
- </securityCategories>
- </xsl:when>
- <xsl:otherwise/>
- </xsl:choose>
- </xsl:for-each>
- </securityLabel>
- </xsl:for-each>
- </xsl:template>
+<?xml version="1.0" encoding="UTF-8"?>\r
+\r
+<!-- ***** 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
+<xsl:stylesheet version="2.0"\r
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"\r
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\r
+ xmlns:ximf="http://eads.org/ximf/">\r
+ <xsl:output method="xml" encoding="UTF-8" indent="yes" version="1.0" /> \r
+ <xsl:template match="/"> \r
+ <xsl:for-each select="/ximf:instance/ximf:rule/ximf:securityLabel"> \r
+ <securityLabel id="{generate-id(.)}"> \r
+ <xsl:for-each select="ximf:aliasHeader"> \r
+ <xsl:choose>\r
+ <xsl:when test="@headerName='SecurityPolicyIdentifier'">\r
+ <securityPolicyIdentifier value="" label=""/>\r
+ </xsl:when>\r
+ <xsl:when test="@headerName='SecurityClassification'">\r
+ <securityClassification valueDisplayed="true">\r
+ <item value="0" label="unmarked" />\r
+ <item value="1" label="unclassified" />\r
+ <item value="2" label="restricted" />\r
+ <item value="3" label="confidential" />\r
+ <item value="4" label="secret" />\r
+ <item value="5" label="top-secret" />\r
+ </securityClassification>\r
+ </xsl:when>\r
+ <xsl:when test="@headerName='ESSPrivacyMark'">\r
+ <privacyMark freetext="true">\r
+ <item value="" label=""/>\r
+ </privacyMark>\r
+ </xsl:when>\r
+ <xsl:when test="@headerName='SecurityCategory'" >\r
+ <securityCategories type="{@type}">\r
+ <!-- <item oid="" type="" value="" label=""/> -->\r
+ </securityCategories>\r
+ </xsl:when> \r
+ <xsl:otherwise/>\r
+ </xsl:choose> \r
+ </xsl:for-each> \r
+ </securityLabel>\r
+ </xsl:for-each>\r
+ </xsl:template>\r
</xsl:stylesheet>
\ No newline at end of file
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- ***** 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 ***** -->
-<xsl:stylesheet version="2.0"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:ximf="http://eads.org/ximf/">
- <xsl:output method="xml" encoding="UTF-8" indent="yes" version="1.0" doctype-system="chrome://ximfmail/locale/ximfmail.dtd" />
-
- <xsl:param name="gLang">us</xsl:param>
- <xsl:param name="gIdSeparator">·</xsl:param> <!-- unicode of middle dot -->
-
- <!-- MAIN FUNCTION -->
- <xsl:template match="/">
- <xsl:for-each select="/ximf:instance/ximf:ihm/ximf:treeRcv">
- <xsl:for-each select="ximf:headerRef">
- <splitter class="tree-splitter" ximfheadtree="1"/>
- <xsl:call-template name="CreateCol">
- <xsl:with-param name="headerRef" select="." />
- </xsl:call-template>
- </xsl:for-each>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="CreateCol">
- <xsl:param name="headerRef" select="" />
- <xsl:for-each select="/ximf:instance/ximf:header[$headerRef=@id]">
- <xsl:element name="treecol">
- <xsl:attribute name="id"><xsl:value-of select="@headerName"/></xsl:attribute>
- <xsl:attribute name="label">
- <xsl:call-template name="getInternational">
- <xsl:with-param name="ilk" select="@ilk" />
- </xsl:call-template>
- </xsl:attribute>
- <xsl:attribute name="tooltiptext">
- <xsl:call-template name="getInternational">
- <xsl:with-param name="ilk" select="@ilk" />
- </xsl:call-template>
- </xsl:attribute>
- <xsl:attribute name="persist">hidden ordinal width</xsl:attribute>
- <xsl:attribute name="flex">1</xsl:attribute>
- <xsl:attribute name="hidden">false</xsl:attribute>
- <xsl:attribute name="ximfheadtree">1</xsl:attribute>
- </xsl:element>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="getInternational">
- <xsl:param name="ilk" />
- <xsl:variable name="value-ilk" select="/ximf:instance/ximf:dictionary/ximf:locale[@lang=$gLang]/ximf:ilk[$ilk=@entity]" />
- <xsl:choose>
- <xsl:when test="string-length($value-ilk) <= 0"><xsl:value-of select="$ilk" /></xsl:when><!-- lire a <= b -->
- <xsl:otherwise><xsl:value-of select="$value-ilk" /></xsl:otherwise>
- </xsl:choose>
- </xsl:template>
+<?xml version="1.0" encoding="UTF-8"?>\r
+\r
+<!-- ***** 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
+<xsl:stylesheet version="2.0"\r
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"\r
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\r
+ xmlns:ximf="http://eads.org/ximf/">\r
+ <xsl:output method="xml" encoding="UTF-8" indent="yes" version="1.0" doctype-system="chrome://ximfmail/locale/ximfmail.dtd" />\r
+\r
+ <xsl:param name="gLang">us</xsl:param>\r
+ <xsl:param name="gIdSeparator">·</xsl:param> <!-- unicode of middle dot -->\r
+\r
+ <!-- MAIN FUNCTION -->\r
+ <xsl:template match="/"> \r
+ <xsl:for-each select="/ximf:instance/ximf:ihm/ximf:treeRcv"> \r
+ <xsl:for-each select="ximf:headerRef">\r
+ <splitter class="tree-splitter" ximfheadtree="1"/> \r
+ <xsl:call-template name="CreateCol">\r
+ <xsl:with-param name="headerRef" select="." />\r
+ </xsl:call-template>\r
+ </xsl:for-each>\r
+ </xsl:for-each> \r
+ </xsl:template>\r
+\r
+ <xsl:template name="CreateCol">\r
+ <xsl:param name="headerRef" select="" />\r
+ <xsl:for-each select="/ximf:instance/ximf:header[$headerRef=@id]">\r
+ <xsl:element name="treecol"> \r
+ <xsl:attribute name="id"><xsl:value-of select="@headerName"/></xsl:attribute>\r
+ <xsl:attribute name="label">\r
+ <xsl:call-template name="getInternational">\r
+ <xsl:with-param name="ilk" select="@ilk" /> \r
+ </xsl:call-template> \r
+ </xsl:attribute>\r
+ <xsl:attribute name="tooltiptext">\r
+ <xsl:call-template name="getInternational">\r
+ <xsl:with-param name="ilk" select="@ilk" /> \r
+ </xsl:call-template> \r
+ </xsl:attribute> \r
+ <xsl:attribute name="persist">hidden ordinal width</xsl:attribute>\r
+ <xsl:attribute name="flex">1</xsl:attribute>\r
+ <xsl:attribute name="hidden">false</xsl:attribute>\r
+ <xsl:attribute name="ximfheadtree">1</xsl:attribute>\r
+ </xsl:element>\r
+ </xsl:for-each>\r
+ </xsl:template>\r
+ \r
+ <xsl:template name="getInternational">\r
+ <xsl:param name="ilk" />\r
+ <xsl:variable name="value-ilk" select="/ximf:instance/ximf:dictionary/ximf:locale[@lang=$gLang]/ximf:ilk[$ilk=@entity]" />\r
+ <xsl:choose>\r
+ <xsl:when test="string-length($value-ilk) <= 0"><xsl:value-of select="$ilk" /></xsl:when><!-- lire a <= b --> \r
+ <xsl:otherwise><xsl:value-of select="$value-ilk" /></xsl:otherwise>\r
+ </xsl:choose> \r
+ </xsl:template>\r
</xsl:stylesheet>
\ No newline at end of file
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Created with Liquid XML Studio 1.0.8.0 (http://www.liquid-technologies.com) -->
-
-<!-- ***** 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 ***** -->
-<xs:schema elementFormDefault="qualified" targetNamespace="http://eads.org/ximf/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <xs:annotation>
- <xs:documentation> $Header: /data/cvs/v1/MCO2008/mozilla/extensions/ximf/ximfmail/chrome/content/theme/ximf.xsd,v 1.1 2008/11/25 18:51:12 xparis Exp $ </xs:documentation>
- </xs:annotation>
- <xs:element name="instance">
- <xs:complexType>
- <xs:complexContent mixed="false">
- <xs:extension xmlns:q1="http://eads.org/ximf/" base="q1:XIMFInstanceType" />
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- <xs:complexType name="XIMFInstanceType">
- <xs:sequence minOccurs="0">
- <xs:element xmlns:q1="http://eads.org/ximf/" minOccurs="0" maxOccurs="unbounded" name="header" type="q1:XIMFHeaderType" />
- <xs:element xmlns:q2="http://eads.org/ximf/" minOccurs="0" maxOccurs="unbounded" name="rule" type="q2:XIMFRuleType" />
- <xs:element minOccurs="0" maxOccurs="unbounded" name="dictionary" xmlns:q1="http://eads.org/ximf/" type="q1:XIMFDictionaryType" />
- </xs:sequence>
- <xs:attribute name="ximfVersion" use="required">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:enumeration value="2.0" />
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="version" type="xs:string" use="required" />
- <xs:attribute name="author" type="xs:string" />
- <xs:attribute name="creationDate" type="xs:date" />
- <xs:attribute name="name" type="xs:string" use="required" />
- </xs:complexType>
- <xs:complexType name="XIMFHeaderType">
- <xs:choice minOccurs="1" maxOccurs="1">
- <xs:element xmlns:q1="http://eads.org/ximf/" minOccurs="1" maxOccurs="unbounded" name="set" type="q1:XIMFSetType" />
- <xs:element xmlns:q1="http://eads.org/ximf/" minOccurs="1" maxOccurs="unbounded" name="multiset" type="q1:XIMFMultiSetType" />
- <xs:element minOccurs="0" maxOccurs="unbounded" name="compstring" xmlns:q2="http://eads.org/ximf/" type="q2:XIMFComplexString" />
- <xs:element xmlns:q7="http://eads.org/ximf/" minOccurs="1" maxOccurs="1" name="string" type="q7:XIMFPrintableStringDataType" />
- </xs:choice>
- <xs:attribute xmlns:q1="http://eads.org/ximf/" name="id" type="q1:XIMFHeaderID" use="required" />
- <xs:attribute xmlns:q2="http://eads.org/ximf/" name="headerName" type="q2:XIMFPrintableStringType" use="required" />
- <xs:attribute xmlns:q1="http://eads.org/ximf/" name="technicalHeaderName" type="q1:XIMFPrintableStringType" use="optional" />
- <xs:attribute name="type" type="xs:string" use="required" />
- <xs:attribute name="technicalType" type="xs:string" use="optional" />
- <xs:attribute name="isMandatory" type="xs:boolean" use="required" />
- <xs:attribute name="ilk" type="xs:string" use="optional" />
- <xs:attribute xmlns:q2="http://eads.org/ximf/" name="description" type="xs:string" use="optional" />
- </xs:complexType>
- <xs:complexType name="XIMFSetType">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element xmlns:q7="http://eads.org/ximf/" name="string" type="q7:XIMFPrintableStringDataType" />
- <xs:element xmlns:q1="http://eads.org/ximf/" minOccurs="1" maxOccurs="1" name="compstring" type="q1:XIMFComplexString" />
- </xs:choice>
- <xs:attributeGroup xmlns:q2="http://eads.org/ximf/" ref="q2:XIMFFacetsGroup" />
- <xs:attributeGroup xmlns:q3="http://eads.org/ximf/" ref="q3:XIMFPropertiesGroup" />
- </xs:complexType>
- <xs:complexType name="XIMFMultiSetType">
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element xmlns:q7="http://eads.org/ximf/" name="string" type="q7:XIMFPrintableStringDataType" />
- <xs:element xmlns:q1="http://eads.org/ximf/" minOccurs="1" maxOccurs="1" name="compstring" type="q1:XIMFComplexString" />
- </xs:choice>
- <xs:attributeGroup xmlns:q4="http://eads.org/ximf/" ref="q4:XIMFFacetsGroup" />
- <xs:attributeGroup xmlns:q5="http://eads.org/ximf/" ref="q5:XIMFPropertiesGroup" />
- </xs:complexType>
- <xs:complexType name="XIMFSequenceType">
- <xs:choice minOccurs="2" maxOccurs="unbounded">
- <xs:element xmlns:q6="http://eads.org/ximf/" name="set" type="q6:XIMFSetType" />
- <xs:element xmlns:q7="http://eads.org/ximf/" name="multiset" type="q7:XIMFMultiSetType" />
- <xs:element xmlns:q8="http://eads.org/ximf/" name="string" type="q8:XIMFPrintableStringDataType" />
- </xs:choice>
- <xs:attributeGroup xmlns:q9="http://eads.org/ximf/" ref="q9:XIMFFacetsGroup" />
- <xs:attributeGroup xmlns:q10="http://eads.org/ximf/" ref="q10:XIMFPropertiesGroup" />
- <xs:attribute default="false" name="reverse" type="xs:boolean" />
- <xs:attribute default="false" name="technicalReverse" type="xs:boolean" />
- </xs:complexType>
- <xs:complexType name="XIMFPrintableStringDataType">
- <xs:sequence>
- <xs:element xmlns:q2="http://eads.org/ximf/" minOccurs="0" maxOccurs="unbounded" name="linkedValue" type="q2:XIMFLinkedValue" />
- </xs:sequence>
- <xs:attributeGroup xmlns:q11="http://eads.org/ximf/" ref="q11:XIMFFacetsGroup" />
- <xs:attributeGroup xmlns:q12="http://eads.org/ximf/" ref="q12:XIMFPropertiesGroup" />
- <xs:attribute default="false" name="editable" type="xs:boolean" use="optional" />
- <xs:attributeGroup xmlns:q3="http://eads.org/ximf/" ref="q3:XIMFContentGroup" />
- </xs:complexType>
- <xs:complexType name="XIMFLinkedValue">
- <xs:attribute name="ref" type="xs:IDREF" use="required" />
- </xs:complexType>
- <xs:complexType name="XIMFRuleType">
- <xs:choice minOccurs="1" maxOccurs="1">
- <xs:sequence minOccurs="1" maxOccurs="unbounded">
- <xs:element xmlns:q3="http://eads.org/ximf/" name="constraint" type="q3:XIMFConstraintType" />
- </xs:sequence>
- <xs:sequence minOccurs="1" maxOccurs="unbounded">
- <xs:element xmlns:q1="http://eads.org/ximf/" name="processing" type="q1:XIMFProcessingType" />
- </xs:sequence>
- <xs:sequence minOccurs="1" maxOccurs="unbounded">
- <xs:element xmlns:q4="http://eads.org/ximf/" name="compatibility" type="q4:XIMFCompatibilityType" />
- </xs:sequence>
- <xs:sequence minOccurs="1" maxOccurs="unbounded">
- <xs:element xmlns:q5="http://eads.org/ximf/" name="policy" type="q5:XIMFPolicyType" />
- </xs:sequence>
- <xs:sequence minOccurs="1" maxOccurs="unbounded">
- <xs:element xmlns:q2="http://eads.org/ximf/" name="custom" type="q2:XIMFCustomType" />
- </xs:sequence>
- </xs:choice>
- <xs:attribute name="agent" use="optional">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:enumeration value="mua" />
- <xs:enumeration value="mta" />
- <xs:enumeration value="mda" />
- <xs:enumeration value="msa" />
- <xs:enumeration value="gateway" />
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="id" type="xs:ID" use="required" />
- <xs:attribute name="description" type="xs:string" use="optional" />
- </xs:complexType>
- <xs:complexType name="XIMFConstraintType">
- <xs:attribute xmlns:q5="http://eads.org/ximf/" name="left" type="q5:XIMFHeaderRef" use="required" />
- <xs:attribute name="operator" use="required">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:enumeration value="greaterThan" />
- <xs:enumeration value="lowerThan" />
- <xs:enumeration value="equalOrGreaterThan" />
- <xs:enumeration value="equalOrLowerThan" />
- <xs:enumeration value="equal" />
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="right" type="xs:IDREF" use="required" />
- </xs:complexType>
- <xs:complexType name="XIMFProcessingType">
- <xs:sequence minOccurs="1" maxOccurs="unbounded">
- <xs:element xmlns:q2="http://eads.org/ximf/" name="headerName" type="q2:XIMFPrintableStringType" />
- </xs:sequence>
- <xs:attribute name="type">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:enumeration value="sign-header-value" />
- <xs:enumeration value="encrypt-header-value" />
- <xs:enumeration value="capitalize-header-value" />
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- </xs:complexType>
- <xs:complexType name="XIMFCompatibilityType">
- <xs:sequence maxOccurs="unbounded">
- <xs:element xmlns:q5="http://eads.org/ximf/" minOccurs="1" maxOccurs="unbounded" name="aliasHeader">
- <xs:complexType>
- <xs:complexContent mixed="false">
- <xs:extension base="q5:XIMFHeaderAliasType">
- <xs:sequence minOccurs="0" maxOccurs="unbounded">
- <xs:element name="aliasValue">
- <xs:complexType>
- <xs:complexContent mixed="false">
- <xs:extension base="q5:XIMFValueAliasType" />
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- <xs:attribute name="targetName" type="xs:string" use="required" />
- <xs:attribute name="targetVersion" type="xs:string" use="required" />
- </xs:complexType>
- <xs:complexType name="XIMFHeaderAliasType">
- <xs:attribute xmlns:q3="http://eads.org/ximf/" name="headerName" type="q3:XIMFPrintableStringType" use="required" />
- <xs:attribute xmlns:q4="http://eads.org/ximf/" name="headerRef" type="q4:XIMFPrintableStringType" use="optional" />
- </xs:complexType>
- <xs:complexType name="XIMFValueAliasType">
- <xs:attribute xmlns:q5="http://eads.org/ximf/" name="valueName" type="q5:XIMFPrintableStringType" use="required" />
- <xs:attribute xmlns:q6="http://eads.org/ximf/" name="valueRef" type="q6:XIMFPrintableStringType" use="optional" />
- </xs:complexType>
- <xs:complexType name="XIMFPolicyType">
- <xs:sequence minOccurs="1" maxOccurs="unbounded">
- <xs:element xmlns:q5="http://eads.org/ximf/" name="role">
- <xs:complexType>
- <xs:complexContent mixed="false">
- <xs:extension base="q5:XIMFACLRoleType" />
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="XIMFACLRoleType">
- <xs:attribute name="aclLevel" type="xs:unsignedInt" />
- <xs:attribute name="id" type="xs:ID" use="optional" />
- </xs:complexType>
- <xs:complexType name="XIMFCustomType">
- <xs:choice>
- <xs:any maxOccurs="unbounded" processContents="skip" />
- </xs:choice>
- <xs:attribute name="id" type="xs:ID" use="required" />
- <xs:attribute name="provider" type="xs:string" use="required" />
- <xs:attribute name="description" type="xs:string" use="optional" />
- </xs:complexType>
- <xs:simpleType name="XIMFPrintableStringType">
- <xs:restriction base="xs:string">
- <xs:pattern value="([A-Za-z0-9]|[ ,;:=/\?'\(\)\+\-\.])+" />
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="XIMFOidType">
- <xs:restriction base="xs:string">
- <xs:pattern value="([0-9]|([1-9][0-9]+))(\.([0-9]|([1-9][0-9]+)))+" />
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="XIMFHeaderID">
- <xs:restriction base="xs:ID">
- <xs:pattern value="header\-.*" />
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="XIMFHeaderRef">
- <xs:restriction base="xs:IDREF">
- <xs:pattern value="header\-.*" />
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="XIMFValueID">
- <xs:restriction base="xs:ID">
- <xs:pattern value="value\-.*" />
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="XIMFValueRef">
- <xs:restriction base="xs:IDREF">
- <xs:pattern value="value\-.*" />
- </xs:restriction>
- </xs:simpleType>
- <xs:complexType name="XIMFComplexString">
- <xs:choice minOccurs="0">
- <xs:element xmlns:q1="http://eads.org/ximf/" minOccurs="0" name="string" type="q1:XIMFPrintableStringDataType" />
- <xs:element xmlns:q2="http://eads.org/ximf/" minOccurs="0" name="set" type="q2:XIMFSetType" />
- <xs:element xmlns:q3="http://eads.org/ximf/" minOccurs="0" name="multiset" type="q3:XIMFMultiSetType" />
- <xs:element xmlns:q4="http://eads.org/ximf/" minOccurs="0" maxOccurs="unbounded" name="compstring" type="q4:XIMFComplexString" />
- </xs:choice>
- <xs:attributeGroup xmlns:q5="http://eads.org/ximf/" ref="q5:XIMFPropertiesGroup" />
- <xs:attributeGroup xmlns:q4="http://eads.org/ximf/" ref="q4:XIMFFacetsGroup" />
- <xs:attributeGroup xmlns:q5="http://eads.org/ximf/" ref="q5:XIMFContentGroup" />
- <xs:attribute name="contentPositionEnd" type="xs:boolean" />
- <xs:attribute name="contentFactorise" type="xs:boolean" />
- <xs:attribute name="technicalPositionEnd" type="xs:boolean" />
- </xs:complexType>
- <xs:complexType name="XIMFDictionaryType">
- <xs:choice maxOccurs="unbounded">
- <xs:element name="locale">
- <xs:complexType>
- <xs:complexContent mixed="false">
- <xs:extension xmlns:q14="http://eads.org/ximf/" base="q14:XIMFLocaleType" />
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
- </xs:choice>
- </xs:complexType>
- <xs:complexType name="XIMFLocaleType">
- <xs:choice maxOccurs="unbounded">
- <xs:element name="locale" xmlns:q6="http://eads.org/ximf/" type="q6:XIMFIlkType" />
- </xs:choice>
- <xs:attribute name="lang" type="xs:string" use="required" />
- <xs:attribute name="country" use="optional" />
- </xs:complexType>
- <xs:complexType name="XIMFIlkType">
- <xs:choice maxOccurs="unbounded">
- <xs:element name="ilk">
- <xs:complexType>
- <xs:simpleContent>
- <xs:extension base="xs:string">
- <xs:attribute name="entity" type="xs:string" use="required" />
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
- </xs:element>
- </xs:choice>
- </xs:complexType>
- <xs:attributeGroup name="XIMFContentGroup">
- <xs:attribute name="content" xmlns:q7="http://eads.org/ximf/" type="q7:XIMFPrintableStringType" />
- <xs:attribute xmlns:q3="http://eads.org/ximf/" name="technicalContent" type="q3:XIMFPrintableStringType" use="optional" />
- </xs:attributeGroup>
- <xs:attributeGroup name="XIMFPropertiesGroup">
- <xs:attribute xmlns:q3="http://eads.org/ximf/" name="id" type="q3:XIMFValueID" use="optional" />
- <xs:attribute xmlns:q4="http://eads.org/ximf/" name="ref" type="q4:XIMFValueRef" use="optional" />
- <xs:attribute name="ilk" type="xs:string" use="optional" />
- <xs:attribute name="aclLevel" type="xs:unsignedInt" use="optional" />
- <xs:attribute name="index" type="xs:unsignedInt" use="optional" />
- <xs:attribute xmlns:q4="http://eads.org/ximf/" name="description" type="xs:string" use="optional" />
- </xs:attributeGroup>
- <xs:attributeGroup name="XIMFFacetsGroup">
- <xs:attribute name="maxLength" type="xs:unsignedInt" use="optional" />
- <xs:attribute name="minLength" type="xs:unsignedInt" use="optional" />
- <xs:attribute default="1" name="maxItem" type="xs:unsignedInt" use="optional" />
- <xs:attribute name="minItem" type="xs:unsignedInt" use="optional" />
- <xs:attribute xmlns:q15="http://eads.org/ximf/" name="separator" type="q15:XIMFPrintableStringType" use="optional" />
- <xs:attribute xmlns:q16="http://eads.org/ximf/" name="technicalSeparator" type="q16:XIMFPrintableStringType" use="optional" />
- </xs:attributeGroup>
+<?xml version="1.0" encoding="utf-8"?>\r
+<!-- Created with Liquid XML Studio 1.0.8.0 (http://www.liquid-technologies.com) -->\r
+\r
+<!-- ***** 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
+<xs:schema elementFormDefault="qualified" targetNamespace="http://eads.org/ximf/" xmlns:xs="http://www.w3.org/2001/XMLSchema">\r
+ <xs:annotation>\r
+ <xs:documentation> $Header: /data/cvs/v1/MCO2008/mozilla/extensions/ximf/ximfmail/chrome/content/theme/ximf.xsd,v 1.1 2008/11/25 18:51:12 xparis Exp $ </xs:documentation>\r
+ </xs:annotation>\r
+ <xs:element name="instance">\r
+ <xs:complexType>\r
+ <xs:complexContent mixed="false">\r
+ <xs:extension xmlns:q1="http://eads.org/ximf/" base="q1:XIMFInstanceType" />\r
+ </xs:complexContent>\r
+ </xs:complexType>\r
+ </xs:element>\r
+ <xs:complexType name="XIMFInstanceType">\r
+ <xs:sequence minOccurs="0">\r
+ <xs:element xmlns:q1="http://eads.org/ximf/" minOccurs="0" maxOccurs="unbounded" name="header" type="q1:XIMFHeaderType" />\r
+ <xs:element xmlns:q2="http://eads.org/ximf/" minOccurs="0" maxOccurs="unbounded" name="rule" type="q2:XIMFRuleType" />\r
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="dictionary" xmlns:q1="http://eads.org/ximf/" type="q1:XIMFDictionaryType" />\r
+ </xs:sequence>\r
+ <xs:attribute name="ximfVersion" use="required">\r
+ <xs:simpleType>\r
+ <xs:restriction base="xs:string">\r
+ <xs:enumeration value="2.0" />\r
+ </xs:restriction>\r
+ </xs:simpleType>\r
+ </xs:attribute>\r
+ <xs:attribute name="version" type="xs:string" use="required" />\r
+ <xs:attribute name="author" type="xs:string" />\r
+ <xs:attribute name="creationDate" type="xs:date" />\r
+ <xs:attribute name="name" type="xs:string" use="required" />\r
+ </xs:complexType>\r
+ <xs:complexType name="XIMFHeaderType">\r
+ <xs:choice minOccurs="1" maxOccurs="1">\r
+ <xs:element xmlns:q1="http://eads.org/ximf/" minOccurs="1" maxOccurs="unbounded" name="set" type="q1:XIMFSetType" />\r
+ <xs:element xmlns:q1="http://eads.org/ximf/" minOccurs="1" maxOccurs="unbounded" name="multiset" type="q1:XIMFMultiSetType" />\r
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="compstring" xmlns:q2="http://eads.org/ximf/" type="q2:XIMFComplexString" />\r
+ <xs:element xmlns:q7="http://eads.org/ximf/" minOccurs="1" maxOccurs="1" name="string" type="q7:XIMFPrintableStringDataType" />\r
+ </xs:choice>\r
+ <xs:attribute xmlns:q1="http://eads.org/ximf/" name="id" type="q1:XIMFHeaderID" use="required" />\r
+ <xs:attribute xmlns:q2="http://eads.org/ximf/" name="headerName" type="q2:XIMFPrintableStringType" use="required" />\r
+ <xs:attribute xmlns:q1="http://eads.org/ximf/" name="technicalHeaderName" type="q1:XIMFPrintableStringType" use="optional" />\r
+ <xs:attribute name="type" type="xs:string" use="required" />\r
+ <xs:attribute name="technicalType" type="xs:string" use="optional" />\r
+ <xs:attribute name="isMandatory" type="xs:boolean" use="required" />\r
+ <xs:attribute name="ilk" type="xs:string" use="optional" />\r
+ <xs:attribute xmlns:q2="http://eads.org/ximf/" name="description" type="xs:string" use="optional" />\r
+ </xs:complexType>\r
+ <xs:complexType name="XIMFSetType">\r
+ <xs:choice minOccurs="0" maxOccurs="unbounded">\r
+ <xs:element xmlns:q7="http://eads.org/ximf/" name="string" type="q7:XIMFPrintableStringDataType" />\r
+ <xs:element xmlns:q1="http://eads.org/ximf/" minOccurs="1" maxOccurs="1" name="compstring" type="q1:XIMFComplexString" />\r
+ </xs:choice>\r
+ <xs:attributeGroup xmlns:q2="http://eads.org/ximf/" ref="q2:XIMFFacetsGroup" />\r
+ <xs:attributeGroup xmlns:q3="http://eads.org/ximf/" ref="q3:XIMFPropertiesGroup" />\r
+ </xs:complexType>\r
+ <xs:complexType name="XIMFMultiSetType">\r
+ <xs:choice minOccurs="0" maxOccurs="unbounded">\r
+ <xs:element xmlns:q7="http://eads.org/ximf/" name="string" type="q7:XIMFPrintableStringDataType" />\r
+ <xs:element xmlns:q1="http://eads.org/ximf/" minOccurs="1" maxOccurs="1" name="compstring" type="q1:XIMFComplexString" />\r
+ </xs:choice>\r
+ <xs:attributeGroup xmlns:q4="http://eads.org/ximf/" ref="q4:XIMFFacetsGroup" />\r
+ <xs:attributeGroup xmlns:q5="http://eads.org/ximf/" ref="q5:XIMFPropertiesGroup" />\r
+ </xs:complexType>\r
+ <xs:complexType name="XIMFSequenceType">\r
+ <xs:choice minOccurs="2" maxOccurs="unbounded">\r
+ <xs:element xmlns:q6="http://eads.org/ximf/" name="set" type="q6:XIMFSetType" />\r
+ <xs:element xmlns:q7="http://eads.org/ximf/" name="multiset" type="q7:XIMFMultiSetType" />\r
+ <xs:element xmlns:q8="http://eads.org/ximf/" name="string" type="q8:XIMFPrintableStringDataType" />\r
+ </xs:choice>\r
+ <xs:attributeGroup xmlns:q9="http://eads.org/ximf/" ref="q9:XIMFFacetsGroup" />\r
+ <xs:attributeGroup xmlns:q10="http://eads.org/ximf/" ref="q10:XIMFPropertiesGroup" />\r
+ <xs:attribute default="false" name="reverse" type="xs:boolean" />\r
+ <xs:attribute default="false" name="technicalReverse" type="xs:boolean" />\r
+ </xs:complexType>\r
+ <xs:complexType name="XIMFPrintableStringDataType">\r
+ <xs:sequence>\r
+ <xs:element xmlns:q2="http://eads.org/ximf/" minOccurs="0" maxOccurs="unbounded" name="linkedValue" type="q2:XIMFLinkedValue" />\r
+ </xs:sequence>\r
+ <xs:attributeGroup xmlns:q11="http://eads.org/ximf/" ref="q11:XIMFFacetsGroup" />\r
+ <xs:attributeGroup xmlns:q12="http://eads.org/ximf/" ref="q12:XIMFPropertiesGroup" />\r
+ <xs:attribute default="false" name="editable" type="xs:boolean" use="optional" />\r
+ <xs:attributeGroup xmlns:q3="http://eads.org/ximf/" ref="q3:XIMFContentGroup" />\r
+ </xs:complexType>\r
+ <xs:complexType name="XIMFLinkedValue">\r
+ <xs:attribute name="ref" type="xs:IDREF" use="required" />\r
+ </xs:complexType>\r
+ <xs:complexType name="XIMFRuleType">\r
+ <xs:choice minOccurs="1" maxOccurs="1">\r
+ <xs:sequence minOccurs="1" maxOccurs="unbounded">\r
+ <xs:element xmlns:q3="http://eads.org/ximf/" name="constraint" type="q3:XIMFConstraintType" />\r
+ </xs:sequence>\r
+ <xs:sequence minOccurs="1" maxOccurs="unbounded">\r
+ <xs:element xmlns:q1="http://eads.org/ximf/" name="processing" type="q1:XIMFProcessingType" />\r
+ </xs:sequence>\r
+ <xs:sequence minOccurs="1" maxOccurs="unbounded">\r
+ <xs:element xmlns:q4="http://eads.org/ximf/" name="compatibility" type="q4:XIMFCompatibilityType" />\r
+ </xs:sequence>\r
+ <xs:sequence minOccurs="1" maxOccurs="unbounded">\r
+ <xs:element xmlns:q5="http://eads.org/ximf/" name="policy" type="q5:XIMFPolicyType" />\r
+ </xs:sequence>\r
+ <xs:sequence minOccurs="1" maxOccurs="unbounded">\r
+ <xs:element xmlns:q2="http://eads.org/ximf/" name="custom" type="q2:XIMFCustomType" />\r
+ </xs:sequence>\r
+ </xs:choice>\r
+ <xs:attribute name="agent" use="optional">\r
+ <xs:simpleType>\r
+ <xs:restriction base="xs:string">\r
+ <xs:enumeration value="mua" />\r
+ <xs:enumeration value="mta" />\r
+ <xs:enumeration value="mda" />\r
+ <xs:enumeration value="msa" />\r
+ <xs:enumeration value="gateway" />\r
+ </xs:restriction>\r
+ </xs:simpleType>\r
+ </xs:attribute>\r
+ <xs:attribute name="id" type="xs:ID" use="required" />\r
+ <xs:attribute name="description" type="xs:string" use="optional" />\r
+ </xs:complexType>\r
+ <xs:complexType name="XIMFConstraintType">\r
+ <xs:attribute xmlns:q5="http://eads.org/ximf/" name="left" type="q5:XIMFHeaderRef" use="required" />\r
+ <xs:attribute name="operator" use="required">\r
+ <xs:simpleType>\r
+ <xs:restriction base="xs:string">\r
+ <xs:enumeration value="greaterThan" />\r
+ <xs:enumeration value="lowerThan" />\r
+ <xs:enumeration value="equalOrGreaterThan" />\r
+ <xs:enumeration value="equalOrLowerThan" />\r
+ <xs:enumeration value="equal" />\r
+ </xs:restriction>\r
+ </xs:simpleType>\r
+ </xs:attribute>\r
+ <xs:attribute name="right" type="xs:IDREF" use="required" />\r
+ </xs:complexType>\r
+ <xs:complexType name="XIMFProcessingType">\r
+ <xs:sequence minOccurs="1" maxOccurs="unbounded">\r
+ <xs:element xmlns:q2="http://eads.org/ximf/" name="headerName" type="q2:XIMFPrintableStringType" />\r
+ </xs:sequence>\r
+ <xs:attribute name="type">\r
+ <xs:simpleType>\r
+ <xs:restriction base="xs:string">\r
+ <xs:enumeration value="sign-header-value" />\r
+ <xs:enumeration value="encrypt-header-value" />\r
+ <xs:enumeration value="capitalize-header-value" />\r
+ </xs:restriction>\r
+ </xs:simpleType>\r
+ </xs:attribute>\r
+ </xs:complexType>\r
+ <xs:complexType name="XIMFCompatibilityType">\r
+ <xs:sequence maxOccurs="unbounded">\r
+ <xs:element xmlns:q5="http://eads.org/ximf/" minOccurs="1" maxOccurs="unbounded" name="aliasHeader">\r
+ <xs:complexType>\r
+ <xs:complexContent mixed="false">\r
+ <xs:extension base="q5:XIMFHeaderAliasType">\r
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">\r
+ <xs:element name="aliasValue">\r
+ <xs:complexType>\r
+ <xs:complexContent mixed="false">\r
+ <xs:extension base="q5:XIMFValueAliasType" />\r
+ </xs:complexContent>\r
+ </xs:complexType>\r
+ </xs:element>\r
+ </xs:sequence>\r
+ </xs:extension>\r
+ </xs:complexContent>\r
+ </xs:complexType>\r
+ </xs:element>\r
+ </xs:sequence>\r
+ <xs:attribute name="targetName" type="xs:string" use="required" />\r
+ <xs:attribute name="targetVersion" type="xs:string" use="required" />\r
+ </xs:complexType>\r
+ <xs:complexType name="XIMFHeaderAliasType">\r
+ <xs:attribute xmlns:q3="http://eads.org/ximf/" name="headerName" type="q3:XIMFPrintableStringType" use="required" />\r
+ <xs:attribute xmlns:q4="http://eads.org/ximf/" name="headerRef" type="q4:XIMFPrintableStringType" use="optional" />\r
+ </xs:complexType>\r
+ <xs:complexType name="XIMFValueAliasType">\r
+ <xs:attribute xmlns:q5="http://eads.org/ximf/" name="valueName" type="q5:XIMFPrintableStringType" use="required" />\r
+ <xs:attribute xmlns:q6="http://eads.org/ximf/" name="valueRef" type="q6:XIMFPrintableStringType" use="optional" />\r
+ </xs:complexType>\r
+ <xs:complexType name="XIMFPolicyType">\r
+ <xs:sequence minOccurs="1" maxOccurs="unbounded">\r
+ <xs:element xmlns:q5="http://eads.org/ximf/" name="role">\r
+ <xs:complexType>\r
+ <xs:complexContent mixed="false">\r
+ <xs:extension base="q5:XIMFACLRoleType" />\r
+ </xs:complexContent>\r
+ </xs:complexType>\r
+ </xs:element>\r
+ </xs:sequence>\r
+ </xs:complexType>\r
+ <xs:complexType name="XIMFACLRoleType">\r
+ <xs:attribute name="aclLevel" type="xs:unsignedInt" />\r
+ <xs:attribute name="id" type="xs:ID" use="optional" />\r
+ </xs:complexType>\r
+ <xs:complexType name="XIMFCustomType">\r
+ <xs:choice>\r
+ <xs:any maxOccurs="unbounded" processContents="skip" />\r
+ </xs:choice>\r
+ <xs:attribute name="id" type="xs:ID" use="required" />\r
+ <xs:attribute name="provider" type="xs:string" use="required" />\r
+ <xs:attribute name="description" type="xs:string" use="optional" />\r
+ </xs:complexType>\r
+ <xs:simpleType name="XIMFPrintableStringType">\r
+ <xs:restriction base="xs:string">\r
+ <xs:pattern value="([A-Za-z0-9]|[ ,;:=/\?'\(\)\+\-\.])+" />\r
+ </xs:restriction>\r
+ </xs:simpleType>\r
+ <xs:simpleType name="XIMFOidType">\r
+ <xs:restriction base="xs:string">\r
+ <xs:pattern value="([0-9]|([1-9][0-9]+))(\.([0-9]|([1-9][0-9]+)))+" />\r
+ </xs:restriction>\r
+ </xs:simpleType>\r
+ <xs:simpleType name="XIMFHeaderID">\r
+ <xs:restriction base="xs:ID">\r
+ <xs:pattern value="header\-.*" />\r
+ </xs:restriction>\r
+ </xs:simpleType>\r
+ <xs:simpleType name="XIMFHeaderRef">\r
+ <xs:restriction base="xs:IDREF">\r
+ <xs:pattern value="header\-.*" />\r
+ </xs:restriction>\r
+ </xs:simpleType>\r
+ <xs:simpleType name="XIMFValueID">\r
+ <xs:restriction base="xs:ID">\r
+ <xs:pattern value="value\-.*" />\r
+ </xs:restriction>\r
+ </xs:simpleType>\r
+ <xs:simpleType name="XIMFValueRef">\r
+ <xs:restriction base="xs:IDREF">\r
+ <xs:pattern value="value\-.*" />\r
+ </xs:restriction>\r
+ </xs:simpleType>\r
+ <xs:complexType name="XIMFComplexString">\r
+ <xs:choice minOccurs="0">\r
+ <xs:element xmlns:q1="http://eads.org/ximf/" minOccurs="0" name="string" type="q1:XIMFPrintableStringDataType" />\r
+ <xs:element xmlns:q2="http://eads.org/ximf/" minOccurs="0" name="set" type="q2:XIMFSetType" />\r
+ <xs:element xmlns:q3="http://eads.org/ximf/" minOccurs="0" name="multiset" type="q3:XIMFMultiSetType" />\r
+ <xs:element xmlns:q4="http://eads.org/ximf/" minOccurs="0" maxOccurs="unbounded" name="compstring" type="q4:XIMFComplexString" />\r
+ </xs:choice>\r
+ <xs:attributeGroup xmlns:q5="http://eads.org/ximf/" ref="q5:XIMFPropertiesGroup" />\r
+ <xs:attributeGroup xmlns:q4="http://eads.org/ximf/" ref="q4:XIMFFacetsGroup" />\r
+ <xs:attributeGroup xmlns:q5="http://eads.org/ximf/" ref="q5:XIMFContentGroup" />\r
+ <xs:attribute name="contentPositionEnd" type="xs:boolean" />\r
+ <xs:attribute name="contentFactorise" type="xs:boolean" />\r
+ <xs:attribute name="technicalPositionEnd" type="xs:boolean" />\r
+ </xs:complexType>\r
+ <xs:complexType name="XIMFDictionaryType">\r
+ <xs:choice maxOccurs="unbounded">\r
+ <xs:element name="locale">\r
+ <xs:complexType>\r
+ <xs:complexContent mixed="false">\r
+ <xs:extension xmlns:q14="http://eads.org/ximf/" base="q14:XIMFLocaleType" />\r
+ </xs:complexContent>\r
+ </xs:complexType>\r
+ </xs:element>\r
+ </xs:choice>\r
+ </xs:complexType>\r
+ <xs:complexType name="XIMFLocaleType">\r
+ <xs:choice maxOccurs="unbounded">\r
+ <xs:element name="locale" xmlns:q6="http://eads.org/ximf/" type="q6:XIMFIlkType" />\r
+ </xs:choice>\r
+ <xs:attribute name="lang" type="xs:string" use="required" />\r
+ <xs:attribute name="country" use="optional" />\r
+ </xs:complexType>\r
+ <xs:complexType name="XIMFIlkType">\r
+ <xs:choice maxOccurs="unbounded">\r
+ <xs:element name="ilk">\r
+ <xs:complexType>\r
+ <xs:simpleContent>\r
+ <xs:extension base="xs:string">\r
+ <xs:attribute name="entity" type="xs:string" use="required" />\r
+ </xs:extension>\r
+ </xs:simpleContent>\r
+ </xs:complexType>\r
+ </xs:element>\r
+ </xs:choice>\r
+ </xs:complexType>\r
+ <xs:attributeGroup name="XIMFContentGroup">\r
+ <xs:attribute name="content" xmlns:q7="http://eads.org/ximf/" type="q7:XIMFPrintableStringType" />\r
+ <xs:attribute xmlns:q3="http://eads.org/ximf/" name="technicalContent" type="q3:XIMFPrintableStringType" use="optional" />\r
+ </xs:attributeGroup>\r
+ <xs:attributeGroup name="XIMFPropertiesGroup">\r
+ <xs:attribute xmlns:q3="http://eads.org/ximf/" name="id" type="q3:XIMFValueID" use="optional" />\r
+ <xs:attribute xmlns:q4="http://eads.org/ximf/" name="ref" type="q4:XIMFValueRef" use="optional" />\r
+ <xs:attribute name="ilk" type="xs:string" use="optional" />\r
+ <xs:attribute name="aclLevel" type="xs:unsignedInt" use="optional" />\r
+ <xs:attribute name="index" type="xs:unsignedInt" use="optional" />\r
+ <xs:attribute xmlns:q4="http://eads.org/ximf/" name="description" type="xs:string" use="optional" />\r
+ </xs:attributeGroup>\r
+ <xs:attributeGroup name="XIMFFacetsGroup">\r
+ <xs:attribute name="maxLength" type="xs:unsignedInt" use="optional" />\r
+ <xs:attribute name="minLength" type="xs:unsignedInt" use="optional" />\r
+ <xs:attribute default="1" name="maxItem" type="xs:unsignedInt" use="optional" />\r
+ <xs:attribute name="minItem" type="xs:unsignedInt" use="optional" />\r
+ <xs:attribute xmlns:q15="http://eads.org/ximf/" name="separator" type="q15:XIMFPrintableStringType" use="optional" />\r
+ <xs:attribute xmlns:q16="http://eads.org/ximf/" name="technicalSeparator" type="q16:XIMFPrintableStringType" use="optional" />\r
+ </xs:attributeGroup>\r
</xs:schema>
\ No newline at end of file
-# ***** 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 *****
-# Strings used in the Mozill AccountManager
-prefPanel-ximfmail=XIMF
+# ***** 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
+# Strings used in the Mozill AccountManager\r
+prefPanel-ximfmail=XIMF\r
+\r
-
-
-<!ENTITY time.midnight "Midnight" >
-<!ENTITY time.1 "1:00 AM" >
-<!ENTITY time.2 "2:00 AM" >
-<!ENTITY time.3 "3:00 AM" >
-<!ENTITY time.4 "4:00 AM" >
-<!ENTITY time.5 "5:00 AM" >
-<!ENTITY time.6 "6:00 AM" >
-<!ENTITY time.7 "7:00 AM" >
-<!ENTITY time.8 "8:00 AM" >
-<!ENTITY time.9 "9:00 AM" >
-<!ENTITY time.10 "10:00 AM" >
-<!ENTITY time.11 "11:00 AM" >
-<!ENTITY time.noon "Noon" >
-<!ENTITY time.13 "1:00 PM" >
-<!ENTITY time.14 "2:00 PM" >
-<!ENTITY time.15 "3:00 PM" >
-<!ENTITY time.16 "4:00 PM" >
-<!ENTITY time.17 "5:00 PM" >
-<!ENTITY time.18 "6:00 PM" >
-<!ENTITY time.19 "7:00 PM" >
-<!ENTITY time.20 "8:00 PM" >
-<!ENTITY time.21 "9:00 PM" >
-<!ENTITY time.22 "10:00 PM" >
-<!ENTITY time.23 "11:00 PM" >
-
-<!ENTITY allDayEvents.label "All Day Events">
-
-<!-- Month Names -->
-<!ENTITY day.1.Ddd "Sun" >
-<!ENTITY day.2.Ddd "Mon" >
-<!ENTITY day.3.Ddd "Tue" >
-<!ENTITY day.4.Ddd "Wed" >
-<!ENTITY day.5.Ddd "Thu" >
-<!ENTITY day.6.Ddd "Fri" >
-<!ENTITY day.7.Ddd "Sat" >
-
-<!ENTITY day.1.DDD "SUN" >
-<!ENTITY day.2.DDD "MON" >
-<!ENTITY day.3.DDD "TUE" >
-<!ENTITY day.4.DDD "WED" >
-<!ENTITY day.5.DDD "THU" >
-<!ENTITY day.6.DDD "FRI" >
-<!ENTITY day.7.DDD "SAT" >
-
-<!ENTITY day.1.name "Sunday" >
-<!ENTITY day.2.name "Monday" >
-<!ENTITY day.3.name "Tuesday" >
-<!ENTITY day.4.name "Wednesday" >
-<!ENTITY day.5.name "Thursday" >
-<!ENTITY day.6.name "Friday" >
-<!ENTITY day.7.name "Saturday" >
-
-<!ENTITY time.am "AM" >
-<!ENTITY time.pm "PM" >
-<!ENTITY time.midnight "Midnight" >
-<!ENTITY time.noon "Noon" >
-
-
-<!ENTITY month.1.MMM "JAN" >
-<!ENTITY month.2.MMM "FEB" >
-<!ENTITY month.3.MMM "MAR" >
-<!ENTITY month.4.MMM "APR" >
-<!ENTITY month.5.MMM "MAY" >
-<!ENTITY month.6.MMM "JUN" >
-<!ENTITY month.7.MMM "JUL" >
-<!ENTITY month.8.MMM "AUG" >
-<!ENTITY month.9.MMM "SEP" >
-<!ENTITY month.10.MMM "OCT" >
-<!ENTITY month.11.MMM "NOV" >
-<!ENTITY month.12.MMM "DEC" >
-
-<!ENTITY time.AM "AM" >
-<!ENTITY time.PM "PM" >
-
-<!ENTITY more.label "MORE" >
-<!ENTITY less.label "LESS" >
-<!ENTITY calendar "calendar">
-
-<!ENTITY hour.label "Hour">
+\r
+\r
+<!ENTITY time.midnight "Midnight" >\r
+<!ENTITY time.1 "1:00 AM" >\r
+<!ENTITY time.2 "2:00 AM" >\r
+<!ENTITY time.3 "3:00 AM" >\r
+<!ENTITY time.4 "4:00 AM" >\r
+<!ENTITY time.5 "5:00 AM" >\r
+<!ENTITY time.6 "6:00 AM" >\r
+<!ENTITY time.7 "7:00 AM" >\r
+<!ENTITY time.8 "8:00 AM" >\r
+<!ENTITY time.9 "9:00 AM" >\r
+<!ENTITY time.10 "10:00 AM" >\r
+<!ENTITY time.11 "11:00 AM" >\r
+<!ENTITY time.noon "Noon" >\r
+<!ENTITY time.13 "1:00 PM" >\r
+<!ENTITY time.14 "2:00 PM" >\r
+<!ENTITY time.15 "3:00 PM" >\r
+<!ENTITY time.16 "4:00 PM" >\r
+<!ENTITY time.17 "5:00 PM" >\r
+<!ENTITY time.18 "6:00 PM" >\r
+<!ENTITY time.19 "7:00 PM" >\r
+<!ENTITY time.20 "8:00 PM" >\r
+<!ENTITY time.21 "9:00 PM" >\r
+<!ENTITY time.22 "10:00 PM" >\r
+<!ENTITY time.23 "11:00 PM" >\r
+\r
+<!ENTITY allDayEvents.label "All Day Events">\r
+\r
+<!-- Month Names -->\r
+<!ENTITY day.1.Ddd "Sun" >\r
+<!ENTITY day.2.Ddd "Mon" >\r
+<!ENTITY day.3.Ddd "Tue" >\r
+<!ENTITY day.4.Ddd "Wed" >\r
+<!ENTITY day.5.Ddd "Thu" >\r
+<!ENTITY day.6.Ddd "Fri" >\r
+<!ENTITY day.7.Ddd "Sat" >\r
+\r
+<!ENTITY day.1.DDD "SUN" >\r
+<!ENTITY day.2.DDD "MON" >\r
+<!ENTITY day.3.DDD "TUE" >\r
+<!ENTITY day.4.DDD "WED" >\r
+<!ENTITY day.5.DDD "THU" >\r
+<!ENTITY day.6.DDD "FRI" >\r
+<!ENTITY day.7.DDD "SAT" >\r
+\r
+<!ENTITY day.1.name "Sunday" >\r
+<!ENTITY day.2.name "Monday" >\r
+<!ENTITY day.3.name "Tuesday" >\r
+<!ENTITY day.4.name "Wednesday" >\r
+<!ENTITY day.5.name "Thursday" >\r
+<!ENTITY day.6.name "Friday" >\r
+<!ENTITY day.7.name "Saturday" >\r
+\r
+<!ENTITY time.am "AM" >\r
+<!ENTITY time.pm "PM" >\r
+<!ENTITY time.midnight "Midnight" >\r
+<!ENTITY time.noon "Noon" >\r
+\r
+\r
+<!ENTITY month.1.MMM "JAN" >\r
+<!ENTITY month.2.MMM "FEB" >\r
+<!ENTITY month.3.MMM "MAR" >\r
+<!ENTITY month.4.MMM "APR" >\r
+<!ENTITY month.5.MMM "MAY" >\r
+<!ENTITY month.6.MMM "JUN" >\r
+<!ENTITY month.7.MMM "JUL" >\r
+<!ENTITY month.8.MMM "AUG" >\r
+<!ENTITY month.9.MMM "SEP" >\r
+<!ENTITY month.10.MMM "OCT" >\r
+<!ENTITY month.11.MMM "NOV" >\r
+<!ENTITY month.12.MMM "DEC" >\r
+\r
+<!ENTITY time.AM "AM" >\r
+<!ENTITY time.PM "PM" >\r
+\r
+<!ENTITY more.label "MORE" >\r
+<!ENTITY less.label "LESS" >\r
+<!ENTITY calendar "calendar">\r
+\r
+<!ENTITY hour.label "Hour">\r
<!ENTITY min.label "Minutes">
\ No newline at end of file
-# ***** 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 *****
-label=value
-ximfmailAccountWizardDoneInstance=XIMF definition :
-ximfmail.composer.context.erase=Erase last value
-ximfmail.composer.context.eraseall=Erase all values
-ximfmail.composer.context.details=Detail values
-ximfmail.composer.context.info=Information
-ximfmail.composer.editor.image=Click to open editor
-ximfmail.composer.treedlg.image=Click to open extern data tool
-ximfmail.composer.calendar.image=Click to open calendar
-ximfmail.composer.popup.image=Click to open menu
-ximfmail.dialog.editor.warning.nbrows=elements will be saved
-ximfmail.dialog.editor.warning.nbrows.one=element will be saved
-ximf-association-alert-label=User datas will be removed!
-ximfmail.securityinfo.warning=[ximfmail information] this message should be signed :
-
-
+# ***** 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
+label=value\r
+ximfmailAccountWizardDoneInstance=XIMF definition : \r
+ximfmail.composer.context.erase=Erase last value\r
+ximfmail.composer.context.eraseall=Erase all values\r
+ximfmail.composer.context.details=Detail values\r
+ximfmail.composer.context.info=Information\r
+ximfmail.composer.editor.image=Click to open editor\r
+ximfmail.composer.treedlg.image=Click to open extern data tool\r
+ximfmail.composer.calendar.image=Click to open calendar\r
+ximfmail.composer.popup.image=Click to open menu\r
+ximfmail.dialog.editor.warning.nbrows=elements will be saved\r
+ximfmail.dialog.editor.warning.nbrows.one=element will be saved\r
+ximf-association-alert-label=User datas will be removed!\r
+ximfmail.securityinfo.warning=[ximfmail information] this message should be signed :\r
+\r
+\r
-# ***** 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 *****
-# Strings used in the Mozill AccountManager
-prefPanel-ximfmail=XIMF
-
+# ***** 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
+# Strings used in the Mozill AccountManager\r
+prefPanel-ximfmail=XIMF\r
-
-
-<!ENTITY time.midnight "Midnight" >
-<!ENTITY time.1 "1:00 AM" >
-<!ENTITY time.2 "2:00 AM" >
-<!ENTITY time.3 "3:00 AM" >
-<!ENTITY time.4 "4:00 AM" >
-<!ENTITY time.5 "5:00 AM" >
-<!ENTITY time.6 "6:00 AM" >
-<!ENTITY time.7 "7:00 AM" >
-<!ENTITY time.8 "8:00 AM" >
-<!ENTITY time.9 "9:00 AM" >
-<!ENTITY time.10 "10:00 AM" >
-<!ENTITY time.11 "11:00 AM" >
-<!ENTITY time.noon "Noon" >
-<!ENTITY time.13 "1:00 PM" >
-<!ENTITY time.14 "2:00 PM" >
-<!ENTITY time.15 "3:00 PM" >
-<!ENTITY time.16 "4:00 PM" >
-<!ENTITY time.17 "5:00 PM" >
-<!ENTITY time.18 "6:00 PM" >
-<!ENTITY time.19 "7:00 PM" >
-<!ENTITY time.20 "8:00 PM" >
-<!ENTITY time.21 "9:00 PM" >
-<!ENTITY time.22 "10:00 PM" >
-<!ENTITY time.23 "11:00 PM" >
-
-<!ENTITY allDayEvents.label "All Day Events">
-
-<!-- Month Names -->
-<!ENTITY day.1.Ddd "Dim" >
-<!ENTITY day.2.Ddd "Lun" >
-<!ENTITY day.3.Ddd "Mar" >
-<!ENTITY day.4.Ddd "Mer" >
-<!ENTITY day.5.Ddd "Jeu" >
-<!ENTITY day.6.Ddd "Ven" >
-<!ENTITY day.7.Ddd "Sam" >
-
-<!ENTITY day.1.DDD "DIM" >
-<!ENTITY day.2.DDD "LUN" >
-<!ENTITY day.3.DDD "MAR" >
-<!ENTITY day.4.DDD "MAR" >
-<!ENTITY day.5.DDD "JEU" >
-<!ENTITY day.6.DDD "VEN" >
-<!ENTITY day.7.DDD "SAM" >
-
-<!ENTITY day.1.name "Sunday" >
-<!ENTITY day.2.name "Monday" >
-<!ENTITY day.3.name "Tuesday" >
-<!ENTITY day.4.name "Wednesday" >
-<!ENTITY day.5.name "Thursday" >
-<!ENTITY day.6.name "Friday" >
-<!ENTITY day.7.name "Saturday" >
-
-<!ENTITY time.am "AM" >
-<!ENTITY time.pm "PM" >
-<!ENTITY time.midnight "Midnight" >
-<!ENTITY time.noon "Noon" >
-
-
-<!ENTITY month.1.MMM "JAN" >
-<!ENTITY month.2.MMM "FEV" >
-<!ENTITY month.3.MMM "MAR" >
-<!ENTITY month.4.MMM "AVR" >
-<!ENTITY month.5.MMM "MAI" >
-<!ENTITY month.6.MMM "JUN" >
-<!ENTITY month.7.MMM "JUL" >
-<!ENTITY month.8.MMM "AUT" >
-<!ENTITY month.9.MMM "SEP" >
-<!ENTITY month.10.MMM "OCT" >
-<!ENTITY month.11.MMM "NOV" >
-<!ENTITY month.12.MMM "DEC" >
-
-<!ENTITY time.AM "AM" >
-<!ENTITY time.PM "PM" >
-
-<!ENTITY more.label "MORE" >
-<!ENTITY less.label "LESS" >
-<!ENTITY calendar "calendrier">
-
-<!ENTITY hour.label "Heure">
+\r
+\r
+<!ENTITY time.midnight "Midnight" >\r
+<!ENTITY time.1 "1:00 AM" >\r
+<!ENTITY time.2 "2:00 AM" >\r
+<!ENTITY time.3 "3:00 AM" >\r
+<!ENTITY time.4 "4:00 AM" >\r
+<!ENTITY time.5 "5:00 AM" >\r
+<!ENTITY time.6 "6:00 AM" >\r
+<!ENTITY time.7 "7:00 AM" >\r
+<!ENTITY time.8 "8:00 AM" >\r
+<!ENTITY time.9 "9:00 AM" >\r
+<!ENTITY time.10 "10:00 AM" >\r
+<!ENTITY time.11 "11:00 AM" >\r
+<!ENTITY time.noon "Noon" >\r
+<!ENTITY time.13 "1:00 PM" >\r
+<!ENTITY time.14 "2:00 PM" >\r
+<!ENTITY time.15 "3:00 PM" >\r
+<!ENTITY time.16 "4:00 PM" >\r
+<!ENTITY time.17 "5:00 PM" >\r
+<!ENTITY time.18 "6:00 PM" >\r
+<!ENTITY time.19 "7:00 PM" >\r
+<!ENTITY time.20 "8:00 PM" >\r
+<!ENTITY time.21 "9:00 PM" >\r
+<!ENTITY time.22 "10:00 PM" >\r
+<!ENTITY time.23 "11:00 PM" >\r
+\r
+<!ENTITY allDayEvents.label "All Day Events">\r
+\r
+<!-- Month Names -->\r
+<!ENTITY day.1.Ddd "Dim" >\r
+<!ENTITY day.2.Ddd "Lun" >\r
+<!ENTITY day.3.Ddd "Mar" >\r
+<!ENTITY day.4.Ddd "Mer" >\r
+<!ENTITY day.5.Ddd "Jeu" >\r
+<!ENTITY day.6.Ddd "Ven" >\r
+<!ENTITY day.7.Ddd "Sam" >\r
+\r
+<!ENTITY day.1.DDD "DIM" >\r
+<!ENTITY day.2.DDD "LUN" >\r
+<!ENTITY day.3.DDD "MAR" >\r
+<!ENTITY day.4.DDD "MAR" >\r
+<!ENTITY day.5.DDD "JEU" >\r
+<!ENTITY day.6.DDD "VEN" >\r
+<!ENTITY day.7.DDD "SAM" >\r
+\r
+<!ENTITY day.1.name "Sunday" >\r
+<!ENTITY day.2.name "Monday" >\r
+<!ENTITY day.3.name "Tuesday" >\r
+<!ENTITY day.4.name "Wednesday" >\r
+<!ENTITY day.5.name "Thursday" >\r
+<!ENTITY day.6.name "Friday" >\r
+<!ENTITY day.7.name "Saturday" >\r
+\r
+<!ENTITY time.am "AM" >\r
+<!ENTITY time.pm "PM" >\r
+<!ENTITY time.midnight "Midnight" >\r
+<!ENTITY time.noon "Noon" >\r
+\r
+\r
+<!ENTITY month.1.MMM "JAN" >\r
+<!ENTITY month.2.MMM "FEV" >\r
+<!ENTITY month.3.MMM "MAR" >\r
+<!ENTITY month.4.MMM "AVR" >\r
+<!ENTITY month.5.MMM "MAI" >\r
+<!ENTITY month.6.MMM "JUN" >\r
+<!ENTITY month.7.MMM "JUL" >\r
+<!ENTITY month.8.MMM "AUT" >\r
+<!ENTITY month.9.MMM "SEP" >\r
+<!ENTITY month.10.MMM "OCT" >\r
+<!ENTITY month.11.MMM "NOV" >\r
+<!ENTITY month.12.MMM "DEC" >\r
+\r
+<!ENTITY time.AM "AM" >\r
+<!ENTITY time.PM "PM" >\r
+\r
+<!ENTITY more.label "MORE" >\r
+<!ENTITY less.label "LESS" >\r
+<!ENTITY calendar "calendrier">\r
+\r
+<!ENTITY hour.label "Heure">\r
<!ENTITY min.label "Minutes">
\ No newline at end of file
-<!ENTITY ximfmail.accountWizard.pageTitle "Voulez-vous utiliser des en-têtes XIMF?">
-<!ENTITY ximfmail.am.themeChoice "Utiliser une définition d'instances XIMF pour ce compte : ">
-<!ENTITY ximfmail.am.instanceGroup "Instances XIMF">
-<!ENTITY ximfmail.am.instanceGroup.composition "Rédaction">
-<!ENTITY ximfmail.am.instanceGroup.message "Messages">
-<!ENTITY ximfmail.am.instanceComposeChoice "Créer un message avec l'instance : ">
-<!ENTITY ximfmail.am.instanceAnswerChoice "Répondre à un message avec l'instance : ">
-<!ENTITY ximfmail.am.instanceTransferChoice "Transférer un message avec l'instance : ">
-<!ENTITY ximfmail.am.xsmtpCompatibilityCheck "Assurer la compatibilité XSMTP des entêtes XIMF">
-<!ENTITY ximfmail.am.dialogTitle "XIMFMAIL : entêtes de messages">
-<!ENTITY ximfmail.am.description "Utilisation et gestion d'entêtes XIMF">
-<!ENTITY ximfmail.compose.headerTab " ">
-<!ENTITY ximfmail.compose.advancedTab "Avancé">
-<!ENTITY ximfmail.am.instanceGroup.reception "Réception">
-<!ENTITY ximfmail.am.instanceTreeThreadChoice "Trier les entêtes de messages avec l'instance : ">
-<!ENTITY ximfmail.am.instanceMailPanelChoice "Afficher les messages stockés avec l'instance : ">
-<!ENTITY dlgheader.hdrInfo.descr "Sélection courante d'entête XIMF">
-<!ENTITY ximfmail.composer.context.erase "Effacer la derniere valeur">
-<!ENTITY ximfmail.composer.context.eraseall "Effacer toutes les valeurs">
-<!ENTITY ximfmail.composer.context.details "Détailler les valeurs">
-<!ENTITY ximfmail.composer.context.info "Information">
-<!ENTITY ximfmail.compose.focus "Agrandir Alt +">
-<!ENTITY ximfmail.compose.unfocus "Réduire Alt -">
-<!ENTITY treedialog.buttonlabelcancel "Annuler">
-<!ENTITY treedialog.buttonlabelaccept "Sélectionner">
-<!ENTITY ximfmail.am.secureHeadersRuleCheck "Signer les entêtes du message">
-<!ENTITY ximfmail.am.signMsgAlwaysRuleCheck "Signer systématiquement le message">
-<!ENTITY ximfmail.dialogtree.title.col0 "Mot clé">
+<!ENTITY ximfmail.accountWizard.pageTitle "Voulez-vous utiliser des en-têtes XIMF?">\r
+<!ENTITY ximfmail.am.themeChoice "Utiliser une définition d'instances XIMF pour ce compte : ">\r
+<!ENTITY ximfmail.am.instanceGroup "Instances XIMF">\r
+<!ENTITY ximfmail.am.instanceGroup.composition "Rédaction">\r
+<!ENTITY ximfmail.am.instanceGroup.message "Messages">\r
+<!ENTITY ximfmail.am.instanceComposeChoice "Créer un message avec l'instance : ">\r
+<!ENTITY ximfmail.am.instanceAnswerChoice "Répondre à un message avec l'instance : ">\r
+<!ENTITY ximfmail.am.instanceTransferChoice "Transférer un message avec l'instance : ">\r
+<!ENTITY ximfmail.am.xsmtpCompatibilityCheck "Assurer la compatibilité XSMTP des entêtes XIMF">\r
+<!ENTITY ximfmail.am.dialogTitle "XIMFMAIL : entêtes de messages">\r
+<!ENTITY ximfmail.am.description "Utilisation et gestion d'entêtes XIMF">\r
+<!ENTITY ximfmail.compose.headerTab " ">\r
+<!ENTITY ximfmail.compose.advancedTab "Avancé">\r
+<!ENTITY ximfmail.am.instanceGroup.reception "Réception">\r
+<!ENTITY ximfmail.am.instanceTreeThreadChoice "Trier les entêtes de messages avec l'instance : ">\r
+<!ENTITY ximfmail.am.instanceMailPanelChoice "Afficher les messages stockés avec l'instance : ">\r
+<!ENTITY dlgheader.hdrInfo.descr "Sélection courante d'entête XIMF">\r
+<!ENTITY ximfmail.composer.context.erase "Effacer la derniere valeur">\r
+<!ENTITY ximfmail.composer.context.eraseall "Effacer toutes les valeurs">\r
+<!ENTITY ximfmail.composer.context.details "Détailler les valeurs">\r
+<!ENTITY ximfmail.composer.context.info "Information">\r
+<!ENTITY ximfmail.compose.focus "Agrandir Alt +">\r
+<!ENTITY ximfmail.compose.unfocus "Réduire Alt -">\r
+<!ENTITY treedialog.buttonlabelcancel "Annuler"> \r
+<!ENTITY treedialog.buttonlabelaccept "Sélectionner">\r
+<!ENTITY ximfmail.am.secureHeadersRuleCheck "Signer les entêtes du message">\r
+<!ENTITY ximfmail.am.signMsgAlwaysRuleCheck "Signer systématiquement le message">\r
+<!ENTITY ximfmail.dialogtree.title.col0 "Mot clé">\r
<!ENTITY ximfmail.dialogtree.title.col1 "Libellé">
\ No newline at end of file
-# ***** 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 *****
-label=valeur
-ximfmailAccountWizardDoneInstance=d\u00E9finition XIMF :
-ximfmail.composer.context.erase=Effacer la derni\u00E8re valeur
-ximfmail.composer.context.eraseall=Effacer toutes les valeurs
-ximfmail.composer.context.details=D\u00E9tailler les valeurs
-ximfmail.composer.context.info=Information
-ximfmail.composer.editor.image=Ouvrir l\u0027\u00E9diteur
-ximfmail.composer.treedlg.image=Ouvrir l\u0027outil de donn\u00E9es externes
-ximfmail.composer.calendar.image=Ouvrir le calendrier
-ximfmail.composer.popup.image=Ouvrir le menu
-ximfmail.dialog.editor.warning.nbrows=\u00E9l\u00E9ments au plus seront enregistr\u00E9s
-ximfmail.dialog.editor.warning.nbrows.one=\u00E9l\u00E9ment au plus sera enregistr\u00E9
-ximf-association-alert-label=Des donn\u00e9es saisies vont \u00eatre effac\u00e9es!
-ximfmail.securityinfo.warning=[ximfmail information] le message devrait \u00eatre sign\u00e9 :
-
-
-
+# ***** 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
+label=valeur\r
+ximfmailAccountWizardDoneInstance=d\u00E9finition XIMF : \r
+ximfmail.composer.context.erase=Effacer la derni\u00E8re valeur\r
+ximfmail.composer.context.eraseall=Effacer toutes les valeurs\r
+ximfmail.composer.context.details=D\u00E9tailler les valeurs\r
+ximfmail.composer.context.info=Information\r
+ximfmail.composer.editor.image=Ouvrir l\u0027\u00E9diteur\r
+ximfmail.composer.treedlg.image=Ouvrir l\u0027outil de donn\u00E9es externes\r
+ximfmail.composer.calendar.image=Ouvrir le calendrier\r
+ximfmail.composer.popup.image=Ouvrir le menu\r
+ximfmail.dialog.editor.warning.nbrows=\u00E9l\u00E9ments au plus seront enregistr\u00E9s\r
+ximfmail.dialog.editor.warning.nbrows.one=\u00E9l\u00E9ment au plus sera enregistr\u00E9\r
+ximf-association-alert-label=Des donn\u00e9es saisies vont \u00eatre effac\u00e9es!\r
+ximfmail.securityinfo.warning=[ximfmail information] le message devrait \u00eatre sign\u00e9 :\r
+\r
+\r
+\r
ximfaddress{
-moz-binding: url("chrome://ximfmail/content/ximfaddress/ximfaddress.xml#ximfaddress");
}
-
-
-
-/* Ximfmail Panel custom*/
-#ximfmailComposeMessagePanel richlistbox{
- -moz-appearance: none;
- background-color: inherit;
- border: none;
-}
-
-#ximfmailComposeMessagePanel richlistitem textbox{
- -moz-appearance: none;
- background-color: #ffffff;
- color: #000000;
- border: none;
-}
-
-richlistitem[ximfenable="true"]:hover,
-richlistitem[ximfenable="true"][selected="true"]{
- background-color: #0a246a;
-}
-
-
-checkbox[ximfchild='true'] *
-{
- color:#b20000;
-}
-
-richlistitem[ximfenable="true"]:hover checkbox[disabled='false'],
-richlistitem[ximfenable="true"]:hover menuitem,
-richlistitem[ximfenable="true"]:hover button,
-richlistitem[ximfenable="true"][selected="true"] checkbox[disabled='false'],
-richlistitem[ximfenable="true"][selected="true"] menuitem,
-richlistitem[ximfenable="true"][selected="true"] button{
- color: #ffffff;
-}
-
-richlistitem[ximfenable="false"][selected="true"],
-richlistitem[ximfenable="false"][selected="true"] *
-{
- background-color:inherit;
- color: inherit;
-}
+\r
+\r
+\r
+/* Ximfmail Panel custom*/ \r
+#ximfmailComposeMessagePanel richlistbox{\r
+ -moz-appearance: none;\r
+ background-color: inherit;\r
+ border: none;\r
+}\r
+\r
+#ximfmailComposeMessagePanel richlistitem textbox{\r
+ -moz-appearance: none;\r
+ background-color: #ffffff;\r
+ color: #000000;\r
+ border: none;\r
+}\r
+\r
+richlistitem[ximfenable="true"]:hover,\r
+richlistitem[ximfenable="true"][selected="true"]{ \r
+ background-color: #0a246a;\r
+}\r
+\r
+\r
+checkbox[ximfchild='true'] *\r
+{ \r
+ color:#b20000; \r
+}\r
+\r
+richlistitem[ximfenable="true"]:hover checkbox[disabled='false'],\r
+richlistitem[ximfenable="true"]:hover menuitem,\r
+richlistitem[ximfenable="true"]:hover button,\r
+richlistitem[ximfenable="true"][selected="true"] checkbox[disabled='false'],\r
+richlistitem[ximfenable="true"][selected="true"] menuitem, \r
+richlistitem[ximfenable="true"][selected="true"] button{\r
+ color: #ffffff;\r
+}\r
+\r
+richlistitem[ximfenable="false"][selected="true"],\r
+richlistitem[ximfenable="false"][selected="true"] *\r
+{\r
+ background-color:inherit; \r
+ color: inherit;\r
+}\r
#ximfmailComposeMessagePanel,
#ximfmailMailPanel{
padding:5px !important;
background-image : url("chrome://ximfmail/content/resource/bottom_bg.jpg");
}
-
+\r
.ximfmailFocusBar{
min-height:20px;
max-height:20px;
.ximfDetail:hover,active{
list-style-image : url("chrome://ximfmail/content/resource/detail_text_over.png");
}
-
+\r
#ximfmail-dialog-hdrInfo{
min-width:500px;
max-width:500px;
-}
-
-#ximfheaderName{
- font-variant:small-caps;
- font-weight:bold;
-}
-
-#ximfheaderValue{
- color:#b20000;
+}\r
+\r
+#ximfheaderName{\r
+ font-variant:small-caps;\r
+ font-weight:bold;\r
+}\r
+\r
+#ximfheaderValue{\r
+ color:#b20000; \r
}
#signedHdrIcon[signed="ximfalert"]{
-/* ***** 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 ***** */
-// components defined in this file
-const AM_XIMF_MAIL_EXTENSION_SERVICE_CONTRACTID =
- "@mozilla.org/accountmanager/extension;1?name=am-service-ximfmail";
-const AM_XIMF_MAIL_EXTENSION_SERVICE_CID =
- Components.ID("{E1934208-A30D-4950-8DCE-DCDAB01BDC65}");
-
-
-// interfaces used in this file
-const nsIMsgAccountManagerExtension = Components.interfaces.nsIMsgAccountManagerExtension;
-const nsICategoryManager = Components.interfaces.nsICategoryManager;
-const nsISupports = Components.interfaces.nsISupports;
-
-function XimfmailPrefService(){}
-
-XimfmailPrefService.prototype.name = "ximfmail";
-XimfmailPrefService.prototype.chromePackageName = "ximfmail"
-XimfmailPrefService.prototype.showPanel =
-function (server){
- // show Ximfmail panel for all account types
- return true;
-}
-
-// factory for command line handler service (XimfMailService)
-var XimfmailPrefFactory = new Object();
-
-XimfmailPrefFactory.createInstance =
-function (outer, iid) {
- if (outer != null)
- throw Components.results.NS_ERROR_NO_AGGREGATION;
-
- if (!iid.equals(nsIMsgAccountManagerExtension) && !iid.equals(nsISupports))
- throw Components.results.NS_ERROR_INVALID_ARG;
-
- return new XimfmailPrefService();
-}
-
-var XimfmailPrefsModule = new Object();
-
-XimfmailPrefsModule.registerSelf =
-function (compMgr, fileSpec, location, type)
-{
- dump("Registering Ximfmail account manager extension.\n");
-
- compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
- compMgr.registerFactoryLocation(AM_XIMF_MAIL_EXTENSION_SERVICE_CID,
- "Ximfmail Account Manager Extension Service",
- AM_XIMF_MAIL_EXTENSION_SERVICE_CONTRACTID,
- fileSpec,
- location,
- type);
- catman = Components.classes["@mozilla.org/categorymanager;1"].getService(nsICategoryManager);
- catman.addCategoryEntry("mailnews-accountmanager-extensions",
- "ximfmail-accountmanager-extension",
- AM_XIMF_MAIL_EXTENSION_SERVICE_CONTRACTID, true, true);
- dump("Ximfmail account manager extension registered.\n");
-}
-
-XimfmailPrefsModule.unregisterSelf =
-function(compMgr, fileSpec, location)
-{
- compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
- compMgr.unregisterFactoryLocation(AM_XIMF_MAIL_EXTENSION_SERVICE_CID, fileSpec);
- catman = Components.classes["@mozilla.org/categorymanager;1"].getService(nsICategoryManager);
- catman.deleteCategoryEntry("mailnews-accountmanager-extensions",
- AM_XIMF_MAIL_EXTENSION_SERVICE_CONTRACTID, true);
-}
-
-XimfmailPrefsModule.getClassObject =
-function (compMgr, cid, iid) {
- if (cid.equals(AM_XIMF_MAIL_EXTENSION_SERVICE_CID))
- return XimfmailPrefFactory;
-
-
- if (!iid.equals(Components.interfaces.nsIFactory))
- throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
-
- throw Components.results.NS_ERROR_NO_INTERFACE;
-}
-
-XimfmailPrefsModule.canUnload =
-function(compMgr)
-{
- return true;
-}
-
-// entrypoint
-function NSGetModule(compMgr, fileSpec) {
- return XimfmailPrefsModule;
+/* ***** 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
+// components defined in this file\r
+const AM_XIMF_MAIL_EXTENSION_SERVICE_CONTRACTID =\r
+ "@mozilla.org/accountmanager/extension;1?name=am-service-ximfmail";\r
+const AM_XIMF_MAIL_EXTENSION_SERVICE_CID =\r
+ Components.ID("{E1934208-A30D-4950-8DCE-DCDAB01BDC65}");\r
+ \r
+ \r
+// interfaces used in this file\r
+const nsIMsgAccountManagerExtension = Components.interfaces.nsIMsgAccountManagerExtension;\r
+const nsICategoryManager = Components.interfaces.nsICategoryManager;\r
+const nsISupports = Components.interfaces.nsISupports;\r
+\r
+function XimfmailPrefService(){}\r
+\r
+XimfmailPrefService.prototype.name = "ximfmail";\r
+XimfmailPrefService.prototype.chromePackageName = "ximfmail"\r
+XimfmailPrefService.prototype.showPanel =\r
+function (server){\r
+ // show Ximfmail panel for all account types \r
+ return true;\r
+}\r
+\r
+// factory for command line handler service (XimfMailService)\r
+var XimfmailPrefFactory = new Object();\r
+\r
+XimfmailPrefFactory.createInstance =\r
+function (outer, iid) {\r
+ if (outer != null)\r
+ throw Components.results.NS_ERROR_NO_AGGREGATION;\r
+\r
+ if (!iid.equals(nsIMsgAccountManagerExtension) && !iid.equals(nsISupports))\r
+ throw Components.results.NS_ERROR_INVALID_ARG;\r
+\r
+ return new XimfmailPrefService();\r
+}\r
+\r
+var XimfmailPrefsModule = new Object();\r
+\r
+XimfmailPrefsModule.registerSelf =\r
+function (compMgr, fileSpec, location, type)\r
+{\r
+ dump("Registering Ximfmail account manager extension.\n");\r
+\r
+ compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);\r
+ compMgr.registerFactoryLocation(AM_XIMF_MAIL_EXTENSION_SERVICE_CID,\r
+ "Ximfmail Account Manager Extension Service",\r
+ AM_XIMF_MAIL_EXTENSION_SERVICE_CONTRACTID,\r
+ fileSpec,\r
+ location,\r
+ type);\r
+ catman = Components.classes["@mozilla.org/categorymanager;1"].getService(nsICategoryManager);\r
+ catman.addCategoryEntry("mailnews-accountmanager-extensions",\r
+ "ximfmail-accountmanager-extension",\r
+ AM_XIMF_MAIL_EXTENSION_SERVICE_CONTRACTID, true, true);\r
+ dump("Ximfmail account manager extension registered.\n");\r
+}\r
+\r
+XimfmailPrefsModule.unregisterSelf =\r
+function(compMgr, fileSpec, location)\r
+{\r
+ compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);\r
+ compMgr.unregisterFactoryLocation(AM_XIMF_MAIL_EXTENSION_SERVICE_CID, fileSpec);\r
+ catman = Components.classes["@mozilla.org/categorymanager;1"].getService(nsICategoryManager);\r
+ catman.deleteCategoryEntry("mailnews-accountmanager-extensions",\r
+ AM_XIMF_MAIL_EXTENSION_SERVICE_CONTRACTID, true);\r
+}\r
+\r
+XimfmailPrefsModule.getClassObject =\r
+function (compMgr, cid, iid) {\r
+ if (cid.equals(AM_XIMF_MAIL_EXTENSION_SERVICE_CID))\r
+ return XimfmailPrefFactory;\r
+\r
+\r
+ if (!iid.equals(Components.interfaces.nsIFactory))\r
+ throw Components.results.NS_ERROR_NOT_IMPLEMENTED;\r
+\r
+ throw Components.results.NS_ERROR_NO_INTERFACE; \r
+}\r
+\r
+XimfmailPrefsModule.canUnload =\r
+function(compMgr)\r
+{\r
+ return true;\r
+}\r
+\r
+// entrypoint\r
+function NSGetModule(compMgr, fileSpec) {\r
+ return XimfmailPrefsModule;\r
}
\ No newline at end of file
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
- <Description about="urn:mozilla:install-manifest">
- <em:name>XIMFMail</em:name>
- <em:version>3.1.10+0.5.1</em:version>
- <em:id>{A627B834-BD9F-4b3f-9AF5-347B5A570402}</em:id>
- <em:description>Xtend Internet Message Format engine</em:description>
-
- <em:targetApplication>
- <!-- Thunderbird -->
- <Description>
- <em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
- <em:minVersion>3.1</em:minVersion>
- <em:maxVersion>3.1.*</em:maxVersion>
- </Description>
- </em:targetApplication>
-
- <!-- Development team -->
- <em:creator>CASSIDIAN - an EADS Company</em:creator>
-
- <!-- Informations -->
- <em:homepageURL>http://www.cassidian.com/cassidian/int/en.html</em:homepageURL>
- <em:iconURL>chrome://ximfmail/content/resource/icon-ximfmail.png</em:iconURL>
- <em:optionsURL/><em:aboutURL/></Description>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">\r
+ <Description about="urn:mozilla:install-manifest">\r
+ <em:name>XIMFMail</em:name>\r
+ <em:version>3.1.5+0.3.0d</em:version>\r
+ <em:id>{A627B834-BD9F-4b3f-9AF5-347B5A570402}</em:id>\r
+ <em:description>Xtend Internet Message Format engine</em:description>\r
+\r
+ <em:targetApplication>\r
+ <!-- Thunderbird -->\r
+ <Description>\r
+ <em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>\r
+ <em:minVersion>3.1</em:minVersion>\r
+ <em:maxVersion>3.1.*</em:maxVersion>\r
+ </Description>\r
+ </em:targetApplication>\r
+\r
+ <!-- Development team -->\r
+ <em:creator>CASSIDIAN - an EADS Company</em:creator>\r
+\r
+ <!-- Informations -->\r
+ <em:homepageURL>http://www.cassidian.com/cassidian/int/en.html</em:homepageURL>\r
+ <em:iconURL>chrome://ximfmail/content/resource/icon-ximfmail.png</em:iconURL>\r
+ <em:optionsURL/><em:aboutURL/></Description>\r
</RDF>
\ No newline at end of file
content/kernel/am-ximfmail.xul (chrome/content/kernel/am-ximfmail.xul)
content/kernel/dialogHdrInfo-ximfmail.xul (chrome/content/kernel/dialogHdrInfo-ximfmail.xul)
content/kernel/dialogTree-ximfmail.xul (chrome/content/kernel/dialogTree-ximfmail.xul)
+ content/kernel/dialogTree-rdf-ximfmail.js (chrome/content/kernel/dialogTree-rdf-ximfmail.js)
content/kernel/messageWindow-ov-ximfmail.xul (chrome/content/kernel/messageWindow-ov-ximfmail.xul)
content/kernel/messengerCompose-ov-ximfmail.xul (chrome/content/kernel/messengerCompose-ov-ximfmail.xul)
content/kernel/messenger-ov-ximfmail.xul (chrome/content/kernel/messenger-ov-ximfmail.xul)
-<?xml version="1.0"?>
-
-<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-
-<RDF:Description about="urn:mozilla:extension:${thunext.name}">
- <em:updates>
- <RDF:Seq>
- <RDF:li resource="urn:mozilla:extension:${thunext.name}:${thunext.version}.1288082179"/>
- </RDF:Seq>
- </em:updates>
- <em:version>${thunext.version}.1288082179</em:version>
- <em:updateLink>${thunext.site}/update/fr/ximfmail/@ARCHIVE_NAME@</em:updateLink>
-</RDF:Description>
-
-<RDF:Description about="urn:mozilla:extension:${thunext.name}:${thunext.version}.1288082179">
-<em:version>${thunext.version}.1288082179</em:version>
-<em:targetApplication>
- <!-- Thunderbird -->
- <Description>
- <em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
- <em:minVersion>3.1</em:minVersion>
- <em:maxVersion>3.1.*</em:maxVersion>
- <em:updateLink>${thunext.site}/update/fr/ximfmail/@ARCHIVE_NAME@</em:updateLink>
- </Description>
-</em:targetApplication>
-</RDF:Description>
-
-</RDF:RDF>
+<?xml version="1.0"?>\r
+\r
+<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\r
+xmlns:em="http://www.mozilla.org/2004/em-rdf#">\r
+\r
+<RDF:Description about="urn:mozilla:extension:${thunext.name}">\r
+ <em:updates>\r
+ <RDF:Seq>\r
+ <RDF:li resource="urn:mozilla:extension:${thunext.name}:${thunext.version}.1288082179"/>\r
+ </RDF:Seq>\r
+ </em:updates>\r
+ <em:version>${thunext.version}.1288082179</em:version>\r
+ <em:updateLink>${thunext.site}/update/fr/ximfmail/@ARCHIVE_NAME@</em:updateLink>\r
+</RDF:Description>\r
+\r
+<RDF:Description about="urn:mozilla:extension:${thunext.name}:${thunext.version}.1288082179">\r
+<em:version>${thunext.version}.1288082179</em:version>\r
+<em:targetApplication>\r
+ <!-- Thunderbird -->\r
+ <Description>\r
+ <em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>\r
+ <em:minVersion>3.1</em:minVersion>\r
+ <em:maxVersion>3.1.*</em:maxVersion>\r
+ <em:updateLink>${thunext.site}/update/fr/ximfmail/@ARCHIVE_NAME@</em:updateLink>\r
+ </Description>\r
+</em:targetApplication>\r
+</RDF:Description>\r
+\r
+</RDF:RDF>\r
+trustedbird (3.1.11+0.5.3)
+* Upgrade to Thunderbird 3.1.11
+* Corrective on blocking TrustedBird on downloading messages with big attachments
+* Correctives on security informations of signed messages function
+-- Sep 09 2011
+
+trustedbird (3.1.9+0.4.3)
+ * Upgrade to Thunderbird 3.1.9
+-- Mar 08 2011
+
+trustedbird (3.1.8+0.4.3)
+ * Upgrade to Thunderbird 3.1.8
+-- Mar 03 2011
+
+trustedbird (3.1.7+0.4.3)
+ * Upgrade to Thunderbird 3.1.7
+ * Add SASL external (IMAPS - LDAPS)
+ * Add Secured Headers (based on RFC 5652)
+-- Feb 23 2011
+
+trustedbird (3.1.7+0.2.0)
+ * Upgrade to Thunderbird 3.1.7
+-- Dec 13 2010
+
+trustedbird (3.1.6+0.4.0)
+ * Upgrade to Thunderbird 3.1.6
+ * Add LDAPS
+-- Nov 24 2010
+
+trustedbird (3.1.6+0.2.0)
+ * Upgrade to Thunderbird 3.1.6
+-- Nov 4 2010
+
trustedbird (3.1.5+0.3.0)
* Add SASL external
* Add Secured Headers (based on RFC 5652)
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * ***** BEGIN LICENSE BLOCK *****
-Copyright (c) 2008-2009 EADS DEFENCE AND SECURITY - All rights reserved.
-secure header 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 ***** */
--->
-
-<!-- ximfsecureheaders definition example -->
-<ximf:secure_headers id="001" version="1.0" ximfVersion="2.0" xmlns:ximf="http://ximf.org/ximf/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://eads.org/ximf/ ximf.xsd">
- <ximf:headers identity="XIMF_BASIC">
- <ximf:header name="X-XIMF-Primary-Precedence" status="0" />
- <ximf:header name="X-XIMF-Copy-Precedence" status="0" />
- <ximf:header name="X-XIMF-Correspondance-Type" />
- <ximf:header name="X-XIMF-Exchange-Type" />
- <ximf:header name="X-XIMF-Security-Policy-Identifier" />
- <ximf:header name="X-XIMF-Security-Classification-Identifier" />
- <ximf:header name="X-XIMF-Attribution-Keyword" />
- <ximf:header name="X-XIMF-Security-Categories" />
- <ximf:header name="X-XIMF-Security-Categories-Identifier" />
- <ximf:header name="Reply-To" />
- <ximf:header name="Sender" />
- <ximf:header name="To" />
- <ximf:header name="Cc" />
- <ximf:header name="From" />
- <ximf:header name="Subject" />
- </ximf:headers>
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!--\r
+ * ***** BEGIN LICENSE BLOCK *****\r
+Copyright (c) 2008-2009 EADS DEFENCE AND SECURITY - All rights reserved.\r
+secure header 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, 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 in the redistribution of the source code.\r
+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.\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 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.\r
+ \r
+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)\r
+ * ***** END LICENSE BLOCK ***** */\r
+-->\r
+\r
+<!-- ximfsecureheaders definition example -->\r
+<ximf:secure_headers id="001" version="1.0" ximfVersion="2.0" xmlns:ximf="http://ximf.org/ximf/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://eads.org/ximf/ ximf.xsd">\r
+ <ximf:headers identity="XIMF_BASIC">\r
+ <ximf:header name="X-XIMF-Primary-Precedence" status="0" />\r
+ <ximf:header name="X-XIMF-Copy-Precedence" status="0" />\r
+ <ximf:header name="X-XIMF-Correspondance-Type" />\r
+ <ximf:header name="X-XIMF-Exchange-Type" />\r
+ <ximf:header name="X-XIMF-Security-Policy-Identifier" /> \r
+ <ximf:header name="X-XIMF-Security-Classification-Identifier" />\r
+ <ximf:header name="X-XIMF-Attribution-Keyword" /> \r
+ <ximf:header name="X-XIMF-Security-Categories" />\r
+ <ximf:header name="X-XIMF-Security-Categories-Identifier" /> \r
+ <ximf:header name="Reply-To" />\r
+ <ximf:header name="Sender" />\r
+ <ximf:header name="To" />\r
+ <ximf:header name="Cc" />\r
+ <ximf:header name="From" />\r
+ <ximf:header name="Subject" /> \r
+ </ximf:headers>\r
</ximf:secure_headers>
\ No newline at end of file
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2002
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Eric Ballet Baz / BT Global Services / Etat francais - Ministere de la Defense
- * Raphael Fairise / BT Global Services / Etat francais - Ministere de la Defense
- * Copyright (c) 2010 CASSIDIAN - All rights reserved
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either 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.
- *
- * ***** END LICENSE BLOCK ***** */
-
-var gListBox;
-var gViewButton;
-var gBundle;
-
-var gEmailAddresses;
-var gCertStatusSummaries;
-var gCertIssuedInfos;
-var gCertExpiresInfos;
-var gCerts;
-var gCount;
-
-var gSMimeContractID = "@mozilla.org/messenger-smime/smimejshelper;1";
-var gISMimeJSHelper = Components.interfaces.nsISMimeJSHelper;
-var gIX509Cert = Components.interfaces.nsIX509Cert;
-const nsICertificateDialogs = Components.interfaces.nsICertificateDialogs;
-const nsCertificateDialogs = "@mozilla.org/nsCertificateDialogs;1"
-
-const PREF_SECURE_HEADERS_FOLDER_DATAS="secureheaders.folderdata";
-const SECURE_HEADER_PROPERTIES_URL = "chrome://messenger/locale/secureheaders.properties";
-var gConsole = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
-
-
-function getStatusExplanation(value)
-{
- switch (value)
- {
- case gIX509Cert.VERIFIED_OK:
- return gBundle.getString("StatusValid");
-
- case gIX509Cert.NOT_VERIFIED_UNKNOWN:
- case gIX509Cert.INVALID_CA:
- case gIX509Cert.USAGE_NOT_ALLOWED:
- return gBundle.getString("StatusInvalid");
-
- case gIX509Cert.CERT_REVOKED:
- return gBundle.getString("StatusRevoked");
-
- case gIX509Cert.CERT_EXPIRED:
- return gBundle.getString("StatusExpired");
-
- case gIX509Cert.CERT_NOT_TRUSTED:
- case gIX509Cert.ISSUER_NOT_TRUSTED:
- case gIX509Cert.ISSUER_UNKNOWN:
- return gBundle.getString("StatusUntrusted");
- }
-
- return "";
-}
-
-function onLoad()
-{
- var params = window.arguments[0];
- if (!params)
- return;
-
- var helper = Components.classes[gSMimeContractID].createInstance(gISMimeJSHelper);
-
- if (!helper)
- return;
-
- gListBox = document.getElementById("infolist");
- gViewButton = document.getElementById("viewCertButton");
- gBundle = document.getElementById("bundle_smime_comp_info");
-
- gEmailAddresses = new Object();
- gCertStatusSummaries = new Object();
- gCertIssuedInfos = new Object();
- gCertExpiresInfos = new Object();
- gCerts = new Object();
- gCount = new Object();
- var canEncrypt = new Object();
-
- var allow_ldap_cert_fetching = false;
-
- try {
- if (params.compFields.securityInfo.requireEncryptMessage) {
- allow_ldap_cert_fetching = true;
- }
- }
- catch (e)
- {
- }
-
- while (true)
- {
- try
- {
- helper.getRecipientCertsInfo(
- params.compFields,
- gCount,
- gEmailAddresses,
- gCertStatusSummaries,
- gCertIssuedInfos,
- gCertExpiresInfos,
- gCerts,
- canEncrypt);
- }
- catch (e)
- {
- dump(e);
- return;
- }
-
- if (!allow_ldap_cert_fetching)
- break;
-
- allow_ldap_cert_fetching = false;
-
- var missing = new Array();
-
- for (var j = gCount.value - 1; j >= 0; --j)
- {
- if (!gCerts.value[j])
- {
- missing[missing.length] = gEmailAddresses.value[j];
- }
- }
-
- if (missing.length > 0)
- {
- var prefService =
- Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefService);
- var sPrefs = prefService.getBranch(null);
-
- var autocompleteLdap = false;
- autocompleteLdap = sPrefs.getBoolPref("ldap_2.autoComplete.useDirectory");
-
- if (autocompleteLdap)
- {
- var autocompleteDirectory = null;
- autocompleteDirectory = sPrefs.getCharPref(
- "ldap_2.autoComplete.directoryServer");
-
- if(params.currentIdentity.overrideGlobalPref) {
- autocompleteDirectory = params.currentIdentity.directoryServer;
- }
-
- if (autocompleteDirectory)
- {
- window.openDialog('chrome://messenger-smime/content/certFetchingStatus.xul',
- '',
- 'chrome,resizable=1,modal=1,dialog=1',
- autocompleteDirectory,
- missing
- );
- }
- }
- }
- }
-
- if (gBundle)
- {
- var yes_string = gBundle.getString("StatusYes");
- var no_string = gBundle.getString("StatusNo");
- var not_possible_string = gBundle.getString("StatusNotPossible");
-
- var signed_element = document.getElementById("signed");
- var encrypted_element = document.getElementById("encrypted");
- var signedReceiptRequest_element = document.getElementById("signedReceiptRequest");
- var tripleWrapped_element = document.getElementById("tripleWrapped");
- var securityLabel_element = document.getElementById("securityLabel");
-
- if (params.smFields.requireEncryptMessage)
- {
- if (params.isEncryptionCertAvailable && canEncrypt.value)
- {
- encrypted_element.value = yes_string;
- }
- else
- {
- encrypted_element.value = not_possible_string;
- }
- }
- else
- {
- encrypted_element.value = no_string;
- }
-
- if (params.smFields.signMessage)
- {
- if (params.isSigningCertAvailable)
- {
- signed_element.value = yes_string;
- }
- else
- {
- signed_element.value = not_possible_string;
- }
- }
- else
- {
- signed_element.value = no_string;
- }
-
- if (params.smFields.signedReceiptRequest)
- {
- if (params.isSigningCertAvailable)
- signedReceiptRequest_element.value = yes_string;
- else
- signedReceiptRequest_element.value = not_possible_string;
- }
- else
- signedReceiptRequest_element.value = no_string;
-
- if (params.smFields.tripleWrapMessage)
- {
- if (params.isEncryptionCertAvailable && canEncrypt.value && params.isSigningCertAvailable)
- {
- tripleWrapped_element.value = yes_string;
- }
- else
- {
- tripleWrapped_element.value = not_possible_string;
- }
- }
- else
- {
- tripleWrapped_element.value = no_string;
- }
-
- /* Security Label */
- if (params.smFields.securityPolicyIdentifier != "") {
- if (params.smFields.securityClassification != -1) {
- securityLabel_element.value = securityLabelGetSecurityClassificationName(params.smFields.securityPolicyIdentifier, params.smFields.securityClassification)
- + " [" + securityLabelGetSecurityPolicyIdentifierName(params.smFields.securityPolicyIdentifier) + "]";
- } else {
- securityLabel_element.value = "[" + securityLabelGetSecurityPolicyIdentifierName(params.smFields.securityPolicyIdentifier) + "]";
- }
- } else {
- securityLabel_element.value = no_string;
- }
- }
-
- var imax = gCount.value;
-
- for (var i = 0; i < imax; ++i)
- {
- var listitem = document.createElement("listitem");
-
- listitem.appendChild(createCell(gEmailAddresses.value[i]));
-
- if (!gCerts.value[i])
- {
- listitem.appendChild(createCell(gBundle.getString("StatusNotFound")));
- }
- else
- {
- listitem.appendChild(createCell(getStatusExplanation(gCertStatusSummaries.value[i])));
- listitem.appendChild(createCell(gCertIssuedInfos.value[i]));
- listitem.appendChild(createCell(gCertExpiresInfos.value[i]));
- }
-
- gListBox.appendChild(listitem);
- }
-
- //Secure Headers
- var gSecureBundle = Components.classes["@mozilla.org/intl/stringbundle;1"].getService(Components.interfaces.nsIStringBundleService);
- var secureBundle = gSecureBundle.createBundle(SECURE_HEADER_PROPERTIES_URL);
- var sLabel;
- if(params.isSecureHeaderAvailable){
- // get international label for new line
- sLabel = secureBundle.GetStringFromName("yes.label");
- document.getElementById("headerSecured").setAttribute("value",sLabel);
- ReadSecureHeaders(params);
- }
- else{
- sLabel = secureBundle.GetStringFromName("no.label");
- document.getElementById("headerSecured").setAttribute("value",sLabel);
- }
-}
-
-function onSelectionChange(event)
-{
- if (gListBox.selectedItems.length <= 0)
- {
- gViewButton.setAttribute("disabled", "true");
- }
- else
- {
- gViewButton.removeAttribute("disabled");
- }
-}
-
-function viewCertHelper(parent, cert) {
- var cd = Components.classes[nsCertificateDialogs].getService(nsICertificateDialogs);
- cd.viewCert(parent, cert);
-}
-
-function viewSelectedCert()
-{
- if (gListBox.selectedItems.length > 0)
- {
- var selected = gListBox.selectedIndex;
- var cert = gCerts.value[selected];
- if (cert)
- {
- viewCertHelper(window, cert);
- }
- }
-}
-
-function doHelpButton()
-{
- openHelp('compose_security');
-}
-
-function createCell(label)
-{
- var cell = document.createElement("listcell");
- cell.setAttribute("label", label)
- return cell;
-}
-
-function ReadSecureHeaders(params){
-
-
- // get international label for new line
- var gSecureBundle = Components.classes["@mozilla.org/intl/stringbundle;1"].getService(Components.interfaces.nsIStringBundleService);
- var secureBundle = gSecureBundle.createBundle(SECURE_HEADER_PROPERTIES_URL);
-
- var arrayHeaderSecure=ReadXmlHeadersToSecure(params);
- if(arrayHeaderSecure && params.isSecureHeaderAvailable)
- {
- document.getElementById("secureheaderbox").collapsed = false;
- var treechild = document.getElementById("secHeader_treechild_id");
- for(var i=0;i<arrayHeaderSecure.length;++i)
- {
- var label;
- //read the current header property
- var headerName = arrayHeaderSecure[i]._name;
- var headerStatus = arrayHeaderSecure[i]._status;
- var headerEncrypted = arrayHeaderSecure[i]._encrypted;
-
- //create each element for the tree
- var treeitem=document.createElement("treeitem");
- var treerow=document.createElement("treerow");
- var namecell=document.createElement("treecell");
- var statuscell=document.createElement("treecell");
- var encryptedcell=document.createElement("treecell");
-
- //set the header name
- namecell.setAttribute("label",headerName);
-
- //set the header status
- switch(headerStatus)
- {
- case "-1":
- label=secureBundle.GetStringFromName("notdefine.label");
- break;
- case "0" :
- label=secureBundle.GetStringFromName("headerstatus.duplicated.label");
- break;
- case "1" :
- label=secureBundle.GetStringFromName("headerstatus.deleted.label");
- break;
- case "2":
- label=secureBundle.GetStringFromName("headerstatus.modified.label");
- break;
- default:
- label="ERROR";
- break;
- }
- statuscell.setAttribute("label",label);
-
- //set the header encrypted
- switch(headerEncrypted)
- {
- case "-1":
- label=secureBundle.GetStringFromName("notdefine.label");
- break;
- case "0" :
- label=secureBundle.GetStringFromName("no.label");
- break;
- case "1" :
- label=secureBundle.GetStringFromName("yes.label");
- break;
- default:
- label="ERROR";
- break;
- }
- encryptedcell.setAttribute("label",label);
-
- //append all element in the tree
- treerow.appendChild(namecell);
- treerow.appendChild(statuscell);
- treerow.appendChild(encryptedcell);
- treeitem.appendChild(treerow);
- treechild.appendChild(treeitem);
- }
- }
-
-}
-
-
-/*
- *
- */
-var DEFAULT_SECUREHEADERS_XML_DIR = "secureHeaders"
-var DEFAULT_SECUREHEADERS_XML_FILE = "secureHeadersDefault.xml"
-function ReadXmlHeadersToSecure(params){
- try{
- // get xml file path
- if(!params.currentIdentity){
- gConsole.logStringMessage("[msgCompSecurityInfo.js - ReadXmlHeadersToSecure ] no xml files define \n ");
- return;
- }
-
- var pref_data = params.currentIdentity.getCharAttribute(PREF_SECURE_HEADERS_FOLDER_DATAS);
- var file = null;
-
- if(!pref_data){
- file = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile); // get profile folder
- file.append(DEFAULT_SECUREHEADERS_XML_DIR);
- file.append(DEFAULT_SECUREHEADERS_XML_FILE);
- }else{
- file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
- file.initWithPath( pref_data );
- }
-
- if(!file.exists()){
- gConsole.logStringMessage("[msgCompSecurityInfo.js - ReadXmlHeadersToSecure] Error loading schema file : " + pref_data);
- return;
- }
-
- // Get Xml Document parser
- var stream = Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream);
- stream.init(file, -1, -1, Components.interfaces.nsIFileInputStream.CLOSE_ON_EOF);
- var parser = Components.classes["@mozilla.org/xmlextras/domparser;1"].createInstance(Components.interfaces.nsIDOMParser);
- var xmlDoc = parser.parseFromStream(stream, null, file.fileSize, "text/xml");
-
- // get datas from file
- var tabSecureHeaders = new Array; // tabHeaders[headerName][status][encrypted]
- var compatibleTag = xmlDoc.getElementsByTagName("ximf:headers");
- var sValue="";
- if(compatibleTag.length>0){
- var childNodes = compatibleTag[0].childNodes;
- for(var j=0; j <childNodes.length; ++j ){
- var header_name = "";
- var header_status = "-1";
- var header_encrypted = "-1";
- if(childNodes[j].localName == "header"){
- header_name = childNodes[j].getAttribute("name");
- if(childNodes[j].hasAttribute("status"))
- {
- header_status = childNodes[j].getAttribute("status");
- }
- if(childNodes[j].hasAttribute("encrypted"))
- header_encrypted = parseInt(childNodes[j].getAttribute("encrypted"));
- // load values to array
- tabSecureHeaders.push(new xSecureHeader(header_name, header_status,header_encrypted));
- }
- }
- return tabSecureHeaders;
- }else{
- gConsole.logStringMessage("[msgCompSecurityInfo.js - ReadXmlHeadersToSecure] no headers tag in file " + pref_data);
- }
- } catch (e) {
- gConsole.logStringMessage("[msgCompSecurityInfo.js - ReadXmlHeadersToSecure ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- }
-}
-
-/*
- *
- */
-function xSecureHeader(name,status,encrypted){
- if(name)
- this._name = name;
- if(status)
- this._status = status;
- if(encrypted)
- this._encrypted = encrypted;
-}
+/* ***** BEGIN LICENSE BLOCK *****\r
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1\r
+ *\r
+ * The contents of this file are subject to the Mozilla Public License Version\r
+ * 1.1 (the "License"); you may not use this file except in compliance with\r
+ * the License. You may obtain a copy of the License at\r
+ * http://www.mozilla.org/MPL/\r
+ *\r
+ * Software distributed under the License is distributed on an "AS IS" basis,\r
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License\r
+ * for the specific language governing rights and limitations under the\r
+ * License.\r
+ *\r
+ * The Original Code is Mozilla Communicator.\r
+ *\r
+ * The Initial Developer of the Original Code is\r
+ * Netscape Communications Corporation.\r
+ * Portions created by the Initial Developer are Copyright (C) 2002\r
+ * the Initial Developer. All Rights Reserved.\r
+ *\r
+ * Contributor(s):\r
+ * Eric Ballet Baz / BT Global Services / Etat francais - Ministere de la Defense\r
+ * Raphael Fairise / BT Global Services / Etat francais - Ministere de la Defense\r
+ * Copyright (c) 2010 CASSIDIAN - All rights reserved\r
+ *\r
+ * Alternatively, the contents of this file may be used under the terms of\r
+ * either the GNU General Public License Version 2 or later (the "GPL"), or\r
+ * 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
+ * ***** END LICENSE BLOCK ***** */\r
+\r
+var gListBox;\r
+var gViewButton;\r
+var gBundle;\r
+\r
+var gEmailAddresses;\r
+var gCertStatusSummaries;\r
+var gCertIssuedInfos;\r
+var gCertExpiresInfos;\r
+var gCerts;\r
+var gCount;\r
+\r
+var gSMimeContractID = "@mozilla.org/messenger-smime/smimejshelper;1";\r
+var gISMimeJSHelper = Components.interfaces.nsISMimeJSHelper;\r
+var gIX509Cert = Components.interfaces.nsIX509Cert;\r
+const nsICertificateDialogs = Components.interfaces.nsICertificateDialogs;\r
+const nsCertificateDialogs = "@mozilla.org/nsCertificateDialogs;1"\r
+\r
+const PREF_SECURE_HEADERS_FOLDER_DATAS="secureheaders.folderdata";\r
+const SECURE_HEADER_PROPERTIES_URL = "chrome://messenger/locale/secureheaders.properties";\r
+var gConsole = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);\r
+\r
+\r
+function getStatusExplanation(value)\r
+{\r
+ switch (value)\r
+ {\r
+ case gIX509Cert.VERIFIED_OK:\r
+ return gBundle.getString("StatusValid");\r
+\r
+ case gIX509Cert.NOT_VERIFIED_UNKNOWN:\r
+ case gIX509Cert.INVALID_CA:\r
+ case gIX509Cert.USAGE_NOT_ALLOWED:\r
+ return gBundle.getString("StatusInvalid");\r
+\r
+ case gIX509Cert.CERT_REVOKED:\r
+ return gBundle.getString("StatusRevoked");\r
+\r
+ case gIX509Cert.CERT_EXPIRED:\r
+ return gBundle.getString("StatusExpired");\r
+\r
+ case gIX509Cert.CERT_NOT_TRUSTED:\r
+ case gIX509Cert.ISSUER_NOT_TRUSTED:\r
+ case gIX509Cert.ISSUER_UNKNOWN:\r
+ return gBundle.getString("StatusUntrusted");\r
+ }\r
+\r
+ return "";\r
+}\r
+\r
+function onLoad()\r
+{\r
+ var params = window.arguments[0];\r
+ if (!params)\r
+ return;\r
+\r
+ var helper = Components.classes[gSMimeContractID].createInstance(gISMimeJSHelper);\r
+\r
+ if (!helper)\r
+ return;\r
+\r
+ gListBox = document.getElementById("infolist");\r
+ gViewButton = document.getElementById("viewCertButton");\r
+ gBundle = document.getElementById("bundle_smime_comp_info");\r
+\r
+ gEmailAddresses = new Object();\r
+ gCertStatusSummaries = new Object();\r
+ gCertIssuedInfos = new Object();\r
+ gCertExpiresInfos = new Object();\r
+ gCerts = new Object();\r
+ gCount = new Object();\r
+ var canEncrypt = new Object();\r
+\r
+ var allow_ldap_cert_fetching = false;\r
+\r
+ try { \r
+ if (params.compFields.securityInfo.requireEncryptMessage) {\r
+ allow_ldap_cert_fetching = true;\r
+ }\r
+ }\r
+ catch (e)\r
+ {\r
+ }\r
+\r
+ while (true)\r
+ {\r
+ try\r
+ {\r
+ helper.getRecipientCertsInfo(\r
+ params.compFields,\r
+ gCount,\r
+ gEmailAddresses,\r
+ gCertStatusSummaries,\r
+ gCertIssuedInfos,\r
+ gCertExpiresInfos,\r
+ gCerts,\r
+ canEncrypt);\r
+ }\r
+ catch (e)\r
+ {\r
+ dump(e);\r
+ return;\r
+ }\r
+\r
+ if (!allow_ldap_cert_fetching)\r
+ break;\r
+\r
+ allow_ldap_cert_fetching = false;\r
+\r
+ var missing = new Array();\r
+\r
+ for (var j = gCount.value - 1; j >= 0; --j)\r
+ {\r
+ if (!gCerts.value[j])\r
+ {\r
+ missing[missing.length] = gEmailAddresses.value[j];\r
+ }\r
+ }\r
+\r
+ if (missing.length > 0)\r
+ {\r
+ var prefService = \r
+ Components.classes["@mozilla.org/preferences-service;1"]\r
+ .getService(Components.interfaces.nsIPrefService);\r
+ var sPrefs = prefService.getBranch(null);\r
+\r
+ var autocompleteLdap = false;\r
+ autocompleteLdap = sPrefs.getBoolPref("ldap_2.autoComplete.useDirectory");\r
+\r
+ if (autocompleteLdap)\r
+ {\r
+ var autocompleteDirectory = null;\r
+ autocompleteDirectory = sPrefs.getCharPref(\r
+ "ldap_2.autoComplete.directoryServer");\r
+\r
+ if(params.currentIdentity.overrideGlobalPref) {\r
+ autocompleteDirectory = params.currentIdentity.directoryServer;\r
+ }\r
+\r
+ if (autocompleteDirectory)\r
+ {\r
+ window.openDialog('chrome://messenger-smime/content/certFetchingStatus.xul',\r
+ '',\r
+ 'chrome,resizable=1,modal=1,dialog=1', \r
+ autocompleteDirectory,\r
+ missing\r
+ );\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ if (gBundle)\r
+ {\r
+ var yes_string = gBundle.getString("StatusYes");\r
+ var no_string = gBundle.getString("StatusNo");\r
+ var not_possible_string = gBundle.getString("StatusNotPossible");\r
+\r
+ var signed_element = document.getElementById("signed");\r
+ var encrypted_element = document.getElementById("encrypted");\r
+ var signedReceiptRequest_element = document.getElementById("signedReceiptRequest");\r
+ var tripleWrapped_element = document.getElementById("tripleWrapped");\r
+ var securityLabel_element = document.getElementById("securityLabel");\r
+\r
+ if (params.smFields.requireEncryptMessage)\r
+ {\r
+ if (params.isEncryptionCertAvailable && canEncrypt.value)\r
+ {\r
+ encrypted_element.value = yes_string;\r
+ }\r
+ else\r
+ {\r
+ encrypted_element.value = not_possible_string;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ encrypted_element.value = no_string;\r
+ }\r
+\r
+ if (params.smFields.signMessage)\r
+ {\r
+ if (params.isSigningCertAvailable)\r
+ {\r
+ signed_element.value = yes_string;\r
+ }\r
+ else\r
+ {\r
+ signed_element.value = not_possible_string;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ signed_element.value = no_string;\r
+ }\r
+\r
+ if (params.smFields.signedReceiptRequest)\r
+ {\r
+ if (params.isSigningCertAvailable)\r
+ signedReceiptRequest_element.value = yes_string;\r
+ else\r
+ signedReceiptRequest_element.value = not_possible_string;\r
+ }\r
+ else\r
+ signedReceiptRequest_element.value = no_string;\r
+\r
+ if (params.smFields.tripleWrapMessage)\r
+ {\r
+ if (params.isEncryptionCertAvailable && canEncrypt.value && params.isSigningCertAvailable)\r
+ {\r
+ tripleWrapped_element.value = yes_string;\r
+ }\r
+ else\r
+ {\r
+ tripleWrapped_element.value = not_possible_string;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ tripleWrapped_element.value = no_string;\r
+ }\r
+ \r
+ /* Security Label */\r
+ if (params.smFields.securityPolicyIdentifier != "") {\r
+ if (params.smFields.securityClassification != -1) {\r
+ securityLabel_element.value = securityLabelGetSecurityClassificationName(params.smFields.securityPolicyIdentifier, params.smFields.securityClassification)\r
+ + " [" + securityLabelGetSecurityPolicyIdentifierName(params.smFields.securityPolicyIdentifier) + "]";\r
+ } else {\r
+ securityLabel_element.value = "[" + securityLabelGetSecurityPolicyIdentifierName(params.smFields.securityPolicyIdentifier) + "]";\r
+ }\r
+ } else {\r
+ securityLabel_element.value = no_string;\r
+ }\r
+ }\r
+\r
+ var imax = gCount.value;\r
+ \r
+ for (var i = 0; i < imax; ++i)\r
+ {\r
+ var listitem = document.createElement("listitem");\r
+\r
+ listitem.appendChild(createCell(gEmailAddresses.value[i]));\r
+ \r
+ if (!gCerts.value[i])\r
+ {\r
+ listitem.appendChild(createCell(gBundle.getString("StatusNotFound")));\r
+ }\r
+ else\r
+ {\r
+ listitem.appendChild(createCell(getStatusExplanation(gCertStatusSummaries.value[i])));\r
+ listitem.appendChild(createCell(gCertIssuedInfos.value[i]));\r
+ listitem.appendChild(createCell(gCertExpiresInfos.value[i]));\r
+ }\r
+\r
+ gListBox.appendChild(listitem);\r
+ }\r
+\r
+ //Secure Headers\r
+ var gSecureBundle = Components.classes["@mozilla.org/intl/stringbundle;1"].getService(Components.interfaces.nsIStringBundleService);\r
+ var secureBundle = gSecureBundle.createBundle(SECURE_HEADER_PROPERTIES_URL);\r
+ var sLabel;\r
+ if(params.isSecureHeaderAvailable){\r
+ // get international label for new line\r
+ sLabel = secureBundle.GetStringFromName("yes.label");\r
+ document.getElementById("headerSecured").setAttribute("value",sLabel);\r
+ ReadSecureHeaders(params);\r
+ }\r
+ else{\r
+ sLabel = secureBundle.GetStringFromName("no.label");\r
+ document.getElementById("headerSecured").setAttribute("value",sLabel);\r
+ }\r
+}\r
+\r
+function onSelectionChange(event)\r
+{\r
+ if (gListBox.selectedItems.length <= 0)\r
+ {\r
+ gViewButton.setAttribute("disabled", "true");\r
+ }\r
+ else\r
+ {\r
+ gViewButton.removeAttribute("disabled");\r
+ }\r
+}\r
+\r
+function viewCertHelper(parent, cert) {\r
+ var cd = Components.classes[nsCertificateDialogs].getService(nsICertificateDialogs);\r
+ cd.viewCert(parent, cert);\r
+}\r
+\r
+function viewSelectedCert()\r
+{\r
+ if (gListBox.selectedItems.length > 0)\r
+ {\r
+ var selected = gListBox.selectedIndex;\r
+ var cert = gCerts.value[selected];\r
+ if (cert)\r
+ {\r
+ viewCertHelper(window, cert);\r
+ }\r
+ }\r
+}\r
+\r
+function doHelpButton()\r
+{\r
+ openHelp('compose_security');\r
+}\r
+\r
+function createCell(label)\r
+{\r
+ var cell = document.createElement("listcell");\r
+ cell.setAttribute("label", label)\r
+ return cell;\r
+}\r
+\r
+function ReadSecureHeaders(params){\r
+\r
+\r
+ // get international label for new line\r
+ var gSecureBundle = Components.classes["@mozilla.org/intl/stringbundle;1"].getService(Components.interfaces.nsIStringBundleService);\r
+ var secureBundle = gSecureBundle.createBundle(SECURE_HEADER_PROPERTIES_URL);\r
+\r
+ var arrayHeaderSecure=ReadXmlHeadersToSecure(params);\r
+ if(arrayHeaderSecure && params.isSecureHeaderAvailable)\r
+ {\r
+ document.getElementById("secureheaderbox").collapsed = false;\r
+ var treechild = document.getElementById("secHeader_treechild_id");\r
+ for(var i=0;i<arrayHeaderSecure.length;++i)\r
+ {\r
+ var label;\r
+ //read the current header property\r
+ var headerName = arrayHeaderSecure[i]._name;\r
+ var headerStatus = arrayHeaderSecure[i]._status;\r
+ var headerEncrypted = arrayHeaderSecure[i]._encrypted;\r
+\r
+ //create each element for the tree\r
+ var treeitem=document.createElement("treeitem");\r
+ var treerow=document.createElement("treerow");\r
+ var namecell=document.createElement("treecell");\r
+ var statuscell=document.createElement("treecell");\r
+ var encryptedcell=document.createElement("treecell");\r
+ \r
+ //set the header name\r
+ namecell.setAttribute("label",headerName);\r
+ \r
+ //set the header status\r
+ switch(headerStatus)\r
+ {\r
+ case "-1":\r
+ label=secureBundle.GetStringFromName("notdefine.label");\r
+ break;\r
+ case "0" :\r
+ label=secureBundle.GetStringFromName("headerstatus.duplicated.label");\r
+ break;\r
+ case "1" :\r
+ label=secureBundle.GetStringFromName("headerstatus.deleted.label");\r
+ break;\r
+ case "2":\r
+ label=secureBundle.GetStringFromName("headerstatus.modified.label");\r
+ break;\r
+ default:\r
+ label="ERROR";\r
+ break;\r
+ }\r
+ statuscell.setAttribute("label",label);\r
+ \r
+ //set the header encrypted\r
+ switch(headerEncrypted)\r
+ {\r
+ case "-1":\r
+ label=secureBundle.GetStringFromName("notdefine.label");\r
+ break;\r
+ case "0" :\r
+ label=secureBundle.GetStringFromName("no.label");\r
+ break;\r
+ case "1" :\r
+ label=secureBundle.GetStringFromName("yes.label");\r
+ break;\r
+ default:\r
+ label="ERROR";\r
+ break;\r
+ }\r
+ encryptedcell.setAttribute("label",label);\r
+\r
+ //append all element in the tree\r
+ treerow.appendChild(namecell);\r
+ treerow.appendChild(statuscell);\r
+ treerow.appendChild(encryptedcell);\r
+ treeitem.appendChild(treerow);\r
+ treechild.appendChild(treeitem);\r
+ }\r
+ }\r
+\r
+}\r
+\r
+\r
+/*\r
+ * \r
+ */\r
+var DEFAULT_SECUREHEADERS_XML_DIR = "secureHeaders"\r
+var DEFAULT_SECUREHEADERS_XML_FILE = "secureHeadersDefault.xml"\r
+function ReadXmlHeadersToSecure(params){\r
+ try{ \r
+ // get xml file path\r
+ if(!params.currentIdentity){ \r
+ gConsole.logStringMessage("[msgCompSecurityInfo.js - ReadXmlHeadersToSecure ] no xml files define \n ");\r
+ return;\r
+ }\r
+ \r
+ var pref_data = params.currentIdentity.getCharAttribute(PREF_SECURE_HEADERS_FOLDER_DATAS);\r
+ var file = null;\r
+ \r
+ if(!pref_data){ \r
+ file = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile); // get profile folder\r
+ file.append(DEFAULT_SECUREHEADERS_XML_DIR);\r
+ file.append(DEFAULT_SECUREHEADERS_XML_FILE); \r
+ }else{\r
+ file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);\r
+ file.initWithPath( pref_data ); \r
+ } \r
+ \r
+ if(!file.exists()){\r
+ gConsole.logStringMessage("[msgCompSecurityInfo.js - ReadXmlHeadersToSecure] Error loading schema file : " + pref_data);\r
+ return;\r
+ } \r
+ \r
+ // Get Xml Document parser\r
+ var stream = Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream);\r
+ stream.init(file, -1, -1, Components.interfaces.nsIFileInputStream.CLOSE_ON_EOF);\r
+ var parser = Components.classes["@mozilla.org/xmlextras/domparser;1"].createInstance(Components.interfaces.nsIDOMParser);\r
+ var xmlDoc = parser.parseFromStream(stream, null, file.fileSize, "text/xml"); \r
+ \r
+ // get datas from file\r
+ var tabSecureHeaders = new Array; // tabHeaders[headerName][status][encrypted] \r
+ var compatibleTag = xmlDoc.getElementsByTagName("ximf:headers");\r
+ var sValue="";\r
+ if(compatibleTag.length>0){\r
+ var childNodes = compatibleTag[0].childNodes;\r
+ for(var j=0; j <childNodes.length; ++j ){\r
+ var header_name = ""; \r
+ var header_status = "-1"; \r
+ var header_encrypted = "-1"; \r
+ if(childNodes[j].localName == "header"){\r
+ header_name = childNodes[j].getAttribute("name");\r
+ if(childNodes[j].hasAttribute("status"))\r
+ {\r
+ header_status = childNodes[j].getAttribute("status");\r
+ }\r
+ if(childNodes[j].hasAttribute("encrypted"))\r
+ header_encrypted = parseInt(childNodes[j].getAttribute("encrypted"),10);\r
+ // load values to array\r
+ tabSecureHeaders.push(new xSecureHeader(header_name, header_status,header_encrypted)); \r
+ } \r
+ } \r
+ return tabSecureHeaders; \r
+ }else{\r
+ gConsole.logStringMessage("[msgCompSecurityInfo.js - ReadXmlHeadersToSecure] no headers tag in file " + pref_data);\r
+ } \r
+ } catch (e) {\r
+ gConsole.logStringMessage("[msgCompSecurityInfo.js - ReadXmlHeadersToSecure ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);\r
+ }\r
+}\r
+\r
+/*\r
+ * \r
+ */\r
+function xSecureHeader(name,status,encrypted){\r
+ if(name)\r
+ this._name = name;\r
+ if(status)\r
+ this._status = status;\r
+ if(encrypted)\r
+ this._encrypted = encrypted;\r
+}\r
//var gBrandBundle; -- defined in mailWindow.js
// manipulates some globals from msgReadSMIMEOverlay.js
-
-const SECURE_HEADER_SEPARATOR = "###HEADER_SEPARATOR###";
-const HEADER_VAL_SEPARATOR = "###HEADER_VAL###";
-
const nsICMSMessageErrors = Components.interfaces.nsICMSMessageErrors;
var smimeHeaderSink =
signedStatus: function(aNestingLevel, aSignatureStatus, aSignerCert)
{
- if (aNestingLevel > 1) {
+ if (aNestingLevel > 1) {
// we are not interested
- return;
+ return;
}
gSignatureStatus = aSignatureStatus;
gSignerCert = aSignerCert;
gSMIMEContainer.collapsed = false;
- gSignedUINode.collapsed = false;
-
+ gSignedUINode.collapsed = false;
+ //gConsole.logStringMessage("[smimeHeaderSink:smimeHeaderSink] nsICMSMessageErrors : " + aSignatureStatus);
switch (aSignatureStatus) {
case nsICMSMessageErrors.SUCCESS:
gSignedUINode.setAttribute("signed", "ok");
case nsICMSMessageErrors.VERIFY_NOT_YET_ATTEMPTED:
gSignedUINode.setAttribute("signed", "unknown");
- gStatusBar.setAttribute("signed", "unknown");
+ gStatusBar.setAttribute("signed", "unknown");
break;
case nsICMSMessageErrors.VERIFY_CERT_WITHOUT_ADDRESS:
case nsICMSMessageErrors.VERIFY_HEADER_MISMATCH:
gSignedUINode.setAttribute("signed", "mismatch");
- gStatusBar.setAttribute("signed", "mismatch");
+ gStatusBar.setAttribute("signed", "mismatch");
break;
default:
if (askUser)
gMessageNotificationBar.setSMIMEReceiptRequestMsg(SMIMEReceiptGenerator, aReceiptsTo);
},
- secureHeadersStatus: function(aSecureHeaders, aCanonAlgo)
- {
+ updateSecureHeadersState: function(msgSrc){
+ // parse mime msg : extract headers
+ var currentMimeHeaderDataArray = {};
+ // get MIME headers only
+ var idxEnd = msgSrc.indexOf("\r\n\r\n",0); // * CRLF DOS : "\r\n"
+ if(idxEnd == -1) idxEnd = msgSrc.indexOf("\n\n",0); // * CRLF UNIX : "\n"
+ if(idxEnd == -1) idxEnd = msgSrc.indexOf("\r\r",0); //CRLF OS : "\r"
+ if(idxEnd != -1) msgSrc = msgSrc.substr(0,idxEnd); //dbg gConsole.logStringMessage("[smime - MessageAnalyser - succes getting mime headers : ] \n" + msgSrc);
+
+ // filter on IMF headers - append data to array
+ var separator = new RegExp("\\r\\n|\\r|\\n", "i");// end line
+ var tab = msgSrc.split(separator);
+ var reg_folding = new RegExp("( )","g");
+ var reg_folding2 = new RegExp("(\t)","g");
+ for(var idxTab=0; idxTab<tab.length; ++idxTab){
+ var header_line = tab[idxTab];
+ // search for long header fields (folding) - RFC 2822
+ if(header_line[0]!= " "){
+ try{
+ while( idxTab < tab.length ){
+ var next_line = tab[idxTab+1];
+ if(next_line){
+ if(next_line[0] == " " || next_line[0] == "\t"){
+ header_line += next_line; //next_line.toLowerCase();
+ header_line = header_line.replace(reg_folding," ");
+ header_line = header_line.replace(reg_folding2,"");
+ ++idxTab;
+ }else{ break; }
+ }else{ break; }
+ }
+ }catch(e){}
+ }
+ //gConsole.logStringMessage("[ximfmail - createXimfHdrArray - decode header line : ] \n" + header_line);
+
+ if(header_line.indexOf(":")!=-1){
+ var oEntry = new Object;
+ oEntry.headerName = header_line.substring(0,header_line.indexOf(": ",0));
+ oEntry.headerValue = header_line.substring(header_line.indexOf(": ",header_line)+2);
+ currentMimeHeaderDataArray[oEntry.headerName] = oEntry;
+ //gConsole.logStringMessage("[smime - MessageAnalyser - push : ] \n" + oEntry.headerName + " :: "+ oEntry.headerValue);
+ }
+ }
+
+ // Compute secure headers and mime headers
+ //gConsole.logStringMessage("[smime - updatesecureheaders ] *** secureHeaders analysis begin *** " );
var secStatus = true; //flag for the global secure headers status, set at true as default means all secure headers were not modified
- gSecureHeaders="";
- if(aSecureHeaders)
- {
- //gConsole.logStringMessage("*** secureHeaders analysis begin ***\ncanonization Algorithm : " + aCanonAlgo);
- gSecureHeadersState=1;
- var secureHeaders=aSecureHeaders.QueryInterface(nsIArray);
- var hdrArray=getMsgHdr(); //get selected mime message headers list
- for(var i=0;i<secureHeaders.length;++i)
- {
- var sHeader = secureHeaders.queryElementAt(i,nsIMsgSMIMESecureHeader);
- if(sHeader){
- var hdrName = sHeader.headerName; // signed header
- var hdrValue = sHeader.headerValue; // Value in the signature
- var hdrMimeValue = ""; // value in the MIME message
- var hdrStatus = ""+sHeader.headerStatus;
- var hdrValidity = "valid" //set the default header validity to ok, it means the header was not modified
- var hdrCanonizValue=aCanonAlgo;
- var headerMimeExists = false;
- var tmp_hdrName = "";
- var tmp_hdrMimeName = "";
- //var headerEncrypted = sHeader.headerEncrypted;
- //if(hdrStatus == "0")
- //{
- //Verify the value validity only in the case where header status is duplicated
- tmp_hdrName = hdrName;
- if(aCanonAlgo){
- // RFC 4871 - relaxed header canonicalization algorithm - convert header field names to lowercase
- tmp_hdrName = tmp_hdrName.toLowerCase();
- }
- //gConsole.logStringMessage("secureHeadersStatus - \n check for signed header "+tmp_hdrName);
- for(var j=0;j<hdrArray.length;++j){
- tmp_hdrMimeName = hdrArray[j]._hdrName;
- if(aCanonAlgo){
- // RFC 4871 - relaxed header canonicalization algorithm - convert header field names to lowercase
- tmp_hdrMimeName = tmp_hdrMimeName.toLowerCase();
- }
+ gSecureHeadersState=1;
+ for (headerName in gSecureHeadersArray) {
+ //Verify the value validity only in the case where header status is duplicated
+ var headerMimeExists = false;
+ var tmp_hdrName = gSecureHeadersArray[headerName].hdrName;
+ var canonalgo = gSecureHeadersArray[headerName].hdrCanonAlgo;
+ if(canonalgo){
+ // RFC 4871 - relaxed header canonicalization algorithm - convert header field names to lowercase
+ tmp_hdrName = tmp_hdrName.toLowerCase();
+ }
+ //gConsole.logStringMessage("secureHeadersStatus - \n check for signed header "+tmp_hdrName);
+ //for(var j=0;j<hdrArray.length;++j){
+ for(headerMimeName in currentMimeHeaderDataArray){
+ var tmp_hdrMimeName = currentMimeHeaderDataArray[headerMimeName].headerName;
+ if(canonalgo){
+ // RFC 4871 - relaxed header canonicalization algorithm - convert header field names to lowercase
+ tmp_hdrMimeName = tmp_hdrMimeName.toLowerCase();
+ }
- //gConsole.logStringMessage("secureHeadersStatus - \nsigned header : "+tmp_hdrName+"\nmime header : "+tmp_hdrMimeName);
-
- if(tmp_hdrName==tmp_hdrMimeName){
- // compare secured value ans MIME value of header
- headerMimeExists = true; // header is in mime
- hdrMimeValue=hdrArray[j]._hdrValue;
- var charset = getMimeValueCharset(hdrMimeValue);
+ //gConsole.logStringMessage("secureHeadersStatus - \nsigned header : "+tmp_hdrName+"\nmime header : "+tmp_hdrMimeName);
+ if(tmp_hdrName == tmp_hdrMimeName){
+ // compare secured value ans MIME value of header
+ headerMimeExists = true; // header is in mime
+ var hdrValue = gSecureHeadersArray[headerName].hdrSecureValue;
+ var hdrMimeValue = currentMimeHeaderDataArray[headerMimeName].headerValue;
+ var charset = getMimeValueCharset(hdrMimeValue);
- // body - delete SP/WPS characters before and after body
- hdrMimeValue = deleteFirstAndLastWhiteSpace(hdrMimeValue);
- hdrValue = deleteFirstAndLastWhiteSpace(hdrValue);
+ // body - delete SP/WPS characters before and after body
+ hdrMimeValue = deleteFirstAndLastWhiteSpace(hdrMimeValue);
+ hdrValue = deleteFirstAndLastWhiteSpace(hdrValue);
- if(aCanonAlgo){
- hdrMimeValue = canonilizeHeaderValue(hdrMimeValue);
- hdrValue = canonilizeHeaderValue(hdrValue);
- //gConsole.logStringMessage("secureHeadersStatus - relaxed canonicalization \n mime value:\n>" +hdrMimeValue+ "<\nsigend value:\n>"+hdrValue+"<");
- }else{
- hdrMimeValue = UnfoldingMimeValue(hdrMimeValue);
- hdrMimeValue = deleteLastCRLF(hdrMimeValue);
- hdrValue = UnfoldingMimeValue(hdrValue);
- hdrValue = deleteLastCRLF(hdrValue);
- }
+ if(canonalgo){
+ hdrMimeValue = canonilizeHeaderValue(hdrMimeValue);
+ hdrValue = canonilizeHeaderValue(hdrValue);
+ //gConsole.logStringMessage("secureHeadersStatus - relaxed canonicalization \n mime value:\n>" +hdrMimeValue+ "<\nsigend value:\n>"+hdrValue+"<");
+ }else{
+ hdrMimeValue = UnfoldingMimeValue(hdrMimeValue);
+ hdrMimeValue = deleteLastCRLF(hdrMimeValue);
+ hdrValue = UnfoldingMimeValue(hdrValue);
+ hdrValue = deleteLastCRLF(hdrValue);
+ }
- if(hdrValue!=hdrMimeValue) //test if the header value in the signature and that one in the mime message is the same
- {
- hdrValidity="invalid"; //header was modified
- secStatus=false;
- gConsole.logStringMessage("Warning - failed on verifing secured header "+hdrName+" :\n mime value:\n>" +hdrMimeValue+ "<\nsecured value:\n>"+hdrValue+"<");
- }
+ if(hdrValue!=hdrMimeValue) //test if the header value in the signature and that one in the mime message is the same
+ {
+ gSecureHeadersArray[headerName].hdrSignedRes = "invalid"; //hdrValidity="invalid"; //header was modified
+ secStatus=false;
+ //dbg gConsole.logStringMessage("Warning - failed on verifing secured header "+tmp_hdrName+" :\n mime value:\n>" +hdrMimeValue+ "<\nsecured value:\n>"+hdrValue+"<");
+ gConsole.logStringMessage("[smimeHeaderSink:updateSecureHeadersState]Warning - failed on verifing secured header ");
+ }
- // decode values from MIME format
- var mimeEncoder = Components.classes["@mozilla.org/messenger/mimeconverter;1"].getService(Components.interfaces.nsIMimeConverter);
- hdrMimeValue = mimeEncoder.decodeMimeHeader(hdrMimeValue, charset, false, true);//encodeMimePartIIStr(hdrValue, false, "ISO-8859-1" , 0, 72);
- hdrValue = mimeEncoder.decodeMimeHeader(hdrValue,charset,false,true);
- //gConsole.logStringMessage("secureHeadersStatus - header "+hdrName+" \nmime value: >" +hdrMimeValue+ "<\nsigned value:>"+hdrValue+"<");
-
- break; // header is correctly checked
- }
+ // decode values from MIME format
+ var tmpDecdodedValue=null;
+ var mimeEncoder = Components.classes["@mozilla.org/messenger/mimeconverter;1"].getService(Components.interfaces.nsIMimeConverter);
+ tmpDecdodedValue = mimeEncoder.decodeMimeHeader(hdrMimeValue, charset, false, true);//encodeMimePartIIStr(hdrValue, false, "ISO-8859-1" , 0, 72);
+ if(tmpDecdodedValue){
+ gSecureHeadersArray[headerName].hdrMimeValue = tmpDecdodedValue;
+ }else{
+ gSecureHeadersArray[headerName].hdrMimeValue = hdrMimeValue;
}
-
- // mime header has been lost, deleted...
- if(!headerMimeExists){
- hdrValidity="invalid"; //header was modified
- secStatus=false;
+ tmpDecdodedValue = null;
+ tmpDecdodedValue = mimeEncoder.decodeMimeHeader(hdrValue,charset,false,true);
+ if(tmpDecdodedValue){
+ gSecureHeadersArray[headerName].hdrSecureValue = tmpDecdodedValue;
+ }else{
+ gSecureHeadersArray[headerName].hdrSecureValue = hdrValue;
}
- //}
-
- //set the display secure headers information in the string to parse after in the GUI
- gSecureHeaders+=hdrName+HEADER_VAL_SEPARATOR;
- gSecureHeaders+=hdrValue+HEADER_VAL_SEPARATOR; //put the value decoded instead of the value in the signature (encoded RFC2047) for the diplay
- gSecureHeaders+=""+hdrStatus+HEADER_VAL_SEPARATOR;
- gSecureHeaders+=""+hdrValidity+HEADER_VAL_SEPARATOR;
- //gSecureHeaders+=""+headerEncrypted+HEADER_VAL_SEPARATOR;
- gSecureHeaders+=hdrMimeValue+HEADER_VAL_SEPARATOR;
- gSecureHeaders+=hdrCanonizValue+HEADER_VAL_SEPARATOR;
- gSecureHeaders+=SECURE_HEADER_SEPARATOR;
+ gSecureHeaders = "signedData in";
+ //dbg gConsole.logStringMessage("secureHeadersStatus - header "+headerName+" \nmime value: >" +gSecureHeadersArray[headerName].hdrMimeValue+ "<\nsigned value:>"+gSecureHeadersArray[headerName].hdrSecureValue+"<");
+ break; // header is correctly checked
+ }
}
+
+ // mime header has been lost, deleted...
+ if(!headerMimeExists){
+ gSecureHeadersArray[headerName].hdrSignedRes ="invalid"; //header was modified
+ secStatus=false;
+ }
}
if((!secStatus) && (gSignatureStatus == nsICMSMessageErrors.SUCCESS))
{
//At least one secure header was modified, set the signed status to mismastch
+ gConsole.logStringMessage("[smimeHeaderSink:updateSecureHeadersState] At least one secure header was modified ");
gSignedUINode.setAttribute("signed", "mismatch");
gStatusBar.setAttribute("signed", "mismatch");
gSecureHeadersState=0;
gSMIMEInfoMsg.setAttribute("value", gSMIMEBundle.getString("secureinfomsg_hdrnok"));
gSMIMEInfoMsgMore.value=gSMIMEBundle.getString("secureinfomsgmore_default").replace(/<BR>/g,"\n");
- }
- //gConsole.logStringMessage("*** secureHeaders analysis end ***");
- }
+ }
+ },//end updateSecureHeadersState
+ secureHeadersStatus: function(aSecureHeaders, aCanonAlgo){
+ gSecureHeaders = "";
+ gSecureHeadersArray={}; // clear array
+ if(aSecureHeaders)
+ {
+ var secureHeadersArray=aSecureHeaders.QueryInterface(nsIArray);
+ if(secureHeadersArray.length <= 0 ){
+ gConsole.logStringMessage("[smimeHeaderSink:secureHeadersStatus] *** no secure headers in smime signeddata ");
+ return;
+ }
+
+ for(var i=0;i<secureHeadersArray.length;++i)
+ {
+ var sHeader = secureHeadersArray.queryElementAt(i,nsIMsgSMIMESecureHeader);
+ if(sHeader){
+ var oEntry = new Object;
+ oEntry.hdrName = sHeader.headerName; // signed header
+ oEntry.hdrSecureValue = sHeader.headerValue; // Value in the signature
+ oEntry.hdrMimeValue = ""; // value in the MIME message
+ oEntry.hdrSignedStatus = sHeader.headerStatus;
+ oEntry.hdrCanonAlgo = aCanonAlgo;
+ oEntry.hdrEncryptStatus = "";
+ oEntry.hdrSignedRes = "valid";
+ gSecureHeadersArray[oEntry.hdrName] = oEntry;
+ }
+ }
+ getMessageSource(gFolderDisplay.selectedMessageUris[0], this.updateSecureHeadersState);
+ }
},
// Check the SMIME receipt with the request
SMIMEReceiptStatus: function(aSignedContentIdentifier,
gMessageNotificationBar.setSMIMEReceiptMsg(requestMsgHdr);
},
-
securityLabelStatus: function(aSecurityPolicyIdentifier, aSecurityClassification, aPrivacyMark, aSecurityCategories)
{
gSecurityPolicyIdentifier = aSecurityPolicyIdentifier;
function onSMIMEEndHeaders()
{
- gSMIMEInfoMsg.setAttribute("value", gSMIMEBundle.getString("secureinfomsg_default"));
-
// display secure info message panel
var setSmimeInfoMsg = true;
var prefBranch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch(null);
}else{
document.getElementById("secureinfomsg").setAttribute("collapsed","true");
}
- }
+ }
+
+ // check if message is signed
+ if(checkSignedDataMsg()){
+ //gSMIMEInfoMsg.setAttribute("value", gSMIMEBundle.getString(""));
+ //gSMIMEInfoMsgMore.value=gSMIMEBundle.getString("secureinfomsgmore_nok").replace(/<BR>/g,"\n");
+ gSMIMEInfoMsg.setAttribute("value", gSMIMEBundle.getString("secureinfomsg_default"));
+ gSMIMEInfoMsgMore.value=gSMIMEBundle.getString("secureinfomsgmore_default").replace(/<BR>/g,"\n");
+ }else{
+ gSMIMEInfoMsg.setAttribute("value", gSMIMEBundle.getString("secureinfomsg_unsecured"));
+ gSMIMEInfoMsgMore.value=gSMIMEBundle.getString("secureinfomsgmore_default").replace(/<BR>/g,"\n");
+ }
}
+//
function onSmartCardChange()
{
// only reload encrypted windows
}
}
+//
function msgHdrViewSMIMEOnLoad(event)
{
window.crypto.enableSmartCardEvents = true;
gEncryptedURIService =
Components.classes["@mozilla.org/messenger-smime/smime-encrypted-uris-service;1"]
.getService(Components.interfaces.nsIEncryptedSMIMEURIsService);
-
+
// display security information message
gSMIMEInfoMsg = document.getElementById("secureinfomsgl");
gSMIMEInfoMsgMore = document.getElementById("secureinfomsgd");
gSMIMEInfoMsg = document.getElementById("secureinfomsgl2");
gSMIMEInfoMsgMore = document.getElementById("secureinfomsgd2");
}
- gSMIMEInfoMsg.setAttribute("value", gSMIMEBundle.getString("secureinfomsg_default"));
- gSMIMEInfoMsgMore.value=gSMIMEBundle.getString("secureinfomsgmore_default").replace(/<BR>/g,"\n");
-
+
try{
if(gCurrentIdentity){
//gConsole.logStringMessage("[msgHdrViewSMIMEOnLoad] secureheaders.smimeinfomsg pref = "+setSmimeInfoMsg);
prefBranch.setBoolPref("smimeinfomsg_on", gCurrentIdentity.getBoolAttribute("secureheaders.smimeinfomsg"));
}
}catch(e){gConsole.logStringMessage("[msgHdrViewSMIMEOnLoad] smimeinfomsg error : " + e);}
+
+ // new folder selected : collapse gSMIMEInfoMsg container
+ try{
+ var el = document.getElementById("folderTree");
+ el.addEventListener("select", function(){
+ if(document.getElementById("singlemessage") != undefined)
+ document.getElementById("secureinfomsg").setAttribute("collapsed","true");},
+ false);
+ }catch(e){}
+
}
function msgHdrViewSMIMEOnUnload(event)
}
}
-function MsgHdrObj(){
- this._hdrName;
- this._hdrValue;
-}
-
-
-/**
-* Get the Message header list
-*/
-function getMsgHdr(){
- var _HdrArray = new Array;
- var msgURI = gFolderDisplay.selectedMessageUris[0];
- var cmessenger = Components.classes["@mozilla.org/messenger;1"].createInstance(Components.interfaces.nsIMessenger);
- var msgSvc = cmessenger.messageServiceFromURI(msgURI);
- var MsgStream = Components.classes["@mozilla.org/network/sync-stream-listener;1"].createInstance();
- var consumer = MsgStream.QueryInterface(Components.interfaces.nsIInputStream);
- var ScriptInput = Components.classes["@mozilla.org/scriptableinputstream;1"].createInstance();
- var ScriptInputStream = ScriptInput.QueryInterface(Components.interfaces.nsIScriptableInputStream);
- ScriptInputStream.init(consumer);
- try{
- msgSvc.streamMessage(msgURI, MsgStream, msgWindow, null, false, null);
- }catch (e){
- dump("Error line " + Error().lineNumber + " : "+ e + " - file "+ Error().fileName);
- return _HdrArray;
- }
-
- // analyse des donnees du message selectionne
- ScriptInputStream.available();
- var content = "";
- var tmpBuf = "";
- while (ScriptInputStream .available()) {
- tmpBuf = ScriptInputStream.read(512);
- content = content + tmpBuf;
- // extrac headers
- // RFC 2822 : The body is simply a sequence of characters that
- // follows the header and is separated from the header by an empty line
- // (i.e., a line with nothing preceding the CRLF).
- if(tmpBuf.indexOf("\r\n\r\n",0) != -1 ||
- tmpBuf.indexOf("\n\n",0) != -1 ||
- tmpBuf.indexOf("\r\r",0) != -1){
- break;
- }
- }
-
- // unfolding mime headers
- content = UnfoldingMimeValue(content);
-
- // create array oh MIME headers
- var cur_pos_CRLF = 0; //current position of CRLF
- var cur_pos_str = 0; // current position of string
- var ligne_header = "";
- while((cur_pos_CRLF=content.indexOf("\r\n",cur_pos_str))!=-1)
- {
- ligne_header+=content.substring(cur_pos_str,cur_pos_CRLF);
- if(ligne_header.indexOf(":",0)!=-1){
- var msghdr = new MsgHdrObj();
- // header
- msghdr._hdrName = ligne_header.substring(0,ligne_header.indexOf(":",0));
- msghdr._hdrValue = ligne_header.substring(ligne_header.indexOf(":",0)+1);
- _HdrArray.push(msghdr);
- }
- ligne_header="";
- cur_pos_str=cur_pos_CRLF+2;
- }
- return _HdrArray;
-}
-
function getMimeValueCharset(val)
{
var res="";
return val;
}
+/*
+ *
+ */
+function checkSignedDataMsg(){
+ //
+ var list="";
+ var headerName;
+ var regHdrName_contentype = new RegExp("content-type", "ig");
+ var regHdrValue_signed = new RegExp("multipart/signed", "ig");
+ for (headerName in currentHeaderData) {
+ //list += currentHeaderData[headerName].headerName +":"+currentHeaderData[headerName].headerValue + " $$ ";
+ if(regHdrName_contentype.test(currentHeaderData[headerName].headerName)){
+ if(regHdrValue_signed.test(currentHeaderData[headerName].headerValue)){
+ gConsole.logStringMessage("[checkSignedDataSmimeSelectedMsg] Msg Is Signed");
+ return true;
+ }
+ }
+ }
+ gConsole.logStringMessage("[checkSignedDataSmimeSelectedMsg] Msg Is Unsigned");
+ //dbg gConsole.logStringMessage("[checkSignedDataSmimeSelectedMsg] list : " + list);
+ return false;
+}
+
+ /**
+Get message source
+@param {nsIMsgDBHdr} header
+@param {function} callbackFunction Function to call when data are received: callbackFunction(header, receivedData, callbackParam)
+@param callbackParam Parameter of callbackFunction
+@return {string} Message source or <b>false</b> if an error occurs
+*/
+function getMessageSource(mailUri, callbackFunction, callbackParam){
+ if (!mailUri) return;
+ var streamListener = {
+ QueryInterface: function(aIID) {
+ if (aIID.equals(Components.interfaces.nsISupports)
+ || aIID.equals(Components.interfaces.nsIStreamListener))
+ return this;
+ throw Components.results.NS_NOINTERFACE;
+ },
+ data: "",
+ isDataComplete: false,
+ onStartRequest: function(request, context) {},
+ onDataAvailable: function(request, context, inputStream, offset, available) {
+ if(!this.isDataComplete ){
+ var stream = Components.classes["@mozilla.org/scriptableinputstream;1"].createInstance(Components.interfaces.nsIScriptableInputStream);
+ stream.init(inputStream);
+ this.data += stream.read(available);
+ stream.close();
+ stream = null;
+
+ // parse headers only
+ var idxEnd = this.data.indexOf("\r\n\r\n",0); // * CRLF DOS : "\r\n"
+ if(idxEnd == -1) idxEnd = this.data.indexOf("\n\n",0); // * CRLF UNIX : "\n"
+ if(idxEnd == -1) idxEnd = this.data.indexOf("\r\r",0); //CRLF OS : "\r"
+ if(idxEnd != -1) this.isDataComplete = true; // msgSrc = msgSrc.substr(0,idxEnd); //dbg gConsole.logStringMessage("[smime - MessageAnalyser - succes getting mime headers : ] \n" + msgSrc);
+ }
+ },
+ onStopRequest: function(request, context, status) {
+ if (Components.isSuccessCode(status)) {
+ callbackFunction(this.data, callbackParam);
+ } else {
+ srv.errorSrv("notifyListener.getMsgSrc - "+mailUri+" - Error: "+status);
+ }
+ }
+ }
+
+ var cmessenger = Components.classes["@mozilla.org/messenger;1"].createInstance(Components.interfaces.nsIMessenger);
+ var msgSvc = cmessenger.messageServiceFromURI(mailUri);
+ try { msgSvc.streamMessage(mailUri, streamListener, null, null, false, null); } catch (ex) { return false; }
+}
addEventListener('messagepane-loaded', msgHdrViewSMIMEOnLoad, true);
addEventListener('messagepane-unloaded', msgHdrViewSMIMEOnUnload, true);
addEventListener('messagepane-hide', msgHdrViewSMIMEOnMessagePaneHide, true);
<image id="encryptedHdrIcon"
onclick="showMessageReadSecurityInfo();" collapsed="true"/>
</hbox>
- </hbox>
-
- <vbox id="singlemessage">
- <vbox id="secureinfomsg" insertafter="msgNotificationBar" collapsed="true">
- <hbox id="secureinfomsgh">
- <vbox>
- <label id="secureinfomsgl" onclick="showMessageReadSecurityInfo();"/>
- <description id="secureinfomsgd" />
- </vbox>
- </hbox>
- </vbox>
- </vbox>
- <vbox id="messagepanebox">
- <vbox id="secureinfomsg2" insertafter="msgNotificationBar" collapsed="true">
- <hbox id="secureinfomsgh2">
- <vbox>
- <label id="secureinfomsgl2" onclick="showMessageReadSecurityInfo();"/>
- <!-- <html:div id="secureinfomsgd2" /> -->
- <description id="secureinfomsgd2" />
- </vbox>
- </hbox>
- </vbox>
+ </hbox>\r
+ \r
+ <vbox id="singlemessage">\r
+ <vbox id="secureinfomsg" insertafter="msgNotificationBar" collapsed="true">\r
+ <hbox id="secureinfomsgh"> \r
+ <vbox> \r
+ <label id="secureinfomsgl" onclick="showMessageReadSecurityInfo();"/>\r
+ <description id="secureinfomsgd" /> \r
+ </vbox>\r
+ </hbox> \r
+ </vbox>\r
+ </vbox>\r
+ <vbox id="messagepanebox">\r
+ <vbox id="secureinfomsg2" insertafter="msgNotificationBar" collapsed="true">\r
+ <hbox id="secureinfomsgh2">\r
+ <vbox>\r
+ <label id="secureinfomsgl2" onclick="showMessageReadSecurityInfo();"/>\r
+ <!-- <html:div id="secureinfomsgd2" /> -->\r
+ <description id="secureinfomsgd2" />\r
+ </vbox>\r
+ </hbox> \r
+ </vbox>\r
</vbox>
</overlay>
% overlay chrome://messenger/content/messenger.xul chrome://messenger-smime/content/msgReadSMIMEOverlay.xul
% overlay chrome://messenger/content/messageWindow.xul chrome://messenger-smime/content/msgReadSMIMEOverlay.xul
% overlay chrome://messenger/content/am-identity-edit.xul chrome://messenger/content/am-smimeIdentityEditOverlay.xul
-* content/messenger-smime/msgCompSecurityInfo.xul (content/msgCompSecurityInfo.xul)
* content/messenger-smime/msgReadSMIMEOverlay.xul (content/msgReadSMIMEOverlay.xul)
* content/messenger-smime/msgCompSMIMEOverlay.xul (content/msgCompSMIMEOverlay.xul)
* content/messenger-smime/msgCompSMIMEOverlay.js (content/msgCompSMIMEOverlay.js)
+* content/messenger-smime/msgCompSecurityInfo.xul (content/msgCompSecurityInfo.xul)
* content/messenger-smime/msgHdrViewSMIMEOverlay.js (content/msgHdrViewSMIMEOverlay.js)
content/messenger-smime/msgHdrViewSMIMEOverlay.xul (content/msgHdrViewSMIMEOverlay.xul)
content/messenger/am-smime.xul (/mailnews/extensions/smime/content/am-smime.xul)
content/messenger/am-smime.js (/mailnews/extensions/smime/content/am-smime.js)
content/messenger/am-smimeIdentityEditOverlay.xul (/mailnews/extensions/smime/content/am-smimeIdentityEditOverlay.xul)
content/messenger/am-smimeOverlay.xul (/mailnews/extensions/smime/content/am-smimeOverlay.xul)
- content/messenger-smime/msgCompSecurityInfo.js (/mailnews/extensions/smime/content/msgCompSecurityInfo.js)
content/messenger-smime/msgReadSMIMEOverlay.js (/mailnews/extensions/smime/content/msgReadSMIMEOverlay.js)
+ content/messenger-smime/msgCompSecurityInfo.js (/mailnews/extensions/smime/content/msgCompSecurityInfo.js)
content/messenger-smime/msgReadSecurityInfo.xul (/mailnews/extensions/smime/content/msgReadSecurityInfo.xul)
content/messenger-smime/msgReadSecurityInfo.js (/mailnews/extensions/smime/content/msgReadSecurityInfo.js)
content/messenger-smime/certFetchingStatus.xul (/mailnews/extensions/smime/content/certFetchingStatus.xul)
#
CantDecryptTitle=%brand% cannot decrypt this message
CantDecryptBody=The sender encrypted this message to you using one of your digital certificates, however %brand% was not able to find this certificate and corresponding private key. <br> Possible solutions: <br><ul><li>If you have a smartcard, please insert it now. <li>If you are using a new machine, or if you are using a new %brand% profile, you will need to restore your certificate and private key from a backup. Certificate backups usually end in ".p12".</ul>
-secureinfomsg_default=Integrity of this message is potentially corrupted
+secureinfomsg_default=Integrity of this message is corrupted
secureinfomsgmore_default=Make sure the message comes from a trusted sender
secureinfomsg_ok=Integrity of this message is guaranteed
secureinfomsgmore_ok=
secureinfomsg_notok=The message signature is corrupted
secureinfomsgmore_notok=several reasons: body message has been changed or signature has been changed or sender message has been changed
secureinfomsg_hdrnok=A header has been changed
+secureinfomsg_unsecured=this message is unsecured
\ No newline at end of file
-<!--LOCALIZATION NOTE am-secureheaders.dtd UI for secure headers preferences -->
-
-<!ENTITY pane.title "Secure Headers">
-<!ENTITY secureHeaderFolderPicker.label "Secure headers file">
-<!ENTITY secureHeaderPath.label "Secure header file">
-<!ENTITY browseFolder.label "Browse...">
-<!ENTITY browseFolder.accesskey "B">
-<!ENTITY useSecureHeaders.label "Use secure headers">
-<!ENTITY secureHeadersDescription.label "Secure headers definition" >
-<!ENTITY secureHeadersDatas.label "Secure headers" >
-<!ENTITY smime.am.infomsg.label "Set security state of each message">
-
-
-
-
-
+<!--LOCALIZATION NOTE am-secureheaders.dtd UI for secure headers preferences -->\r
+\r
+<!ENTITY pane.title "Secure Headers">\r
+<!ENTITY secureHeaderFolderPicker.label "Secure headers file">\r
+<!ENTITY secureHeaderPath.label "Secure header file">\r
+<!ENTITY browseFolder.label "Browse...">\r
+<!ENTITY browseFolder.accesskey "B">\r
+<!ENTITY useSecureHeaders.label "Use secure headers">\r
+<!ENTITY secureHeadersDescription.label "Secure headers definition" >\r
+<!ENTITY secureHeadersDatas.label "Secure headers" >\r
+<!ENTITY smime.am.infomsg.label "Set security state of each message">\r
+\r
+\r
+\r
+\r
+\r
-# ***** 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 *****
-# Strings used in the Mozill AccountManager
-prefPanel-secureheaders=Secure Headers
-
+# ***** 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
+# Strings used in the Mozill AccountManager\r
+prefPanel-secureheaders=Secure Headers\r
+\r
-<!--LOCALIZATION NOTE msgReadSecurityInfo.dtd UI for viewing security status when reading a received message -->
-
-<!ENTITY secureHeaders.name "Secure Headers">
-<!ENTITY secureHeaders.field "Secure Headers :">
-<!ENTITY secureHeadersView.label "View Secure Headers">
-<!ENTITY secureHeadersList.label "Secure Headers List">
-<!ENTITY headername.label "Header">
-<!ENTITY headervalue.label "Signed value">
-<!ENTITY headerstatus.label "Status">
-<!ENTITY headerencrypted.label "Encrypted">
-<!ENTITY headermimevalue.label "Displayed value">
-<!ENTITY headercanonisation.label "Canonicalization">
+<!--LOCALIZATION NOTE msgReadSecurityInfo.dtd UI for viewing security status when reading a received message -->\r
+\r
+<!ENTITY secureHeaders.name "Secure Headers">\r
+<!ENTITY secureHeaders.field "Secure Headers :">\r
+<!ENTITY secureHeadersView.label "View Secure Headers">\r
+<!ENTITY secureHeadersList.label "Secure Headers List">\r
+<!ENTITY headername.label "Header">\r
+<!ENTITY headervalue.label "Signed value">\r
+<!ENTITY headerstatus.label "Status">\r
+<!ENTITY headerencrypted.label "Encrypted">\r
+<!ENTITY headermimevalue.label "Displayed value">\r
+<!ENTITY headercanonisation.label "Canonicalization">\r
-menu.secureheaders.label=Secure headers
-secureInfo.secureheaders.label=Secure Headers
-secureheaders.label=Secure Headers :
-yes.label=Yes
-no.label=No
-notdefine.label=Not Defined
-headerstatus.deleted.label=Deleted
-headerstatus.duplicated.label=Duplicated
-headerstatus.modified.label=Modified
-headersecure.valid.label=Valid header
-headersecure.invalid.label=Modified header
-allsecureheaders.valid.label= All secure headers are valid
-allsecureheaders.invalid.label=Secures headers were modified
-headercanoniz.simple.label=Simple
+menu.secureheaders.label=Secure headers\r
+secureInfo.secureheaders.label=Secure Headers\r
+secureheaders.label=Secure Headers :\r
+yes.label=Yes\r
+no.label=No\r
+notdefine.label=Not Defined\r
+headerstatus.deleted.label=Deleted\r
+headerstatus.duplicated.label=Duplicated\r
+headerstatus.modified.label=Modified\r
+headersecure.valid.label=Valid header\r
+headersecure.invalid.label=Modified header\r
+allsecureheaders.valid.label= All secure headers are valid\r
+allsecureheaders.invalid.label=Secures headers were modified\r
+headercanoniz.simple.label=Simple\r
headercanoniz.relaxed.label=Relaxed
\ No newline at end of file
-# securityLabel.js
-unknownSecurityPolicyIdentifier=unknown
-unknownSecurityClassification=unknown
-unknownSecurityCategory=unknown
-
-# securityLabelDialog.js
-noSecurityPolicyIdentifier=none
-noSecurityClassification=none
+# securityLabel.js\r
+unknownSecurityPolicyIdentifier=unknown\r
+unknownSecurityClassification=unknown\r
+unknownSecurityCategory=unknown\r
+\r
+# securityLabelDialog.js\r
+noSecurityPolicyIdentifier=none\r
+noSecurityClassification=none\r
-<!--LOCALIZATION NOTE securityLabelTreeColOverlay.dtd UI -->
-
-<!ENTITY securityLabelSecurityClassificationColumn.label "Classification de sécurité">
-<!ENTITY securityLabelSecurityClassificationColumn.tooltip "trier par étiquettes de sécurité">
+<!--LOCALIZATION NOTE securityLabelTreeColOverlay.dtd UI -->\r
+\r
+<!ENTITY securityLabelSecurityClassificationColumn.label "Classification de sécurité">\r
+<!ENTITY securityLabelSecurityClassificationColumn.tooltip "trier par étiquettes de sécurité">\r
-<!ENTITY pane.title "Entêtes Sécurisés">
-<!ENTITY secureHeaderFolderPicker.label "Fichier des entêtes sécurisés">
-<!ENTITY secureHeaderPath.label "Fichier des entêtes sécurisés">
-<!ENTITY browseFolder.label "Parcourir...">
-<!ENTITY browseFolder.accesskey "P">
-<!ENTITY useSecureHeaders.label "Activer les entêtes sécurises pour ce compte">
-<!ENTITY secureHeadersDescription.label "Définition des entêtes sécurisés">
-<!ENTITY secureHeadersDatas.label "Entêtes sécurisés" >
+<!ENTITY pane.title "Entêtes Sécurisés">\r
+<!ENTITY secureHeaderFolderPicker.label "Fichier des entêtes sécurisés">\r
+<!ENTITY secureHeaderPath.label "Fichier des entêtes sécurisés">\r
+<!ENTITY browseFolder.label "Parcourir...">\r
+<!ENTITY browseFolder.accesskey "P">\r
+<!ENTITY useSecureHeaders.label "Activer les entêtes sécurises pour ce compte">\r
+<!ENTITY secureHeadersDescription.label "Définition des entêtes sécurisés">\r
+<!ENTITY secureHeadersDatas.label "Entêtes sécurisés" >\r
-# ***** 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 *****
-# Strings used in the Mozill AccountManager
-prefPanel-secureheaders=Ent\u00EAtes S\u00E9curis\u00E9s
-
+# ***** 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
+# Strings used in the Mozill AccountManager\r
+prefPanel-secureheaders=Ent\u00EAtes S\u00E9curis\u00E9s\r
+\r
-<!ENTITY pane.title "Eiquettes de sécurité">
-<!ENTITY securityLabel.location "Emplacement des labeles dans l'enveloppe tripme">
-<!ENTITY securityLabel.bothSignatures "Signature interne et externe">
-<!ENTITY securityLabel.innerSignatureOnly "Signature interne uniquement">
-<!ENTITY securityLabel.outerSignatureOnly "Signature externe uniquement">
+<!ENTITY pane.title "Eiquettes de sécurité">\r
+<!ENTITY securityLabel.location "Emplacement des labeles dans l'enveloppe tripme">\r
+<!ENTITY securityLabel.bothSignatures "Signature interne et externe">\r
+<!ENTITY securityLabel.innerSignatureOnly "Signature interne uniquement">\r
+<!ENTITY securityLabel.outerSignatureOnly "Signature externe uniquement">\r
-prefPanel-securitylabel=Etiquettes s\u00E9curit\u00E9
-
+prefPanel-securitylabel=Etiquettes s\u00E9curit\u00E9\r
+\r
-<!ENTITY secureHeaders.name "Entêtes Sécurisés">
-<!ENTITY secureHeaders.field "Entêtes Sécurisés :">
-<!ENTITY secureHeadersView.label "Voir Les Entêtes Sécurisés">
-<!ENTITY secureHeadersList.label "Listes Des Entêtes Sécurisés">
-<!ENTITY headername.label "Entête">
-<!ENTITY headervalue.label "Valeur signée">
-<!ENTITY headerstatus.label "Statut">
-<!ENTITY headerencrypted.label "Chiffré">
-<!ENTITY headermimevalue.label "Valeur affichée">
+<!ENTITY secureHeaders.name "Entêtes Sécurisés">\r
+<!ENTITY secureHeaders.field "Entêtes Sécurisés :">\r
+<!ENTITY secureHeadersView.label "Voir Les Entêtes Sécurisés">\r
+<!ENTITY secureHeadersList.label "Listes Des Entêtes Sécurisés">\r
+<!ENTITY headername.label "Entête">\r
+<!ENTITY headervalue.label "Valeur signée">\r
+<!ENTITY headerstatus.label "Statut">\r
+<!ENTITY headerencrypted.label "Chiffré">\r
+<!ENTITY headermimevalue.label "Valeur affichée">\r
<!ENTITY headercanonisation.label "Canonicalisation">
\ No newline at end of file
-menu.secureheaders.label=S\u00E9curiser les ent\u00EAtes
-secureInfo.secureheaders.label=Ent\u00EAtes S\u00E9curis\u00E9s
-secureheaders.label=Ent\u00EAtes S\u00E9curis\u00E9s :
-yes.label=Oui
-no.label=Non
-notdefine.label=Non defini
-headerstatus.deleted.label=Supprim\u00E9
-headerstatus.duplicated.label=Dupliqu\u00E9
-headerstatus.modified.label=Modifi\u00E9
-headersecure.valid.label=Ent\u00EAtes valide
-headersecure.invalid.label=Ent\u00EAtes modifi\u00E9
-allsecureheaders.valid.label=L\u0027 int\u00E9grit\u00E9 des ent\u00EAtes est v\u00E9rifi\u00E9e
-allsecureheaders.invalid.label=Les ent\u00EAtes ont \u00E9t\u00E9 modifi\u00E9s
-headercanoniz.simple.label=Simple
+menu.secureheaders.label=S\u00E9curiser les ent\u00EAtes\r
+secureInfo.secureheaders.label=Ent\u00EAtes S\u00E9curis\u00E9s\r
+secureheaders.label=Ent\u00EAtes S\u00E9curis\u00E9s :\r
+yes.label=Oui\r
+no.label=Non\r
+notdefine.label=Non defini\r
+headerstatus.deleted.label=Supprim\u00E9\r
+headerstatus.duplicated.label=Dupliqu\u00E9\r
+headerstatus.modified.label=Modifi\u00E9\r
+headersecure.valid.label=Ent\u00EAtes valide\r
+headersecure.invalid.label=Ent\u00EAtes modifi\u00E9\r
+allsecureheaders.valid.label=L\u0027 int\u00E9grit\u00E9 des ent\u00EAtes est v\u00E9rifi\u00E9e\r
+allsecureheaders.invalid.label=Les ent\u00EAtes ont \u00E9t\u00E9 modifi\u00E9s\r
+headercanoniz.simple.label=Simple\r
headercanoniz.relaxed.label=Relach\u00E9
\ No newline at end of file
visibility: visible;
}
-#secureinfomsgh,
+#secureinfomsgh,\r
#secureinfomsgh2{
margin-top:2px;
margin-bottom:2px;
background-color:#ffffcc;
}
-#secureinfomsg label,
+#secureinfomsg label,\r
#secureinfomsg2 label{
font-weight: bold;
cursor: pointer;
}
-#secureinfomsg label:hover,
+#secureinfomsg label:hover,\r
#secureinfomsg2 label:hover{
- color: #ffffff;
- background-color:#000080;
+ color: #ffffff;\r
+ background-color:#000080;\r
-moz-border-radius:3px;
}
\ No newline at end of file
list-style-image: url("chrome://messenger/skin/smime/icons/hdrCryptoNotOk.png");
visibility: visible;
}
-
-#secureinfomsgh,
-#secureinfomsgh2{
- margin-top:2px;
- margin-bottom:2px;
- padding-left:5px;
- background-color:#ffffcc;
-
-}
-#secureinfomsg label,
-#secureinfomsg2 label{
- font-weight: bold;
- cursor: pointer;
-}
-#secureinfomsg label:hover,
-#secureinfomsg2 label:hover{
- color: #ffffff;
- background-color:#000080;
- -moz-border-radius:3px;
+\r
+#secureinfomsgh,\r
+#secureinfomsgh2{\r
+ margin-top:2px; \r
+ margin-bottom:2px;\r
+ padding-left:5px;\r
+ background-color:#ffffcc;\r
+ \r
+}\r
+#secureinfomsg label,\r
+#secureinfomsg2 label{\r
+ font-weight: bold;\r
+ cursor: pointer;\r
+}\r
+#secureinfomsg label:hover,\r
+#secureinfomsg2 label:hover{\r
+ color: #ffffff;\r
+ background-color:#000080;\r
+ -moz-border-radius:3px;\r
}
\ No newline at end of file
list-style-image: url("chrome://messenger/skin/smime/icons/hdrCryptoNotOk.png");
visibility: visible;
}
-
-#secureinfomsgh,
-#secureinfomsgh2{
- margin-top:2px;
- margin-bottom:2px;
- padding-left:5px;
- background-color:#ffffcc;
-
-}
-#secureinfomsg label,
-#secureinfomsg2 label{
- font-weight: bold;
- cursor: pointer;
-}
-#secureinfomsg label:hover,
-#secureinfomsg2 label:hover{
- color: #ffffff;
- background-color:#000080;
- -moz-border-radius:3px;
+\r
+#secureinfomsgh,\r
+#secureinfomsgh2{\r
+ margin-top:2px; \r
+ margin-bottom:2px;\r
+ padding-left:5px;\r
+ background-color:#ffffcc;\r
+ \r
+}\r
+#secureinfomsg label,\r
+#secureinfomsg2 label{\r
+ font-weight: bold;\r
+ cursor: pointer;\r
+}\r
+#secureinfomsg label:hover,\r
+#secureinfomsg2 label:hover{\r
+ color: #ffffff;\r
+ background-color:#000080;\r
+ -moz-border-radius:3px;\r
}
\ No newline at end of file
-/*
- * ***** BEGIN LICENSE BLOCK *****
-Copyright (c) 2008-2009 EADS DEFENCE AND SECURITY - All rights reserved.
-secure header 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 ***** */
-
-var gJSLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].createInstance(Components.interfaces.mozIJSSubScriptLoader);
-var gConsole = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
-
-var gCurrentIdentity=null;
-
-const nsIFilePicker = Components.interfaces.nsIFilePicker;
-const PREF_SECUREHEADERS_FOLDER_DATAS="secureheaders.folderdata";
-//const DEFAULT_SECUREHEADERS_XML_DIR = "\\secureHeader\\";
-//const DEFAULT_SECUREHEADERS_XML_RELATIVE_DIR = "secureHeader/";
-const DEFAULT_SECUREHEADERS_XML_DIR = "secureHeaders"
-const DEFAULT_SECUREHEADERS_XML_FILE = "secureHeadersDefault.xml"
-const PREF_SECUREHEADERS_SMIMEINFO = "secureheaders.smimeinfomsg";
-
-function onPreInit(account, accountValues){
- gCurrentIdentity = account.defaultIdentity;
-}
-
-
-function onInit(aPageId, aServerId){
- /* Get profile directory */
- var dirSecureHeader = Components.classes["@mozilla.org/file/directory_service;1"].createInstance(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile);
- dirSecureHeader.append("secureHeaders");
-
- /* Copy a default profile if needed */
- if (!dirSecureHeader.exists()) {
- dirSecureHeader.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755);
- var defaultFile = Components.classes["@mozilla.org/file/directory_service;1"].createInstance(Components.interfaces.nsIProperties).get("ProfDefNoLoc", Components.interfaces.nsIFile);
- defaultFile.append("secureHeadersDefault.xml");
- if (defaultFile.exists())
- defaultFile.copyTo(dirSecureHeader, "secureHeadersDefault.xml");
- }
-
- var currentFolderTextBox = document.getElementById("secureheaders.xmlPath");
- if(currentFolderTextBox.value==""){
- var pref_data = gCurrentIdentity.getCharAttribute(PREF_SECUREHEADERS_FOLDER_DATAS) ;
- if(pref_data){
- currentFolderTextBox.value = pref_data;
- }else{
- //
- var file = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile);
- file.append(DEFAULT_SECUREHEADERS_XML_DIR);
- file.append(DEFAULT_SECUREHEADERS_XML_FILE);
- //
- var currentFolderTextBox = document.getElementById("secureheaders.xmlPath");
- currentFolderTextBox.value = file.path;
- //currentFolderTextBox.value = file.path + DEFAULT_SECUREHEADERS_XML_DIR+DEFAULT_SECUREHEADERS_XML_FILE;
- gCurrentIdentity.setCharAttribute(PREF_SECUREHEADERS_FOLDER_DATAS,currentFolderTextBox.value);
- }
- }
-
- if(gCurrentIdentity.getBoolAttribute(PREF_SECUREHEADERS_SMIMEINFO)){
- document.getElementById("smimeinfomsgcheck").setAttribute("checked", "true");
- }else{
- document.getElementById("smimeinfomsgcheck").setAttribute("checked", "false");
- }
-}
-
-function onSave(){
- // save secure headers selection to preferences
- var currentFolderTextBox = document.getElementById("secureheaders.xmlPath");
- gCurrentIdentity.setCharAttribute(PREF_SECUREHEADERS_FOLDER_DATAS,currentFolderTextBox.value);
- if(document.getElementById("smimeinfomsgcheck").getAttribute("checked") == "true"){
- gCurrentIdentity.setBoolAttribute(PREF_SECUREHEADERS_SMIMEINFO,true);
- }else{
- gCurrentIdentity.setBoolAttribute(PREF_SECUREHEADERS_SMIMEINFO,false);
- }
-}
-
-
-function BrowseForXmlFile(){
- var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
- var currentFolder = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
- var currentFolderTextBox = document.getElementById("secureheaders.xmlPath");
-
- if(currentFolderTextBox.value!=""){
- currentFolder.initWithPath(currentFolderTextBox.value);
- }else{
- // var extensionPath = getFilePathInProfile(DEFAULT_SECUREHEADERS_XML_RELATIVE_DIR);
- var dirProfile = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile);
- dirProfile.append(DEFAULT_SECUREHEADERS_XML_DIR);
- currentFolder.initWithPath(dirProfile.path);
- }
- //fp.init(window, document.getElementById("browseForXmlFolder").getAttribute("filepickertitle"), nsIFilePicker.modeOpen);
- //fp.appendFilters(nsIFilePicker.filterXML);
- fp.init(window, document.getElementById("browseForXmlFolder").getAttribute("filepickertitle"), nsIFilePicker.modeOpen);
- fp.displayDirectory = currentFolder;
-
- var ret = fp.show();
- if (ret == nsIFilePicker.returnOK)
- {
- // convert the nsILocalFile into a nsIFileSpec
- currentFolderTextBox.value = fp.file.path;
- }
-}
+/*\r
+ * ***** BEGIN LICENSE BLOCK *****\r
+Copyright (c) 2008-2009 EADS DEFENCE AND SECURITY - All rights reserved.\r
+secure header 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, 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 in the redistribution of the source code.\r
+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.\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 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.\r
+ \r
+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)\r
+ * ***** END LICENSE BLOCK ***** */\r
+\r
+var gJSLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].createInstance(Components.interfaces.mozIJSSubScriptLoader);\r
+var gConsole = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);\r
+\r
+var gCurrentIdentity=null;\r
+\r
+const nsIFilePicker = Components.interfaces.nsIFilePicker;\r
+const PREF_SECUREHEADERS_FOLDER_DATAS="secureheaders.folderdata";\r
+//const DEFAULT_SECUREHEADERS_XML_DIR = "\\secureHeader\\";\r
+//const DEFAULT_SECUREHEADERS_XML_RELATIVE_DIR = "secureHeader/";\r
+const DEFAULT_SECUREHEADERS_XML_DIR = "secureHeaders"\r
+const DEFAULT_SECUREHEADERS_XML_FILE = "secureHeadersDefault.xml"\r
+const PREF_SECUREHEADERS_SMIMEINFO = "secureheaders.smimeinfomsg";\r
+\r
+function onPreInit(account, accountValues){\r
+ gCurrentIdentity = account.defaultIdentity;\r
+}\r
+\r
+\r
+function onInit(aPageId, aServerId){\r
+ /* Get profile directory */\r
+ var dirSecureHeader = Components.classes["@mozilla.org/file/directory_service;1"].createInstance(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile);\r
+ dirSecureHeader.append("secureHeaders");\r
+ \r
+ /* Copy a default profile if needed */\r
+ if (!dirSecureHeader.exists()) {\r
+ dirSecureHeader.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755);\r
+ var defaultFile = Components.classes["@mozilla.org/file/directory_service;1"].createInstance(Components.interfaces.nsIProperties).get("ProfDefNoLoc", Components.interfaces.nsIFile);\r
+ defaultFile.append("secureHeadersDefault.xml");\r
+ if (defaultFile.exists())\r
+ defaultFile.copyTo(dirSecureHeader, "secureHeadersDefault.xml");\r
+ }\r
+ \r
+ var currentFolderTextBox = document.getElementById("secureheaders.xmlPath");\r
+ if(currentFolderTextBox.value==""){ \r
+ var pref_data = gCurrentIdentity.getCharAttribute(PREF_SECUREHEADERS_FOLDER_DATAS) ;\r
+ if(pref_data){ \r
+ currentFolderTextBox.value = pref_data;\r
+ }else{\r
+ //\r
+ var file = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile);\r
+ file.append(DEFAULT_SECUREHEADERS_XML_DIR);\r
+ file.append(DEFAULT_SECUREHEADERS_XML_FILE);\r
+ //\r
+ var currentFolderTextBox = document.getElementById("secureheaders.xmlPath");\r
+ currentFolderTextBox.value = file.path;\r
+ //currentFolderTextBox.value = file.path + DEFAULT_SECUREHEADERS_XML_DIR+DEFAULT_SECUREHEADERS_XML_FILE;\r
+ gCurrentIdentity.setCharAttribute(PREF_SECUREHEADERS_FOLDER_DATAS,currentFolderTextBox.value);\r
+ }\r
+ } \r
+ \r
+ if(gCurrentIdentity.getBoolAttribute(PREF_SECUREHEADERS_SMIMEINFO)){\r
+ document.getElementById("smimeinfomsgcheck").setAttribute("checked", "true");\r
+ }else{\r
+ document.getElementById("smimeinfomsgcheck").setAttribute("checked", "false");\r
+ }\r
+}\r
+\r
+function onSave(){\r
+ // save secure headers selection to preferences\r
+ var currentFolderTextBox = document.getElementById("secureheaders.xmlPath"); \r
+ gCurrentIdentity.setCharAttribute(PREF_SECUREHEADERS_FOLDER_DATAS,currentFolderTextBox.value);\r
+ if(document.getElementById("smimeinfomsgcheck").getAttribute("checked") == "true"){ \r
+ gCurrentIdentity.setBoolAttribute(PREF_SECUREHEADERS_SMIMEINFO,true); \r
+ }else{ \r
+ gCurrentIdentity.setBoolAttribute(PREF_SECUREHEADERS_SMIMEINFO,false);\r
+ }\r
+}\r
+\r
+\r
+function BrowseForXmlFile(){\r
+ var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);\r
+ var currentFolder = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);\r
+ var currentFolderTextBox = document.getElementById("secureheaders.xmlPath");\r
+\r
+ if(currentFolderTextBox.value!=""){\r
+ currentFolder.initWithPath(currentFolderTextBox.value);\r
+ }else{\r
+ // var extensionPath = getFilePathInProfile(DEFAULT_SECUREHEADERS_XML_RELATIVE_DIR);\r
+ var dirProfile = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile);\r
+ dirProfile.append(DEFAULT_SECUREHEADERS_XML_DIR);\r
+ currentFolder.initWithPath(dirProfile.path);\r
+ }\r
+ //fp.init(window, document.getElementById("browseForXmlFolder").getAttribute("filepickertitle"), nsIFilePicker.modeOpen);\r
+ //fp.appendFilters(nsIFilePicker.filterXML);\r
+ fp.init(window, document.getElementById("browseForXmlFolder").getAttribute("filepickertitle"), nsIFilePicker.modeOpen);\r
+ fp.displayDirectory = currentFolder;\r
+\r
+ var ret = fp.show();\r
+ if (ret == nsIFilePicker.returnOK) \r
+ {\r
+ // convert the nsILocalFile into a nsIFileSpec \r
+ currentFolderTextBox.value = fp.file.path;\r
+ }\r
+}\r
-<?xml version="1.0"?>
-<!--
- * ***** BEGIN LICENSE BLOCK *****
-Copyright (c) 2008-2009 EADS DEFENCE AND SECURITY - All rights reserved.
-secure header 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 ***** */
--->
-
-<?xml-stylesheet href="chrome://messenger/skin/accountManage.css" type="text/css"?>
-
-<!DOCTYPE page SYSTEM "chrome://messenger/locale/am-secureheaders.dtd">
-
-<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- class="color-dialog"
- onload="parent.onPanelLoaded('am-secureheaders.xul');"
- orient="vertical">
-
- <stringbundle id="bundle_smime" src="chrome://messenger/locale/am-secureheaders.properties" />
- <script type="application/javascript" src="chrome://messenger/content/AccountManager.js" />
- <script type="application/javascript" src="chrome://messenger/content/am-secureheaders.js" />
-
-
- <dialogheader title="&pane.title;"/>
-
- <description value="&secureHeadersDescription.label;"/>
- <separator/>
- <!-- <checkbox label="&useSecureHeaders.label;"/> -->
- <groupbox>
- <caption label="&secureHeadersDatas.label;"/>
- <vbox>
- <label value="&secureHeaderPath.label;"/>
- <hbox align="center">
- <textbox readonly="true" wsm_persist="true" flex="1" id="secureheaders.xmlPath" datatype="nsIFileSpec"
- prefstring="mail.server.%serverkey%.secureheaders.directory" value=""/>
- <button id="browseForXmlFolder" label="&browseFolder.label;" filepickertitle="&secureHeaderFolderPicker.label;"
- accesskey="&browseFolder.accesskey;" oncommand="BrowseForXmlFile()"/>
- </hbox>
- <checkbox id="smimeinfomsgcheck" label="&smime.am.infomsg.label;" checked="true"/>
- </vbox>
- </groupbox>
-</page>
+<?xml version="1.0"?>\r
+<!--\r
+ * ***** BEGIN LICENSE BLOCK *****\r
+Copyright (c) 2008-2009 EADS DEFENCE AND SECURITY - All rights reserved.\r
+secure header 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, 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 in the redistribution of the source code.\r
+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.\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 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.\r
+ \r
+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)\r
+ * ***** END LICENSE BLOCK ***** */\r
+-->\r
+\r
+<?xml-stylesheet href="chrome://messenger/skin/accountManage.css" type="text/css"?>\r
+\r
+<!DOCTYPE page SYSTEM "chrome://messenger/locale/am-secureheaders.dtd">\r
+\r
+<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"\r
+ class="color-dialog"\r
+ onload="parent.onPanelLoaded('am-secureheaders.xul');"\r
+ orient="vertical">\r
+ \r
+ <stringbundle id="bundle_smime" src="chrome://messenger/locale/am-secureheaders.properties" /> \r
+ <script type="application/javascript" src="chrome://messenger/content/AccountManager.js" />\r
+ <script type="application/javascript" src="chrome://messenger/content/am-secureheaders.js" />\r
+\r
+\r
+ <dialogheader title="&pane.title;"/>\r
+\r
+ <description value="&secureHeadersDescription.label;"/>\r
+ <separator/>\r
+ <!-- <checkbox label="&useSecureHeaders.label;"/> --> \r
+ <groupbox> \r
+ <caption label="&secureHeadersDatas.label;"/>\r
+ <vbox>\r
+ <label value="&secureHeaderPath.label;"/>\r
+ <hbox align="center">\r
+ <textbox readonly="true" wsm_persist="true" flex="1" id="secureheaders.xmlPath" datatype="nsIFileSpec"\r
+ prefstring="mail.server.%serverkey%.secureheaders.directory" value=""/>\r
+ <button id="browseForXmlFolder" label="&browseFolder.label;" filepickertitle="&secureHeaderFolderPicker.label;"\r
+ accesskey="&browseFolder.accesskey;" oncommand="BrowseForXmlFile()"/> \r
+ </hbox>\r
+ <checkbox id="smimeinfomsgcheck" label="&smime.am.infomsg.label;" checked="true"/>\r
+ </vbox>\r
+ </groupbox> \r
+</page>\r
-<?xml version="1.0"?>
-<!--
- * ***** BEGIN LICENSE BLOCK *****
-Copyright (c) 2008-2009 EADS DEFENCE AND SECURITY - All rights reserved.
-secure header 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 ***** */
--->
-
-<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
-
- <!-- list all the packages being supplied by this jar -->
- <RDF:Seq about="urn:mozilla:package:root">
- <RDF:li resource="urn:mozilla:package:messenger-secureheaders"/>
- </RDF:Seq>
-
- <!-- package information -->
- <RDF:Description about="urn:mozilla:package:messenger-secureheaders"
- chrome:displayName="Messenger"
- chrome:author="mozilla.org"
- chrome:name="messenger-secureheaders"
-#expand chrome:localeVersion="__MOZILLA_LOCALE_VERSION__"
-#expand chrome:skinVersion="__MOZILLA_SKIN_VERSION__">
- </RDF:Description>
-
-</RDF:RDF>
+<?xml version="1.0"?>\r
+<!--\r
+ * ***** BEGIN LICENSE BLOCK *****\r
+Copyright (c) 2008-2009 EADS DEFENCE AND SECURITY - All rights reserved.\r
+secure header 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, 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 in the redistribution of the source code.\r
+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.\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 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.\r
+ \r
+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)\r
+ * ***** END LICENSE BLOCK ***** */\r
+-->\r
+\r
+<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\r
+ xmlns:chrome="http://www.mozilla.org/rdf/chrome#">\r
+\r
+ <!-- list all the packages being supplied by this jar -->\r
+ <RDF:Seq about="urn:mozilla:package:root">\r
+ <RDF:li resource="urn:mozilla:package:messenger-secureheaders"/>\r
+ </RDF:Seq>\r
+\r
+ <!-- package information -->\r
+ <RDF:Description about="urn:mozilla:package:messenger-secureheaders"\r
+ chrome:displayName="Messenger"\r
+ chrome:author="mozilla.org"\r
+ chrome:name="messenger-secureheaders"\r
+#expand chrome:localeVersion="__MOZILLA_LOCALE_VERSION__"\r
+#expand chrome:skinVersion="__MOZILLA_SKIN_VERSION__">\r
+ </RDF:Description>\r
+\r
+</RDF:RDF>\r
-/* ***** BEGIN LICENSE BLOCK *****
-Copyright (c) 2008-2009 EADS DEFENCE AND SECURITY - All rights reserved.
-secure header 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 ***** */
-
-
-var gConsole = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
-
-const PREF_SECURE_HEADERS_FOLDER_DATAS="secureheaders.folderdata";
-const PREF_DEFAULT_SECUREHEADERS = "secureheaders.bydefault";
-const PROPERTIES_URL = "chrome://messenger/locale/secureheaders.properties";
-const SECURE_HEADERS_ATTRIBUTE_CHECK="secureheaders.checked";
-const HEADER_SEPARATOR=",";
-
-
-
-/*
- *
- */
-document.addEventListener('load', msgCompSMIMEOnLoad, true);
-function msgCompSMIMEOnLoad(){
- /* Get profile directory */
- var dirSecureHeader = Components.classes["@mozilla.org/file/directory_service;1"].createInstance(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile);
- dirSecureHeader.append("secureHeaders");
-
- /* Copy a default profile if needed */
- if (!dirSecureHeader.exists()) {
- dirSecureHeader.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755);
- var defaultFile = Components.classes["@mozilla.org/file/directory_service;1"].createInstance(Components.interfaces.nsIProperties).get("ProfDefNoLoc", Components.interfaces.nsIFile);
- defaultFile.append("secureHeadersDefault.xml");
- if (defaultFile.exists())
- defaultFile.copyTo(dirSecureHeader, "secureHeadersDefault.xml");
- }
-
- // observer on current document
- //document.addEventListener('compose-window-reopen', onComposerOpen_SecureHeaders, true);
- onComposerOpen_SecureHeaders();
-
- // observer on sending message
- var secureheaders_ObserverSvc = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
- secureheaders_ObserverSvc.addObserver(secureheaders_OnSend, "mail:composeOnSend", false);
-
- // ihm events and update
- var item1 = document.getElementById("idItemSecureHeaders_1");
- item1.addEventListener('command', SetCheck_1, true);
- var item2 = document.getElementById("idItemSecureHeaders_2");
- item2.addEventListener('command', SetCheck_2, true);
-
- var item3 = document.getElementById("menu_securitySign1");
- item3.addEventListener('command', SetCheckSecurity_1, true);
- var item4 = document.getElementById("menu_securitySign2");
- item4.addEventListener('command', SetCheckSecurity_2, true);
-
- document.addEventListener("compose-window-close", msgCompSMIMEOnUnLoad, true);
-}
-
-function msgCompSMIMEOnUnLoad(){
- document.getElementById("idItemSecureHeaders_1").setAttribute("checked","false");
- document.getElementById("idItemSecureHeaders_2").setAttribute("checked","false");
- UpdateSecureRequest();
-}
-
-/*
- * Init ihm sign headers
- */
-function onComposerOpen_SecureHeaders(){
- try{
- // get international label for new line
- var gBundle = Components.classes["@mozilla.org/intl/stringbundle;1"].getService(Components.interfaces.nsIStringBundleService);
- var stringBundle = gBundle.createBundle(PROPERTIES_URL);
- var sLabel = stringBundle.GetStringFromName("menu.secureheaders.label");
-
- var elt_menu_to_sign = document.getElementById("idItemSecureHeaders_1");
- // if null, create it
- if(elt_menu_to_sign == null){
- // insert item SecureHeaders in menu composer
- var itemSecureHeaders = document.createElement("menuitem");
- itemSecureHeaders.setAttribute("label",sLabel);
- itemSecureHeaders.setAttribute("id","idItemSecureHeaders_1");
- itemSecureHeaders.setAttribute("type","checkbox");
- itemSecureHeaders.setAttribute("checked","false");
- var itemSecurity = document.getElementById("menu_securitySign1");
- itemSecurity.parentNode.appendChild(itemSecureHeaders);
-
- // insert item Securitylabel in toolbar composer
- var itemSecureHeaders2 = document.createElement("menuitem");
- itemSecureHeaders2.setAttribute("label",sLabel);
- itemSecureHeaders2.setAttribute("id","idItemSecureHeaders_2");
- itemSecureHeaders2.setAttribute("type","checkbox");
- itemSecureHeaders2.setAttribute("checked","false");
- itemSecurity = document.getElementById("menu_securitySign2");
- itemSecurity.parentNode.appendChild(itemSecureHeaders2);
- }else{
- UpdateSecureRequest();
- }
-
- //Loaded SecureHeader Preference
- /*if(gCurrentIdentity){
- gCurrentIdentity.setBoolAttribute(SECURE_HEADERS_ATTRIBUTE_CHECK, false);
- }*/
- }catch(e){
- gConsole.logStringMessage("[_secure_headers - onComposerOpen_SecureHeaders ] \n " + e + "\nfile : " + e.fileName+"\nline : "+ e.lineNumber);
- }
-}
-
-/*
- *
- */
-function SetCheck_1(){
- var checked_1="false";
- var checked_2="false";
- if(document.getElementById("idItemSecureHeaders_2").hasAttribute("checked")){
- checked_2=document.getElementById("idItemSecureHeaders_2").getAttribute("checked");
- }
- if(document.getElementById("idItemSecureHeaders_1").hasAttribute("checked")){
- checked_1=document.getElementById("idItemSecureHeaders_1").getAttribute("checked");
- }
-
- if(checked_2 != checked_1){
- document.getElementById("idItemSecureHeaders_2").setAttribute("checked",checked_1);
- UpdateSecureRequest();
- }
-}
-
-function SetCheck_2(){
- var checked_1="false";
- var checked_2="false";
- if(document.getElementById("idItemSecureHeaders_2").hasAttribute("checked")){
- checked_2=document.getElementById("idItemSecureHeaders_2").getAttribute("checked");
- }
- if(document.getElementById("idItemSecureHeaders_1").hasAttribute("checked")){
- checked_1=document.getElementById("idItemSecureHeaders_1").getAttribute("checked");
- }
-
- if(checked_2 != checked_1){
- document.getElementById("idItemSecureHeaders_1").setAttribute("checked",checked_2);
- UpdateSecureRequest();
- }
-}
-
-/*
- *
- */
-function SetCheckSecurity_1(){
- var checked_1="false";
- var checked_2="false";
- if(document.getElementById("menu_securitySign1").hasAttribute("checked")){
- checked_2=document.getElementById("menu_securitySign1").getAttribute("checked");
- }
-
- if(checked_2 == checked_1){
- document.getElementById("idItemSecureHeaders_1").setAttribute("checked",checked_1);
- document.getElementById("idItemSecureHeaders_2").setAttribute("checked",checked_1);
- UpdateSecureRequest();
- }
-}
-
-/*
- *
- */
-function SetCheckSecurity_2(){
- var checked_1="false";
- var checked_2="false";
- if(document.getElementById("menu_securitySign2").hasAttribute("checked")){
- checked_2=document.getElementById("menu_securitySign2").getAttribute("checked");
- }
-
- if(checked_2 == checked_1){
- document.getElementById("idItemSecureHeaders_1").setAttribute("checked",checked_1);
- document.getElementById("idItemSecureHeaders_2").setAttribute("checked",checked_1);
- UpdateSecureRequest();
- }
-}
-
-function UpdateSecureRequest(){
-
- var checked="false";
- if(document.getElementById("idItemSecureHeaders_1").hasAttribute("checked")){
- checked=document.getElementById("idItemSecureHeaders_1").getAttribute("checked");
- }
- if(checked=="true"){
- document.getElementById("menu_securitySign1").setAttribute("checked","true");
- document.getElementById("menu_securitySign2").setAttribute("checked","true");
- if(gSMFields && !gSMFields.signMessage)
- {
- setNextCommand('signMessage');
- }
- //gCurrentIdentity.setBoolAttribute(SECURE_HEADERS_ATTRIBUTE_CHECK,true);
- }
- else{
- document.getElementById("menu_securitySign1").setAttribute("checked","false");
- document.getElementById("menu_securitySign2").setAttribute("checked","false");
- //gCurrentIdentity.setBoolAttribute(SECURE_HEADERS_ATTRIBUTE_CHECK,false);
- }
-}
-
-/*
- *
- */
-var secureheaders_OnSend = {
- _ArrayheadersToSign : null,
- observe: function(subject, topic, data) {
- //is HeaderSecure requested
- var elt = document.getElementById("idItemSecureHeaders_1");
- if(elt.hasAttribute("checked")){
- this.AddSecureHeadersArray();
- }
- },
- AddSecureHeadersArray: function(){
- try {
- if (!gMsgCompose.compFields) return;
- if (!gMsgCompose.compFields.securityInfo) return;
-
- var msgSMimeCompFields = gMsgCompose.compFields.securityInfo;
- if(!msgSMimeCompFields){
- gConsole.logStringMessage("[ _secure_headers - AddSecureHeadersArray] : gMsgCompose.compFields.securityInfo not found");
- return;
- }
- //clear secure headers
- msgSMimeCompFields.clearSecureHeaders();
-
- // get preferences informations to sign
- var arrayHeaderToSign = ReadXmlHeadersToSign();
-
- // relaxed canon algorithm as default value
- msgSMimeCompFields.canonAlgorithme = 1;
-
- if(arrayHeaderToSign){
- var secHeader = null;
-
- for(i=0;i<arrayHeaderToSign.length;++i){
- if(arrayHeaderToSign[i]._name == "canonalgo"){
- // is canonalgo value
- msgSMimeCompFields.canonAlgorithme = parseInt(arrayHeaderToSign[i]._status);
- //gConsole.logStringMessage("[ _secure_headers - AddSecureHeadersArray] canonAlgorithme = " + msgSMimeCompFields.canonAlgorithme);
- }else{
- // create Header object
- secHeader = Components.classes["@mozilla.org/messenger-smime/smime-secure-header;1"].createInstance(Components.interfaces.nsIMsgSMIMESecureHeader);
- secHeader.headerName=arrayHeaderToSign[i]._name;
- if(arrayHeaderToSign[i]._status!="")
- secHeader.headerStatus=arrayHeaderToSign[i]._status;
- /*if(arrayHeaderToSign[i]._encrypted!="")
- secHeader.headerEncrypted=arrayHeaderToSign[i]._encrypted;*/
-
- // push Header object to array of msgCompFields object
- msgSMimeCompFields.addSecureHeader(secHeader);
- }
- }
- }
- }catch(e){
- gConsole.logStringMessage("[ _secure_headers - AddSecureHeadersArray] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- }
- }
-};
-
-/*
- *
- */
-var DEFAULT_SECUREHEADERS_XML_DIR = "secureHeaders"
-var DEFAULT_SECUREHEADERS_XML_FILE = "secureHeadersDefault.xml"
-function ReadXmlHeadersToSign(){
- try{
- //var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
-
- // get xml file path
- if(!gCurrentIdentity){
- gConsole.logStringMessage("[_secure_headers - ReadXmlHeadersToSign ] no xml files define \n ");
- return;
- }
- var pref_data = gCurrentIdentity.getCharAttribute(PREF_SECURE_HEADERS_FOLDER_DATAS);
- var file = null;
- if(!pref_data){
- file = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile); // get profile folder
- file.append(DEFAULT_SECUREHEADERS_XML_DIR);
- file.append(DEFAULT_SECUREHEADERS_XML_FILE);
- pref_data = file.path;
- }else{
- file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
- file.initWithPath( pref_data );
- }
-
- if(!file.exists()){
- gConsole.logStringMessage("[_secure_headers - ReadXmlHeadersToSign] Error loading schema file : " + completePath);
- return;
- }
-
- // Get Xml Document parser
- var stream = Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream);
- stream.init(file, -1, -1, Components.interfaces.nsIFileInputStream.CLOSE_ON_EOF);
- var parser = Components.classes["@mozilla.org/xmlextras/domparser;1"].createInstance(Components.interfaces.nsIDOMParser);
- var xmlDoc = parser.parseFromStream(stream, null, file.fileSize, "text/xml");
-
- // get datas from file
- var tabSecureHeaders = new Array; // tabHeaders[headerName][status][encrypted]
- var compatibleTag = xmlDoc.getElementsByTagName("ximf:headers");
- var sValue="";
-
- if(compatibleTag.length>0){
- // get canonical algorithm
- if(compatibleTag[0].hasAttribute("canonalgo")){
- var canonalgo = compatibleTag[0].getAttribute("canonalgo");
- tabSecureHeaders.push(new xSecureHeader("canonalgo", canonalgo));
- gConsole.logStringMessage("[ ReadXmlHeadersToSign ] get canonical algorithm : " + canonalgo);
- }
-
- // get headers to sign
- var childNodes = compatibleTag[0].childNodes;
- for(var j=0; j <childNodes.length; ++j ){
- var header_name = "";
- var header_status = 0;
-
- //var header_encrypted = -1;
- if(childNodes[j].localName == "header"){
- header_name = childNodes[j].getAttribute("name");
- if(childNodes[j].hasAttribute("status"))
- header_status = parseInt(childNodes[j].getAttribute("status"));
-
- /*if(childNodes[j].hasAttribute("encrypted"))
- header_encrypted = parseInt(childNodes[j].getAttribute("encrypted"));*/
-
- // load values to array
- tabSecureHeaders.push(new xSecureHeader(header_name, header_status));
- }
- }
- return tabSecureHeaders;
- }else{
- gConsole.logStringMessage("[_secure_headers - ReadXmlHeadersToSign] no headers tag in file " + completePath);
- }
- } catch (e) {
- gConsole.logStringMessage("[_secure_headers - ReadXmlHeadersToSign ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- }
-}
-
-/*
- *
- */
-function xSecureHeader(name,status){
- if(name)
- this._name = name;
- if(status)
- this._status = status;
- /*if(encrypted)
- this._encrypted = encrypted;*/
-}
-
-function setNoSecureHeaderUI()
-{
- document.getElementById("idItemSecureHeaders_2").removeAttribute("checked");
- document.getElementById("idItemSecureHeaders_1").removeAttribute("checked");
- //gCurrentIdentity.setBoolAttribute(SECURE_HEADERS_ATTRIBUTE_CHECK,false);
-}
-
-function setSecureHeaderUI()
-{
- document.getElementById("idItemSecureHeaders_1").setAttribute("checked","true");
- document.getElementById("idItemSecureHeaders_2").setAttribute("checked","true");
- //gCurrentIdentity.setBoolAttribute(SECURE_HEADERS_ATTRIBUTE_CHECK,true);
+/* ***** BEGIN LICENSE BLOCK *****\r
+Copyright (c) 2008-2009 EADS DEFENCE AND SECURITY - All rights reserved.\r
+secure header 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, 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 in the redistribution of the source code.\r
+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.\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 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.\r
+ \r
+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)\r
+ * ***** END LICENSE BLOCK ***** */\r
+\r
+\r
+var gConsole = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);\r
+\r
+const PREF_SECURE_HEADERS_FOLDER_DATAS="secureheaders.folderdata";\r
+const PREF_DEFAULT_SECUREHEADERS = "secureheaders.bydefault";\r
+const PROPERTIES_URL = "chrome://messenger/locale/secureheaders.properties";\r
+const SECURE_HEADERS_ATTRIBUTE_CHECK="secureheaders.checked";\r
+const HEADER_SEPARATOR=",";\r
+\r
+\r
+\r
+/*\r
+ * \r
+ */\r
+document.addEventListener('load', msgCompSMIMEOnLoad, true);\r
+function msgCompSMIMEOnLoad(){\r
+ /* Get profile directory */\r
+ var dirSecureHeader = Components.classes["@mozilla.org/file/directory_service;1"].createInstance(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile);\r
+ dirSecureHeader.append("secureHeaders");\r
+ \r
+ /* Copy a default profile if needed */\r
+ if (!dirSecureHeader.exists()) {\r
+ dirSecureHeader.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755);\r
+ var defaultFile = Components.classes["@mozilla.org/file/directory_service;1"].createInstance(Components.interfaces.nsIProperties).get("ProfDefNoLoc", Components.interfaces.nsIFile);\r
+ defaultFile.append("secureHeadersDefault.xml");\r
+ if (defaultFile.exists())\r
+ defaultFile.copyTo(dirSecureHeader, "secureHeadersDefault.xml");\r
+ }\r
+ \r
+ // observer on current document \r
+ //document.addEventListener('compose-window-reopen', onComposerOpen_SecureHeaders, true);\r
+ onComposerOpen_SecureHeaders();\r
+ \r
+ // observer on sending message\r
+ var secureheaders_ObserverSvc = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);\r
+ secureheaders_ObserverSvc.addObserver(secureheaders_OnSend, "mail:composeOnSend", false); \r
+ \r
+ // ihm events and update\r
+ var item1 = document.getElementById("idItemSecureHeaders_1");\r
+ item1.addEventListener('command', SetCheck_1, true);\r
+ var item2 = document.getElementById("idItemSecureHeaders_2");\r
+ item2.addEventListener('command', SetCheck_2, true);\r
+ \r
+ var item3 = document.getElementById("menu_securitySign1");\r
+ item3.addEventListener('command', SetCheckSecurity_1, true);\r
+ var item4 = document.getElementById("menu_securitySign2");\r
+ item4.addEventListener('command', SetCheckSecurity_2, true);\r
+ \r
+ document.addEventListener("compose-window-close", msgCompSMIMEOnUnLoad, true);\r
+}\r
+\r
+function msgCompSMIMEOnUnLoad(){\r
+ document.getElementById("idItemSecureHeaders_1").setAttribute("checked","false");\r
+ document.getElementById("idItemSecureHeaders_2").setAttribute("checked","false");\r
+ UpdateSecureRequest();\r
+}\r
+\r
+/*\r
+ * Init ihm sign headers\r
+ */\r
+function onComposerOpen_SecureHeaders(){\r
+ try{\r
+ // get international label for new line\r
+ var gBundle = Components.classes["@mozilla.org/intl/stringbundle;1"].getService(Components.interfaces.nsIStringBundleService);\r
+ var stringBundle = gBundle.createBundle(PROPERTIES_URL);\r
+ var sLabel = stringBundle.GetStringFromName("menu.secureheaders.label");\r
+ \r
+ var elt_menu_to_sign = document.getElementById("idItemSecureHeaders_1");\r
+ // if null, create it\r
+ if(elt_menu_to_sign == null){\r
+ // insert item SecureHeaders in menu composer\r
+ var itemSecureHeaders = document.createElement("menuitem");\r
+ itemSecureHeaders.setAttribute("label",sLabel);\r
+ itemSecureHeaders.setAttribute("id","idItemSecureHeaders_1");\r
+ itemSecureHeaders.setAttribute("type","checkbox");\r
+ itemSecureHeaders.setAttribute("checked","false");\r
+ var itemSecurity = document.getElementById("menu_securitySign1"); \r
+ itemSecurity.parentNode.appendChild(itemSecureHeaders);\r
+ \r
+ // insert item Securitylabel in toolbar composer\r
+ var itemSecureHeaders2 = document.createElement("menuitem");\r
+ itemSecureHeaders2.setAttribute("label",sLabel);\r
+ itemSecureHeaders2.setAttribute("id","idItemSecureHeaders_2");\r
+ itemSecureHeaders2.setAttribute("type","checkbox");\r
+ itemSecureHeaders2.setAttribute("checked","false");\r
+ itemSecurity = document.getElementById("menu_securitySign2"); \r
+ itemSecurity.parentNode.appendChild(itemSecureHeaders2);\r
+ }else{\r
+ UpdateSecureRequest();\r
+ }\r
+\r
+ //Loaded SecureHeader Preference\r
+ /*if(gCurrentIdentity){\r
+ gCurrentIdentity.setBoolAttribute(SECURE_HEADERS_ATTRIBUTE_CHECK, false);\r
+ }*/\r
+ }catch(e){\r
+ gConsole.logStringMessage("[_secure_headers - onComposerOpen_SecureHeaders ] \n " + e + "\nfile : " + e.fileName+"\nline : "+ e.lineNumber); \r
+ }\r
+}\r
+\r
+/*\r
+ * \r
+ */\r
+function SetCheck_1(){\r
+ var checked_1="false";\r
+ var checked_2="false";\r
+ if(document.getElementById("idItemSecureHeaders_2").hasAttribute("checked")){\r
+ checked_2=document.getElementById("idItemSecureHeaders_2").getAttribute("checked");\r
+ }\r
+ if(document.getElementById("idItemSecureHeaders_1").hasAttribute("checked")){\r
+ checked_1=document.getElementById("idItemSecureHeaders_1").getAttribute("checked");\r
+ }\r
+ \r
+ if(checked_2 != checked_1){\r
+ document.getElementById("idItemSecureHeaders_2").setAttribute("checked",checked_1);\r
+ UpdateSecureRequest();\r
+ }\r
+}\r
+\r
+function SetCheck_2(){\r
+ var checked_1="false";\r
+ var checked_2="false";\r
+ if(document.getElementById("idItemSecureHeaders_2").hasAttribute("checked")){\r
+ checked_2=document.getElementById("idItemSecureHeaders_2").getAttribute("checked");\r
+ }\r
+ if(document.getElementById("idItemSecureHeaders_1").hasAttribute("checked")){\r
+ checked_1=document.getElementById("idItemSecureHeaders_1").getAttribute("checked");\r
+ }\r
+ \r
+ if(checked_2 != checked_1){\r
+ document.getElementById("idItemSecureHeaders_1").setAttribute("checked",checked_2);\r
+ UpdateSecureRequest();\r
+ }\r
+}\r
+\r
+/*\r
+ * \r
+ */\r
+function SetCheckSecurity_1(){\r
+ var checked_1="false";\r
+ var checked_2="false";\r
+ if(document.getElementById("menu_securitySign1").hasAttribute("checked")){\r
+ checked_2=document.getElementById("menu_securitySign1").getAttribute("checked");\r
+ }\r
+ \r
+ if(checked_2 == checked_1){\r
+ document.getElementById("idItemSecureHeaders_1").setAttribute("checked",checked_1);\r
+ document.getElementById("idItemSecureHeaders_2").setAttribute("checked",checked_1);\r
+ UpdateSecureRequest();\r
+ }\r
+}\r
+\r
+/*\r
+ * \r
+ */\r
+function SetCheckSecurity_2(){\r
+ var checked_1="false";\r
+ var checked_2="false";\r
+ if(document.getElementById("menu_securitySign2").hasAttribute("checked")){\r
+ checked_2=document.getElementById("menu_securitySign2").getAttribute("checked");\r
+ }\r
+ \r
+ if(checked_2 == checked_1){\r
+ document.getElementById("idItemSecureHeaders_1").setAttribute("checked",checked_1);\r
+ document.getElementById("idItemSecureHeaders_2").setAttribute("checked",checked_1);\r
+ UpdateSecureRequest();\r
+ }\r
+}\r
+\r
+function UpdateSecureRequest(){\r
+\r
+ var checked="false";\r
+ if(document.getElementById("idItemSecureHeaders_1").hasAttribute("checked")){\r
+ checked=document.getElementById("idItemSecureHeaders_1").getAttribute("checked");\r
+ }\r
+ if(checked=="true"){\r
+ document.getElementById("menu_securitySign1").setAttribute("checked","true");\r
+ document.getElementById("menu_securitySign2").setAttribute("checked","true"); \r
+ if(gSMFields && !gSMFields.signMessage)\r
+ {\r
+ setNextCommand('signMessage');\r
+ }\r
+ //gCurrentIdentity.setBoolAttribute(SECURE_HEADERS_ATTRIBUTE_CHECK,true);\r
+ }\r
+ else{\r
+ document.getElementById("menu_securitySign1").setAttribute("checked","false");\r
+ document.getElementById("menu_securitySign2").setAttribute("checked","false");\r
+ //gCurrentIdentity.setBoolAttribute(SECURE_HEADERS_ATTRIBUTE_CHECK,false);\r
+ }\r
+}\r
+\r
+/*\r
+ * \r
+ */\r
+var secureheaders_OnSend = {\r
+ _ArrayheadersToSign : null,\r
+ observe: function(subject, topic, data) {\r
+ //is HeaderSecure requested\r
+ var elt = document.getElementById("idItemSecureHeaders_1");\r
+ if(elt.hasAttribute("checked")){\r
+ this.AddSecureHeadersArray();\r
+ }\r
+ },\r
+ AddSecureHeadersArray: function(){\r
+ try {\r
+ if (!gMsgCompose.compFields) return;\r
+ if (!gMsgCompose.compFields.securityInfo) return;\r
+ \r
+ var msgSMimeCompFields = gMsgCompose.compFields.securityInfo;\r
+ if(!msgSMimeCompFields){\r
+ gConsole.logStringMessage("[ _secure_headers - AddSecureHeadersArray] : gMsgCompose.compFields.securityInfo not found");\r
+ return;\r
+ }\r
+ //clear secure headers\r
+ msgSMimeCompFields.clearSecureHeaders();\r
+\r
+ // get preferences informations to sign\r
+ var arrayHeaderToSign = ReadXmlHeadersToSign();\r
+ \r
+ // relaxed canon algorithm as default value \r
+ msgSMimeCompFields.canonAlgorithme = 1;\r
+ \r
+ if(arrayHeaderToSign){\r
+ var secHeader = null;\r
+ \r
+ for(i=0;i<arrayHeaderToSign.length;++i){ \r
+ if(arrayHeaderToSign[i]._name == "canonalgo"){\r
+ // is canonalgo value\r
+ msgSMimeCompFields.canonAlgorithme = parseInt(arrayHeaderToSign[i]._status,10);\r
+ //gConsole.logStringMessage("[ _secure_headers - AddSecureHeadersArray] canonAlgorithme = " + msgSMimeCompFields.canonAlgorithme);\r
+ }else{ \r
+ // create Header object\r
+ secHeader = Components.classes["@mozilla.org/messenger-smime/smime-secure-header;1"].createInstance(Components.interfaces.nsIMsgSMIMESecureHeader);\r
+ secHeader.headerName=arrayHeaderToSign[i]._name;\r
+ if(arrayHeaderToSign[i]._status!="")\r
+ secHeader.headerStatus=arrayHeaderToSign[i]._status;\r
+ /*if(arrayHeaderToSign[i]._encrypted!="")\r
+ secHeader.headerEncrypted=arrayHeaderToSign[i]._encrypted;*/\r
+ \r
+ // push Header object to array of msgCompFields object\r
+ msgSMimeCompFields.addSecureHeader(secHeader);\r
+ }\r
+ }\r
+ }\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ _secure_headers - AddSecureHeadersArray] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);\r
+ }\r
+ } \r
+};\r
+\r
+/*\r
+ *\r
+ */\r
+var DEFAULT_SECUREHEADERS_XML_DIR = "secureHeaders"\r
+var DEFAULT_SECUREHEADERS_XML_FILE = "secureHeadersDefault.xml"\r
+function ReadXmlHeadersToSign(){\r
+ try{\r
+ //var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);\r
+ \r
+ // get xml file path\r
+ if(!gCurrentIdentity){ \r
+ gConsole.logStringMessage("[_secure_headers - ReadXmlHeadersToSign ] no xml files define \n ");\r
+ return;\r
+ }\r
+ var pref_data = gCurrentIdentity.getCharAttribute(PREF_SECURE_HEADERS_FOLDER_DATAS);\r
+ var file = null;\r
+ if(!pref_data){ \r
+ file = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile); // get profile folder\r
+ file.append(DEFAULT_SECUREHEADERS_XML_DIR);\r
+ file.append(DEFAULT_SECUREHEADERS_XML_FILE);\r
+ pref_data = file.path;\r
+ }else{\r
+ file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);\r
+ file.initWithPath( pref_data );\r
+ }\r
+ \r
+ if(!file.exists()){\r
+ gConsole.logStringMessage("[_secure_headers - ReadXmlHeadersToSign] Error loading schema file : " + completePath);\r
+ return;\r
+ }\r
+ \r
+ // Get Xml Document parser\r
+ var stream = Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream);\r
+ stream.init(file, -1, -1, Components.interfaces.nsIFileInputStream.CLOSE_ON_EOF);\r
+ var parser = Components.classes["@mozilla.org/xmlextras/domparser;1"].createInstance(Components.interfaces.nsIDOMParser);\r
+ var xmlDoc = parser.parseFromStream(stream, null, file.fileSize, "text/xml");\r
+ \r
+ // get datas from file\r
+ var tabSecureHeaders = new Array; // tabHeaders[headerName][status][encrypted]\r
+ var compatibleTag = xmlDoc.getElementsByTagName("ximf:headers");\r
+ var sValue="";\r
+ \r
+ if(compatibleTag.length>0){\r
+ // get canonical algorithm\r
+ if(compatibleTag[0].hasAttribute("canonalgo")){\r
+ var canonalgo = compatibleTag[0].getAttribute("canonalgo"); \r
+ tabSecureHeaders.push(new xSecureHeader("canonalgo", canonalgo));\r
+ //gConsole.logStringMessage("[ ReadXmlHeadersToSign ] get canonical algorithm : " + canonalgo);\r
+ }\r
+ \r
+ // get headers to sign\r
+ var childNodes = compatibleTag[0].childNodes;\r
+ for(var j=0; j <childNodes.length; ++j ){\r
+ var header_name = ""; \r
+ var header_status = 0; \r
+ \r
+ //var header_encrypted = -1;\r
+ if(childNodes[j].localName == "header"){\r
+ header_name = childNodes[j].getAttribute("name");\r
+ if(childNodes[j].hasAttribute("status"))\r
+ header_status = parseInt(childNodes[j].getAttribute("status"),10);\r
+ \r
+ /*if(childNodes[j].hasAttribute("encrypted"))\r
+ header_encrypted = parseInt(childNodes[j].getAttribute("encrypted"),10);*/\r
+ \r
+ // load values to array\r
+ tabSecureHeaders.push(new xSecureHeader(header_name, header_status));\r
+ }\r
+ }\r
+ return tabSecureHeaders;\r
+ }else{\r
+ gConsole.logStringMessage("[_secure_headers - ReadXmlHeadersToSign] no headers tag in file " + completePath);\r
+ }\r
+ } catch (e) {\r
+ gConsole.logStringMessage("[_secure_headers - ReadXmlHeadersToSign ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);\r
+ }\r
+}\r
+\r
+/*\r
+ * \r
+ */\r
+function xSecureHeader(name,status){\r
+ if(name)\r
+ this._name = name;\r
+ if(status)\r
+ this._status = status;\r
+ /*if(encrypted)\r
+ this._encrypted = encrypted;*/\r
+}\r
+\r
+function setNoSecureHeaderUI()\r
+{\r
+ document.getElementById("idItemSecureHeaders_2").removeAttribute("checked");\r
+ document.getElementById("idItemSecureHeaders_1").removeAttribute("checked");\r
+ //gCurrentIdentity.setBoolAttribute(SECURE_HEADERS_ATTRIBUTE_CHECK,false);\r
+}\r
+\r
+function setSecureHeaderUI()\r
+{\r
+ document.getElementById("idItemSecureHeaders_1").setAttribute("checked","true");\r
+ document.getElementById("idItemSecureHeaders_2").setAttribute("checked","true");\r
+ //gCurrentIdentity.setBoolAttribute(SECURE_HEADERS_ATTRIBUTE_CHECK,true);\r
}
\ No newline at end of file
-<!--
- * ***** BEGIN LICENSE BLOCK *****
-Copyright (c) 2008-2009 EADS DEFENCE AND SECURITY - All rights reserved.
-secure header 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 ***** */
--->
-
-<overlay id="id.msgCompSMIME.SecureHeaders"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- xmlns:html="http://www.w3.org/1999/xhtml">
-
- <script type="application/javascript" src="chrome://messenger-smime/content/msgCompSMIMESecureHeaders.js"/>
-
+<!--\r
+ * ***** BEGIN LICENSE BLOCK *****\r
+Copyright (c) 2008-2009 EADS DEFENCE AND SECURITY - All rights reserved.\r
+secure header 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, 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 in the redistribution of the source code.\r
+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.\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 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.\r
+ \r
+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)\r
+ * ***** END LICENSE BLOCK ***** */\r
+-->\r
+\r
+<overlay id="id.msgCompSMIME.SecureHeaders"\r
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"\r
+ xmlns:html="http://www.w3.org/1999/xhtml"> \r
+ \r
+ <script type="application/javascript" src="chrome://messenger-smime/content/msgCompSMIMESecureHeaders.js"/>\r
+ \r
</overlay>
\ No newline at end of file
-/* ***** BEGIN LICENSE BLOCK *****
-Copyright (c) 2008-2009 EADS DEFENCE AND SECURITY - All rights reserved.
-secure header 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 ***** */
-
-var gSecureHeaders="";
-
-const SECURE_HEADER_SEPARATOR = "###HEADER_SEPARATOR###";
-const HEADER_VAL_SEPARATOR = "###HEADER_VAL###";
-
-function onLoad()
-{
- var gSecureHeadersBundle = document.getElementById("bundle_secure_headers_view");
-
- gSecureHeaders = window.arguments[0];
-
- if(gSecureHeaders!=""){
- var treechild = document.getElementById("secHeader_treechild_id");
- var each_header_tab=gSecureHeaders.split(SECURE_HEADER_SEPARATOR);
- for(var i=0;i<each_header_tab.length;++i)
- {
- var each_value_tab=each_header_tab[i].split(HEADER_VAL_SEPARATOR);
- var label;
- if(each_value_tab.length>=3){
- //read the current header property
- var headerName = each_value_tab[0];
- var headerValue = each_value_tab[1];
- var headerStatus = each_value_tab[2];
- var headerSecStatus = each_value_tab[3];
- //var headerEncrypted = parseInt(each_value_tab[4]);
- var headerMime = each_value_tab[4];
- var headerCanoniz = each_value_tab[5];
-
- //create each element for the tree
- var treeitem=document.createElement("treeitem");
- var treerow=document.createElement("treerow");
- var namecell=document.createElement("treecell");
- var valuecell=document.createElement("treecell");
- var statuscell=document.createElement("treecell");
- var canonizcell=document.createElement("treecell");
- var valueMimecell=document.createElement("treecell");
- //var encryptedcell=document.createElement("treecell");
-
- //set the header name, value and status
- namecell.setAttribute("label",headerName);
- valuecell.setAttribute("label",headerValue); // signed value
- namecell.setAttribute("properties",headerSecStatus);
- valueMimecell.setAttribute("label",headerMime); // displayed value in message
-
- //set the header status
- switch(headerStatus)
- {
- case "-1":
- label=gSecureHeadersBundle.getString("notdefine.label");
- break;
- case "0" :
- label=gSecureHeadersBundle.getString("headerstatus.duplicated.label");
- break;
- case "1" :
- label=gSecureHeadersBundle.getString("headerstatus.deleted.label");
- break;
- case "2":
- label=gSecureHeadersBundle.getString("headerstatus.modified.label");
- break;
- default:
- label="ERROR";
- break;
- }
- statuscell.setAttribute("label",label);
-
- //set the canonization algo used
- var sAlgo = "";
- switch(parseInt(headerCanoniz,10)){
- case 0:
- sAlgo = gSecureHeadersBundle.getString("headercanoniz.simple.label");
- break
- case 1:
- sAlgo = gSecureHeadersBundle.getString("headercanoniz.relaxed.label");
- break;
- }
- canonizcell.setAttribute("label",sAlgo);
-
- //set the header encrypted
- /*switch(headerEncrypted)
- {
- case -1:
- label=gSecureHeadersBundle.getString("notdefine.label");
- break;
- case 0 :
- label=gSecureHeadersBundle.getString("no.label");
- break;
- case 1 :
- label=gSecureHeadersBundle.getString("yes.label");
- break;
- default:
- label="ERROR";
- break;
- }
- encryptedcell.setAttribute("label",label);*/
-
- //append all elements in the tree
- treerow.appendChild(namecell);
- treerow.appendChild(valuecell);
- treerow.appendChild(statuscell);
- treerow.appendChild(canonizcell);
- treerow.appendChild(valueMimecell);
- //treerow.appendChild(encryptedcell);
- treeitem.appendChild(treerow);
- treechild.appendChild(treeitem);
- }
- }
- }
-}
-
-/*
- * Load complete informations of selected header in texteboxes box
- */
-function DisplayDetailHeader(){
- var gConsole = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
- try{
- var tree = document.getElementById("secureheaderstree.id");
- var v = tree.currentIndex;
- document.getElementById("headerName_val").value = tree.view.getCellText(v, tree.columns.getColumnAt(0));
- document.getElementById("headerValue_val").value = tree.view.getCellText(v, tree.columns.getColumnAt(1));
- document.getElementById("headerStatus_val").value = tree.view.getCellText(v, tree.columns.getColumnAt(2));
- document.getElementById("headerCanonization_val").value = tree.view.getCellText(v, tree.columns.getColumnAt(3));
- document.getElementById("headerMimeValue_val").value = tree.view.getCellText(v, tree.columns.getColumnAt(4));
- }catch(e){
- gConsole.logStringMessage("DisplayDetailHeader -error : " + e + " - line " + e.lineNumber);
- }
-}
+/* ***** BEGIN LICENSE BLOCK *****\r
+Copyright (c) 2008-2009 EADS DEFENCE AND SECURITY - All rights reserved.\r
+secure header 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, 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 in the redistribution of the source code.\r
+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.\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 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.\r
+ \r
+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)\r
+ * ***** END LICENSE BLOCK ***** */\r
+\r
+const SECURE_HEADER_SEPARATOR = "###HEADER_SEPARATOR###";\r
+const HEADER_VAL_SEPARATOR = "###HEADER_VAL###";\r
+\r
+/*\r
+gSecureHeadersArray[o.hdrName]={\r
+ o.hdrName = sHeader.headerName; // signed header\r
+ o.hdrSecureValue = sHeader.headerValue; // Value in the signature\r
+ o.hdrMimeValue = ""; // value in the MIME message\r
+ o.hdrSignedStatus = sHeader.headerStatus;\r
+ o.hdrCanonAlgo = aCanonAlgo;\r
+ o.hdrEncryptStatus = "";\r
+ o.hdrSignedRes = "valid";}\r
+*/\r
+function onLoad()\r
+{\r
+ var gSecureHeadersBundle = document.getElementById("bundle_secure_headers_view");\r
+\r
+ var secureHeadersString = window.arguments[0]; \r
+ \r
+ if(secureHeadersString=="")return;\r
+ // split secureHeadersString to cSecureHeadersArray\r
+ var cSecureHeadersArray = {}; \r
+ var each_header_tab=secureHeadersString.split(SECURE_HEADER_SEPARATOR);\r
+ for(var i=0;i<each_header_tab.length;++i){\r
+ var each_value_header_tab=each_header_tab[i].split(HEADER_VAL_SEPARATOR);\r
+ var oEntry = new Object;\r
+ var headerNameEntry = ""; \r
+ for(var idxElt=0;idxElt<each_value_header_tab.length;++idxElt){ \r
+ switch(idxElt){\r
+ case 0:\r
+ headerNameEntry = each_value_header_tab[idxElt];\r
+ oEntry.hdrName = each_value_header_tab[idxElt];\r
+ break;\r
+ case 1:\r
+ oEntry.hdrSecureValue = each_value_header_tab[idxElt];\r
+ break;\r
+ case 2:\r
+ oEntry.hdrMimeValue = each_value_header_tab[idxElt];\r
+ break;\r
+ case 3:\r
+ oEntry.hdrSignedStatus = each_value_header_tab[idxElt];\r
+ break;\r
+ case 4:\r
+ oEntry.hdrCanonAlgo = each_value_header_tab[idxElt];\r
+ break;\r
+ case 5:\r
+ oEntry.hdrSignedRes = each_value_header_tab[idxElt];\r
+ break; \r
+ }\r
+ }\r
+ oEntry.hdrEncryptStatus = "";\r
+ if(headerNameEntry!="") cSecureHeadersArray[headerNameEntry] = oEntry;\r
+ }\r
+ \r
+ // create tree viewer\r
+ var treechild = document.getElementById("secHeader_treechild_id"); \r
+ for (headerName in cSecureHeadersArray) {\r
+ var label=""; \r
+ //create each element for the tree\r
+ var treeitem=document.createElement("treeitem");\r
+ var treerow=document.createElement("treerow");\r
+ var namecell=document.createElement("treecell");\r
+ var valuecell=document.createElement("treecell");\r
+ var statuscell=document.createElement("treecell"); \r
+ var canonizcell=document.createElement("treecell"); \r
+ var valueMimecell=document.createElement("treecell");\r
+ //var encryptedcell=document.createElement("treecell");\r
+ \r
+ //set the header name, value and status\r
+ namecell.setAttribute("label",cSecureHeadersArray[headerName].hdrName);\r
+ valuecell.setAttribute("label",cSecureHeadersArray[headerName].hdrSecureValue); // signed value\r
+ namecell.setAttribute("properties",cSecureHeadersArray[headerName].hdrSignedRes); \r
+ valueMimecell.setAttribute("label",cSecureHeadersArray[headerName].hdrMimeValue); // displayed value in message\r
+ \r
+ //set the header status\r
+ switch(cSecureHeadersArray[headerName].hdrSignedStatus){\r
+ case "-1":\r
+ label=gSecureHeadersBundle.getString("notdefine.label");\r
+ break;\r
+ case "0" :\r
+ label=gSecureHeadersBundle.getString("headerstatus.duplicated.label");\r
+ break;\r
+ case "1" :\r
+ label=gSecureHeadersBundle.getString("headerstatus.deleted.label");\r
+ break;\r
+ case "2":\r
+ label=gSecureHeadersBundle.getString("headerstatus.modified.label");\r
+ break;\r
+ default:\r
+ label="ERROR";\r
+ break;\r
+ }\r
+ statuscell.setAttribute("label",label);\r
+ \r
+ //set the canonization algo used\r
+ var sAlgo = "";\r
+ switch(parseInt(cSecureHeadersArray[headerName].hdrCanonAlgo,10)){\r
+ case 0:\r
+ sAlgo = gSecureHeadersBundle.getString("headercanoniz.simple.label");\r
+ break;\r
+ case 1:\r
+ sAlgo = gSecureHeadersBundle.getString("headercanoniz.relaxed.label");\r
+ break; \r
+ }\r
+ canonizcell.setAttribute("label",sAlgo);\r
+ \r
+ //set the header encrypted\r
+ /*switch(gSecureHeadersArray[headerName].hdrEncryptStatus){\r
+ case -1:\r
+ label=gSecureHeadersBundle.getString("notdefine.label");\r
+ break;\r
+ case 0 :\r
+ label=gSecureHeadersBundle.getString("no.label");\r
+ break;\r
+ case 1 :\r
+ label=gSecureHeadersBundle.getString("yes.label");\r
+ break;\r
+ default:\r
+ label="ERROR";\r
+ break;\r
+ }\r
+ encryptedcell.setAttribute("label",label);*/\r
+\r
+ //append all elements in the tree\r
+ treerow.appendChild(namecell);\r
+ treerow.appendChild(valuecell);\r
+ treerow.appendChild(statuscell); \r
+ treerow.appendChild(canonizcell); \r
+ treerow.appendChild(valueMimecell); \r
+ //treerow.appendChild(encryptedcell);\r
+ treeitem.appendChild(treerow);\r
+ treechild.appendChild(treeitem);\r
+ }\r
+}\r
+\r
+/*\r
+ * Load complete informations of selected header in texteboxes box\r
+ */\r
+function DisplayDetailHeader(){\r
+ var gConsole = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);\r
+ try{\r
+ var tree = document.getElementById("secureheaderstree.id"); \r
+ var v = tree.currentIndex;\r
+ document.getElementById("headerName_val").value = tree.view.getCellText(v, tree.columns.getColumnAt(0)); \r
+ document.getElementById("headerValue_val").value = tree.view.getCellText(v, tree.columns.getColumnAt(1));\r
+ document.getElementById("headerStatus_val").value = tree.view.getCellText(v, tree.columns.getColumnAt(2));\r
+ document.getElementById("headerCanonization_val").value = tree.view.getCellText(v, tree.columns.getColumnAt(3));\r
+ document.getElementById("headerMimeValue_val").value = tree.view.getCellText(v, tree.columns.getColumnAt(4));\r
+ }catch(e){\r
+ gConsole.logStringMessage("DisplayDetailHeader -error : " + e + " - line " + e.lineNumber);\r
+ }\r
+}\r
-<!--
-/* ***** BEGIN LICENSE BLOCK *****
-Copyright (c) 2008-2009 EADS DEFENCE AND SECURITY - All rights reserved.
-secure header 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 ***** */
--->
-
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
-<?xml-stylesheet href="chrome://messenger/skin/smime/msgReadSecureHeaders.css" type="text/css"?>
-
-<!DOCTYPE dialog SYSTEM "chrome://messenger/locale/secureheaders.dtd">
-
-<dialog id="msgReadSecureHeadersViewId" title="&secureHeadersList.label;"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- style="width:50em;"
- buttons="accept"
- persist="width height"
- onload="onLoad();">
-
- <script type="application/javascript" src="chrome://messenger-smime/content/msgReadSecureHeadersView.js"/>
-
- <stringbundle id="bundle_secure_headers_view" src="chrome://messenger/locale/secureheaders.properties"/>
- <vbox flex="1">
- <hbox flex="1" style="width:30px; height:250px;">
- <tree id="secureheaderstree.id" flex="1" seltype="single" onselect="DisplayDetailHeader();" >
- <treecols>
- <treecol id="headerName" label="&headername.label;" flex="1" persist="width ordinal hidden" ordinal="1"/>
- <splitter class="tree-splitter"/>
- <treecol id="headerValue" label="&headervalue.label;" flex="2" persist="width ordinal hidden" ordinal="2"/>
- <treecol id="headerStatus" label="&headerstatus.label;" ordinal="3" hidden="true" ignoreincolumnpicker="true"/>
- <treecol id="headerCanonization" label="&headercanonisation.label;" ordinal="4" hidden="true" ignoreincolumnpicker="true"/>
- <treecol id="headerMimeValue" label="&headermimevalue.label;" ordinal="5" hidden="true" ignoreincolumnpicker="true"/>
- </treecols>
- <treechildren id="secHeader_treechild_id">
- </treechildren>
- </tree>
- </hbox>
- <spacer flex="1"/>
- <hbox flex="1" style="border:thin groove inherit;">
- <grid flex="1">
- <columns >
- <column align="center"/>
- <column flex="1" align="center"/>
- </columns>
- <rows>
- <row>
- <label id="headerName_desc" value="&headername.label;"/>
- <textbox id="headerName_val" readonly="true" flex="1"/>
- </row>
- <row>
- <label id="headerValue_desc" value="&headervalue.label;"/>
- <textbox id="headerValue_val" readonly="true" flex="1"/>
- </row>
- <row>
- <label id="headerMimeValue_desc" value="&headermimevalue.label;"/>
- <textbox id="headerMimeValue_val" readonly="true" flex="1"/>
- </row>
- <row>
- <label id="headerStatus_desc" value="&headerstatus.label;"/>
- <textbox id="headerStatus_val" readonly="true" flex="1"/>
- </row>
- <row>
- <label id="headerCanonization_desc" value="&headercanonisation.label;"/>
- <textbox id="headerCanonization_val" readonly="true" flex="1"/>
- </row>
- </rows>
- </grid>
- </hbox>
- </vbox>
+<!--\r
+/* ***** BEGIN LICENSE BLOCK *****\r
+Copyright (c) 2008-2009 EADS DEFENCE AND SECURITY - All rights reserved.\r
+secure header 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, 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 in the redistribution of the source code.\r
+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.\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 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.\r
+ \r
+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)\r
+ * ***** END LICENSE BLOCK ***** */\r
+-->\r
+\r
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>\r
+<?xml-stylesheet href="chrome://messenger/skin/smime/msgReadSecureHeaders.css" type="text/css"?> \r
+\r
+<!DOCTYPE dialog SYSTEM "chrome://messenger/locale/secureheaders.dtd">\r
+\r
+<dialog id="msgReadSecureHeadersViewId" title="&secureHeadersList.label;"\r
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" \r
+ style="width:50em;"\r
+ buttons="accept"\r
+ persist="width height"\r
+ onload="onLoad();">\r
+\r
+ <script type="application/javascript" src="chrome://messenger-smime/content/msgReadSecureHeadersView.js"/>\r
+\r
+ <stringbundle id="bundle_secure_headers_view" src="chrome://messenger/locale/secureheaders.properties"/> \r
+ <vbox flex="1"> \r
+ <hbox flex="1" style="width:30px; height:250px;">\r
+ <tree id="secureheaderstree.id" flex="1" seltype="single" onselect="DisplayDetailHeader();" >\r
+ <treecols>\r
+ <treecol id="headerName" label="&headername.label;" flex="1" persist="width ordinal hidden" ordinal="1"/>\r
+ <splitter class="tree-splitter"/>\r
+ <treecol id="headerValue" label="&headervalue.label;" flex="2" persist="width ordinal hidden" ordinal="2"/>\r
+ <treecol id="headerStatus" label="&headerstatus.label;" ordinal="3" hidden="true" ignoreincolumnpicker="true"/>\r
+ <treecol id="headerCanonization" label="&headercanonisation.label;" ordinal="4" hidden="true" ignoreincolumnpicker="true"/>\r
+ <treecol id="headerMimeValue" label="&headermimevalue.label;" ordinal="5" hidden="true" ignoreincolumnpicker="true"/>\r
+ </treecols> \r
+ <treechildren id="secHeader_treechild_id"> \r
+ </treechildren>\r
+ </tree>\r
+ </hbox>\r
+ <spacer flex="1"/>\r
+ <hbox flex="1" style="border:thin groove inherit;">\r
+ <grid flex="1">\r
+ <columns >\r
+ <column align="center"/> \r
+ <column flex="1" align="center"/>\r
+ </columns>\r
+ <rows>\r
+ <row>\r
+ <label id="headerName_desc" value="&headername.label;"/> \r
+ <textbox id="headerName_val" readonly="true" flex="1"/>\r
+ </row>\r
+ <row>\r
+ <label id="headerValue_desc" value="&headervalue.label;"/>\r
+ <textbox id="headerValue_val" readonly="true" flex="1"/>\r
+ </row>\r
+ <row>\r
+ <label id="headerMimeValue_desc" value="&headermimevalue.label;"/>\r
+ <textbox id="headerMimeValue_val" readonly="true" flex="1"/>\r
+ </row> \r
+ <row>\r
+ <label id="headerStatus_desc" value="&headerstatus.label;"/>\r
+ <textbox id="headerStatus_val" readonly="true" flex="1"/>\r
+ </row>\r
+ <row>\r
+ <label id="headerCanonization_desc" value="&headercanonisation.label;"/>\r
+ <textbox id="headerCanonization_val" readonly="true" flex="1"/>\r
+ </row>\r
+ </rows>\r
+ </grid>\r
+ </hbox>\r
+ </vbox>\r
</dialog>
\ No newline at end of file
-/* ***** BEGIN LICENSE BLOCK *****
-Copyright (c) 2008-2009 EADS DEFENCE AND SECURITY - All rights reserved.
-secure header 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 ***** */
-
-/* ===== msgReadSecureHeaders.css ========================================
- == Styles for the secure headers info window when displaying received mail.
- ======================================================================= */
-
-@import url("chrome://messenger/skin/");
-
-@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
-
-treechildren::-moz-tree-row(selected){
- background-color: DarkGray;
-}
-
-treechildren::-moz-tree-row(odd){
- background-color: #EEEEEE;
-}
-
-treechildren::-moz-tree-row(odd, selected){
- background-color: DarkGray;
-}
-
-treechildren::-moz-tree-cell-text(valid){
- color: green;
-}
-treechildren::-moz-tree-cell-text(invalid){
- color: #b10000;
- font-weight: bold;
-}
-
-treechildren::-moz-tree-image(valid){
- list-style-image: url("chrome://messenger/skin/smime/icons/check_sign.png");
-}
-
-treechildren::-moz-tree-image(invalid){
- list-style-image: url("chrome://messenger/skin/smime/icons/cross_sign.png");
-}
+/* ***** BEGIN LICENSE BLOCK *****\r
+Copyright (c) 2008-2009 EADS DEFENCE AND SECURITY - All rights reserved.\r
+secure header 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, 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 in the redistribution of the source code.\r
+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.\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 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.\r
+ \r
+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)\r
+ * ***** END LICENSE BLOCK ***** */\r
+\r
+/* ===== msgReadSecureHeaders.css ========================================\r
+ == Styles for the secure headers info window when displaying received mail.\r
+ ======================================================================= */\r
+\r
+@import url("chrome://messenger/skin/");\r
+\r
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");\r
+\r
+treechildren::-moz-tree-row(selected){ \r
+ background-color: DarkGray;\r
+}\r
+\r
+treechildren::-moz-tree-row(odd){ \r
+ background-color: #EEEEEE;\r
+}\r
+\r
+treechildren::-moz-tree-row(odd, selected){ \r
+ background-color: DarkGray;\r
+}\r
+\r
+treechildren::-moz-tree-cell-text(valid){ \r
+ color: green;\r
+}\r
+treechildren::-moz-tree-cell-text(invalid){ \r
+ color: #b10000;\r
+ font-weight: bold;\r
+}\r
+\r
+treechildren::-moz-tree-image(valid){\r
+ list-style-image: url("chrome://messenger/skin/smime/icons/check_sign.png");\r
+}\r
+\r
+treechildren::-moz-tree-image(invalid){\r
+ list-style-image: url("chrome://messenger/skin/smime/icons/cross_sign.png");\r
+}\r
-/* ***** BEGIN LICENSE BLOCK *****
- * Copyright (c) 2008-2009 EADS DEFENCE AND SECURITY - All rights reserved.
- * secure headers 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 ***** */
-
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-function SecureHeadersService() {};
-
-SecureHeadersService.prototype = {
- name: "secureheaders",
- chromePackageName: "messenger",
- showPanel: function(server) {
- // don't show the panel for news, rss, or local accounts
- return (server.type != "nntp" && server.type != "rss" &&
- server.type != "none");
- },
-
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIMsgAccountManagerExtension]),
- classDescription: "secure Headers Account Manager Extension Service",
- classID: Components.ID("{470139E3-7ADD-43e4-954F-CA997B68657C}"),
- contractID: "@mozilla.org/accountmanager/extension;1?name=secureheaders",
-
- _xpcom_categories: [{category: "mailnews-accountmanager-extensions",
- entry: "secureheaders account manager extension"}]
-};
-
-function NSGetModule(compMgr, fileSpec) {
- return XPCOMUtils.generateModule([SecureHeadersService]);
-}
+/* ***** BEGIN LICENSE BLOCK *****\r
+ * Copyright (c) 2008-2009 EADS DEFENCE AND SECURITY - All rights reserved.\r
+ * secure headers 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
+Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");\r
+function SecureHeadersService() {};\r
+\r
+SecureHeadersService.prototype = {\r
+ name: "secureheaders",\r
+ chromePackageName: "messenger",\r
+ showPanel: function(server) {\r
+ // don't show the panel for news, rss, or local accounts\r
+ return (server.type != "nntp" && server.type != "rss" &&\r
+ server.type != "none");\r
+ },\r
+\r
+ QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIMsgAccountManagerExtension]),\r
+ classDescription: "secure Headers Account Manager Extension Service",\r
+ classID: Components.ID("{470139E3-7ADD-43e4-954F-CA997B68657C}"),\r
+ contractID: "@mozilla.org/accountmanager/extension;1?name=secureheaders",\r
+\r
+ _xpcom_categories: [{category: "mailnews-accountmanager-extensions",\r
+ entry: "secureheaders account manager extension"}]\r
+};\r
+\r
+function NSGetModule(compMgr, fileSpec) {\r
+ return XPCOMUtils.generateModule([SecureHeadersService]);\r
+}\r
header_status = childNodes[j].getAttribute("status");
}
if(childNodes[j].hasAttribute("encrypted"))
- header_encrypted = parseInt(childNodes[j].getAttribute("encrypted"));
+ header_encrypted = parseInt(childNodes[j].getAttribute("encrypted"),10);
// load values to array
tabSecureHeaders.push(new xSecureHeader(header_name, header_status,header_encrypted));
}
-/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Netscape Communicator.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2002
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Eric Ballet Baz / BT Global Services / Etat francais - Ministere de la Defense
- * Raphael Fairise / BT Global Services / Etat francais - Ministere de la Defense
- * Copyright (c) 2010 CASSIDIAN - All rights reserved
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either 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.
- *
- * ***** END LICENSE BLOCK ***** */
-
-var gEncryptionStatus = -1;
-var gSignatureStatus = -1;
-var gSignerCert = null;
-var gEncryptionCert = null;
-var gSecurityPolicyIdentifier = null;
-var gSecurityClassification = -1;
-var gPrivacyMark = null;
-var gSecurityCategories = null;
-var gSecurityLabelConf = null;
-var gSecureHeaders = "";
-var gSecureHeadersState=-1;
-
-addEventListener("load", smimeReadOnLoad, false);
-
-function smimeReadOnLoad()
-{
- removeEventListener("load", smimeReadOnLoad, false);
-
- top.controllers.appendController(SecurityController);
-
- addEventListener("unload", smimeReadOnUnload, false);
-
- Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService)
- .addObserver(securityLabelCreateDbObserver, "MsgCreateDBView", false);
-
- if (!gSecurityLabelConf)
- gSecurityLabelConf = new securityLabelConf();
-}
-
-function smimeReadOnUnload()
-{
- removeEventListener("unload", smimeReadOnUnload, false);
-
- top.controllers.removeController(SecurityController);
-
- Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService)
- .removeObserver(securityLabelCreateDbObserver, "MsgCreateDBView");
-}
-
-function showImapSignatureUnknown()
-{
- let readSmimeBundle = document.getElementById("bundle_read_smime");
- let brandBundle = document.getElementById("bundle_brand");
- if (!readSmimeBundle || !brandBundle)
- return;
-
- let promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
- .getService(Components.interfaces.nsIPromptService);
- if (promptService &&
- promptService.confirm(window, brandBundle.getString("brandShortName"),
- readSmimeBundle.getString("ImapOnDemand")))
- gDBView.reloadMessageWithAllParts();
-}
-
-function showMessageReadSecurityInfo()
-{
- let gSignedUINode = document.getElementById("signedHdrIcon");
- if (gSignedUINode && gSignedUINode.getAttribute("signed") == "unknown")
- {
- showImapSignatureUnknown();
- return;
- }
-
- let pkiParams = Components.classes["@mozilla.org/security/pkiparamblock;1"]
- .createInstance(Components.interfaces.nsIPKIParamBlock);
-
- // isupport array starts with index 1
- pkiParams.setISupportAtIndex(1, gSignerCert);
- pkiParams.setISupportAtIndex(2, gEncryptionCert);
-
- var params = pkiParams.QueryInterface(Components.interfaces.nsIDialogParamBlock);
- // int array starts with index 0, but that is used for window exit status
- params.SetInt(1, gSignatureStatus);
- params.SetInt(2, gEncryptionStatus);
- params.SetInt(3, gSecurityClassification);
- params.SetInt(4,gSecureHeadersState);
-
- params.SetString(0, gSecurityPolicyIdentifier);
- params.SetString(1, gPrivacyMark);
- params.SetString(2, gSecurityCategories);
- params.SetString(12,gSecureHeaders);
-
- window.openDialog("chrome://messenger-smime/content/msgReadSecurityInfo.xul",
- "", "chrome,resizable=1,modal=1,dialog=1", pkiParams);
-}
-
-var SecurityController =
-{
- supportsCommand: function(command)
- {
- switch (command)
- {
- case "cmd_viewSecurityStatus":
- return true;
-
- default:
- return false;
- }
- },
-
- isCommandEnabled: function(command)
- {
- switch (command)
- {
- case "cmd_viewSecurityStatus":
- if (document.documentElement.getAttribute('windowtype') == "mail:messageWindow")
- return GetNumSelectedMessages() > 0;
-
- if (GetNumSelectedMessages() > 0 && gDBView)
- {
- let enabled = {value: false};
- let checkStatus = {};
- gDBView.getCommandStatus(nsMsgViewCommandType.cmdRequiringMsgBody,
- enabled, checkStatus);
- return enabled.value;
- }
- // else: fall through.
-
- default:
- return false;
- }
- }
-};
-
-/* Add Security Label column */
-var securityLabelCreateDbObserver = {
- observe: function(aMsgFolder, aTopic, aData) {
- try {
- if (gDBView != undefined && gDBView.addColumnHandler)
- gDBView.addColumnHandler("securityLabelSecurityClassificationColumn", securityLabelSecurityClassificationColumnHandler);
- } catch(e) {}
- }
-}
-
-var securityLabelSecurityClassificationColumnHandler = {
- getCellText: function(row, column) {
- var key = gDBView.getKeyAt(row);
- var hdr = gDBView.db.GetMsgHdrForKey(key);
- var securityLabelSecurityPolicyIdentifier = hdr.getStringProperty("securityLabelSecurityPolicyIdentifier");
- var securityLabelSecurityClassification = hdr.getStringProperty("securityLabelSecurityClassification");
-
- if (securityLabelSecurityPolicyIdentifier != "" && securityLabelSecurityClassification != "" && securityLabelSecurityClassification != "-1")
- return gSecurityLabelConf.getSecurityClassificationName(securityLabelSecurityPolicyIdentifier, securityLabelSecurityClassification);
-
- return "";
- },
- getSortStringForRow: function(hdr) {
- var securityLabelSecurityPolicyIdentifier = hdr.getStringProperty("securityLabelSecurityPolicyIdentifier");
- var securityLabelSecurityClassification = hdr.getStringProperty("securityLabelSecurityClassification");
-
- if (securityLabelSecurityPolicyIdentifier != "") {
- if (securityLabelSecurityClassification != "" && securityLabelSecurityClassification != "-1") {
- if (securityLabelSecurityClassification < 10)
- return "00" + securityLabelSecurityClassification;
- else if (securityLabelSecurityClassification < 100)
- return "0" + securityLabelSecurityClassification;
- else
- return securityLabelSecurityClassification;
- }
- }
- return "";
- },
- isString: function() {return true;},
- getCellProperties: function(row, col, props){ },
- getRowProperties: function(row, props){ },
- getImageSrc: function(row, col) {return null;},
- getSortLongForRow: function(hdr) {return 0;}
-}
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */\r
+/* ***** BEGIN LICENSE BLOCK *****\r
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1\r
+ *\r
+ * The contents of this file are subject to the Mozilla Public License Version\r
+ * 1.1 (the "License"); you may not use this file except in compliance with\r
+ * the License. You may obtain a copy of the License at\r
+ * http://www.mozilla.org/MPL/\r
+ *\r
+ * Software distributed under the License is distributed on an "AS IS" basis,\r
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License\r
+ * for the specific language governing rights and limitations under the\r
+ * License.\r
+ *\r
+ * The Original Code is Netscape Communicator.\r
+ *\r
+ * The Initial Developer of the Original Code is\r
+ * Netscape Communications Corporation.\r
+ * Portions created by the Initial Developer are Copyright (C) 2002\r
+ * the Initial Developer. All Rights Reserved.\r
+ *\r
+ * Contributor(s):\r
+ * Eric Ballet Baz / BT Global Services / Etat francais - Ministere de la Defense\r
+ * Raphael Fairise / BT Global Services / Etat francais - Ministere de la Defense\r
+ * Copyright (c) 2010 CASSIDIAN - All rights reserved\r
+ *\r
+ * Alternatively, the contents of this file may be used under the terms of\r
+ * either the GNU General Public License Version 2 or later (the "GPL"), or\r
+ * 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
+ * ***** END LICENSE BLOCK ***** */\r
+\r
+var gEncryptionStatus = -1;\r
+var gSignatureStatus = -1;\r
+var gSignerCert = null;\r
+var gEncryptionCert = null;\r
+var gSecurityPolicyIdentifier = null;\r
+var gSecurityClassification = -1;\r
+var gPrivacyMark = null;\r
+var gSecurityCategories = null;\r
+var gSecurityLabelConf = null;\r
+var gSecureHeaders = "";\r
+var gSecureHeadersState=-1;\r
+/*\r
+gSecureHeadersArray[o.hdrName]={\r
+ o.hdrName = sHeader.headerName; // signed header\r
+ o.hdrSecureValue = sHeader.headerValue; // value in the signature\r
+ o.hdrMimeValue = ""; // value in the MIME message\r
+ o.hdrSignedStatus = sHeader.headerStatus;\r
+ o.hdrCanonAlgo = aCanonAlgo;\r
+ o.hdrEncryptStatus = "";\r
+ o.hdrSignedRes = "valid";}\r
+*/\r
+const SECURE_HEADER_SEPARATOR = "###HEADER_SEPARATOR###";\r
+const HEADER_VAL_SEPARATOR = "###HEADER_VAL###";\r
+var gSecureHeadersArray={};\r
+addEventListener("load", smimeReadOnLoad, false);\r
+\r
+function smimeReadOnLoad()\r
+{\r
+ removeEventListener("load", smimeReadOnLoad, false);\r
+\r
+ top.controllers.appendController(SecurityController);\r
+\r
+ addEventListener("unload", smimeReadOnUnload, false);\r
+\r
+ Components.classes["@mozilla.org/observer-service;1"]\r
+ .getService(Components.interfaces.nsIObserverService)\r
+ .addObserver(securityLabelCreateDbObserver, "MsgCreateDBView", false);\r
+\r
+ if (!gSecurityLabelConf)\r
+ gSecurityLabelConf = new securityLabelConf();\r
+}\r
+\r
+function smimeReadOnUnload()\r
+{\r
+ removeEventListener("unload", smimeReadOnUnload, false);\r
+\r
+ top.controllers.removeController(SecurityController);\r
+\r
+ Components.classes["@mozilla.org/observer-service;1"]\r
+ .getService(Components.interfaces.nsIObserverService)\r
+ .removeObserver(securityLabelCreateDbObserver, "MsgCreateDBView");\r
+}\r
+\r
+function showImapSignatureUnknown()\r
+{\r
+ let readSmimeBundle = document.getElementById("bundle_read_smime");\r
+ let brandBundle = document.getElementById("bundle_brand");\r
+ if (!readSmimeBundle || !brandBundle)\r
+ return;\r
+\r
+ let promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]\r
+ .getService(Components.interfaces.nsIPromptService);\r
+ if (promptService &&\r
+ promptService.confirm(window, brandBundle.getString("brandShortName"),\r
+ readSmimeBundle.getString("ImapOnDemand")))\r
+ gDBView.reloadMessageWithAllParts();\r
+}\r
+\r
+function showMessageReadSecurityInfo()\r
+{\r
+ let gSignedUINode = document.getElementById("signedHdrIcon");\r
+ if (gSignedUINode && gSignedUINode.getAttribute("signed") == "unknown")\r
+ {\r
+ showImapSignatureUnknown();\r
+ return;\r
+ }\r
+\r
+ let pkiParams = Components.classes["@mozilla.org/security/pkiparamblock;1"]\r
+ .createInstance(Components.interfaces.nsIPKIParamBlock);\r
+\r
+ // isupport array starts with index 1\r
+ pkiParams.setISupportAtIndex(1, gSignerCert);\r
+ pkiParams.setISupportAtIndex(2, gEncryptionCert);\r
+\r
+ var params = pkiParams.QueryInterface(Components.interfaces.nsIDialogParamBlock);\r
+ // int array starts with index 0, but that is used for window exit status\r
+ params.SetInt(1, gSignatureStatus);\r
+ params.SetInt(2, gEncryptionStatus);\r
+ params.SetInt(3, gSecurityClassification);\r
+ params.SetInt(4,gSecureHeadersState);\r
+\r
+ params.SetString(0, gSecurityPolicyIdentifier);\r
+ params.SetString(1, gPrivacyMark);\r
+ params.SetString(2, gSecurityCategories);\r
+ params.SetString(12,gSecureHeaders);\r
+ \r
+ //create string with gSecureHeadersArray\r
+ var arraySecureHeadersString = "";\r
+ for (headerName in gSecureHeadersArray) { \r
+ arraySecureHeadersString+=gSecureHeadersArray[headerName].hdrName+HEADER_VAL_SEPARATOR;\r
+ arraySecureHeadersString+=gSecureHeadersArray[headerName].hdrSecureValue+HEADER_VAL_SEPARATOR; //put the value decoded instead of the value in the signature (encoded RFC2047) for the diplay\r
+ arraySecureHeadersString+=gSecureHeadersArray[headerName].hdrMimeValue+HEADER_VAL_SEPARATOR;\r
+ arraySecureHeadersString+=""+gSecureHeadersArray[headerName].hdrSignedStatus+HEADER_VAL_SEPARATOR; \r
+ arraySecureHeadersString+=gSecureHeadersArray[headerName].hdrCanonAlgo+HEADER_VAL_SEPARATOR;\r
+ //arraySecureHeadersString+=""+gSecureHeadersArray[headerName].hdrEncryptStatus+HEADER_VAL_SEPARATOR;\r
+ arraySecureHeadersString+=""+gSecureHeadersArray[headerName].hdrSignedRes+HEADER_VAL_SEPARATOR;\r
+ arraySecureHeadersString+=SECURE_HEADER_SEPARATOR;\r
+ } \r
+ params.SetString(13,arraySecureHeadersString); \r
+\r
+\r
+ window.openDialog("chrome://messenger-smime/content/msgReadSecurityInfo.xul",\r
+ "", "chrome,resizable=1,modal=1,dialog=1", pkiParams);\r
+}\r
+\r
+var SecurityController =\r
+{\r
+ supportsCommand: function(command)\r
+ {\r
+ switch (command)\r
+ {\r
+ case "cmd_viewSecurityStatus":\r
+ return true;\r
+\r
+ default:\r
+ return false;\r
+ }\r
+ },\r
+\r
+ isCommandEnabled: function(command)\r
+ {\r
+ switch (command)\r
+ {\r
+ case "cmd_viewSecurityStatus":\r
+ if (document.documentElement.getAttribute('windowtype') == "mail:messageWindow")\r
+ return GetNumSelectedMessages() > 0;\r
+\r
+ if (GetNumSelectedMessages() > 0 && gDBView)\r
+ {\r
+ let enabled = {value: false};\r
+ let checkStatus = {};\r
+ gDBView.getCommandStatus(nsMsgViewCommandType.cmdRequiringMsgBody,\r
+ enabled, checkStatus);\r
+ return enabled.value;\r
+ }\r
+ // else: fall through.\r
+\r
+ default:\r
+ return false;\r
+ }\r
+ }\r
+};\r
+\r
+/* Add Security Label column */\r
+var securityLabelCreateDbObserver = {\r
+ observe: function(aMsgFolder, aTopic, aData) {\r
+ try {\r
+ if (gDBView != undefined && gDBView.addColumnHandler)\r
+ gDBView.addColumnHandler("securityLabelSecurityClassificationColumn", securityLabelSecurityClassificationColumnHandler);\r
+ } catch(e) {}\r
+ }\r
+}\r
+\r
+var securityLabelSecurityClassificationColumnHandler = {\r
+ getCellText: function(row, column) {\r
+ var key = gDBView.getKeyAt(row);\r
+ var hdr = gDBView.db.GetMsgHdrForKey(key);\r
+ var securityLabelSecurityPolicyIdentifier = hdr.getStringProperty("securityLabelSecurityPolicyIdentifier");\r
+ var securityLabelSecurityClassification = hdr.getStringProperty("securityLabelSecurityClassification");\r
+\r
+ if (securityLabelSecurityPolicyIdentifier != "" && securityLabelSecurityClassification != "" && securityLabelSecurityClassification != "-1")\r
+ return gSecurityLabelConf.getSecurityClassificationName(securityLabelSecurityPolicyIdentifier, securityLabelSecurityClassification);\r
+\r
+ return "";\r
+ },\r
+ getSortStringForRow: function(hdr) {\r
+ var securityLabelSecurityPolicyIdentifier = hdr.getStringProperty("securityLabelSecurityPolicyIdentifier");\r
+ var securityLabelSecurityClassification = hdr.getStringProperty("securityLabelSecurityClassification");\r
+\r
+ if (securityLabelSecurityPolicyIdentifier != "") {\r
+ if (securityLabelSecurityClassification != "" && securityLabelSecurityClassification != "-1") {\r
+ if (securityLabelSecurityClassification < 10)\r
+ return "00" + securityLabelSecurityClassification;\r
+ else if (securityLabelSecurityClassification < 100)\r
+ return "0" + securityLabelSecurityClassification;\r
+ else\r
+ return securityLabelSecurityClassification;\r
+ }\r
+ }\r
+ return "";\r
+ },\r
+ isString: function() {return true;},\r
+ getCellProperties: function(row, col, props){ },\r
+ getRowProperties: function(row, props){ },\r
+ getImageSrc: function(row, col) {return null;},\r
+ getSortLongForRow: function(hdr) {return 0;}\r
+}\r
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corp..
- * Portions created by the Initial Developer are Copyright (C) 2002
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Kai Engert <kaie@netscape.com>
- * Copyright (c) 2010 CASSIDIAN - All rights reserved
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either 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.
- *
- * ***** END LICENSE BLOCK ***** */
-
-const nsIPKIParamBlock = Components.interfaces.nsIPKIParamBlock;
-const nsIDialogParamBlock = Components.interfaces.nsIDialogParamBlock;
-const nsIX509Cert = Components.interfaces.nsIX509Cert;
-const nsICMSMessageErrors = Components.interfaces.nsICMSMessageErrors;
-const nsICertificateDialogs = Components.interfaces.nsICertificateDialogs;
-const nsCertificateDialogs = "@mozilla.org/nsCertificateDialogs;1"
-
-var gSignerCert = null;
-var gEncryptionCert = null;
-
-var gSignatureStatus = -1;
-var gEncryptionStatus = -1;
-
-var gSecurityPolicyIdentifier = null;
-var gSecurityClassification = -1;
-var gPrivacyMark = null;
-var gSecurityCategories = null;
-
-var gSecurityLabelConf = null;
-
-var gSecureHeaders = "";
-var gSecureHeadersState = -1;
-var params = null;
-
-function setText(id, value) {
- var element = document.getElementById(id);
- if (!element)
- return;
- if (element.hasChildNodes())
- element.removeChild(element.firstChild);
- var textNode = document.createTextNode(value);
- element.appendChild(textNode);
-}
-
-function onLoad()
-{
- var pkiParams = window.arguments[0].QueryInterface(nsIPKIParamBlock);
- var isupport = pkiParams.getISupportAtIndex(1);
- if (isupport) {
- gSignerCert = isupport.QueryInterface(nsIX509Cert);
- }
- isupport = pkiParams.getISupportAtIndex(2);
- if (isupport) {
- gEncryptionCert = isupport.QueryInterface(nsIX509Cert);
- }
-
- params = pkiParams.QueryInterface(nsIDialogParamBlock);
-
- gSignatureStatus = params.GetInt(1);
- gEncryptionStatus = params.GetInt(2);
- gSecurityClassification = params.GetInt(3);
- gSecureHeadersState = params.GetInt(4);
-
- gSecurityPolicyIdentifier = params.GetString(0);
- gPrivacyMark = params.GetString(1);
- gSecurityCategories = params.GetString(2);
- gSecureHeaders = params.GetString(12);
-
- if (!gSecurityLabelConf)
- gSecurityLabelConf = new securityLabelConf();
-
- var bundle = document.getElementById("bundle_smime_read_info");
- var bundle_secure_headers = document.getElementById("bundle_smime_secure_headers");
-
- if (bundle) {
- var sigInfoLabel = null;
- var sigInfoHeader = null;
- var sigInfo = null;
- var sigInfo_clueless = false;
-
- switch (gSignatureStatus) {
- case -1:
- case nsICMSMessageErrors.VERIFY_NOT_SIGNED:
- sigInfoLabel = "SINoneLabel";
- sigInfo = "SINone";
- break;
-
- case nsICMSMessageErrors.SUCCESS:
- sigInfoLabel = "SIValidLabel";
- sigInfo = "SIValid";
- break;
-
-
- case nsICMSMessageErrors.VERIFY_BAD_SIGNATURE:
- case nsICMSMessageErrors.VERIFY_DIGEST_MISMATCH:
- sigInfoLabel = "SIInvalidLabel";
- sigInfoHeader = "SIInvalidHeader";
- sigInfo = "SIContentAltered";
- break;
-
- case nsICMSMessageErrors.VERIFY_UNKNOWN_ALGO:
- case nsICMSMessageErrors.VERIFY_UNSUPPORTED_ALGO:
- sigInfoLabel = "SIInvalidLabel";
- sigInfoHeader = "SIInvalidHeader";
- sigInfo = "SIInvalidCipher";
- break;
-
- case nsICMSMessageErrors.VERIFY_HEADER_MISMATCH:
- sigInfoLabel = "SIPartiallyValidLabel";
- sigInfoHeader = "SIPartiallyValidHeader";
- sigInfo = "SIHeaderMismatch";
- break;
-
- case nsICMSMessageErrors.VERIFY_CERT_WITHOUT_ADDRESS:
- sigInfoLabel = "SIPartiallyValidLabel";
- sigInfoHeader = "SIPartiallyValidHeader";
- sigInfo = "SICertWithoutAddress";
- break;
-
- case nsICMSMessageErrors.VERIFY_UNTRUSTED:
- sigInfoLabel = "SIInvalidLabel";
- sigInfoHeader = "SIInvalidHeader";
- sigInfo = "SIUntrustedCA";
- // XXX Need to extend to communicate better errors
- // might also be:
- // SIExpired SIRevoked SINotYetValid SIUnknownCA SIExpiredCA SIRevokedCA SINotYetValidCA
- break;
-
- case nsICMSMessageErrors.VERIFY_NOT_YET_ATTEMPTED:
- case nsICMSMessageErrors.GENERAL_ERROR:
- case nsICMSMessageErrors.VERIFY_NO_CONTENT_INFO:
- case nsICMSMessageErrors.VERIFY_BAD_DIGEST:
- case nsICMSMessageErrors.VERIFY_NOCERT:
- case nsICMSMessageErrors.VERIFY_ERROR_UNVERIFIED:
- case nsICMSMessageErrors.VERIFY_ERROR_PROCESSING:
- case nsICMSMessageErrors.VERIFY_MALFORMED_SIGNATURE:
- sigInfoLabel = "SIInvalidLabel";
- sigInfoHeader = "SIInvalidHeader";
- sigInfo_clueless = true;
- break;
- }
-
-
- document.getElementById("signatureLabel").value =
- bundle.getString(sigInfoLabel);
-
- var label;
- if (sigInfoHeader) {
- label = document.getElementById("signatureHeader");
- label.collapsed = false;
- label.value = bundle.getString(sigInfoHeader);
- }
-
- var str;
- if (sigInfo) {
- str = bundle.getString(sigInfo);
- }
- else if (sigInfo_clueless) {
- str = bundle.getString("SIClueless") + " (" + gSignatureStatus + ")";
- }
- setText("signatureExplanation", str);
-
-
- var encInfoLabel = null;
- var encInfoHeader = null;
- var encInfo = null;
- var encInfo_clueless = false;
-
- switch (gEncryptionStatus) {
- case -1:
- encInfoLabel = "EINoneLabel";
- encInfo = "EINone";
- break;
-
- case nsICMSMessageErrors.SUCCESS:
- encInfoLabel = "EIValidLabel";
- encInfo = "EIValid";
- break;
-
- case nsICMSMessageErrors.ENCRYPT_INCOMPLETE:
- encInfoLabel = "EIInvalidLabel";
- encInfo = "EIContentAltered";
- break;
-
- case nsICMSMessageErrors.GENERAL_ERROR:
- encInfoLabel = "EIInvalidLabel";
- encInfoHeader = "EIInvalidHeader";
- encInfo_clueless = 1;
- break;
- }
-
-
- document.getElementById("encryptionLabel").value =
- bundle.getString(encInfoLabel);
-
- if (encInfoHeader) {
- label = document.getElementById("encryptionHeader");
- label.collapsed = false;
- label.value = bundle.getString(encInfoHeader);
- }
-
- if (encInfo) {
- str = bundle.getString(encInfo);
- }
- else if (encInfo_clueless) {
- str = bundle.getString("EIClueless");
- }
- setText("encryptionExplanation", str);
- }
-
- if (gSignerCert) {
- document.getElementById("signatureCert").collapsed = false;
- if (gSignerCert.subjectName) {
- document.getElementById("signedBy").value = gSignerCert.commonName;
- }
- if (gSignerCert.emailAddress) {
- document.getElementById("signerEmail").value = gSignerCert.emailAddress;
- }
- if (gSignerCert.issuerName) {
- document.getElementById("sigCertIssuedBy").value = gSignerCert.issuerCommonName;
- }
- }
-
- if (gEncryptionCert) {
- document.getElementById("encryptionCert").collapsed = false;
- if (gEncryptionCert.subjectName) {
- document.getElementById("encryptedFor").value = gEncryptionCert.commonName;
- }
- if (gEncryptionCert.emailAddress) {
- document.getElementById("recipientEmail").value = gEncryptionCert.emailAddress;
- }
- if (gEncryptionCert.issuerName) {
- document.getElementById("encCertIssuedBy").value = gEncryptionCert.issuerCommonName;
- }
- }
-
-
- if(gSecureHeaders !="" &&
- gSignatureStatus != -1 &&
- gSignatureStatus != nsICMSMessageErrors.VERIFY_NOT_SIGNED){
- document.getElementById("secureHeaderBox").collapsed = false;
- label = document.getElementById("secureHeadersLabel");
- label.collapsed = false;
- label.value = bundle_secure_headers.getString("secureInfo.secureheaders.label");
-
- var secureStatelabel = document.getElementById("secureHeadersStateLabel");
- secureStatelabel.hidden = false;
- if(gSecureHeadersState>0)
- {
- secureStatelabel.value = bundle_secure_headers.getString("allsecureheaders.valid.label");
- }
- else{
- secureStatelabel.value = bundle_secure_headers.getString("allsecureheaders.invalid.label");
- }
- }
-
- if (gSecurityPolicyIdentifier != "") {
- document.getElementById("securityLabelBox").collapsed = false;
- document.getElementById("securityLabelSecurityPolicyIdentifierValue").value = gSecurityLabelConf.getSecurityPolicyIdentifierName(gSecurityPolicyIdentifier);
- if (gSecurityClassification != -1) {
- document.getElementById("securityLabelSecurityClassificationValue").value = gSecurityLabelConf.getSecurityClassificationName(gSecurityPolicyIdentifier, gSecurityClassification);
- document.getElementById("securityLabelSecurityClassificationRow").collapsed = false;
- }
- if (gPrivacyMark != "") {
- document.getElementById("securityLabelPrivacyMarkValue").value = gPrivacyMark;
- document.getElementById("securityLabelPrivacyMarkRow").collapsed = false;
- }
- if (gSecurityCategories != "") {
- var securityLabelSecurityCategoriesListBox = document.getElementById("securityLabelSecurityCategoriesListBox");
-
- securityCategoriesArray = gSecurityCategories.split("|");
- var listboxSize = securityCategoriesArray.length / 3;
- if (listboxSize > 5) listboxSize = 5;
- securityLabelSecurityCategoriesListBox.setAttribute("rows", listboxSize);
-
- for (var i = 0; i < securityCategoriesArray.length; i += 3) {
- var listitem = document.createElement("listitem");
- listitem.setAttribute("label", gSecurityLabelConf.getSecurityCategoryName(gSecurityPolicyIdentifier, gSecurityClassification, securityCategoriesArray[i], securityCategoriesArray[i + 1], securityCategoriesArray[i + 2]));
- securityLabelSecurityCategoriesListBox.appendChild(listitem);
- }
- document.getElementById("securityLabelSecurityCategoriesRow").collapsed = false;
- }
- }
-}
-
-function viewCertHelper(parent, cert) {
- var cd = Components.classes[nsCertificateDialogs].getService(nsICertificateDialogs);
- cd.viewCert(parent, cert);
-}
-
-function viewSignatureCert()
-{
- if (gSignerCert) {
- viewCertHelper(window, gSignerCert);
- }
-}
-
-function viewEncryptionCert()
-{
- if (gEncryptionCert) {
- viewCertHelper(window, gEncryptionCert);
- }
-}
-
-function doHelpButton()
-{
- openHelp('received_security');
-}
-
-function viewSecureHeaders(){
- if(gSecureHeaders!="")
- {
- window.openDialog('chrome://messenger-smime/content/msgReadSecureHeadersView.xul',
- '', 'chrome,resizable=1,modal=1,dialog=1', gSecureHeaders );
- }
-}
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */\r
+/* ***** BEGIN LICENSE BLOCK *****\r
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1\r
+ *\r
+ * The contents of this file are subject to the Mozilla Public License Version\r
+ * 1.1 (the "License"); you may not use this file except in compliance with\r
+ * the License. You may obtain a copy of the License at\r
+ * http://www.mozilla.org/MPL/\r
+ *\r
+ * Software distributed under the License is distributed on an "AS IS" basis,\r
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License\r
+ * for the specific language governing rights and limitations under the\r
+ * License.\r
+ *\r
+ * The Original Code is Mozilla Communicator.\r
+ *\r
+ * The Initial Developer of the Original Code is\r
+ * Netscape Communications Corp..\r
+ * Portions created by the Initial Developer are Copyright (C) 2002\r
+ * the Initial Developer. All Rights Reserved.\r
+ *\r
+ * Contributor(s):\r
+ * Kai Engert <kaie@netscape.com>\r
+ * Copyright (c) 2010 CASSIDIAN - All rights reserved\r
+ *\r
+ * Alternatively, the contents of this file may be used under the terms of\r
+ * either the GNU General Public License Version 2 or later (the "GPL"), or\r
+ * 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
+ * ***** END LICENSE BLOCK ***** */\r
+\r
+const nsIPKIParamBlock = Components.interfaces.nsIPKIParamBlock;\r
+const nsIDialogParamBlock = Components.interfaces.nsIDialogParamBlock;\r
+const nsIX509Cert = Components.interfaces.nsIX509Cert;\r
+const nsICMSMessageErrors = Components.interfaces.nsICMSMessageErrors;\r
+const nsICertificateDialogs = Components.interfaces.nsICertificateDialogs;\r
+const nsCertificateDialogs = "@mozilla.org/nsCertificateDialogs;1"\r
+\r
+var gSignerCert = null;\r
+var gEncryptionCert = null;\r
+\r
+var gSignatureStatus = -1;\r
+var gEncryptionStatus = -1;\r
+\r
+var gSecurityPolicyIdentifier = null;\r
+var gSecurityClassification = -1;\r
+var gPrivacyMark = null;\r
+var gSecurityCategories = null;\r
+\r
+var gSecurityLabelConf = null;\r
+\r
+var gSecureHeaders = "";\r
+var gSecureHeadersState = -1;\r
+var params = null;\r
+\r
+function setText(id, value) {\r
+ var element = document.getElementById(id);\r
+ if (!element)\r
+ return;\r
+ if (element.hasChildNodes())\r
+ element.removeChild(element.firstChild);\r
+ var textNode = document.createTextNode(value);\r
+ element.appendChild(textNode);\r
+}\r
+\r
+function onLoad()\r
+{\r
+ var pkiParams = window.arguments[0].QueryInterface(nsIPKIParamBlock);\r
+ var isupport = pkiParams.getISupportAtIndex(1);\r
+ if (isupport) {\r
+ gSignerCert = isupport.QueryInterface(nsIX509Cert);\r
+ }\r
+ isupport = pkiParams.getISupportAtIndex(2);\r
+ if (isupport) {\r
+ gEncryptionCert = isupport.QueryInterface(nsIX509Cert);\r
+ }\r
+ \r
+ params = pkiParams.QueryInterface(nsIDialogParamBlock);\r
+ \r
+ gSignatureStatus = params.GetInt(1);\r
+ gEncryptionStatus = params.GetInt(2);\r
+ gSecurityClassification = params.GetInt(3);\r
+ gSecureHeadersState = params.GetInt(4);\r
+\r
+ gSecurityPolicyIdentifier = params.GetString(0);\r
+ gPrivacyMark = params.GetString(1);\r
+ gSecurityCategories = params.GetString(2);\r
+ gSecureHeaders = params.GetString(12);\r
+ \r
+ if (!gSecurityLabelConf)\r
+ gSecurityLabelConf = new securityLabelConf();\r
+\r
+ var bundle = document.getElementById("bundle_smime_read_info");\r
+ var bundle_secure_headers = document.getElementById("bundle_smime_secure_headers");\r
+\r
+ if (bundle) {\r
+ var sigInfoLabel = null;\r
+ var sigInfoHeader = null;\r
+ var sigInfo = null;\r
+ var sigInfo_clueless = false;\r
+\r
+ switch (gSignatureStatus) {\r
+ case -1:\r
+ case nsICMSMessageErrors.VERIFY_NOT_SIGNED:\r
+ sigInfoLabel = "SINoneLabel";\r
+ sigInfo = "SINone";\r
+ break;\r
+\r
+ case nsICMSMessageErrors.SUCCESS:\r
+ sigInfoLabel = "SIValidLabel";\r
+ sigInfo = "SIValid";\r
+ break;\r
+\r
+\r
+ case nsICMSMessageErrors.VERIFY_BAD_SIGNATURE:\r
+ case nsICMSMessageErrors.VERIFY_DIGEST_MISMATCH:\r
+ sigInfoLabel = "SIInvalidLabel";\r
+ sigInfoHeader = "SIInvalidHeader";\r
+ sigInfo = "SIContentAltered";\r
+ break;\r
+\r
+ case nsICMSMessageErrors.VERIFY_UNKNOWN_ALGO:\r
+ case nsICMSMessageErrors.VERIFY_UNSUPPORTED_ALGO:\r
+ sigInfoLabel = "SIInvalidLabel";\r
+ sigInfoHeader = "SIInvalidHeader";\r
+ sigInfo = "SIInvalidCipher";\r
+ break;\r
+\r
+ case nsICMSMessageErrors.VERIFY_HEADER_MISMATCH:\r
+ sigInfoLabel = "SIPartiallyValidLabel";\r
+ sigInfoHeader = "SIPartiallyValidHeader";\r
+ sigInfo = "SIHeaderMismatch";\r
+ break;\r
+\r
+ case nsICMSMessageErrors.VERIFY_CERT_WITHOUT_ADDRESS:\r
+ sigInfoLabel = "SIPartiallyValidLabel";\r
+ sigInfoHeader = "SIPartiallyValidHeader";\r
+ sigInfo = "SICertWithoutAddress";\r
+ break;\r
+\r
+ case nsICMSMessageErrors.VERIFY_UNTRUSTED:\r
+ sigInfoLabel = "SIInvalidLabel";\r
+ sigInfoHeader = "SIInvalidHeader";\r
+ sigInfo = "SIUntrustedCA";\r
+ // XXX Need to extend to communicate better errors\r
+ // might also be:\r
+ // SIExpired SIRevoked SINotYetValid SIUnknownCA SIExpiredCA SIRevokedCA SINotYetValidCA\r
+ break;\r
+\r
+ case nsICMSMessageErrors.VERIFY_NOT_YET_ATTEMPTED:\r
+ case nsICMSMessageErrors.GENERAL_ERROR:\r
+ case nsICMSMessageErrors.VERIFY_NO_CONTENT_INFO:\r
+ case nsICMSMessageErrors.VERIFY_BAD_DIGEST:\r
+ case nsICMSMessageErrors.VERIFY_NOCERT:\r
+ case nsICMSMessageErrors.VERIFY_ERROR_UNVERIFIED:\r
+ case nsICMSMessageErrors.VERIFY_ERROR_PROCESSING:\r
+ case nsICMSMessageErrors.VERIFY_MALFORMED_SIGNATURE:\r
+ sigInfoLabel = "SIInvalidLabel";\r
+ sigInfoHeader = "SIInvalidHeader";\r
+ sigInfo_clueless = true;\r
+ break;\r
+ }\r
+\r
+ \r
+ document.getElementById("signatureLabel").value = \r
+ bundle.getString(sigInfoLabel);\r
+\r
+ var label;\r
+ if (sigInfoHeader) {\r
+ label = document.getElementById("signatureHeader");\r
+ label.collapsed = false;\r
+ label.value = bundle.getString(sigInfoHeader);\r
+ }\r
+ \r
+ var str;\r
+ if (sigInfo) {\r
+ str = bundle.getString(sigInfo);\r
+ }\r
+ else if (sigInfo_clueless) {\r
+ str = bundle.getString("SIClueless") + " (" + gSignatureStatus + ")";\r
+ }\r
+ setText("signatureExplanation", str);\r
+ \r
+\r
+ var encInfoLabel = null;\r
+ var encInfoHeader = null;\r
+ var encInfo = null;\r
+ var encInfo_clueless = false;\r
+\r
+ switch (gEncryptionStatus) {\r
+ case -1:\r
+ encInfoLabel = "EINoneLabel";\r
+ encInfo = "EINone";\r
+ break;\r
+\r
+ case nsICMSMessageErrors.SUCCESS:\r
+ encInfoLabel = "EIValidLabel";\r
+ encInfo = "EIValid";\r
+ break;\r
+\r
+ case nsICMSMessageErrors.ENCRYPT_INCOMPLETE:\r
+ encInfoLabel = "EIInvalidLabel";\r
+ encInfo = "EIContentAltered";\r
+ break;\r
+\r
+ case nsICMSMessageErrors.GENERAL_ERROR:\r
+ encInfoLabel = "EIInvalidLabel";\r
+ encInfoHeader = "EIInvalidHeader";\r
+ encInfo_clueless = 1;\r
+ break;\r
+ }\r
+\r
+\r
+ document.getElementById("encryptionLabel").value = \r
+ bundle.getString(encInfoLabel);\r
+\r
+ if (encInfoHeader) {\r
+ label = document.getElementById("encryptionHeader");\r
+ label.collapsed = false;\r
+ label.value = bundle.getString(encInfoHeader);\r
+ }\r
+ \r
+ if (encInfo) {\r
+ str = bundle.getString(encInfo);\r
+ }\r
+ else if (encInfo_clueless) {\r
+ str = bundle.getString("EIClueless");\r
+ }\r
+ setText("encryptionExplanation", str);\r
+ }\r
+ \r
+ if (gSignerCert) {\r
+ document.getElementById("signatureCert").collapsed = false;\r
+ if (gSignerCert.subjectName) {\r
+ document.getElementById("signedBy").value = gSignerCert.commonName;\r
+ }\r
+ if (gSignerCert.emailAddress) {\r
+ document.getElementById("signerEmail").value = gSignerCert.emailAddress;\r
+ }\r
+ if (gSignerCert.issuerName) {\r
+ document.getElementById("sigCertIssuedBy").value = gSignerCert.issuerCommonName;\r
+ }\r
+ }\r
+\r
+ if (gEncryptionCert) {\r
+ document.getElementById("encryptionCert").collapsed = false;\r
+ if (gEncryptionCert.subjectName) {\r
+ document.getElementById("encryptedFor").value = gEncryptionCert.commonName;\r
+ }\r
+ if (gEncryptionCert.emailAddress) {\r
+ document.getElementById("recipientEmail").value = gEncryptionCert.emailAddress;\r
+ }\r
+ if (gEncryptionCert.issuerName) {\r
+ document.getElementById("encCertIssuedBy").value = gEncryptionCert.issuerCommonName;\r
+ }\r
+ }\r
+\r
+ \r
+ if(gSecureHeaders !="" &&\r
+ gSignatureStatus != -1 && \r
+ gSignatureStatus != nsICMSMessageErrors.VERIFY_NOT_SIGNED){\r
+ document.getElementById("secureHeaderBox").collapsed = false;\r
+ label = document.getElementById("secureHeadersLabel");\r
+ label.collapsed = false;\r
+ label.value = bundle_secure_headers.getString("secureInfo.secureheaders.label");\r
+\r
+ var secureStatelabel = document.getElementById("secureHeadersStateLabel");\r
+ secureStatelabel.hidden = false;\r
+ if(gSecureHeadersState>0)\r
+ {\r
+ secureStatelabel.value = bundle_secure_headers.getString("allsecureheaders.valid.label");\r
+ }\r
+ else{\r
+ secureStatelabel.value = bundle_secure_headers.getString("allsecureheaders.invalid.label");\r
+ }\r
+ }\r
+ \r
+ if (gSecurityPolicyIdentifier != "") {\r
+ document.getElementById("securityLabelBox").collapsed = false;\r
+ document.getElementById("securityLabelSecurityPolicyIdentifierValue").value = gSecurityLabelConf.getSecurityPolicyIdentifierName(gSecurityPolicyIdentifier);\r
+ if (gSecurityClassification != -1) {\r
+ document.getElementById("securityLabelSecurityClassificationValue").value = gSecurityLabelConf.getSecurityClassificationName(gSecurityPolicyIdentifier, gSecurityClassification);\r
+ document.getElementById("securityLabelSecurityClassificationRow").collapsed = false;\r
+ }\r
+ if (gPrivacyMark != "") {\r
+ document.getElementById("securityLabelPrivacyMarkValue").value = gPrivacyMark;\r
+ document.getElementById("securityLabelPrivacyMarkRow").collapsed = false;\r
+ }\r
+ if (gSecurityCategories != "") {\r
+ var securityLabelSecurityCategoriesListBox = document.getElementById("securityLabelSecurityCategoriesListBox");\r
+\r
+ securityCategoriesArray = gSecurityCategories.split("|");\r
+ var listboxSize = securityCategoriesArray.length / 3;\r
+ if (listboxSize > 5) listboxSize = 5;\r
+ securityLabelSecurityCategoriesListBox.setAttribute("rows", listboxSize);\r
+\r
+ for (var i = 0; i < securityCategoriesArray.length; i += 3) {\r
+ var listitem = document.createElement("listitem");\r
+ listitem.setAttribute("label", gSecurityLabelConf.getSecurityCategoryName(gSecurityPolicyIdentifier, gSecurityClassification, securityCategoriesArray[i], securityCategoriesArray[i + 1], securityCategoriesArray[i + 2]));\r
+ securityLabelSecurityCategoriesListBox.appendChild(listitem);\r
+ }\r
+ document.getElementById("securityLabelSecurityCategoriesRow").collapsed = false;\r
+ }\r
+ }\r
+}\r
+\r
+function viewCertHelper(parent, cert) {\r
+ var cd = Components.classes[nsCertificateDialogs].getService(nsICertificateDialogs);\r
+ cd.viewCert(parent, cert);\r
+}\r
+\r
+function viewSignatureCert()\r
+{\r
+ if (gSignerCert) {\r
+ viewCertHelper(window, gSignerCert);\r
+ }\r
+}\r
+\r
+function viewEncryptionCert()\r
+{\r
+ if (gEncryptionCert) {\r
+ viewCertHelper(window, gEncryptionCert);\r
+ }\r
+}\r
+\r
+function doHelpButton()\r
+{\r
+ openHelp('received_security');\r
+}\r
+\r
+function viewSecureHeaders(){\r
+ if(gSecureHeaders!="")\r
+ {\r
+ window.openDialog('chrome://messenger-smime/content/msgReadSecureHeadersView.xul',\r
+ '', 'chrome,resizable=1,modal=1,dialog=1', params.GetString(13) );\r
+ }\r
+}\r
-<?xml version="1.0"?>
-<!-- ***** BEGIN LICENSE BLOCK *****
- - Version: MPL 1.1/GPL 2.0/LGPL 2.1
- -
- - The contents of this file are subject to the Mozilla Public License Version
- - 1.1 (the "License"); you may not use this file except in compliance with
- - the License. You may obtain a copy of the License at
- - http://www.mozilla.org/MPL/
- -
- - Software distributed under the License is distributed on an "AS IS" basis,
- - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- - for the specific language governing rights and limitations under the
- - License.
- -
- - The Original Code is Mozilla Communicator
- -
- - The Initial Developer of the Original Code is
- - Netscape Communications Corp..
- - Portions created by the Initial Developer are Copyright (C) 2002
- - the Initial Developer. All Rights Reserved.
- -
- - Contributor(s):
- - Kai Engert <kaie@netscape.com>
- - Copyright (c) 2010 CASSIDIAN - All rights reserved
- -
- - Alternatively, the contents of this file may be used under the terms of
- - either 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 LGPL or the GPL. 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.
- -
- - ***** END LICENSE BLOCK ***** -->
-
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
-<?xml-stylesheet href="chrome://messenger/skin/smime/msgReadSecurityInfo.css" type="text/css"?>
-
-<!DOCTYPE dialog [
- <!ENTITY % msgReadSecurityInfoDTD SYSTEM "chrome://messenger-smime/locale/msgReadSecurityInfo.dtd">
- %msgReadSecurityInfoDTD;
- <!ENTITY % secureheadersDTD SYSTEM "chrome://messenger/locale/secureheaders.dtd">
- %secureheadersDTD;
-]>
-
-<dialog id="msgReadSecurityInfo" title="&status.label;"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- style="width: 40em;"
- buttons="accept"
- onload="onLoad();">
-
- <script type="application/javascript" src="chrome://messenger-smime/content/msgReadSecurityInfo.js"/>
- <script type="application/javascript" src="chrome://messenger-smime/content/msgSecurityLabel.js"/>
-
- <stringbundle id="bundle_smime_read_info" src="chrome://messenger-smime/locale/msgSecurityInfo.properties"/>
- <stringbundle id="bundle_smime_secure_headers" src="chrome://messenger/locale/secureheaders.properties"/>
-
- <vbox flex="1">
- <label id="signatureLabel"/>
- <label id="signatureHeader" collapsed="true"/>
- <description id="signatureExplanation"/>
- <vbox id="signatureCert" collapsed="true">
- <hbox>
- <label id="signedByLabel">&signer.name;</label>
- <description id="signedBy"/>
- </hbox>
- <hbox>
- <label id="signerEmailLabel">&email.address;</label>
- <description id="signerEmail"/>
- </hbox>
- <hbox>
- <label id="sigCertIssuedByLabel">&issuer.name;</label>
- <description id="sigCertIssuedBy"/>
- </hbox>
- <hbox>
- <button id="signatureCertView" label="&signatureCert.label;"
- oncommand="viewSignatureCert()"/>
- </hbox>
- </vbox>
-
- <separator/>
-
- <label id="encryptionLabel"/>
- <label id="encryptionHeader" collapsed="true"/>
- <description id="encryptionExplanation"/>
- <vbox id="encryptionCert" collapsed="true">
- <hbox>
- <label id="encryptedForLabel">&recipient.name;</label>
- <description id="encryptedFor"/>
- </hbox>
- <hbox>
- <label id="recipientEmailLabel">&email.address;</label>
- <description id="recipientEmail"/>
- </hbox>
- <hbox>
- <label id="encCertIssuedByLabel">&issuer.name;</label>
- <description id="encCertIssuedBy"/>
- </hbox>
- <hbox>
- <button id="encryptionCertView" label="&encryptionCert.label;"
- oncommand="viewEncryptionCert()"/>
- </hbox>
- </vbox>
-
- <vbox id="securityLabelBox" collapsed="true">
- <separator/>
- <label id="securityLabel">&securityLabel.name;</label>
- <grid id="securityLabelContent" flex="1">
- <columns>
- <column />
- <column flex="1"/>
- </columns>
- <rows>
- <row align="center">
- <label id="securityLabelSecurityPolicyIdentifierLabel" value="&securityLabel.securityPolicyIdentifier.name;"/>
- <description id="securityLabelSecurityPolicyIdentifierValue"/>
- </row>
- <row align="center" id="securityLabelPrivacyMarkRow" collapsed="true">
- <label id="securityLabelPrivacyMarkLabel" value="&securityLabel.privacyMark.name;"/>
- <description id="securityLabelPrivacyMarkValue"/>
- </row>
- <row align="center" id="securityLabelSecurityClassificationRow" collapsed="true">
- <label id="securityLabelSecurityClassificationLabel" value="&securityLabel.securityClassification.name;"/>
- <description id="securityLabelSecurityClassificationValue"/>
- </row>
- <row align="center" id="securityLabelSecurityCategoriesRow" collapsed="true">
- <label id="securityLabelSecurityCategoriesLabel" value="&securityLabel.securityCategories.name;"/>
- <listbox id="securityLabelSecurityCategoriesListBox" flex="1"/>
- </row>
- </rows>
- </grid>
- </vbox>
-
- <vbox id="secureHeaderBox" collapsed="true">
- <separator/>
- <label id="secureHeadersLabel" style="font-weight: bold;"/>
- <hbox>
- <button id="secureHeadersView" label="&secureHeadersView.label;"
- oncommand="viewSecureHeaders()"/>
- <label id="secureHeadersStateLabel" hidden="true"/>
- </hbox>
- </vbox>
- </vbox>
-</dialog>
+<?xml version="1.0"?>\r
+<!-- ***** BEGIN LICENSE BLOCK *****\r
+ - Version: MPL 1.1/GPL 2.0/LGPL 2.1\r
+ -\r
+ - The contents of this file are subject to the Mozilla Public License Version\r
+ - 1.1 (the "License"); you may not use this file except in compliance with\r
+ - the License. You may obtain a copy of the License at\r
+ - http://www.mozilla.org/MPL/\r
+ -\r
+ - Software distributed under the License is distributed on an "AS IS" basis,\r
+ - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License\r
+ - for the specific language governing rights and limitations under the\r
+ - License.\r
+ -\r
+ - The Original Code is Mozilla Communicator\r
+ -\r
+ - The Initial Developer of the Original Code is\r
+ - Netscape Communications Corp..\r
+ - Portions created by the Initial Developer are Copyright (C) 2002\r
+ - the Initial Developer. All Rights Reserved.\r
+ -\r
+ - Contributor(s):\r
+ - Kai Engert <kaie@netscape.com>\r
+ - Copyright (c) 2010 CASSIDIAN - All rights reserved\r
+ -\r
+ - Alternatively, the contents of this file may be used under the terms of\r
+ - either the GNU General Public License Version 2 or later (the "GPL"), or\r
+ - 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 LGPL or the GPL. 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
+ - ***** END LICENSE BLOCK ***** -->\r
+\r
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>\r
+<?xml-stylesheet href="chrome://messenger/skin/smime/msgReadSecurityInfo.css" type="text/css"?> \r
+\r
+<!DOCTYPE dialog [\r
+ <!ENTITY % msgReadSecurityInfoDTD SYSTEM "chrome://messenger-smime/locale/msgReadSecurityInfo.dtd">\r
+ %msgReadSecurityInfoDTD;\r
+ <!ENTITY % secureheadersDTD SYSTEM "chrome://messenger/locale/secureheaders.dtd">\r
+ %secureheadersDTD;\r
+]>\r
+\r
+<dialog id="msgReadSecurityInfo" title="&status.label;"\r
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"\r
+ style="width: 40em;"\r
+ buttons="accept"\r
+ onload="onLoad();">\r
+\r
+ <script type="application/javascript" src="chrome://messenger-smime/content/msgReadSecurityInfo.js"/>\r
+ <script type="application/javascript" src="chrome://messenger-smime/content/msgSecurityLabel.js"/>\r
+\r
+ <stringbundle id="bundle_smime_read_info" src="chrome://messenger-smime/locale/msgSecurityInfo.properties"/> \r
+ <stringbundle id="bundle_smime_secure_headers" src="chrome://messenger/locale/secureheaders.properties"/>\r
+\r
+ <vbox flex="1">\r
+ <label id="signatureLabel"/>\r
+ <label id="signatureHeader" collapsed="true"/>\r
+ <description id="signatureExplanation"/>\r
+ <vbox id="signatureCert" collapsed="true">\r
+ <hbox>\r
+ <label id="signedByLabel">&signer.name;</label>\r
+ <description id="signedBy"/>\r
+ </hbox>\r
+ <hbox>\r
+ <label id="signerEmailLabel">&email.address;</label>\r
+ <description id="signerEmail"/>\r
+ </hbox>\r
+ <hbox>\r
+ <label id="sigCertIssuedByLabel">&issuer.name;</label>\r
+ <description id="sigCertIssuedBy"/>\r
+ </hbox>\r
+ <hbox>\r
+ <button id="signatureCertView" label="&signatureCert.label;"\r
+ oncommand="viewSignatureCert()"/>\r
+ </hbox>\r
+ </vbox>\r
+\r
+ <separator/>\r
+\r
+ <label id="encryptionLabel"/>\r
+ <label id="encryptionHeader" collapsed="true"/>\r
+ <description id="encryptionExplanation"/>\r
+ <vbox id="encryptionCert" collapsed="true">\r
+ <hbox>\r
+ <label id="encryptedForLabel">&recipient.name;</label>\r
+ <description id="encryptedFor"/>\r
+ </hbox>\r
+ <hbox>\r
+ <label id="recipientEmailLabel">&email.address;</label>\r
+ <description id="recipientEmail"/>\r
+ </hbox>\r
+ <hbox>\r
+ <label id="encCertIssuedByLabel">&issuer.name;</label>\r
+ <description id="encCertIssuedBy"/>\r
+ </hbox>\r
+ <hbox>\r
+ <button id="encryptionCertView" label="&encryptionCert.label;"\r
+ oncommand="viewEncryptionCert()"/>\r
+ </hbox>\r
+ </vbox>\r
+\r
+ <vbox id="securityLabelBox" collapsed="true">\r
+ <separator/>\r
+ <label id="securityLabel">&securityLabel.name;</label>\r
+ <grid id="securityLabelContent" flex="1">\r
+ <columns>\r
+ <column />\r
+ <column flex="1"/>\r
+ </columns>\r
+ <rows>\r
+ <row align="center">\r
+ <label id="securityLabelSecurityPolicyIdentifierLabel" value="&securityLabel.securityPolicyIdentifier.name;"/>\r
+ <description id="securityLabelSecurityPolicyIdentifierValue"/>\r
+ </row>\r
+ <row align="center" id="securityLabelPrivacyMarkRow" collapsed="true">\r
+ <label id="securityLabelPrivacyMarkLabel" value="&securityLabel.privacyMark.name;"/>\r
+ <description id="securityLabelPrivacyMarkValue"/>\r
+ </row>\r
+ <row align="center" id="securityLabelSecurityClassificationRow" collapsed="true">\r
+ <label id="securityLabelSecurityClassificationLabel" value="&securityLabel.securityClassification.name;"/>\r
+ <description id="securityLabelSecurityClassificationValue"/>\r
+ </row>\r
+ <row align="center" id="securityLabelSecurityCategoriesRow" collapsed="true">\r
+ <label id="securityLabelSecurityCategoriesLabel" value="&securityLabel.securityCategories.name;"/>\r
+ <listbox id="securityLabelSecurityCategoriesListBox" flex="1"/>\r
+ </row>\r
+ </rows>\r
+ </grid>\r
+ </vbox>\r
+ \r
+ <vbox id="secureHeaderBox" collapsed="true">\r
+ <separator/>\r
+ <label id="secureHeadersLabel" style="font-weight: bold;"/>\r
+ <hbox>\r
+ <button id="secureHeadersView" label="&secureHeadersView.label;"\r
+ oncommand="viewSecureHeaders()"/>\r
+ <label id="secureHeadersStateLabel" hidden="true"/>\r
+ </hbox>\r
+ </vbox>\r
+ </vbox>\r
+</dialog>\r
if (itemNode.nodeName == "item") {
var label = itemNode.getAttribute("label").trim();
var value = itemNode.getAttribute("value").trim();
- value = parseInt(value);
+ value = parseInt(value,10);
if (label != "" && value >= 0 && value <= 256) {
if (displayValue != "false" && displayValue != "0")
label += " (" + value + ")";
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * David Drinan <ddrinan@netscape.com>
- * Stephane Saux <ssaux@netscape.com>
- * ESS Signed Receipts: Raphael Fairise / BT Global Services / Etat francais - Ministere de la Defense
- * Copyright (c) 2010 CASSIDIAN - All rights reserved
- *
- * 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.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "nsMsgComposeSecure.h"
-
-#include "msgCore.h"
-#include "nsIMsgCompFields.h"
-#include "nsIMsgCompUtils.h"
-#include "nsIMsgHeaderParser.h"
-#include "nsIMsgIdentity.h"
-#include "nsISMimeCert.h"
-#include "nsIX509CertDB.h"
-#include "nsMimeTypes.h"
-#include "nsMsgMimeCID.h"
-#include "nsMsgCompCID.h"
-#include "nspr.h"
-#include "nsArrayUtils.h"
-
-// XXX These strings should go in properties file XXX //
-#define MIME_MULTIPART_SIGNED_BLURB "This is a cryptographically signed message in MIME format."
-#define MIME_SMIME_ENCRYPTED_CONTENT_DESCRIPTION "S/MIME Encrypted Message"
-#define MIME_SMIME_SIGNATURE_CONTENT_DESCRIPTION "S/MIME Cryptographic Signature"
-#define MIME_SMIME_RECEIPT_CONTENT_DESCRIPTION "S/MIME Receipt"
-
-#define MK_MIME_ERROR_WRITING_FILE -1
-
-#define SMIME_STRBUNDLE_URL "chrome://messenger/locale/am-smime.properties"
-
-static void mime_crypto_write_base64 (void *closure, const char *buf,
- unsigned long size);
-static nsresult mime_encoder_output_fn(const char *buf, PRInt32 size, void *closure);
-static nsresult mime_nested_encoder_output_fn (const char *buf, PRInt32 size, void *closure);
-static int make_multipart_signed_header_string(PRBool outer_p,
- char **header_return,
- char **boundary_return);
-static char *mime_make_separator(const char *prefix);
-
-// mscott --> FIX ME...for now cloning code from compose\nsMsgEncode.h/.cpp
-
-MimeEncoderData *
-MIME_B64EncoderInit(nsresult (* output_fn) (const char *buf, PRInt32 size, void *closure), void *closure)
-{
- MimeEncoderData *returnEncoderData = nsnull;
- nsIMimeConverter *converter;
- nsresult res = CallCreateInstance(NS_MIME_CONVERTER_CONTRACTID, &converter);
- if (NS_SUCCEEDED(res) && nsnull != converter)
- {
- res = converter->B64EncoderInit(output_fn, closure, &returnEncoderData);
- NS_RELEASE(converter);
- }
- return NS_SUCCEEDED(res) ? returnEncoderData : nsnull;
-}
-
-MimeEncoderData *
-MIME_QPEncoderInit(nsresult (* output_fn) (const char *buf, PRInt32 size, void *closure), void *closure)
-{
- MimeEncoderData *returnEncoderData = nsnull;
- nsIMimeConverter *converter;
- nsresult res = CallCreateInstance(NS_MIME_CONVERTER_CONTRACTID, &converter);
- if (NS_SUCCEEDED(res) && nsnull != converter)
- {
- res = converter->QPEncoderInit(output_fn, closure, &returnEncoderData);
- NS_RELEASE(converter);
- }
- return NS_SUCCEEDED(res) ? returnEncoderData : nsnull;
-}
-
-nsresult
-MIME_EncoderDestroy(MimeEncoderData *data, PRBool abort_p)
-{
- //MimeEncoderData *returnEncoderData = nsnull;
- nsIMimeConverter *converter;
- nsresult res = CallCreateInstance(NS_MIME_CONVERTER_CONTRACTID, &converter);
- if (NS_SUCCEEDED(res) && nsnull != converter)
- {
- res = converter->EncoderDestroy(data, abort_p);
- NS_RELEASE(converter);
- }
-
- return NS_SUCCEEDED(res) ? 0 : -1;
-}
-
-nsresult
-MIME_EncoderWrite(MimeEncoderData *data, const char *buffer, PRInt32 size)
-{
- // MimeEncoderData *returnEncoderData = nsnull;
- nsIMimeConverter *converter;
- PRInt32 written = 0;
- nsresult res = CallCreateInstance(NS_MIME_CONVERTER_CONTRACTID, &converter);
- if (NS_SUCCEEDED(res) && nsnull != converter) {
- res = converter->EncoderWrite(data, buffer, size, &written);
- NS_RELEASE(converter);
- }
- return NS_SUCCEEDED(res) ? 0 : -1;
-}
-
-static void
-GenerateGlobalRandomBytes(unsigned char *buf, PRInt32 len)
-{
- static PRBool firstTime = PR_TRUE;
-
- if (firstTime)
- {
- // Seed the random-number generator with current time so that
- // the numbers will be different every time we run.
- PRInt32 aTime;
- LL_L2I(aTime, PR_Now());
- srand( (unsigned)aTime );
- firstTime = PR_FALSE;
- }
-
- for( PRInt32 i = 0; i < len; i++ )
- buf[i] = rand() % 10;
-}
-
-char
-*mime_make_separator(const char *prefix)
-{
- unsigned char rand_buf[13];
- GenerateGlobalRandomBytes(rand_buf, 12);
-
- return PR_smprintf("------------%s"
- "%02X%02X%02X%02X"
- "%02X%02X%02X%02X"
- "%02X%02X%02X%02X",
- prefix,
- rand_buf[0], rand_buf[1], rand_buf[2], rand_buf[3],
- rand_buf[4], rand_buf[5], rand_buf[6], rand_buf[7],
- rand_buf[8], rand_buf[9], rand_buf[10], rand_buf[11]);
-}
-
-// end of copied code which needs fixed....
-
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// Implementation of nsMsgSMIMESecureHeader
-/////////////////////////////////////////////////////////////////////////////////////////
-NS_IMPL_ISUPPORTS1(nsMsgSMIMESecureHeader, nsIMsgSMIMESecureHeader)
-
-nsMsgSMIMESecureHeader::nsMsgSMIMESecureHeader():mHeaderStatus(-1),mHeaderEncrypted(-1)
-{
-
-}
-
-nsMsgSMIMESecureHeader::~nsMsgSMIMESecureHeader()
-{
-}
-
-NS_IMETHODIMP nsMsgSMIMESecureHeader::SetHeaderName( const nsAString & value)
-{
- mHeaderName = value;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMESecureHeader::GetHeaderName( nsAString & _retval)
-{
- _retval=mHeaderName;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMESecureHeader::SetHeaderValue( const nsAString & value)
-{
- mHeaderValue = value;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMESecureHeader::GetHeaderValue( nsAString & _retval)
-{
- _retval=mHeaderValue;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMESecureHeader::SetHeaderStatus( PRInt32 value )
-{
- mHeaderStatus=value;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMESecureHeader::GetHeaderStatus(PRInt32 * _retval)
-{
- *_retval=mHeaderStatus;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMESecureHeader::SetHeaderEncrypted( PRInt32 value )
-{
- mHeaderEncrypted=value;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMESecureHeader::GetHeaderEncrypted(PRInt32 * _retval)
-{
- *_retval = mHeaderEncrypted;
- return NS_OK;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// Implementation of nsMsgSMIMEComposeFields
-/////////////////////////////////////////////////////////////////////////////////////////
-
-NS_IMPL_ISUPPORTS1(nsMsgSMIMEComposeFields, nsIMsgSMIMECompFields)
-
-nsMsgSMIMEComposeFields::nsMsgSMIMEComposeFields()
-:mSignMessage(PR_FALSE), mAlwaysEncryptMessage(PR_FALSE),
-mSMIMEReceiptRequest(PR_FALSE),
-mSMIMEReceipt(PR_FALSE),
-mSMIMEReceiptSignedContentIdentifierLen(0),
-mSMIMEReceiptOriginatorSignatureValueLen(0),
-mSMIMEReceiptOriginatorContentTypeLen(0),
-mSMIMEReceiptMsgSigDigestLen(0),
-mCanonAlgorithme(0),
-mSecurityClassification(-1)
-{
- nsresult rv;
- m_secureHeaders = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
-}
-
-nsMsgSMIMEComposeFields::~nsMsgSMIMEComposeFields()
-{
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::SetSignMessage(PRBool value)
-{
- mSignMessage = value;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::GetSignMessage(PRBool *_retval)
-{
- *_retval = mSignMessage;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::SetRequireEncryptMessage(PRBool value)
-{
- mAlwaysEncryptMessage = value;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::GetRequireEncryptMessage(PRBool *_retval)
-{
- *_retval = mAlwaysEncryptMessage;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::SetSMIMEReceiptRequest(PRBool value)
-{
- mSMIMEReceiptRequest = value;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::GetSMIMEReceiptRequest(PRBool *_retval)
-{
- *_retval = mSMIMEReceiptRequest;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::SetSMIMEReceipt(PRBool value)
-{
- mSMIMEReceipt = value;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::GetSMIMEReceipt(PRBool *_retval)
-{
- *_retval = mSMIMEReceipt;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::SetSMIMEReceiptSignedContentIdentifier(PRUint8 *value)
-{
- mSMIMEReceiptSignedContentIdentifier = value;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::GetSMIMEReceiptSignedContentIdentifier(PRUint8 **_retval)
-{
- *_retval = mSMIMEReceiptSignedContentIdentifier;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::SetSMIMEReceiptSignedContentIdentifierLen(const PRUint32 value)
-{
- mSMIMEReceiptSignedContentIdentifierLen = value;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::GetSMIMEReceiptSignedContentIdentifierLen(PRUint32 *_retval)
-{
- *_retval = mSMIMEReceiptSignedContentIdentifierLen;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::SetSMIMEReceiptOriginatorSignatureValue(PRUint8 *value)
-{
- mSMIMEReceiptOriginatorSignatureValue = value;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::GetSMIMEReceiptOriginatorSignatureValue(PRUint8 **_retval)
-{
- *_retval = mSMIMEReceiptOriginatorSignatureValue;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::SetSMIMEReceiptOriginatorSignatureValueLen(const PRUint32 value)
-{
- mSMIMEReceiptOriginatorSignatureValueLen = value;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::GetSMIMEReceiptOriginatorSignatureValueLen(PRUint32 *_retval)
-{
- *_retval = mSMIMEReceiptOriginatorSignatureValueLen;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::SetSMIMEReceiptOriginatorContentType(PRUint8 *value)
-{
- mSMIMEReceiptOriginatorContentType = value;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::GetSMIMEReceiptOriginatorContentType(PRUint8 **_retval)
-{
- *_retval = mSMIMEReceiptOriginatorContentType;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::SetSMIMEReceiptOriginatorContentTypeLen(const PRUint32 value)
-{
- mSMIMEReceiptOriginatorContentTypeLen = value;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::GetSMIMEReceiptOriginatorContentTypeLen(PRUint32 *_retval)
-{
- *_retval = mSMIMEReceiptOriginatorContentTypeLen;
- return NS_OK;
-}
-
-//Secure Headers
-NS_IMETHODIMP nsMsgSMIMEComposeFields::AddSecureHeader(nsIMsgSMIMESecureHeader * secureHeader)
-{
- nsresult rv = NS_OK;
-
- if (!secureHeader)
- return NS_ERROR_FAILURE;
- rv=m_secureHeaders->AppendElement(secureHeader,PR_FALSE);
- return rv;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::GetSecureHeadersList(nsIMutableArray ** _SecureHeaders)
-{
- *_SecureHeaders=m_secureHeaders;
- NS_ADDREF(*_SecureHeaders);
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::ClearSecureHeaders()
-{
- if(m_secureHeaders)
- {
- m_secureHeaders->Clear();
- }
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::SetCanonAlgorithme(PRInt32 value)
-{
- mCanonAlgorithme=value;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::GetCanonAlgorithme(PRInt32 * retval)
-{
- *retval = mCanonAlgorithme;
- return NS_OK;
-}
-//
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::SetSMIMEReceiptMsgSigDigest(PRUint8 *value)
-{
- mSMIMEReceiptMsgSigDigest = value;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::GetSMIMEReceiptMsgSigDigest(PRUint8 **_retval)
-{
- *_retval = mSMIMEReceiptMsgSigDigest;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::SetSMIMEReceiptMsgSigDigestLen(const PRUint32 value)
-{
- mSMIMEReceiptMsgSigDigestLen = value;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::GetSMIMEReceiptMsgSigDigestLen(PRUint32 *_retval)
-{
- *_retval = mSMIMEReceiptMsgSigDigestLen;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::SetSecurityPolicyIdentifier(const nsAString &value)
-{
- mSecurityPolicyIdentifier = value;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::GetSecurityPolicyIdentifier(nsAString &_retval)
-{
- _retval = mSecurityPolicyIdentifier;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::SetSecurityClassification(PRInt32 value)
-{
- mSecurityClassification = value;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::GetSecurityClassification(PRInt32 *_retval)
-{
- *_retval = mSecurityClassification;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::SetPrivacyMark(const nsAString &value)
-{
- mPrivacyMark = value;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::GetPrivacyMark(nsAString &_retval)
-{
- _retval = mPrivacyMark;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::SetSecurityCategories(const nsAString &value)
-{
- mSecurityCategories = value;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsMsgSMIMEComposeFields::GetSecurityCategories(nsAString &_retval)
-{
- _retval = mSecurityCategories;
- return NS_OK;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// Implementation of nsMsgComposeSecure
-/////////////////////////////////////////////////////////////////////////////////////////
-
-NS_IMPL_ISUPPORTS1(nsMsgComposeSecure, nsIMsgComposeSecure)
-
-nsMsgComposeSecure::nsMsgComposeSecure()
-{
- /* member initializers and constructor code */
- mSigEncoderData = 0;
- mMultipartSignedBoundary = 0;
- mCryptoEncoderData = 0;
- mBuffer = 0;
- mBufferedBytes = 0;
- mCanonAlgorithme=0;
- mHasSecuritylabel = PR_FALSE;
- mSecurityClassification = -1;
-}
-
-nsMsgComposeSecure::~nsMsgComposeSecure()
-{
- /* destructor code */
- if (mEncryptionContext) {
- if (mBufferedBytes) {
- mEncryptionContext->Update(mBuffer, mBufferedBytes);
- mBufferedBytes = 0;
- }
- mEncryptionContext->Finish();
- }
-
- if (mSigEncoderData) {
- MIME_EncoderDestroy (mSigEncoderData, PR_TRUE);
- }
- if (mCryptoEncoderData) {
- MIME_EncoderDestroy (mCryptoEncoderData, PR_TRUE);
- }
-
- delete [] mBuffer;
-
- PR_FREEIF(mMultipartSignedBoundary);
-}
-
-NS_IMETHODIMP nsMsgComposeSecure::RequiresCryptoEncapsulation(nsIMsgIdentity * aIdentity, nsIMsgCompFields * aCompFields, PRBool * aRequiresEncryptionWork)
-{
- NS_ENSURE_ARG_POINTER(aRequiresEncryptionWork);
-
- nsresult rv = NS_OK;
- *aRequiresEncryptionWork = PR_FALSE;
-
- PRBool alwaysEncryptMessages = PR_FALSE;
- PRBool signMessage = PR_FALSE;
- rv = ExtractEncryptionState(aIdentity, aCompFields, &signMessage, &alwaysEncryptMessages);
-
- if (alwaysEncryptMessages || signMessage)
- *aRequiresEncryptionWork = PR_TRUE;
-
- return NS_OK;
-}
-
-
-nsresult nsMsgComposeSecure::GetSMIMEBundleString(const PRUnichar *name,
- PRUnichar **outString)
-{
- *outString = nsnull;
-
- NS_ENSURE_ARG_POINTER(name);
-
- if (!InitializeSMIMEBundle())
- return NS_ERROR_FAILURE;
-
- return NS_SUCCEEDED(mSMIMEBundle->GetStringFromName(name, outString));
-}
-
-nsresult
-nsMsgComposeSecure::
-SMIMEBundleFormatStringFromName(const PRUnichar *name,
- const PRUnichar **params,
- PRUint32 numParams,
- PRUnichar **outString)
-{
- NS_ENSURE_ARG_POINTER(name);
-
- if (!InitializeSMIMEBundle())
- return NS_ERROR_FAILURE;
-
- return mSMIMEBundle->FormatStringFromName(name, params,
- numParams, outString);
-}
-
-PRBool nsMsgComposeSecure::InitializeSMIMEBundle()
-{
- if (mSMIMEBundle)
- return PR_TRUE;
-
- nsCOMPtr<nsIStringBundleService> bundleService =
- do_GetService(NS_STRINGBUNDLE_CONTRACTID);
- nsresult rv = bundleService->CreateBundle(SMIME_STRBUNDLE_URL,
- getter_AddRefs(mSMIMEBundle));
- NS_ENSURE_SUCCESS(rv, PR_FALSE);
-
- return PR_TRUE;
-}
-
-void nsMsgComposeSecure::SetError(nsIMsgSendReport *sendReport, const PRUnichar *bundle_string)
-{
- if (!sendReport || !bundle_string)
- return;
-
- if (mErrorAlreadyReported)
- return;
-
- mErrorAlreadyReported = PR_TRUE;
-
- nsString errorString;
- nsresult res;
-
- res = GetSMIMEBundleString(bundle_string,
- getter_Copies(errorString));
-
- if (NS_SUCCEEDED(res) && !errorString.IsEmpty())
- {
- sendReport->SetMessage(nsIMsgSendReport::process_Current,
- errorString.get(),
- PR_TRUE);
- }
-}
-
-void nsMsgComposeSecure::SetErrorWithParam(nsIMsgSendReport *sendReport, const PRUnichar *bundle_string, const char *param)
-{
- if (!sendReport || !bundle_string || !param)
- return;
-
- if (mErrorAlreadyReported)
- return;
-
- mErrorAlreadyReported = PR_TRUE;
-
- nsString errorString;
- nsresult res;
- const PRUnichar *params[1];
-
- NS_ConvertASCIItoUTF16 ucs2(param);
- params[0]= ucs2.get();
-
- res = SMIMEBundleFormatStringFromName(bundle_string,
- params,
- 1,
- getter_Copies(errorString));
-
- if (NS_SUCCEEDED(res) && !errorString.IsEmpty())
- {
- sendReport->SetMessage(nsIMsgSendReport::process_Current,
- errorString.get(),
- PR_TRUE);
- }
-}
-
-nsresult nsMsgComposeSecure::ExtractEncryptionState(nsIMsgIdentity * aIdentity, nsIMsgCompFields * aComposeFields, PRBool * aSignMessage, PRBool * aEncrypt)
-{
- if (!aComposeFields && !aIdentity)
- return NS_ERROR_FAILURE; // kick out...invalid args....
-
- NS_ENSURE_ARG_POINTER(aSignMessage);
- NS_ENSURE_ARG_POINTER(aEncrypt);
-
- nsCOMPtr<nsISupports> securityInfo;
- if (aComposeFields)
- aComposeFields->GetSecurityInfo(getter_AddRefs(securityInfo));
-
- if (securityInfo) // if we were given security comp fields, use them.....
- {
- nsCOMPtr<nsIMsgSMIMECompFields> smimeCompFields = do_QueryInterface(securityInfo);
- if (smimeCompFields)
- {
- smimeCompFields->GetSignMessage(aSignMessage);
- smimeCompFields->GetRequireEncryptMessage(aEncrypt);
- return NS_OK;
- }
- }
-
- // get the default info from the identity....
- PRInt32 ep = 0;
- nsresult testrv = aIdentity->GetIntAttribute("encryptionpolicy", &ep);
- if (NS_FAILED(testrv)) {
- *aEncrypt = PR_FALSE;
- }
- else {
- *aEncrypt = (ep > 0);
- }
-
- testrv = aIdentity->GetBoolAttribute("sign_mail", aSignMessage);
- if (NS_FAILED(testrv))
- {
- *aSignMessage = PR_FALSE;
- }
- return NS_OK;
-}
-
-nsresult nsMsgComposeSecure::ExtractSMIMEReceiptState(nsIMsgIdentity *aIdentity,
- nsIMsgCompFields *aComposeFields,
- PRBool *aSMIMEReceiptRequest,
- PRBool *aSMIMEReceipt,
- PRUint8 **aSMIMEReceiptSignedContentIdentifier,
- PRUint32 *aSMIMEReceiptSignedContentIdentifierLen,
- PRUint8 **aSMIMEReceiptOriginatorSignatureValue,
- PRUint32 *aSMIMEReceiptOriginatorSignatureValueLen,
- PRUint8 **aSMIMEReceiptOriginatorContentType,
- PRUint32 *aSMIMEReceiptOriginatorContentTypeLen,
- PRUint8 **aSMIMEReceiptMsgSigDigest,
- PRUint32 *aSMIMEReceiptMsgSigDigestLen)
-{
- if (!aComposeFields && !aIdentity)
- return NS_ERROR_FAILURE; // kick out...invalid args....
-
- NS_ENSURE_ARG(aSMIMEReceiptRequest);
- NS_ENSURE_ARG(aSMIMEReceipt);
- NS_ENSURE_ARG(aSMIMEReceiptSignedContentIdentifier);
- NS_ENSURE_ARG(aSMIMEReceiptSignedContentIdentifierLen);
- NS_ENSURE_ARG(aSMIMEReceiptOriginatorSignatureValue);
- NS_ENSURE_ARG(aSMIMEReceiptOriginatorSignatureValueLen);
- NS_ENSURE_ARG(aSMIMEReceiptOriginatorContentType);
- NS_ENSURE_ARG(aSMIMEReceiptOriginatorContentTypeLen);
- NS_ENSURE_ARG(aSMIMEReceiptMsgSigDigest);
- NS_ENSURE_ARG(aSMIMEReceiptMsgSigDigestLen);
-
- *aSMIMEReceiptRequest = PR_FALSE;
- *aSMIMEReceipt = PR_FALSE;
-
- nsCOMPtr<nsISupports> securityInfo;
- if (aComposeFields)
- {
- aComposeFields->GetSecurityInfo(getter_AddRefs(securityInfo));
-
- if (securityInfo) // if we were given security comp fields, use them.....
- {
- nsCOMPtr<nsIMsgSMIMECompFields> smimeCompFields = do_QueryInterface(securityInfo);
- if (smimeCompFields)
- {
- /* Get SMIME receipt request */
- smimeCompFields->GetSMIMEReceiptRequest(aSMIMEReceiptRequest);
-
- if (*aSMIMEReceiptRequest)
- return NS_OK;
-
- /* Get SMIME receipt */
- smimeCompFields->GetSMIMEReceipt(aSMIMEReceipt);
- if (*aSMIMEReceipt)
- {
- smimeCompFields->GetSMIMEReceiptSignedContentIdentifier(aSMIMEReceiptSignedContentIdentifier);
- smimeCompFields->GetSMIMEReceiptSignedContentIdentifierLen(aSMIMEReceiptSignedContentIdentifierLen);
- smimeCompFields->GetSMIMEReceiptOriginatorSignatureValue(aSMIMEReceiptOriginatorSignatureValue);
- smimeCompFields->GetSMIMEReceiptOriginatorSignatureValueLen(aSMIMEReceiptOriginatorSignatureValueLen);
- smimeCompFields->GetSMIMEReceiptOriginatorContentType(aSMIMEReceiptOriginatorContentType);
- smimeCompFields->GetSMIMEReceiptOriginatorContentTypeLen(aSMIMEReceiptOriginatorContentTypeLen);
- smimeCompFields->GetSMIMEReceiptMsgSigDigest(aSMIMEReceiptMsgSigDigest);
- smimeCompFields->GetSMIMEReceiptMsgSigDigestLen(aSMIMEReceiptMsgSigDigestLen);
- return NS_OK;
- }
-
- }
- }
- }
-
- return NS_OK;
-}
-
-nsresult nsMsgComposeSecure::ExtractSecurityLabelState(nsIMsgCompFields * aComposeFields, PRBool * aHasSecuritylabel, nsAString& aSecurityPolicyIdentifier, PRInt32 * aSecurityClassification, nsAString& aPrivacyMark, nsAString& aSecurityCategories)
-{
- if (!aComposeFields)
- return NS_ERROR_FAILURE; // kick out...invalid args....
-
- NS_ENSURE_ARG_POINTER(aHasSecuritylabel);
- NS_ENSURE_ARG_POINTER(aSecurityClassification);
-
- nsCOMPtr<nsISupports> securityInfo;
- if (aComposeFields)
- {
- aComposeFields->GetSecurityInfo(getter_AddRefs(securityInfo));
-
- if (securityInfo) // if we were given security comp fields, use them.....
- {
- nsCOMPtr<nsIMsgSMIMECompFields> smimeCompFields = do_QueryInterface(securityInfo);
- if (smimeCompFields)
- {
- smimeCompFields->GetSecurityPolicyIdentifier(aSecurityPolicyIdentifier);
- smimeCompFields->GetSecurityClassification(aSecurityClassification);
- smimeCompFields->GetPrivacyMark(aPrivacyMark);
- smimeCompFields->GetSecurityCategories(aSecurityCategories);
- if (!aSecurityPolicyIdentifier.IsEmpty())
- *aHasSecuritylabel = PR_TRUE;
- }
- }
- }
-
- return NS_OK;
-}
-
-/* void beginCryptoEncapsulation (in nsOutputFileStream aStream, in boolean aEncrypt, in boolean aSign, in string aRecipeints, in boolean aIsDraft); */
-NS_IMETHODIMP nsMsgComposeSecure::BeginCryptoEncapsulation(nsIOutputStream * aStream,
- const char * aRecipients,
- nsIMsgCompFields * aCompFields,
- nsIMsgIdentity * aIdentity,
- nsIMsgSendReport *sendReport,
- PRBool aIsDraft)
-{
- mErrorAlreadyReported = PR_FALSE;
- nsresult rv = NS_OK;
-
- PRBool encryptMessages = PR_FALSE;
- PRBool signMessage = PR_FALSE;
- ExtractEncryptionState(aIdentity, aCompFields, &signMessage, &encryptMessages);
-
- if (!signMessage && !encryptMessages) return NS_ERROR_FAILURE;
-
- // Extract SMIME receipt request and receipt state
- mSMIMEReceiptRequest = PR_FALSE;
- ExtractSMIMEReceiptState(aIdentity,
- aCompFields,
- &mSMIMEReceiptRequest,
- &mSMIMEReceipt,
- &mSMIMEReceiptSignedContentIdentifier,
- &mSMIMEReceiptSignedContentIdentifierLen,
- &mSMIMEReceiptOriginatorSignatureValue,
- &mSMIMEReceiptOriginatorSignatureValueLen,
- &mSMIMEReceiptOriginatorContentType,
- &mSMIMEReceiptOriginatorContentTypeLen,
- &mSMIMEReceiptMsgSigDigest,
- &mSMIMEReceiptMsgSigDigestLen);
-
- //Extract Headers to secure
- ReadHeadersToSecure(aIdentity,aCompFields);
-
- if (mSMIMEReceiptRequest) {
- signMessage = PR_TRUE;
-
- /* Generate a random signed content identifier for the receipt request */
- nsCOMPtr<nsIMsgCompUtils> compUtils;
- compUtils = do_GetService(NS_MSGCOMPUTILS_CONTRACTID, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
- rv = compUtils->MsgGenerateMessageId(aIdentity, getter_Copies(mSMIMEReceiptRequestSignedContentIdentifier));
- NS_ENSURE_SUCCESS(rv, rv);
-
- /* Get sender address for the recipient field of the receipt request */
- aIdentity->GetEmail(mSMIMEReceiptRequestReceiptsTo);
- } else if (mSMIMEReceipt) {
- signMessage = PR_TRUE;
- }
-
- ExtractSecurityLabelState(aCompFields, &mHasSecuritylabel, mSecurityPolicyIdentifier, &mSecurityClassification, mPrivacyMark, mSecurityCategories);
-
- mStream = aStream;
- mIsDraft = aIsDraft;
-
- if (mSMIMEReceipt)
- mCryptoState = mime_crypto_signed_receipt;
- else if (encryptMessages && signMessage)
- mCryptoState = mime_crypto_signed_encrypted;
- else if (encryptMessages)
- mCryptoState = mime_crypto_encrypted;
- else if (signMessage)
- mCryptoState = mime_crypto_clear_signed;
- else
- PR_ASSERT(0);
-
- aIdentity->GetUnicharAttribute("signing_cert_name", mSigningCertName);
- aIdentity->GetUnicharAttribute("encryption_cert_name", mEncryptionCertName);
-
- rv = MimeCryptoHackCerts(aRecipients, sendReport, encryptMessages, signMessage);
- if (NS_FAILED(rv)) {
- goto FAIL;
- }
-
- switch (mCryptoState)
- {
- case mime_crypto_clear_signed:
- rv = MimeInitMultipartSigned(PR_TRUE, sendReport);
- break;
- case mime_crypto_opaque_signed:
- PR_ASSERT(0); /* #### no api for this yet */
- rv = NS_ERROR_NOT_IMPLEMENTED;
- break;
- case mime_crypto_signed_encrypted:
- rv = MimeInitEncryption(PR_TRUE, sendReport);
- break;
- case mime_crypto_encrypted:
- rv = MimeInitEncryption(PR_FALSE, sendReport);
- break;
- case mime_crypto_signed_receipt:
- /* Nothing to be done here */
- break;
- case mime_crypto_none:
- /* This can happen if mime_crypto_hack_certs() decided to turn off
- encryption (by asking the user.) */
- rv = 1;
- break;
- default:
- PR_ASSERT(0);
- break;
- }
-
-FAIL:
- return rv;
-}
-
-/* void finishCryptoEncapsulation (in boolean aAbort); */
-NS_IMETHODIMP nsMsgComposeSecure::FinishCryptoEncapsulation(PRBool aAbort, nsIMsgSendReport *sendReport)
-{
- nsresult rv = NS_OK;
-
- if (!aAbort) {
- switch (mCryptoState) {
- case mime_crypto_clear_signed:
- rv = MimeFinishMultipartSigned (PR_TRUE, sendReport);
- break;
- case mime_crypto_opaque_signed:
- PR_ASSERT(0); /* #### no api for this yet */
- rv = NS_ERROR_FAILURE;
- break;
- case mime_crypto_signed_encrypted:
- rv = MimeFinishEncryption (PR_TRUE, sendReport);
- break;
- case mime_crypto_encrypted:
- rv = MimeFinishEncryption (PR_FALSE, sendReport);
- break;
- case mime_crypto_signed_receipt:
- rv = MimeFinishSignedReceipt(sendReport);
- break;
- default:
- PR_ASSERT(0);
- rv = NS_ERROR_FAILURE;
- break;
- }
- }
- return rv;
-}
-
-nsresult nsMsgComposeSecure::MimeInitMultipartSigned(PRBool aOuter, nsIMsgSendReport *sendReport)
-{
- /* First, construct and write out the multipart/signed MIME header data.
- */
- nsresult rv = NS_OK;
- char *header = 0;
- PRUint32 L;
-
- rv = make_multipart_signed_header_string(aOuter, &header,
- &mMultipartSignedBoundary);
- if (NS_FAILED(rv)) goto FAIL;
-
- L = strlen(header);
-
- if (aOuter){
- /* If this is the outer block, write it to the file. */
- PRUint32 n;
- rv = mStream->Write(header, L, &n);
- if (NS_FAILED(rv) || n < L) {
- rv = MK_MIME_ERROR_WRITING_FILE;
- }
- } else {
- /* If this is an inner block, feed it through the crypto stream. */
- rv = MimeCryptoWriteBlock (header, L);
- }
-
- PR_Free(header);
- if (NS_FAILED(rv)) goto FAIL;
-
- /* Now initialize the crypto library, so that we can compute a hash
- on the object which we are signing.
- */
-
- mHashType = nsICryptoHash::SHA1;
-
- PR_SetError(0,0);
- mDataHash = do_CreateInstance("@mozilla.org/security/hash;1", &rv);
- if (NS_FAILED(rv)) return 0;
-
- rv = mDataHash->Init(mHashType);
- if (NS_FAILED(rv)) {
- goto FAIL;
- }
-
- PR_SetError(0,0);
- FAIL:
- return rv;
-}
-
-nsresult nsMsgComposeSecure::MimeInitEncryption(PRBool aSign, nsIMsgSendReport *sendReport)
-{
- nsresult rv;
-
- /* First, construct and write out the opaque-crypto-blob MIME header data.
- */
-
- char *s =
- PR_smprintf("Content-Type: " APPLICATION_PKCS7_MIME
- "; name=\"smime.p7m\"" CRLF
- "Content-Transfer-Encoding: " ENCODING_BASE64 CRLF
- "Content-Disposition: attachment"
- "; filename=\"smime.p7m\"" CRLF
- "Content-Description: %s" CRLF
- CRLF,
- MIME_SMIME_ENCRYPTED_CONTENT_DESCRIPTION);
- PRUint32 L;
- if (!s) return NS_ERROR_OUT_OF_MEMORY;
- L = strlen(s);
- PRUint32 n;
- rv = mStream->Write(s, L, &n);
- if (NS_FAILED(rv) || n < L) {
- return NS_ERROR_FAILURE;
- }
- PR_Free(s);
- s = 0;
-
- /* Now initialize the crypto library, so that we can filter the object
- to be encrypted through it.
- */
-
- if (!mIsDraft) {
- PRUint32 numCerts;
- mCerts->GetLength(&numCerts);
- PR_ASSERT(numCerts > 0);
- if (numCerts == 0) return NS_ERROR_FAILURE;
- }
-
- /* Initialize the base64 encoder. */
- PR_ASSERT(!mCryptoEncoderData);
- mCryptoEncoderData = MIME_B64EncoderInit(mime_encoder_output_fn,
- this);
- if (!mCryptoEncoderData) {
- return NS_ERROR_OUT_OF_MEMORY;
- }
-
- /* Initialize the encrypter (and add the sender's cert.) */
- PR_ASSERT(mSelfEncryptionCert);
- PR_SetError(0,0);
- mEncryptionCinfo = do_CreateInstance(NS_CMSMESSAGE_CONTRACTID, &rv);
- if (NS_FAILED(rv)) return rv;
- rv = mEncryptionCinfo->CreateEncrypted(mCerts);
- if (NS_FAILED(rv)) {
- SetError(sendReport, NS_LITERAL_STRING("ErrorCanNotEncrypt").get());
- goto FAIL;
- }
-
- mEncryptionContext = do_CreateInstance(NS_CMSENCODER_CONTRACTID, &rv);
- if (NS_FAILED(rv)) return rv;
-
- if (!mBuffer) {
- mBuffer = new char[eBufferSize];
- if (!mBuffer)
- return NS_ERROR_OUT_OF_MEMORY;
- }
-
- mBufferedBytes = 0;
-
- rv = mEncryptionContext->Start(mEncryptionCinfo, mime_crypto_write_base64, mCryptoEncoderData);
- if (NS_FAILED(rv)) {
- SetError(sendReport, NS_LITERAL_STRING("ErrorCanNotEncrypt").get());
- goto FAIL;
- }
-
- /* If we're signing, tack a multipart/signed header onto the front of
- the data to be encrypted, and initialize the sign-hashing code too.
- */
- if (aSign) {
- rv = MimeInitMultipartSigned(PR_FALSE, sendReport);
- if (NS_FAILED(rv)) goto FAIL;
- }
-
- FAIL:
- return rv;
-}
-
-nsresult nsMsgComposeSecure::MimeFinishMultipartSigned (PRBool aOuter, nsIMsgSendReport *sendReport)
-{
- int status;
- nsresult rv;
- nsCOMPtr<nsICMSMessage> cinfo = do_CreateInstance(NS_CMSMESSAGE_CONTRACTID, &rv);
- nsCOMPtr<nsICMSEncoder> encoder = do_CreateInstance(NS_CMSENCODER_CONTRACTID, &rv);
- char * header = nsnull;
-
- /* Compute the hash...
- */
-
- nsCAutoString hashString;
- mDataHash->Finish(PR_FALSE, hashString);
-
- mDataHash = 0;
-
- status = PR_GetError();
- if (status < 0) goto FAIL;
-
- /* Write out the headers for the signature.
- */
- PRUint32 L;
- header =
- PR_smprintf(CRLF
- "--%s" CRLF
- "Content-Type: " APPLICATION_PKCS7_SIGNATURE
- "; name=\"smime.p7s\"" CRLF
- "Content-Transfer-Encoding: " ENCODING_BASE64 CRLF
- "Content-Disposition: attachment; "
- "filename=\"smime.p7s\"" CRLF
- "Content-Description: %s" CRLF
- CRLF,
- mMultipartSignedBoundary,
- MIME_SMIME_SIGNATURE_CONTENT_DESCRIPTION);
- if (!header) {
- rv = NS_ERROR_OUT_OF_MEMORY;
- goto FAIL;
- }
-
- L = strlen(header);
- if (aOuter) {
- /* If this is the outer block, write it to the file. */
- PRUint32 n;
- rv = mStream->Write(header, L, &n);
- if (NS_FAILED(rv) || n < L) {
- rv = MK_MIME_ERROR_WRITING_FILE;
- }
- } else {
- /* If this is an inner block, feed it through the crypto stream. */
- rv = MimeCryptoWriteBlock (header, L);
- }
-
- PR_Free(header);
-
- /* Store the SMIME receipt request
- */
- if (mSMIMEReceiptRequest && !mSMIMEReceiptRequestReceiptsTo.IsEmpty())
- cinfo->SetReceiptRequest(mSMIMEReceiptRequestSignedContentIdentifier, mSMIMEReceiptRequestReceiptsTo);
-
- /* Store Security Label
- */
- if (mHasSecuritylabel)
- rv = cinfo->SetSecurityLabel(NS_ConvertUTF16toUTF8(mSecurityPolicyIdentifier), mSecurityClassification, NS_ConvertUTF16toUTF8(mPrivacyMark), NS_ConvertUTF16toUTF8(mSecurityCategories));
-
- /* Create the signature...
- */
-
- PR_ASSERT(mHashType == nsICryptoHash::SHA1);
-
- PR_ASSERT (mSelfSigningCert);
- PR_SetError(0,0);
-
- rv = cinfo->CreateSigned(mSelfSigningCert,
- mSelfEncryptionCert,
- (unsigned char*)hashString.get(),
- hashString.Length(),
- mSecureHeaders,
- mCanonAlgorithme);
-
- if (NS_FAILED(rv)) {
- SetError(sendReport, NS_LITERAL_STRING("ErrorCanNotSign").get());
- goto FAIL;
- }
-
- /* Initialize the base64 encoder for the signature data.
- */
- PR_ASSERT(!mSigEncoderData);
- mSigEncoderData =
- MIME_B64EncoderInit((aOuter
- ? mime_encoder_output_fn
- : mime_nested_encoder_output_fn),
- this);
- if (!mSigEncoderData) {
- rv = NS_ERROR_OUT_OF_MEMORY;
- goto FAIL;
- }
-
- /* Write out the signature.
- */
- PR_SetError(0,0);
- rv = encoder->Start(cinfo, mime_crypto_write_base64, mSigEncoderData);
- if (NS_FAILED(rv)) {
- SetError(sendReport, NS_LITERAL_STRING("ErrorCanNotSign").get());
- goto FAIL;
- }
-
- // We're not passing in any data, so no update needed.
- rv = encoder->Finish();
- if (NS_FAILED(rv)) {
- SetError(sendReport, NS_LITERAL_STRING("ErrorCanNotSign").get());
- goto FAIL;
- }
-
- /* Shut down the sig's base64 encoder.
- */
- rv = MIME_EncoderDestroy(mSigEncoderData, PR_FALSE);
- mSigEncoderData = 0;
- if (NS_FAILED(rv)) {
- goto FAIL;
- }
-
- /* Now write out the terminating boundary.
- */
- {
- PRUint32 L;
- char *header = PR_smprintf(CRLF "--%s--" CRLF,
- mMultipartSignedBoundary);
- PR_Free(mMultipartSignedBoundary);
- mMultipartSignedBoundary = 0;
-
- if (!header) {
- rv = NS_ERROR_OUT_OF_MEMORY;
- goto FAIL;
- }
- L = strlen(header);
- if (aOuter) {
- /* If this is the outer block, write it to the file. */
- PRUint32 n;
- rv = mStream->Write(header, L, &n);
- if (NS_FAILED(rv) || n < L)
- rv = MK_MIME_ERROR_WRITING_FILE;
- } else {
- /* If this is an inner block, feed it through the crypto stream. */
- rv = MimeCryptoWriteBlock (header, L);
- }
- }
-
-FAIL:
- return rv;
-}
-
-nsresult nsMsgComposeSecure::MimeFinishSignedReceipt(nsIMsgSendReport *sendReport)
-{
- nsresult rv;
- PRUint32 L;
- PRUint32 n;
- PRUint8 *encodedReceiptObject = NULL;
- PRUint32 encodedReceiptObjectLen = 0;
-
- nsCOMPtr<nsICMSMessage> cinfo = do_CreateInstance(NS_CMSMESSAGE_CONTRACTID, &rv);
- nsCOMPtr<nsICMSEncoder> encoder = do_CreateInstance(NS_CMSENCODER_CONTRACTID, &rv);
- char * header = nsnull;
-
- /* Write out the headers for the signature.
- */
- header = PR_smprintf("Content-Type: " APPLICATION_PKCS7_MIME "; smime-type=signed-receipt; name=\"smime.p7m\"" CRLF
- "Content-Transfer-Encoding: " ENCODING_BASE64 CRLF
- "Content-Disposition: attachment; filename=\"smime.p7m\"" CRLF
- "Content-Description: %s" CRLF CRLF,
- MIME_SMIME_RECEIPT_CONTENT_DESCRIPTION);
-
- if (!header) {
- rv = NS_ERROR_OUT_OF_MEMORY;
- goto FAIL;
- }
-
- L = strlen(header);
- rv = mStream->Write(header, L, &n);
- if (NS_FAILED(rv) || n < L)
- rv = MK_MIME_ERROR_WRITING_FILE;
- PR_smprintf_free(header);
-
- /* Store the SMIME receipt values
- */
- cinfo->SetReceipt(mSMIMEReceiptSignedContentIdentifier,
- mSMIMEReceiptSignedContentIdentifierLen,
- mSMIMEReceiptOriginatorSignatureValue,
- mSMIMEReceiptOriginatorSignatureValueLen,
- mSMIMEReceiptOriginatorContentType,
- mSMIMEReceiptOriginatorContentTypeLen,
- mSMIMEReceiptMsgSigDigest,
- mSMIMEReceiptMsgSigDigestLen);
-
- /* Create the signature...
- */
-
- PR_ASSERT (mSelfSigningCert);
- PR_SetError(0, 0);
-
- rv = cinfo->CreateSigned(mSelfSigningCert, mSelfEncryptionCert, NULL, 0,NULL,0);
- if (NS_FAILED(rv)) {
- SetError(sendReport, NS_LITERAL_STRING("ErrorCanNotSign").get());
- goto FAIL;
- }
-
- /* Create receipt object and set message digest */
- rv = cinfo->CreateReceipt(&encodedReceiptObject, &encodedReceiptObjectLen);
- if (NS_FAILED(rv)) {
- SetError(sendReport, NS_LITERAL_STRING("ErrorCanNotSign").get());
- goto FAIL;
- }
-
- /* Initialize the base64 encoder for the signature data.
- */
- PR_ASSERT(!mSigEncoderData);
- mSigEncoderData =
- MIME_B64EncoderInit(mime_encoder_output_fn, this);
- if (!mSigEncoderData) {
- rv = NS_ERROR_OUT_OF_MEMORY;
- goto FAIL;
- }
-
- /* Write out the signature.
- */
- PR_SetError(0, 0);
- rv = encoder->Start(cinfo, mime_crypto_write_base64, mSigEncoderData);
- if (NS_FAILED(rv)) {
- SetError(sendReport, NS_LITERAL_STRING("ErrorCanNotSign").get());
- goto FAIL;
- }
-
- /* Attach receipt object to the signature */
- rv = encoder->Update((char*)encodedReceiptObject, (PRInt32)encodedReceiptObjectLen);
- if (NS_FAILED(rv)) {
- SetError(sendReport, NS_LITERAL_STRING("ErrorCanNotSign").get());
- goto FAIL;
- }
-
- rv = encoder->Finish();
- if (NS_FAILED(rv)) {
- SetError(sendReport, NS_LITERAL_STRING("ErrorCanNotSign").get());
- goto FAIL;
- }
-
- /* Shut down the sig's base64 encoder.
- */
- rv = MIME_EncoderDestroy(mSigEncoderData, PR_FALSE);
- mSigEncoderData = 0;
- if (NS_FAILED(rv))
- goto FAIL;
-
- rv = mStream->Write(CRLF, 2, &n);
- if (NS_FAILED(rv) || n < 2)
- rv = NS_ERROR_FAILURE;
-
-FAIL:
- return rv;
-}
-
-/* Helper function for mime_finish_crypto_encapsulation() to close off
- an opaque crypto object (for encrypted or signed-and-encrypted messages.)
- */
-nsresult nsMsgComposeSecure::MimeFinishEncryption (PRBool aSign, nsIMsgSendReport *sendReport)
-{
- nsresult rv;
-
- /* If this object is both encrypted and signed, close off the
- signature first (since it's inside.) */
- if (aSign) {
- rv = MimeFinishMultipartSigned (PR_FALSE, sendReport);
- if (NS_FAILED(rv)) {
- goto FAIL;
- }
- }
-
- /* Close off the opaque encrypted blob.
- */
- PR_ASSERT(mEncryptionContext);
-
- if (mBufferedBytes) {
- rv = mEncryptionContext->Update(mBuffer, mBufferedBytes);
- mBufferedBytes = 0;
- if (NS_FAILED(rv)) {
- PR_ASSERT(PR_GetError() < 0);
- goto FAIL;
- }
- }
-
- rv = mEncryptionContext->Finish();
- if (NS_FAILED(rv)) {
- SetError(sendReport, NS_LITERAL_STRING("ErrorCanNotEncrypt").get());
- goto FAIL;
- }
-
- mEncryptionContext = 0;
-
- PR_ASSERT(mEncryptionCinfo);
- if (!mEncryptionCinfo) {
- rv = NS_ERROR_FAILURE;
- }
- if (mEncryptionCinfo) {
- mEncryptionCinfo = 0;
- }
-
- /* Shut down the base64 encoder. */
- rv = MIME_EncoderDestroy(mCryptoEncoderData, PR_FALSE);
- mCryptoEncoderData = 0;
-
- PRUint32 n;
- rv = mStream->Write(CRLF, 2, &n);
- if (NS_FAILED(rv) || n < 2)
- rv = NS_ERROR_FAILURE;
-
- FAIL:
- return rv;
-}
-
-/* Used to figure out what certs should be used when encrypting this message.
- */
-nsresult nsMsgComposeSecure::MimeCryptoHackCerts(const char *aRecipients,
- nsIMsgSendReport *sendReport,
- PRBool aEncrypt,
- PRBool aSign)
-{
- char *mailbox_list = 0;
- nsCString all_mailboxes, mailboxes;
- const char *mailbox = 0;
- PRUint32 count = 0;
- nsCOMPtr<nsIX509CertDB> certdb = do_GetService(NS_X509CERTDB_CONTRACTID);
- nsresult res;
- nsCOMPtr<nsIMsgHeaderParser> pHeader = do_GetService(NS_MAILNEWS_MIME_HEADER_PARSER_CONTRACTID, &res);
- NS_ENSURE_SUCCESS(res,res);
-
- mCerts = do_CreateInstance(NS_ARRAY_CONTRACTID, &res);
- if (NS_FAILED(res)) {
- return res;
- }
-
- PR_ASSERT(aEncrypt || aSign);
- certdb->FindEmailEncryptionCert(mEncryptionCertName, getter_AddRefs(mSelfEncryptionCert));
- certdb->FindEmailSigningCert(mSigningCertName, getter_AddRefs(mSelfSigningCert));
-
- // must have both the signing and encryption certs to sign
- if ((mSelfSigningCert == nsnull) && aSign) {
- SetError(sendReport, NS_LITERAL_STRING("NoSenderSigningCert").get());
- res = NS_ERROR_FAILURE;
- goto FAIL;
- }
-
- if ((mSelfEncryptionCert == nsnull) && aEncrypt) {
- SetError(sendReport, NS_LITERAL_STRING("NoSenderEncryptionCert").get());
- res = NS_ERROR_FAILURE;
- goto FAIL;
- }
-
- pHeader->ExtractHeaderAddressMailboxes(nsDependentCString(aRecipients),
- all_mailboxes);
- pHeader->RemoveDuplicateAddresses(all_mailboxes, EmptyCString(), mailboxes);
-
- pHeader->ParseHeaderAddresses(mailboxes.get(), 0, &mailbox_list, &count);
-
- if (count < 0) return count;
-
- if (aEncrypt && mSelfEncryptionCert) {
- // Make sure self's configured cert is prepared for being used
- // as an email recipient cert.
-
- nsCOMPtr<nsISMimeCert> sc = do_QueryInterface(mSelfEncryptionCert);
- if (sc) {
- sc->SaveSMimeProfile();
- }
- }
-
- /* If the message is to be encrypted, then get the recipient certs */
- if (aEncrypt) {
- mailbox = mailbox_list;
-
- PRBool already_added_self_cert = PR_FALSE;
-
- for (; count > 0; count--) {
- nsCString mailbox_lowercase;
- ToLowerCase(nsDependentCString(mailbox), mailbox_lowercase);
- nsCOMPtr<nsIX509Cert> cert;
- certdb->FindCertByEmailAddress(nsnull, mailbox_lowercase.get(), getter_AddRefs(cert));
- PRBool foundValidCert = PR_FALSE;
-
- if (cert) {
- PRUint32 verification_result;
-
- if (NS_SUCCEEDED(
- cert->VerifyForUsage(nsIX509Cert::CERT_USAGE_EmailRecipient, &verification_result))
- &&
- nsIX509Cert::VERIFIED_OK == verification_result)
- {
- foundValidCert = PR_TRUE;
- }
- }
-
- if (!foundValidCert) {
- // Failure to find a valid encryption cert is fatal.
- // here I assume that mailbox contains ascii rather than utf8.
- SetErrorWithParam(sendReport, NS_LITERAL_STRING("MissingRecipientEncryptionCert").get(), mailbox);
- res = NS_ERROR_FAILURE;
- goto FAIL;
- }
-
- /* #### see if recipient requests `signedData'.
- if (...) no_clearsigning_p = PR_TRUE;
- (This is the only reason we even bother looking up the certs
- of the recipients if we're sending a signed-but-not-encrypted
- message.)
- */
-
- PRBool isSame;
- if (NS_SUCCEEDED(cert->Equals(mSelfEncryptionCert, &isSame))
- && isSame) {
- already_added_self_cert = PR_TRUE;
- }
-
- mCerts->AppendElement(cert, PR_FALSE);
- // To understand this loop, especially the "+= strlen +1", look at the documentation
- // of ParseHeaderAddresses. Basically, it returns a list of zero terminated strings.
- mailbox += strlen(mailbox) + 1;
- }
-
- if (!already_added_self_cert) {
- mCerts->AppendElement(mSelfEncryptionCert, PR_FALSE);
- }
- }
-FAIL:
- if (mailbox_list) {
- nsMemory::Free(mailbox_list);
- }
- return res;
-}
-
-NS_IMETHODIMP nsMsgComposeSecure::MimeCryptoWriteBlock (const char *buf, PRInt32 size)
-{
- int status = 0;
- nsresult rv;
-
- /* If this is a From line, mangle it before signing it. You just know
- that something somewhere is going to mangle it later, and that's
- going to cause the signature check to fail.
-
- (This assumes that, in the cases where From-mangling must happen,
- this function is called a line at a time. That happens to be the
- case.)
- */
- if (size >= 5 && buf[0] == 'F' && !strncmp(buf, "From ", 5)) {
- char mangle[] = ">";
- status = MimeCryptoWriteBlock (mangle, 1);
- if (status < 0)
- return status;
- }
-
- /* If we're signing, or signing-and-encrypting, feed this data into
- the computation of the hash. */
- if (mDataHash) {
- PR_SetError(0,0);
- mDataHash->Update((const PRUint8*) buf, size);
- status = PR_GetError();
- if (status < 0) goto FAIL;
- }
-
- PR_SetError(0,0);
- if (mEncryptionContext) {
- /* If we're encrypting, or signing-and-encrypting, write this data
- by filtering it through the crypto library. */
-
- /* We want to create equally sized encryption strings */
- const char *inputBytesIterator = buf;
- PRUint32 inputBytesLeft = size;
-
- while (inputBytesLeft) {
- const PRUint32 spaceLeftInBuffer = eBufferSize - mBufferedBytes;
- const PRUint32 bytesToAppend = NS_MIN(inputBytesLeft, spaceLeftInBuffer);
-
- memcpy(mBuffer+mBufferedBytes, inputBytesIterator, bytesToAppend);
- mBufferedBytes += bytesToAppend;
-
- inputBytesIterator += bytesToAppend;
- inputBytesLeft -= bytesToAppend;
-
- if (eBufferSize == mBufferedBytes) {
- rv = mEncryptionContext->Update(mBuffer, mBufferedBytes);
- mBufferedBytes = 0;
- if (NS_FAILED(rv)) {
- status = PR_GetError();
- PR_ASSERT(status < 0);
- if (status >= 0) status = -1;
- goto FAIL;
- }
- }
- }
- } else {
- /* If we're not encrypting (presumably just signing) then write this
- data directly to the file. */
-
- PRUint32 n;
- rv = mStream->Write(buf, size, &n);
- if (NS_FAILED(rv) || n < size) {
- return MK_MIME_ERROR_WRITING_FILE;
- }
- }
- FAIL:
- return status;
-}
-
-
-/*
- * unfold string sequence : CRLF sequences followed by WSP will be interpreted without the CRLF
- */
-nsAutoString& removeJumpSymb(nsAutoString& s)
-{
- s.ReplaceSubstring(NS_LITERAL_STRING("\n\r "), NS_LITERAL_STRING(" "));
- s.ReplaceSubstring(NS_LITERAL_STRING("\r\n "), NS_LITERAL_STRING(" "));
- s.ReplaceSubstring(NS_LITERAL_STRING("\r "), NS_LITERAL_STRING(" "));
- s.ReplaceSubstring(NS_LITERAL_STRING("\n "), NS_LITERAL_STRING(" "));
- s.ReplaceSubstring(NS_LITERAL_STRING("\n\r\t"), NS_LITERAL_STRING(" "));
- s.ReplaceSubstring(NS_LITERAL_STRING("\r\n\t"), NS_LITERAL_STRING(" "));
- s.ReplaceSubstring(NS_LITERAL_STRING("\r\t"), NS_LITERAL_STRING(" "));
- s.ReplaceSubstring(NS_LITERAL_STRING("\n\t"), NS_LITERAL_STRING(" "));
-
- return s;
-}
-
-/*
- * Convert all sequences of one ore more WSP characters to a single SP character
- */
-nsAutoString& onlyOneWhiteSpace(nsAutoString& s){
- s.ReplaceSubstring(NS_LITERAL_STRING("\t"), NS_LITERAL_STRING(" "));
- s.ReplaceSubstring(NS_LITERAL_STRING(" "), NS_LITERAL_STRING(" "));
-
- return s;
-}
-
-
-nsAutoString& canonilizeHeaderValue(nsAutoString &hdrval)
-{
- removeJumpSymb(hdrval);
- onlyOneWhiteSpace(hdrval);
- hdrval.CompressWhitespace(PR_TRUE,PR_TRUE);
- return hdrval;
-}
-
-nsAutoString& canonilizeHeaderName(nsAutoString &hdrname)
-{
- nsCAutoString utf8str = NS_ConvertUTF16toUTF8(hdrname);
- ToLowerCase(utf8str);
- hdrname = NS_ConvertUTF8toUTF16(utf8str);
- onlyOneWhiteSpace(hdrname);
- hdrname.CompressWhitespace(PR_TRUE,PR_TRUE);
- return hdrname;
-}
-
-void strsplit(const char separator, nsAString& strToSplit, nsStringArray & result)
-{
- PRInt32 start = 0;
- PRInt32 end = 0;
- PRInt32 len = 0;
-
- while (end != -1) {
- end = strToSplit.FindChar(separator,start);
- if (end == -1) {
- len = strToSplit.Length() - start;
- } else {
- len = end - start;
- }
- // grab the name of the current header pref
- const nsAString& str_tmp = Substring(strToSplit, start, end);
-
- start = end + 1;
- result.AppendString(str_tmp);
- }
-
-}
-
-/*
- Parse extended headers
- */
-void parseHeaderValue(const nsAString & str, const nsAString& headerName, nsAString & headerVal)
-{
- nsVoidArray tab_header;
- nsAutoString ligne_header;
- nsAutoString tmpstr(str);
- nsAString::const_iterator cur_pos_str,cur_pos_CRLF,start,end;
-
- tmpstr.BeginReading(start);
- tmpstr.EndReading(end);
-
- cur_pos_str=start;
- cur_pos_CRLF=end;
- NS_NAMED_LITERAL_STRING(valuePrefix, "\r\n");
-
- while(FindInReadable(valuePrefix, start, end))
- {
- cur_pos_CRLF = end;
- if(*cur_pos_CRLF == PRUnichar(' '))
- {
- ligne_header.Append(Substring(cur_pos_CRLF.start(),cur_pos_CRLF.get()));
- tmpstr.Replace(0,end.get()-end.start(),NS_LITERAL_STRING(""));
- }
- else
- {
- ligne_header.Append(Substring(cur_pos_CRLF.start(),cur_pos_CRLF.get()));
- nsAutoString _hdrName;
- nsAutoString _hdrValue;
-
- _hdrName.Assign(Substring(ligne_header,0,ligne_header.FindChar(':',0)));
- _hdrValue.Assign(Substring(ligne_header,ligne_header.FindChar(':',0)+2,ligne_header.Length()-ligne_header.FindChar(':',0)+1));
- if(_hdrName.Equals(headerName)){
- headerVal.Assign(_hdrValue);
- break;
- }
- ligne_header.Assign(NS_LITERAL_STRING(""));
- tmpstr.Replace(0,end.get()-end.start(),NS_LITERAL_STRING(""));
- }
-
- tmpstr.BeginReading(start);
- tmpstr.EndReading(end);
- }
-}
-
-/*
- Returns mime encoded value
- */
-void GetMimeEncodedValue(nsAString& headerName, nsAString& charset, PRBool bstructured, nsAString & value, nsAString & result){
- nsresult rv;
- char * tmp;
- tmp=NULL;
- nsCOMPtr<nsIMimeConverter> mimeconverter = do_GetService(NS_MIME_CONVERTER_CONTRACTID, &rv);
-
- mimeconverter->EncodeMimePartIIStr_UTF8(NS_ConvertUTF16toUTF8(value),
- bstructured,
- NS_ConvertUTF16toUTF8(charset).get(),
- (PRInt32)headerName.Length()+2, // header len + 2 characters semi-colon and space ": "
- nsIMimeConverter::MIME_ENCODED_WORD_SIZE,
- &tmp);
- if(tmp!=NULL)
- {
- result.Assign(NS_ConvertUTF8toUTF16(tmp));
- }
- else{
- result.Assign(value);
- }
-}
-
-/*
- Returns value of header as mime encoded format
- */
-void GetValueHeader(nsAString& headerName,nsIMsgCompFields * aComposeFields, nsAString & result)
-{
- nsresult rv;
- nsAutoString otherHeaders;
- nsAutoString to;
- nsAutoString from;
- nsAutoString subject;
- nsAutoString cc;
- nsAutoString bcc;
- nsAutoString body;
- nsAutoString messageId;
- nsAutoString priority;
- nsAutoString replyTo;
- nsAutoString charset;
-
- aComposeFields->GetTo(to);
- aComposeFields->GetFrom(from);
- aComposeFields->GetSubject(subject);
- aComposeFields->GetCc(cc);
- aComposeFields->GetBcc(bcc);
- aComposeFields->GetBody(body);
- aComposeFields->GetOtherRandomHeaders(otherHeaders);
- aComposeFields->GetReplyTo(replyTo);
- char * tmp;
- aComposeFields->GetMessageId(&tmp);
- messageId=NS_ConvertASCIItoUTF16(tmp);
- aComposeFields->GetPriority(&tmp);
- priority=NS_ConvertASCIItoUTF16(tmp);
- aComposeFields->GetCharacterSet(&tmp);
- charset=NS_ConvertASCIItoUTF16(tmp);
- if(charset.IsEmpty()){
- aComposeFields->GetDefaultCharacterSet(&tmp);
- charset=NS_ConvertASCIItoUTF16(tmp);
- }
-
- //replace the tabulation by a space for each header
- //which can be multiline to simplify the treatment
- to.ReplaceSubstring(NS_LITERAL_STRING("\t"), NS_LITERAL_STRING(" "));
- cc.ReplaceSubstring(NS_LITERAL_STRING("\t"), NS_LITERAL_STRING(" "));
- bcc.ReplaceSubstring(NS_LITERAL_STRING("\t"), NS_LITERAL_STRING(" "));
-
- if(headerName.LowerCaseEqualsLiteral("from")){
- if(!from.IsEmpty()){
- GetMimeEncodedValue(headerName, charset, PR_TRUE, from, result);
- return;
- }
- }
- else if(headerName.LowerCaseEqualsLiteral("to")){
- if(!to.IsEmpty()){
- GetMimeEncodedValue(headerName, charset, PR_TRUE, to, result);
- return;
- }
- }
- else if(headerName.LowerCaseEqualsLiteral("body")){
- if(!body.IsEmpty()){
- GetMimeEncodedValue(headerName, charset, PR_FALSE, body, result);
- return;
- }
- }
- else if(headerName.LowerCaseEqualsLiteral("subject")){
- if(!subject.IsEmpty()){
- GetMimeEncodedValue(headerName, charset, PR_FALSE, subject, result);
- return;
- }
- }
- else if(headerName.LowerCaseEqualsLiteral("cc")){
- if(!cc.IsEmpty()){
- GetMimeEncodedValue(headerName, charset, PR_TRUE, cc, result);
- return;
- }
- }
- else if(headerName.LowerCaseEqualsLiteral("bcc")){
- if(!bcc.IsEmpty()){
- GetMimeEncodedValue(headerName, charset, PR_TRUE, bcc, result);
- return;
- }
- }
- else if(headerName.LowerCaseEqualsLiteral("message-id")){
- if(!messageId.IsEmpty())
- result.Assign(messageId);
- }
- else if(headerName.LowerCaseEqualsLiteral("priority")){
- if(!priority.IsEmpty())
- result.Assign(priority);
- }
- else if(headerName.LowerCaseEqualsLiteral("reply-to")){
- if(!replyTo.IsEmpty()){
- GetMimeEncodedValue(headerName, charset, PR_TRUE, replyTo, result);
- return;
- }
- }
- else{
- parseHeaderValue(otherHeaders,headerName,result);
- }
-
-}
-
-/*
- Returns array of secure headers
- */
-nsresult nsMsgComposeSecure::ReadHeadersToSecure(nsIMsgIdentity * aIdentity,nsIMsgCompFields * aComposeFields){
-
- //Extract Signed Headers list
- nsCOMPtr<nsISupports> securityInfo;
- if (aComposeFields)
- {
- aComposeFields->GetSecurityInfo(getter_AddRefs(securityInfo));
-
- if (securityInfo) // if we were given security comp fields, use them.....
- {
- nsCOMPtr<nsIMsgSMIMECompFields> smimeCompFields = do_QueryInterface(securityInfo);
- if (smimeCompFields)
- {
- nsCOMPtr<nsIMutableArray> tmpHeaders;
- smimeCompFields->GetSecureHeadersList(getter_AddRefs(tmpHeaders));
- smimeCompFields->GetCanonAlgorithme(&mCanonAlgorithme);
- if(tmpHeaders)
- {
- nsresult rv;
- mSecureHeaders = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
- PRUint32 nbHeaders;
- tmpHeaders->GetLength(&nbHeaders);
-
- for(int i=0;i<nbHeaders;++i)
- {
- nsCOMPtr<nsIMsgSMIMESecureHeader> _secureHeader= do_QueryElementAt(tmpHeaders,i);
- if(_secureHeader)
- {
- nsAutoString _headerName;
- nsAutoString _headerValue;
- PRInt32 _headerStatus;
- _secureHeader->GetHeaderName(_headerName);
- GetValueHeader(_headerName,aComposeFields,_headerValue);
- if(!_headerValue.IsEmpty()){
-
- if(mCanonAlgorithme){
- canonilizeHeaderName(_headerName);
- canonilizeHeaderValue(_headerValue);
- }
- _secureHeader->SetHeaderName(_headerName);
- _secureHeader->SetHeaderValue(_headerValue);
- mSecureHeaders->AppendElement(_secureHeader,PR_FALSE);
- }
- }
- }
- }
- }
- }
- }
-
- return NS_OK;
-}
-
-/* Returns a string consisting of a Content-Type header, and a boundary
- string, suitable for moving from the header block, down into the body
- of a multipart object. The boundary itself is also returned (so that
- the caller knows what to write to close it off.)
- */
-static int
-make_multipart_signed_header_string(PRBool outer_p,
- char **header_return,
- char **boundary_return)
-{
- *header_return = 0;
- *boundary_return = mime_make_separator("ms");
- const char * crypto_multipart_blurb = nsnull;
-
- if (!*boundary_return)
- return NS_ERROR_OUT_OF_MEMORY;
-
- if (outer_p) {
- crypto_multipart_blurb = MIME_MULTIPART_SIGNED_BLURB;
- }
-
- *header_return = PR_smprintf(
- "Content-Type: " MULTIPART_SIGNED "; "
- "protocol=\"" APPLICATION_PKCS7_SIGNATURE "\"; "
- "micalg=" PARAM_MICALG_SHA1 "; "
- "boundary=\"%s\"" CRLF
- CRLF
- "%s%s"
- "--%s" CRLF,
-
- *boundary_return,
- (crypto_multipart_blurb ? crypto_multipart_blurb : ""),
- (crypto_multipart_blurb ? CRLF CRLF : ""),
- *boundary_return);
-
- if (!*header_return) {
- PR_Free(*boundary_return);
- *boundary_return = 0;
- return NS_ERROR_OUT_OF_MEMORY;
- }
-
- return 0;
-}
-
-/* Used as the output function of a SEC_PKCS7EncoderContext -- we feed
- plaintext into the crypto engine, and it calls this function with encrypted
- data; then this function writes a base64-encoded representation of that
- data to the file (by filtering it through the given MimeEncoderData object.)
-
- Also used as the output function of SEC_PKCS7Encode() -- but in that case,
- it's used to write the encoded representation of the signature. The only
- difference is which MimeEncoderData object is used.
- */
-static void
-mime_crypto_write_base64 (void *closure, const char *buf,
- unsigned long size)
-{
- MimeEncoderData *data = (MimeEncoderData *) closure;
- int status = MIME_EncoderWrite (data, buf, size);
- PR_SetError(status < 0 ? status : 0, 0);
-}
-
-
-/* Used as the output function of MimeEncoderData -- when we have generated
- the signature for a multipart/signed object, this is used to write the
- base64-encoded representation of the signature to the file.
- */
-nsresult mime_encoder_output_fn(const char *buf, PRInt32 size, void *closure)
-{
- nsMsgComposeSecure *state = (nsMsgComposeSecure *) closure;
- nsCOMPtr<nsIOutputStream> stream;
- state->GetOutputStream(getter_AddRefs(stream));
- PRUint32 n;
- nsresult rv = stream->Write((char *) buf, size, &n);
- if (NS_FAILED(rv) || n < size)
- return MK_MIME_ERROR_WRITING_FILE;
- else
- return 0;
-}
-
-/* Like mime_encoder_output_fn, except this is used for the case where we
- are both signing and encrypting -- the base64-encoded output of the
- signature should be fed into the crypto engine, rather than being written
- directly to the file.
- */
-static nsresult
-mime_nested_encoder_output_fn (const char *buf, PRInt32 size, void *closure)
-{
- nsMsgComposeSecure *state = (nsMsgComposeSecure *) closure;
- return state->MimeCryptoWriteBlock ((char *) buf, size);
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-\r
+ *\r
+ * ***** BEGIN LICENSE BLOCK *****\r
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1\r
+ *\r
+ * The contents of this file are subject to the Mozilla Public License Version\r
+ * 1.1 (the "License"); you may not use this file except in compliance with\r
+ * the License. You may obtain a copy of the License at\r
+ * http://www.mozilla.org/MPL/\r
+ *\r
+ * Software distributed under the License is distributed on an "AS IS" basis,\r
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License\r
+ * for the specific language governing rights and limitations under the\r
+ * License.\r
+ *\r
+ * The Original Code is mozilla.org code.\r
+ *\r
+ * The Initial Developer of the Original Code is\r
+ * Netscape Communications Corporation.\r
+ * Portions created by the Initial Developer are Copyright (C) 1998\r
+ * the Initial Developer. All Rights Reserved.\r
+ *\r
+ * Contributor(s):\r
+ * David Drinan <ddrinan@netscape.com>\r
+ * Stephane Saux <ssaux@netscape.com>\r
+ * ESS Signed Receipts: Raphael Fairise / BT Global Services / Etat francais - Ministere de la Defense\r
+ * Copyright (c) 2010 CASSIDIAN - All rights reserved\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
+ * ***** END LICENSE BLOCK ***** */\r
+\r
+#include "nsMsgComposeSecure.h"\r
+\r
+#include "msgCore.h"\r
+#include "nsIMsgCompFields.h"\r
+#include "nsIMsgCompUtils.h"\r
+#include "nsIMsgHeaderParser.h"\r
+#include "nsIMsgIdentity.h"\r
+#include "nsISMimeCert.h"\r
+#include "nsIX509CertDB.h"\r
+#include "nsMimeTypes.h"\r
+#include "nsMsgMimeCID.h"\r
+#include "nsMsgCompCID.h"\r
+#include "nspr.h"\r
+#include "nsArrayUtils.h"\r
+\r
+// XXX These strings should go in properties file XXX //\r
+#define MIME_MULTIPART_SIGNED_BLURB "This is a cryptographically signed message in MIME format."\r
+#define MIME_SMIME_ENCRYPTED_CONTENT_DESCRIPTION "S/MIME Encrypted Message"\r
+#define MIME_SMIME_SIGNATURE_CONTENT_DESCRIPTION "S/MIME Cryptographic Signature"\r
+#define MIME_SMIME_RECEIPT_CONTENT_DESCRIPTION "S/MIME Receipt"\r
+\r
+#define MK_MIME_ERROR_WRITING_FILE -1\r
+\r
+#define SMIME_STRBUNDLE_URL "chrome://messenger/locale/am-smime.properties"\r
+\r
+static void mime_crypto_write_base64 (void *closure, const char *buf,\r
+ unsigned long size);\r
+static nsresult mime_encoder_output_fn(const char *buf, PRInt32 size, void *closure);\r
+static nsresult mime_nested_encoder_output_fn (const char *buf, PRInt32 size, void *closure);\r
+static int make_multipart_signed_header_string(PRBool outer_p,\r
+ char **header_return,\r
+ char **boundary_return);\r
+static char *mime_make_separator(const char *prefix);\r
+\r
+// mscott --> FIX ME...for now cloning code from compose\nsMsgEncode.h/.cpp\r
+\r
+MimeEncoderData *\r
+MIME_B64EncoderInit(nsresult (* output_fn) (const char *buf, PRInt32 size, void *closure), void *closure) \r
+{\r
+ MimeEncoderData *returnEncoderData = nsnull;\r
+ nsIMimeConverter *converter;\r
+ nsresult res = CallCreateInstance(NS_MIME_CONVERTER_CONTRACTID, &converter);\r
+ if (NS_SUCCEEDED(res) && nsnull != converter) \r
+ {\r
+ res = converter->B64EncoderInit(output_fn, closure, &returnEncoderData);\r
+ NS_RELEASE(converter);\r
+ }\r
+ return NS_SUCCEEDED(res) ? returnEncoderData : nsnull;\r
+}\r
+\r
+MimeEncoderData * \r
+MIME_QPEncoderInit(nsresult (* output_fn) (const char *buf, PRInt32 size, void *closure), void *closure) \r
+{\r
+ MimeEncoderData *returnEncoderData = nsnull;\r
+ nsIMimeConverter *converter;\r
+ nsresult res = CallCreateInstance(NS_MIME_CONVERTER_CONTRACTID, &converter);\r
+ if (NS_SUCCEEDED(res) && nsnull != converter) \r
+ {\r
+ res = converter->QPEncoderInit(output_fn, closure, &returnEncoderData);\r
+ NS_RELEASE(converter);\r
+ }\r
+ return NS_SUCCEEDED(res) ? returnEncoderData : nsnull;\r
+}\r
+\r
+nsresult\r
+MIME_EncoderDestroy(MimeEncoderData *data, PRBool abort_p) \r
+{\r
+ //MimeEncoderData *returnEncoderData = nsnull;\r
+ nsIMimeConverter *converter;\r
+ nsresult res = CallCreateInstance(NS_MIME_CONVERTER_CONTRACTID, &converter);\r
+ if (NS_SUCCEEDED(res) && nsnull != converter) \r
+ {\r
+ res = converter->EncoderDestroy(data, abort_p);\r
+ NS_RELEASE(converter);\r
+ }\r
+\r
+ return NS_SUCCEEDED(res) ? 0 : -1;\r
+}\r
+\r
+nsresult\r
+MIME_EncoderWrite(MimeEncoderData *data, const char *buffer, PRInt32 size) \r
+{\r
+ // MimeEncoderData *returnEncoderData = nsnull;\r
+ nsIMimeConverter *converter;\r
+ PRInt32 written = 0;\r
+ nsresult res = CallCreateInstance(NS_MIME_CONVERTER_CONTRACTID, &converter);\r
+ if (NS_SUCCEEDED(res) && nsnull != converter) {\r
+ res = converter->EncoderWrite(data, buffer, size, &written);\r
+ NS_RELEASE(converter);\r
+ }\r
+ return NS_SUCCEEDED(res) ? 0 : -1;\r
+}\r
+\r
+static void\r
+GenerateGlobalRandomBytes(unsigned char *buf, PRInt32 len)\r
+{\r
+ static PRBool firstTime = PR_TRUE;\r
+ \r
+ if (firstTime)\r
+ {\r
+ // Seed the random-number generator with current time so that\r
+ // the numbers will be different every time we run.\r
+ PRInt32 aTime;\r
+ LL_L2I(aTime, PR_Now());\r
+ srand( (unsigned)aTime );\r
+ firstTime = PR_FALSE;\r
+ }\r
+ \r
+ for( PRInt32 i = 0; i < len; i++ )\r
+ buf[i] = rand() % 10;\r
+}\r
+ \r
+char \r
+*mime_make_separator(const char *prefix)\r
+{\r
+ unsigned char rand_buf[13]; \r
+ GenerateGlobalRandomBytes(rand_buf, 12);\r
+\r
+ return PR_smprintf("------------%s"\r
+ "%02X%02X%02X%02X"\r
+ "%02X%02X%02X%02X"\r
+ "%02X%02X%02X%02X",\r
+ prefix,\r
+ rand_buf[0], rand_buf[1], rand_buf[2], rand_buf[3],\r
+ rand_buf[4], rand_buf[5], rand_buf[6], rand_buf[7],\r
+ rand_buf[8], rand_buf[9], rand_buf[10], rand_buf[11]);\r
+}\r
+\r
+// end of copied code which needs fixed....\r
+\r
+\r
+/////////////////////////////////////////////////////////////////////////////////////////\r
+// Implementation of nsMsgSMIMESecureHeader\r
+/////////////////////////////////////////////////////////////////////////////////////////\r
+NS_IMPL_ISUPPORTS1(nsMsgSMIMESecureHeader, nsIMsgSMIMESecureHeader)\r
+\r
+nsMsgSMIMESecureHeader::nsMsgSMIMESecureHeader():mHeaderStatus(-1),mHeaderEncrypted(-1)\r
+{\r
+\r
+}\r
+\r
+nsMsgSMIMESecureHeader::~nsMsgSMIMESecureHeader()\r
+{\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMESecureHeader::SetHeaderName( const nsAString & value)\r
+{\r
+ mHeaderName = value;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMESecureHeader::GetHeaderName( nsAString & _retval)\r
+{\r
+ _retval=mHeaderName;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMESecureHeader::SetHeaderValue( const nsAString & value)\r
+{\r
+ mHeaderValue = value;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMESecureHeader::GetHeaderValue( nsAString & _retval)\r
+{\r
+ _retval=mHeaderValue;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMESecureHeader::SetHeaderStatus( PRInt32 value )\r
+{\r
+ mHeaderStatus=value;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMESecureHeader::GetHeaderStatus(PRInt32 * _retval)\r
+{\r
+ *_retval=mHeaderStatus;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMESecureHeader::SetHeaderEncrypted( PRInt32 value )\r
+{\r
+ mHeaderEncrypted=value;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMESecureHeader::GetHeaderEncrypted(PRInt32 * _retval)\r
+{\r
+ *_retval = mHeaderEncrypted;\r
+ return NS_OK;\r
+}\r
+\r
+/////////////////////////////////////////////////////////////////////////////////////////\r
+// Implementation of nsMsgSMIMEComposeFields\r
+/////////////////////////////////////////////////////////////////////////////////////////\r
+\r
+NS_IMPL_ISUPPORTS1(nsMsgSMIMEComposeFields, nsIMsgSMIMECompFields)\r
+\r
+nsMsgSMIMEComposeFields::nsMsgSMIMEComposeFields()\r
+:mSignMessage(PR_FALSE), mAlwaysEncryptMessage(PR_FALSE),\r
+mSMIMEReceiptRequest(PR_FALSE),\r
+mSMIMEReceipt(PR_FALSE),\r
+mSMIMEReceiptSignedContentIdentifierLen(0),\r
+mSMIMEReceiptOriginatorSignatureValueLen(0),\r
+mSMIMEReceiptOriginatorContentTypeLen(0),\r
+mSMIMEReceiptMsgSigDigestLen(0),\r
+mCanonAlgorithme(0),\r
+mSecurityClassification(-1)\r
+{\r
+ nsresult rv;\r
+ m_secureHeaders = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);\r
+}\r
+\r
+nsMsgSMIMEComposeFields::~nsMsgSMIMEComposeFields()\r
+{\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::SetSignMessage(PRBool value)\r
+{\r
+ mSignMessage = value;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::GetSignMessage(PRBool *_retval)\r
+{\r
+ *_retval = mSignMessage;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::SetRequireEncryptMessage(PRBool value)\r
+{\r
+ mAlwaysEncryptMessage = value;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::GetRequireEncryptMessage(PRBool *_retval)\r
+{\r
+ *_retval = mAlwaysEncryptMessage;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::SetSMIMEReceiptRequest(PRBool value)\r
+{\r
+ mSMIMEReceiptRequest = value;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::GetSMIMEReceiptRequest(PRBool *_retval)\r
+{\r
+ *_retval = mSMIMEReceiptRequest;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::SetSMIMEReceipt(PRBool value)\r
+{\r
+ mSMIMEReceipt = value;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::GetSMIMEReceipt(PRBool *_retval)\r
+{\r
+ *_retval = mSMIMEReceipt;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::SetSMIMEReceiptSignedContentIdentifier(PRUint8 *value)\r
+{\r
+ mSMIMEReceiptSignedContentIdentifier = value;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::GetSMIMEReceiptSignedContentIdentifier(PRUint8 **_retval)\r
+{\r
+ *_retval = mSMIMEReceiptSignedContentIdentifier;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::SetSMIMEReceiptSignedContentIdentifierLen(const PRUint32 value)\r
+{\r
+ mSMIMEReceiptSignedContentIdentifierLen = value;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::GetSMIMEReceiptSignedContentIdentifierLen(PRUint32 *_retval)\r
+{\r
+ *_retval = mSMIMEReceiptSignedContentIdentifierLen;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::SetSMIMEReceiptOriginatorSignatureValue(PRUint8 *value)\r
+{\r
+ mSMIMEReceiptOriginatorSignatureValue = value;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::GetSMIMEReceiptOriginatorSignatureValue(PRUint8 **_retval)\r
+{\r
+ *_retval = mSMIMEReceiptOriginatorSignatureValue;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::SetSMIMEReceiptOriginatorSignatureValueLen(const PRUint32 value)\r
+{\r
+ mSMIMEReceiptOriginatorSignatureValueLen = value;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::GetSMIMEReceiptOriginatorSignatureValueLen(PRUint32 *_retval)\r
+{\r
+ *_retval = mSMIMEReceiptOriginatorSignatureValueLen;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::SetSMIMEReceiptOriginatorContentType(PRUint8 *value)\r
+{\r
+ mSMIMEReceiptOriginatorContentType = value;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::GetSMIMEReceiptOriginatorContentType(PRUint8 **_retval)\r
+{\r
+ *_retval = mSMIMEReceiptOriginatorContentType;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::SetSMIMEReceiptOriginatorContentTypeLen(const PRUint32 value)\r
+{\r
+ mSMIMEReceiptOriginatorContentTypeLen = value;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::GetSMIMEReceiptOriginatorContentTypeLen(PRUint32 *_retval)\r
+{\r
+ *_retval = mSMIMEReceiptOriginatorContentTypeLen;\r
+ return NS_OK;\r
+}\r
+\r
+//Secure Headers\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::AddSecureHeader(nsIMsgSMIMESecureHeader * secureHeader)\r
+{\r
+ nsresult rv = NS_OK;\r
+\r
+ if (!secureHeader)\r
+ return NS_ERROR_FAILURE;\r
+ rv=m_secureHeaders->AppendElement(secureHeader,PR_FALSE);\r
+ return rv;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::GetSecureHeadersList(nsIMutableArray ** _SecureHeaders)\r
+{\r
+ *_SecureHeaders=m_secureHeaders;\r
+ NS_ADDREF(*_SecureHeaders);\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::ClearSecureHeaders()\r
+{\r
+ if(m_secureHeaders)\r
+ {\r
+ m_secureHeaders->Clear();\r
+ }\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::SetCanonAlgorithme(PRInt32 value)\r
+{\r
+ mCanonAlgorithme=value;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::GetCanonAlgorithme(PRInt32 * retval)\r
+{\r
+ *retval = mCanonAlgorithme;\r
+ return NS_OK;\r
+}\r
+//\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::SetSMIMEReceiptMsgSigDigest(PRUint8 *value)\r
+{\r
+ mSMIMEReceiptMsgSigDigest = value;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::GetSMIMEReceiptMsgSigDigest(PRUint8 **_retval)\r
+{\r
+ *_retval = mSMIMEReceiptMsgSigDigest;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::SetSMIMEReceiptMsgSigDigestLen(const PRUint32 value)\r
+{\r
+ mSMIMEReceiptMsgSigDigestLen = value;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::GetSMIMEReceiptMsgSigDigestLen(PRUint32 *_retval)\r
+{\r
+ *_retval = mSMIMEReceiptMsgSigDigestLen;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::SetSecurityPolicyIdentifier(const nsAString &value)\r
+{\r
+ mSecurityPolicyIdentifier = value;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::GetSecurityPolicyIdentifier(nsAString &_retval)\r
+{\r
+ _retval = mSecurityPolicyIdentifier;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::SetSecurityClassification(PRInt32 value)\r
+{\r
+ mSecurityClassification = value;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::GetSecurityClassification(PRInt32 *_retval)\r
+{\r
+ *_retval = mSecurityClassification;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::SetPrivacyMark(const nsAString &value)\r
+{\r
+ mPrivacyMark = value;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::GetPrivacyMark(nsAString &_retval)\r
+{\r
+ _retval = mPrivacyMark;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::SetSecurityCategories(const nsAString &value)\r
+{\r
+ mSecurityCategories = value;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgSMIMEComposeFields::GetSecurityCategories(nsAString &_retval)\r
+{\r
+ _retval = mSecurityCategories;\r
+ return NS_OK;\r
+}\r
+\r
+/////////////////////////////////////////////////////////////////////////////////////////\r
+// Implementation of nsMsgComposeSecure\r
+/////////////////////////////////////////////////////////////////////////////////////////\r
+\r
+NS_IMPL_ISUPPORTS1(nsMsgComposeSecure, nsIMsgComposeSecure)\r
+\r
+nsMsgComposeSecure::nsMsgComposeSecure()\r
+{\r
+ /* member initializers and constructor code */\r
+ mSigEncoderData = 0;\r
+ mMultipartSignedBoundary = 0;\r
+ mCryptoEncoderData = 0;\r
+ mBuffer = 0;\r
+ mBufferedBytes = 0;\r
+ mCanonAlgorithme=0;\r
+ mHasSecuritylabel = PR_FALSE;\r
+ mSecurityClassification = -1;\r
+}\r
+\r
+nsMsgComposeSecure::~nsMsgComposeSecure()\r
+{\r
+ /* destructor code */\r
+ if (mEncryptionContext) {\r
+ if (mBufferedBytes) {\r
+ mEncryptionContext->Update(mBuffer, mBufferedBytes);\r
+ mBufferedBytes = 0;\r
+ }\r
+ mEncryptionContext->Finish();\r
+ }\r
+\r
+ if (mSigEncoderData) {\r
+ MIME_EncoderDestroy (mSigEncoderData, PR_TRUE);\r
+ }\r
+ if (mCryptoEncoderData) {\r
+ MIME_EncoderDestroy (mCryptoEncoderData, PR_TRUE);\r
+ }\r
+\r
+ delete [] mBuffer;\r
+\r
+ PR_FREEIF(mMultipartSignedBoundary);\r
+}\r
+\r
+NS_IMETHODIMP nsMsgComposeSecure::RequiresCryptoEncapsulation(nsIMsgIdentity * aIdentity, nsIMsgCompFields * aCompFields, PRBool * aRequiresEncryptionWork)\r
+{\r
+ NS_ENSURE_ARG_POINTER(aRequiresEncryptionWork);\r
+\r
+ nsresult rv = NS_OK;\r
+ *aRequiresEncryptionWork = PR_FALSE;\r
+\r
+ PRBool alwaysEncryptMessages = PR_FALSE;\r
+ PRBool signMessage = PR_FALSE;\r
+ rv = ExtractEncryptionState(aIdentity, aCompFields, &signMessage, &alwaysEncryptMessages);\r
+\r
+ if (alwaysEncryptMessages || signMessage)\r
+ *aRequiresEncryptionWork = PR_TRUE;\r
+\r
+ return NS_OK;\r
+}\r
+\r
+\r
+nsresult nsMsgComposeSecure::GetSMIMEBundleString(const PRUnichar *name,\r
+ PRUnichar **outString)\r
+{\r
+ *outString = nsnull;\r
+\r
+ NS_ENSURE_ARG_POINTER(name);\r
+\r
+ if (!InitializeSMIMEBundle())\r
+ return NS_ERROR_FAILURE;\r
+\r
+ return NS_SUCCEEDED(mSMIMEBundle->GetStringFromName(name, outString));\r
+}\r
+\r
+nsresult\r
+nsMsgComposeSecure::\r
+SMIMEBundleFormatStringFromName(const PRUnichar *name,\r
+ const PRUnichar **params,\r
+ PRUint32 numParams,\r
+ PRUnichar **outString)\r
+{\r
+ NS_ENSURE_ARG_POINTER(name);\r
+\r
+ if (!InitializeSMIMEBundle())\r
+ return NS_ERROR_FAILURE;\r
+\r
+ return mSMIMEBundle->FormatStringFromName(name, params,\r
+ numParams, outString);\r
+}\r
+\r
+PRBool nsMsgComposeSecure::InitializeSMIMEBundle()\r
+{\r
+ if (mSMIMEBundle)\r
+ return PR_TRUE;\r
+\r
+ nsCOMPtr<nsIStringBundleService> bundleService =\r
+ do_GetService(NS_STRINGBUNDLE_CONTRACTID);\r
+ nsresult rv = bundleService->CreateBundle(SMIME_STRBUNDLE_URL,\r
+ getter_AddRefs(mSMIMEBundle));\r
+ NS_ENSURE_SUCCESS(rv, PR_FALSE);\r
+\r
+ return PR_TRUE;\r
+}\r
+\r
+void nsMsgComposeSecure::SetError(nsIMsgSendReport *sendReport, const PRUnichar *bundle_string)\r
+{\r
+ if (!sendReport || !bundle_string)\r
+ return;\r
+\r
+ if (mErrorAlreadyReported)\r
+ return;\r
+\r
+ mErrorAlreadyReported = PR_TRUE;\r
+ \r
+ nsString errorString;\r
+ nsresult res;\r
+\r
+ res = GetSMIMEBundleString(bundle_string,\r
+ getter_Copies(errorString));\r
+\r
+ if (NS_SUCCEEDED(res) && !errorString.IsEmpty())\r
+ {\r
+ sendReport->SetMessage(nsIMsgSendReport::process_Current,\r
+ errorString.get(),\r
+ PR_TRUE);\r
+ }\r
+}\r
+\r
+void nsMsgComposeSecure::SetErrorWithParam(nsIMsgSendReport *sendReport, const PRUnichar *bundle_string, const char *param)\r
+{\r
+ if (!sendReport || !bundle_string || !param)\r
+ return;\r
+\r
+ if (mErrorAlreadyReported)\r
+ return;\r
+\r
+ mErrorAlreadyReported = PR_TRUE;\r
+ \r
+ nsString errorString;\r
+ nsresult res;\r
+ const PRUnichar *params[1];\r
+\r
+ NS_ConvertASCIItoUTF16 ucs2(param);\r
+ params[0]= ucs2.get();\r
+\r
+ res = SMIMEBundleFormatStringFromName(bundle_string,\r
+ params,\r
+ 1,\r
+ getter_Copies(errorString));\r
+\r
+ if (NS_SUCCEEDED(res) && !errorString.IsEmpty())\r
+ {\r
+ sendReport->SetMessage(nsIMsgSendReport::process_Current,\r
+ errorString.get(),\r
+ PR_TRUE);\r
+ }\r
+}\r
+\r
+nsresult nsMsgComposeSecure::ExtractEncryptionState(nsIMsgIdentity * aIdentity, nsIMsgCompFields * aComposeFields, PRBool * aSignMessage, PRBool * aEncrypt)\r
+{\r
+ if (!aComposeFields && !aIdentity)\r
+ return NS_ERROR_FAILURE; // kick out...invalid args....\r
+\r
+ NS_ENSURE_ARG_POINTER(aSignMessage);\r
+ NS_ENSURE_ARG_POINTER(aEncrypt);\r
+\r
+ nsCOMPtr<nsISupports> securityInfo;\r
+ if (aComposeFields)\r
+ aComposeFields->GetSecurityInfo(getter_AddRefs(securityInfo));\r
+\r
+ if (securityInfo) // if we were given security comp fields, use them.....\r
+ {\r
+ nsCOMPtr<nsIMsgSMIMECompFields> smimeCompFields = do_QueryInterface(securityInfo);\r
+ if (smimeCompFields)\r
+ {\r
+ smimeCompFields->GetSignMessage(aSignMessage);\r
+ smimeCompFields->GetRequireEncryptMessage(aEncrypt);\r
+ return NS_OK;\r
+ }\r
+ }\r
+\r
+ // get the default info from the identity....\r
+ PRInt32 ep = 0;\r
+ nsresult testrv = aIdentity->GetIntAttribute("encryptionpolicy", &ep);\r
+ if (NS_FAILED(testrv)) {\r
+ *aEncrypt = PR_FALSE;\r
+ }\r
+ else {\r
+ *aEncrypt = (ep > 0);\r
+ }\r
+\r
+ testrv = aIdentity->GetBoolAttribute("sign_mail", aSignMessage);\r
+ if (NS_FAILED(testrv))\r
+ {\r
+ *aSignMessage = PR_FALSE;\r
+ }\r
+ return NS_OK;\r
+}\r
+\r
+nsresult nsMsgComposeSecure::ExtractSMIMEReceiptState(nsIMsgIdentity *aIdentity,\r
+ nsIMsgCompFields *aComposeFields,\r
+ PRBool *aSMIMEReceiptRequest,\r
+ PRBool *aSMIMEReceipt,\r
+ PRUint8 **aSMIMEReceiptSignedContentIdentifier,\r
+ PRUint32 *aSMIMEReceiptSignedContentIdentifierLen,\r
+ PRUint8 **aSMIMEReceiptOriginatorSignatureValue,\r
+ PRUint32 *aSMIMEReceiptOriginatorSignatureValueLen,\r
+ PRUint8 **aSMIMEReceiptOriginatorContentType,\r
+ PRUint32 *aSMIMEReceiptOriginatorContentTypeLen,\r
+ PRUint8 **aSMIMEReceiptMsgSigDigest,\r
+ PRUint32 *aSMIMEReceiptMsgSigDigestLen)\r
+{\r
+ if (!aComposeFields && !aIdentity)\r
+ return NS_ERROR_FAILURE; // kick out...invalid args....\r
+\r
+ NS_ENSURE_ARG(aSMIMEReceiptRequest);\r
+ NS_ENSURE_ARG(aSMIMEReceipt);\r
+ NS_ENSURE_ARG(aSMIMEReceiptSignedContentIdentifier);\r
+ NS_ENSURE_ARG(aSMIMEReceiptSignedContentIdentifierLen);\r
+ NS_ENSURE_ARG(aSMIMEReceiptOriginatorSignatureValue);\r
+ NS_ENSURE_ARG(aSMIMEReceiptOriginatorSignatureValueLen);\r
+ NS_ENSURE_ARG(aSMIMEReceiptOriginatorContentType);\r
+ NS_ENSURE_ARG(aSMIMEReceiptOriginatorContentTypeLen);\r
+ NS_ENSURE_ARG(aSMIMEReceiptMsgSigDigest);\r
+ NS_ENSURE_ARG(aSMIMEReceiptMsgSigDigestLen);\r
+\r
+ *aSMIMEReceiptRequest = PR_FALSE;\r
+ *aSMIMEReceipt = PR_FALSE;\r
+\r
+ nsCOMPtr<nsISupports> securityInfo;\r
+ if (aComposeFields)\r
+ {\r
+ aComposeFields->GetSecurityInfo(getter_AddRefs(securityInfo));\r
+\r
+ if (securityInfo) // if we were given security comp fields, use them.....\r
+ {\r
+ nsCOMPtr<nsIMsgSMIMECompFields> smimeCompFields = do_QueryInterface(securityInfo);\r
+ if (smimeCompFields)\r
+ {\r
+ /* Get SMIME receipt request */\r
+ smimeCompFields->GetSMIMEReceiptRequest(aSMIMEReceiptRequest);\r
+\r
+ if (*aSMIMEReceiptRequest)\r
+ return NS_OK;\r
+\r
+ /* Get SMIME receipt */\r
+ smimeCompFields->GetSMIMEReceipt(aSMIMEReceipt);\r
+ if (*aSMIMEReceipt)\r
+ {\r
+ smimeCompFields->GetSMIMEReceiptSignedContentIdentifier(aSMIMEReceiptSignedContentIdentifier);\r
+ smimeCompFields->GetSMIMEReceiptSignedContentIdentifierLen(aSMIMEReceiptSignedContentIdentifierLen);\r
+ smimeCompFields->GetSMIMEReceiptOriginatorSignatureValue(aSMIMEReceiptOriginatorSignatureValue);\r
+ smimeCompFields->GetSMIMEReceiptOriginatorSignatureValueLen(aSMIMEReceiptOriginatorSignatureValueLen);\r
+ smimeCompFields->GetSMIMEReceiptOriginatorContentType(aSMIMEReceiptOriginatorContentType);\r
+ smimeCompFields->GetSMIMEReceiptOriginatorContentTypeLen(aSMIMEReceiptOriginatorContentTypeLen);\r
+ smimeCompFields->GetSMIMEReceiptMsgSigDigest(aSMIMEReceiptMsgSigDigest);\r
+ smimeCompFields->GetSMIMEReceiptMsgSigDigestLen(aSMIMEReceiptMsgSigDigestLen);\r
+ return NS_OK;\r
+ }\r
+\r
+ }\r
+ }\r
+ }\r
+\r
+ return NS_OK;\r
+}\r
+\r
+nsresult nsMsgComposeSecure::ExtractSecurityLabelState(nsIMsgCompFields * aComposeFields, PRBool * aHasSecuritylabel, nsAString& aSecurityPolicyIdentifier, PRInt32 * aSecurityClassification, nsAString& aPrivacyMark, nsAString& aSecurityCategories)\r
+{\r
+ if (!aComposeFields)\r
+ return NS_ERROR_FAILURE; // kick out...invalid args....\r
+\r
+ NS_ENSURE_ARG_POINTER(aHasSecuritylabel);\r
+ NS_ENSURE_ARG_POINTER(aSecurityClassification);\r
+\r
+ nsCOMPtr<nsISupports> securityInfo;\r
+ if (aComposeFields)\r
+ {\r
+ aComposeFields->GetSecurityInfo(getter_AddRefs(securityInfo));\r
+\r
+ if (securityInfo) // if we were given security comp fields, use them.....\r
+ {\r
+ nsCOMPtr<nsIMsgSMIMECompFields> smimeCompFields = do_QueryInterface(securityInfo);\r
+ if (smimeCompFields)\r
+ {\r
+ smimeCompFields->GetSecurityPolicyIdentifier(aSecurityPolicyIdentifier);\r
+ smimeCompFields->GetSecurityClassification(aSecurityClassification);\r
+ smimeCompFields->GetPrivacyMark(aPrivacyMark);\r
+ smimeCompFields->GetSecurityCategories(aSecurityCategories);\r
+ if (!aSecurityPolicyIdentifier.IsEmpty())\r
+ *aHasSecuritylabel = PR_TRUE;\r
+ }\r
+ }\r
+ }\r
+\r
+ return NS_OK;\r
+}\r
+\r
+/* void beginCryptoEncapsulation (in nsOutputFileStream aStream, in boolean aEncrypt, in boolean aSign, in string aRecipeints, in boolean aIsDraft); */\r
+NS_IMETHODIMP nsMsgComposeSecure::BeginCryptoEncapsulation(nsIOutputStream * aStream,\r
+ const char * aRecipients,\r
+ nsIMsgCompFields * aCompFields,\r
+ nsIMsgIdentity * aIdentity,\r
+ nsIMsgSendReport *sendReport,\r
+ PRBool aIsDraft)\r
+{\r
+ mErrorAlreadyReported = PR_FALSE;\r
+ nsresult rv = NS_OK;\r
+\r
+ PRBool encryptMessages = PR_FALSE;\r
+ PRBool signMessage = PR_FALSE;\r
+ ExtractEncryptionState(aIdentity, aCompFields, &signMessage, &encryptMessages);\r
+\r
+ if (!signMessage && !encryptMessages) return NS_ERROR_FAILURE;\r
+\r
+ // Extract SMIME receipt request and receipt state\r
+ mSMIMEReceiptRequest = PR_FALSE;\r
+ ExtractSMIMEReceiptState(aIdentity,\r
+ aCompFields,\r
+ &mSMIMEReceiptRequest,\r
+ &mSMIMEReceipt,\r
+ &mSMIMEReceiptSignedContentIdentifier,\r
+ &mSMIMEReceiptSignedContentIdentifierLen,\r
+ &mSMIMEReceiptOriginatorSignatureValue,\r
+ &mSMIMEReceiptOriginatorSignatureValueLen,\r
+ &mSMIMEReceiptOriginatorContentType,\r
+ &mSMIMEReceiptOriginatorContentTypeLen,\r
+ &mSMIMEReceiptMsgSigDigest,\r
+ &mSMIMEReceiptMsgSigDigestLen);\r
+\r
+ //Extract Headers to secure\r
+ ReadHeadersToSecure(aIdentity,aCompFields);\r
+\r
+ if (mSMIMEReceiptRequest) {\r
+ signMessage = PR_TRUE;\r
+\r
+ /* Generate a random signed content identifier for the receipt request */\r
+ nsCOMPtr<nsIMsgCompUtils> compUtils;\r
+ compUtils = do_GetService(NS_MSGCOMPUTILS_CONTRACTID, &rv);\r
+ NS_ENSURE_SUCCESS(rv, rv);\r
+ rv = compUtils->MsgGenerateMessageId(aIdentity, getter_Copies(mSMIMEReceiptRequestSignedContentIdentifier));\r
+ NS_ENSURE_SUCCESS(rv, rv);\r
+\r
+ /* Get sender address for the recipient field of the receipt request */\r
+ aIdentity->GetEmail(mSMIMEReceiptRequestReceiptsTo);\r
+ } else if (mSMIMEReceipt) {\r
+ signMessage = PR_TRUE;\r
+ }\r
+\r
+ ExtractSecurityLabelState(aCompFields, &mHasSecuritylabel, mSecurityPolicyIdentifier, &mSecurityClassification, mPrivacyMark, mSecurityCategories);\r
+\r
+ mStream = aStream;\r
+ mIsDraft = aIsDraft;\r
+\r
+ if (mSMIMEReceipt)\r
+ mCryptoState = mime_crypto_signed_receipt;\r
+ else if (encryptMessages && signMessage)\r
+ mCryptoState = mime_crypto_signed_encrypted;\r
+ else if (encryptMessages)\r
+ mCryptoState = mime_crypto_encrypted;\r
+ else if (signMessage)\r
+ mCryptoState = mime_crypto_clear_signed;\r
+ else\r
+ PR_ASSERT(0);\r
+\r
+ aIdentity->GetUnicharAttribute("signing_cert_name", mSigningCertName);\r
+ aIdentity->GetUnicharAttribute("encryption_cert_name", mEncryptionCertName);\r
+\r
+ rv = MimeCryptoHackCerts(aRecipients, sendReport, encryptMessages, signMessage);\r
+ if (NS_FAILED(rv)) {\r
+ goto FAIL;\r
+ }\r
+\r
+ switch (mCryptoState)\r
+ {\r
+ case mime_crypto_clear_signed:\r
+ rv = MimeInitMultipartSigned(PR_TRUE, sendReport);\r
+ break;\r
+ case mime_crypto_opaque_signed:\r
+ PR_ASSERT(0); /* #### no api for this yet */\r
+ rv = NS_ERROR_NOT_IMPLEMENTED;\r
+ break;\r
+ case mime_crypto_signed_encrypted:\r
+ rv = MimeInitEncryption(PR_TRUE, sendReport);\r
+ break;\r
+ case mime_crypto_encrypted:\r
+ rv = MimeInitEncryption(PR_FALSE, sendReport);\r
+ break;\r
+ case mime_crypto_signed_receipt:\r
+ /* Nothing to be done here */\r
+ break;\r
+ case mime_crypto_none:\r
+ /* This can happen if mime_crypto_hack_certs() decided to turn off\r
+ encryption (by asking the user.) */\r
+ rv = 1;\r
+ break;\r
+ default:\r
+ PR_ASSERT(0);\r
+ break;\r
+ }\r
+\r
+FAIL:\r
+ return rv;\r
+}\r
+\r
+/* void finishCryptoEncapsulation (in boolean aAbort); */\r
+NS_IMETHODIMP nsMsgComposeSecure::FinishCryptoEncapsulation(PRBool aAbort, nsIMsgSendReport *sendReport)\r
+{\r
+ nsresult rv = NS_OK;\r
+\r
+ if (!aAbort) {\r
+ switch (mCryptoState) {\r
+ case mime_crypto_clear_signed:\r
+ rv = MimeFinishMultipartSigned (PR_TRUE, sendReport);\r
+ break;\r
+ case mime_crypto_opaque_signed:\r
+ PR_ASSERT(0); /* #### no api for this yet */\r
+ rv = NS_ERROR_FAILURE;\r
+ break;\r
+ case mime_crypto_signed_encrypted:\r
+ rv = MimeFinishEncryption (PR_TRUE, sendReport);\r
+ break;\r
+ case mime_crypto_encrypted:\r
+ rv = MimeFinishEncryption (PR_FALSE, sendReport);\r
+ break;\r
+ case mime_crypto_signed_receipt:\r
+ rv = MimeFinishSignedReceipt(sendReport);\r
+ break;\r
+ default:\r
+ PR_ASSERT(0);\r
+ rv = NS_ERROR_FAILURE;\r
+ break;\r
+ }\r
+ }\r
+ return rv;\r
+}\r
+\r
+nsresult nsMsgComposeSecure::MimeInitMultipartSigned(PRBool aOuter, nsIMsgSendReport *sendReport)\r
+{\r
+ /* First, construct and write out the multipart/signed MIME header data.\r
+ */\r
+ nsresult rv = NS_OK;\r
+ char *header = 0;\r
+ PRUint32 L;\r
+\r
+ rv = make_multipart_signed_header_string(aOuter, &header,\r
+ &mMultipartSignedBoundary);\r
+ if (NS_FAILED(rv)) goto FAIL;\r
+\r
+ L = strlen(header);\r
+\r
+ if (aOuter){\r
+ /* If this is the outer block, write it to the file. */\r
+ PRUint32 n;\r
+ rv = mStream->Write(header, L, &n);\r
+ if (NS_FAILED(rv) || n < L) {\r
+ rv = MK_MIME_ERROR_WRITING_FILE;\r
+ }\r
+ } else {\r
+ /* If this is an inner block, feed it through the crypto stream. */\r
+ rv = MimeCryptoWriteBlock (header, L);\r
+ }\r
+\r
+ PR_Free(header);\r
+ if (NS_FAILED(rv)) goto FAIL;\r
+\r
+ /* Now initialize the crypto library, so that we can compute a hash\r
+ on the object which we are signing.\r
+ */\r
+\r
+ mHashType = nsICryptoHash::SHA1;\r
+\r
+ PR_SetError(0,0);\r
+ mDataHash = do_CreateInstance("@mozilla.org/security/hash;1", &rv);\r
+ if (NS_FAILED(rv)) return 0;\r
+\r
+ rv = mDataHash->Init(mHashType);\r
+ if (NS_FAILED(rv)) {\r
+ goto FAIL;\r
+ }\r
+\r
+ PR_SetError(0,0);\r
+ FAIL:\r
+ return rv;\r
+}\r
+\r
+nsresult nsMsgComposeSecure::MimeInitEncryption(PRBool aSign, nsIMsgSendReport *sendReport)\r
+{\r
+ nsresult rv;\r
+\r
+ /* First, construct and write out the opaque-crypto-blob MIME header data.\r
+ */\r
+\r
+ char *s =\r
+ PR_smprintf("Content-Type: " APPLICATION_PKCS7_MIME\r
+ "; name=\"smime.p7m\"" CRLF\r
+ "Content-Transfer-Encoding: " ENCODING_BASE64 CRLF\r
+ "Content-Disposition: attachment"\r
+ "; filename=\"smime.p7m\"" CRLF\r
+ "Content-Description: %s" CRLF\r
+ CRLF,\r
+ MIME_SMIME_ENCRYPTED_CONTENT_DESCRIPTION);\r
+ PRUint32 L;\r
+ if (!s) return NS_ERROR_OUT_OF_MEMORY;\r
+ L = strlen(s);\r
+ PRUint32 n;\r
+ rv = mStream->Write(s, L, &n);\r
+ if (NS_FAILED(rv) || n < L) {\r
+ return NS_ERROR_FAILURE;\r
+ }\r
+ PR_Free(s);\r
+ s = 0;\r
+\r
+ /* Now initialize the crypto library, so that we can filter the object\r
+ to be encrypted through it.\r
+ */\r
+\r
+ if (!mIsDraft) {\r
+ PRUint32 numCerts;\r
+ mCerts->GetLength(&numCerts);\r
+ PR_ASSERT(numCerts > 0);\r
+ if (numCerts == 0) return NS_ERROR_FAILURE;\r
+ }\r
+\r
+ /* Initialize the base64 encoder. */\r
+ PR_ASSERT(!mCryptoEncoderData);\r
+ mCryptoEncoderData = MIME_B64EncoderInit(mime_encoder_output_fn,\r
+ this);\r
+ if (!mCryptoEncoderData) {\r
+ return NS_ERROR_OUT_OF_MEMORY;\r
+ }\r
+\r
+ /* Initialize the encrypter (and add the sender's cert.) */\r
+ PR_ASSERT(mSelfEncryptionCert);\r
+ PR_SetError(0,0);\r
+ mEncryptionCinfo = do_CreateInstance(NS_CMSMESSAGE_CONTRACTID, &rv);\r
+ if (NS_FAILED(rv)) return rv;\r
+ rv = mEncryptionCinfo->CreateEncrypted(mCerts);\r
+ if (NS_FAILED(rv)) {\r
+ SetError(sendReport, NS_LITERAL_STRING("ErrorCanNotEncrypt").get());\r
+ goto FAIL;\r
+ }\r
+\r
+ mEncryptionContext = do_CreateInstance(NS_CMSENCODER_CONTRACTID, &rv);\r
+ if (NS_FAILED(rv)) return rv;\r
+\r
+ if (!mBuffer) {\r
+ mBuffer = new char[eBufferSize];\r
+ if (!mBuffer)\r
+ return NS_ERROR_OUT_OF_MEMORY;\r
+ }\r
+\r
+ mBufferedBytes = 0;\r
+\r
+ rv = mEncryptionContext->Start(mEncryptionCinfo, mime_crypto_write_base64, mCryptoEncoderData);\r
+ if (NS_FAILED(rv)) {\r
+ SetError(sendReport, NS_LITERAL_STRING("ErrorCanNotEncrypt").get());\r
+ goto FAIL;\r
+ }\r
+\r
+ /* If we're signing, tack a multipart/signed header onto the front of\r
+ the data to be encrypted, and initialize the sign-hashing code too.\r
+ */\r
+ if (aSign) {\r
+ rv = MimeInitMultipartSigned(PR_FALSE, sendReport);\r
+ if (NS_FAILED(rv)) goto FAIL;\r
+ }\r
+\r
+ FAIL:\r
+ return rv;\r
+}\r
+\r
+nsresult nsMsgComposeSecure::MimeFinishMultipartSigned (PRBool aOuter, nsIMsgSendReport *sendReport)\r
+{\r
+ int status;\r
+ nsresult rv;\r
+ nsCOMPtr<nsICMSMessage> cinfo = do_CreateInstance(NS_CMSMESSAGE_CONTRACTID, &rv);\r
+ nsCOMPtr<nsICMSEncoder> encoder = do_CreateInstance(NS_CMSENCODER_CONTRACTID, &rv);\r
+ char * header = nsnull;\r
+\r
+ /* Compute the hash...\r
+ */\r
+\r
+ nsCAutoString hashString;\r
+ mDataHash->Finish(PR_FALSE, hashString);\r
+\r
+ mDataHash = 0;\r
+\r
+ status = PR_GetError();\r
+ if (status < 0) goto FAIL;\r
+\r
+ /* Write out the headers for the signature.\r
+ */\r
+ PRUint32 L;\r
+ header =\r
+ PR_smprintf(CRLF\r
+ "--%s" CRLF\r
+ "Content-Type: " APPLICATION_PKCS7_SIGNATURE\r
+ "; name=\"smime.p7s\"" CRLF\r
+ "Content-Transfer-Encoding: " ENCODING_BASE64 CRLF\r
+ "Content-Disposition: attachment; "\r
+ "filename=\"smime.p7s\"" CRLF\r
+ "Content-Description: %s" CRLF\r
+ CRLF,\r
+ mMultipartSignedBoundary,\r
+ MIME_SMIME_SIGNATURE_CONTENT_DESCRIPTION);\r
+ if (!header) {\r
+ rv = NS_ERROR_OUT_OF_MEMORY;\r
+ goto FAIL;\r
+ }\r
+\r
+ L = strlen(header);\r
+ if (aOuter) {\r
+ /* If this is the outer block, write it to the file. */\r
+ PRUint32 n;\r
+ rv = mStream->Write(header, L, &n);\r
+ if (NS_FAILED(rv) || n < L) {\r
+ rv = MK_MIME_ERROR_WRITING_FILE;\r
+ } \r
+ } else {\r
+ /* If this is an inner block, feed it through the crypto stream. */\r
+ rv = MimeCryptoWriteBlock (header, L);\r
+ }\r
+\r
+ PR_Free(header);\r
+\r
+ /* Store the SMIME receipt request\r
+ */\r
+ if (mSMIMEReceiptRequest && !mSMIMEReceiptRequestReceiptsTo.IsEmpty())\r
+ cinfo->SetReceiptRequest(mSMIMEReceiptRequestSignedContentIdentifier, mSMIMEReceiptRequestReceiptsTo);\r
+\r
+ /* Store Security Label\r
+ */\r
+ if (mHasSecuritylabel)\r
+ rv = cinfo->SetSecurityLabel(NS_ConvertUTF16toUTF8(mSecurityPolicyIdentifier), mSecurityClassification, NS_ConvertUTF16toUTF8(mPrivacyMark), NS_ConvertUTF16toUTF8(mSecurityCategories));\r
+\r
+ /* Create the signature...\r
+ */\r
+\r
+ PR_ASSERT(mHashType == nsICryptoHash::SHA1);\r
+\r
+ PR_ASSERT (mSelfSigningCert);\r
+ PR_SetError(0,0);\r
+\r
+ rv = cinfo->CreateSigned(mSelfSigningCert,\r
+ mSelfEncryptionCert,\r
+ (unsigned char*)hashString.get(),\r
+ hashString.Length(),\r
+ mSecureHeaders, \r
+ mCanonAlgorithme);\r
+ \r
+ if (NS_FAILED(rv)) {\r
+ SetError(sendReport, NS_LITERAL_STRING("ErrorCanNotSign").get());\r
+ goto FAIL;\r
+ }\r
+\r
+ /* Initialize the base64 encoder for the signature data.\r
+ */\r
+ PR_ASSERT(!mSigEncoderData);\r
+ mSigEncoderData =\r
+ MIME_B64EncoderInit((aOuter\r
+ ? mime_encoder_output_fn\r
+ : mime_nested_encoder_output_fn),\r
+ this);\r
+ if (!mSigEncoderData) {\r
+ rv = NS_ERROR_OUT_OF_MEMORY;\r
+ goto FAIL;\r
+ }\r
+\r
+ /* Write out the signature.\r
+ */\r
+ PR_SetError(0,0);\r
+ rv = encoder->Start(cinfo, mime_crypto_write_base64, mSigEncoderData);\r
+ if (NS_FAILED(rv)) {\r
+ SetError(sendReport, NS_LITERAL_STRING("ErrorCanNotSign").get());\r
+ goto FAIL;\r
+ }\r
+\r
+ // We're not passing in any data, so no update needed.\r
+ rv = encoder->Finish();\r
+ if (NS_FAILED(rv)) {\r
+ SetError(sendReport, NS_LITERAL_STRING("ErrorCanNotSign").get());\r
+ goto FAIL;\r
+ }\r
+\r
+ /* Shut down the sig's base64 encoder.\r
+ */\r
+ rv = MIME_EncoderDestroy(mSigEncoderData, PR_FALSE);\r
+ mSigEncoderData = 0;\r
+ if (NS_FAILED(rv)) {\r
+ goto FAIL;\r
+ }\r
+\r
+ /* Now write out the terminating boundary.\r
+ */\r
+ {\r
+ PRUint32 L;\r
+ char *header = PR_smprintf(CRLF "--%s--" CRLF,\r
+ mMultipartSignedBoundary);\r
+ PR_Free(mMultipartSignedBoundary);\r
+ mMultipartSignedBoundary = 0;\r
+\r
+ if (!header) {\r
+ rv = NS_ERROR_OUT_OF_MEMORY;\r
+ goto FAIL;\r
+ }\r
+ L = strlen(header);\r
+ if (aOuter) {\r
+ /* If this is the outer block, write it to the file. */\r
+ PRUint32 n;\r
+ rv = mStream->Write(header, L, &n);\r
+ if (NS_FAILED(rv) || n < L)\r
+ rv = MK_MIME_ERROR_WRITING_FILE;\r
+ } else {\r
+ /* If this is an inner block, feed it through the crypto stream. */\r
+ rv = MimeCryptoWriteBlock (header, L);\r
+ }\r
+ }\r
+\r
+FAIL:\r
+ return rv;\r
+}\r
+\r
+nsresult nsMsgComposeSecure::MimeFinishSignedReceipt(nsIMsgSendReport *sendReport)\r
+{\r
+ nsresult rv;\r
+ PRUint32 L;\r
+ PRUint32 n;\r
+ PRUint8 *encodedReceiptObject = NULL;\r
+ PRUint32 encodedReceiptObjectLen = 0;\r
+\r
+ nsCOMPtr<nsICMSMessage> cinfo = do_CreateInstance(NS_CMSMESSAGE_CONTRACTID, &rv);\r
+ nsCOMPtr<nsICMSEncoder> encoder = do_CreateInstance(NS_CMSENCODER_CONTRACTID, &rv);\r
+ char * header = nsnull;\r
+\r
+ /* Write out the headers for the signature.\r
+ */\r
+ header = PR_smprintf("Content-Type: " APPLICATION_PKCS7_MIME "; smime-type=signed-receipt; name=\"smime.p7m\"" CRLF\r
+ "Content-Transfer-Encoding: " ENCODING_BASE64 CRLF\r
+ "Content-Disposition: attachment; filename=\"smime.p7m\"" CRLF\r
+ "Content-Description: %s" CRLF CRLF,\r
+ MIME_SMIME_RECEIPT_CONTENT_DESCRIPTION);\r
+\r
+ if (!header) {\r
+ rv = NS_ERROR_OUT_OF_MEMORY;\r
+ goto FAIL;\r
+ }\r
+\r
+ L = strlen(header);\r
+ rv = mStream->Write(header, L, &n);\r
+ if (NS_FAILED(rv) || n < L)\r
+ rv = MK_MIME_ERROR_WRITING_FILE;\r
+ PR_smprintf_free(header);\r
+\r
+ /* Store the SMIME receipt values\r
+ */\r
+ cinfo->SetReceipt(mSMIMEReceiptSignedContentIdentifier,\r
+ mSMIMEReceiptSignedContentIdentifierLen,\r
+ mSMIMEReceiptOriginatorSignatureValue,\r
+ mSMIMEReceiptOriginatorSignatureValueLen,\r
+ mSMIMEReceiptOriginatorContentType,\r
+ mSMIMEReceiptOriginatorContentTypeLen,\r
+ mSMIMEReceiptMsgSigDigest,\r
+ mSMIMEReceiptMsgSigDigestLen);\r
+\r
+ /* Create the signature...\r
+ */\r
+\r
+ PR_ASSERT (mSelfSigningCert);\r
+ PR_SetError(0, 0);\r
+\r
+ rv = cinfo->CreateSigned(mSelfSigningCert, mSelfEncryptionCert, NULL, 0,NULL,0);\r
+ if (NS_FAILED(rv)) {\r
+ SetError(sendReport, NS_LITERAL_STRING("ErrorCanNotSign").get());\r
+ goto FAIL;\r
+ }\r
+\r
+ /* Create receipt object and set message digest */\r
+ rv = cinfo->CreateReceipt(&encodedReceiptObject, &encodedReceiptObjectLen);\r
+ if (NS_FAILED(rv)) {\r
+ SetError(sendReport, NS_LITERAL_STRING("ErrorCanNotSign").get());\r
+ goto FAIL;\r
+ }\r
+\r
+ /* Initialize the base64 encoder for the signature data.\r
+ */\r
+ PR_ASSERT(!mSigEncoderData);\r
+ mSigEncoderData =\r
+ MIME_B64EncoderInit(mime_encoder_output_fn, this);\r
+ if (!mSigEncoderData) {\r
+ rv = NS_ERROR_OUT_OF_MEMORY;\r
+ goto FAIL;\r
+ }\r
+\r
+ /* Write out the signature.\r
+ */\r
+ PR_SetError(0, 0);\r
+ rv = encoder->Start(cinfo, mime_crypto_write_base64, mSigEncoderData);\r
+ if (NS_FAILED(rv)) {\r
+ SetError(sendReport, NS_LITERAL_STRING("ErrorCanNotSign").get());\r
+ goto FAIL;\r
+ }\r
+\r
+ /* Attach receipt object to the signature */\r
+ rv = encoder->Update((char*)encodedReceiptObject, (PRInt32)encodedReceiptObjectLen);\r
+ if (NS_FAILED(rv)) {\r
+ SetError(sendReport, NS_LITERAL_STRING("ErrorCanNotSign").get());\r
+ goto FAIL;\r
+ }\r
+\r
+ rv = encoder->Finish();\r
+ if (NS_FAILED(rv)) {\r
+ SetError(sendReport, NS_LITERAL_STRING("ErrorCanNotSign").get());\r
+ goto FAIL;\r
+ }\r
+\r
+ /* Shut down the sig's base64 encoder.\r
+ */\r
+ rv = MIME_EncoderDestroy(mSigEncoderData, PR_FALSE);\r
+ mSigEncoderData = 0;\r
+ if (NS_FAILED(rv))\r
+ goto FAIL;\r
+\r
+ rv = mStream->Write(CRLF, 2, &n);\r
+ if (NS_FAILED(rv) || n < 2)\r
+ rv = NS_ERROR_FAILURE;\r
+\r
+FAIL:\r
+ return rv;\r
+}\r
+\r
+/* Helper function for mime_finish_crypto_encapsulation() to close off\r
+ an opaque crypto object (for encrypted or signed-and-encrypted messages.)\r
+ */\r
+nsresult nsMsgComposeSecure::MimeFinishEncryption (PRBool aSign, nsIMsgSendReport *sendReport)\r
+{\r
+ nsresult rv;\r
+\r
+ /* If this object is both encrypted and signed, close off the\r
+ signature first (since it's inside.) */\r
+ if (aSign) {\r
+ rv = MimeFinishMultipartSigned (PR_FALSE, sendReport);\r
+ if (NS_FAILED(rv)) {\r
+ goto FAIL;\r
+ }\r
+ }\r
+\r
+ /* Close off the opaque encrypted blob.\r
+ */\r
+ PR_ASSERT(mEncryptionContext);\r
+\r
+ if (mBufferedBytes) {\r
+ rv = mEncryptionContext->Update(mBuffer, mBufferedBytes);\r
+ mBufferedBytes = 0;\r
+ if (NS_FAILED(rv)) {\r
+ PR_ASSERT(PR_GetError() < 0);\r
+ goto FAIL;\r
+ }\r
+ }\r
+ \r
+ rv = mEncryptionContext->Finish();\r
+ if (NS_FAILED(rv)) {\r
+ SetError(sendReport, NS_LITERAL_STRING("ErrorCanNotEncrypt").get());\r
+ goto FAIL;\r
+ }\r
+\r
+ mEncryptionContext = 0;\r
+\r
+ PR_ASSERT(mEncryptionCinfo);\r
+ if (!mEncryptionCinfo) {\r
+ rv = NS_ERROR_FAILURE;\r
+ }\r
+ if (mEncryptionCinfo) {\r
+ mEncryptionCinfo = 0;\r
+ }\r
+\r
+ /* Shut down the base64 encoder. */\r
+ rv = MIME_EncoderDestroy(mCryptoEncoderData, PR_FALSE);\r
+ mCryptoEncoderData = 0;\r
+\r
+ PRUint32 n;\r
+ rv = mStream->Write(CRLF, 2, &n);\r
+ if (NS_FAILED(rv) || n < 2)\r
+ rv = NS_ERROR_FAILURE;\r
+\r
+ FAIL:\r
+ return rv;\r
+}\r
+\r
+/* Used to figure out what certs should be used when encrypting this message.\r
+ */\r
+nsresult nsMsgComposeSecure::MimeCryptoHackCerts(const char *aRecipients,\r
+ nsIMsgSendReport *sendReport,\r
+ PRBool aEncrypt,\r
+ PRBool aSign)\r
+{\r
+ char *mailbox_list = 0;\r
+ nsCString all_mailboxes, mailboxes;\r
+ const char *mailbox = 0;\r
+ PRUint32 count = 0;\r
+ nsCOMPtr<nsIX509CertDB> certdb = do_GetService(NS_X509CERTDB_CONTRACTID);\r
+ nsresult res;\r
+ nsCOMPtr<nsIMsgHeaderParser> pHeader = do_GetService(NS_MAILNEWS_MIME_HEADER_PARSER_CONTRACTID, &res);\r
+ NS_ENSURE_SUCCESS(res,res);\r
+\r
+ mCerts = do_CreateInstance(NS_ARRAY_CONTRACTID, &res);\r
+ if (NS_FAILED(res)) {\r
+ return res;\r
+ }\r
+\r
+ PR_ASSERT(aEncrypt || aSign);\r
+ certdb->FindEmailEncryptionCert(mEncryptionCertName, getter_AddRefs(mSelfEncryptionCert));\r
+ certdb->FindEmailSigningCert(mSigningCertName, getter_AddRefs(mSelfSigningCert));\r
+\r
+ // must have both the signing and encryption certs to sign\r
+ if ((mSelfSigningCert == nsnull) && aSign) {\r
+ SetError(sendReport, NS_LITERAL_STRING("NoSenderSigningCert").get());\r
+ res = NS_ERROR_FAILURE;\r
+ goto FAIL;\r
+ }\r
+\r
+ if ((mSelfEncryptionCert == nsnull) && aEncrypt) {\r
+ SetError(sendReport, NS_LITERAL_STRING("NoSenderEncryptionCert").get());\r
+ res = NS_ERROR_FAILURE;\r
+ goto FAIL;\r
+ }\r
+\r
+ pHeader->ExtractHeaderAddressMailboxes(nsDependentCString(aRecipients),\r
+ all_mailboxes);\r
+ pHeader->RemoveDuplicateAddresses(all_mailboxes, EmptyCString(), mailboxes);\r
+\r
+ pHeader->ParseHeaderAddresses(mailboxes.get(), 0, &mailbox_list, &count);\r
+\r
+ if (count < 0) return count;\r
+\r
+ if (aEncrypt && mSelfEncryptionCert) {\r
+ // Make sure self's configured cert is prepared for being used\r
+ // as an email recipient cert.\r
+ \r
+ nsCOMPtr<nsISMimeCert> sc = do_QueryInterface(mSelfEncryptionCert);\r
+ if (sc) {\r
+ sc->SaveSMimeProfile();\r
+ }\r
+ }\r
+\r
+ /* If the message is to be encrypted, then get the recipient certs */\r
+ if (aEncrypt) {\r
+ mailbox = mailbox_list;\r
+\r
+ PRBool already_added_self_cert = PR_FALSE;\r
+\r
+ for (; count > 0; count--) {\r
+ nsCString mailbox_lowercase;\r
+ ToLowerCase(nsDependentCString(mailbox), mailbox_lowercase);\r
+ nsCOMPtr<nsIX509Cert> cert;\r
+ certdb->FindCertByEmailAddress(nsnull, mailbox_lowercase.get(), getter_AddRefs(cert));\r
+ PRBool foundValidCert = PR_FALSE;\r
+\r
+ if (cert) {\r
+ PRUint32 verification_result;\r
+\r
+ if (NS_SUCCEEDED(\r
+ cert->VerifyForUsage(nsIX509Cert::CERT_USAGE_EmailRecipient, &verification_result))\r
+ &&\r
+ nsIX509Cert::VERIFIED_OK == verification_result)\r
+ {\r
+ foundValidCert = PR_TRUE;\r
+ }\r
+ }\r
+ \r
+ if (!foundValidCert) {\r
+ // Failure to find a valid encryption cert is fatal.\r
+ // here I assume that mailbox contains ascii rather than utf8.\r
+ SetErrorWithParam(sendReport, NS_LITERAL_STRING("MissingRecipientEncryptionCert").get(), mailbox);\r
+ res = NS_ERROR_FAILURE;\r
+ goto FAIL;\r
+ }\r
+\r
+ /* #### see if recipient requests `signedData'.\r
+ if (...) no_clearsigning_p = PR_TRUE;\r
+ (This is the only reason we even bother looking up the certs\r
+ of the recipients if we're sending a signed-but-not-encrypted\r
+ message.)\r
+ */\r
+\r
+ PRBool isSame;\r
+ if (NS_SUCCEEDED(cert->Equals(mSelfEncryptionCert, &isSame))\r
+ && isSame) {\r
+ already_added_self_cert = PR_TRUE;\r
+ }\r
+\r
+ mCerts->AppendElement(cert, PR_FALSE);\r
+ // To understand this loop, especially the "+= strlen +1", look at the documentation\r
+ // of ParseHeaderAddresses. Basically, it returns a list of zero terminated strings.\r
+ mailbox += strlen(mailbox) + 1;\r
+ }\r
+ \r
+ if (!already_added_self_cert) {\r
+ mCerts->AppendElement(mSelfEncryptionCert, PR_FALSE);\r
+ }\r
+ }\r
+FAIL:\r
+ if (mailbox_list) {\r
+ nsMemory::Free(mailbox_list);\r
+ }\r
+ return res;\r
+}\r
+\r
+NS_IMETHODIMP nsMsgComposeSecure::MimeCryptoWriteBlock (const char *buf, PRInt32 size)\r
+{\r
+ int status = 0;\r
+ nsresult rv;\r
+\r
+ /* If this is a From line, mangle it before signing it. You just know\r
+ that something somewhere is going to mangle it later, and that's\r
+ going to cause the signature check to fail.\r
+\r
+ (This assumes that, in the cases where From-mangling must happen,\r
+ this function is called a line at a time. That happens to be the\r
+ case.)\r
+ */\r
+ if (size >= 5 && buf[0] == 'F' && !strncmp(buf, "From ", 5)) {\r
+ char mangle[] = ">";\r
+ status = MimeCryptoWriteBlock (mangle, 1);\r
+ if (status < 0)\r
+ return status;\r
+ }\r
+\r
+ /* If we're signing, or signing-and-encrypting, feed this data into\r
+ the computation of the hash. */\r
+ if (mDataHash) {\r
+ PR_SetError(0,0);\r
+ mDataHash->Update((const PRUint8*) buf, size);\r
+ status = PR_GetError();\r
+ if (status < 0) goto FAIL;\r
+ }\r
+\r
+ PR_SetError(0,0);\r
+ if (mEncryptionContext) {\r
+ /* If we're encrypting, or signing-and-encrypting, write this data\r
+ by filtering it through the crypto library. */\r
+\r
+ /* We want to create equally sized encryption strings */\r
+ const char *inputBytesIterator = buf;\r
+ PRUint32 inputBytesLeft = size;\r
+\r
+ while (inputBytesLeft) {\r
+ const PRUint32 spaceLeftInBuffer = eBufferSize - mBufferedBytes;\r
+ const PRUint32 bytesToAppend = NS_MIN(inputBytesLeft, spaceLeftInBuffer);\r
+\r
+ memcpy(mBuffer+mBufferedBytes, inputBytesIterator, bytesToAppend);\r
+ mBufferedBytes += bytesToAppend;\r
+ \r
+ inputBytesIterator += bytesToAppend;\r
+ inputBytesLeft -= bytesToAppend;\r
+\r
+ if (eBufferSize == mBufferedBytes) {\r
+ rv = mEncryptionContext->Update(mBuffer, mBufferedBytes);\r
+ mBufferedBytes = 0;\r
+ if (NS_FAILED(rv)) {\r
+ status = PR_GetError();\r
+ PR_ASSERT(status < 0);\r
+ if (status >= 0) status = -1;\r
+ goto FAIL;\r
+ }\r
+ }\r
+ }\r
+ } else {\r
+ /* If we're not encrypting (presumably just signing) then write this\r
+ data directly to the file. */\r
+\r
+ PRUint32 n;\r
+ rv = mStream->Write(buf, size, &n);\r
+ if (NS_FAILED(rv) || n < size) {\r
+ return MK_MIME_ERROR_WRITING_FILE;\r
+ }\r
+ }\r
+ FAIL:\r
+ return status;\r
+}\r
+\r
+\r
+/*\r
+ * unfold string sequence : CRLF sequences followed by WSP will be interpreted without the CRLF\r
+ */\r
+nsAutoString& removeJumpSymb(nsAutoString& s)\r
+{\r
+ s.ReplaceSubstring(NS_LITERAL_STRING("\n\r "), NS_LITERAL_STRING(" "));\r
+ s.ReplaceSubstring(NS_LITERAL_STRING("\r\n "), NS_LITERAL_STRING(" "));\r
+ s.ReplaceSubstring(NS_LITERAL_STRING("\r "), NS_LITERAL_STRING(" "));\r
+ s.ReplaceSubstring(NS_LITERAL_STRING("\n "), NS_LITERAL_STRING(" "));\r
+ s.ReplaceSubstring(NS_LITERAL_STRING("\n\r\t"), NS_LITERAL_STRING(" "));\r
+ s.ReplaceSubstring(NS_LITERAL_STRING("\r\n\t"), NS_LITERAL_STRING(" "));\r
+ s.ReplaceSubstring(NS_LITERAL_STRING("\r\t"), NS_LITERAL_STRING(" "));\r
+ s.ReplaceSubstring(NS_LITERAL_STRING("\n\t"), NS_LITERAL_STRING(" "));\r
+\r
+ return s;\r
+}\r
+\r
+/*\r
+ * Convert all sequences of one ore more WSP characters to a single SP character\r
+ */\r
+nsAutoString& onlyOneWhiteSpace(nsAutoString& s){\r
+ s.ReplaceSubstring(NS_LITERAL_STRING("\t"), NS_LITERAL_STRING(" "));\r
+ s.ReplaceSubstring(NS_LITERAL_STRING(" "), NS_LITERAL_STRING(" "));\r
+ \r
+ return s;\r
+}\r
+\r
+\r
+nsAutoString& canonilizeHeaderValue(nsAutoString &hdrval)\r
+{\r
+ removeJumpSymb(hdrval);\r
+ onlyOneWhiteSpace(hdrval);\r
+ hdrval.CompressWhitespace(PR_TRUE,PR_TRUE);\r
+ return hdrval;\r
+}\r
+\r
+nsAutoString& canonilizeHeaderName(nsAutoString &hdrname)\r
+{\r
+ nsCAutoString utf8str = NS_ConvertUTF16toUTF8(hdrname);\r
+ ToLowerCase(utf8str);\r
+ hdrname = NS_ConvertUTF8toUTF16(utf8str);\r
+ onlyOneWhiteSpace(hdrname);\r
+ hdrname.CompressWhitespace(PR_TRUE,PR_TRUE);\r
+ return hdrname;\r
+}\r
+\r
+void strsplit(const char separator, nsAString& strToSplit, nsStringArray & result)\r
+{\r
+ PRInt32 start = 0;\r
+ PRInt32 end = 0;\r
+ PRInt32 len = 0;\r
+\r
+ while (end != -1) {\r
+ end = strToSplit.FindChar(separator,start);\r
+ if (end == -1) {\r
+ len = strToSplit.Length() - start;\r
+ } else {\r
+ len = end - start;\r
+ }\r
+ // grab the name of the current header pref\r
+ const nsAString& str_tmp = Substring(strToSplit, start, end);\r
+\r
+ start = end + 1;\r
+ result.AppendString(str_tmp);\r
+ }\r
+ \r
+}\r
+\r
+/* \r
+ Parse extended headers\r
+ */\r
+void parseHeaderValue(const nsAString & str, const nsAString& headerName, nsAString & headerVal)\r
+{\r
+ nsVoidArray tab_header;\r
+ nsAutoString ligne_header;\r
+ nsAutoString tmpstr(str);\r
+ nsAString::const_iterator cur_pos_str,cur_pos_CRLF,start,end;\r
+\r
+ tmpstr.BeginReading(start);\r
+ tmpstr.EndReading(end);\r
+ \r
+ cur_pos_str=start;\r
+ cur_pos_CRLF=end;\r
+ NS_NAMED_LITERAL_STRING(valuePrefix, "\r\n");\r
+ \r
+ while(FindInReadable(valuePrefix, start, end))\r
+ {\r
+ cur_pos_CRLF = end;\r
+ if(*cur_pos_CRLF == PRUnichar(' '))\r
+ {\r
+ ligne_header.Append(Substring(cur_pos_CRLF.start(),cur_pos_CRLF.get()));\r
+ tmpstr.Replace(0,end.get()-end.start(),NS_LITERAL_STRING(""));\r
+ }\r
+ else\r
+ {\r
+ ligne_header.Append(Substring(cur_pos_CRLF.start(),cur_pos_CRLF.get()));\r
+ nsAutoString _hdrName;\r
+ nsAutoString _hdrValue;\r
+ \r
+ _hdrName.Assign(Substring(ligne_header,0,ligne_header.FindChar(':',0)));\r
+ _hdrValue.Assign(Substring(ligne_header,ligne_header.FindChar(':',0)+2,ligne_header.Length()-ligne_header.FindChar(':',0)+1));\r
+ if(_hdrName.Equals(headerName)){\r
+ headerVal.Assign(_hdrValue);\r
+ break;\r
+ } \r
+ ligne_header.Assign(NS_LITERAL_STRING(""));\r
+ tmpstr.Replace(0,end.get()-end.start(),NS_LITERAL_STRING(""));\r
+ }\r
+ \r
+ tmpstr.BeginReading(start);\r
+ tmpstr.EndReading(end);\r
+ }\r
+}\r
+\r
+/* \r
+ Returns mime encoded value\r
+ */\r
+void GetMimeEncodedValue(nsAString& headerName, nsAString& charset, PRBool bstructured, nsAString & value, nsAString & result){\r
+ nsresult rv;\r
+ char * tmp;\r
+ tmp=NULL;\r
+ nsCOMPtr<nsIMimeConverter> mimeconverter = do_GetService(NS_MIME_CONVERTER_CONTRACTID, &rv);\r
+ \r
+ mimeconverter->EncodeMimePartIIStr_UTF8(NS_ConvertUTF16toUTF8(value), \r
+ bstructured,\r
+ NS_ConvertUTF16toUTF8(charset).get(),\r
+ (PRInt32)headerName.Length()+2, // header len + 2 characters semi-colon and space ": " \r
+ nsIMimeConverter::MIME_ENCODED_WORD_SIZE,\r
+ &tmp);\r
+ if(tmp!=NULL)\r
+ {\r
+ result.Assign(NS_ConvertUTF8toUTF16(tmp));\r
+ }\r
+ else{\r
+ result.Assign(value);\r
+ }\r
+}\r
+\r
+/* \r
+ Returns value of header as mime encoded format\r
+ */\r
+void GetValueHeader(nsAString& headerName,nsIMsgCompFields * aComposeFields, nsAString & result)\r
+{\r
+ nsresult rv;\r
+ nsAutoString otherHeaders;\r
+ nsAutoString to;\r
+ nsAutoString from;\r
+ nsAutoString subject;\r
+ nsAutoString cc;\r
+ nsAutoString bcc;\r
+ nsAutoString body;\r
+ nsAutoString messageId;\r
+ nsAutoString priority;\r
+ nsAutoString replyTo;\r
+ nsAutoString charset;\r
+\r
+ aComposeFields->GetTo(to);\r
+ aComposeFields->GetFrom(from);\r
+ aComposeFields->GetSubject(subject);\r
+ aComposeFields->GetCc(cc);\r
+ aComposeFields->GetBcc(bcc);\r
+ aComposeFields->GetBody(body);\r
+ aComposeFields->GetOtherRandomHeaders(otherHeaders);\r
+ aComposeFields->GetReplyTo(replyTo);\r
+ char * tmp;\r
+ aComposeFields->GetMessageId(&tmp);\r
+ messageId=NS_ConvertASCIItoUTF16(tmp);\r
+ aComposeFields->GetPriority(&tmp);\r
+ priority=NS_ConvertASCIItoUTF16(tmp);\r
+ aComposeFields->GetCharacterSet(&tmp);\r
+ charset=NS_ConvertASCIItoUTF16(tmp);\r
+ if(charset.IsEmpty()){\r
+ aComposeFields->GetDefaultCharacterSet(&tmp);\r
+ charset=NS_ConvertASCIItoUTF16(tmp);\r
+ }\r
+\r
+ //replace the tabulation by a space for each header\r
+ //which can be multiline to simplify the treatment\r
+ to.ReplaceSubstring(NS_LITERAL_STRING("\t"), NS_LITERAL_STRING(" "));\r
+ cc.ReplaceSubstring(NS_LITERAL_STRING("\t"), NS_LITERAL_STRING(" "));\r
+ bcc.ReplaceSubstring(NS_LITERAL_STRING("\t"), NS_LITERAL_STRING(" "));\r
+ \r
+ if(headerName.LowerCaseEqualsLiteral("from")){\r
+ if(!from.IsEmpty()){\r
+ GetMimeEncodedValue(headerName, charset, PR_TRUE, from, result);\r
+ return;\r
+ }\r
+ }\r
+ else if(headerName.LowerCaseEqualsLiteral("to")){\r
+ if(!to.IsEmpty()){\r
+ GetMimeEncodedValue(headerName, charset, PR_TRUE, to, result);\r
+ return;\r
+ }\r
+ }\r
+ else if(headerName.LowerCaseEqualsLiteral("body")){\r
+ if(!body.IsEmpty()){\r
+ GetMimeEncodedValue(headerName, charset, PR_FALSE, body, result);\r
+ return;\r
+ }\r
+ }\r
+ else if(headerName.LowerCaseEqualsLiteral("subject")){\r
+ if(!subject.IsEmpty()){\r
+ GetMimeEncodedValue(headerName, charset, PR_FALSE, subject, result);\r
+ return;\r
+ }\r
+ }\r
+ else if(headerName.LowerCaseEqualsLiteral("cc")){\r
+ if(!cc.IsEmpty()){\r
+ GetMimeEncodedValue(headerName, charset, PR_TRUE, cc, result);\r
+ return;\r
+ }\r
+ }\r
+ else if(headerName.LowerCaseEqualsLiteral("bcc")){\r
+ if(!bcc.IsEmpty()){\r
+ GetMimeEncodedValue(headerName, charset, PR_TRUE, bcc, result);\r
+ return;\r
+ }\r
+ }\r
+ else if(headerName.LowerCaseEqualsLiteral("message-id")){\r
+ if(!messageId.IsEmpty())\r
+ result.Assign(messageId);\r
+ }\r
+ else if(headerName.LowerCaseEqualsLiteral("priority")){\r
+ if(!priority.IsEmpty())\r
+ result.Assign(priority);\r
+ }\r
+ else if(headerName.LowerCaseEqualsLiteral("reply-to")){\r
+ if(!replyTo.IsEmpty()){\r
+ GetMimeEncodedValue(headerName, charset, PR_TRUE, replyTo, result);\r
+ return;\r
+ }\r
+ }\r
+ else{\r
+ parseHeaderValue(otherHeaders,headerName,result);\r
+ }\r
+\r
+}\r
+\r
+/* \r
+ Returns array of secure headers \r
+ */\r
+nsresult nsMsgComposeSecure::ReadHeadersToSecure(nsIMsgIdentity * aIdentity,nsIMsgCompFields * aComposeFields){\r
+\r
+ //Extract Signed Headers list\r
+ nsCOMPtr<nsISupports> securityInfo;\r
+ if (aComposeFields)\r
+ {\r
+ aComposeFields->GetSecurityInfo(getter_AddRefs(securityInfo));\r
+\r
+ if (securityInfo) // if we were given security comp fields, use them.....\r
+ {\r
+ nsCOMPtr<nsIMsgSMIMECompFields> smimeCompFields = do_QueryInterface(securityInfo);\r
+ if (smimeCompFields)\r
+ {\r
+ nsCOMPtr<nsIMutableArray> tmpHeaders;\r
+ smimeCompFields->GetSecureHeadersList(getter_AddRefs(tmpHeaders));\r
+ smimeCompFields->GetCanonAlgorithme(&mCanonAlgorithme);\r
+ if(tmpHeaders)\r
+ {\r
+ nsresult rv;\r
+ mSecureHeaders = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);\r
+ PRUint32 nbHeaders;\r
+ tmpHeaders->GetLength(&nbHeaders);\r
+ \r
+ for(int i=0;i<nbHeaders;++i)\r
+ {\r
+ nsCOMPtr<nsIMsgSMIMESecureHeader> _secureHeader= do_QueryElementAt(tmpHeaders,i);\r
+ if(_secureHeader)\r
+ {\r
+ nsAutoString _headerName;\r
+ nsAutoString _headerValue;\r
+ PRInt32 _headerStatus;\r
+ _secureHeader->GetHeaderName(_headerName);\r
+ GetValueHeader(_headerName,aComposeFields,_headerValue);\r
+ if(!_headerValue.IsEmpty()){\r
+\r
+ if(mCanonAlgorithme){\r
+ canonilizeHeaderName(_headerName);\r
+ canonilizeHeaderValue(_headerValue);\r
+ }\r
+ _secureHeader->SetHeaderName(_headerName);\r
+ _secureHeader->SetHeaderValue(_headerValue);\r
+ mSecureHeaders->AppendElement(_secureHeader,PR_FALSE);\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ return NS_OK;\r
+}\r
+\r
+/* Returns a string consisting of a Content-Type header, and a boundary\r
+ string, suitable for moving from the header block, down into the body\r
+ of a multipart object. The boundary itself is also returned (so that\r
+ the caller knows what to write to close it off.)\r
+ */\r
+static int\r
+make_multipart_signed_header_string(PRBool outer_p,\r
+ char **header_return,\r
+ char **boundary_return)\r
+{\r
+ *header_return = 0;\r
+ *boundary_return = mime_make_separator("ms");\r
+ const char * crypto_multipart_blurb = nsnull;\r
+\r
+ if (!*boundary_return)\r
+ return NS_ERROR_OUT_OF_MEMORY;\r
+\r
+ if (outer_p) {\r
+ crypto_multipart_blurb = MIME_MULTIPART_SIGNED_BLURB;\r
+ }\r
+\r
+ *header_return = PR_smprintf(\r
+ "Content-Type: " MULTIPART_SIGNED "; "\r
+ "protocol=\"" APPLICATION_PKCS7_SIGNATURE "\"; "\r
+ "micalg=" PARAM_MICALG_SHA1 "; "\r
+ "boundary=\"%s\"" CRLF\r
+ CRLF\r
+ "%s%s"\r
+ "--%s" CRLF,\r
+\r
+ *boundary_return,\r
+ (crypto_multipart_blurb ? crypto_multipart_blurb : ""),\r
+ (crypto_multipart_blurb ? CRLF CRLF : ""),\r
+ *boundary_return);\r
+\r
+ if (!*header_return) {\r
+ PR_Free(*boundary_return);\r
+ *boundary_return = 0;\r
+ return NS_ERROR_OUT_OF_MEMORY;\r
+ }\r
+\r
+ return 0;\r
+}\r
+\r
+/* Used as the output function of a SEC_PKCS7EncoderContext -- we feed\r
+ plaintext into the crypto engine, and it calls this function with encrypted\r
+ data; then this function writes a base64-encoded representation of that\r
+ data to the file (by filtering it through the given MimeEncoderData object.)\r
+\r
+ Also used as the output function of SEC_PKCS7Encode() -- but in that case,\r
+ it's used to write the encoded representation of the signature. The only\r
+ difference is which MimeEncoderData object is used.\r
+ */\r
+static void\r
+mime_crypto_write_base64 (void *closure, const char *buf,\r
+ unsigned long size)\r
+{\r
+ MimeEncoderData *data = (MimeEncoderData *) closure;\r
+ int status = MIME_EncoderWrite (data, buf, size);\r
+ PR_SetError(status < 0 ? status : 0, 0);\r
+}\r
+\r
+\r
+/* Used as the output function of MimeEncoderData -- when we have generated\r
+ the signature for a multipart/signed object, this is used to write the\r
+ base64-encoded representation of the signature to the file.\r
+ */\r
+nsresult mime_encoder_output_fn(const char *buf, PRInt32 size, void *closure)\r
+{\r
+ nsMsgComposeSecure *state = (nsMsgComposeSecure *) closure;\r
+ nsCOMPtr<nsIOutputStream> stream;\r
+ state->GetOutputStream(getter_AddRefs(stream));\r
+ PRUint32 n;\r
+ nsresult rv = stream->Write((char *) buf, size, &n);\r
+ if (NS_FAILED(rv) || n < size)\r
+ return MK_MIME_ERROR_WRITING_FILE;\r
+ else\r
+ return 0;\r
+}\r
+\r
+/* Like mime_encoder_output_fn, except this is used for the case where we\r
+ are both signing and encrypting -- the base64-encoded output of the\r
+ signature should be fed into the crypto engine, rather than being written\r
+ directly to the file.\r
+ */\r
+static nsresult\r
+mime_nested_encoder_output_fn (const char *buf, PRInt32 size, void *closure)\r
+{\r
+ nsMsgComposeSecure *state = (nsMsgComposeSecure *) closure;\r
+ return state->MimeCryptoWriteBlock ((char *) buf, size);\r
}
\ No newline at end of file
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
- * Copyright (c) 2010 CASSIDIAN - All rights reserved
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* @param aEatContinuation When set, removes CR/LF
* @return decoded header value
*/
- //[noscript]
+ [noscript]
ACString decodeRFC2047Header(in string aHeaderVal,
in string aDefaultCharset,
in boolean aOverrideCharset,
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Red Hat, Inc.
- * Portions created by the Initial Developer are Copyright (C) 2008
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Kai Engert <kengert@redhat.com>
- * Copyright (c) 2010 CASSIDIAN - All rights reserved
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either 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.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "nsClientAuthRemember.h"
-
-#include "nsIX509Cert.h"
-#include "nsCRT.h"
-#include "nsNetUtil.h"
-#include "nsIObserverService.h"
-#include "nsNetUtil.h"
-#include "nsISupportsPrimitives.h"
-#include "nsPromiseFlatString.h"
-#include "nsProxiedService.h"
-#include "nsStringBuffer.h"
-#include "nsAutoLock.h"
-#include "nspr.h"
-#include "pk11pub.h"
-#include "certdb.h"
-#include "sechash.h"
-#include "ssl.h" // For SSL_ClearSessionCache
-
-#include "nsNSSCleaner.h"
-NSSCleanupAutoPtrClass(CERTCertificate, CERT_DestroyCertificate)
-
-NS_IMPL_THREADSAFE_ISUPPORTS2(nsClientAuthRememberService,
- nsIObserver,
- nsISupportsWeakReference)
-
-nsClientAuthRememberService::nsClientAuthRememberService()
-{
- monitor = PR_NewMonitor();
-}
-
-nsClientAuthRememberService::~nsClientAuthRememberService()
-{
- RemoveAllFromMemory();
- if (monitor)
- PR_DestroyMonitor(monitor);
-}
-
-nsresult
-nsClientAuthRememberService::Init()
-{
- if (!mSettingsTable.Init())
- return NS_ERROR_OUT_OF_MEMORY;
-
- nsCOMPtr<nsIProxyObjectManager> proxyman(do_GetService(NS_XPCOMPROXY_CONTRACTID));
- if (!proxyman)
- return NS_ERROR_FAILURE;
-
- nsCOMPtr<nsIObserverService> observerService(do_GetService("@mozilla.org/observer-service;1"));
- nsCOMPtr<nsIObserverService> proxiedObserver;
-
- NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
- NS_GET_IID(nsIObserverService),
- observerService,
- NS_PROXY_SYNC,
- getter_AddRefs(proxiedObserver));
-
- if (proxiedObserver) {
- proxiedObserver->AddObserver(this, "profile-before-change", PR_TRUE);
- }
-
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsClientAuthRememberService::Observe(nsISupports *aSubject,
- const char *aTopic,
- const PRUnichar *aData)
-{
- // check the topic
- if (!nsCRT::strcmp(aTopic, "profile-before-change")) {
- // The profile is about to change,
- // or is going away because the application is shutting down.
-
- nsAutoMonitor lock(monitor);
- RemoveAllFromMemory();
- }
-
- return NS_OK;
-}
-
-void nsClientAuthRememberService::ClearRememberedDecisions()
-{
- nsAutoMonitor lock(monitor);
- RemoveAllFromMemory();
-}
-
-void
-nsClientAuthRememberService::RemoveAllFromMemory()
-{
- mSettingsTable.Clear();
-}
-
-static nsresult
-GetCertFingerprintByOidTag(CERTCertificate* nsscert,
- SECOidTag aOidTag,
- nsCString &fp)
-{
- unsigned int hash_len = HASH_ResultLenByOidTag(aOidTag);
- nsRefPtr<nsStringBuffer> fingerprint = nsStringBuffer::Alloc(hash_len);
- if (!fingerprint)
- return NS_ERROR_OUT_OF_MEMORY;
-
- PK11_HashBuf(aOidTag, (unsigned char*)fingerprint->Data(),
- nsscert->derCert.data, nsscert->derCert.len);
-
- SECItem fpItem;
- fpItem.data = (unsigned char*)fingerprint->Data();
- fpItem.len = hash_len;
-
- fp.Adopt(CERT_Hexify(&fpItem, 1));
- return NS_OK;
-}
-
-nsresult
-nsClientAuthRememberService::RememberDecision(const nsACString & aHostName,
- CERTCertificate *aServerCert, CERTCertificate *aClientCert)
-{
- // aClientCert == NULL means: remember that user does not want to use a cert
- NS_ENSURE_ARG_POINTER(aServerCert);
- if (aHostName.IsEmpty())
- return NS_ERROR_INVALID_ARG;
-
- nsCAutoString fpStr;
- nsresult rv = GetCertFingerprintByOidTag(aServerCert, SEC_OID_SHA256, fpStr);
- if (NS_FAILED(rv))
- return rv;
-
- {
- nsAutoMonitor lock(monitor);
- if (aClientCert) {
- nsNSSCertificate pipCert(aClientCert);
- char *dbkey = NULL;
- rv = pipCert.GetDbKey(&dbkey);
- if (NS_SUCCEEDED(rv) && dbkey) {
- AddEntryToList(aHostName, fpStr,
- nsDependentCString(dbkey));
- }
- if (dbkey) {
- PORT_Free(dbkey);
- }
- }
- else {
- nsCString empty;
- AddEntryToList(aHostName, fpStr, empty);
- }
- }
-
- return NS_OK;
-}
-
-nsresult
-nsClientAuthRememberService::HasRememberedDecision(const nsACString & aHostName,
- CERTCertificate *aCert,
- nsACString & aCertDBKey,
- PRBool *_retval)
-{
- if (aHostName.IsEmpty())
- return NS_ERROR_INVALID_ARG;
-
- NS_ENSURE_ARG_POINTER(aCert);
- NS_ENSURE_ARG_POINTER(_retval);
- *_retval = PR_FALSE;
-
- nsresult rv;
- nsCAutoString fpStr;
- rv = GetCertFingerprintByOidTag(aCert, SEC_OID_SHA256, fpStr);
- if (NS_FAILED(rv))
- return rv;
-
- nsCAutoString hostCert;
- GetHostWithCert(aHostName, fpStr, hostCert);
- nsClientAuthRemember settings;
-
- {
- nsAutoMonitor lock(monitor);
- nsClientAuthRememberEntry *entry = mSettingsTable.GetEntry(hostCert.get());
- if (!entry)
- return NS_OK;
- settings = entry->mSettings; // copy
- }
-
- aCertDBKey = settings.mDBKey;
- *_retval = PR_TRUE;
- return NS_OK;
-}
-
-nsresult
-nsClientAuthRememberService::AddEntryToList(const nsACString &aHostName,
- const nsACString &fingerprint,
- const nsACString &db_key)
-
-{
- nsCAutoString hostCert;
- GetHostWithCert(aHostName, fingerprint, hostCert);
-
- {
- nsAutoMonitor lock(monitor);
- nsClientAuthRememberEntry *entry = mSettingsTable.PutEntry(hostCert.get());
-
- if (!entry) {
- NS_ERROR("can't insert a null entry!");
- return NS_ERROR_OUT_OF_MEMORY;
- }
-
- entry->mHostWithCert = hostCert;
-
- nsClientAuthRemember &settings = entry->mSettings;
- settings.mAsciiHost = aHostName;
- settings.mFingerprint = fingerprint;
- settings.mDBKey = db_key;
- }
-
- return NS_OK;
-}
-
-////////////////////////////////
-nsresult
-nsClientAuthRememberService::RememberDecision(const nsACString & aHostName,
- CERTCertificate *aServerCert, CERTCertificate *aClientCert, const nsACString & aClientLogin)
-{
- // aClientCert == NULL means: remember that user does not want to use a cert
- NS_ENSURE_ARG_POINTER(aServerCert);
- if (aHostName.IsEmpty())
- return NS_ERROR_INVALID_ARG;
-
- nsCAutoString fpStr;
- nsresult rv = GetCertFingerprintByOidTag(aServerCert, SEC_OID_SHA256, fpStr);
- if (NS_FAILED(rv))
- return rv;
-
- {
- nsAutoMonitor lock(monitor);
- if (aClientCert && aClientLogin.IsEmpty()) {
- AddEntryToList(aHostName, fpStr,
- nsDependentCString(aClientCert->nickname));
- }
- else if(aClientCert && !aClientLogin.IsEmpty()){
- AddEntryToList(aHostName, fpStr,
- nsDependentCString(aClientCert->nickname),
- aClientLogin);
- }
- else {
- nsCString empty;
- AddEntryToList(aHostName, fpStr, empty);
- }
- }
-
- return NS_OK;
-}
-
-nsresult
-nsClientAuthRememberService::HasRememberedDecision(const nsACString & aHostName,
- CERTCertificate *aCert,
- nsACString & aCertDBKey,
- PRBool *_retval,
- const nsACString & aClientLogin)
-{
- if (aHostName.IsEmpty())
- return NS_ERROR_INVALID_ARG;
-
- NS_ENSURE_ARG_POINTER(aCert);
- NS_ENSURE_ARG_POINTER(_retval);
- *_retval = PR_FALSE;
-
- nsresult rv;
- nsCAutoString fpStr;
- rv = GetCertFingerprintByOidTag(aCert, SEC_OID_SHA256, fpStr);
- if (NS_FAILED(rv))
- return rv;
-
- nsCAutoString hostCert;
- GetHostWithCert(aHostName, fpStr, hostCert);
- nsClientAuthRemember settings;
-
- {
- nsAutoMonitor lock(monitor);
- nsClientAuthRememberEntry *entry = mSettingsTable.GetEntry(hostCert.get());
- if (!entry)
- return NS_OK;
- settings = entry->mSettings; // copy
- }
-
- aCertDBKey = settings.mDBKey;
- if(aCertDBKey.IsEmpty() || aCertDBKey.Equals(settings.mDBKey))
- *_retval = PR_TRUE;
-
- return NS_OK;
-}
-
-nsresult
-nsClientAuthRememberService::AddEntryToList(const nsACString &aHostName,
- const nsACString &fingerprint,
- const nsACString &aCertDBKey,
- const nsACString &client_login)
-
-{
- nsCAutoString hostCert;
- GetHostWithCert(aHostName, fingerprint, hostCert);
-
- {
- nsAutoMonitor lock(monitor);
- nsClientAuthRememberEntry *entry = mSettingsTable.PutEntry(hostCert.get());
-
- if (!entry) {
- NS_ERROR("can't insert a null entry!");
- return NS_ERROR_OUT_OF_MEMORY;
- }
-
- entry->mHostWithCert = hostCert;
-
- nsClientAuthRemember &settings = entry->mSettings;
- settings.mAsciiHost = aHostName;
- settings.mFingerprint = fingerprint;
- settings.mDBKey = aCertDBKey;
- settings.mClientLogin = client_login;
- }
-
- return NS_OK;
-}
-////////////////////////////////
-
-void
-nsClientAuthRememberService::GetHostWithCert(const nsACString & aHostName,
- const nsACString & fingerprint,
- nsACString& _retval)
-{
- nsCAutoString hostCert(aHostName);
- hostCert.AppendLiteral(":");
- hostCert.Append(fingerprint);
-
- _retval.Assign(hostCert);
-}
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-\r
+ *\r
+ * ***** BEGIN LICENSE BLOCK *****\r
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1\r
+ *\r
+ * The contents of this file are subject to the Mozilla Public License Version\r
+ * 1.1 (the "License"); you may not use this file except in compliance with\r
+ * the License. You may obtain a copy of the License at\r
+ * http://www.mozilla.org/MPL/\r
+ *\r
+ * Software distributed under the License is distributed on an "AS IS" basis,\r
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License\r
+ * for the specific language governing rights and limitations under the\r
+ * License.\r
+ *\r
+ * The Original Code is mozilla.org code.\r
+ *\r
+ * The Initial Developer of the Original Code is\r
+ * Red Hat, Inc.\r
+ * Portions created by the Initial Developer are Copyright (C) 2008\r
+ * the Initial Developer. All Rights Reserved.\r
+ *\r
+ * Contributor(s):\r
+ * Kai Engert <kengert@redhat.com>\r
+ * Copyright (c) 2010 CASSIDIAN - All rights reserved\r
+ *\r
+ * Alternatively, the contents of this file may be used under the terms of\r
+ * either the GNU General Public License Version 2 or later (the "GPL"), or\r
+ * 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
+ * ***** END LICENSE BLOCK ***** */\r
+\r
+#include "nsClientAuthRemember.h"\r
+\r
+#include "nsIX509Cert.h"\r
+#include "nsCRT.h"\r
+#include "nsNetUtil.h"\r
+#include "nsIObserverService.h"\r
+#include "nsNetUtil.h"\r
+#include "nsISupportsPrimitives.h"\r
+#include "nsPromiseFlatString.h"\r
+#include "nsProxiedService.h"\r
+#include "nsStringBuffer.h"\r
+#include "nsAutoLock.h"\r
+#include "nspr.h"\r
+#include "pk11pub.h"\r
+#include "certdb.h"\r
+#include "sechash.h"\r
+#include "ssl.h" // For SSL_ClearSessionCache\r
+\r
+#include "nsNSSCleaner.h"\r
+NSSCleanupAutoPtrClass(CERTCertificate, CERT_DestroyCertificate)\r
+\r
+NS_IMPL_THREADSAFE_ISUPPORTS2(nsClientAuthRememberService, \r
+ nsIObserver,\r
+ nsISupportsWeakReference)\r
+\r
+nsClientAuthRememberService::nsClientAuthRememberService()\r
+{\r
+ monitor = PR_NewMonitor();\r
+}\r
+\r
+nsClientAuthRememberService::~nsClientAuthRememberService()\r
+{\r
+ RemoveAllFromMemory();\r
+ if (monitor)\r
+ PR_DestroyMonitor(monitor);\r
+}\r
+\r
+nsresult\r
+nsClientAuthRememberService::Init()\r
+{\r
+ if (!mSettingsTable.Init())\r
+ return NS_ERROR_OUT_OF_MEMORY;\r
+\r
+ nsCOMPtr<nsIProxyObjectManager> proxyman(do_GetService(NS_XPCOMPROXY_CONTRACTID));\r
+ if (!proxyman)\r
+ return NS_ERROR_FAILURE;\r
+\r
+ nsCOMPtr<nsIObserverService> observerService(do_GetService("@mozilla.org/observer-service;1"));\r
+ nsCOMPtr<nsIObserverService> proxiedObserver;\r
+\r
+ NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,\r
+ NS_GET_IID(nsIObserverService),\r
+ observerService,\r
+ NS_PROXY_SYNC,\r
+ getter_AddRefs(proxiedObserver));\r
+\r
+ if (proxiedObserver) {\r
+ proxiedObserver->AddObserver(this, "profile-before-change", PR_TRUE);\r
+ }\r
+\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP\r
+nsClientAuthRememberService::Observe(nsISupports *aSubject,\r
+ const char *aTopic,\r
+ const PRUnichar *aData)\r
+{\r
+ // check the topic\r
+ if (!nsCRT::strcmp(aTopic, "profile-before-change")) {\r
+ // The profile is about to change,\r
+ // or is going away because the application is shutting down.\r
+\r
+ nsAutoMonitor lock(monitor);\r
+ RemoveAllFromMemory();\r
+ }\r
+\r
+ return NS_OK;\r
+}\r
+\r
+void nsClientAuthRememberService::ClearRememberedDecisions()\r
+{\r
+ nsAutoMonitor lock(monitor);\r
+ RemoveAllFromMemory();\r
+}\r
+\r
+void\r
+nsClientAuthRememberService::RemoveAllFromMemory()\r
+{\r
+ mSettingsTable.Clear();\r
+}\r
+\r
+static nsresult\r
+GetCertFingerprintByOidTag(CERTCertificate* nsscert,\r
+ SECOidTag aOidTag, \r
+ nsCString &fp)\r
+{\r
+ unsigned int hash_len = HASH_ResultLenByOidTag(aOidTag);\r
+ nsRefPtr<nsStringBuffer> fingerprint = nsStringBuffer::Alloc(hash_len);\r
+ if (!fingerprint)\r
+ return NS_ERROR_OUT_OF_MEMORY;\r
+\r
+ PK11_HashBuf(aOidTag, (unsigned char*)fingerprint->Data(), \r
+ nsscert->derCert.data, nsscert->derCert.len);\r
+\r
+ SECItem fpItem;\r
+ fpItem.data = (unsigned char*)fingerprint->Data();\r
+ fpItem.len = hash_len;\r
+\r
+ fp.Adopt(CERT_Hexify(&fpItem, 1));\r
+ return NS_OK;\r
+}\r
+\r
+nsresult\r
+nsClientAuthRememberService::RememberDecision(const nsACString & aHostName, \r
+ CERTCertificate *aServerCert, CERTCertificate *aClientCert)\r
+{\r
+ // aClientCert == NULL means: remember that user does not want to use a cert\r
+ NS_ENSURE_ARG_POINTER(aServerCert);\r
+ if (aHostName.IsEmpty())\r
+ return NS_ERROR_INVALID_ARG;\r
+\r
+ nsCAutoString fpStr;\r
+ nsresult rv = GetCertFingerprintByOidTag(aServerCert, SEC_OID_SHA256, fpStr);\r
+ if (NS_FAILED(rv))\r
+ return rv;\r
+\r
+ {\r
+ nsAutoMonitor lock(monitor);\r
+ if (aClientCert) {\r
+ nsNSSCertificate pipCert(aClientCert);\r
+ char *dbkey = NULL;\r
+ rv = pipCert.GetDbKey(&dbkey);\r
+ if (NS_SUCCEEDED(rv) && dbkey) {\r
+ AddEntryToList(aHostName, fpStr, \r
+ nsDependentCString(dbkey));\r
+ }\r
+ if (dbkey) {\r
+ PORT_Free(dbkey);\r
+ }\r
+ }\r
+ else {\r
+ nsCString empty;\r
+ AddEntryToList(aHostName, fpStr, empty);\r
+ }\r
+ }\r
+\r
+ return NS_OK;\r
+}\r
+\r
+nsresult\r
+nsClientAuthRememberService::HasRememberedDecision(const nsACString & aHostName, \r
+ CERTCertificate *aCert, \r
+ nsACString & aCertDBKey,\r
+ PRBool *_retval)\r
+{\r
+ if (aHostName.IsEmpty())\r
+ return NS_ERROR_INVALID_ARG;\r
+\r
+ NS_ENSURE_ARG_POINTER(aCert);\r
+ NS_ENSURE_ARG_POINTER(_retval);\r
+ *_retval = PR_FALSE;\r
+\r
+ nsresult rv;\r
+ nsCAutoString fpStr;\r
+ rv = GetCertFingerprintByOidTag(aCert, SEC_OID_SHA256, fpStr);\r
+ if (NS_FAILED(rv))\r
+ return rv;\r
+\r
+ nsCAutoString hostCert;\r
+ GetHostWithCert(aHostName, fpStr, hostCert);\r
+ nsClientAuthRemember settings;\r
+\r
+ {\r
+ nsAutoMonitor lock(monitor);\r
+ nsClientAuthRememberEntry *entry = mSettingsTable.GetEntry(hostCert.get());\r
+ if (!entry)\r
+ return NS_OK;\r
+ settings = entry->mSettings; // copy\r
+ }\r
+\r
+ aCertDBKey = settings.mDBKey;\r
+ *_retval = PR_TRUE;\r
+ return NS_OK;\r
+}\r
+\r
+nsresult\r
+nsClientAuthRememberService::AddEntryToList(const nsACString &aHostName, \r
+ const nsACString &fingerprint,\r
+ const nsACString &db_key)\r
+\r
+{\r
+ nsCAutoString hostCert;\r
+ GetHostWithCert(aHostName, fingerprint, hostCert);\r
+\r
+ {\r
+ nsAutoMonitor lock(monitor);\r
+ nsClientAuthRememberEntry *entry = mSettingsTable.PutEntry(hostCert.get());\r
+\r
+ if (!entry) {\r
+ NS_ERROR("can't insert a null entry!");\r
+ return NS_ERROR_OUT_OF_MEMORY;\r
+ }\r
+\r
+ entry->mHostWithCert = hostCert;\r
+\r
+ nsClientAuthRemember &settings = entry->mSettings;\r
+ settings.mAsciiHost = aHostName;\r
+ settings.mFingerprint = fingerprint;\r
+ settings.mDBKey = db_key;\r
+ }\r
+\r
+ return NS_OK;\r
+}\r
+\r
+////////////////////////////////\r
+nsresult\r
+nsClientAuthRememberService::RememberDecision(const nsACString & aHostName, \r
+ CERTCertificate *aServerCert, CERTCertificate *aClientCert, const nsACString & aClientLogin)\r
+{\r
+ // aClientCert == NULL means: remember that user does not want to use a cert\r
+ NS_ENSURE_ARG_POINTER(aServerCert);\r
+ if (aHostName.IsEmpty())\r
+ return NS_ERROR_INVALID_ARG;\r
+\r
+ nsCAutoString fpStr;\r
+ nsresult rv = GetCertFingerprintByOidTag(aServerCert, SEC_OID_SHA256, fpStr);\r
+ if (NS_FAILED(rv))\r
+ return rv;\r
+\r
+ {\r
+ nsAutoMonitor lock(monitor);\r
+ if (aClientCert && aClientLogin.IsEmpty()) {\r
+ AddEntryToList(aHostName, fpStr, \r
+ nsDependentCString(aClientCert->nickname));\r
+ }\r
+ else if(aClientCert && !aClientLogin.IsEmpty()){\r
+ AddEntryToList(aHostName, fpStr, \r
+ nsDependentCString(aClientCert->nickname),\r
+ aClientLogin);\r
+ }\r
+ else {\r
+ nsCString empty;\r
+ AddEntryToList(aHostName, fpStr, empty);\r
+ }\r
+ }\r
+\r
+ return NS_OK;\r
+}\r
+\r
+nsresult\r
+nsClientAuthRememberService::HasRememberedDecision(const nsACString & aHostName, \r
+ CERTCertificate *aCert, \r
+ nsACString & aCertDBKey,\r
+ PRBool *_retval,\r
+ const nsACString & aClientLogin)\r
+{\r
+ if (aHostName.IsEmpty())\r
+ return NS_ERROR_INVALID_ARG;\r
+\r
+ NS_ENSURE_ARG_POINTER(aCert);\r
+ NS_ENSURE_ARG_POINTER(_retval);\r
+ *_retval = PR_FALSE;\r
+\r
+ nsresult rv;\r
+ nsCAutoString fpStr;\r
+ rv = GetCertFingerprintByOidTag(aCert, SEC_OID_SHA256, fpStr);\r
+ if (NS_FAILED(rv))\r
+ return rv;\r
+\r
+ nsCAutoString hostCert;\r
+ GetHostWithCert(aHostName, fpStr, hostCert);\r
+ nsClientAuthRemember settings;\r
+\r
+ {\r
+ nsAutoMonitor lock(monitor);\r
+ nsClientAuthRememberEntry *entry = mSettingsTable.GetEntry(hostCert.get());\r
+ if (!entry)\r
+ return NS_OK;\r
+ settings = entry->mSettings; // copy\r
+ }\r
+\r
+ aCertDBKey = settings.mDBKey;\r
+ if(aCertDBKey.IsEmpty() || aCertDBKey.Equals(settings.mDBKey))\r
+ *_retval = PR_TRUE;\r
+ \r
+ return NS_OK;\r
+}\r
+\r
+nsresult\r
+nsClientAuthRememberService::AddEntryToList(const nsACString &aHostName, \r
+ const nsACString &fingerprint,\r
+ const nsACString &aCertDBKey,\r
+ const nsACString &client_login)\r
+\r
+{\r
+ nsCAutoString hostCert;\r
+ GetHostWithCert(aHostName, fingerprint, hostCert);\r
+\r
+ {\r
+ nsAutoMonitor lock(monitor);\r
+ nsClientAuthRememberEntry *entry = mSettingsTable.PutEntry(hostCert.get());\r
+\r
+ if (!entry) {\r
+ NS_ERROR("can't insert a null entry!");\r
+ return NS_ERROR_OUT_OF_MEMORY;\r
+ }\r
+\r
+ entry->mHostWithCert = hostCert;\r
+\r
+ nsClientAuthRemember &settings = entry->mSettings;\r
+ settings.mAsciiHost = aHostName;\r
+ settings.mFingerprint = fingerprint;\r
+ settings.mDBKey = aCertDBKey;\r
+ settings.mClientLogin = client_login;\r
+ }\r
+\r
+ return NS_OK;\r
+}\r
+////////////////////////////////\r
+\r
+void\r
+nsClientAuthRememberService::GetHostWithCert(const nsACString & aHostName, \r
+ const nsACString & fingerprint, \r
+ nsACString& _retval)\r
+{\r
+ nsCAutoString hostCert(aHostName);\r
+ hostCert.AppendLiteral(":");\r
+ hostCert.Append(fingerprint);\r
+ \r
+ _retval.Assign(hostCert);\r
+}\r
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Red Hat, Inc.
- * Portions created by the Initial Developer are Copyright (C) 2008
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Kai Engert <kengert@redhat.com>
- * Copyright (c) 2010 CASSIDIAN - All rights reserved
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either 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.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef __NSCLIENTAUTHREMEMBER_H__
-#define __NSCLIENTAUTHREMEMBER_H__
-
-#include "nsTHashtable.h"
-#include "nsIObserver.h"
-#include "nsIX509Cert.h"
-#include "nsAutoPtr.h"
-#include "nsNSSCertificate.h"
-#include "nsString.h"
-#include "nsWeakReference.h"
-#include "prmon.h"
-
-class nsClientAuthRemember
-{
-public:
-
- nsClientAuthRemember()
- {
- }
-
- nsClientAuthRemember(const nsClientAuthRemember &other)
- {
- this->operator=(other);
- }
-
- nsClientAuthRemember &operator=(const nsClientAuthRemember &other)
- {
- mAsciiHost = other.mAsciiHost;
- mFingerprint = other.mFingerprint;
- mDBKey = other.mDBKey;
- mClientLogin = other.mClientLogin;
- return *this;
- }
-
- nsCString mAsciiHost;
- nsCString mFingerprint;
- nsCString mDBKey;
- nsCString mClientLogin;
-};
-
-
-// hash entry class
-class nsClientAuthRememberEntry : public PLDHashEntryHdr
-{
- public:
- // Hash methods
- typedef const char* KeyType;
- typedef const char* KeyTypePointer;
-
- // do nothing with aHost - we require mHead to be set before we're live!
- nsClientAuthRememberEntry(KeyTypePointer aHostWithCertUTF8)
- {
- }
-
- nsClientAuthRememberEntry(const nsClientAuthRememberEntry& toCopy)
- {
- mSettings = toCopy.mSettings;
- }
-
- ~nsClientAuthRememberEntry()
- {
- }
-
- KeyType GetKey() const
- {
- return HostWithCertPtr();
- }
-
- KeyTypePointer GetKeyPointer() const
- {
- return HostWithCertPtr();
- }
-
- PRBool KeyEquals(KeyTypePointer aKey) const
- {
- return !strcmp(HostWithCertPtr(), aKey);
- }
-
- static KeyTypePointer KeyToPointer(KeyType aKey)
- {
- return aKey;
- }
-
- static PLDHashNumber HashKey(KeyTypePointer aKey)
- {
- // PL_DHashStringKey doesn't use the table parameter, so we can safely
- // pass nsnull
- return PL_DHashStringKey(nsnull, aKey);
- }
-
- enum { ALLOW_MEMMOVE = PR_FALSE };
-
- // get methods
- inline const nsCString &HostWithCert() const { return mHostWithCert; }
-
- inline KeyTypePointer HostWithCertPtr() const
- {
- return mHostWithCert.get();
- }
-
- nsClientAuthRemember mSettings;
- nsCString mHostWithCert;
-};
-
-class nsClientAuthRememberService : public nsIObserver,
- public nsSupportsWeakReference
-{
-public:
- NS_DECL_ISUPPORTS
- NS_DECL_NSIOBSERVER
-
- nsClientAuthRememberService();
- ~nsClientAuthRememberService();
-
- nsresult Init();
-
- static void GetHostWithCert(const nsACString & aHostName,
- const nsACString & nickname, nsACString& _retval);
-
- nsresult RememberDecision(const nsACString & aHostName,
- CERTCertificate *aServerCert, CERTCertificate *aClientCert);
- nsresult HasRememberedDecision(const nsACString & aHostName,
- CERTCertificate *aServerCert,
- nsACString & aCertDBKey, PRBool *_retval);
-
- nsresult RememberDecision(const nsACString & aHostName,
- CERTCertificate *aServerCert, CERTCertificate *aClientCert, const nsACString & aClientLogin);
- nsresult HasRememberedDecision(const nsACString & aHostName,
- CERTCertificate *aServerCert,
- nsACString & aCertDBKey, PRBool *_retval,
- const nsACString & aClientLogin);
-
- void ClearRememberedDecisions();
-
-protected:
- PRMonitor *monitor;
- nsTHashtable<nsClientAuthRememberEntry> mSettingsTable;
-
- void RemoveAllFromMemory();
- nsresult AddEntryToList(const nsACString &host,
- const nsACString &server_fingerprint,
- const nsACString &db_key);
-
- nsresult AddEntryToList(const nsACString &host,
- const nsACString &server_fingerprint,
- const nsACString &client_nickname,
- const nsACString &db_key);
-};
-
-#endif
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-\r
+ *\r
+ * ***** BEGIN LICENSE BLOCK *****\r
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1\r
+ *\r
+ * The contents of this file are subject to the Mozilla Public License Version\r
+ * 1.1 (the "License"); you may not use this file except in compliance with\r
+ * the License. You may obtain a copy of the License at\r
+ * http://www.mozilla.org/MPL/\r
+ *\r
+ * Software distributed under the License is distributed on an "AS IS" basis,\r
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License\r
+ * for the specific language governing rights and limitations under the\r
+ * License.\r
+ *\r
+ * The Original Code is mozilla.org code.\r
+ *\r
+ * The Initial Developer of the Original Code is\r
+ * Red Hat, Inc.\r
+ * Portions created by the Initial Developer are Copyright (C) 2008\r
+ * the Initial Developer. All Rights Reserved.\r
+ *\r
+ * Contributor(s):\r
+ * Kai Engert <kengert@redhat.com>\r
+ * Copyright (c) 2010 CASSIDIAN - All rights reserved\r
+ *\r
+ * Alternatively, the contents of this file may be used under the terms of\r
+ * either the GNU General Public License Version 2 or later (the "GPL"), or\r
+ * 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
+ * ***** END LICENSE BLOCK ***** */\r
+\r
+#ifndef __NSCLIENTAUTHREMEMBER_H__\r
+#define __NSCLIENTAUTHREMEMBER_H__\r
+\r
+#include "nsTHashtable.h"\r
+#include "nsIObserver.h"\r
+#include "nsIX509Cert.h"\r
+#include "nsAutoPtr.h"\r
+#include "nsNSSCertificate.h"\r
+#include "nsString.h"\r
+#include "nsWeakReference.h"\r
+#include "prmon.h"\r
+\r
+class nsClientAuthRemember\r
+{\r
+public:\r
+\r
+ nsClientAuthRemember()\r
+ {\r
+ }\r
+ \r
+ nsClientAuthRemember(const nsClientAuthRemember &other)\r
+ {\r
+ this->operator=(other);\r
+ }\r
+\r
+ nsClientAuthRemember &operator=(const nsClientAuthRemember &other)\r
+ {\r
+ mAsciiHost = other.mAsciiHost;\r
+ mFingerprint = other.mFingerprint;\r
+ mDBKey = other.mDBKey;\r
+ mClientLogin = other.mClientLogin;\r
+ return *this;\r
+ }\r
+\r
+ nsCString mAsciiHost;\r
+ nsCString mFingerprint;\r
+ nsCString mDBKey;\r
+ nsCString mClientLogin;\r
+};\r
+\r
+\r
+// hash entry class\r
+class nsClientAuthRememberEntry : public PLDHashEntryHdr\r
+{\r
+ public:\r
+ // Hash methods\r
+ typedef const char* KeyType;\r
+ typedef const char* KeyTypePointer;\r
+\r
+ // do nothing with aHost - we require mHead to be set before we're live!\r
+ nsClientAuthRememberEntry(KeyTypePointer aHostWithCertUTF8)\r
+ {\r
+ }\r
+\r
+ nsClientAuthRememberEntry(const nsClientAuthRememberEntry& toCopy)\r
+ {\r
+ mSettings = toCopy.mSettings;\r
+ }\r
+\r
+ ~nsClientAuthRememberEntry()\r
+ {\r
+ }\r
+\r
+ KeyType GetKey() const\r
+ {\r
+ return HostWithCertPtr();\r
+ }\r
+\r
+ KeyTypePointer GetKeyPointer() const\r
+ {\r
+ return HostWithCertPtr();\r
+ }\r
+\r
+ PRBool KeyEquals(KeyTypePointer aKey) const\r
+ {\r
+ return !strcmp(HostWithCertPtr(), aKey);\r
+ }\r
+\r
+ static KeyTypePointer KeyToPointer(KeyType aKey)\r
+ {\r
+ return aKey;\r
+ }\r
+\r
+ static PLDHashNumber HashKey(KeyTypePointer aKey)\r
+ {\r
+ // PL_DHashStringKey doesn't use the table parameter, so we can safely\r
+ // pass nsnull\r
+ return PL_DHashStringKey(nsnull, aKey);\r
+ }\r
+\r
+ enum { ALLOW_MEMMOVE = PR_FALSE };\r
+\r
+ // get methods\r
+ inline const nsCString &HostWithCert() const { return mHostWithCert; }\r
+\r
+ inline KeyTypePointer HostWithCertPtr() const\r
+ {\r
+ return mHostWithCert.get();\r
+ }\r
+\r
+ nsClientAuthRemember mSettings;\r
+ nsCString mHostWithCert;\r
+};\r
+\r
+class nsClientAuthRememberService : public nsIObserver,\r
+ public nsSupportsWeakReference\r
+{\r
+public:\r
+ NS_DECL_ISUPPORTS\r
+ NS_DECL_NSIOBSERVER\r
+\r
+ nsClientAuthRememberService();\r
+ ~nsClientAuthRememberService();\r
+\r
+ nsresult Init();\r
+\r
+ static void GetHostWithCert(const nsACString & aHostName, \r
+ const nsACString & nickname, nsACString& _retval);\r
+\r
+ nsresult RememberDecision(const nsACString & aHostName, \r
+ CERTCertificate *aServerCert, CERTCertificate *aClientCert);\r
+ nsresult HasRememberedDecision(const nsACString & aHostName, \r
+ CERTCertificate *aServerCert, \r
+ nsACString & aCertDBKey, PRBool *_retval);\r
+\r
+ nsresult RememberDecision(const nsACString & aHostName, \r
+ CERTCertificate *aServerCert, CERTCertificate *aClientCert, const nsACString & aClientLogin);\r
+ nsresult HasRememberedDecision(const nsACString & aHostName, \r
+ CERTCertificate *aServerCert, \r
+ nsACString & aCertDBKey, PRBool *_retval, \r
+ const nsACString & aClientLogin);\r
+\r
+ void ClearRememberedDecisions();\r
+\r
+protected:\r
+ PRMonitor *monitor;\r
+ nsTHashtable<nsClientAuthRememberEntry> mSettingsTable;\r
+\r
+ void RemoveAllFromMemory();\r
+ nsresult AddEntryToList(const nsACString &host, \r
+ const nsACString &server_fingerprint,\r
+ const nsACString &db_key);\r
+ \r
+ nsresult AddEntryToList(const nsACString &host, \r
+ const nsACString &server_fingerprint,\r
+ const nsACString &client_nickname,\r
+ const nsACString &db_key); \r
+};\r
+\r
+#endif\r
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Brian Ryner <bryner@brianryner.com>
- * Javier Delgadillo <javi@netscape.com>
- * Kai Engert <kengert@redhat.com>
- * Copyright (c) 2010 CASSIDIAN - All rights reserved
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either 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.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "nsNSSComponent.h"
-#include "nsNSSIOLayer.h"
-#include "nsNSSCallbacks.h"
-
-#include "prlog.h"
-#include "prnetdb.h"
-#include "nsIPrompt.h"
-#include "nsIPrefService.h"
-#include "nsIPrefBranch.h"
-#include "nsIServiceManager.h"
-#include "nsIWebProgressListener.h"
-#include "nsIChannel.h"
-#include "nsNSSCertificate.h"
-#include "nsIX509CertValidity.h"
-#include "nsIProxyObjectManager.h"
-#include "nsProxiedService.h"
-#include "nsIDateTimeFormat.h"
-#include "nsDateTimeFormatCID.h"
-#include "nsIClientAuthDialogs.h"
-#include "nsClientAuthRemember.h"
-#include "nsICertOverrideService.h"
-#include "nsIBadCertListener2.h"
-#include "nsISSLErrorListener.h"
-#include "nsIObjectInputStream.h"
-#include "nsIObjectOutputStream.h"
-#include "nsRecentBadCerts.h"
-#include "nsISSLCertErrorDialog.h"
-
-#include "nsXPIDLString.h"
-#include "nsReadableUtils.h"
-#include "nsHashSets.h"
-#include "nsCRT.h"
-#include "nsAutoPtr.h"
-#include "nsPrintfCString.h"
-#include "nsAutoLock.h"
-#include "nsSSLThread.h"
-#include "nsNSSShutDown.h"
-#include "nsSSLStatus.h"
-#include "nsNSSCertHelper.h"
-#include "nsNSSCleaner.h"
-#include "nsThreadUtils.h"
-#include "nsIDocShell.h"
-#include "nsIDocShellTreeItem.h"
-#include "nsISecureBrowserUI.h"
-#include "nsProxyRelease.h"
-#include "nsIClassInfoImpl.h"
-#include "nsIProgrammingLanguage.h"
-#include "nsCommaSeparatedTokenizer.h"
-
-#include "ssl.h"
-#include "secerr.h"
-#include "sslerr.h"
-#include "secder.h"
-#include "secasn1.h"
-#include "certdb.h"
-#include "cert.h"
-#include "keyhi.h"
-#include "secport.h"
-
-
-//#define DEBUG_SSL_VERBOSE //Enable this define to get minimal
- //reports when doing SSL read/write
-
-//#define DUMP_BUFFER //Enable this define along with
- //DEBUG_SSL_VERBOSE to dump SSL
- //read/write buffer to a log.
- //Uses PR_LOG except on Mac where
- //we always write out to our own
- //file.
-
-NSSCleanupAutoPtrClass(CERTCertificate, CERT_DestroyCertificate)
-NSSCleanupAutoPtrClass(char, PL_strfree)
-NSSCleanupAutoPtrClass(void, PR_FREEIF)
-NSSCleanupAutoPtrClass_WithParam(PRArenaPool, PORT_FreeArena, FalseParam, PR_FALSE)
-
-/* SSM_UserCertChoice: enum for cert choice info */
-typedef enum {ASK, AUTO} SSM_UserCertChoice;
-
-
-static SECStatus PR_CALLBACK
-nsNSS_SSLGetClientAuthData(void *arg, PRFileDesc *socket,
- CERTDistNames *caNames,
- CERTCertificate **pRetCert,
- SECKEYPrivateKey **pRetKey);
-static SECStatus PR_CALLBACK
-nsNSS_SSLGetClientAuthData(void *arg, PRFileDesc *socket,
- CERTDistNames *caNames,
- CERTCertificate **pRetCert,
- SECKEYPrivateKey **pRetKey);
-#ifdef PR_LOGGING
-extern PRLogModuleInfo* gPIPNSSLog;
-#endif
-
-#if defined(DEBUG_SSL_VERBOSE) && defined (XP_MAC)
-
-#ifdef PR_LOG
-#undef PR_LOG
-#endif
-
-static PRFileDesc *gMyLogFile = nsnull;
-#define MAC_LOG_FILE "MAC PIPNSS Log File"
-
-void MyLogFunction(const char *fmt, ...)
-{
-
- va_list ap;
- va_start(ap,fmt);
- if (gMyLogFile == nsnull)
- gMyLogFile = PR_Open(MAC_LOG_FILE, PR_WRONLY | PR_CREATE_FILE | PR_APPEND,
- 0600);
- if (!gMyLogFile)
- return;
- PR_vfprintf(gMyLogFile, fmt, ap);
- va_end(ap);
-}
-
-#define PR_LOG(module,level,args) MyLogFunction args
-#endif
-
-
-nsSSLSocketThreadData::nsSSLSocketThreadData()
-: mSSLState(ssl_idle)
-, mPRErrorCode(PR_SUCCESS)
-, mSSLDataBuffer(nsnull)
-, mSSLDataBufferAllocatedSize(0)
-, mSSLRequestedTransferAmount(0)
-, mSSLRemainingReadResultData(nsnull)
-, mSSLResultRemainingBytes(0)
-, mReplacedSSLFileDesc(nsnull)
-, mOneBytePendingFromEarlierWrite(PR_FALSE)
-, mThePendingByte(0)
-, mOriginalRequestedTransferAmount(0)
-{
-}
-
-nsSSLSocketThreadData::~nsSSLSocketThreadData()
-{
- NS_ASSERTION(mSSLState != ssl_pending_write
- &&
- mSSLState != ssl_pending_read,
- "oops??? ssl socket is not idle at the time it is being destroyed");
- if (mSSLDataBuffer) {
- nsMemory::Free(mSSLDataBuffer);
- }
-}
-
-PRBool nsSSLSocketThreadData::ensure_buffer_size(PRInt32 amount)
-{
- if (amount > mSSLDataBufferAllocatedSize) {
- if (mSSLDataBuffer) {
- mSSLDataBuffer = (char*)nsMemory::Realloc(mSSLDataBuffer, amount);
- }
- else {
- mSSLDataBuffer = (char*)nsMemory::Alloc(amount);
- }
-
- if (!mSSLDataBuffer)
- return PR_FALSE;
-
- mSSLDataBufferAllocatedSize = amount;
- }
-
- return PR_TRUE;
-}
-
-nsNSSSocketInfo::nsNSSSocketInfo()
- : mFd(nsnull),
- mBlockingState(blocking_state_unknown),
- mSecurityState(nsIWebProgressListener::STATE_IS_INSECURE),
- mSubRequestsHighSecurity(0),
- mSubRequestsLowSecurity(0),
- mSubRequestsBrokenSecurity(0),
- mSubRequestsNoSecurity(0),
- mDocShellDependentStuffKnown(PR_FALSE),
- mExternalErrorReporting(PR_FALSE),
- mForSTARTTLS(PR_FALSE),
- mHandshakePending(PR_TRUE),
- mCanceled(PR_FALSE),
- mHasCleartextPhase(PR_FALSE),
- mHandshakeInProgress(PR_FALSE),
- mAllowTLSIntoleranceTimeout(PR_TRUE),
- mRememberClientAuthCertificate(PR_FALSE),
- mHandshakeStartTime(0),
- mPort(0)
-{
- mThreadData = new nsSSLSocketThreadData;
-}
-
-nsNSSSocketInfo::~nsNSSSocketInfo()
-{
- delete mThreadData;
-
- nsNSSShutDownPreventionLock locker;
- if (isAlreadyShutDown())
- return;
-
- shutdown(calledFromObject);
-}
-
-void nsNSSSocketInfo::virtualDestroyNSSReference()
-{
-}
-
-NS_IMPL_THREADSAFE_ISUPPORTS9(nsNSSSocketInfo,
- nsITransportSecurityInfo,
- nsISSLSocketControl,
- nsIInterfaceRequestor,
- nsISSLStatusProvider,
- nsIIdentityInfo,
- nsIAssociatedContentSecurity,
- nsISerializable,
- nsIClassInfo,
- nsIClientAuthUserDecision)
-
-nsresult
-nsNSSSocketInfo::GetHandshakePending(PRBool *aHandshakePending)
-{
- *aHandshakePending = mHandshakePending;
- return NS_OK;
-}
-
-nsresult
-nsNSSSocketInfo::SetHandshakePending(PRBool aHandshakePending)
-{
- mHandshakePending = aHandshakePending;
- return NS_OK;
-}
-
-nsresult
-nsNSSSocketInfo::SetHostName(const char* host)
-{
- mHostName.Adopt(host ? NS_strdup(host) : 0);
- return NS_OK;
-}
-
-nsresult
-nsNSSSocketInfo::GetHostName(char **host)
-{
- *host = (mHostName) ? NS_strdup(mHostName) : nsnull;
- return NS_OK;
-}
-
-nsresult
-nsNSSSocketInfo::SetClientLogin(const nsACString & aClientLogin)
-{
- mClientLogin = aClientLogin;
- return NS_OK;
-}
-
-nsresult
-nsNSSSocketInfo::GetClientLogin(nsACString & aClientLogin)
-{
- aClientLogin = mClientLogin;
- return NS_OK;
-}
-
-nsresult
-nsNSSSocketInfo::SetPort(PRInt32 aPort)
-{
- mPort = aPort;
- return NS_OK;
-}
-
-nsresult
-nsNSSSocketInfo::GetPort(PRInt32 *aPort)
-{
- *aPort = mPort;
- return NS_OK;
-}
-
-void nsNSSSocketInfo::SetCanceled(PRBool aCanceled)
-{
- mCanceled = aCanceled;
-}
-
-PRBool nsNSSSocketInfo::GetCanceled()
-{
- return mCanceled;
-}
-
-NS_IMETHODIMP nsNSSSocketInfo::GetRememberClientAuthCertificate(PRBool *aRememberClientAuthCertificate)
-{
- NS_ENSURE_ARG_POINTER(aRememberClientAuthCertificate);
- *aRememberClientAuthCertificate = mRememberClientAuthCertificate;
- return NS_OK;
-}
-
-NS_IMETHODIMP nsNSSSocketInfo::SetRememberClientAuthCertificate(PRBool aRememberClientAuthCertificate)
-{
- mRememberClientAuthCertificate = aRememberClientAuthCertificate;
- return NS_OK;
-}
-
-void nsNSSSocketInfo::SetHasCleartextPhase(PRBool aHasCleartextPhase)
-{
- mHasCleartextPhase = aHasCleartextPhase;
-}
-
-PRBool nsNSSSocketInfo::GetHasCleartextPhase()
-{
- return mHasCleartextPhase;
-}
-
-NS_IMETHODIMP
-nsNSSSocketInfo::GetNotificationCallbacks(nsIInterfaceRequestor** aCallbacks)
-{
- *aCallbacks = mCallbacks;
- NS_IF_ADDREF(*aCallbacks);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsNSSSocketInfo::SetNotificationCallbacks(nsIInterfaceRequestor* aCallbacks)
-{
- if (!aCallbacks) {
- mCallbacks = nsnull;
- return NS_OK;
- }
-
- mCallbacks = aCallbacks;
- mDocShellDependentStuffKnown = PR_FALSE;
-
- return NS_OK;
-}
-
-nsresult
-nsNSSSocketInfo::EnsureDocShellDependentStuffKnown()
-{
- if (mDocShellDependentStuffKnown)
- return NS_OK;
-
- if (!mCallbacks || nsSSLThread::exitRequested())
- return NS_ERROR_FAILURE;
-
- mDocShellDependentStuffKnown = PR_TRUE;
-
- nsCOMPtr<nsIInterfaceRequestor> proxiedCallbacks;
- NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
- NS_GET_IID(nsIInterfaceRequestor),
- static_cast<nsIInterfaceRequestor*>(mCallbacks),
- NS_PROXY_SYNC,
- getter_AddRefs(proxiedCallbacks));
-
- // Are we running within a context that wants external SSL error reporting?
- // We'll look at the presence of a security UI object inside docshell.
- // If the docshell wants the lock icon, you'll get the ssl error pages, too.
- // This is helpful to distinguish from all other contexts, like mail windows,
- // or any other SSL connections running in the background.
- // We must query it now and remember, because fatal SSL errors will come
- // with a socket close, and the socket transport might detach the callbacks
- // instance prior to our error reporting.
-
- nsCOMPtr<nsIDocShell> docshell;
-
- nsCOMPtr<nsIDocShellTreeItem> item(do_GetInterface(proxiedCallbacks));
- if (item)
- {
- nsCOMPtr<nsIDocShellTreeItem> proxiedItem;
- nsCOMPtr<nsIDocShellTreeItem> rootItem;
- NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
- NS_GET_IID(nsIDocShellTreeItem),
- item.get(),
- NS_PROXY_SYNC,
- getter_AddRefs(proxiedItem));
-
- proxiedItem->GetSameTypeRootTreeItem(getter_AddRefs(rootItem));
- docshell = do_QueryInterface(rootItem);
- NS_ASSERTION(docshell, "rootItem do_QI is null");
- }
-
- if (docshell)
- {
- nsCOMPtr<nsIDocShell> proxiedDocShell;
- NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
- NS_GET_IID(nsIDocShell),
- docshell.get(),
- NS_PROXY_SYNC,
- getter_AddRefs(proxiedDocShell));
- nsISecureBrowserUI* secureUI = nsnull;
- if (proxiedDocShell)
- proxiedDocShell->GetSecurityUI(&secureUI);
- if (secureUI)
- {
- nsCOMPtr<nsIThread> mainThread(do_GetMainThread());
- NS_ProxyRelease(mainThread, secureUI, PR_FALSE);
- mExternalErrorReporting = PR_TRUE;
-
- // If this socket is associated to a docshell, let's try to remember
- // the currently used cert. If this socket gets a notification from NSS
- // having the same raw socket, we can keep the PSM wrapper object
- // and all the data it has cached (like verification results).
- nsCOMPtr<nsISSLStatusProvider> statprov = do_QueryInterface(secureUI);
- if (statprov) {
- nsCOMPtr<nsISupports> isup_stat;
- statprov->GetSSLStatus(getter_AddRefs(isup_stat));
- if (isup_stat) {
- nsCOMPtr<nsISSLStatus> sslstat = do_QueryInterface(isup_stat);
- if (sslstat) {
- sslstat->GetServerCert(getter_AddRefs(mPreviousCert));
- }
- }
- }
- }
- }
-
- return NS_OK;
-}
-
-nsresult
-nsNSSSocketInfo::GetExternalErrorReporting(PRBool* state)
-{
- nsresult rv = EnsureDocShellDependentStuffKnown();
- NS_ENSURE_SUCCESS(rv, rv);
- *state = mExternalErrorReporting;
- return NS_OK;
-}
-
-nsresult
-nsNSSSocketInfo::SetExternalErrorReporting(PRBool aState)
-{
- mExternalErrorReporting = aState;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsNSSSocketInfo::GetSecurityState(PRUint32* state)
-{
- *state = mSecurityState;
- return NS_OK;
-}
-
-nsresult
-nsNSSSocketInfo::SetSecurityState(PRUint32 aState)
-{
- mSecurityState = aState;
- return NS_OK;
-}
-
-/* attribute unsigned long countSubRequestsHighSecurity; */
-NS_IMETHODIMP nsNSSSocketInfo::GetCountSubRequestsHighSecurity(PRInt32 *aSubRequestsHighSecurity)
-{
- *aSubRequestsHighSecurity = mSubRequestsHighSecurity;
- return NS_OK;
-}
-NS_IMETHODIMP nsNSSSocketInfo::SetCountSubRequestsHighSecurity(PRInt32 aSubRequestsHighSecurity)
-{
- mSubRequestsHighSecurity = aSubRequestsHighSecurity;
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* attribute unsigned long countSubRequestsLowSecurity; */
-NS_IMETHODIMP nsNSSSocketInfo::GetCountSubRequestsLowSecurity(PRInt32 *aSubRequestsLowSecurity)
-{
- *aSubRequestsLowSecurity = mSubRequestsLowSecurity;
- return NS_OK;
-}
-NS_IMETHODIMP nsNSSSocketInfo::SetCountSubRequestsLowSecurity(PRInt32 aSubRequestsLowSecurity)
-{
- mSubRequestsLowSecurity = aSubRequestsLowSecurity;
- return NS_OK;
-}
-
-/* attribute unsigned long countSubRequestsBrokenSecurity; */
-NS_IMETHODIMP nsNSSSocketInfo::GetCountSubRequestsBrokenSecurity(PRInt32 *aSubRequestsBrokenSecurity)
-{
- *aSubRequestsBrokenSecurity = mSubRequestsBrokenSecurity;
- return NS_OK;
-}
-NS_IMETHODIMP nsNSSSocketInfo::SetCountSubRequestsBrokenSecurity(PRInt32 aSubRequestsBrokenSecurity)
-{
- mSubRequestsBrokenSecurity = aSubRequestsBrokenSecurity;
- return NS_OK;
-}
-
-/* attribute unsigned long countSubRequestsNoSecurity; */
-NS_IMETHODIMP nsNSSSocketInfo::GetCountSubRequestsNoSecurity(PRInt32 *aSubRequestsNoSecurity)
-{
- *aSubRequestsNoSecurity = mSubRequestsNoSecurity;
- return NS_OK;
-}
-NS_IMETHODIMP nsNSSSocketInfo::SetCountSubRequestsNoSecurity(PRInt32 aSubRequestsNoSecurity)
-{
- mSubRequestsNoSecurity = aSubRequestsNoSecurity;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsNSSSocketInfo::GetShortSecurityDescription(PRUnichar** aText) {
- if (mShortDesc.IsEmpty())
- *aText = nsnull;
- else {
- *aText = ToNewUnicode(mShortDesc);
- NS_ENSURE_TRUE(*aText, NS_ERROR_OUT_OF_MEMORY);
- }
- return NS_OK;
-}
-
-nsresult
-nsNSSSocketInfo::SetShortSecurityDescription(const PRUnichar* aText) {
- mShortDesc.Assign(aText);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsNSSSocketInfo::GetErrorMessage(PRUnichar** aText) {
- if (mErrorMessage.IsEmpty())
- *aText = nsnull;
- else {
- *aText = ToNewUnicode(mErrorMessage);
- NS_ENSURE_TRUE(*aText, NS_ERROR_OUT_OF_MEMORY);
- }
- return NS_OK;
-}
-
-nsresult
-nsNSSSocketInfo::SetErrorMessage(const PRUnichar* aText) {
- mErrorMessage.Assign(aText);
- return NS_OK;
-}
-
-/* void getInterface (in nsIIDRef uuid, [iid_is (uuid), retval] out nsQIResult result); */
-NS_IMETHODIMP nsNSSSocketInfo::GetInterface(const nsIID & uuid, void * *result)
-{
- nsresult rv;
- if (!mCallbacks) {
- nsCOMPtr<nsIInterfaceRequestor> ir = new PipUIContext();
- if (!ir)
- return NS_ERROR_OUT_OF_MEMORY;
-
- rv = ir->GetInterface(uuid, result);
- } else {
- if (nsSSLThread::exitRequested())
- return NS_ERROR_FAILURE;
-
- nsCOMPtr<nsIInterfaceRequestor> proxiedCallbacks;
- NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
- NS_GET_IID(nsIInterfaceRequestor),
- mCallbacks,
- NS_PROXY_SYNC,
- getter_AddRefs(proxiedCallbacks));
-
- rv = proxiedCallbacks->GetInterface(uuid, result);
- }
- return rv;
-}
-
-nsresult
-nsNSSSocketInfo::GetForSTARTTLS(PRBool* aForSTARTTLS)
-{
- *aForSTARTTLS = mForSTARTTLS;
- return NS_OK;
-}
-
-nsresult
-nsNSSSocketInfo::SetForSTARTTLS(PRBool aForSTARTTLS)
-{
- mForSTARTTLS = aForSTARTTLS;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsNSSSocketInfo::ProxyStartSSL()
-{
- return ActivateSSL();
-}
-
-NS_IMETHODIMP
-nsNSSSocketInfo::StartTLS()
-{
- return ActivateSSL();
-}
-
-NS_IMETHODIMP
-nsNSSSocketInfo::Write(nsIObjectOutputStream* stream) {
- stream->WriteCompoundObject(NS_ISUPPORTS_CAST(nsIX509Cert*, mCert),
- NS_GET_IID(nsISupports), PR_TRUE);
-
- // Store the version number of the binary stream data format.
- // The 0xFFFF0000 mask is included to the version number
- // to distinguish version number from mSecurityState
- // field stored in times before versioning has been introduced.
- // This mask value has been chosen as mSecurityState could
- // never be assigned such value.
- PRUint32 version = 2;
- stream->Write32(version | 0xFFFF0000);
- stream->Write32(mSecurityState);
- stream->WriteWStringZ(mShortDesc.get());
- stream->WriteWStringZ(mErrorMessage.get());
-
- stream->WriteCompoundObject(NS_ISUPPORTS_CAST(nsISSLStatus*, mSSLStatus),
- NS_GET_IID(nsISupports), PR_TRUE);
-
- stream->Write32((PRUint32)mSubRequestsHighSecurity);
- stream->Write32((PRUint32)mSubRequestsLowSecurity);
- stream->Write32((PRUint32)mSubRequestsBrokenSecurity);
- stream->Write32((PRUint32)mSubRequestsNoSecurity);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsNSSSocketInfo::Read(nsIObjectInputStream* stream) {
- nsCOMPtr<nsISupports> obj;
- stream->ReadObject(PR_TRUE, getter_AddRefs(obj));
- mCert = reinterpret_cast<nsNSSCertificate*>(obj.get());
-
- PRUint32 version;
- stream->Read32(&version);
- // If the version field we have just read is not masked with 0xFFFF0000
- // then it is stored mSecurityState field and this is version 1 of
- // the binary data stream format.
- if ((version & 0xFFFF0000) == 0xFFFF0000) {
- version &= ~0xFFFF0000;
- stream->Read32(&mSecurityState);
- }
- else {
- mSecurityState = version;
- version = 1;
- }
- stream->ReadString(mShortDesc);
- stream->ReadString(mErrorMessage);
-
- stream->ReadObject(PR_TRUE, getter_AddRefs(obj));
- mSSLStatus = reinterpret_cast<nsSSLStatus*>(obj.get());
-
- if (version >= 2) {
- stream->Read32((PRUint32*)&mSubRequestsHighSecurity);
- stream->Read32((PRUint32*)&mSubRequestsLowSecurity);
- stream->Read32((PRUint32*)&mSubRequestsBrokenSecurity);
- stream->Read32((PRUint32*)&mSubRequestsNoSecurity);
- }
- else {
- mSubRequestsHighSecurity = 0;
- mSubRequestsLowSecurity = 0;
- mSubRequestsBrokenSecurity = 0;
- mSubRequestsNoSecurity = 0;
- }
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsNSSSocketInfo::GetInterfaces(PRUint32 *count, nsIID * **array)
-{
- *count = 0;
- *array = nsnull;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsNSSSocketInfo::GetHelperForLanguage(PRUint32 language, nsISupports **_retval)
-{
- *_retval = nsnull;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsNSSSocketInfo::GetContractID(char * *aContractID)
-{
- *aContractID = nsnull;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsNSSSocketInfo::GetClassDescription(char * *aClassDescription)
-{
- *aClassDescription = nsnull;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsNSSSocketInfo::GetClassID(nsCID * *aClassID)
-{
- *aClassID = (nsCID*) nsMemory::Alloc(sizeof(nsCID));
- if (!*aClassID)
- return NS_ERROR_OUT_OF_MEMORY;
- return GetClassIDNoAlloc(*aClassID);
-}
-
-NS_IMETHODIMP
-nsNSSSocketInfo::GetImplementationLanguage(PRUint32 *aImplementationLanguage)
-{
- *aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsNSSSocketInfo::GetFlags(PRUint32 *aFlags)
-{
- *aFlags = 0;
- return NS_OK;
-}
-
-static NS_DEFINE_CID(kNSSSocketInfoCID, NS_NSSSOCKETINFO_CID);
-
-NS_IMETHODIMP
-nsNSSSocketInfo::GetClassIDNoAlloc(nsCID *aClassIDNoAlloc)
-{
- *aClassIDNoAlloc = kNSSSocketInfoCID;
- return NS_OK;
-}
-
-nsresult nsNSSSocketInfo::ActivateSSL()
-{
- nsNSSShutDownPreventionLock locker;
- if (isAlreadyShutDown())
- return NS_ERROR_NOT_AVAILABLE;
-
- nsresult rv = nsSSLThread::requestActivateSSL(this);
-
- if (NS_FAILED(rv))
- return rv;
-
- mHandshakePending = PR_TRUE;
-
- return NS_OK;
-}
-
-nsresult nsNSSSocketInfo::GetFileDescPtr(PRFileDesc** aFilePtr)
-{
- *aFilePtr = mFd;
- return NS_OK;
-}
-
-nsresult nsNSSSocketInfo::SetFileDescPtr(PRFileDesc* aFilePtr)
-{
- mFd = aFilePtr;
- return NS_OK;
-}
-
-nsresult nsNSSSocketInfo::GetPreviousCert(nsIX509Cert** _result)
-{
- NS_ENSURE_ARG_POINTER(_result);
- nsresult rv = EnsureDocShellDependentStuffKnown();
- NS_ENSURE_SUCCESS(rv, rv);
-
- *_result = mPreviousCert;
- NS_IF_ADDREF(*_result);
-
- return NS_OK;
-}
-
-nsresult nsNSSSocketInfo::GetCert(nsIX509Cert** _result)
-{
- NS_ENSURE_ARG_POINTER(_result);
-
- *_result = mCert;
- NS_IF_ADDREF(*_result);
-
- return NS_OK;
-}
-
-nsresult nsNSSSocketInfo::SetCert(nsIX509Cert *aCert)
-{
- mCert = aCert;
-
- return NS_OK;
-}
-
-nsresult nsNSSSocketInfo::GetSSLStatus(nsISupports** _result)
-{
- NS_ENSURE_ARG_POINTER(_result);
-
- *_result = NS_ISUPPORTS_CAST(nsISSLStatus*, mSSLStatus);
- NS_IF_ADDREF(*_result);
-
- return NS_OK;
-}
-
-nsresult nsNSSSocketInfo::SetSSLStatus(nsSSLStatus *aSSLStatus)
-{
- mSSLStatus = aSSLStatus;
-
- return NS_OK;
-}
-
-void nsNSSSocketInfo::SetHandshakeInProgress(PRBool aIsIn)
-{
- mHandshakeInProgress = aIsIn;
-
- if (mHandshakeInProgress && !mHandshakeStartTime)
- {
- mHandshakeStartTime = PR_IntervalNow();
- }
-}
-
-void nsNSSSocketInfo::SetAllowTLSIntoleranceTimeout(PRBool aAllow)
-{
- mAllowTLSIntoleranceTimeout = aAllow;
-}
-
-#define HANDSHAKE_TIMEOUT_SECONDS 25
-
-PRBool nsNSSSocketInfo::HandshakeTimeout()
-{
- if (!mHandshakeInProgress || !mAllowTLSIntoleranceTimeout)
- return PR_FALSE;
-
- return ((PRIntervalTime)(PR_IntervalNow() - mHandshakeStartTime)
- > PR_SecondsToInterval(HANDSHAKE_TIMEOUT_SECONDS));
-}
-
-void nsSSLIOLayerHelpers::Cleanup()
-{
- if (mTLSIntolerantSites) {
- delete mTLSIntolerantSites;
- mTLSIntolerantSites = nsnull;
- }
-
- if (mTLSTolerantSites) {
- delete mTLSTolerantSites;
- mTLSTolerantSites = nsnull;
- }
-
- if (mRenegoUnrestrictedSites) {
- delete mRenegoUnrestrictedSites;
- mRenegoUnrestrictedSites = nsnull;
- }
-
- if (mSharedPollableEvent)
- PR_DestroyPollableEvent(mSharedPollableEvent);
-
- if (mutex) {
- PR_DestroyLock(mutex);
- mutex = nsnull;
- }
-
- if (mHostsWithCertErrors) {
- delete mHostsWithCertErrors;
- mHostsWithCertErrors = nsnull;
- }
-}
-
-static nsresult
-getErrorMessage(PRInt32 err,
- const nsString &host,
- PRInt32 port,
- PRBool externalErrorReporting,
- nsINSSComponent *component,
- nsString &returnedMessage)
-{
- NS_ENSURE_ARG_POINTER(component);
-
- const PRUnichar *params[1];
- nsresult rv;
-
- if (host.Length())
- {
- nsString hostWithPort;
-
- // For now, hide port when it's 443 and we're reporting the error using
- // external reporting. In the future a better mechanism should be used
- // to make a decision about showing the port number, possibly by requiring
- // the context object to implement a specific interface.
- // The motivation is that Mozilla browser would like to hide the port number
- // in error pages in the common case.
-
- if (externalErrorReporting && port == 443) {
- params[0] = host.get();
- }
- else {
- hostWithPort = host;
- hostWithPort.AppendLiteral(":");
- hostWithPort.AppendInt(port);
- params[0] = hostWithPort.get();
- }
-
- nsString formattedString;
- rv = component->PIPBundleFormatStringFromName("SSLConnectionErrorPrefix",
- params, 1,
- formattedString);
- if (NS_SUCCEEDED(rv))
- {
- returnedMessage.Append(formattedString);
- returnedMessage.Append(NS_LITERAL_STRING("\n\n"));
- }
- }
-
- nsString explanation;
- rv = nsNSSErrors::getErrorMessageFromCode(err, component, explanation);
- if (NS_SUCCEEDED(rv))
- returnedMessage.Append(explanation);
-
- return NS_OK;
-}
-
-static void
-AppendErrorTextUntrusted(PRErrorCode errTrust,
- const nsString &host,
- nsIX509Cert* ix509,
- nsINSSComponent *component,
- nsString &returnedMessage)
-{
- const char *errorID = nsnull;
- nsCOMPtr<nsIX509Cert3> cert3 = do_QueryInterface(ix509);
- if (cert3) {
- PRBool isSelfSigned;
- if (NS_SUCCEEDED(cert3->GetIsSelfSigned(&isSelfSigned))
- && isSelfSigned) {
- errorID = "certErrorTrust_SelfSigned";
- }
- }
-
- if (!errorID) {
- switch (errTrust) {
- case SEC_ERROR_UNKNOWN_ISSUER:
- errorID = "certErrorTrust_UnknownIssuer";
- break;
- case SEC_ERROR_INADEQUATE_KEY_USAGE:
- // Should get an individual string in the future
- // For now, use the same as CaInvalid
- case SEC_ERROR_CA_CERT_INVALID:
- errorID = "certErrorTrust_CaInvalid";
- break;
- case SEC_ERROR_UNTRUSTED_ISSUER:
- errorID = "certErrorTrust_Issuer";
- break;
- case SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE:
- errorID = "certErrorTrust_ExpiredIssuer";
- break;
- case SEC_ERROR_UNTRUSTED_CERT:
- default:
- errorID = "certErrorTrust_Untrusted";
- break;
- }
- }
-
- nsString formattedString;
- nsresult rv = component->GetPIPNSSBundleString(errorID,
- formattedString);
- if (NS_SUCCEEDED(rv))
- {
- returnedMessage.Append(formattedString);
- returnedMessage.Append(NS_LITERAL_STRING("\n"));
- }
-}
-
-// returns TRUE if SAN was used to produce names
-// return FALSE if nothing was produced
-// names => a single name or a list of names
-// multipleNames => whether multiple names were delivered
-static PRBool
-GetSubjectAltNames(CERTCertificate *nssCert,
- nsINSSComponent *component,
- nsString &allNames,
- PRUint32 &nameCount)
-{
- allNames.Truncate();
- nameCount = 0;
-
- PRArenaPool *san_arena = nsnull;
- SECItem altNameExtension = {siBuffer, NULL, 0 };
- CERTGeneralName *sanNameList = nsnull;
-
- nsresult rv;
- rv = CERT_FindCertExtension(nssCert, SEC_OID_X509_SUBJECT_ALT_NAME,
- &altNameExtension);
- if (rv != SECSuccess)
- return PR_FALSE;
-
- san_arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
- if (!san_arena)
- return PR_FALSE;
-
- sanNameList = CERT_DecodeAltNameExtension(san_arena, &altNameExtension);
- if (!sanNameList)
- return PR_FALSE;
-
- SECITEM_FreeItem(&altNameExtension, PR_FALSE);
-
- CERTGeneralName *current = sanNameList;
- do {
- nsAutoString name;
- switch (current->type) {
- case certDNSName:
- name.AssignASCII((char*)current->name.other.data, current->name.other.len);
- if (!allNames.IsEmpty()) {
- allNames.Append(NS_LITERAL_STRING(" , "));
- }
- ++nameCount;
- allNames.Append(name);
- break;
-
- case certIPAddress:
- {
- char buf[INET6_ADDRSTRLEN];
- PRNetAddr addr;
- if (current->name.other.len == 4) {
- addr.inet.family = PR_AF_INET;
- memcpy(&addr.inet.ip, current->name.other.data, current->name.other.len);
- PR_NetAddrToString(&addr, buf, sizeof(buf));
- name.AssignASCII(buf);
- } else if (current->name.other.len == 16) {
- addr.ipv6.family = PR_AF_INET6;
- memcpy(&addr.ipv6.ip, current->name.other.data, current->name.other.len);
- PR_NetAddrToString(&addr, buf, sizeof(buf));
- name.AssignASCII(buf);
- } else {
- /* invalid IP address */
- }
- if (!name.IsEmpty()) {
- if (!allNames.IsEmpty()) {
- allNames.Append(NS_LITERAL_STRING(" , "));
- }
- ++nameCount;
- allNames.Append(name);
- }
- break;
- }
-
- default: // all other types of names are ignored
- break;
- }
- current = CERT_GetNextGeneralName(current);
- } while (current != sanNameList); // double linked
-
- PORT_FreeArena(san_arena, PR_FALSE);
- return PR_TRUE;
-}
-
-static void
-AppendErrorTextMismatch(const nsString &host,
- nsIX509Cert* ix509,
- nsINSSComponent *component,
- PRBool wantsHtml,
- nsString &returnedMessage)
-{
- const PRUnichar *params[1];
- nsresult rv;
-
- CERTCertificate *nssCert = NULL;
- CERTCertificateCleaner nssCertCleaner(nssCert);
-
- nsCOMPtr<nsIX509Cert2> cert2 = do_QueryInterface(ix509, &rv);
- if (cert2)
- nssCert = cert2->GetCert();
-
- if (!nssCert) {
- // We are unable to extract the valid names, say "not valid for name".
- params[0] = host.get();
- nsString formattedString;
- rv = component->PIPBundleFormatStringFromName("certErrorMismatch",
- params, 1,
- formattedString);
- if (NS_SUCCEEDED(rv)) {
- returnedMessage.Append(formattedString);
- returnedMessage.Append(NS_LITERAL_STRING("\n"));
- }
- return;
- }
-
- nsString allNames;
- PRUint32 nameCount = 0;
- PRBool useSAN = PR_FALSE;
-
- if (nssCert)
- useSAN = GetSubjectAltNames(nssCert, component, allNames, nameCount);
-
- if (!useSAN) {
- char *certName = nsnull;
- // currently CERT_FindNSStringExtension is not being exported by NSS.
- // If it gets exported, enable the following line.
- // certName = CERT_FindNSStringExtension(nssCert, SEC_OID_NS_CERT_EXT_SSL_SERVER_NAME);
- // However, it has been discussed to treat the extension as obsolete and ignore it.
- if (!certName)
- certName = CERT_GetCommonName(&nssCert->subject);
- if (certName) {
- ++nameCount;
- allNames.AssignASCII(certName);
- PORT_Free(certName);
- }
- }
-
- if (nameCount > 1) {
- nsString message;
- rv = component->GetPIPNSSBundleString("certErrorMismatchMultiple",
- message);
- if (NS_SUCCEEDED(rv)) {
- returnedMessage.Append(message);
- returnedMessage.Append(NS_LITERAL_STRING("\n "));
- returnedMessage.Append(allNames);
- returnedMessage.Append(NS_LITERAL_STRING(" \n"));
- }
- }
- else if (nameCount == 1) {
- const PRUnichar *params[1];
- params[0] = allNames.get();
-
- const char *stringID;
- if (wantsHtml)
- stringID = "certErrorMismatchSingle2";
- else
- stringID = "certErrorMismatchSinglePlain";
-
- nsString formattedString;
- rv = component->PIPBundleFormatStringFromName(stringID,
- params, 1,
- formattedString);
- if (NS_SUCCEEDED(rv)) {
- returnedMessage.Append(formattedString);
- returnedMessage.Append(NS_LITERAL_STRING("\n"));
- }
- }
- else { // nameCount == 0
- nsString message;
- nsresult rv = component->GetPIPNSSBundleString("certErrorMismatchNoNames",
- message);
- if (NS_SUCCEEDED(rv)) {
- returnedMessage.Append(message);
- returnedMessage.Append(NS_LITERAL_STRING("\n"));
- }
- }
-}
-
-static void
-GetDateBoundary(nsIX509Cert* ix509,
- nsString &formattedDate,
- PRBool &trueExpired_falseNotYetValid)
-{
- trueExpired_falseNotYetValid = PR_TRUE;
- formattedDate.Truncate();
-
- PRTime notAfter, notBefore, timeToUse;
- nsCOMPtr<nsIX509CertValidity> validity;
- nsresult rv;
-
- rv = ix509->GetValidity(getter_AddRefs(validity));
- if (NS_FAILED(rv))
- return;
-
- rv = validity->GetNotAfter(¬After);
- if (NS_FAILED(rv))
- return;
-
- rv = validity->GetNotBefore(¬Before);
- if (NS_FAILED(rv))
- return;
-
- if (LL_CMP(PR_Now(), >, notAfter)) {
- timeToUse = notAfter;
- } else {
- timeToUse = notBefore;
- trueExpired_falseNotYetValid = PR_FALSE;
- }
-
- nsIDateTimeFormat* aDateTimeFormat;
- rv = CallCreateInstance(NS_DATETIMEFORMAT_CONTRACTID, &aDateTimeFormat);
- if (NS_FAILED(rv))
- return;
-
- aDateTimeFormat->FormatPRTime(nsnull, kDateFormatShort,
- kTimeFormatNoSeconds, timeToUse,
- formattedDate);
- NS_IF_RELEASE(aDateTimeFormat);
-}
-
-static void
-AppendErrorTextTime(nsIX509Cert* ix509,
- nsINSSComponent *component,
- nsString &returnedMessage)
-{
- nsAutoString formattedDate;
- PRBool trueExpired_falseNotYetValid;
- GetDateBoundary(ix509, formattedDate, trueExpired_falseNotYetValid);
-
- const PRUnichar *params[1];
- params[0] = formattedDate.get(); // might be empty, if helper function had a problem
-
- const char *key = trueExpired_falseNotYetValid ?
- "certErrorExpired" : "certErrorNotYetValid";
- nsresult rv;
- nsString formattedString;
- rv = component->PIPBundleFormatStringFromName(key, params,
- 1, formattedString);
- if (NS_SUCCEEDED(rv))
- {
- returnedMessage.Append(formattedString);
- returnedMessage.Append(NS_LITERAL_STRING("\n"));
- }
-}
-
-static void
-AppendErrorTextCode(PRErrorCode errorCodeToReport,
- nsINSSComponent *component,
- nsString &returnedMessage)
-{
- const char *codeName = nsNSSErrors::getDefaultErrorStringName(errorCodeToReport);
- if (codeName)
- {
- nsCString error_id(codeName);
- ToLowerCase(error_id);
- NS_ConvertASCIItoUTF16 idU(error_id);
-
- const PRUnichar *params[1];
- params[0] = idU.get();
-
- nsString formattedString;
- nsresult rv;
- rv = component->PIPBundleFormatStringFromName("certErrorCodePrefix",
- params, 1,
- formattedString);
- if (NS_SUCCEEDED(rv)) {
- returnedMessage.Append(NS_LITERAL_STRING("\n"));
- returnedMessage.Append(formattedString);
- returnedMessage.Append(NS_LITERAL_STRING("\n"));
- }
- else {
- returnedMessage.Append(NS_LITERAL_STRING(" ("));
- returnedMessage.Append(idU);
- returnedMessage.Append(NS_LITERAL_STRING(")"));
- }
- }
-}
-
-static nsresult
-getInvalidCertErrorMessage(PRUint32 multipleCollectedErrors,
- PRErrorCode errorCodeToReport,
- PRErrorCode errTrust,
- PRErrorCode errMismatch,
- PRErrorCode errExpired,
- const nsString &host,
- const nsString &hostWithPort,
- PRInt32 port,
- nsIX509Cert* ix509,
- PRBool externalErrorReporting,
- PRBool wantsHtml,
- nsINSSComponent *component,
- nsString &returnedMessage)
-{
- NS_ENSURE_ARG_POINTER(component);
-
- const PRUnichar *params[1];
- nsresult rv;
-
- // For now, hide port when it's 443 and we're reporting the error using
- // external reporting. In the future a better mechanism should be used
- // to make a decision about showing the port number, possibly by requiring
- // the context object to implement a specific interface.
- // The motivation is that Mozilla browser would like to hide the port number
- // in error pages in the common case.
-
- if (externalErrorReporting && port == 443)
- params[0] = host.get();
- else
- params[0] = hostWithPort.get();
-
- nsString formattedString;
- rv = component->PIPBundleFormatStringFromName("certErrorIntro",
- params, 1,
- formattedString);
- if (NS_SUCCEEDED(rv))
- {
- returnedMessage.Append(formattedString);
- returnedMessage.Append(NS_LITERAL_STRING("\n\n"));
- }
-
- if (multipleCollectedErrors & nsICertOverrideService::ERROR_UNTRUSTED)
- {
- AppendErrorTextUntrusted(errTrust, host, ix509,
- component, returnedMessage);
- }
-
- if (multipleCollectedErrors & nsICertOverrideService::ERROR_MISMATCH)
- {
- AppendErrorTextMismatch(host, ix509, component, wantsHtml, returnedMessage);
- }
-
- if (multipleCollectedErrors & nsICertOverrideService::ERROR_TIME)
- {
- AppendErrorTextTime(ix509, component, returnedMessage);
- }
-
- AppendErrorTextCode(errorCodeToReport, component, returnedMessage);
-
- return NS_OK;
-}
-
-static nsresult
-displayAlert(nsAFlatString &formattedString, nsNSSSocketInfo *infoObject)
-{
- // The interface requestor object may not be safe, so proxy the call to get
- // the nsIPrompt.
-
- if (nsSSLThread::exitRequested())
- return NS_ERROR_FAILURE;
-
- nsCOMPtr<nsIInterfaceRequestor> proxiedCallbacks;
- NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
- NS_GET_IID(nsIInterfaceRequestor),
- static_cast<nsIInterfaceRequestor*>(infoObject),
- NS_PROXY_SYNC,
- getter_AddRefs(proxiedCallbacks));
-
- nsCOMPtr<nsIPrompt> prompt (do_GetInterface(proxiedCallbacks));
- if (!prompt)
- return NS_ERROR_NO_INTERFACE;
-
- // Finally, get a proxy for the nsIPrompt
-
- nsCOMPtr<nsIPrompt> proxyPrompt;
- NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
- NS_GET_IID(nsIPrompt),
- prompt,
- NS_PROXY_SYNC,
- getter_AddRefs(proxyPrompt));
-
- proxyPrompt->Alert(nsnull, formattedString.get());
- return NS_OK;
-}
-
-static nsresult
-nsHandleSSLError(nsNSSSocketInfo *socketInfo, PRInt32 err)
-{
- if (socketInfo->GetCanceled()) {
- // If the socket has been flagged as canceled,
- // the code who did was responsible for showing
- // an error message (if desired).
- return NS_OK;
- }
-
- if (nsSSLThread::exitRequested()) {
- return NS_ERROR_FAILURE;
- }
-
- nsresult rv;
- NS_DEFINE_CID(nssComponentCID, NS_NSSCOMPONENT_CID);
- nsCOMPtr<nsINSSComponent> nssComponent(do_GetService(nssComponentCID, &rv));
- if (NS_FAILED(rv))
- return rv;
-
- nsXPIDLCString hostName;
- socketInfo->GetHostName(getter_Copies(hostName));
- NS_ConvertASCIItoUTF16 hostNameU(hostName);
-
- PRInt32 port;
- socketInfo->GetPort(&port);
-
- // Try to get a nsISSLErrorListener implementation from the socket consumer.
- nsCOMPtr<nsIInterfaceRequestor> cb;
- socketInfo->GetNotificationCallbacks(getter_AddRefs(cb));
- if (cb) {
- nsCOMPtr<nsIInterfaceRequestor> callbacks;
- NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
- NS_GET_IID(nsIInterfaceRequestor),
- cb,
- NS_PROXY_SYNC,
- getter_AddRefs(callbacks));
-
- nsCOMPtr<nsISSLErrorListener> sel = do_GetInterface(callbacks);
- if (sel) {
- nsISSLErrorListener *proxy_sel = nsnull;
- NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
- NS_GET_IID(nsISSLErrorListener),
- sel,
- NS_PROXY_SYNC,
- (void**)&proxy_sel);
- if (proxy_sel) {
- nsIInterfaceRequestor *csi = static_cast<nsIInterfaceRequestor*>(socketInfo);
- PRBool suppressMessage = PR_FALSE;
- nsCString hostWithPortString = hostName;
- hostWithPortString.AppendLiteral(":");
- hostWithPortString.AppendInt(port);
- rv = proxy_sel->NotifySSLError(csi, err, hostWithPortString,
- &suppressMessage);
- if (NS_SUCCEEDED(rv) && suppressMessage)
- return NS_OK;
- }
- }
- }
-
- PRBool external = PR_FALSE;
- socketInfo->GetExternalErrorReporting(&external);
-
- nsString formattedString;
- rv = getErrorMessage(err, hostNameU, port, external, nssComponent, formattedString);
-
- if (external)
- {
- socketInfo->SetErrorMessage(formattedString.get());
- }
- else
- {
- nsPSMUITracker tracker;
- if (tracker.isUIForbidden()) {
- rv = NS_ERROR_NOT_AVAILABLE;
- }
- else {
- rv = displayAlert(formattedString, socketInfo);
- }
- }
- return rv;
-}
-
-static nsresult
-nsHandleInvalidCertError(nsNSSSocketInfo *socketInfo,
- PRUint32 multipleCollectedErrors,
- const nsACString &host,
- const nsACString &hostWithPort,
- PRInt32 port,
- PRErrorCode errorCodeToReport,
- PRErrorCode errTrust,
- PRErrorCode errMismatch,
- PRErrorCode errExpired,
- PRBool wantsHtml,
- nsIX509Cert* ix509)
-{
- nsresult rv;
- NS_DEFINE_CID(nssComponentCID, NS_NSSCOMPONENT_CID);
- nsCOMPtr<nsINSSComponent> nssComponent(do_GetService(nssComponentCID, &rv));
- if (NS_FAILED(rv))
- return rv;
-
- NS_ConvertASCIItoUTF16 hostU(host);
- NS_ConvertASCIItoUTF16 hostWithPortU(hostWithPort);
-
- // What mechanism is used to inform the user?
- // The highest priority has the "external error reporting" feature,
- // if set, we'll provide the strings to be used by the nsINSSErrorsService
-
- PRBool external = PR_FALSE;
- socketInfo->GetExternalErrorReporting(&external);
-
- nsString formattedString;
- rv = getInvalidCertErrorMessage(multipleCollectedErrors, errorCodeToReport,
- errTrust, errMismatch, errExpired,
- hostU, hostWithPortU, port,
- ix509, external, wantsHtml,
- nssComponent, formattedString);
-
- if (external)
- {
- socketInfo->SetErrorMessage(formattedString.get());
- }
- else
- {
- nsPSMUITracker tracker;
- if (tracker.isUIForbidden()) {
- rv = NS_ERROR_NOT_AVAILABLE;
- }
- else {
- nsISSLCertErrorDialog *dialogs = nsnull;
- rv = getNSSDialogs((void**)&dialogs,
- NS_GET_IID(nsISSLCertErrorDialog),
- NS_SSLCERTERRORDIALOG_CONTRACTID);
-
- if (NS_SUCCEEDED(rv)) {
- nsPSMUITracker tracker;
- if (tracker.isUIForbidden()) {
- rv = NS_ERROR_NOT_AVAILABLE;
- }
- else {
- nsCOMPtr<nsISSLStatus> status;
- socketInfo->GetSSLStatus(getter_AddRefs(status));
-
- nsString empty;
-
- rv = dialogs->ShowCertError(nsnull, status, ix509,
- formattedString,
- empty, host, port);
- }
-
- NS_RELEASE(dialogs);
- }
- }
- }
- return rv;
-}
-
-static PRStatus PR_CALLBACK
-nsSSLIOLayerConnect(PRFileDesc* fd, const PRNetAddr* addr,
- PRIntervalTime timeout)
-{
- PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("[%p] connecting SSL socket\n", (void*)fd));
- nsNSSShutDownPreventionLock locker;
- if (!fd || !fd->lower)
- return PR_FAILURE;
-
- PRStatus status = PR_SUCCESS;
-
-#if defined(XP_BEOS)
- // Due to BeOS net_server's lack of support for nonblocking sockets,
- // we must execute this entire connect as a blocking operation - bug 70217
-
- PRSocketOptionData sockopt;
- sockopt.option = PR_SockOpt_Nonblocking;
- PR_GetSocketOption(fd, &sockopt);
- PRBool oldBlockVal = sockopt.value.non_blocking;
- sockopt.option = PR_SockOpt_Nonblocking;
- sockopt.value.non_blocking = PR_FALSE;
- PR_SetSocketOption(fd, &sockopt);
-#endif
-
- status = fd->lower->methods->connect(fd->lower, addr,
-#if defined(XP_BEOS) // bug 70217
- PR_INTERVAL_NO_TIMEOUT);
-#else
- timeout);
-#endif
- if (status != PR_SUCCESS) {
- PR_LOG(gPIPNSSLog, PR_LOG_ERROR, ("[%p] Lower layer connect error: %d\n",
- (void*)fd, PR_GetError()));
-#if defined(XP_BEOS) // bug 70217
- goto loser;
-#else
- return status;
-#endif
- }
-
- PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("[%p] Connect\n", (void*)fd));
-
-#if defined(XP_BEOS) // bug 70217
- loser:
- // We put the Nonblocking bit back to the value it was when
- // we entered this function.
- NS_ASSERTION(sockopt.option == PR_SockOpt_Nonblocking,
- "sockopt.option was re-set to an unexpected value");
- sockopt.value.non_blocking = oldBlockVal;
- PR_SetSocketOption(fd, &sockopt);
-#endif
-
- return status;
-}
-
-// nsPSMRememberCertErrorsTable
-
-nsPSMRememberCertErrorsTable::nsPSMRememberCertErrorsTable()
-{
- mErrorHosts.Init(16);
-}
-
-nsresult
-nsPSMRememberCertErrorsTable::GetHostPortKey(nsNSSSocketInfo* infoObject,
- nsCAutoString &result)
-{
- nsresult rv;
-
- result.Truncate();
-
- nsXPIDLCString hostName;
- rv = infoObject->GetHostName(getter_Copies(hostName));
- NS_ENSURE_SUCCESS(rv, rv);
-
- PRInt32 port;
- rv = infoObject->GetPort(&port);
- NS_ENSURE_SUCCESS(rv, rv);
-
- result.Assign(hostName);
- result.Append(':');
- result.AppendInt(port);
-
- return NS_OK;
-}
-
-void
-nsPSMRememberCertErrorsTable::RememberCertHasError(nsNSSSocketInfo* infoObject,
- nsSSLStatus* status,
- SECStatus certVerificationResult)
-{
- nsresult rv;
-
- nsCAutoString hostPortKey;
- rv = GetHostPortKey(infoObject, hostPortKey);
- if (NS_FAILED(rv))
- return;
-
- if (certVerificationResult != SECSuccess) {
- NS_ASSERTION(status,
- "Must have nsSSLStatus object when remembering flags");
-
- if (!status)
- return;
-
- CertStateBits bits;
- bits.mIsDomainMismatch = status->mIsDomainMismatch;
- bits.mIsNotValidAtThisTime = status->mIsNotValidAtThisTime;
- bits.mIsUntrusted = status->mIsUntrusted;
- mErrorHosts.Put(hostPortKey, bits);
- }
- else {
- mErrorHosts.Remove(hostPortKey);
- }
-}
-
-void
-nsPSMRememberCertErrorsTable::LookupCertErrorBits(nsNSSSocketInfo* infoObject,
- nsSSLStatus* status)
-{
- // Get remembered error bits from our cache, because of SSL session caching
- // the NSS library potentially hasn't notified us for this socket.
- if (status->mHaveCertErrorBits)
- // Rather do not modify bits if already set earlier
- return;
-
- nsresult rv;
-
- nsCAutoString hostPortKey;
- rv = GetHostPortKey(infoObject, hostPortKey);
- if (NS_FAILED(rv))
- return;
-
- CertStateBits bits;
- if (!mErrorHosts.Get(hostPortKey, &bits))
- // No record was found, this host had no cert errors
- return;
-
- // This host had cert errors, update the bits correctly
- status->mHaveCertErrorBits = PR_TRUE;
- status->mIsDomainMismatch = bits.mIsDomainMismatch;
- status->mIsNotValidAtThisTime = bits.mIsNotValidAtThisTime;
- status->mIsUntrusted = bits.mIsUntrusted;
-}
-
-void
-nsSSLIOLayerHelpers::getSiteKey(nsNSSSocketInfo *socketInfo, nsCSubstring &key)
-{
- PRInt32 port;
- socketInfo->GetPort(&port);
-
- nsXPIDLCString host;
- socketInfo->GetHostName(getter_Copies(host));
-
- key = host + NS_LITERAL_CSTRING(":") + nsPrintfCString("%d", port);
-}
-
-// Call this function to report a site that is possibly TLS intolerant.
-// This function will return true, if the given socket is currently using TLS.
-PRBool
-nsSSLIOLayerHelpers::rememberPossibleTLSProblemSite(PRFileDesc* ssl_layer_fd, nsNSSSocketInfo *socketInfo)
-{
- PRBool currentlyUsesTLS = PR_FALSE;
-
- nsCAutoString key;
- getSiteKey(socketInfo, key);
-
- SSL_OptionGet(ssl_layer_fd, SSL_ENABLE_TLS, ¤tlyUsesTLS);
- if (!currentlyUsesTLS) {
- // We were not using TLS but failed with an intolerant error using
- // a different protocol. To give TLS a try on next connection attempt again
- // drop this site from the list of intolerant sites. TLS failure might be
- // caused only by a traffic congestion while the server is TLS tolerant.
- removeIntolerantSite(key);
- return PR_FALSE;
- }
-
- PRBool enableSSL3 = PR_FALSE;
- SSL_OptionGet(ssl_layer_fd, SSL_ENABLE_SSL3, &enableSSL3);
- PRBool enableSSL2 = PR_FALSE;
- SSL_OptionGet(ssl_layer_fd, SSL_ENABLE_SSL2, &enableSSL2);
- if (enableSSL3 || enableSSL2) {
- // Add this site to the list of TLS intolerant sites.
- addIntolerantSite(key);
- }
-
- return currentlyUsesTLS;
-}
-
-void
-nsSSLIOLayerHelpers::rememberTolerantSite(PRFileDesc* ssl_layer_fd,
- nsNSSSocketInfo *socketInfo)
-{
- PRBool usingSecurity = PR_FALSE;
- PRBool currentlyUsesTLS = PR_FALSE;
- SSL_OptionGet(ssl_layer_fd, SSL_SECURITY, &usingSecurity);
- SSL_OptionGet(ssl_layer_fd, SSL_ENABLE_TLS, ¤tlyUsesTLS);
- if (!usingSecurity || !currentlyUsesTLS) {
- return;
- }
-
- nsCAutoString key;
- getSiteKey(socketInfo, key);
-
- nsAutoLock lock(mutex);
- nsSSLIOLayerHelpers::mTLSTolerantSites->Put(key);
-}
-
-static PRStatus PR_CALLBACK
-nsSSLIOLayerClose(PRFileDesc *fd)
-{
- nsNSSShutDownPreventionLock locker;
- if (!fd)
- return PR_FAILURE;
-
- PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("[%p] Shutting down socket\n", (void*)fd));
-
- nsNSSSocketInfo *socketInfo = (nsNSSSocketInfo*)fd->secret;
- NS_ASSERTION(socketInfo,"nsNSSSocketInfo was null for an fd");
-
- return nsSSLThread::requestClose(socketInfo);
-}
-
-PRStatus nsNSSSocketInfo::CloseSocketAndDestroy()
-{
- nsNSSShutDownPreventionLock locker;
-
- nsNSSShutDownList::trackSSLSocketClose();
-
- PRFileDesc* popped = PR_PopIOLayer(mFd, PR_TOP_IO_LAYER);
-
- if (GetHandshakeInProgress()) {
- nsSSLIOLayerHelpers::rememberPossibleTLSProblemSite(mFd->lower, this);
- }
-
- PRStatus status = mFd->methods->close(mFd);
- if (status != PR_SUCCESS) return status;
-
- popped->identity = PR_INVALID_IO_LAYER;
- NS_RELEASE_THIS();
- popped->dtor(popped);
-
- return PR_SUCCESS;
-}
-
-#if defined(DEBUG_SSL_VERBOSE) && defined(DUMP_BUFFER)
-/* Dumps a (potentially binary) buffer using SSM_DEBUG.
- (We could have used the version in ssltrace.c, but that's
- specifically tailored to SSLTRACE. Sigh. */
-#define DUMPBUF_LINESIZE 24
-static void
-nsDumpBuffer(unsigned char *buf, PRIntn len)
-{
- char hexbuf[DUMPBUF_LINESIZE*3+1];
- char chrbuf[DUMPBUF_LINESIZE+1];
- static const char *hex = "0123456789abcdef";
- PRIntn i = 0, l = 0;
- char ch, *c, *h;
- if (len == 0)
- return;
- hexbuf[DUMPBUF_LINESIZE*3] = '\0';
- chrbuf[DUMPBUF_LINESIZE] = '\0';
- (void) memset(hexbuf, 0x20, DUMPBUF_LINESIZE*3);
- (void) memset(chrbuf, 0x20, DUMPBUF_LINESIZE);
- h = hexbuf;
- c = chrbuf;
-
- while (i < len)
- {
- ch = buf[i];
-
- if (l == DUMPBUF_LINESIZE)
- {
- PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("%s%s\n", hexbuf, chrbuf));
- (void) memset(hexbuf, 0x20, DUMPBUF_LINESIZE*3);
- (void) memset(chrbuf, 0x20, DUMPBUF_LINESIZE);
- h = hexbuf;
- c = chrbuf;
- l = 0;
- }
-
- /* Convert a character to hex. */
- *h++ = hex[(ch >> 4) & 0xf];
- *h++ = hex[ch & 0xf];
- h++;
-
- /* Put the character (if it's printable) into the character buffer. */
- if ((ch >= 0x20) && (ch <= 0x7e))
- *c++ = ch;
- else
- *c++ = '.';
- i++; l++;
- }
- PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("%s%s\n", hexbuf, chrbuf));
-}
-
-#define DEBUG_DUMP_BUFFER(buf,len) nsDumpBuffer(buf,len)
-#else
-#define DEBUG_DUMP_BUFFER(buf,len)
-#endif
-
-static PRBool
-isNonSSLErrorThatWeAllowToRetry(PRInt32 err, PRBool withInitialCleartext)
-{
- switch (err)
- {
- case PR_CONNECT_RESET_ERROR:
- if (!withInitialCleartext)
- return PR_TRUE;
- break;
-
- case PR_END_OF_FILE_ERROR:
- return PR_TRUE;
- }
-
- return PR_FALSE;
-}
-
-static PRBool
-isTLSIntoleranceError(PRInt32 err, PRBool withInitialCleartext)
-{
- // This function is supposed to decide, which error codes should
- // be used to conclude server is TLS intolerant.
- // Note this only happens during the initial SSL handshake.
- //
- // When not using a proxy we'll see a connection reset error.
- // When using a proxy, we'll see an end of file error.
- // In addition check for some error codes where it is reasonable
- // to retry without TLS.
-
- if (isNonSSLErrorThatWeAllowToRetry(err, withInitialCleartext))
- return PR_TRUE;
-
- switch (err)
- {
- case SSL_ERROR_BAD_MAC_ALERT:
- case SSL_ERROR_BAD_MAC_READ:
- case SSL_ERROR_HANDSHAKE_FAILURE_ALERT:
- case SSL_ERROR_HANDSHAKE_UNEXPECTED_ALERT:
- case SSL_ERROR_CLIENT_KEY_EXCHANGE_FAILURE:
- case SSL_ERROR_ILLEGAL_PARAMETER_ALERT:
- case SSL_ERROR_NO_CYPHER_OVERLAP:
- case SSL_ERROR_BAD_SERVER:
- case SSL_ERROR_BAD_BLOCK_PADDING:
- case SSL_ERROR_UNSUPPORTED_VERSION:
- case SSL_ERROR_PROTOCOL_VERSION_ALERT:
- case SSL_ERROR_RX_MALFORMED_FINISHED:
- case SSL_ERROR_BAD_HANDSHAKE_HASH_VALUE:
- case SSL_ERROR_DECODE_ERROR_ALERT:
- case SSL_ERROR_RX_UNKNOWN_ALERT:
- return PR_TRUE;
- }
-
- return PR_FALSE;
-}
-
-PRInt32
-nsSSLThread::checkHandshake(PRInt32 bytesTransfered,
- PRBool wasReading,
- PRFileDesc* ssl_layer_fd,
- nsNSSSocketInfo *socketInfo)
-{
- // This is where we work around all of those SSL servers that don't
- // conform to the SSL spec and shutdown a connection when we request
- // SSL v3.1 (aka TLS). The spec says the client says what version
- // of the protocol we're willing to perform, in our case SSL v3.1
- // In its response, the server says which version it wants to perform.
- // Many servers out there only know how to do v3.0. Next, we're supposed
- // to send back the version of the protocol we requested (ie v3.1). At
- // this point many servers's implementations are broken and they shut
- // down the connection when they don't see the version they sent back.
- // This is supposed to prevent a man in the middle from forcing one
- // side to dumb down to a lower level of the protocol. Unfortunately,
- // there are enough broken servers out there that such a gross work-around
- // is necessary. :(
-
- // Additional comment added in August 2006:
- // When we begun to use TLS hello extensions, we encountered a new class of
- // broken server, which simply stall for a very long time.
- // We would like to shorten the timeout, but limit this shorter timeout
- // to the handshake phase.
- // When we arrive here for the first time (for a given socket),
- // we know the connection is established, and the application code
- // tried the first read or write. This triggers the beginning of the
- // SSL handshake phase at the SSL FD level.
- // We'll make a note of the current time,
- // and use this to measure the elapsed time since handshake begin.
-
- // Do NOT assume TLS intolerance on a closed connection after bad cert ui was shown.
- // Simply retry.
- // This depends on the fact that Cert UI will not be shown again,
- // should the user override the bad cert.
-
- PRBool handleHandshakeResultNow;
- socketInfo->GetHandshakePending(&handleHandshakeResultNow);
-
- PRBool wantRetry = PR_FALSE;
-
- if (0 > bytesTransfered) {
- PRInt32 err = PR_GetError();
-
- if (handleHandshakeResultNow) {
- if (PR_WOULD_BLOCK_ERROR == err) {
- socketInfo->SetHandshakeInProgress(PR_TRUE);
- return bytesTransfered;
- }
-
- if (!wantRetry // no decision yet
- && isTLSIntoleranceError(err, socketInfo->GetHasCleartextPhase()))
- {
- wantRetry = nsSSLIOLayerHelpers::rememberPossibleTLSProblemSite(ssl_layer_fd, socketInfo);
- }
- }
-
- // This is the common place where we trigger an error message on a SSL socket.
- // This might be reached at any time of the connection.
- if (!wantRetry && (IS_SSL_ERROR(err) || IS_SEC_ERROR(err))) {
- nsHandleSSLError(socketInfo, err);
- }
- }
- else if (wasReading && 0 == bytesTransfered) // zero bytes on reading, socket closed
- {
- if (handleHandshakeResultNow)
- {
- if (!wantRetry // no decision yet
- && !socketInfo->GetHasCleartextPhase()) // mirror PR_CONNECT_RESET_ERROR treament
- {
- wantRetry =
- nsSSLIOLayerHelpers::rememberPossibleTLSProblemSite(ssl_layer_fd, socketInfo);
- }
- }
- }
-
- if (wantRetry) {
- // We want to cause the network layer to retry the connection.
- PR_SetError(PR_CONNECT_RESET_ERROR, 0);
- if (wasReading)
- bytesTransfered = -1;
- }
-
- // TLS intolerant servers only cause the first transfer to fail, so let's
- // set the HandshakePending attribute to false so that we don't try the logic
- // above again in a subsequent transfer.
- if (handleHandshakeResultNow) {
- socketInfo->SetHandshakePending(PR_FALSE);
- socketInfo->SetHandshakeInProgress(PR_FALSE);
- }
-
- return bytesTransfered;
-}
-
-static PRInt16 PR_CALLBACK
-nsSSLIOLayerPoll(PRFileDesc *fd, PRInt16 in_flags, PRInt16 *out_flags)
-{
- PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("[%p] polling SSL socket\n", (void*)fd));
- nsNSSShutDownPreventionLock locker;
-
- if (!out_flags)
- {
- NS_WARNING("nsSSLIOLayerPoll called with null out_flags");
- return 0;
- }
-
- *out_flags = 0;
-
- if (!fd)
- {
- NS_WARNING("nsSSLIOLayerPoll called with null fd");
- return 0;
- }
-
- nsNSSSocketInfo *socketInfo = (nsNSSSocketInfo*)fd->secret;
- NS_ASSERTION(socketInfo,"nsNSSSocketInfo was null for an fd");
-
- return nsSSLThread::requestPoll(socketInfo, in_flags, out_flags);
-}
-
-PRBool nsSSLIOLayerHelpers::nsSSLIOLayerInitialized = PR_FALSE;
-PRDescIdentity nsSSLIOLayerHelpers::nsSSLIOLayerIdentity;
-PRIOMethods nsSSLIOLayerHelpers::nsSSLIOLayerMethods;
-PRLock *nsSSLIOLayerHelpers::mutex = nsnull;
-nsCStringHashSet *nsSSLIOLayerHelpers::mTLSIntolerantSites = nsnull;
-nsCStringHashSet *nsSSLIOLayerHelpers::mTLSTolerantSites = nsnull;
-nsPSMRememberCertErrorsTable *nsSSLIOLayerHelpers::mHostsWithCertErrors = nsnull;
-nsCStringHashSet *nsSSLIOLayerHelpers::mRenegoUnrestrictedSites = nsnull;
-PRBool nsSSLIOLayerHelpers::mTreatUnsafeNegotiationAsBroken = PR_FALSE;
-PRFileDesc *nsSSLIOLayerHelpers::mSharedPollableEvent = nsnull;
-nsNSSSocketInfo *nsSSLIOLayerHelpers::mSocketOwningPollableEvent = nsnull;
-PRBool nsSSLIOLayerHelpers::mPollableEventCurrentlySet = PR_FALSE;
-
-static PRIntn _PSM_InvalidInt(void)
-{
- PR_ASSERT(!"I/O method is invalid");
- PR_SetError(PR_INVALID_METHOD_ERROR, 0);
- return -1;
-}
-
-static PRInt64 _PSM_InvalidInt64(void)
-{
- PR_ASSERT(!"I/O method is invalid");
- PR_SetError(PR_INVALID_METHOD_ERROR, 0);
- return -1;
-}
-
-static PRStatus _PSM_InvalidStatus(void)
-{
- PR_ASSERT(!"I/O method is invalid");
- PR_SetError(PR_INVALID_METHOD_ERROR, 0);
- return PR_FAILURE;
-}
-
-static PRFileDesc *_PSM_InvalidDesc(void)
-{
- PR_ASSERT(!"I/O method is invalid");
- PR_SetError(PR_INVALID_METHOD_ERROR, 0);
- return NULL;
-}
-
-static PRStatus PR_CALLBACK PSMGetsockname(PRFileDesc *fd, PRNetAddr *addr)
-{
- nsNSSShutDownPreventionLock locker;
- if (!fd || !fd->lower) {
- return PR_FAILURE;
- }
-
- nsNSSSocketInfo *socketInfo = (nsNSSSocketInfo*)fd->secret;
- NS_ASSERTION(socketInfo,"nsNSSSocketInfo was null for an fd");
-
- return nsSSLThread::requestGetsockname(socketInfo, addr);
-}
-
-static PRStatus PR_CALLBACK PSMGetpeername(PRFileDesc *fd, PRNetAddr *addr)
-{
- nsNSSShutDownPreventionLock locker;
- if (!fd || !fd->lower) {
- return PR_FAILURE;
- }
-
- nsNSSSocketInfo *socketInfo = (nsNSSSocketInfo*)fd->secret;
- NS_ASSERTION(socketInfo,"nsNSSSocketInfo was null for an fd");
-
- return nsSSLThread::requestGetpeername(socketInfo, addr);
-}
-
-static PRStatus PR_CALLBACK PSMGetsocketoption(PRFileDesc *fd,
- PRSocketOptionData *data)
-{
- nsNSSShutDownPreventionLock locker;
- if (!fd || !fd->lower) {
- return PR_FAILURE;
- }
-
- nsNSSSocketInfo *socketInfo = (nsNSSSocketInfo*)fd->secret;
- NS_ASSERTION(socketInfo,"nsNSSSocketInfo was null for an fd");
-
- return nsSSLThread::requestGetsocketoption(socketInfo, data);
-}
-
-static PRStatus PR_CALLBACK PSMSetsocketoption(PRFileDesc *fd,
- const PRSocketOptionData *data)
-{
- nsNSSShutDownPreventionLock locker;
- if (!fd || !fd->lower) {
- return PR_FAILURE;
- }
-
- nsNSSSocketInfo *socketInfo = (nsNSSSocketInfo*)fd->secret;
- NS_ASSERTION(socketInfo,"nsNSSSocketInfo was null for an fd");
-
- return nsSSLThread::requestSetsocketoption(socketInfo, data);
-}
-
-static PRInt32 PR_CALLBACK PSMRecv(PRFileDesc *fd, void *buf, PRInt32 amount,
- PRIntn flags, PRIntervalTime timeout)
-{
- nsNSSShutDownPreventionLock locker;
- if (!fd || !fd->lower) {
- PR_SetError(PR_BAD_DESCRIPTOR_ERROR, 0);
- return -1;
- }
-
- nsNSSSocketInfo *socketInfo = (nsNSSSocketInfo*)fd->secret;
- NS_ASSERTION(socketInfo,"nsNSSSocketInfo was null for an fd");
-
- if (flags == PR_MSG_PEEK) {
- return nsSSLThread::requestRecvMsgPeek(socketInfo, buf, amount, flags, timeout);
- }
-
- if (flags != 0) {
- PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
- return -1;
- }
-
- return nsSSLThread::requestRead(socketInfo, buf, amount, timeout);
-}
-
-static PRInt32 PR_CALLBACK PSMSend(PRFileDesc *fd, const void *buf, PRInt32 amount,
- PRIntn flags, PRIntervalTime timeout)
-{
- nsNSSShutDownPreventionLock locker;
- if (!fd || !fd->lower) {
- PR_SetError(PR_BAD_DESCRIPTOR_ERROR, 0);
- return -1;
- }
-
- if (flags != 0) {
- PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
- return -1;
- }
-
- nsNSSSocketInfo *socketInfo = (nsNSSSocketInfo*)fd->secret;
- NS_ASSERTION(socketInfo,"nsNSSSocketInfo was null for an fd");
-
- return nsSSLThread::requestWrite(socketInfo, buf, amount, timeout);
-}
-
-static PRInt32 PR_CALLBACK
-nsSSLIOLayerRead(PRFileDesc* fd, void* buf, PRInt32 amount)
-{
- return PSMRecv(fd, buf, amount, 0, PR_INTERVAL_NO_TIMEOUT);
-}
-
-static PRInt32 PR_CALLBACK
-nsSSLIOLayerWrite(PRFileDesc* fd, const void* buf, PRInt32 amount)
-{
- return PSMSend(fd, buf, amount, 0, PR_INTERVAL_NO_TIMEOUT);
-}
-
-static PRStatus PR_CALLBACK PSMConnectcontinue(PRFileDesc *fd, PRInt16 out_flags)
-{
- nsNSSShutDownPreventionLock locker;
- if (!fd || !fd->lower) {
- return PR_FAILURE;
- }
-
- nsNSSSocketInfo *socketInfo = (nsNSSSocketInfo*)fd->secret;
- NS_ASSERTION(socketInfo,"nsNSSSocketInfo was null for an fd");
-
- return nsSSLThread::requestConnectcontinue(socketInfo, out_flags);
-}
-
-nsresult nsSSLIOLayerHelpers::Init()
-{
- if (!nsSSLIOLayerInitialized) {
- nsSSLIOLayerInitialized = PR_TRUE;
- nsSSLIOLayerIdentity = PR_GetUniqueIdentity("NSS layer");
- nsSSLIOLayerMethods = *PR_GetDefaultIOMethods();
-
- nsSSLIOLayerMethods.available = (PRAvailableFN)_PSM_InvalidInt;
- nsSSLIOLayerMethods.available64 = (PRAvailable64FN)_PSM_InvalidInt64;
- nsSSLIOLayerMethods.fsync = (PRFsyncFN)_PSM_InvalidStatus;
- nsSSLIOLayerMethods.seek = (PRSeekFN)_PSM_InvalidInt;
- nsSSLIOLayerMethods.seek64 = (PRSeek64FN)_PSM_InvalidInt64;
- nsSSLIOLayerMethods.fileInfo = (PRFileInfoFN)_PSM_InvalidStatus;
- nsSSLIOLayerMethods.fileInfo64 = (PRFileInfo64FN)_PSM_InvalidStatus;
- nsSSLIOLayerMethods.writev = (PRWritevFN)_PSM_InvalidInt;
- nsSSLIOLayerMethods.accept = (PRAcceptFN)_PSM_InvalidDesc;
- nsSSLIOLayerMethods.bind = (PRBindFN)_PSM_InvalidStatus;
- nsSSLIOLayerMethods.listen = (PRListenFN)_PSM_InvalidStatus;
- nsSSLIOLayerMethods.shutdown = (PRShutdownFN)_PSM_InvalidStatus;
- nsSSLIOLayerMethods.recvfrom = (PRRecvfromFN)_PSM_InvalidInt;
- nsSSLIOLayerMethods.sendto = (PRSendtoFN)_PSM_InvalidInt;
- nsSSLIOLayerMethods.acceptread = (PRAcceptreadFN)_PSM_InvalidInt;
- nsSSLIOLayerMethods.transmitfile = (PRTransmitfileFN)_PSM_InvalidInt;
- nsSSLIOLayerMethods.sendfile = (PRSendfileFN)_PSM_InvalidInt;
-
- nsSSLIOLayerMethods.getsockname = PSMGetsockname;
- nsSSLIOLayerMethods.getpeername = PSMGetpeername;
- nsSSLIOLayerMethods.getsocketoption = PSMGetsocketoption;
- nsSSLIOLayerMethods.setsocketoption = PSMSetsocketoption;
- nsSSLIOLayerMethods.recv = PSMRecv;
- nsSSLIOLayerMethods.send = PSMSend;
- nsSSLIOLayerMethods.connectcontinue = PSMConnectcontinue;
-
- nsSSLIOLayerMethods.connect = nsSSLIOLayerConnect;
- nsSSLIOLayerMethods.close = nsSSLIOLayerClose;
- nsSSLIOLayerMethods.write = nsSSLIOLayerWrite;
- nsSSLIOLayerMethods.read = nsSSLIOLayerRead;
- nsSSLIOLayerMethods.poll = nsSSLIOLayerPoll;
- }
-
- mutex = PR_NewLock();
- if (!mutex)
- return NS_ERROR_OUT_OF_MEMORY;
-
- mSharedPollableEvent = PR_NewPollableEvent();
-
- // if we can not get a pollable event, we'll have to do busy waiting
-
- mTLSIntolerantSites = new nsCStringHashSet();
- if (!mTLSIntolerantSites)
- return NS_ERROR_OUT_OF_MEMORY;
-
- mTLSIntolerantSites->Init(1);
-
- mTLSTolerantSites = new nsCStringHashSet();
- if (!mTLSTolerantSites)
- return NS_ERROR_OUT_OF_MEMORY;
-
- // Initialize the tolerant site hashtable to 16 items at the start seems
- // reasonable as most servers are TLS tolerant. We just want to lower
- // the rate of hashtable array reallocation.
- mTLSTolerantSites->Init(16);
-
- mRenegoUnrestrictedSites = new nsCStringHashSet();
- if (!mRenegoUnrestrictedSites)
- return NS_ERROR_OUT_OF_MEMORY;
-
- mRenegoUnrestrictedSites->Init(1);
-
- mTreatUnsafeNegotiationAsBroken = PR_FALSE;
-
- mHostsWithCertErrors = new nsPSMRememberCertErrorsTable();
- if (!mHostsWithCertErrors || !mHostsWithCertErrors->mErrorHosts.IsInitialized())
- return NS_ERROR_OUT_OF_MEMORY;
-
- return NS_OK;
-}
-
-void nsSSLIOLayerHelpers::addIntolerantSite(const nsCString &str)
-{
- nsAutoLock lock(mutex);
- // Remember intolerant site only if it is not known as tolerant
- if (!mTLSTolerantSites->Contains(str))
- nsSSLIOLayerHelpers::mTLSIntolerantSites->Put(str);
-}
-
-void nsSSLIOLayerHelpers::removeIntolerantSite(const nsCString &str)
-{
- nsAutoLock lock(mutex);
- nsSSLIOLayerHelpers::mTLSIntolerantSites->Remove(str);
-}
-
-PRBool nsSSLIOLayerHelpers::isKnownAsIntolerantSite(const nsCString &str)
-{
- nsAutoLock lock(mutex);
- return mTLSIntolerantSites->Contains(str);
-}
-
-void nsSSLIOLayerHelpers::setRenegoUnrestrictedSites(const nsCString &str)
-{
- nsAutoLock lock(mutex);
-
- if (mRenegoUnrestrictedSites) {
- delete mRenegoUnrestrictedSites;
- mRenegoUnrestrictedSites = nsnull;
- }
-
- mRenegoUnrestrictedSites = new nsCStringHashSet();
- if (!mRenegoUnrestrictedSites)
- return;
-
- mRenegoUnrestrictedSites->Init(1);
-
- nsCCommaSeparatedTokenizer toker(str);
-
- while (toker.hasMoreTokens()) {
- const nsCSubstring &host = toker.nextToken();
- if (!host.IsEmpty()) {
- mRenegoUnrestrictedSites->Put(host);
- }
- }
-}
-
-PRBool nsSSLIOLayerHelpers::isRenegoUnrestrictedSite(const nsCString &str)
-{
- nsAutoLock lock(mutex);
- return mRenegoUnrestrictedSites->Contains(str);
-}
-
-void nsSSLIOLayerHelpers::setTreatUnsafeNegotiationAsBroken(PRBool broken)
-{
- nsAutoLock lock(mutex);
- mTreatUnsafeNegotiationAsBroken = broken;
-}
-
-PRBool nsSSLIOLayerHelpers::treatUnsafeNegotiationAsBroken()
-{
- nsAutoLock lock(mutex);
- return mTreatUnsafeNegotiationAsBroken;
-}
-
-nsresult
-nsSSLIOLayerNewSocket(PRInt32 family,
- const char *host,
- PRInt32 port,
- const char *proxyHost,
- PRInt32 proxyPort,
- PRFileDesc **fd,
- nsISupports** info,
- PRBool forSTARTTLS,
- PRBool anonymousLoad)
-{
-
- PRFileDesc* sock = PR_OpenTCPSocket(family);
- if (!sock) return NS_ERROR_OUT_OF_MEMORY;
-
- nsresult rv = nsSSLIOLayerAddToSocket(family, host, port, proxyHost, proxyPort,
- sock, info, forSTARTTLS, anonymousLoad);
- if (NS_FAILED(rv)) {
- PR_Close(sock);
- return rv;
- }
-
- *fd = sock;
- return NS_OK;
-}
-
-/*
- * Function: SECStatus nsConvertCANamesToStrings()
- * Purpose: creates CA names strings from (CERTDistNames* caNames)
- *
- * Arguments and return values
- * - arena: arena to allocate strings on
- * - caNameStrings: filled with CA names strings on return
- * - caNames: CERTDistNames to extract strings from
- * - return: SECSuccess if successful; error code otherwise
- *
- * Note: copied in its entirety from Nova code
- */
-SECStatus nsConvertCANamesToStrings(PRArenaPool* arena, char** caNameStrings,
- CERTDistNames* caNames)
-{
- SECItem* dername;
- SECStatus rv;
- int headerlen;
- PRUint32 contentlen;
- SECItem newitem;
- int n;
- char* namestring;
-
- for (n = 0; n < caNames->nnames; n++) {
- newitem.data = NULL;
- dername = &caNames->names[n];
-
- rv = DER_Lengths(dername, &headerlen, &contentlen);
-
- if (rv != SECSuccess) {
- goto loser;
- }
-
- if (headerlen + contentlen != dername->len) {
- /* This must be from an enterprise 2.x server, which sent
- * incorrectly formatted der without the outer wrapper of
- * type and length. Fix it up by adding the top level
- * header.
- */
- if (dername->len <= 127) {
- newitem.data = (unsigned char *) PR_Malloc(dername->len + 2);
- if (newitem.data == NULL) {
- goto loser;
- }
- newitem.data[0] = (unsigned char)0x30;
- newitem.data[1] = (unsigned char)dername->len;
- (void)memcpy(&newitem.data[2], dername->data, dername->len);
- }
- else if (dername->len <= 255) {
- newitem.data = (unsigned char *) PR_Malloc(dername->len + 3);
- if (newitem.data == NULL) {
- goto loser;
- }
- newitem.data[0] = (unsigned char)0x30;
- newitem.data[1] = (unsigned char)0x81;
- newitem.data[2] = (unsigned char)dername->len;
- (void)memcpy(&newitem.data[3], dername->data, dername->len);
- }
- else {
- /* greater than 256, better be less than 64k */
- newitem.data = (unsigned char *) PR_Malloc(dername->len + 4);
- if (newitem.data == NULL) {
- goto loser;
- }
- newitem.data[0] = (unsigned char)0x30;
- newitem.data[1] = (unsigned char)0x82;
- newitem.data[2] = (unsigned char)((dername->len >> 8) & 0xff);
- newitem.data[3] = (unsigned char)(dername->len & 0xff);
- memcpy(&newitem.data[4], dername->data, dername->len);
- }
- dername = &newitem;
- }
-
- namestring = CERT_DerNameToAscii(dername);
- if (namestring == NULL) {
- /* XXX - keep going until we fail to convert the name */
- caNameStrings[n] = "";
- }
- else {
- caNameStrings[n] = PORT_ArenaStrdup(arena, namestring);
- PR_Free(namestring);
- if (caNameStrings[n] == NULL) {
- goto loser;
- }
- }
-
- if (newitem.data != NULL) {
- PR_Free(newitem.data);
- }
- }
-
- return SECSuccess;
-loser:
- if (newitem.data != NULL) {
- PR_Free(newitem.data);
- }
- return SECFailure;
-}
-
-/*
- * structs and ASN1 templates for the limited scope-of-use extension
- *
- * CertificateScopeEntry ::= SEQUENCE {
- * name GeneralName, -- pattern, as for NameConstraints
- * portNumber INTEGER OPTIONAL }
- *
- * CertificateScopeOfUse ::= SEQUENCE OF CertificateScopeEntry
- */
-/*
- * CERTCertificateScopeEntry: struct for scope entry that can be consumed by
- * the code
- * certCertificateScopeOfUse: struct that represents the decoded extension data
- */
-typedef struct {
- SECItem derConstraint;
- SECItem derPort;
- CERTGeneralName* constraint; /* decoded constraint */
- PRIntn port; /* decoded port number */
-} CERTCertificateScopeEntry;
-
-typedef struct {
- CERTCertificateScopeEntry** entries;
-} certCertificateScopeOfUse;
-
-/* corresponding ASN1 templates */
-static const SEC_ASN1Template cert_CertificateScopeEntryTemplate[] = {
- { SEC_ASN1_SEQUENCE,
- 0, NULL, sizeof(CERTCertificateScopeEntry) },
- { SEC_ASN1_ANY,
- offsetof(CERTCertificateScopeEntry, derConstraint) },
- { SEC_ASN1_OPTIONAL | SEC_ASN1_INTEGER,
- offsetof(CERTCertificateScopeEntry, derPort) },
- { 0 }
-};
-
-static const SEC_ASN1Template cert_CertificateScopeOfUseTemplate[] = {
- { SEC_ASN1_SEQUENCE_OF, 0, cert_CertificateScopeEntryTemplate }
-};
-
-#if 0
-/*
- * decodes the extension data and create CERTCertificateScopeEntry that can
- * be consumed by the code
- */
-static
-SECStatus cert_DecodeScopeOfUseEntries(PRArenaPool* arena, SECItem* extData,
- CERTCertificateScopeEntry*** entries,
- int* numEntries)
-{
- certCertificateScopeOfUse* scope = NULL;
- SECStatus rv = SECSuccess;
- int i;
-
- *entries = NULL; /* in case of failure */
- *numEntries = 0; /* ditto */
-
- scope = (certCertificateScopeOfUse*)
- PORT_ArenaZAlloc(arena, sizeof(certCertificateScopeOfUse));
- if (scope == NULL) {
- goto loser;
- }
-
- rv = SEC_ASN1DecodeItem(arena, (void*)scope,
- cert_CertificateScopeOfUseTemplate, extData);
- if (rv != SECSuccess) {
- goto loser;
- }
-
- *entries = scope->entries;
- PR_ASSERT(*entries != NULL);
-
- /* first, let's count 'em. */
- for (i = 0; (*entries)[i] != NULL; i++) ;
- *numEntries = i;
-
- /* convert certCertificateScopeEntry sequence into what we can readily
- * use
- */
- for (i = 0; i < *numEntries; i++) {
- (*entries)[i]->constraint =
- CERT_DecodeGeneralName(arena, &((*entries)[i]->derConstraint),
- NULL);
- if ((*entries)[i]->derPort.data != NULL) {
- (*entries)[i]->port =
- (int)DER_GetInteger(&((*entries)[i]->derPort));
- }
- else {
- (*entries)[i]->port = 0;
- }
- }
-
- goto done;
-loser:
- if (rv == SECSuccess) {
- rv = SECFailure;
- }
-done:
- return rv;
-}
-
-static SECStatus cert_DecodeCertIPAddress(SECItem* genname,
- PRUint32* constraint, PRUint32* mask)
-{
- /* in case of failure */
- *constraint = 0;
- *mask = 0;
-
- PR_ASSERT(genname->data != NULL);
- if (genname->data == NULL) {
- return SECFailure;
- }
- if (genname->len != 8) {
- /* the length must be 4 byte IP address with 4 byte subnet mask */
- return SECFailure;
- }
-
- /* get them in the right order */
- *constraint = PR_ntohl((PRUint32)(*genname->data));
- *mask = PR_ntohl((PRUint32)(*(genname->data + 4)));
-
- return SECSuccess;
-}
-
-static char* _str_to_lower(char* string)
-{
-#ifdef XP_WIN
- return _strlwr(string);
-#else
- int i;
- for (i = 0; string[i] != '\0'; i++) {
- string[i] = tolower(string[i]);
- }
- return string;
-#endif
-}
-
-/*
- * Sees if the client certificate has a restriction in presenting the cert
- * to the host: returns PR_TRUE if there is no restriction or if the hostname
- * (and the port) satisfies the restriction, or PR_FALSE if the hostname (and
- * the port) does not satisfy the restriction
- */
-static PRBool CERT_MatchesScopeOfUse(CERTCertificate* cert, char* hostname,
- char* hostIP, PRIntn port)
-{
- PRBool rv = PR_TRUE; /* whether the cert can be presented */
- SECStatus srv;
- SECItem extData;
- PRArenaPool* arena = NULL;
- CERTCertificateScopeEntry** entries = NULL;
- /* arrays of decoded scope entries */
- int numEntries = 0;
- int i;
- char* hostLower = NULL;
- PRUint32 hostIPAddr = 0;
-
- PR_ASSERT((cert != NULL) && (hostname != NULL) && (hostIP != NULL));
-
- /* find cert extension */
- srv = CERT_FindCertExtension(cert, SEC_OID_NS_CERT_EXT_SCOPE_OF_USE,
- &extData);
- if (srv != SECSuccess) {
- /* most of the time, this means the extension was not found: also,
- * since this is not a critical extension (as of now) we may simply
- * return PR_TRUE
- */
- goto done;
- }
-
- arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
- if (arena == NULL) {
- goto done;
- }
-
- /* decode the scope of use entries into pairs of GeneralNames and
- * an optional port numbers
- */
- srv = cert_DecodeScopeOfUseEntries(arena, &extData, &entries, &numEntries);
- if (srv != SECSuccess) {
- /* XXX What should we do when we failed to decode the extension? This
- * may mean either the extension was malformed or some (unlikely)
- * fatal error on our part: my argument is that if the extension
- * was malformed the extension "disqualifies" as a valid
- * constraint and we may present the cert
- */
- goto done;
- }
-
- /* loop over these structures */
- for (i = 0; i < numEntries; i++) {
- /* determine whether the GeneralName is a DNS pattern, an IP address
- * constraint, or else
- */
- CERTGeneralName* genname = entries[i]->constraint;
-
- /* if constraint is NULL, don't bother looking */
- if (genname == NULL) {
- /* this is not a failure: just continue */
- continue;
- }
-
- switch (genname->type) {
- case certDNSName: {
- /* we have a DNS name constraint; we should use only the host name
- * information
- */
- char* pattern = NULL;
- char* substring = NULL;
-
- /* null-terminate the string */
- genname->name.other.data[genname->name.other.len] = '\0';
- pattern = _str_to_lower((char*)genname->name.other.data);
-
- if (hostLower == NULL) {
- /* so that it's done only if necessary and only once */
- hostLower = _str_to_lower(PL_strdup(hostname));
- }
-
- /* the hostname satisfies the constraint */
- if (((substring = strstr(hostLower, pattern)) != NULL) &&
- /* the hostname contains the pattern */
- (strlen(substring) == strlen(pattern)) &&
- /* the hostname ends with the pattern */
- ((substring == hostLower) || (*(substring-1) == '.'))) {
- /* the hostname either is identical to the pattern or
- * belongs to a subdomain
- */
- rv = PR_TRUE;
- }
- else {
- rv = PR_FALSE;
- }
- /* clean up strings if necessary */
- break;
- }
- case certIPAddress: {
- PRUint32 constraint;
- PRUint32 mask;
- PRNetAddr addr;
-
- if (hostIPAddr == 0) {
- /* so that it's done only if necessary and only once */
- PR_StringToNetAddr(hostIP, &addr);
- hostIPAddr = addr.inet.ip;
- }
-
- if (cert_DecodeCertIPAddress(&(genname->name.other), &constraint,
- &mask) != SECSuccess) {
- continue;
- }
- if ((hostIPAddr & mask) == (constraint & mask)) {
- rv = PR_TRUE;
- }
- else {
- rv = PR_FALSE;
- }
- break;
- }
- default:
- /* ill-formed entry: abort */
- continue; /* go to the next entry */
- }
-
- if (!rv) {
- /* we do not need to check the port: go to the next entry */
- continue;
- }
-
- /* finally, check the optional port number */
- if ((entries[i]->port != 0) && (port != entries[i]->port)) {
- /* port number does not match */
- rv = PR_FALSE;
- continue;
- }
-
- /* we have a match */
- PR_ASSERT(rv);
- break;
- }
-done:
- /* clean up entries */
- if (arena != NULL) {
- PORT_FreeArena(arena, PR_FALSE);
- }
- if (hostLower != NULL) {
- PR_Free(hostLower);
- }
- return rv;
-}
-#endif
-
-/*
- * Function: SSMStatus SSM_SetUserCertChoice()
-
- * Purpose: sets certChoice by reading the preference
- *
- * Arguments and return values
- * - conn: SSMSSLDataConnection
- * - returns: SSM_SUCCESS if successful; SSM_FAILURE otherwise
- *
- * Note: If done properly, this function will read the identifier strings
- * for ASK and AUTO modes, read the selected strings from the
- * preference, compare the strings, and determine in which mode it is
- * in.
- * We currently use ASK mode for UI apps and AUTO mode for UI-less
- * apps without really asking for preferences.
- */
-nsresult nsGetUserCertChoice(SSM_UserCertChoice* certChoice)
-{
- char *mode=NULL;
- nsresult ret;
-
- NS_ENSURE_ARG_POINTER(certChoice);
-
- nsCOMPtr<nsIPrefBranch> pref = do_GetService(NS_PREFSERVICE_CONTRACTID);
-
- ret = pref->GetCharPref("security.default_personal_cert", &mode);
- if (NS_FAILED(ret)) {
- goto loser;
- }
-
- if (PL_strcmp(mode, "Select Automatically") == 0) {
- *certChoice = AUTO;
- }
- else if (PL_strcmp(mode, "Ask Every Time") == 0) {
- *certChoice = ASK;
- }
- else {
- // Most likely we see a nickname from a migrated cert.
- // We do not currently support that, ask the user which cert to use.
- *certChoice = ASK;
- }
-
-loser:
- if (mode) {
- nsMemory::Free(mode);
- }
- return ret;
-}
-
-static PRBool hasExplicitKeyUsageNonRepudiation(CERTCertificate *cert)
-{
- /* There is no extension, v1 or v2 certificate */
- if (!cert->extensions)
- return PR_FALSE;
-
- SECStatus srv;
- SECItem keyUsageItem;
- keyUsageItem.data = NULL;
-
- srv = CERT_FindKeyUsageExtension(cert, &keyUsageItem);
- if (srv == SECFailure)
- return PR_FALSE;
-
- unsigned char keyUsage = keyUsageItem.data[0];
- PORT_Free (keyUsageItem.data);
-
- return !!(keyUsage & KU_NON_REPUDIATION);
-}
-
-/*
- * Function: SECStatus SSM_SSLGetClientAuthData()
- * Purpose: this callback function is used to pull client certificate
- * information upon server request
- *
- * Arguments and return values
- * - arg: SSL data connection
- * - socket: SSL socket we're dealing with
- * - caNames: list of CA names
- * - pRetCert: returns a pointer to a pointer to a valid certificate if
- * successful; otherwise NULL
- * - pRetKey: returns a pointer to a pointer to the corresponding key if
- * successful; otherwise NULL
- * - returns: SECSuccess if successful; error code otherwise
- */
-SECStatus nsNSS_SSLGetClientAuthData(void* arg, PRFileDesc* socket,
- CERTDistNames* caNames,
- CERTCertificate** pRetCert,
- SECKEYPrivateKey** pRetKey)
-{
- nsNSSShutDownPreventionLock locker;
- void* wincx = NULL;
- SECStatus ret = SECFailure;
- nsNSSSocketInfo* info = NULL;
- PRArenaPool* arena = NULL;
- char** caNameStrings;
- CERTCertificate* cert = NULL;
- SECKEYPrivateKey* privKey = NULL;
- CERTCertList* certList = NULL;
- CERTCertListNode* node;
- CERTCertNicknames* nicknames = NULL;
- char* extracted = NULL;
- PRIntn keyError = 0; /* used for private key retrieval error */
- SSM_UserCertChoice certChoice;
- PRInt32 NumberOfCerts = 0;
-
- /* do some argument checking */
- if (socket == NULL || caNames == NULL || pRetCert == NULL ||
- pRetKey == NULL) {
- PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
- return SECFailure;
- }
-
- /* get PKCS11 pin argument */
- wincx = SSL_RevealPinArg(socket);
- if (wincx == NULL) {
- return SECFailure;
- }
-
- /* get the socket info */
- info = (nsNSSSocketInfo*)socket->higher->secret;
-
- /* create caNameStrings */
- arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
- if (arena == NULL) {
- goto loser;
- }
-
- caNameStrings = (char**)PORT_ArenaAlloc(arena,
- sizeof(char*)*(caNames->nnames));
- if (caNameStrings == NULL) {
- goto loser;
- }
-
-
- ret = nsConvertCANamesToStrings(arena, caNameStrings, caNames);
- if (ret != SECSuccess) {
- goto loser;
- }
-
- /* get the preference */
- if (NS_FAILED(nsGetUserCertChoice(&certChoice))) {
- goto loser;
- }
-
- /* find valid user cert and key pair */
- if (certChoice == AUTO) {
- /* automatically find the right cert */
-
- /* find all user certs that are valid and for SSL */
- certList = CERT_FindUserCertsByUsage(CERT_GetDefaultCertDB(),
- certUsageSSLClient, PR_FALSE,
- PR_TRUE, wincx);
- if (certList == NULL) {
- goto noCert;
- }
-
- /* filter the list to those issued by CAs supported by the server */
- ret = CERT_FilterCertListByCANames(certList, caNames->nnames,
- caNameStrings, certUsageSSLClient);
- if (ret != SECSuccess) {
- goto noCert;
- }
-
- /* make sure the list is not empty */
- node = CERT_LIST_HEAD(certList);
- if (CERT_LIST_END(node, certList)) {
- goto noCert;
- }
-
- CERTCertificate* low_prio_nonrep_cert = NULL;
- CERTCertificateCleaner low_prio_cleaner(low_prio_nonrep_cert);
-
- /* loop through the list until we find a cert with a key */
- while (!CERT_LIST_END(node, certList)) {
- /* if the certificate has restriction and we do not satisfy it
- * we do not use it
- */
-#if 0 /* XXX This must be re-enabled */
- if (!CERT_MatchesScopeOfUse(node->cert, info->GetHostName,
- info->GetHostIP, info->GetHostPort)) {
- node = CERT_LIST_NEXT(node);
- continue;
- }
-#endif
-
- privKey = PK11_FindKeyByAnyCert(node->cert, wincx);
- if (privKey != NULL) {
- if (hasExplicitKeyUsageNonRepudiation(node->cert)) {
- SECKEY_DestroyPrivateKey(privKey);
- privKey = NULL;
- // Not a prefered cert
- if (!low_prio_nonrep_cert) // did not yet find a low prio cert
- low_prio_nonrep_cert = CERT_DupCertificate(node->cert);
- }
- else {
- // this is a good cert to present
- cert = CERT_DupCertificate(node->cert);
- break;
- }
- }
- keyError = PR_GetError();
- if (keyError == SEC_ERROR_BAD_PASSWORD) {
- /* problem with password: bail */
- goto loser;
- }
-
- node = CERT_LIST_NEXT(node);
- }
-
- if (!cert && low_prio_nonrep_cert) {
- cert = low_prio_nonrep_cert;
- low_prio_nonrep_cert = NULL; // take it away from the cleaner
- privKey = PK11_FindKeyByAnyCert(cert, wincx);
- }
-
- if (cert == NULL) {
- goto noCert;
- }
- }
- else { // Not Auto => ask
- /* Get the SSL Certificate */
- CERTCertificate* serverCert = NULL;
- CERTCertificateCleaner serverCertCleaner(serverCert);
- serverCert = SSL_PeerCertificate(socket);
- if (serverCert == NULL) {
- /* couldn't get the server cert: what do I do? */
- goto loser;
- }
-
- nsXPIDLCString hostname;
- info->GetHostName(getter_Copies(hostname));
-
- nsCAutoString clientlogin;
- info->GetClientLogin(clientlogin);
-
- nsresult rv;
- NS_DEFINE_CID(nssComponentCID, NS_NSSCOMPONENT_CID);
- nsCOMPtr<nsINSSComponent> nssComponent(do_GetService(nssComponentCID, &rv));
- nsRefPtr<nsClientAuthRememberService> cars;
- if (nssComponent) {
- nssComponent->GetClientAuthRememberService(getter_AddRefs(cars));
- }
-
- PRBool hasRemembered = PR_FALSE;
- nsCString rememberedDBKey;
- if (cars) {
- PRBool found;
- nsresult rv;
- if(clientlogin.IsEmpty()){
- rv = cars->HasRememberedDecision(hostname,
- serverCert,
- rememberedDBKey, &found);
- }
- else{
- rv = cars->HasRememberedDecision(hostname,
- serverCert,
- rememberedDBKey, &found,clientlogin);
- }
-
- if (NS_SUCCEEDED(rv) && found) {
- hasRemembered = PR_TRUE;
- }
- }
-
- PRBool canceled = PR_FALSE;
-
-if (hasRemembered)
-{
- if (rememberedDBKey.IsEmpty())
- {
- canceled = PR_TRUE;
- }
- else
- {
- nsCOMPtr<nsIX509CertDB> certdb;
- certdb = do_GetService(NS_X509CERTDB_CONTRACTID);
- if (certdb)
- {
- nsCOMPtr<nsIX509Cert> found_cert;
- nsresult find_rv =
- certdb->FindCertByDBKey(rememberedDBKey.get(), nsnull,
- getter_AddRefs(found_cert));
- if (NS_SUCCEEDED(find_rv) && found_cert) {
- nsNSSCertificate *obj_cert = reinterpret_cast<nsNSSCertificate *>(found_cert.get());
- if (obj_cert) {
- cert = obj_cert->GetCert();
-
-#ifdef DEBUG_kaie
- nsAutoString nick, nickWithSerial, details;
- if (NS_SUCCEEDED(obj_cert->FormatUIStrings(nick,
- nickWithSerial,
- details))) {
- NS_LossyConvertUTF16toASCII asc(nickWithSerial);
- fprintf(stderr, "====> remembered serial %s\n", asc.get());
- }
-#endif
-
- }
- }
-
- if (!cert) {
- hasRemembered = PR_FALSE;
- }
- }
- }
-}
-
-if (!hasRemembered)
-{
- /* user selects a cert to present */
- nsIClientAuthDialogs *dialogs = NULL;
- PRInt32 selectedIndex = -1;
- PRUnichar **certNicknameList = NULL;
- PRUnichar **certDetailsList = NULL;
-
- /* find all user certs that are for SSL */
- /* note that we are allowing expired certs in this list */
- certList = CERT_FindUserCertsByUsage(CERT_GetDefaultCertDB(),
- certUsageSSLClient, PR_FALSE,
- PR_FALSE, wincx);
- if (certList == NULL) {
- goto noCert;
- }
-
- if (caNames->nnames != 0) {
- /* filter the list to those issued by CAs supported by the
- * server
- */
- ret = CERT_FilterCertListByCANames(certList, caNames->nnames,
- caNameStrings,
- certUsageSSLClient);
- if (ret != SECSuccess) {
- goto loser;
- }
- }
-
- if (CERT_LIST_END(CERT_LIST_HEAD(certList), certList)) {
- /* list is empty - no matching certs */
- goto noCert;
- }
-
- /* filter it further for hostname restriction */
- node = CERT_LIST_HEAD(certList);
- while (!CERT_LIST_END(node, certList)) {
- ++NumberOfCerts;
-#if 0 /* XXX Fix this */
- if (!CERT_MatchesScopeOfUse(node->cert, conn->hostName,
- conn->hostIP, conn->port)) {
- CERTCertListNode* removed = node;
- node = CERT_LIST_NEXT(removed);
- CERT_RemoveCertListNode(removed);
- }
- else {
- node = CERT_LIST_NEXT(node);
- }
-#endif
- node = CERT_LIST_NEXT(node);
- }
- if (CERT_LIST_END(CERT_LIST_HEAD(certList), certList)) {
- goto noCert;
- }
-
- nicknames = getNSSCertNicknamesFromCertList(certList);
-
- if (nicknames == NULL) {
- goto loser;
- }
-
- NS_ASSERTION(nicknames->numnicknames == NumberOfCerts, "nicknames->numnicknames != NumberOfCerts");
-
- /* Get CN and O of the subject and O of the issuer */
- char *ccn = CERT_GetCommonName(&serverCert->subject);
- void *v = ccn;
- voidCleaner ccnCleaner(v);
- NS_ConvertUTF8toUTF16 cn(ccn);
-
- PRInt32 port;
- info->GetPort(&port);
-
- nsString cn_host_port;
- if (ccn && strcmp(ccn, hostname) == 0) {
- cn_host_port.Append(cn);
- cn_host_port.AppendLiteral(":");
- cn_host_port.AppendInt(port);
- }
- else {
- cn_host_port.Append(cn);
- cn_host_port.AppendLiteral(" (");
- cn_host_port.AppendLiteral(":");
- cn_host_port.AppendInt(port);
- cn_host_port.AppendLiteral(")");
- }
-
- char *corg = CERT_GetOrgName(&serverCert->subject);
- NS_ConvertUTF8toUTF16 org(corg);
- if (corg) PORT_Free(corg);
-
- char *cissuer = CERT_GetOrgName(&serverCert->issuer);
- NS_ConvertUTF8toUTF16 issuer(cissuer);
- if (cissuer) PORT_Free(cissuer);
-
- certNicknameList = (PRUnichar **)nsMemory::Alloc(sizeof(PRUnichar *) * nicknames->numnicknames);
- if (!certNicknameList)
- goto loser;
- certDetailsList = (PRUnichar **)nsMemory::Alloc(sizeof(PRUnichar *) * nicknames->numnicknames);
- if (!certDetailsList) {
- nsMemory::Free(certNicknameList);
- goto loser;
- }
-
- PRInt32 CertsToUse;
- for (CertsToUse = 0, node = CERT_LIST_HEAD(certList);
- !CERT_LIST_END(node, certList) && CertsToUse < nicknames->numnicknames;
- node = CERT_LIST_NEXT(node)
- )
- {
- nsRefPtr<nsNSSCertificate> tempCert = new nsNSSCertificate(node->cert);
-
- if (!tempCert)
- continue;
-
- NS_ConvertUTF8toUTF16 i_nickname(nicknames->nicknames[CertsToUse]);
- nsAutoString nickWithSerial, details;
-
- if (NS_FAILED(tempCert->FormatUIStrings(i_nickname, nickWithSerial, details)))
- continue;
-
- certNicknameList[CertsToUse] = ToNewUnicode(nickWithSerial);
- if (!certNicknameList[CertsToUse])
- continue;
- certDetailsList[CertsToUse] = ToNewUnicode(details);
- if (!certDetailsList[CertsToUse]) {
- nsMemory::Free(certNicknameList[CertsToUse]);
- continue;
- }
-
- ++CertsToUse;
- }
-
- /* Throw up the client auth dialog and get back the index of the selected cert */
- rv = getNSSDialogs((void**)&dialogs,
- NS_GET_IID(nsIClientAuthDialogs),
- NS_CLIENTAUTHDIALOGS_CONTRACTID);
-
- if (NS_FAILED(rv)) {
- NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(CertsToUse, certNicknameList);
- NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(CertsToUse, certDetailsList);
- goto loser;
- }
-
- {
- nsPSMUITracker tracker;
- if (tracker.isUIForbidden()) {
- rv = NS_ERROR_NOT_AVAILABLE;
- }
- else {
- rv = dialogs->ChooseCertificate(info, cn_host_port.get(), org.get(), issuer.get(),
- (const PRUnichar**)certNicknameList, (const PRUnichar**)certDetailsList,
- CertsToUse, &selectedIndex, &canceled);
- }
- }
-
- NS_RELEASE(dialogs);
- NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(CertsToUse, certNicknameList);
- NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(CertsToUse, certDetailsList);
-
- if (NS_FAILED(rv)) goto loser;
-
- // even if the user has canceled, we want to remember that, to avoid repeating prompts
- PRBool wantRemember = PR_FALSE;
- info->GetRememberClientAuthCertificate(&wantRemember);
-
- int i;
- if (!canceled)
- for (i = 0, node = CERT_LIST_HEAD(certList);
- !CERT_LIST_END(node, certList);
- ++i, node = CERT_LIST_NEXT(node)) {
-
- if (i == selectedIndex) {
- cert = CERT_DupCertificate(node->cert);
- break;
- }
- }
-
- if (cars && wantRemember) {
- if(clientlogin.IsEmpty()){
- cars->RememberDecision(hostname,
- serverCert,
- canceled ? 0 : cert);
- }
- else{
- cars->RememberDecision(hostname,
- serverCert,
- canceled ? 0 : cert,clientlogin);
- }
- }
-}
-
- if (canceled) { rv = NS_ERROR_NOT_AVAILABLE; goto loser; }
-
- if (cert == NULL) {
- goto loser;
- }
-
- /* go get the private key */
- privKey = PK11_FindKeyByAnyCert(cert, wincx);
- if (privKey == NULL) {
- keyError = PR_GetError();
- if (keyError == SEC_ERROR_BAD_PASSWORD) {
- /* problem with password: bail */
- goto loser;
- }
- else {
- goto noCert;
- }
- }
- }
- goto done;
-
-noCert:
-loser:
- if (ret == SECSuccess) {
- ret = SECFailure;
- }
- if (cert != NULL) {
- CERT_DestroyCertificate(cert);
- cert = NULL;
- }
-done:
- if (extracted != NULL) {
- PR_Free(extracted);
- }
- if (nicknames != NULL) {
- CERT_FreeNicknames(nicknames);
- }
- if (certList != NULL) {
- CERT_DestroyCertList(certList);
- }
- if (arena != NULL) {
- PORT_FreeArena(arena, PR_FALSE);
- }
-
- *pRetCert = cert;
- *pRetKey = privKey;
-
- return ret;
-}
-
-static SECStatus
-cancel_and_failure(nsNSSSocketInfo* infoObject)
-{
- infoObject->SetCanceled(PR_TRUE);
- return SECFailure;
-}
-
-static SECStatus
-nsNSSBadCertHandler(void *arg, PRFileDesc *sslSocket)
-{
- nsNSSShutDownPreventionLock locker;
- nsNSSSocketInfo* infoObject = (nsNSSSocketInfo *)arg;
- if (!infoObject)
- return SECFailure;
-
- if (nsSSLThread::exitRequested())
- return cancel_and_failure(infoObject);
-
- CERTCertificate *peerCert = nsnull;
- CERTCertificateCleaner peerCertCleaner(peerCert);
- peerCert = SSL_PeerCertificate(sslSocket);
- if (!peerCert)
- return cancel_and_failure(infoObject);
-
- nsRefPtr<nsNSSCertificate> nssCert;
- nssCert = new nsNSSCertificate(peerCert);
- if (!nssCert)
- return cancel_and_failure(infoObject);
-
- nsCOMPtr<nsIX509Cert> ix509 = static_cast<nsIX509Cert*>(nssCert.get());
-
- SECStatus srv;
- nsresult nsrv;
- PRUint32 collected_errors = 0;
- PRUint32 remaining_display_errors = 0;
-
- PRErrorCode errorCodeTrust = SECSuccess;
- PRErrorCode errorCodeMismatch = SECSuccess;
- PRErrorCode errorCodeExpired = SECSuccess;
-
- char *hostname = SSL_RevealURL(sslSocket);
- charCleaner hostnameCleaner(hostname);
- nsDependentCString hostString(hostname);
-
- PRInt32 port;
- infoObject->GetPort(&port);
-
- nsCString hostWithPortString = hostString;
- hostWithPortString.AppendLiteral(":");
- hostWithPortString.AppendInt(port);
-
- NS_ConvertUTF8toUTF16 hostWithPortStringUTF16(hostWithPortString);
-
- // Check the name field against the desired hostname.
- if (hostname && hostname[0] &&
- CERT_VerifyCertName(peerCert, hostname) != SECSuccess) {
- collected_errors |= nsICertOverrideService::ERROR_MISMATCH;
- errorCodeMismatch = SSL_ERROR_BAD_CERT_DOMAIN;
- }
-
- {
- PRArenaPool *log_arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
- if (!log_arena)
- return cancel_and_failure(infoObject);
-
- PRArenaPoolCleanerFalseParam log_arena_cleaner(log_arena);
-
- CERTVerifyLog *verify_log = PORT_ArenaZNew(log_arena, CERTVerifyLog);
- if (!verify_log)
- return cancel_and_failure(infoObject);
-
- CERTVerifyLogContentsCleaner verify_log_cleaner(verify_log);
-
- verify_log->arena = log_arena;
-
- srv = CERT_VerifyCertificate(CERT_GetDefaultCertDB(), peerCert,
- PR_TRUE, certificateUsageSSLServer,
- PR_Now(), (void*)infoObject,
- verify_log, NULL);
-
- // We ignore the result code of the cert verification.
- // Either it is a failure, which is expected, and we'll process the
- // verify log below.
- // Or it is a success, then a domain mismatch is the only
- // possible failure.
-
- CERTVerifyLogNode *i_node;
- for (i_node = verify_log->head; i_node; i_node = i_node->next)
- {
- switch (i_node->error)
- {
- case SEC_ERROR_UNKNOWN_ISSUER:
- case SEC_ERROR_CA_CERT_INVALID:
- case SEC_ERROR_UNTRUSTED_ISSUER:
- case SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE:
- case SEC_ERROR_UNTRUSTED_CERT:
- case SEC_ERROR_INADEQUATE_KEY_USAGE:
- // We group all these errors as "cert not trusted"
- collected_errors |= nsICertOverrideService::ERROR_UNTRUSTED;
- if (errorCodeTrust == SECSuccess) {
- errorCodeTrust = i_node->error;
- }
- break;
- case SSL_ERROR_BAD_CERT_DOMAIN:
- collected_errors |= nsICertOverrideService::ERROR_MISMATCH;
- if (errorCodeMismatch == SECSuccess) {
- errorCodeMismatch = i_node->error;
- }
- break;
- case SEC_ERROR_EXPIRED_CERTIFICATE:
- collected_errors |= nsICertOverrideService::ERROR_TIME;
- if (errorCodeExpired == SECSuccess) {
- errorCodeExpired = i_node->error;
- }
- break;
- default:
- // we are not willing to continue on any other error
- nsHandleSSLError(infoObject, i_node->error);
- // this error is our stop condition, so let's make sure
- // this error code will be reported to the external world.
- PR_SetError(i_node->error, 0);
- return cancel_and_failure(infoObject);
- }
- }
- }
-
- if (!collected_errors)
- {
- NS_NOTREACHED("why did NSS call our bad cert handler if all looks good? Let's cancel the connection");
- return SECFailure;
- }
-
- nsRefPtr<nsSSLStatus> status = infoObject->SSLStatus();
- if (!status) {
- status = new nsSSLStatus();
- infoObject->SetSSLStatus(status);
- }
-
- if (status) {
- if (!status->mServerCert) {
- status->mServerCert = nssCert;
- }
-
- status->mHaveCertErrorBits = PR_TRUE;
- status->mIsDomainMismatch = collected_errors & nsICertOverrideService::ERROR_MISMATCH;
- status->mIsNotValidAtThisTime = collected_errors & nsICertOverrideService::ERROR_TIME;
- status->mIsUntrusted = collected_errors & nsICertOverrideService::ERROR_UNTRUSTED;
-
- nsSSLIOLayerHelpers::mHostsWithCertErrors->RememberCertHasError(
- infoObject, status, SECFailure);
- }
-
- remaining_display_errors = collected_errors;
-
- nsCOMPtr<nsICertOverrideService> overrideService =
- do_GetService(NS_CERTOVERRIDE_CONTRACTID);
- // it is fine to continue without the nsICertOverrideService
-
- PRUint32 overrideBits = 0;
-
- if (overrideService)
- {
- PRBool haveOverride;
- PRBool isTemporaryOverride; // we don't care
-
- nsrv = overrideService->HasMatchingOverride(hostString, port,
- ix509,
- &overrideBits,
- &isTemporaryOverride,
- &haveOverride);
- if (NS_SUCCEEDED(nsrv) && haveOverride)
- {
- // remove the errors that are already overriden
- remaining_display_errors -= overrideBits;
- }
- }
-
- if (!remaining_display_errors) {
- // all errors are covered by override rules, so let's accept the cert
- return SECSuccess;
- }
-
- // Ok, this is a full stop.
- // First, deliver the technical details of the broken SSL status,
- // giving the caller a chance to suppress the error messages.
-
- PRBool suppressMessage = PR_FALSE;
- nsresult rv;
-
- // Try to get a nsIBadCertListener2 implementation from the socket consumer.
- nsCOMPtr<nsIInterfaceRequestor> cb;
- infoObject->GetNotificationCallbacks(getter_AddRefs(cb));
- if (cb) {
- nsCOMPtr<nsIInterfaceRequestor> callbacks;
- NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
- NS_GET_IID(nsIInterfaceRequestor),
- cb,
- NS_PROXY_SYNC,
- getter_AddRefs(callbacks));
-
- nsCOMPtr<nsIBadCertListener2> bcl = do_GetInterface(callbacks);
- if (bcl) {
- nsCOMPtr<nsIBadCertListener2> proxy_bcl;
- NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
- NS_GET_IID(nsIBadCertListener2),
- bcl,
- NS_PROXY_SYNC,
- getter_AddRefs(proxy_bcl));
- if (proxy_bcl) {
- nsIInterfaceRequestor *csi = static_cast<nsIInterfaceRequestor*>(infoObject);
- rv = proxy_bcl->NotifyCertProblem(csi, status, hostWithPortString,
- &suppressMessage);
- }
- }
- }
-
- nsCOMPtr<nsIRecentBadCertsService> recentBadCertsService =
- do_GetService(NS_RECENTBADCERTS_CONTRACTID);
-
- if (recentBadCertsService) {
- recentBadCertsService->AddBadCert(hostWithPortStringUTF16, status);
- }
-
- // pick the error code to report by priority
- PRErrorCode errorCodeToReport = SECSuccess;
- if (remaining_display_errors & nsICertOverrideService::ERROR_UNTRUSTED)
- errorCodeToReport = errorCodeTrust;
- else if (remaining_display_errors & nsICertOverrideService::ERROR_MISMATCH)
- errorCodeToReport = errorCodeMismatch;
- else if (remaining_display_errors & nsICertOverrideService::ERROR_TIME)
- errorCodeToReport = errorCodeExpired;
-
- if (!suppressMessage) {
- PRBool external = PR_FALSE;
- infoObject->GetExternalErrorReporting(&external);
-
- nsHandleInvalidCertError(infoObject,
- remaining_display_errors,
- hostString,
- hostWithPortString,
- port,
- errorCodeToReport,
- errorCodeTrust,
- errorCodeMismatch,
- errorCodeExpired,
- external, // wantsHtml
- ix509);
- }
-
- PR_SetError(errorCodeToReport, 0);
- return cancel_and_failure(infoObject);
-}
-
-static PRFileDesc*
-nsSSLIOLayerImportFD(PRFileDesc *fd,
- nsNSSSocketInfo *infoObject,
- const char *host,
- PRBool anonymousLoad)
-{
- nsNSSShutDownPreventionLock locker;
- PRFileDesc* sslSock = SSL_ImportFD(nsnull, fd);
- if (!sslSock) {
- NS_ASSERTION(PR_FALSE, "NSS: Error importing socket");
- return nsnull;
- }
- SSL_SetPKCS11PinArg(sslSock, (nsIInterfaceRequestor*)infoObject);
- SSL_HandshakeCallback(sslSock, HandshakeCallback, infoObject);
-
- // Disable this hook if we connect anonymously. See bug 466080.
- if (anonymousLoad) {
- SSL_GetClientAuthDataHook(sslSock, NULL, infoObject);
- } else {
- SSL_GetClientAuthDataHook(sslSock,
- (SSLGetClientAuthData)nsNSS_SSLGetClientAuthData,
- infoObject);
- }
- SSL_AuthCertificateHook(sslSock, AuthCertificateCallback, 0);
-
- PRInt32 ret = SSL_SetURL(sslSock, host);
- if (ret == -1) {
- NS_ASSERTION(PR_FALSE, "NSS: Error setting server name");
- goto loser;
- }
- return sslSock;
-loser:
- if (sslSock) {
- PR_Close(sslSock);
- }
- return nsnull;
-}
-
-static nsresult
-nsSSLIOLayerSetOptions(PRFileDesc *fd, PRBool forSTARTTLS,
- const char *proxyHost, const char *host, PRInt32 port,
- PRBool anonymousLoad, nsNSSSocketInfo *infoObject)
-{
- nsNSSShutDownPreventionLock locker;
- if (forSTARTTLS || proxyHost) {
- if (SECSuccess != SSL_OptionSet(fd, SSL_SECURITY, PR_FALSE)) {
- return NS_ERROR_FAILURE;
- }
- infoObject->SetHasCleartextPhase(PR_TRUE);
- }
-
- if (forSTARTTLS) {
- if (SECSuccess != SSL_OptionSet(fd, SSL_ENABLE_SSL2, PR_FALSE)) {
- return NS_ERROR_FAILURE;
- }
- if (SECSuccess != SSL_OptionSet(fd, SSL_V2_COMPATIBLE_HELLO, PR_FALSE)) {
- return NS_ERROR_FAILURE;
- }
- }
-
- // Let's see if we're trying to connect to a site we know is
- // TLS intolerant.
- nsCAutoString key;
- key = nsDependentCString(host) + NS_LITERAL_CSTRING(":") + nsPrintfCString("%d", port);
-
- if (nsSSLIOLayerHelpers::isKnownAsIntolerantSite(key)) {
- if (SECSuccess != SSL_OptionSet(fd, SSL_ENABLE_TLS, PR_FALSE))
- return NS_ERROR_FAILURE;
-
- infoObject->SetAllowTLSIntoleranceTimeout(PR_FALSE);
-
- // We assume that protocols that use the STARTTLS mechanism should support
- // modern hellos. For other protocols, if we suspect a site
- // does not support TLS, let's also use V2 hellos.
- // One advantage of this approach, if a site only supports the older
- // hellos, it is more likely that we will get a reasonable error code
- // on our single retry attempt.
-
- if (!forSTARTTLS &&
- SECSuccess != SSL_OptionSet(fd, SSL_V2_COMPATIBLE_HELLO, PR_TRUE))
- return NS_ERROR_FAILURE;
- }
-
- if (SECSuccess != SSL_OptionSet(fd, SSL_HANDSHAKE_AS_CLIENT, PR_TRUE)) {
- return NS_ERROR_FAILURE;
- }
- if (SECSuccess != SSL_BadCertHook(fd, (SSLBadCertHandler) nsNSSBadCertHandler,
- infoObject)) {
- return NS_ERROR_FAILURE;
- }
-
- if (nsSSLIOLayerHelpers::isRenegoUnrestrictedSite(nsDependentCString(host))) {
- if (SECSuccess != SSL_OptionSet(fd, SSL_REQUIRE_SAFE_NEGOTIATION, PR_FALSE)) {
- return NS_ERROR_FAILURE;
- }
- if (SECSuccess != SSL_OptionSet(fd, SSL_ENABLE_RENEGOTIATION, SSL_RENEGOTIATE_UNRESTRICTED)) {
- return NS_ERROR_FAILURE;
- }
- }
-
- // Set the Peer ID so that SSL proxy connections work properly.
- char *peerId;
- if (anonymousLoad) { // See bug #466080. Separate the caches.
- peerId = PR_smprintf("anon:%s:%d", host, port);
- } else {
- peerId = PR_smprintf("%s:%d", host, port);
- }
-
- if (SECSuccess != SSL_SetSockPeerID(fd, peerId)) {
- PR_smprintf_free(peerId);
- return NS_ERROR_FAILURE;
- }
-
- PR_smprintf_free(peerId);
- return NS_OK;
-}
-
-nsresult
-nsSSLIOLayerAddToSocket(PRInt32 family,
- const char* host,
- PRInt32 port,
- const char* proxyHost,
- PRInt32 proxyPort,
- PRFileDesc* fd,
- nsISupports** info,
- PRBool forSTARTTLS,
- PRBool anonymousLoad)
-{
- nsNSSShutDownPreventionLock locker;
- PRFileDesc* layer = nsnull;
- nsresult rv;
-
- nsNSSSocketInfo* infoObject = new nsNSSSocketInfo();
- if (!infoObject) return NS_ERROR_FAILURE;
-
- NS_ADDREF(infoObject);
- infoObject->SetForSTARTTLS(forSTARTTLS);
- infoObject->SetHostName(host);
- infoObject->SetPort(port);
-
- PRFileDesc *sslSock = nsSSLIOLayerImportFD(fd, infoObject, host, anonymousLoad);
- if (!sslSock) {
- NS_ASSERTION(PR_FALSE, "NSS: Error importing socket");
- goto loser;
- }
-
- infoObject->SetFileDescPtr(sslSock);
-
- rv = nsSSLIOLayerSetOptions(sslSock,
- forSTARTTLS, proxyHost, host, port, anonymousLoad,
- infoObject);
-
- if (NS_FAILED(rv))
- goto loser;
-
- /* Now, layer ourselves on top of the SSL socket... */
- layer = PR_CreateIOLayerStub(nsSSLIOLayerHelpers::nsSSLIOLayerIdentity,
- &nsSSLIOLayerHelpers::nsSSLIOLayerMethods);
- if (!layer)
- goto loser;
-
- layer->secret = (PRFilePrivate*) infoObject;
- rv = PR_PushIOLayer(sslSock, PR_GetLayersIdentity(sslSock), layer);
-
- if (NS_FAILED(rv)) {
- goto loser;
- }
-
- nsNSSShutDownList::trackSSLSocketCreate();
-
- PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("[%p] Socket set up\n", (void*)sslSock));
- infoObject->QueryInterface(NS_GET_IID(nsISupports), (void**) (info));
-
- // We are going use a clear connection first //
- if (forSTARTTLS || proxyHost) {
- infoObject->SetHandshakePending(PR_FALSE);
- }
-
- return NS_OK;
- loser:
- NS_IF_RELEASE(infoObject);
- if (layer) {
- layer->dtor(layer);
- }
- return NS_ERROR_FAILURE;
-}
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-\r
+ *\r
+ * ***** BEGIN LICENSE BLOCK *****\r
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1\r
+ *\r
+ * The contents of this file are subject to the Mozilla Public License Version\r
+ * 1.1 (the "License"); you may not use this file except in compliance with\r
+ * the License. You may obtain a copy of the License at\r
+ * http://www.mozilla.org/MPL/\r
+ *\r
+ * Software distributed under the License is distributed on an "AS IS" basis,\r
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License\r
+ * for the specific language governing rights and limitations under the\r
+ * License.\r
+ *\r
+ * The Original Code is mozilla.org code.\r
+ *\r
+ * The Initial Developer of the Original Code is\r
+ * Netscape Communications Corporation.\r
+ * Portions created by the Initial Developer are Copyright (C) 1998\r
+ * the Initial Developer. All Rights Reserved.\r
+ *\r
+ * Contributor(s):\r
+ * Brian Ryner <bryner@brianryner.com>\r
+ * Javier Delgadillo <javi@netscape.com>\r
+ * Kai Engert <kengert@redhat.com>\r
+ * Copyright (c) 2010 CASSIDIAN - All rights reserved\r
+ *\r
+ * Alternatively, the contents of this file may be used under the terms of\r
+ * either the GNU General Public License Version 2 or later (the "GPL"), or\r
+ * 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
+ * ***** END LICENSE BLOCK ***** */\r
+\r
+#include "nsNSSComponent.h"\r
+#include "nsNSSIOLayer.h"\r
+#include "nsNSSCallbacks.h"\r
+\r
+#include "prlog.h"\r
+#include "prnetdb.h"\r
+#include "nsIPrompt.h"\r
+#include "nsIPrefService.h"\r
+#include "nsIPrefBranch.h"\r
+#include "nsIServiceManager.h"\r
+#include "nsIWebProgressListener.h"\r
+#include "nsIChannel.h"\r
+#include "nsNSSCertificate.h"\r
+#include "nsIX509CertValidity.h"\r
+#include "nsIProxyObjectManager.h"\r
+#include "nsProxiedService.h"\r
+#include "nsIDateTimeFormat.h"\r
+#include "nsDateTimeFormatCID.h"\r
+#include "nsIClientAuthDialogs.h"\r
+#include "nsClientAuthRemember.h"\r
+#include "nsICertOverrideService.h"\r
+#include "nsIBadCertListener2.h"\r
+#include "nsISSLErrorListener.h"\r
+#include "nsIObjectInputStream.h"\r
+#include "nsIObjectOutputStream.h"\r
+#include "nsRecentBadCerts.h"\r
+#include "nsISSLCertErrorDialog.h"\r
+\r
+#include "nsXPIDLString.h"\r
+#include "nsReadableUtils.h"\r
+#include "nsHashSets.h"\r
+#include "nsCRT.h"\r
+#include "nsAutoPtr.h"\r
+#include "nsPrintfCString.h"\r
+#include "nsAutoLock.h"\r
+#include "nsSSLThread.h"\r
+#include "nsNSSShutDown.h"\r
+#include "nsSSLStatus.h"\r
+#include "nsNSSCertHelper.h"\r
+#include "nsNSSCleaner.h"\r
+#include "nsThreadUtils.h"\r
+#include "nsIDocShell.h"\r
+#include "nsIDocShellTreeItem.h"\r
+#include "nsISecureBrowserUI.h"\r
+#include "nsProxyRelease.h"\r
+#include "nsIClassInfoImpl.h"\r
+#include "nsIProgrammingLanguage.h"\r
+#include "nsCommaSeparatedTokenizer.h"\r
+\r
+#include "ssl.h"\r
+#include "secerr.h"\r
+#include "sslerr.h"\r
+#include "secder.h"\r
+#include "secasn1.h"\r
+#include "certdb.h"\r
+#include "cert.h"\r
+#include "keyhi.h"\r
+#include "secport.h"\r
+\r
+\r
+//#define DEBUG_SSL_VERBOSE //Enable this define to get minimal \r
+ //reports when doing SSL read/write\r
+ \r
+//#define DUMP_BUFFER //Enable this define along with\r
+ //DEBUG_SSL_VERBOSE to dump SSL\r
+ //read/write buffer to a log.\r
+ //Uses PR_LOG except on Mac where\r
+ //we always write out to our own\r
+ //file.\r
+\r
+NSSCleanupAutoPtrClass(CERTCertificate, CERT_DestroyCertificate)\r
+NSSCleanupAutoPtrClass(char, PL_strfree)\r
+NSSCleanupAutoPtrClass(void, PR_FREEIF)\r
+NSSCleanupAutoPtrClass_WithParam(PRArenaPool, PORT_FreeArena, FalseParam, PR_FALSE)\r
+\r
+/* SSM_UserCertChoice: enum for cert choice info */\r
+typedef enum {ASK, AUTO} SSM_UserCertChoice;\r
+\r
+\r
+static SECStatus PR_CALLBACK\r
+nsNSS_SSLGetClientAuthData(void *arg, PRFileDesc *socket,\r
+ CERTDistNames *caNames,\r
+ CERTCertificate **pRetCert,\r
+ SECKEYPrivateKey **pRetKey);\r
+static SECStatus PR_CALLBACK\r
+nsNSS_SSLGetClientAuthData(void *arg, PRFileDesc *socket,\r
+ CERTDistNames *caNames,\r
+ CERTCertificate **pRetCert,\r
+ SECKEYPrivateKey **pRetKey);\r
+#ifdef PR_LOGGING\r
+extern PRLogModuleInfo* gPIPNSSLog;\r
+#endif\r
+\r
+#if defined(DEBUG_SSL_VERBOSE) && defined (XP_MAC)\r
+\r
+#ifdef PR_LOG\r
+#undef PR_LOG\r
+#endif\r
+\r
+static PRFileDesc *gMyLogFile = nsnull;\r
+#define MAC_LOG_FILE "MAC PIPNSS Log File"\r
+\r
+void MyLogFunction(const char *fmt, ...)\r
+{\r
+ \r
+ va_list ap;\r
+ va_start(ap,fmt);\r
+ if (gMyLogFile == nsnull)\r
+ gMyLogFile = PR_Open(MAC_LOG_FILE, PR_WRONLY | PR_CREATE_FILE | PR_APPEND,\r
+ 0600);\r
+ if (!gMyLogFile)\r
+ return;\r
+ PR_vfprintf(gMyLogFile, fmt, ap);\r
+ va_end(ap);\r
+}\r
+\r
+#define PR_LOG(module,level,args) MyLogFunction args\r
+#endif\r
+\r
+\r
+nsSSLSocketThreadData::nsSSLSocketThreadData()\r
+: mSSLState(ssl_idle)\r
+, mPRErrorCode(PR_SUCCESS)\r
+, mSSLDataBuffer(nsnull)\r
+, mSSLDataBufferAllocatedSize(0)\r
+, mSSLRequestedTransferAmount(0)\r
+, mSSLRemainingReadResultData(nsnull)\r
+, mSSLResultRemainingBytes(0)\r
+, mReplacedSSLFileDesc(nsnull)\r
+, mOneBytePendingFromEarlierWrite(PR_FALSE)\r
+, mThePendingByte(0)\r
+, mOriginalRequestedTransferAmount(0)\r
+{\r
+}\r
+\r
+nsSSLSocketThreadData::~nsSSLSocketThreadData()\r
+{\r
+ NS_ASSERTION(mSSLState != ssl_pending_write\r
+ &&\r
+ mSSLState != ssl_pending_read, \r
+ "oops??? ssl socket is not idle at the time it is being destroyed");\r
+ if (mSSLDataBuffer) {\r
+ nsMemory::Free(mSSLDataBuffer);\r
+ }\r
+}\r
+\r
+PRBool nsSSLSocketThreadData::ensure_buffer_size(PRInt32 amount)\r
+{\r
+ if (amount > mSSLDataBufferAllocatedSize) {\r
+ if (mSSLDataBuffer) {\r
+ mSSLDataBuffer = (char*)nsMemory::Realloc(mSSLDataBuffer, amount);\r
+ }\r
+ else {\r
+ mSSLDataBuffer = (char*)nsMemory::Alloc(amount);\r
+ }\r
+ \r
+ if (!mSSLDataBuffer)\r
+ return PR_FALSE;\r
+\r
+ mSSLDataBufferAllocatedSize = amount;\r
+ }\r
+ \r
+ return PR_TRUE;\r
+}\r
+\r
+nsNSSSocketInfo::nsNSSSocketInfo()\r
+ : mFd(nsnull),\r
+ mBlockingState(blocking_state_unknown),\r
+ mSecurityState(nsIWebProgressListener::STATE_IS_INSECURE),\r
+ mSubRequestsHighSecurity(0),\r
+ mSubRequestsLowSecurity(0),\r
+ mSubRequestsBrokenSecurity(0),\r
+ mSubRequestsNoSecurity(0),\r
+ mDocShellDependentStuffKnown(PR_FALSE),\r
+ mExternalErrorReporting(PR_FALSE),\r
+ mForSTARTTLS(PR_FALSE),\r
+ mHandshakePending(PR_TRUE),\r
+ mCanceled(PR_FALSE),\r
+ mHasCleartextPhase(PR_FALSE),\r
+ mHandshakeInProgress(PR_FALSE),\r
+ mAllowTLSIntoleranceTimeout(PR_TRUE),\r
+ mRememberClientAuthCertificate(PR_FALSE),\r
+ mHandshakeStartTime(0),\r
+ mPort(0)\r
+{\r
+ mThreadData = new nsSSLSocketThreadData;\r
+}\r
+\r
+nsNSSSocketInfo::~nsNSSSocketInfo()\r
+{\r
+ delete mThreadData;\r
+\r
+ nsNSSShutDownPreventionLock locker;\r
+ if (isAlreadyShutDown())\r
+ return;\r
+\r
+ shutdown(calledFromObject);\r
+}\r
+\r
+void nsNSSSocketInfo::virtualDestroyNSSReference()\r
+{\r
+}\r
+\r
+NS_IMPL_THREADSAFE_ISUPPORTS9(nsNSSSocketInfo,\r
+ nsITransportSecurityInfo,\r
+ nsISSLSocketControl,\r
+ nsIInterfaceRequestor,\r
+ nsISSLStatusProvider,\r
+ nsIIdentityInfo,\r
+ nsIAssociatedContentSecurity,\r
+ nsISerializable,\r
+ nsIClassInfo,\r
+ nsIClientAuthUserDecision)\r
+\r
+nsresult\r
+nsNSSSocketInfo::GetHandshakePending(PRBool *aHandshakePending)\r
+{\r
+ *aHandshakePending = mHandshakePending;\r
+ return NS_OK;\r
+}\r
+\r
+nsresult\r
+nsNSSSocketInfo::SetHandshakePending(PRBool aHandshakePending)\r
+{\r
+ mHandshakePending = aHandshakePending;\r
+ return NS_OK;\r
+}\r
+\r
+nsresult\r
+nsNSSSocketInfo::SetHostName(const char* host)\r
+{\r
+ mHostName.Adopt(host ? NS_strdup(host) : 0);\r
+ return NS_OK;\r
+}\r
+\r
+nsresult\r
+nsNSSSocketInfo::GetHostName(char **host)\r
+{\r
+ *host = (mHostName) ? NS_strdup(mHostName) : nsnull;\r
+ return NS_OK;\r
+}\r
+\r
+nsresult\r
+nsNSSSocketInfo::SetClientLogin(const nsACString & aClientLogin)\r
+{\r
+ mClientLogin = aClientLogin;\r
+ return NS_OK;\r
+}\r
+\r
+nsresult\r
+nsNSSSocketInfo::GetClientLogin(nsACString & aClientLogin)\r
+{\r
+ aClientLogin = mClientLogin;\r
+ return NS_OK;\r
+}\r
+\r
+nsresult\r
+nsNSSSocketInfo::SetPort(PRInt32 aPort)\r
+{\r
+ mPort = aPort;\r
+ return NS_OK;\r
+}\r
+\r
+nsresult\r
+nsNSSSocketInfo::GetPort(PRInt32 *aPort)\r
+{\r
+ *aPort = mPort;\r
+ return NS_OK;\r
+}\r
+\r
+void nsNSSSocketInfo::SetCanceled(PRBool aCanceled)\r
+{\r
+ mCanceled = aCanceled;\r
+}\r
+\r
+PRBool nsNSSSocketInfo::GetCanceled()\r
+{\r
+ return mCanceled;\r
+}\r
+\r
+NS_IMETHODIMP nsNSSSocketInfo::GetRememberClientAuthCertificate(PRBool *aRememberClientAuthCertificate)\r
+{\r
+ NS_ENSURE_ARG_POINTER(aRememberClientAuthCertificate);\r
+ *aRememberClientAuthCertificate = mRememberClientAuthCertificate;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP nsNSSSocketInfo::SetRememberClientAuthCertificate(PRBool aRememberClientAuthCertificate)\r
+{\r
+ mRememberClientAuthCertificate = aRememberClientAuthCertificate;\r
+ return NS_OK;\r
+}\r
+\r
+void nsNSSSocketInfo::SetHasCleartextPhase(PRBool aHasCleartextPhase)\r
+{\r
+ mHasCleartextPhase = aHasCleartextPhase;\r
+}\r
+\r
+PRBool nsNSSSocketInfo::GetHasCleartextPhase()\r
+{\r
+ return mHasCleartextPhase;\r
+}\r
+\r
+NS_IMETHODIMP\r
+nsNSSSocketInfo::GetNotificationCallbacks(nsIInterfaceRequestor** aCallbacks)\r
+{\r
+ *aCallbacks = mCallbacks;\r
+ NS_IF_ADDREF(*aCallbacks);\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP\r
+nsNSSSocketInfo::SetNotificationCallbacks(nsIInterfaceRequestor* aCallbacks)\r
+{\r
+ if (!aCallbacks) {\r
+ mCallbacks = nsnull;\r
+ return NS_OK;\r
+ }\r
+\r
+ mCallbacks = aCallbacks;\r
+ mDocShellDependentStuffKnown = PR_FALSE;\r
+\r
+ return NS_OK;\r
+}\r
+\r
+nsresult\r
+nsNSSSocketInfo::EnsureDocShellDependentStuffKnown()\r
+{\r
+ if (mDocShellDependentStuffKnown)\r
+ return NS_OK;\r
+\r
+ if (!mCallbacks || nsSSLThread::exitRequested())\r
+ return NS_ERROR_FAILURE;\r
+\r
+ mDocShellDependentStuffKnown = PR_TRUE;\r
+\r
+ nsCOMPtr<nsIInterfaceRequestor> proxiedCallbacks;\r
+ NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,\r
+ NS_GET_IID(nsIInterfaceRequestor),\r
+ static_cast<nsIInterfaceRequestor*>(mCallbacks),\r
+ NS_PROXY_SYNC,\r
+ getter_AddRefs(proxiedCallbacks));\r
+\r
+ // Are we running within a context that wants external SSL error reporting?\r
+ // We'll look at the presence of a security UI object inside docshell.\r
+ // If the docshell wants the lock icon, you'll get the ssl error pages, too.\r
+ // This is helpful to distinguish from all other contexts, like mail windows,\r
+ // or any other SSL connections running in the background.\r
+ // We must query it now and remember, because fatal SSL errors will come \r
+ // with a socket close, and the socket transport might detach the callbacks \r
+ // instance prior to our error reporting.\r
+\r
+ nsCOMPtr<nsIDocShell> docshell;\r
+\r
+ nsCOMPtr<nsIDocShellTreeItem> item(do_GetInterface(proxiedCallbacks));\r
+ if (item)\r
+ {\r
+ nsCOMPtr<nsIDocShellTreeItem> proxiedItem;\r
+ nsCOMPtr<nsIDocShellTreeItem> rootItem;\r
+ NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,\r
+ NS_GET_IID(nsIDocShellTreeItem),\r
+ item.get(),\r
+ NS_PROXY_SYNC,\r
+ getter_AddRefs(proxiedItem));\r
+\r
+ proxiedItem->GetSameTypeRootTreeItem(getter_AddRefs(rootItem));\r
+ docshell = do_QueryInterface(rootItem);\r
+ NS_ASSERTION(docshell, "rootItem do_QI is null");\r
+ }\r
+\r
+ if (docshell)\r
+ {\r
+ nsCOMPtr<nsIDocShell> proxiedDocShell;\r
+ NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,\r
+ NS_GET_IID(nsIDocShell),\r
+ docshell.get(),\r
+ NS_PROXY_SYNC,\r
+ getter_AddRefs(proxiedDocShell));\r
+ nsISecureBrowserUI* secureUI = nsnull;\r
+ if (proxiedDocShell)\r
+ proxiedDocShell->GetSecurityUI(&secureUI);\r
+ if (secureUI)\r
+ {\r
+ nsCOMPtr<nsIThread> mainThread(do_GetMainThread());\r
+ NS_ProxyRelease(mainThread, secureUI, PR_FALSE);\r
+ mExternalErrorReporting = PR_TRUE;\r
+\r
+ // If this socket is associated to a docshell, let's try to remember\r
+ // the currently used cert. If this socket gets a notification from NSS\r
+ // having the same raw socket, we can keep the PSM wrapper object\r
+ // and all the data it has cached (like verification results).\r
+ nsCOMPtr<nsISSLStatusProvider> statprov = do_QueryInterface(secureUI);\r
+ if (statprov) {\r
+ nsCOMPtr<nsISupports> isup_stat;\r
+ statprov->GetSSLStatus(getter_AddRefs(isup_stat));\r
+ if (isup_stat) {\r
+ nsCOMPtr<nsISSLStatus> sslstat = do_QueryInterface(isup_stat);\r
+ if (sslstat) {\r
+ sslstat->GetServerCert(getter_AddRefs(mPreviousCert));\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ return NS_OK;\r
+}\r
+\r
+nsresult\r
+nsNSSSocketInfo::GetExternalErrorReporting(PRBool* state)\r
+{\r
+ nsresult rv = EnsureDocShellDependentStuffKnown();\r
+ NS_ENSURE_SUCCESS(rv, rv);\r
+ *state = mExternalErrorReporting;\r
+ return NS_OK;\r
+}\r
+\r
+nsresult\r
+nsNSSSocketInfo::SetExternalErrorReporting(PRBool aState)\r
+{\r
+ mExternalErrorReporting = aState;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP\r
+nsNSSSocketInfo::GetSecurityState(PRUint32* state)\r
+{\r
+ *state = mSecurityState;\r
+ return NS_OK;\r
+}\r
+\r
+nsresult\r
+nsNSSSocketInfo::SetSecurityState(PRUint32 aState)\r
+{\r
+ mSecurityState = aState;\r
+ return NS_OK;\r
+}\r
+\r
+/* attribute unsigned long countSubRequestsHighSecurity; */\r
+NS_IMETHODIMP nsNSSSocketInfo::GetCountSubRequestsHighSecurity(PRInt32 *aSubRequestsHighSecurity)\r
+{\r
+ *aSubRequestsHighSecurity = mSubRequestsHighSecurity;\r
+ return NS_OK;\r
+}\r
+NS_IMETHODIMP nsNSSSocketInfo::SetCountSubRequestsHighSecurity(PRInt32 aSubRequestsHighSecurity)\r
+{\r
+ mSubRequestsHighSecurity = aSubRequestsHighSecurity;\r
+ return NS_ERROR_NOT_IMPLEMENTED;\r
+}\r
+\r
+/* attribute unsigned long countSubRequestsLowSecurity; */\r
+NS_IMETHODIMP nsNSSSocketInfo::GetCountSubRequestsLowSecurity(PRInt32 *aSubRequestsLowSecurity)\r
+{\r
+ *aSubRequestsLowSecurity = mSubRequestsLowSecurity;\r
+ return NS_OK;\r
+}\r
+NS_IMETHODIMP nsNSSSocketInfo::SetCountSubRequestsLowSecurity(PRInt32 aSubRequestsLowSecurity)\r
+{\r
+ mSubRequestsLowSecurity = aSubRequestsLowSecurity;\r
+ return NS_OK;\r
+}\r
+\r
+/* attribute unsigned long countSubRequestsBrokenSecurity; */\r
+NS_IMETHODIMP nsNSSSocketInfo::GetCountSubRequestsBrokenSecurity(PRInt32 *aSubRequestsBrokenSecurity)\r
+{\r
+ *aSubRequestsBrokenSecurity = mSubRequestsBrokenSecurity;\r
+ return NS_OK;\r
+}\r
+NS_IMETHODIMP nsNSSSocketInfo::SetCountSubRequestsBrokenSecurity(PRInt32 aSubRequestsBrokenSecurity)\r
+{\r
+ mSubRequestsBrokenSecurity = aSubRequestsBrokenSecurity;\r
+ return NS_OK;\r
+}\r
+\r
+/* attribute unsigned long countSubRequestsNoSecurity; */\r
+NS_IMETHODIMP nsNSSSocketInfo::GetCountSubRequestsNoSecurity(PRInt32 *aSubRequestsNoSecurity)\r
+{\r
+ *aSubRequestsNoSecurity = mSubRequestsNoSecurity;\r
+ return NS_OK;\r
+}\r
+NS_IMETHODIMP nsNSSSocketInfo::SetCountSubRequestsNoSecurity(PRInt32 aSubRequestsNoSecurity)\r
+{\r
+ mSubRequestsNoSecurity = aSubRequestsNoSecurity;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP\r
+nsNSSSocketInfo::GetShortSecurityDescription(PRUnichar** aText) {\r
+ if (mShortDesc.IsEmpty())\r
+ *aText = nsnull;\r
+ else {\r
+ *aText = ToNewUnicode(mShortDesc);\r
+ NS_ENSURE_TRUE(*aText, NS_ERROR_OUT_OF_MEMORY);\r
+ }\r
+ return NS_OK;\r
+}\r
+\r
+nsresult\r
+nsNSSSocketInfo::SetShortSecurityDescription(const PRUnichar* aText) {\r
+ mShortDesc.Assign(aText);\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP\r
+nsNSSSocketInfo::GetErrorMessage(PRUnichar** aText) {\r
+ if (mErrorMessage.IsEmpty())\r
+ *aText = nsnull;\r
+ else {\r
+ *aText = ToNewUnicode(mErrorMessage);\r
+ NS_ENSURE_TRUE(*aText, NS_ERROR_OUT_OF_MEMORY);\r
+ }\r
+ return NS_OK;\r
+}\r
+\r
+nsresult\r
+nsNSSSocketInfo::SetErrorMessage(const PRUnichar* aText) {\r
+ mErrorMessage.Assign(aText);\r
+ return NS_OK;\r
+}\r
+\r
+/* void getInterface (in nsIIDRef uuid, [iid_is (uuid), retval] out nsQIResult result); */\r
+NS_IMETHODIMP nsNSSSocketInfo::GetInterface(const nsIID & uuid, void * *result)\r
+{\r
+ nsresult rv;\r
+ if (!mCallbacks) {\r
+ nsCOMPtr<nsIInterfaceRequestor> ir = new PipUIContext();\r
+ if (!ir)\r
+ return NS_ERROR_OUT_OF_MEMORY;\r
+\r
+ rv = ir->GetInterface(uuid, result);\r
+ } else {\r
+ if (nsSSLThread::exitRequested())\r
+ return NS_ERROR_FAILURE;\r
+\r
+ nsCOMPtr<nsIInterfaceRequestor> proxiedCallbacks;\r
+ NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,\r
+ NS_GET_IID(nsIInterfaceRequestor),\r
+ mCallbacks,\r
+ NS_PROXY_SYNC,\r
+ getter_AddRefs(proxiedCallbacks));\r
+\r
+ rv = proxiedCallbacks->GetInterface(uuid, result);\r
+ }\r
+ return rv;\r
+}\r
+\r
+nsresult\r
+nsNSSSocketInfo::GetForSTARTTLS(PRBool* aForSTARTTLS)\r
+{\r
+ *aForSTARTTLS = mForSTARTTLS;\r
+ return NS_OK;\r
+}\r
+\r
+nsresult\r
+nsNSSSocketInfo::SetForSTARTTLS(PRBool aForSTARTTLS)\r
+{\r
+ mForSTARTTLS = aForSTARTTLS;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP\r
+nsNSSSocketInfo::ProxyStartSSL()\r
+{\r
+ return ActivateSSL();\r
+}\r
+\r
+NS_IMETHODIMP\r
+nsNSSSocketInfo::StartTLS()\r
+{\r
+ return ActivateSSL();\r
+}\r
+\r
+NS_IMETHODIMP\r
+nsNSSSocketInfo::Write(nsIObjectOutputStream* stream) {\r
+ stream->WriteCompoundObject(NS_ISUPPORTS_CAST(nsIX509Cert*, mCert),\r
+ NS_GET_IID(nsISupports), PR_TRUE);\r
+\r
+ // Store the version number of the binary stream data format.\r
+ // The 0xFFFF0000 mask is included to the version number\r
+ // to distinguish version number from mSecurityState\r
+ // field stored in times before versioning has been introduced.\r
+ // This mask value has been chosen as mSecurityState could\r
+ // never be assigned such value.\r
+ PRUint32 version = 2;\r
+ stream->Write32(version | 0xFFFF0000);\r
+ stream->Write32(mSecurityState);\r
+ stream->WriteWStringZ(mShortDesc.get());\r
+ stream->WriteWStringZ(mErrorMessage.get());\r
+\r
+ stream->WriteCompoundObject(NS_ISUPPORTS_CAST(nsISSLStatus*, mSSLStatus),\r
+ NS_GET_IID(nsISupports), PR_TRUE);\r
+\r
+ stream->Write32((PRUint32)mSubRequestsHighSecurity);\r
+ stream->Write32((PRUint32)mSubRequestsLowSecurity);\r
+ stream->Write32((PRUint32)mSubRequestsBrokenSecurity);\r
+ stream->Write32((PRUint32)mSubRequestsNoSecurity);\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP\r
+nsNSSSocketInfo::Read(nsIObjectInputStream* stream) {\r
+ nsCOMPtr<nsISupports> obj;\r
+ stream->ReadObject(PR_TRUE, getter_AddRefs(obj));\r
+ mCert = reinterpret_cast<nsNSSCertificate*>(obj.get());\r
+\r
+ PRUint32 version;\r
+ stream->Read32(&version);\r
+ // If the version field we have just read is not masked with 0xFFFF0000\r
+ // then it is stored mSecurityState field and this is version 1 of\r
+ // the binary data stream format.\r
+ if ((version & 0xFFFF0000) == 0xFFFF0000) {\r
+ version &= ~0xFFFF0000;\r
+ stream->Read32(&mSecurityState);\r
+ }\r
+ else {\r
+ mSecurityState = version;\r
+ version = 1;\r
+ }\r
+ stream->ReadString(mShortDesc);\r
+ stream->ReadString(mErrorMessage);\r
+\r
+ stream->ReadObject(PR_TRUE, getter_AddRefs(obj));\r
+ mSSLStatus = reinterpret_cast<nsSSLStatus*>(obj.get());\r
+\r
+ if (version >= 2) {\r
+ stream->Read32((PRUint32*)&mSubRequestsHighSecurity);\r
+ stream->Read32((PRUint32*)&mSubRequestsLowSecurity);\r
+ stream->Read32((PRUint32*)&mSubRequestsBrokenSecurity);\r
+ stream->Read32((PRUint32*)&mSubRequestsNoSecurity);\r
+ }\r
+ else {\r
+ mSubRequestsHighSecurity = 0;\r
+ mSubRequestsLowSecurity = 0;\r
+ mSubRequestsBrokenSecurity = 0;\r
+ mSubRequestsNoSecurity = 0;\r
+ }\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP\r
+nsNSSSocketInfo::GetInterfaces(PRUint32 *count, nsIID * **array)\r
+{\r
+ *count = 0;\r
+ *array = nsnull;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP\r
+nsNSSSocketInfo::GetHelperForLanguage(PRUint32 language, nsISupports **_retval)\r
+{\r
+ *_retval = nsnull;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP\r
+nsNSSSocketInfo::GetContractID(char * *aContractID)\r
+{\r
+ *aContractID = nsnull;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP\r
+nsNSSSocketInfo::GetClassDescription(char * *aClassDescription)\r
+{\r
+ *aClassDescription = nsnull;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP\r
+nsNSSSocketInfo::GetClassID(nsCID * *aClassID)\r
+{\r
+ *aClassID = (nsCID*) nsMemory::Alloc(sizeof(nsCID));\r
+ if (!*aClassID)\r
+ return NS_ERROR_OUT_OF_MEMORY;\r
+ return GetClassIDNoAlloc(*aClassID);\r
+}\r
+\r
+NS_IMETHODIMP\r
+nsNSSSocketInfo::GetImplementationLanguage(PRUint32 *aImplementationLanguage)\r
+{\r
+ *aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS;\r
+ return NS_OK;\r
+}\r
+\r
+NS_IMETHODIMP\r
+nsNSSSocketInfo::GetFlags(PRUint32 *aFlags)\r
+{\r
+ *aFlags = 0;\r
+ return NS_OK;\r
+}\r
+\r
+static NS_DEFINE_CID(kNSSSocketInfoCID, NS_NSSSOCKETINFO_CID);\r
+\r
+NS_IMETHODIMP\r
+nsNSSSocketInfo::GetClassIDNoAlloc(nsCID *aClassIDNoAlloc)\r
+{\r
+ *aClassIDNoAlloc = kNSSSocketInfoCID;\r
+ return NS_OK;\r
+}\r
+\r
+nsresult nsNSSSocketInfo::ActivateSSL()\r
+{\r
+ nsNSSShutDownPreventionLock locker;\r
+ if (isAlreadyShutDown())\r
+ return NS_ERROR_NOT_AVAILABLE;\r
+\r
+ nsresult rv = nsSSLThread::requestActivateSSL(this);\r
+ \r
+ if (NS_FAILED(rv))\r
+ return rv;\r
+\r
+ mHandshakePending = PR_TRUE;\r
+\r
+ return NS_OK;\r
+}\r
+\r
+nsresult nsNSSSocketInfo::GetFileDescPtr(PRFileDesc** aFilePtr)\r
+{\r
+ *aFilePtr = mFd;\r
+ return NS_OK;\r
+}\r
+\r
+nsresult nsNSSSocketInfo::SetFileDescPtr(PRFileDesc* aFilePtr)\r
+{\r
+ mFd = aFilePtr;\r
+ return NS_OK;\r
+}\r
+\r
+nsresult nsNSSSocketInfo::GetPreviousCert(nsIX509Cert** _result)\r
+{\r
+ NS_ENSURE_ARG_POINTER(_result);\r
+ nsresult rv = EnsureDocShellDependentStuffKnown();\r
+ NS_ENSURE_SUCCESS(rv, rv);\r
+\r
+ *_result = mPreviousCert;\r
+ NS_IF_ADDREF(*_result);\r
+\r
+ return NS_OK;\r
+}\r
+\r
+nsresult nsNSSSocketInfo::GetCert(nsIX509Cert** _result)\r
+{\r
+ NS_ENSURE_ARG_POINTER(_result);\r
+\r
+ *_result = mCert;\r
+ NS_IF_ADDREF(*_result);\r
+\r
+ return NS_OK;\r
+}\r
+\r
+nsresult nsNSSSocketInfo::SetCert(nsIX509Cert *aCert)\r
+{\r
+ mCert = aCert;\r
+\r
+ return NS_OK;\r
+}\r
+\r
+nsresult nsNSSSocketInfo::GetSSLStatus(nsISupports** _result)\r
+{\r
+ NS_ENSURE_ARG_POINTER(_result);\r
+\r
+ *_result = NS_ISUPPORTS_CAST(nsISSLStatus*, mSSLStatus);\r
+ NS_IF_ADDREF(*_result);\r
+\r
+ return NS_OK;\r
+}\r
+\r
+nsresult nsNSSSocketInfo::SetSSLStatus(nsSSLStatus *aSSLStatus)\r
+{\r
+ mSSLStatus = aSSLStatus;\r
+\r
+ return NS_OK;\r
+}\r
+\r
+void nsNSSSocketInfo::SetHandshakeInProgress(PRBool aIsIn)\r
+{\r
+ mHandshakeInProgress = aIsIn;\r
+\r
+ if (mHandshakeInProgress && !mHandshakeStartTime)\r
+ {\r
+ mHandshakeStartTime = PR_IntervalNow();\r
+ }\r
+}\r
+\r
+void nsNSSSocketInfo::SetAllowTLSIntoleranceTimeout(PRBool aAllow)\r
+{\r
+ mAllowTLSIntoleranceTimeout = aAllow;\r
+}\r
+\r
+#define HANDSHAKE_TIMEOUT_SECONDS 25\r
+\r
+PRBool nsNSSSocketInfo::HandshakeTimeout()\r
+{\r
+ if (!mHandshakeInProgress || !mAllowTLSIntoleranceTimeout)\r
+ return PR_FALSE;\r
+\r
+ return ((PRIntervalTime)(PR_IntervalNow() - mHandshakeStartTime)\r
+ > PR_SecondsToInterval(HANDSHAKE_TIMEOUT_SECONDS));\r
+}\r
+\r
+void nsSSLIOLayerHelpers::Cleanup()\r
+{\r
+ if (mTLSIntolerantSites) {\r
+ delete mTLSIntolerantSites;\r
+ mTLSIntolerantSites = nsnull;\r
+ }\r
+\r
+ if (mTLSTolerantSites) {\r
+ delete mTLSTolerantSites;\r
+ mTLSTolerantSites = nsnull;\r
+ }\r
+\r
+ if (mRenegoUnrestrictedSites) {\r
+ delete mRenegoUnrestrictedSites;\r
+ mRenegoUnrestrictedSites = nsnull;\r
+ }\r
+\r
+ if (mSharedPollableEvent)\r
+ PR_DestroyPollableEvent(mSharedPollableEvent);\r
+\r
+ if (mutex) {\r
+ PR_DestroyLock(mutex);\r
+ mutex = nsnull;\r
+ }\r
+\r
+ if (mHostsWithCertErrors) {\r
+ delete mHostsWithCertErrors;\r
+ mHostsWithCertErrors = nsnull;\r
+ }\r
+}\r
+\r
+static nsresult\r
+getErrorMessage(PRInt32 err, \r
+ const nsString &host,\r
+ PRInt32 port,\r
+ PRBool externalErrorReporting,\r
+ nsINSSComponent *component,\r
+ nsString &returnedMessage)\r
+{\r
+ NS_ENSURE_ARG_POINTER(component);\r
+\r
+ const PRUnichar *params[1];\r
+ nsresult rv;\r
+\r
+ if (host.Length())\r
+ {\r
+ nsString hostWithPort;\r
+\r
+ // For now, hide port when it's 443 and we're reporting the error using\r
+ // external reporting. In the future a better mechanism should be used\r
+ // to make a decision about showing the port number, possibly by requiring\r
+ // the context object to implement a specific interface.\r
+ // The motivation is that Mozilla browser would like to hide the port number\r
+ // in error pages in the common case.\r
+\r
+ if (externalErrorReporting && port == 443) {\r
+ params[0] = host.get();\r
+ }\r
+ else {\r
+ hostWithPort = host;\r
+ hostWithPort.AppendLiteral(":");\r
+ hostWithPort.AppendInt(port);\r
+ params[0] = hostWithPort.get();\r
+ }\r
+\r
+ nsString formattedString;\r
+ rv = component->PIPBundleFormatStringFromName("SSLConnectionErrorPrefix", \r
+ params, 1, \r
+ formattedString);\r
+ if (NS_SUCCEEDED(rv))\r
+ {\r
+ returnedMessage.Append(formattedString);\r
+ returnedMessage.Append(NS_LITERAL_STRING("\n\n"));\r
+ }\r
+ }\r
+\r
+ nsString explanation;\r
+ rv = nsNSSErrors::getErrorMessageFromCode(err, component, explanation);\r
+ if (NS_SUCCEEDED(rv))\r
+ returnedMessage.Append(explanation);\r
+\r
+ return NS_OK;\r
+}\r
+\r
+static void\r
+AppendErrorTextUntrusted(PRErrorCode errTrust,\r
+ const nsString &host,\r
+ nsIX509Cert* ix509,\r
+ nsINSSComponent *component,\r
+ nsString &returnedMessage)\r
+{\r
+ const char *errorID = nsnull;\r
+ nsCOMPtr<nsIX509Cert3> cert3 = do_QueryInterface(ix509);\r
+ if (cert3) {\r
+ PRBool isSelfSigned;\r
+ if (NS_SUCCEEDED(cert3->GetIsSelfSigned(&isSelfSigned))\r
+ && isSelfSigned) {\r
+ errorID = "certErrorTrust_SelfSigned";\r
+ }\r
+ }\r
+\r
+ if (!errorID) {\r
+ switch (errTrust) {\r
+ case SEC_ERROR_UNKNOWN_ISSUER:\r
+ errorID = "certErrorTrust_UnknownIssuer";\r
+ break;\r
+ case SEC_ERROR_INADEQUATE_KEY_USAGE:\r
+ // Should get an individual string in the future\r
+ // For now, use the same as CaInvalid\r
+ case SEC_ERROR_CA_CERT_INVALID:\r
+ errorID = "certErrorTrust_CaInvalid";\r
+ break;\r
+ case SEC_ERROR_UNTRUSTED_ISSUER:\r
+ errorID = "certErrorTrust_Issuer";\r
+ break;\r
+ case SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE:\r
+ errorID = "certErrorTrust_ExpiredIssuer";\r
+ break;\r
+ case SEC_ERROR_UNTRUSTED_CERT:\r
+ default:\r
+ errorID = "certErrorTrust_Untrusted";\r
+ break;\r
+ }\r
+ }\r
+\r
+ nsString formattedString;\r
+ nsresult rv = component->GetPIPNSSBundleString(errorID, \r
+ formattedString);\r
+ if (NS_SUCCEEDED(rv))\r
+ {\r
+ returnedMessage.Append(formattedString);\r
+ returnedMessage.Append(NS_LITERAL_STRING("\n"));\r
+ }\r
+}\r
+\r
+// returns TRUE if SAN was used to produce names\r
+// return FALSE if nothing was produced\r
+// names => a single name or a list of names\r
+// multipleNames => whether multiple names were delivered\r
+static PRBool\r
+GetSubjectAltNames(CERTCertificate *nssCert,\r
+ nsINSSComponent *component,\r
+ nsString &allNames,\r
+ PRUint32 &nameCount)\r
+{\r
+ allNames.Truncate();\r
+ nameCount = 0;\r
+\r
+ PRArenaPool *san_arena = nsnull;\r
+ SECItem altNameExtension = {siBuffer, NULL, 0 };\r
+ CERTGeneralName *sanNameList = nsnull;\r
+\r
+ nsresult rv;\r
+ rv = CERT_FindCertExtension(nssCert, SEC_OID_X509_SUBJECT_ALT_NAME,\r
+ &altNameExtension);\r
+ if (rv != SECSuccess)\r
+ return PR_FALSE;\r
+\r
+ san_arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);\r
+ if (!san_arena)\r
+ return PR_FALSE;\r
+\r
+ sanNameList = CERT_DecodeAltNameExtension(san_arena, &altNameExtension);\r
+ if (!sanNameList)\r
+ return PR_FALSE;\r
+\r
+ SECITEM_FreeItem(&altNameExtension, PR_FALSE);\r
+\r
+ CERTGeneralName *current = sanNameList;\r
+ do {\r
+ nsAutoString name;\r
+ switch (current->type) {\r
+ case certDNSName:\r
+ name.AssignASCII((char*)current->name.other.data, current->name.other.len);\r
+ if (!allNames.IsEmpty()) {\r
+ allNames.Append(NS_LITERAL_STRING(" , "));\r
+ }\r
+ ++nameCount;\r
+ allNames.Append(name);\r
+ break;\r
+\r
+ case certIPAddress:\r
+ {\r
+ char buf[INET6_ADDRSTRLEN];\r
+ PRNetAddr addr;\r
+ if (current->name.other.len == 4) {\r
+ addr.inet.family = PR_AF_INET;\r
+ memcpy(&addr.inet.ip, current->name.other.data, current->name.other.len);\r
+ PR_NetAddrToString(&addr, buf, sizeof(buf));\r
+ name.AssignASCII(buf);\r
+ } else if (current->name.other.len == 16) {\r
+ addr.ipv6.family = PR_AF_INET6;\r
+ memcpy(&addr.ipv6.ip, current->name.other.data, current->name.other.len);\r
+ PR_NetAddrToString(&addr, buf, sizeof(buf));\r
+ name.AssignASCII(buf);\r
+ } else {\r
+ /* invalid IP address */\r
+ }\r
+ if (!name.IsEmpty()) {\r
+ if (!allNames.IsEmpty()) {\r
+ allNames.Append(NS_LITERAL_STRING(" , "));\r
+ }\r
+ ++nameCount;\r
+ allNames.Append(name);\r
+ }\r
+ break;\r
+ }\r
+\r
+ default: // all other types of names are ignored\r
+ break;\r
+ }\r
+ current = CERT_GetNextGeneralName(current);\r
+ } while (current != sanNameList); // double linked\r
+\r
+ PORT_FreeArena(san_arena, PR_FALSE);\r
+ return PR_TRUE;\r
+}\r
+\r
+static void\r
+AppendErrorTextMismatch(const nsString &host,\r
+ nsIX509Cert* ix509,\r
+ nsINSSComponent *component,\r
+ PRBool wantsHtml,\r
+ nsString &returnedMessage)\r
+{\r
+ const PRUnichar *params[1];\r
+ nsresult rv;\r
+\r
+ CERTCertificate *nssCert = NULL;\r
+ CERTCertificateCleaner nssCertCleaner(nssCert);\r
+\r
+ nsCOMPtr<nsIX509Cert2> cert2 = do_QueryInterface(ix509, &rv);\r
+ if (cert2)\r
+ nssCert = cert2->GetCert();\r
+\r
+ if (!nssCert) {\r
+ // We are unable to extract the valid names, say "not valid for name".\r
+ params[0] = host.get();\r
+ nsString formattedString;\r
+ rv = component->PIPBundleFormatStringFromName("certErrorMismatch", \r
+ params, 1, \r
+ formattedString);\r
+ if (NS_SUCCEEDED(rv)) {\r
+ returnedMessage.Append(formattedString);\r
+ returnedMessage.Append(NS_LITERAL_STRING("\n"));\r
+ }\r
+ return;\r
+ }\r
+\r
+ nsString allNames;\r
+ PRUint32 nameCount = 0;\r
+ PRBool useSAN = PR_FALSE;\r
+\r
+ if (nssCert)\r
+ useSAN = GetSubjectAltNames(nssCert, component, allNames, nameCount);\r
+\r
+ if (!useSAN) {\r
+ char *certName = nsnull;\r
+ // currently CERT_FindNSStringExtension is not being exported by NSS.\r
+ // If it gets exported, enable the following line.\r
+ // certName = CERT_FindNSStringExtension(nssCert, SEC_OID_NS_CERT_EXT_SSL_SERVER_NAME);\r
+ // However, it has been discussed to treat the extension as obsolete and ignore it.\r
+ if (!certName)\r
+ certName = CERT_GetCommonName(&nssCert->subject);\r
+ if (certName) {\r
+ ++nameCount;\r
+ allNames.AssignASCII(certName);\r
+ PORT_Free(certName);\r
+ }\r
+ }\r
+\r
+ if (nameCount > 1) {\r
+ nsString message;\r
+ rv = component->GetPIPNSSBundleString("certErrorMismatchMultiple", \r
+ message);\r
+ if (NS_SUCCEEDED(rv)) {\r
+ returnedMessage.Append(message);\r
+ returnedMessage.Append(NS_LITERAL_STRING("\n "));\r
+ returnedMessage.Append(allNames);\r
+ returnedMessage.Append(NS_LITERAL_STRING(" \n"));\r
+ }\r
+ }\r
+ else if (nameCount == 1) {\r
+ const PRUnichar *params[1];\r
+ params[0] = allNames.get();\r
+\r
+ const char *stringID;\r
+ if (wantsHtml)\r
+ stringID = "certErrorMismatchSingle2";\r
+ else\r
+ stringID = "certErrorMismatchSinglePlain";\r
+\r
+ nsString formattedString;\r
+ rv = component->PIPBundleFormatStringFromName(stringID, \r
+ params, 1, \r
+ formattedString);\r
+ if (NS_SUCCEEDED(rv)) {\r
+ returnedMessage.Append(formattedString);\r
+ returnedMessage.Append(NS_LITERAL_STRING("\n"));\r
+ }\r
+ }\r
+ else { // nameCount == 0\r
+ nsString message;\r
+ nsresult rv = component->GetPIPNSSBundleString("certErrorMismatchNoNames",\r
+ message);\r
+ if (NS_SUCCEEDED(rv)) {\r
+ returnedMessage.Append(message);\r
+ returnedMessage.Append(NS_LITERAL_STRING("\n"));\r
+ }\r
+ }\r
+}\r
+\r
+static void\r
+GetDateBoundary(nsIX509Cert* ix509,\r
+ nsString &formattedDate,\r
+ PRBool &trueExpired_falseNotYetValid)\r
+{\r
+ trueExpired_falseNotYetValid = PR_TRUE;\r
+ formattedDate.Truncate();\r
+\r
+ PRTime notAfter, notBefore, timeToUse;\r
+ nsCOMPtr<nsIX509CertValidity> validity;\r
+ nsresult rv;\r
+\r
+ rv = ix509->GetValidity(getter_AddRefs(validity));\r
+ if (NS_FAILED(rv))\r
+ return;\r
+\r
+ rv = validity->GetNotAfter(¬After);\r
+ if (NS_FAILED(rv))\r
+ return;\r
+\r
+ rv = validity->GetNotBefore(¬Before);\r
+ if (NS_FAILED(rv))\r
+ return;\r
+\r
+ if (LL_CMP(PR_Now(), >, notAfter)) {\r
+ timeToUse = notAfter;\r
+ } else {\r
+ timeToUse = notBefore;\r
+ trueExpired_falseNotYetValid = PR_FALSE;\r
+ }\r
+\r
+ nsIDateTimeFormat* aDateTimeFormat;\r
+ rv = CallCreateInstance(NS_DATETIMEFORMAT_CONTRACTID, &aDateTimeFormat);\r
+ if (NS_FAILED(rv))\r
+ return;\r
+\r
+ aDateTimeFormat->FormatPRTime(nsnull, kDateFormatShort, \r
+ kTimeFormatNoSeconds, timeToUse, \r
+ formattedDate);\r
+ NS_IF_RELEASE(aDateTimeFormat);\r
+}\r
+\r
+static void\r
+AppendErrorTextTime(nsIX509Cert* ix509,\r
+ nsINSSComponent *component,\r
+ nsString &returnedMessage)\r
+{\r
+ nsAutoString formattedDate;\r
+ PRBool trueExpired_falseNotYetValid;\r
+ GetDateBoundary(ix509, formattedDate, trueExpired_falseNotYetValid);\r
+\r
+ const PRUnichar *params[1];\r
+ params[0] = formattedDate.get(); // might be empty, if helper function had a problem \r
+\r
+ const char *key = trueExpired_falseNotYetValid ? \r
+ "certErrorExpired" : "certErrorNotYetValid";\r
+ nsresult rv;\r
+ nsString formattedString;\r
+ rv = component->PIPBundleFormatStringFromName(key, params, \r
+ 1, formattedString);\r
+ if (NS_SUCCEEDED(rv))\r
+ {\r
+ returnedMessage.Append(formattedString);\r
+ returnedMessage.Append(NS_LITERAL_STRING("\n"));\r
+ }\r
+}\r
+\r
+static void\r
+AppendErrorTextCode(PRErrorCode errorCodeToReport,\r
+ nsINSSComponent *component,\r
+ nsString &returnedMessage)\r
+{\r
+ const char *codeName = nsNSSErrors::getDefaultErrorStringName(errorCodeToReport);\r
+ if (codeName)\r
+ {\r
+ nsCString error_id(codeName);\r
+ ToLowerCase(error_id);\r
+ NS_ConvertASCIItoUTF16 idU(error_id);\r
+\r
+ const PRUnichar *params[1];\r
+ params[0] = idU.get();\r
+\r
+ nsString formattedString;\r
+ nsresult rv;\r
+ rv = component->PIPBundleFormatStringFromName("certErrorCodePrefix", \r
+ params, 1, \r
+ formattedString);\r
+ if (NS_SUCCEEDED(rv)) {\r
+ returnedMessage.Append(NS_LITERAL_STRING("\n"));\r
+ returnedMessage.Append(formattedString);\r
+ returnedMessage.Append(NS_LITERAL_STRING("\n"));\r
+ }\r
+ else {\r
+ returnedMessage.Append(NS_LITERAL_STRING(" ("));\r
+ returnedMessage.Append(idU);\r
+ returnedMessage.Append(NS_LITERAL_STRING(")"));\r
+ }\r
+ }\r
+}\r
+\r
+static nsresult\r
+getInvalidCertErrorMessage(PRUint32 multipleCollectedErrors, \r
+ PRErrorCode errorCodeToReport, \r
+ PRErrorCode errTrust, \r
+ PRErrorCode errMismatch, \r
+ PRErrorCode errExpired,\r
+ const nsString &host,\r
+ const nsString &hostWithPort,\r
+ PRInt32 port,\r
+ nsIX509Cert* ix509,\r
+ PRBool externalErrorReporting,\r
+ PRBool wantsHtml,\r
+ nsINSSComponent *component,\r
+ nsString &returnedMessage)\r
+{\r
+ NS_ENSURE_ARG_POINTER(component);\r
+\r
+ const PRUnichar *params[1];\r
+ nsresult rv;\r
+\r
+ // For now, hide port when it's 443 and we're reporting the error using\r
+ // external reporting. In the future a better mechanism should be used\r
+ // to make a decision about showing the port number, possibly by requiring\r
+ // the context object to implement a specific interface.\r
+ // The motivation is that Mozilla browser would like to hide the port number\r
+ // in error pages in the common case.\r
+ \r
+ if (externalErrorReporting && port == 443)\r
+ params[0] = host.get();\r
+ else\r
+ params[0] = hostWithPort.get();\r
+\r
+ nsString formattedString;\r
+ rv = component->PIPBundleFormatStringFromName("certErrorIntro", \r
+ params, 1, \r
+ formattedString);\r
+ if (NS_SUCCEEDED(rv))\r
+ {\r
+ returnedMessage.Append(formattedString);\r
+ returnedMessage.Append(NS_LITERAL_STRING("\n\n"));\r
+ }\r
+\r
+ if (multipleCollectedErrors & nsICertOverrideService::ERROR_UNTRUSTED)\r
+ {\r
+ AppendErrorTextUntrusted(errTrust, host, ix509, \r
+ component, returnedMessage);\r
+ }\r
+\r
+ if (multipleCollectedErrors & nsICertOverrideService::ERROR_MISMATCH)\r
+ {\r
+ AppendErrorTextMismatch(host, ix509, component, wantsHtml, returnedMessage);\r
+ }\r
+\r
+ if (multipleCollectedErrors & nsICertOverrideService::ERROR_TIME)\r
+ {\r
+ AppendErrorTextTime(ix509, component, returnedMessage);\r
+ }\r
+\r
+ AppendErrorTextCode(errorCodeToReport, component, returnedMessage);\r
+\r
+ return NS_OK;\r
+}\r
+\r
+static nsresult\r
+displayAlert(nsAFlatString &formattedString, nsNSSSocketInfo *infoObject)\r
+{\r
+ // The interface requestor object may not be safe, so proxy the call to get\r
+ // the nsIPrompt.\r
+\r
+ if (nsSSLThread::exitRequested())\r
+ return NS_ERROR_FAILURE;\r
+\r
+ nsCOMPtr<nsIInterfaceRequestor> proxiedCallbacks;\r
+ NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,\r
+ NS_GET_IID(nsIInterfaceRequestor),\r
+ static_cast<nsIInterfaceRequestor*>(infoObject),\r
+ NS_PROXY_SYNC,\r
+ getter_AddRefs(proxiedCallbacks));\r
+\r
+ nsCOMPtr<nsIPrompt> prompt (do_GetInterface(proxiedCallbacks));\r
+ if (!prompt)\r
+ return NS_ERROR_NO_INTERFACE;\r
+\r
+ // Finally, get a proxy for the nsIPrompt\r
+\r
+ nsCOMPtr<nsIPrompt> proxyPrompt;\r
+ NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,\r
+ NS_GET_IID(nsIPrompt),\r
+ prompt,\r
+ NS_PROXY_SYNC,\r
+ getter_AddRefs(proxyPrompt));\r
+\r
+ proxyPrompt->Alert(nsnull, formattedString.get());\r
+ return NS_OK;\r
+}\r
+\r
+static nsresult\r
+nsHandleSSLError(nsNSSSocketInfo *socketInfo, PRInt32 err)\r
+{\r
+ if (socketInfo->GetCanceled()) {\r
+ // If the socket has been flagged as canceled,\r
+ // the code who did was responsible for showing\r
+ // an error message (if desired).\r
+ return NS_OK;\r
+ }\r
+\r
+ if (nsSSLThread::exitRequested()) {\r
+ return NS_ERROR_FAILURE;\r
+ }\r
+\r
+ nsresult rv;\r
+ NS_DEFINE_CID(nssComponentCID, NS_NSSCOMPONENT_CID);\r
+ nsCOMPtr<nsINSSComponent> nssComponent(do_GetService(nssComponentCID, &rv));\r
+ if (NS_FAILED(rv))\r
+ return rv;\r
+\r
+ nsXPIDLCString hostName;\r
+ socketInfo->GetHostName(getter_Copies(hostName));\r
+ NS_ConvertASCIItoUTF16 hostNameU(hostName);\r
+\r
+ PRInt32 port;\r
+ socketInfo->GetPort(&port);\r
+\r
+ // Try to get a nsISSLErrorListener implementation from the socket consumer.\r
+ nsCOMPtr<nsIInterfaceRequestor> cb;\r
+ socketInfo->GetNotificationCallbacks(getter_AddRefs(cb));\r
+ if (cb) {\r
+ nsCOMPtr<nsIInterfaceRequestor> callbacks;\r
+ NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,\r
+ NS_GET_IID(nsIInterfaceRequestor),\r
+ cb,\r
+ NS_PROXY_SYNC,\r
+ getter_AddRefs(callbacks));\r
+\r
+ nsCOMPtr<nsISSLErrorListener> sel = do_GetInterface(callbacks);\r
+ if (sel) {\r
+ nsISSLErrorListener *proxy_sel = nsnull;\r
+ NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,\r
+ NS_GET_IID(nsISSLErrorListener),\r
+ sel,\r
+ NS_PROXY_SYNC,\r
+ (void**)&proxy_sel);\r
+ if (proxy_sel) {\r
+ nsIInterfaceRequestor *csi = static_cast<nsIInterfaceRequestor*>(socketInfo);\r
+ PRBool suppressMessage = PR_FALSE;\r
+ nsCString hostWithPortString = hostName;\r
+ hostWithPortString.AppendLiteral(":");\r
+ hostWithPortString.AppendInt(port);\r
+ rv = proxy_sel->NotifySSLError(csi, err, hostWithPortString, \r
+ &suppressMessage);\r
+ if (NS_SUCCEEDED(rv) && suppressMessage)\r
+ return NS_OK;\r
+ }\r
+ }\r
+ }\r
+\r
+ PRBool external = PR_FALSE;\r
+ socketInfo->GetExternalErrorReporting(&external);\r
+ \r
+ nsString formattedString;\r
+ rv = getErrorMessage(err, hostNameU, port, external, nssComponent, formattedString);\r
+\r
+ if (external)\r
+ {\r
+ socketInfo->SetErrorMessage(formattedString.get());\r
+ }\r
+ else\r
+ {\r
+ nsPSMUITracker tracker;\r
+ if (tracker.isUIForbidden()) {\r
+ rv = NS_ERROR_NOT_AVAILABLE;\r
+ }\r
+ else {\r
+ rv = displayAlert(formattedString, socketInfo);\r
+ }\r
+ }\r
+ return rv;\r
+}\r
+\r
+static nsresult\r
+nsHandleInvalidCertError(nsNSSSocketInfo *socketInfo, \r
+ PRUint32 multipleCollectedErrors, \r
+ const nsACString &host, \r
+ const nsACString &hostWithPort,\r
+ PRInt32 port,\r
+ PRErrorCode errorCodeToReport,\r
+ PRErrorCode errTrust, \r
+ PRErrorCode errMismatch, \r
+ PRErrorCode errExpired,\r
+ PRBool wantsHtml,\r
+ nsIX509Cert* ix509)\r
+{\r
+ nsresult rv;\r
+ NS_DEFINE_CID(nssComponentCID, NS_NSSCOMPONENT_CID);\r
+ nsCOMPtr<nsINSSComponent> nssComponent(do_GetService(nssComponentCID, &rv));\r
+ if (NS_FAILED(rv))\r
+ return rv;\r
+\r
+ NS_ConvertASCIItoUTF16 hostU(host);\r
+ NS_ConvertASCIItoUTF16 hostWithPortU(hostWithPort);\r
+\r
+ // What mechanism is used to inform the user?\r
+ // The highest priority has the "external error reporting" feature,\r
+ // if set, we'll provide the strings to be used by the nsINSSErrorsService\r
+\r
+ PRBool external = PR_FALSE;\r
+ socketInfo->GetExternalErrorReporting(&external);\r
+ \r
+ nsString formattedString;\r
+ rv = getInvalidCertErrorMessage(multipleCollectedErrors, errorCodeToReport,\r
+ errTrust, errMismatch, errExpired,\r
+ hostU, hostWithPortU, port, \r
+ ix509, external, wantsHtml,\r
+ nssComponent, formattedString);\r
+\r
+ if (external)\r
+ {\r
+ socketInfo->SetErrorMessage(formattedString.get());\r
+ }\r
+ else\r
+ {\r
+ nsPSMUITracker tracker;\r
+ if (tracker.isUIForbidden()) {\r
+ rv = NS_ERROR_NOT_AVAILABLE;\r
+ }\r
+ else {\r
+ nsISSLCertErrorDialog *dialogs = nsnull;\r
+ rv = getNSSDialogs((void**)&dialogs, \r
+ NS_GET_IID(nsISSLCertErrorDialog), \r
+ NS_SSLCERTERRORDIALOG_CONTRACTID);\r
+ \r
+ if (NS_SUCCEEDED(rv)) {\r
+ nsPSMUITracker tracker;\r
+ if (tracker.isUIForbidden()) {\r
+ rv = NS_ERROR_NOT_AVAILABLE;\r
+ }\r
+ else {\r
+ nsCOMPtr<nsISSLStatus> status;\r
+ socketInfo->GetSSLStatus(getter_AddRefs(status));\r
+\r
+ nsString empty;\r
+\r
+ rv = dialogs->ShowCertError(nsnull, status, ix509, \r
+ formattedString, \r
+ empty, host, port);\r
+ }\r
+ \r
+ NS_RELEASE(dialogs);\r
+ }\r
+ }\r
+ }\r
+ return rv;\r
+}\r
+\r
+static PRStatus PR_CALLBACK\r
+nsSSLIOLayerConnect(PRFileDesc* fd, const PRNetAddr* addr,\r
+ PRIntervalTime timeout)\r
+{\r
+ PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("[%p] connecting SSL socket\n", (void*)fd));\r
+ nsNSSShutDownPreventionLock locker;\r
+ if (!fd || !fd->lower)\r
+ return PR_FAILURE;\r
+ \r
+ PRStatus status = PR_SUCCESS;\r
+\r
+#if defined(XP_BEOS)\r
+ // Due to BeOS net_server's lack of support for nonblocking sockets,\r
+ // we must execute this entire connect as a blocking operation - bug 70217\r
+ \r
+ PRSocketOptionData sockopt;\r
+ sockopt.option = PR_SockOpt_Nonblocking;\r
+ PR_GetSocketOption(fd, &sockopt);\r
+ PRBool oldBlockVal = sockopt.value.non_blocking;\r
+ sockopt.option = PR_SockOpt_Nonblocking;\r
+ sockopt.value.non_blocking = PR_FALSE;\r
+ PR_SetSocketOption(fd, &sockopt);\r
+#endif\r
+ \r
+ status = fd->lower->methods->connect(fd->lower, addr, \r
+#if defined(XP_BEOS) // bug 70217\r
+ PR_INTERVAL_NO_TIMEOUT);\r
+#else\r
+ timeout);\r
+#endif\r
+ if (status != PR_SUCCESS) {\r
+ PR_LOG(gPIPNSSLog, PR_LOG_ERROR, ("[%p] Lower layer connect error: %d\n",\r
+ (void*)fd, PR_GetError()));\r
+#if defined(XP_BEOS) // bug 70217\r
+ goto loser;\r
+#else\r
+ return status;\r
+#endif\r
+ }\r
+ \r
+ PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("[%p] Connect\n", (void*)fd));\r
+\r
+#if defined(XP_BEOS) // bug 70217\r
+ loser:\r
+ // We put the Nonblocking bit back to the value it was when \r
+ // we entered this function.\r
+ NS_ASSERTION(sockopt.option == PR_SockOpt_Nonblocking,\r
+ "sockopt.option was re-set to an unexpected value");\r
+ sockopt.value.non_blocking = oldBlockVal;\r
+ PR_SetSocketOption(fd, &sockopt);\r
+#endif\r
+\r
+ return status;\r
+}\r
+\r
+// nsPSMRememberCertErrorsTable\r
+\r
+nsPSMRememberCertErrorsTable::nsPSMRememberCertErrorsTable()\r
+{\r
+ mErrorHosts.Init(16);\r
+}\r
+\r
+nsresult\r
+nsPSMRememberCertErrorsTable::GetHostPortKey(nsNSSSocketInfo* infoObject,\r
+ nsCAutoString &result)\r
+{\r
+ nsresult rv;\r
+\r
+ result.Truncate();\r
+\r
+ nsXPIDLCString hostName;\r
+ rv = infoObject->GetHostName(getter_Copies(hostName));\r
+ NS_ENSURE_SUCCESS(rv, rv);\r
+\r
+ PRInt32 port;\r
+ rv = infoObject->GetPort(&port);\r
+ NS_ENSURE_SUCCESS(rv, rv);\r
+\r
+ result.Assign(hostName);\r
+ result.Append(':');\r
+ result.AppendInt(port);\r
+\r
+ return NS_OK;\r
+}\r
+\r
+void\r
+nsPSMRememberCertErrorsTable::RememberCertHasError(nsNSSSocketInfo* infoObject,\r
+ nsSSLStatus* status,\r
+ SECStatus certVerificationResult)\r
+{\r
+ nsresult rv;\r
+\r
+ nsCAutoString hostPortKey;\r
+ rv = GetHostPortKey(infoObject, hostPortKey);\r
+ if (NS_FAILED(rv))\r
+ return;\r
+\r
+ if (certVerificationResult != SECSuccess) {\r
+ NS_ASSERTION(status,\r
+ "Must have nsSSLStatus object when remembering flags");\r
+\r
+ if (!status)\r
+ return;\r
+\r
+ CertStateBits bits;\r
+ bits.mIsDomainMismatch = status->mIsDomainMismatch;\r
+ bits.mIsNotValidAtThisTime = status->mIsNotValidAtThisTime;\r
+ bits.mIsUntrusted = status->mIsUntrusted;\r
+ mErrorHosts.Put(hostPortKey, bits);\r
+ }\r
+ else {\r
+ mErrorHosts.Remove(hostPortKey);\r
+ }\r
+}\r
+\r
+void\r
+nsPSMRememberCertErrorsTable::LookupCertErrorBits(nsNSSSocketInfo* infoObject,\r
+ nsSSLStatus* status)\r
+{\r
+ // Get remembered error bits from our cache, because of SSL session caching\r
+ // the NSS library potentially hasn't notified us for this socket.\r
+ if (status->mHaveCertErrorBits)\r
+ // Rather do not modify bits if already set earlier\r
+ return;\r
+\r
+ nsresult rv;\r
+\r
+ nsCAutoString hostPortKey;\r
+ rv = GetHostPortKey(infoObject, hostPortKey);\r
+ if (NS_FAILED(rv))\r
+ return;\r
+\r
+ CertStateBits bits;\r
+ if (!mErrorHosts.Get(hostPortKey, &bits))\r
+ // No record was found, this host had no cert errors\r
+ return;\r
+\r
+ // This host had cert errors, update the bits correctly\r
+ status->mHaveCertErrorBits = PR_TRUE;\r
+ status->mIsDomainMismatch = bits.mIsDomainMismatch;\r
+ status->mIsNotValidAtThisTime = bits.mIsNotValidAtThisTime;\r
+ status->mIsUntrusted = bits.mIsUntrusted;\r
+}\r
+\r
+void\r
+nsSSLIOLayerHelpers::getSiteKey(nsNSSSocketInfo *socketInfo, nsCSubstring &key)\r
+{\r
+ PRInt32 port;\r
+ socketInfo->GetPort(&port);\r
+\r
+ nsXPIDLCString host;\r
+ socketInfo->GetHostName(getter_Copies(host));\r
+\r
+ key = host + NS_LITERAL_CSTRING(":") + nsPrintfCString("%d", port);\r
+}\r
+\r
+// Call this function to report a site that is possibly TLS intolerant.\r
+// This function will return true, if the given socket is currently using TLS.\r
+PRBool\r
+nsSSLIOLayerHelpers::rememberPossibleTLSProblemSite(PRFileDesc* ssl_layer_fd, nsNSSSocketInfo *socketInfo)\r
+{\r
+ PRBool currentlyUsesTLS = PR_FALSE;\r
+\r
+ nsCAutoString key;\r
+ getSiteKey(socketInfo, key);\r
+\r
+ SSL_OptionGet(ssl_layer_fd, SSL_ENABLE_TLS, ¤tlyUsesTLS);\r
+ if (!currentlyUsesTLS) {\r
+ // We were not using TLS but failed with an intolerant error using\r
+ // a different protocol. To give TLS a try on next connection attempt again\r
+ // drop this site from the list of intolerant sites. TLS failure might be \r
+ // caused only by a traffic congestion while the server is TLS tolerant.\r
+ removeIntolerantSite(key);\r
+ return PR_FALSE;\r
+ }\r
+\r
+ PRBool enableSSL3 = PR_FALSE;\r
+ SSL_OptionGet(ssl_layer_fd, SSL_ENABLE_SSL3, &enableSSL3);\r
+ PRBool enableSSL2 = PR_FALSE;\r
+ SSL_OptionGet(ssl_layer_fd, SSL_ENABLE_SSL2, &enableSSL2);\r
+ if (enableSSL3 || enableSSL2) {\r
+ // Add this site to the list of TLS intolerant sites.\r
+ addIntolerantSite(key);\r
+ }\r
+ \r
+ return currentlyUsesTLS;\r
+}\r
+\r
+void\r
+nsSSLIOLayerHelpers::rememberTolerantSite(PRFileDesc* ssl_layer_fd, \r
+ nsNSSSocketInfo *socketInfo)\r
+{\r
+ PRBool usingSecurity = PR_FALSE;\r
+ PRBool currentlyUsesTLS = PR_FALSE;\r
+ SSL_OptionGet(ssl_layer_fd, SSL_SECURITY, &usingSecurity);\r
+ SSL_OptionGet(ssl_layer_fd, SSL_ENABLE_TLS, ¤tlyUsesTLS);\r
+ if (!usingSecurity || !currentlyUsesTLS) {\r
+ return;\r
+ }\r
+\r
+ nsCAutoString key;\r
+ getSiteKey(socketInfo, key);\r
+\r
+ nsAutoLock lock(mutex);\r
+ nsSSLIOLayerHelpers::mTLSTolerantSites->Put(key);\r
+}\r
+\r
+static PRStatus PR_CALLBACK\r
+nsSSLIOLayerClose(PRFileDesc *fd)\r
+{\r
+ nsNSSShutDownPreventionLock locker;\r
+ if (!fd)\r
+ return PR_FAILURE;\r
+\r
+ PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("[%p] Shutting down socket\n", (void*)fd));\r
+ \r
+ nsNSSSocketInfo *socketInfo = (nsNSSSocketInfo*)fd->secret;\r
+ NS_ASSERTION(socketInfo,"nsNSSSocketInfo was null for an fd");\r
+\r
+ return nsSSLThread::requestClose(socketInfo);\r
+}\r
+\r
+PRStatus nsNSSSocketInfo::CloseSocketAndDestroy()\r
+{\r
+ nsNSSShutDownPreventionLock locker;\r
+\r
+ nsNSSShutDownList::trackSSLSocketClose();\r
+\r
+ PRFileDesc* popped = PR_PopIOLayer(mFd, PR_TOP_IO_LAYER);\r
+\r
+ if (GetHandshakeInProgress()) {\r
+ nsSSLIOLayerHelpers::rememberPossibleTLSProblemSite(mFd->lower, this);\r
+ }\r
+\r
+ PRStatus status = mFd->methods->close(mFd);\r
+ if (status != PR_SUCCESS) return status;\r
+\r
+ popped->identity = PR_INVALID_IO_LAYER;\r
+ NS_RELEASE_THIS();\r
+ popped->dtor(popped);\r
+\r
+ return PR_SUCCESS;\r
+}\r
+\r
+#if defined(DEBUG_SSL_VERBOSE) && defined(DUMP_BUFFER)\r
+/* Dumps a (potentially binary) buffer using SSM_DEBUG. \r
+ (We could have used the version in ssltrace.c, but that's\r
+ specifically tailored to SSLTRACE. Sigh. */\r
+#define DUMPBUF_LINESIZE 24\r
+static void\r
+nsDumpBuffer(unsigned char *buf, PRIntn len)\r
+{\r
+ char hexbuf[DUMPBUF_LINESIZE*3+1];\r
+ char chrbuf[DUMPBUF_LINESIZE+1];\r
+ static const char *hex = "0123456789abcdef";\r
+ PRIntn i = 0, l = 0;\r
+ char ch, *c, *h;\r
+ if (len == 0)\r
+ return;\r
+ hexbuf[DUMPBUF_LINESIZE*3] = '\0';\r
+ chrbuf[DUMPBUF_LINESIZE] = '\0';\r
+ (void) memset(hexbuf, 0x20, DUMPBUF_LINESIZE*3);\r
+ (void) memset(chrbuf, 0x20, DUMPBUF_LINESIZE);\r
+ h = hexbuf;\r
+ c = chrbuf;\r
+\r
+ while (i < len)\r
+ {\r
+ ch = buf[i];\r
+\r
+ if (l == DUMPBUF_LINESIZE)\r
+ {\r
+ PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("%s%s\n", hexbuf, chrbuf));\r
+ (void) memset(hexbuf, 0x20, DUMPBUF_LINESIZE*3);\r
+ (void) memset(chrbuf, 0x20, DUMPBUF_LINESIZE);\r
+ h = hexbuf;\r
+ c = chrbuf;\r
+ l = 0;\r
+ }\r
+\r
+ /* Convert a character to hex. */\r
+ *h++ = hex[(ch >> 4) & 0xf];\r
+ *h++ = hex[ch & 0xf];\r
+ h++;\r
+ \r
+ /* Put the character (if it's printable) into the character buffer. */\r
+ if ((ch >= 0x20) && (ch <= 0x7e))\r
+ *c++ = ch;\r
+ else\r
+ *c++ = '.';\r
+ i++; l++;\r
+ }\r
+ PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("%s%s\n", hexbuf, chrbuf));\r
+}\r
+\r
+#define DEBUG_DUMP_BUFFER(buf,len) nsDumpBuffer(buf,len)\r
+#else\r
+#define DEBUG_DUMP_BUFFER(buf,len)\r
+#endif\r
+\r
+static PRBool\r
+isNonSSLErrorThatWeAllowToRetry(PRInt32 err, PRBool withInitialCleartext)\r
+{\r
+ switch (err)\r
+ {\r
+ case PR_CONNECT_RESET_ERROR:\r
+ if (!withInitialCleartext)\r
+ return PR_TRUE;\r
+ break;\r
+ \r
+ case PR_END_OF_FILE_ERROR:\r
+ return PR_TRUE;\r
+ }\r
+\r
+ return PR_FALSE;\r
+}\r
+\r
+static PRBool\r
+isTLSIntoleranceError(PRInt32 err, PRBool withInitialCleartext)\r
+{\r
+ // This function is supposed to decide, which error codes should\r
+ // be used to conclude server is TLS intolerant.\r
+ // Note this only happens during the initial SSL handshake.\r
+ // \r
+ // When not using a proxy we'll see a connection reset error.\r
+ // When using a proxy, we'll see an end of file error.\r
+ // In addition check for some error codes where it is reasonable\r
+ // to retry without TLS.\r
+\r
+ if (isNonSSLErrorThatWeAllowToRetry(err, withInitialCleartext))\r
+ return PR_TRUE;\r
+\r
+ switch (err)\r
+ {\r
+ case SSL_ERROR_BAD_MAC_ALERT:\r
+ case SSL_ERROR_BAD_MAC_READ:\r
+ case SSL_ERROR_HANDSHAKE_FAILURE_ALERT:\r
+ case SSL_ERROR_HANDSHAKE_UNEXPECTED_ALERT:\r
+ case SSL_ERROR_CLIENT_KEY_EXCHANGE_FAILURE:\r
+ case SSL_ERROR_ILLEGAL_PARAMETER_ALERT:\r
+ case SSL_ERROR_NO_CYPHER_OVERLAP:\r
+ case SSL_ERROR_BAD_SERVER:\r
+ case SSL_ERROR_BAD_BLOCK_PADDING:\r
+ case SSL_ERROR_UNSUPPORTED_VERSION:\r
+ case SSL_ERROR_PROTOCOL_VERSION_ALERT:\r
+ case SSL_ERROR_RX_MALFORMED_FINISHED:\r
+ case SSL_ERROR_BAD_HANDSHAKE_HASH_VALUE:\r
+ case SSL_ERROR_DECODE_ERROR_ALERT:\r
+ case SSL_ERROR_RX_UNKNOWN_ALERT:\r
+ return PR_TRUE;\r
+ }\r
+ \r
+ return PR_FALSE;\r
+}\r
+\r
+PRInt32\r
+nsSSLThread::checkHandshake(PRInt32 bytesTransfered, \r
+ PRBool wasReading,\r
+ PRFileDesc* ssl_layer_fd, \r
+ nsNSSSocketInfo *socketInfo)\r
+{\r
+ // This is where we work around all of those SSL servers that don't \r
+ // conform to the SSL spec and shutdown a connection when we request\r
+ // SSL v3.1 (aka TLS). The spec says the client says what version\r
+ // of the protocol we're willing to perform, in our case SSL v3.1\r
+ // In its response, the server says which version it wants to perform.\r
+ // Many servers out there only know how to do v3.0. Next, we're supposed\r
+ // to send back the version of the protocol we requested (ie v3.1). At\r
+ // this point many servers's implementations are broken and they shut\r
+ // down the connection when they don't see the version they sent back.\r
+ // This is supposed to prevent a man in the middle from forcing one\r
+ // side to dumb down to a lower level of the protocol. Unfortunately,\r
+ // there are enough broken servers out there that such a gross work-around\r
+ // is necessary. :(\r
+\r
+ // Additional comment added in August 2006:\r
+ // When we begun to use TLS hello extensions, we encountered a new class of\r
+ // broken server, which simply stall for a very long time.\r
+ // We would like to shorten the timeout, but limit this shorter timeout \r
+ // to the handshake phase.\r
+ // When we arrive here for the first time (for a given socket),\r
+ // we know the connection is established, and the application code\r
+ // tried the first read or write. This triggers the beginning of the\r
+ // SSL handshake phase at the SSL FD level.\r
+ // We'll make a note of the current time,\r
+ // and use this to measure the elapsed time since handshake begin.\r
+\r
+ // Do NOT assume TLS intolerance on a closed connection after bad cert ui was shown.\r
+ // Simply retry.\r
+ // This depends on the fact that Cert UI will not be shown again,\r
+ // should the user override the bad cert.\r
+\r
+ PRBool handleHandshakeResultNow;\r
+ socketInfo->GetHandshakePending(&handleHandshakeResultNow);\r
+\r
+ PRBool wantRetry = PR_FALSE;\r
+\r
+ if (0 > bytesTransfered) {\r
+ PRInt32 err = PR_GetError();\r
+\r
+ if (handleHandshakeResultNow) {\r
+ if (PR_WOULD_BLOCK_ERROR == err) {\r
+ socketInfo->SetHandshakeInProgress(PR_TRUE);\r
+ return bytesTransfered;\r
+ }\r
+\r
+ if (!wantRetry // no decision yet\r
+ && isTLSIntoleranceError(err, socketInfo->GetHasCleartextPhase()))\r
+ {\r
+ wantRetry = nsSSLIOLayerHelpers::rememberPossibleTLSProblemSite(ssl_layer_fd, socketInfo);\r
+ }\r
+ }\r
+ \r
+ // This is the common place where we trigger an error message on a SSL socket.\r
+ // This might be reached at any time of the connection.\r
+ if (!wantRetry && (IS_SSL_ERROR(err) || IS_SEC_ERROR(err))) {\r
+ nsHandleSSLError(socketInfo, err);\r
+ }\r
+ }\r
+ else if (wasReading && 0 == bytesTransfered) // zero bytes on reading, socket closed\r
+ {\r
+ if (handleHandshakeResultNow)\r
+ {\r
+ if (!wantRetry // no decision yet\r
+ && !socketInfo->GetHasCleartextPhase()) // mirror PR_CONNECT_RESET_ERROR treament\r
+ {\r
+ wantRetry = \r
+ nsSSLIOLayerHelpers::rememberPossibleTLSProblemSite(ssl_layer_fd, socketInfo);\r
+ }\r
+ }\r
+ }\r
+\r
+ if (wantRetry) {\r
+ // We want to cause the network layer to retry the connection.\r
+ PR_SetError(PR_CONNECT_RESET_ERROR, 0);\r
+ if (wasReading)\r
+ bytesTransfered = -1;\r
+ }\r
+\r
+ // TLS intolerant servers only cause the first transfer to fail, so let's \r
+ // set the HandshakePending attribute to false so that we don't try the logic\r
+ // above again in a subsequent transfer.\r
+ if (handleHandshakeResultNow) {\r
+ socketInfo->SetHandshakePending(PR_FALSE);\r
+ socketInfo->SetHandshakeInProgress(PR_FALSE);\r
+ }\r
+ \r
+ return bytesTransfered;\r
+}\r
+\r
+static PRInt16 PR_CALLBACK\r
+nsSSLIOLayerPoll(PRFileDesc *fd, PRInt16 in_flags, PRInt16 *out_flags)\r
+{\r
+ PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("[%p] polling SSL socket\n", (void*)fd));\r
+ nsNSSShutDownPreventionLock locker;\r
+\r
+ if (!out_flags)\r
+ {\r
+ NS_WARNING("nsSSLIOLayerPoll called with null out_flags");\r
+ return 0;\r
+ }\r
+\r
+ *out_flags = 0;\r
+\r
+ if (!fd)\r
+ {\r
+ NS_WARNING("nsSSLIOLayerPoll called with null fd");\r
+ return 0;\r
+ }\r
+\r
+ nsNSSSocketInfo *socketInfo = (nsNSSSocketInfo*)fd->secret;\r
+ NS_ASSERTION(socketInfo,"nsNSSSocketInfo was null for an fd");\r
+\r
+ return nsSSLThread::requestPoll(socketInfo, in_flags, out_flags);\r
+}\r
+\r
+PRBool nsSSLIOLayerHelpers::nsSSLIOLayerInitialized = PR_FALSE;\r
+PRDescIdentity nsSSLIOLayerHelpers::nsSSLIOLayerIdentity;\r
+PRIOMethods nsSSLIOLayerHelpers::nsSSLIOLayerMethods;\r
+PRLock *nsSSLIOLayerHelpers::mutex = nsnull;\r
+nsCStringHashSet *nsSSLIOLayerHelpers::mTLSIntolerantSites = nsnull;\r
+nsCStringHashSet *nsSSLIOLayerHelpers::mTLSTolerantSites = nsnull;\r
+nsPSMRememberCertErrorsTable *nsSSLIOLayerHelpers::mHostsWithCertErrors = nsnull;\r
+nsCStringHashSet *nsSSLIOLayerHelpers::mRenegoUnrestrictedSites = nsnull;\r
+PRBool nsSSLIOLayerHelpers::mTreatUnsafeNegotiationAsBroken = PR_FALSE;\r
+PRFileDesc *nsSSLIOLayerHelpers::mSharedPollableEvent = nsnull;\r
+nsNSSSocketInfo *nsSSLIOLayerHelpers::mSocketOwningPollableEvent = nsnull;\r
+PRBool nsSSLIOLayerHelpers::mPollableEventCurrentlySet = PR_FALSE;\r
+\r
+static PRIntn _PSM_InvalidInt(void)\r
+{\r
+ PR_ASSERT(!"I/O method is invalid");\r
+ PR_SetError(PR_INVALID_METHOD_ERROR, 0);\r
+ return -1;\r
+}\r
+\r
+static PRInt64 _PSM_InvalidInt64(void)\r
+{\r
+ PR_ASSERT(!"I/O method is invalid");\r
+ PR_SetError(PR_INVALID_METHOD_ERROR, 0);\r
+ return -1;\r
+}\r
+\r
+static PRStatus _PSM_InvalidStatus(void)\r
+{\r
+ PR_ASSERT(!"I/O method is invalid");\r
+ PR_SetError(PR_INVALID_METHOD_ERROR, 0);\r
+ return PR_FAILURE;\r
+}\r
+\r
+static PRFileDesc *_PSM_InvalidDesc(void)\r
+{\r
+ PR_ASSERT(!"I/O method is invalid");\r
+ PR_SetError(PR_INVALID_METHOD_ERROR, 0);\r
+ return NULL;\r
+}\r
+\r
+static PRStatus PR_CALLBACK PSMGetsockname(PRFileDesc *fd, PRNetAddr *addr)\r
+{\r
+ nsNSSShutDownPreventionLock locker;\r
+ if (!fd || !fd->lower) {\r
+ return PR_FAILURE;\r
+ }\r
+\r
+ nsNSSSocketInfo *socketInfo = (nsNSSSocketInfo*)fd->secret;\r
+ NS_ASSERTION(socketInfo,"nsNSSSocketInfo was null for an fd");\r
+\r
+ return nsSSLThread::requestGetsockname(socketInfo, addr);\r
+}\r
+\r
+static PRStatus PR_CALLBACK PSMGetpeername(PRFileDesc *fd, PRNetAddr *addr)\r
+{\r
+ nsNSSShutDownPreventionLock locker;\r
+ if (!fd || !fd->lower) {\r
+ return PR_FAILURE;\r
+ }\r
+\r
+ nsNSSSocketInfo *socketInfo = (nsNSSSocketInfo*)fd->secret;\r
+ NS_ASSERTION(socketInfo,"nsNSSSocketInfo was null for an fd");\r
+\r
+ return nsSSLThread::requestGetpeername(socketInfo, addr);\r
+}\r
+\r
+static PRStatus PR_CALLBACK PSMGetsocketoption(PRFileDesc *fd, \r
+ PRSocketOptionData *data)\r
+{\r
+ nsNSSShutDownPreventionLock locker;\r
+ if (!fd || !fd->lower) {\r
+ return PR_FAILURE;\r
+ }\r
+\r
+ nsNSSSocketInfo *socketInfo = (nsNSSSocketInfo*)fd->secret;\r
+ NS_ASSERTION(socketInfo,"nsNSSSocketInfo was null for an fd");\r
+\r
+ return nsSSLThread::requestGetsocketoption(socketInfo, data);\r
+}\r
+\r
+static PRStatus PR_CALLBACK PSMSetsocketoption(PRFileDesc *fd, \r
+ const PRSocketOptionData *data)\r
+{\r
+ nsNSSShutDownPreventionLock locker;\r
+ if (!fd || !fd->lower) {\r
+ return PR_FAILURE;\r
+ }\r
+\r
+ nsNSSSocketInfo *socketInfo = (nsNSSSocketInfo*)fd->secret;\r
+ NS_ASSERTION(socketInfo,"nsNSSSocketInfo was null for an fd");\r
+\r
+ return nsSSLThread::requestSetsocketoption(socketInfo, data);\r
+}\r
+\r
+static PRInt32 PR_CALLBACK PSMRecv(PRFileDesc *fd, void *buf, PRInt32 amount,\r
+ PRIntn flags, PRIntervalTime timeout)\r
+{\r
+ nsNSSShutDownPreventionLock locker;\r
+ if (!fd || !fd->lower) {\r
+ PR_SetError(PR_BAD_DESCRIPTOR_ERROR, 0);\r
+ return -1;\r
+ }\r
+\r
+ nsNSSSocketInfo *socketInfo = (nsNSSSocketInfo*)fd->secret;\r
+ NS_ASSERTION(socketInfo,"nsNSSSocketInfo was null for an fd");\r
+\r
+ if (flags == PR_MSG_PEEK) {\r
+ return nsSSLThread::requestRecvMsgPeek(socketInfo, buf, amount, flags, timeout);\r
+ }\r
+\r
+ if (flags != 0) {\r
+ PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);\r
+ return -1;\r
+ }\r
+\r
+ return nsSSLThread::requestRead(socketInfo, buf, amount, timeout);\r
+}\r
+\r
+static PRInt32 PR_CALLBACK PSMSend(PRFileDesc *fd, const void *buf, PRInt32 amount,\r
+ PRIntn flags, PRIntervalTime timeout)\r
+{\r
+ nsNSSShutDownPreventionLock locker;\r
+ if (!fd || !fd->lower) {\r
+ PR_SetError(PR_BAD_DESCRIPTOR_ERROR, 0);\r
+ return -1;\r
+ }\r
+\r
+ if (flags != 0) {\r
+ PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);\r
+ return -1;\r
+ }\r
+\r
+ nsNSSSocketInfo *socketInfo = (nsNSSSocketInfo*)fd->secret;\r
+ NS_ASSERTION(socketInfo,"nsNSSSocketInfo was null for an fd");\r
+\r
+ return nsSSLThread::requestWrite(socketInfo, buf, amount, timeout);\r
+}\r
+\r
+static PRInt32 PR_CALLBACK\r
+nsSSLIOLayerRead(PRFileDesc* fd, void* buf, PRInt32 amount)\r
+{\r
+ return PSMRecv(fd, buf, amount, 0, PR_INTERVAL_NO_TIMEOUT);\r
+}\r
+\r
+static PRInt32 PR_CALLBACK\r
+nsSSLIOLayerWrite(PRFileDesc* fd, const void* buf, PRInt32 amount)\r
+{\r
+ return PSMSend(fd, buf, amount, 0, PR_INTERVAL_NO_TIMEOUT);\r
+}\r
+\r
+static PRStatus PR_CALLBACK PSMConnectcontinue(PRFileDesc *fd, PRInt16 out_flags)\r
+{\r
+ nsNSSShutDownPreventionLock locker;\r
+ if (!fd || !fd->lower) {\r
+ return PR_FAILURE;\r
+ }\r
+\r
+ nsNSSSocketInfo *socketInfo = (nsNSSSocketInfo*)fd->secret;\r
+ NS_ASSERTION(socketInfo,"nsNSSSocketInfo was null for an fd");\r
+\r
+ return nsSSLThread::requestConnectcontinue(socketInfo, out_flags);\r
+}\r
+\r
+nsresult nsSSLIOLayerHelpers::Init()\r
+{\r
+ if (!nsSSLIOLayerInitialized) {\r
+ nsSSLIOLayerInitialized = PR_TRUE;\r
+ nsSSLIOLayerIdentity = PR_GetUniqueIdentity("NSS layer");\r
+ nsSSLIOLayerMethods = *PR_GetDefaultIOMethods();\r
+\r
+ nsSSLIOLayerMethods.available = (PRAvailableFN)_PSM_InvalidInt;\r
+ nsSSLIOLayerMethods.available64 = (PRAvailable64FN)_PSM_InvalidInt64;\r
+ nsSSLIOLayerMethods.fsync = (PRFsyncFN)_PSM_InvalidStatus;\r
+ nsSSLIOLayerMethods.seek = (PRSeekFN)_PSM_InvalidInt;\r
+ nsSSLIOLayerMethods.seek64 = (PRSeek64FN)_PSM_InvalidInt64;\r
+ nsSSLIOLayerMethods.fileInfo = (PRFileInfoFN)_PSM_InvalidStatus;\r
+ nsSSLIOLayerMethods.fileInfo64 = (PRFileInfo64FN)_PSM_InvalidStatus;\r
+ nsSSLIOLayerMethods.writev = (PRWritevFN)_PSM_InvalidInt;\r
+ nsSSLIOLayerMethods.accept = (PRAcceptFN)_PSM_InvalidDesc;\r
+ nsSSLIOLayerMethods.bind = (PRBindFN)_PSM_InvalidStatus;\r
+ nsSSLIOLayerMethods.listen = (PRListenFN)_PSM_InvalidStatus;\r
+ nsSSLIOLayerMethods.shutdown = (PRShutdownFN)_PSM_InvalidStatus;\r
+ nsSSLIOLayerMethods.recvfrom = (PRRecvfromFN)_PSM_InvalidInt;\r
+ nsSSLIOLayerMethods.sendto = (PRSendtoFN)_PSM_InvalidInt;\r
+ nsSSLIOLayerMethods.acceptread = (PRAcceptreadFN)_PSM_InvalidInt;\r
+ nsSSLIOLayerMethods.transmitfile = (PRTransmitfileFN)_PSM_InvalidInt;\r
+ nsSSLIOLayerMethods.sendfile = (PRSendfileFN)_PSM_InvalidInt;\r
+\r
+ nsSSLIOLayerMethods.getsockname = PSMGetsockname;\r
+ nsSSLIOLayerMethods.getpeername = PSMGetpeername;\r
+ nsSSLIOLayerMethods.getsocketoption = PSMGetsocketoption;\r
+ nsSSLIOLayerMethods.setsocketoption = PSMSetsocketoption;\r
+ nsSSLIOLayerMethods.recv = PSMRecv;\r
+ nsSSLIOLayerMethods.send = PSMSend;\r
+ nsSSLIOLayerMethods.connectcontinue = PSMConnectcontinue;\r
+\r
+ nsSSLIOLayerMethods.connect = nsSSLIOLayerConnect;\r
+ nsSSLIOLayerMethods.close = nsSSLIOLayerClose;\r
+ nsSSLIOLayerMethods.write = nsSSLIOLayerWrite;\r
+ nsSSLIOLayerMethods.read = nsSSLIOLayerRead;\r
+ nsSSLIOLayerMethods.poll = nsSSLIOLayerPoll;\r
+ }\r
+\r
+ mutex = PR_NewLock();\r
+ if (!mutex)\r
+ return NS_ERROR_OUT_OF_MEMORY;\r
+\r
+ mSharedPollableEvent = PR_NewPollableEvent();\r
+\r
+ // if we can not get a pollable event, we'll have to do busy waiting\r
+\r
+ mTLSIntolerantSites = new nsCStringHashSet();\r
+ if (!mTLSIntolerantSites)\r
+ return NS_ERROR_OUT_OF_MEMORY;\r
+\r
+ mTLSIntolerantSites->Init(1);\r
+\r
+ mTLSTolerantSites = new nsCStringHashSet();\r
+ if (!mTLSTolerantSites)\r
+ return NS_ERROR_OUT_OF_MEMORY;\r
+\r
+ // Initialize the tolerant site hashtable to 16 items at the start seems\r
+ // reasonable as most servers are TLS tolerant. We just want to lower \r
+ // the rate of hashtable array reallocation.\r
+ mTLSTolerantSites->Init(16);\r
+\r
+ mRenegoUnrestrictedSites = new nsCStringHashSet();\r
+ if (!mRenegoUnrestrictedSites)\r
+ return NS_ERROR_OUT_OF_MEMORY;\r
+\r
+ mRenegoUnrestrictedSites->Init(1);\r
+\r
+ mTreatUnsafeNegotiationAsBroken = PR_FALSE;\r
+ \r
+ mHostsWithCertErrors = new nsPSMRememberCertErrorsTable();\r
+ if (!mHostsWithCertErrors || !mHostsWithCertErrors->mErrorHosts.IsInitialized())\r
+ return NS_ERROR_OUT_OF_MEMORY;\r
+\r
+ return NS_OK;\r
+}\r
+\r
+void nsSSLIOLayerHelpers::addIntolerantSite(const nsCString &str)\r
+{\r
+ nsAutoLock lock(mutex);\r
+ // Remember intolerant site only if it is not known as tolerant\r
+ if (!mTLSTolerantSites->Contains(str))\r
+ nsSSLIOLayerHelpers::mTLSIntolerantSites->Put(str);\r
+}\r
+\r
+void nsSSLIOLayerHelpers::removeIntolerantSite(const nsCString &str)\r
+{\r
+ nsAutoLock lock(mutex);\r
+ nsSSLIOLayerHelpers::mTLSIntolerantSites->Remove(str);\r
+}\r
+\r
+PRBool nsSSLIOLayerHelpers::isKnownAsIntolerantSite(const nsCString &str)\r
+{\r
+ nsAutoLock lock(mutex);\r
+ return mTLSIntolerantSites->Contains(str);\r
+}\r
+\r
+void nsSSLIOLayerHelpers::setRenegoUnrestrictedSites(const nsCString &str)\r
+{\r
+ nsAutoLock lock(mutex);\r
+ \r
+ if (mRenegoUnrestrictedSites) {\r
+ delete mRenegoUnrestrictedSites;\r
+ mRenegoUnrestrictedSites = nsnull;\r
+ }\r
+\r
+ mRenegoUnrestrictedSites = new nsCStringHashSet();\r
+ if (!mRenegoUnrestrictedSites)\r
+ return;\r
+ \r
+ mRenegoUnrestrictedSites->Init(1);\r
+ \r
+ nsCCommaSeparatedTokenizer toker(str);\r
+\r
+ while (toker.hasMoreTokens()) {\r
+ const nsCSubstring &host = toker.nextToken();\r
+ if (!host.IsEmpty()) {\r
+ mRenegoUnrestrictedSites->Put(host);\r
+ }\r
+ }\r
+}\r
+\r
+PRBool nsSSLIOLayerHelpers::isRenegoUnrestrictedSite(const nsCString &str)\r
+{\r
+ nsAutoLock lock(mutex);\r
+ return mRenegoUnrestrictedSites->Contains(str);\r
+}\r
+\r
+void nsSSLIOLayerHelpers::setTreatUnsafeNegotiationAsBroken(PRBool broken)\r
+{\r
+ nsAutoLock lock(mutex);\r
+ mTreatUnsafeNegotiationAsBroken = broken;\r
+}\r
+\r
+PRBool nsSSLIOLayerHelpers::treatUnsafeNegotiationAsBroken()\r
+{\r
+ nsAutoLock lock(mutex);\r
+ return mTreatUnsafeNegotiationAsBroken;\r
+}\r
+\r
+nsresult\r
+nsSSLIOLayerNewSocket(PRInt32 family,\r
+ const char *host,\r
+ PRInt32 port,\r
+ const char *proxyHost,\r
+ PRInt32 proxyPort,\r
+ PRFileDesc **fd,\r
+ nsISupports** info,\r
+ PRBool forSTARTTLS,\r
+ PRBool anonymousLoad)\r
+{\r
+\r
+ PRFileDesc* sock = PR_OpenTCPSocket(family);\r
+ if (!sock) return NS_ERROR_OUT_OF_MEMORY;\r
+\r
+ nsresult rv = nsSSLIOLayerAddToSocket(family, host, port, proxyHost, proxyPort,\r
+ sock, info, forSTARTTLS, anonymousLoad);\r
+ if (NS_FAILED(rv)) {\r
+ PR_Close(sock);\r
+ return rv;\r
+ }\r
+\r
+ *fd = sock;\r
+ return NS_OK;\r
+}\r
+\r
+/*\r
+ * Function: SECStatus nsConvertCANamesToStrings()\r
+ * Purpose: creates CA names strings from (CERTDistNames* caNames)\r
+ *\r
+ * Arguments and return values\r
+ * - arena: arena to allocate strings on\r
+ * - caNameStrings: filled with CA names strings on return\r
+ * - caNames: CERTDistNames to extract strings from\r
+ * - return: SECSuccess if successful; error code otherwise\r
+ *\r
+ * Note: copied in its entirety from Nova code\r
+ */\r
+SECStatus nsConvertCANamesToStrings(PRArenaPool* arena, char** caNameStrings,\r
+ CERTDistNames* caNames)\r
+{\r
+ SECItem* dername;\r
+ SECStatus rv;\r
+ int headerlen;\r
+ PRUint32 contentlen;\r
+ SECItem newitem;\r
+ int n;\r
+ char* namestring;\r
+\r
+ for (n = 0; n < caNames->nnames; n++) {\r
+ newitem.data = NULL;\r
+ dername = &caNames->names[n];\r
+\r
+ rv = DER_Lengths(dername, &headerlen, &contentlen);\r
+\r
+ if (rv != SECSuccess) {\r
+ goto loser;\r
+ }\r
+\r
+ if (headerlen + contentlen != dername->len) {\r
+ /* This must be from an enterprise 2.x server, which sent\r
+ * incorrectly formatted der without the outer wrapper of\r
+ * type and length. Fix it up by adding the top level\r
+ * header.\r
+ */\r
+ if (dername->len <= 127) {\r
+ newitem.data = (unsigned char *) PR_Malloc(dername->len + 2);\r
+ if (newitem.data == NULL) {\r
+ goto loser;\r
+ }\r
+ newitem.data[0] = (unsigned char)0x30;\r
+ newitem.data[1] = (unsigned char)dername->len;\r
+ (void)memcpy(&newitem.data[2], dername->data, dername->len);\r
+ }\r
+ else if (dername->len <= 255) {\r
+ newitem.data = (unsigned char *) PR_Malloc(dername->len + 3);\r
+ if (newitem.data == NULL) {\r
+ goto loser;\r
+ }\r
+ newitem.data[0] = (unsigned char)0x30;\r
+ newitem.data[1] = (unsigned char)0x81;\r
+ newitem.data[2] = (unsigned char)dername->len;\r
+ (void)memcpy(&newitem.data[3], dername->data, dername->len);\r
+ }\r
+ else {\r
+ /* greater than 256, better be less than 64k */\r
+ newitem.data = (unsigned char *) PR_Malloc(dername->len + 4);\r
+ if (newitem.data == NULL) {\r
+ goto loser;\r
+ }\r
+ newitem.data[0] = (unsigned char)0x30;\r
+ newitem.data[1] = (unsigned char)0x82;\r
+ newitem.data[2] = (unsigned char)((dername->len >> 8) & 0xff);\r
+ newitem.data[3] = (unsigned char)(dername->len & 0xff);\r
+ memcpy(&newitem.data[4], dername->data, dername->len);\r
+ }\r
+ dername = &newitem;\r
+ }\r
+\r
+ namestring = CERT_DerNameToAscii(dername);\r
+ if (namestring == NULL) {\r
+ /* XXX - keep going until we fail to convert the name */\r
+ caNameStrings[n] = "";\r
+ }\r
+ else {\r
+ caNameStrings[n] = PORT_ArenaStrdup(arena, namestring);\r
+ PR_Free(namestring);\r
+ if (caNameStrings[n] == NULL) {\r
+ goto loser;\r
+ }\r
+ }\r
+\r
+ if (newitem.data != NULL) {\r
+ PR_Free(newitem.data);\r
+ }\r
+ }\r
+\r
+ return SECSuccess;\r
+loser:\r
+ if (newitem.data != NULL) {\r
+ PR_Free(newitem.data);\r
+ }\r
+ return SECFailure;\r
+}\r
+\r
+/*\r
+ * structs and ASN1 templates for the limited scope-of-use extension\r
+ *\r
+ * CertificateScopeEntry ::= SEQUENCE {\r
+ * name GeneralName, -- pattern, as for NameConstraints\r
+ * portNumber INTEGER OPTIONAL }\r
+ *\r
+ * CertificateScopeOfUse ::= SEQUENCE OF CertificateScopeEntry\r
+ */\r
+/*\r
+ * CERTCertificateScopeEntry: struct for scope entry that can be consumed by\r
+ * the code\r
+ * certCertificateScopeOfUse: struct that represents the decoded extension data\r
+ */\r
+typedef struct {\r
+ SECItem derConstraint;\r
+ SECItem derPort;\r
+ CERTGeneralName* constraint; /* decoded constraint */\r
+ PRIntn port; /* decoded port number */\r
+} CERTCertificateScopeEntry;\r
+\r
+typedef struct {\r
+ CERTCertificateScopeEntry** entries;\r
+} certCertificateScopeOfUse;\r
+\r
+/* corresponding ASN1 templates */\r
+static const SEC_ASN1Template cert_CertificateScopeEntryTemplate[] = {\r
+ { SEC_ASN1_SEQUENCE, \r
+ 0, NULL, sizeof(CERTCertificateScopeEntry) },\r
+ { SEC_ASN1_ANY,\r
+ offsetof(CERTCertificateScopeEntry, derConstraint) },\r
+ { SEC_ASN1_OPTIONAL | SEC_ASN1_INTEGER,\r
+ offsetof(CERTCertificateScopeEntry, derPort) },\r
+ { 0 }\r
+};\r
+\r
+static const SEC_ASN1Template cert_CertificateScopeOfUseTemplate[] = {\r
+ { SEC_ASN1_SEQUENCE_OF, 0, cert_CertificateScopeEntryTemplate }\r
+};\r
+\r
+#if 0\r
+/* \r
+ * decodes the extension data and create CERTCertificateScopeEntry that can\r
+ * be consumed by the code\r
+ */\r
+static\r
+SECStatus cert_DecodeScopeOfUseEntries(PRArenaPool* arena, SECItem* extData,\r
+ CERTCertificateScopeEntry*** entries,\r
+ int* numEntries)\r
+{\r
+ certCertificateScopeOfUse* scope = NULL;\r
+ SECStatus rv = SECSuccess;\r
+ int i;\r
+\r
+ *entries = NULL; /* in case of failure */\r
+ *numEntries = 0; /* ditto */\r
+\r
+ scope = (certCertificateScopeOfUse*)\r
+ PORT_ArenaZAlloc(arena, sizeof(certCertificateScopeOfUse));\r
+ if (scope == NULL) {\r
+ goto loser;\r
+ }\r
+\r
+ rv = SEC_ASN1DecodeItem(arena, (void*)scope, \r
+ cert_CertificateScopeOfUseTemplate, extData);\r
+ if (rv != SECSuccess) {\r
+ goto loser;\r
+ }\r
+\r
+ *entries = scope->entries;\r
+ PR_ASSERT(*entries != NULL);\r
+\r
+ /* first, let's count 'em. */\r
+ for (i = 0; (*entries)[i] != NULL; i++) ;\r
+ *numEntries = i;\r
+\r
+ /* convert certCertificateScopeEntry sequence into what we can readily\r
+ * use\r
+ */\r
+ for (i = 0; i < *numEntries; i++) {\r
+ (*entries)[i]->constraint = \r
+ CERT_DecodeGeneralName(arena, &((*entries)[i]->derConstraint), \r
+ NULL);\r
+ if ((*entries)[i]->derPort.data != NULL) {\r
+ (*entries)[i]->port = \r
+ (int)DER_GetInteger(&((*entries)[i]->derPort));\r
+ }\r
+ else {\r
+ (*entries)[i]->port = 0;\r
+ }\r
+ }\r
+\r
+ goto done;\r
+loser:\r
+ if (rv == SECSuccess) {\r
+ rv = SECFailure;\r
+ }\r
+done:\r
+ return rv;\r
+}\r
+\r
+static SECStatus cert_DecodeCertIPAddress(SECItem* genname, \r
+ PRUint32* constraint, PRUint32* mask)\r
+{\r
+ /* in case of failure */\r
+ *constraint = 0;\r
+ *mask = 0;\r
+\r
+ PR_ASSERT(genname->data != NULL);\r
+ if (genname->data == NULL) {\r
+ return SECFailure;\r
+ }\r
+ if (genname->len != 8) {\r
+ /* the length must be 4 byte IP address with 4 byte subnet mask */\r
+ return SECFailure;\r
+ }\r
+\r
+ /* get them in the right order */\r
+ *constraint = PR_ntohl((PRUint32)(*genname->data));\r
+ *mask = PR_ntohl((PRUint32)(*(genname->data + 4)));\r
+\r
+ return SECSuccess;\r
+}\r
+\r
+static char* _str_to_lower(char* string)\r
+{\r
+#ifdef XP_WIN\r
+ return _strlwr(string);\r
+#else\r
+ int i;\r
+ for (i = 0; string[i] != '\0'; i++) {\r
+ string[i] = tolower(string[i]);\r
+ }\r
+ return string;\r
+#endif\r
+}\r
+\r
+/*\r
+ * Sees if the client certificate has a restriction in presenting the cert\r
+ * to the host: returns PR_TRUE if there is no restriction or if the hostname\r
+ * (and the port) satisfies the restriction, or PR_FALSE if the hostname (and\r
+ * the port) does not satisfy the restriction\r
+ */\r
+static PRBool CERT_MatchesScopeOfUse(CERTCertificate* cert, char* hostname,\r
+ char* hostIP, PRIntn port)\r
+{\r
+ PRBool rv = PR_TRUE; /* whether the cert can be presented */\r
+ SECStatus srv;\r
+ SECItem extData;\r
+ PRArenaPool* arena = NULL;\r
+ CERTCertificateScopeEntry** entries = NULL;\r
+ /* arrays of decoded scope entries */\r
+ int numEntries = 0;\r
+ int i;\r
+ char* hostLower = NULL;\r
+ PRUint32 hostIPAddr = 0;\r
+\r
+ PR_ASSERT((cert != NULL) && (hostname != NULL) && (hostIP != NULL));\r
+\r
+ /* find cert extension */\r
+ srv = CERT_FindCertExtension(cert, SEC_OID_NS_CERT_EXT_SCOPE_OF_USE,\r
+ &extData);\r
+ if (srv != SECSuccess) {\r
+ /* most of the time, this means the extension was not found: also,\r
+ * since this is not a critical extension (as of now) we may simply\r
+ * return PR_TRUE\r
+ */\r
+ goto done;\r
+ }\r
+\r
+ arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);\r
+ if (arena == NULL) {\r
+ goto done;\r
+ }\r
+\r
+ /* decode the scope of use entries into pairs of GeneralNames and\r
+ * an optional port numbers\r
+ */\r
+ srv = cert_DecodeScopeOfUseEntries(arena, &extData, &entries, &numEntries);\r
+ if (srv != SECSuccess) {\r
+ /* XXX What should we do when we failed to decode the extension? This\r
+ * may mean either the extension was malformed or some (unlikely)\r
+ * fatal error on our part: my argument is that if the extension \r
+ * was malformed the extension "disqualifies" as a valid \r
+ * constraint and we may present the cert\r
+ */\r
+ goto done;\r
+ }\r
+\r
+ /* loop over these structures */\r
+ for (i = 0; i < numEntries; i++) {\r
+ /* determine whether the GeneralName is a DNS pattern, an IP address \r
+ * constraint, or else\r
+ */\r
+ CERTGeneralName* genname = entries[i]->constraint;\r
+\r
+ /* if constraint is NULL, don't bother looking */\r
+ if (genname == NULL) {\r
+ /* this is not a failure: just continue */\r
+ continue;\r
+ }\r
+\r
+ switch (genname->type) {\r
+ case certDNSName: {\r
+ /* we have a DNS name constraint; we should use only the host name\r
+ * information\r
+ */\r
+ char* pattern = NULL;\r
+ char* substring = NULL;\r
+\r
+ /* null-terminate the string */\r
+ genname->name.other.data[genname->name.other.len] = '\0';\r
+ pattern = _str_to_lower((char*)genname->name.other.data);\r
+\r
+ if (hostLower == NULL) {\r
+ /* so that it's done only if necessary and only once */\r
+ hostLower = _str_to_lower(PL_strdup(hostname));\r
+ }\r
+\r
+ /* the hostname satisfies the constraint */\r
+ if (((substring = strstr(hostLower, pattern)) != NULL) &&\r
+ /* the hostname contains the pattern */\r
+ (strlen(substring) == strlen(pattern)) &&\r
+ /* the hostname ends with the pattern */\r
+ ((substring == hostLower) || (*(substring-1) == '.'))) {\r
+ /* the hostname either is identical to the pattern or\r
+ * belongs to a subdomain\r
+ */\r
+ rv = PR_TRUE;\r
+ }\r
+ else {\r
+ rv = PR_FALSE;\r
+ }\r
+ /* clean up strings if necessary */\r
+ break;\r
+ }\r
+ case certIPAddress: {\r
+ PRUint32 constraint;\r
+ PRUint32 mask;\r
+ PRNetAddr addr;\r
+ \r
+ if (hostIPAddr == 0) {\r
+ /* so that it's done only if necessary and only once */\r
+ PR_StringToNetAddr(hostIP, &addr);\r
+ hostIPAddr = addr.inet.ip;\r
+ }\r
+\r
+ if (cert_DecodeCertIPAddress(&(genname->name.other), &constraint, \r
+ &mask) != SECSuccess) {\r
+ continue;\r
+ }\r
+ if ((hostIPAddr & mask) == (constraint & mask)) {\r
+ rv = PR_TRUE;\r
+ }\r
+ else {\r
+ rv = PR_FALSE;\r
+ }\r
+ break;\r
+ }\r
+ default:\r
+ /* ill-formed entry: abort */\r
+ continue; /* go to the next entry */\r
+ }\r
+\r
+ if (!rv) {\r
+ /* we do not need to check the port: go to the next entry */\r
+ continue;\r
+ }\r
+\r
+ /* finally, check the optional port number */\r
+ if ((entries[i]->port != 0) && (port != entries[i]->port)) {\r
+ /* port number does not match */\r
+ rv = PR_FALSE;\r
+ continue;\r
+ }\r
+\r
+ /* we have a match */\r
+ PR_ASSERT(rv);\r
+ break;\r
+ }\r
+done:\r
+ /* clean up entries */\r
+ if (arena != NULL) {\r
+ PORT_FreeArena(arena, PR_FALSE);\r
+ }\r
+ if (hostLower != NULL) {\r
+ PR_Free(hostLower);\r
+ }\r
+ return rv;\r
+}\r
+#endif\r
+\r
+/*\r
+ * Function: SSMStatus SSM_SetUserCertChoice()\r
+\r
+ * Purpose: sets certChoice by reading the preference\r
+ *\r
+ * Arguments and return values\r
+ * - conn: SSMSSLDataConnection\r
+ * - returns: SSM_SUCCESS if successful; SSM_FAILURE otherwise\r
+ *\r
+ * Note: If done properly, this function will read the identifier strings\r
+ * for ASK and AUTO modes, read the selected strings from the\r
+ * preference, compare the strings, and determine in which mode it is\r
+ * in.\r
+ * We currently use ASK mode for UI apps and AUTO mode for UI-less\r
+ * apps without really asking for preferences.\r
+ */\r
+nsresult nsGetUserCertChoice(SSM_UserCertChoice* certChoice)\r
+{\r
+ char *mode=NULL;\r
+ nsresult ret;\r
+\r
+ NS_ENSURE_ARG_POINTER(certChoice);\r
+\r
+ nsCOMPtr<nsIPrefBranch> pref = do_GetService(NS_PREFSERVICE_CONTRACTID);\r
+\r
+ ret = pref->GetCharPref("security.default_personal_cert", &mode);\r
+ if (NS_FAILED(ret)) {\r
+ goto loser;\r
+ }\r
+\r
+ if (PL_strcmp(mode, "Select Automatically") == 0) {\r
+ *certChoice = AUTO;\r
+ }\r
+ else if (PL_strcmp(mode, "Ask Every Time") == 0) {\r
+ *certChoice = ASK;\r
+ }\r
+ else {\r
+ // Most likely we see a nickname from a migrated cert.\r
+ // We do not currently support that, ask the user which cert to use.\r
+ *certChoice = ASK;\r
+ }\r
+\r
+loser:\r
+ if (mode) {\r
+ nsMemory::Free(mode);\r
+ }\r
+ return ret;\r
+}\r
+\r
+static PRBool hasExplicitKeyUsageNonRepudiation(CERTCertificate *cert)\r
+{\r
+ /* There is no extension, v1 or v2 certificate */\r
+ if (!cert->extensions)\r
+ return PR_FALSE;\r
+\r
+ SECStatus srv;\r
+ SECItem keyUsageItem;\r
+ keyUsageItem.data = NULL;\r
+\r
+ srv = CERT_FindKeyUsageExtension(cert, &keyUsageItem);\r
+ if (srv == SECFailure)\r
+ return PR_FALSE;\r
+\r
+ unsigned char keyUsage = keyUsageItem.data[0];\r
+ PORT_Free (keyUsageItem.data);\r
+\r
+ return !!(keyUsage & KU_NON_REPUDIATION);\r
+}\r
+\r
+/*\r
+ * Function: SECStatus SSM_SSLGetClientAuthData()\r
+ * Purpose: this callback function is used to pull client certificate\r
+ * information upon server request\r
+ *\r
+ * Arguments and return values\r
+ * - arg: SSL data connection\r
+ * - socket: SSL socket we're dealing with\r
+ * - caNames: list of CA names\r
+ * - pRetCert: returns a pointer to a pointer to a valid certificate if\r
+ * successful; otherwise NULL\r
+ * - pRetKey: returns a pointer to a pointer to the corresponding key if\r
+ * successful; otherwise NULL\r
+ * - returns: SECSuccess if successful; error code otherwise\r
+ */\r
+SECStatus nsNSS_SSLGetClientAuthData(void* arg, PRFileDesc* socket,\r
+ CERTDistNames* caNames,\r
+ CERTCertificate** pRetCert,\r
+ SECKEYPrivateKey** pRetKey)\r
+{\r
+ nsNSSShutDownPreventionLock locker;\r
+ void* wincx = NULL;\r
+ SECStatus ret = SECFailure;\r
+ nsNSSSocketInfo* info = NULL;\r
+ PRArenaPool* arena = NULL;\r
+ char** caNameStrings;\r
+ CERTCertificate* cert = NULL;\r
+ SECKEYPrivateKey* privKey = NULL;\r
+ CERTCertList* certList = NULL;\r
+ CERTCertListNode* node;\r
+ CERTCertNicknames* nicknames = NULL;\r
+ char* extracted = NULL;\r
+ PRIntn keyError = 0; /* used for private key retrieval error */\r
+ SSM_UserCertChoice certChoice;\r
+ PRInt32 NumberOfCerts = 0;\r
+ \r
+ /* do some argument checking */\r
+ if (socket == NULL || caNames == NULL || pRetCert == NULL ||\r
+ pRetKey == NULL) {\r
+ PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);\r
+ return SECFailure;\r
+ }\r
+\r
+ /* get PKCS11 pin argument */\r
+ wincx = SSL_RevealPinArg(socket);\r
+ if (wincx == NULL) {\r
+ return SECFailure;\r
+ }\r
+\r
+ /* get the socket info */\r
+ info = (nsNSSSocketInfo*)socket->higher->secret;\r
+\r
+ /* create caNameStrings */\r
+ arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);\r
+ if (arena == NULL) {\r
+ goto loser;\r
+ }\r
+\r
+ caNameStrings = (char**)PORT_ArenaAlloc(arena, \r
+ sizeof(char*)*(caNames->nnames));\r
+ if (caNameStrings == NULL) {\r
+ goto loser;\r
+ }\r
+\r
+\r
+ ret = nsConvertCANamesToStrings(arena, caNameStrings, caNames);\r
+ if (ret != SECSuccess) {\r
+ goto loser;\r
+ }\r
+\r
+ /* get the preference */\r
+ if (NS_FAILED(nsGetUserCertChoice(&certChoice))) {\r
+ goto loser;\r
+ }\r
+\r
+ /* find valid user cert and key pair */ \r
+ if (certChoice == AUTO) {\r
+ /* automatically find the right cert */\r
+\r
+ /* find all user certs that are valid and for SSL */\r
+ certList = CERT_FindUserCertsByUsage(CERT_GetDefaultCertDB(), \r
+ certUsageSSLClient, PR_FALSE,\r
+ PR_TRUE, wincx);\r
+ if (certList == NULL) {\r
+ goto noCert;\r
+ }\r
+\r
+ /* filter the list to those issued by CAs supported by the server */\r
+ ret = CERT_FilterCertListByCANames(certList, caNames->nnames,\r
+ caNameStrings, certUsageSSLClient);\r
+ if (ret != SECSuccess) {\r
+ goto noCert;\r
+ }\r
+\r
+ /* make sure the list is not empty */\r
+ node = CERT_LIST_HEAD(certList);\r
+ if (CERT_LIST_END(node, certList)) {\r
+ goto noCert;\r
+ }\r
+\r
+ CERTCertificate* low_prio_nonrep_cert = NULL;\r
+ CERTCertificateCleaner low_prio_cleaner(low_prio_nonrep_cert);\r
+\r
+ /* loop through the list until we find a cert with a key */\r
+ while (!CERT_LIST_END(node, certList)) {\r
+ /* if the certificate has restriction and we do not satisfy it\r
+ * we do not use it\r
+ */\r
+#if 0 /* XXX This must be re-enabled */\r
+ if (!CERT_MatchesScopeOfUse(node->cert, info->GetHostName,\r
+ info->GetHostIP, info->GetHostPort)) {\r
+ node = CERT_LIST_NEXT(node);\r
+ continue;\r
+ }\r
+#endif\r
+\r
+ privKey = PK11_FindKeyByAnyCert(node->cert, wincx);\r
+ if (privKey != NULL) {\r
+ if (hasExplicitKeyUsageNonRepudiation(node->cert)) {\r
+ SECKEY_DestroyPrivateKey(privKey);\r
+ privKey = NULL;\r
+ // Not a prefered cert\r
+ if (!low_prio_nonrep_cert) // did not yet find a low prio cert\r
+ low_prio_nonrep_cert = CERT_DupCertificate(node->cert);\r
+ }\r
+ else {\r
+ // this is a good cert to present\r
+ cert = CERT_DupCertificate(node->cert);\r
+ break;\r
+ }\r
+ }\r
+ keyError = PR_GetError();\r
+ if (keyError == SEC_ERROR_BAD_PASSWORD) {\r
+ /* problem with password: bail */\r
+ goto loser;\r
+ }\r
+\r
+ node = CERT_LIST_NEXT(node);\r
+ }\r
+\r
+ if (!cert && low_prio_nonrep_cert) {\r
+ cert = low_prio_nonrep_cert;\r
+ low_prio_nonrep_cert = NULL; // take it away from the cleaner\r
+ privKey = PK11_FindKeyByAnyCert(cert, wincx);\r
+ }\r
+\r
+ if (cert == NULL) {\r
+ goto noCert;\r
+ }\r
+ }\r
+ else { // Not Auto => ask\r
+ /* Get the SSL Certificate */\r
+ CERTCertificate* serverCert = NULL;\r
+ CERTCertificateCleaner serverCertCleaner(serverCert);\r
+ serverCert = SSL_PeerCertificate(socket);\r
+ if (serverCert == NULL) {\r
+ /* couldn't get the server cert: what do I do? */\r
+ goto loser;\r
+ }\r
+\r
+ nsXPIDLCString hostname;\r
+ info->GetHostName(getter_Copies(hostname));\r
+\r
+ nsCAutoString clientlogin;\r
+ info->GetClientLogin(clientlogin);\r
+ \r
+ nsresult rv;\r
+ NS_DEFINE_CID(nssComponentCID, NS_NSSCOMPONENT_CID);\r
+ nsCOMPtr<nsINSSComponent> nssComponent(do_GetService(nssComponentCID, &rv));\r
+ nsRefPtr<nsClientAuthRememberService> cars;\r
+ if (nssComponent) {\r
+ nssComponent->GetClientAuthRememberService(getter_AddRefs(cars));\r
+ }\r
+\r
+ PRBool hasRemembered = PR_FALSE;\r
+ nsCString rememberedDBKey;\r
+ if (cars) {\r
+ PRBool found;\r
+ nsresult rv;\r
+ if(clientlogin.IsEmpty()){\r
+ rv = cars->HasRememberedDecision(hostname, \r
+ serverCert,\r
+ rememberedDBKey, &found);\r
+ }\r
+ else{\r
+ rv = cars->HasRememberedDecision(hostname, \r
+ serverCert,\r
+ rememberedDBKey, &found,clientlogin);\r
+ }\r
+ \r
+ if (NS_SUCCEEDED(rv) && found) {\r
+ hasRemembered = PR_TRUE;\r
+ }\r
+ }\r
+\r
+ PRBool canceled = PR_FALSE;\r
+\r
+if (hasRemembered)\r
+{\r
+ if (rememberedDBKey.IsEmpty())\r
+ {\r
+ canceled = PR_TRUE;\r
+ }\r
+ else\r
+ {\r
+ nsCOMPtr<nsIX509CertDB> certdb;\r
+ certdb = do_GetService(NS_X509CERTDB_CONTRACTID);\r
+ if (certdb)\r
+ {\r
+ nsCOMPtr<nsIX509Cert> found_cert;\r
+ nsresult find_rv = \r
+ certdb->FindCertByDBKey(rememberedDBKey.get(), nsnull,\r
+ getter_AddRefs(found_cert));\r
+ if (NS_SUCCEEDED(find_rv) && found_cert) {\r
+ nsNSSCertificate *obj_cert = reinterpret_cast<nsNSSCertificate *>(found_cert.get());\r
+ if (obj_cert) {\r
+ cert = obj_cert->GetCert();\r
+\r
+#ifdef DEBUG_kaie\r
+ nsAutoString nick, nickWithSerial, details;\r
+ if (NS_SUCCEEDED(obj_cert->FormatUIStrings(nick, \r
+ nickWithSerial, \r
+ details))) {\r
+ NS_LossyConvertUTF16toASCII asc(nickWithSerial);\r
+ fprintf(stderr, "====> remembered serial %s\n", asc.get());\r
+ }\r
+#endif\r
+\r
+ }\r
+ }\r
+ \r
+ if (!cert) {\r
+ hasRemembered = PR_FALSE;\r
+ }\r
+ }\r
+ }\r
+}\r
+\r
+if (!hasRemembered)\r
+{\r
+ /* user selects a cert to present */\r
+ nsIClientAuthDialogs *dialogs = NULL;\r
+ PRInt32 selectedIndex = -1;\r
+ PRUnichar **certNicknameList = NULL;\r
+ PRUnichar **certDetailsList = NULL;\r
+\r
+ /* find all user certs that are for SSL */\r
+ /* note that we are allowing expired certs in this list */\r
+ certList = CERT_FindUserCertsByUsage(CERT_GetDefaultCertDB(), \r
+ certUsageSSLClient, PR_FALSE, \r
+ PR_FALSE, wincx);\r
+ if (certList == NULL) {\r
+ goto noCert;\r
+ }\r
+\r
+ if (caNames->nnames != 0) {\r
+ /* filter the list to those issued by CAs supported by the \r
+ * server \r
+ */\r
+ ret = CERT_FilterCertListByCANames(certList, caNames->nnames, \r
+ caNameStrings, \r
+ certUsageSSLClient);\r
+ if (ret != SECSuccess) {\r
+ goto loser;\r
+ }\r
+ }\r
+\r
+ if (CERT_LIST_END(CERT_LIST_HEAD(certList), certList)) {\r
+ /* list is empty - no matching certs */\r
+ goto noCert;\r
+ }\r
+\r
+ /* filter it further for hostname restriction */\r
+ node = CERT_LIST_HEAD(certList);\r
+ while (!CERT_LIST_END(node, certList)) {\r
+ ++NumberOfCerts;\r
+#if 0 /* XXX Fix this */\r
+ if (!CERT_MatchesScopeOfUse(node->cert, conn->hostName,\r
+ conn->hostIP, conn->port)) {\r
+ CERTCertListNode* removed = node;\r
+ node = CERT_LIST_NEXT(removed);\r
+ CERT_RemoveCertListNode(removed);\r
+ }\r
+ else {\r
+ node = CERT_LIST_NEXT(node);\r
+ }\r
+#endif\r
+ node = CERT_LIST_NEXT(node);\r
+ }\r
+ if (CERT_LIST_END(CERT_LIST_HEAD(certList), certList)) {\r
+ goto noCert;\r
+ }\r
+\r
+ nicknames = getNSSCertNicknamesFromCertList(certList);\r
+\r
+ if (nicknames == NULL) {\r
+ goto loser;\r
+ }\r
+\r
+ NS_ASSERTION(nicknames->numnicknames == NumberOfCerts, "nicknames->numnicknames != NumberOfCerts");\r
+\r
+ /* Get CN and O of the subject and O of the issuer */\r
+ char *ccn = CERT_GetCommonName(&serverCert->subject);\r
+ void *v = ccn;\r
+ voidCleaner ccnCleaner(v);\r
+ NS_ConvertUTF8toUTF16 cn(ccn);\r
+\r
+ PRInt32 port;\r
+ info->GetPort(&port);\r
+\r
+ nsString cn_host_port;\r
+ if (ccn && strcmp(ccn, hostname) == 0) {\r
+ cn_host_port.Append(cn);\r
+ cn_host_port.AppendLiteral(":");\r
+ cn_host_port.AppendInt(port);\r
+ }\r
+ else {\r
+ cn_host_port.Append(cn);\r
+ cn_host_port.AppendLiteral(" (");\r
+ cn_host_port.AppendLiteral(":");\r
+ cn_host_port.AppendInt(port);\r
+ cn_host_port.AppendLiteral(")");\r
+ }\r
+\r
+ char *corg = CERT_GetOrgName(&serverCert->subject);\r
+ NS_ConvertUTF8toUTF16 org(corg);\r
+ if (corg) PORT_Free(corg);\r
+\r
+ char *cissuer = CERT_GetOrgName(&serverCert->issuer);\r
+ NS_ConvertUTF8toUTF16 issuer(cissuer);\r
+ if (cissuer) PORT_Free(cissuer);\r
+\r
+ certNicknameList = (PRUnichar **)nsMemory::Alloc(sizeof(PRUnichar *) * nicknames->numnicknames);\r
+ if (!certNicknameList)\r
+ goto loser;\r
+ certDetailsList = (PRUnichar **)nsMemory::Alloc(sizeof(PRUnichar *) * nicknames->numnicknames);\r
+ if (!certDetailsList) {\r
+ nsMemory::Free(certNicknameList);\r
+ goto loser;\r
+ }\r
+\r
+ PRInt32 CertsToUse;\r
+ for (CertsToUse = 0, node = CERT_LIST_HEAD(certList);\r
+ !CERT_LIST_END(node, certList) && CertsToUse < nicknames->numnicknames;\r
+ node = CERT_LIST_NEXT(node)\r
+ )\r
+ {\r
+ nsRefPtr<nsNSSCertificate> tempCert = new nsNSSCertificate(node->cert);\r
+\r
+ if (!tempCert)\r
+ continue;\r
+ \r
+ NS_ConvertUTF8toUTF16 i_nickname(nicknames->nicknames[CertsToUse]);\r
+ nsAutoString nickWithSerial, details;\r
+ \r
+ if (NS_FAILED(tempCert->FormatUIStrings(i_nickname, nickWithSerial, details)))\r
+ continue;\r
+\r
+ certNicknameList[CertsToUse] = ToNewUnicode(nickWithSerial);\r
+ if (!certNicknameList[CertsToUse])\r
+ continue;\r
+ certDetailsList[CertsToUse] = ToNewUnicode(details);\r
+ if (!certDetailsList[CertsToUse]) {\r
+ nsMemory::Free(certNicknameList[CertsToUse]);\r
+ continue;\r
+ }\r
+\r
+ ++CertsToUse;\r
+ }\r
+\r
+ /* Throw up the client auth dialog and get back the index of the selected cert */\r
+ rv = getNSSDialogs((void**)&dialogs, \r
+ NS_GET_IID(nsIClientAuthDialogs),\r
+ NS_CLIENTAUTHDIALOGS_CONTRACTID);\r
+\r
+ if (NS_FAILED(rv)) {\r
+ NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(CertsToUse, certNicknameList);\r
+ NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(CertsToUse, certDetailsList);\r
+ goto loser;\r
+ }\r
+\r
+ {\r
+ nsPSMUITracker tracker;\r
+ if (tracker.isUIForbidden()) {\r
+ rv = NS_ERROR_NOT_AVAILABLE;\r
+ }\r
+ else {\r
+ rv = dialogs->ChooseCertificate(info, cn_host_port.get(), org.get(), issuer.get(), \r
+ (const PRUnichar**)certNicknameList, (const PRUnichar**)certDetailsList,\r
+ CertsToUse, &selectedIndex, &canceled);\r
+ }\r
+ }\r
+\r
+ NS_RELEASE(dialogs);\r
+ NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(CertsToUse, certNicknameList);\r
+ NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(CertsToUse, certDetailsList);\r
+ \r
+ if (NS_FAILED(rv)) goto loser;\r
+\r
+ // even if the user has canceled, we want to remember that, to avoid repeating prompts\r
+ PRBool wantRemember = PR_FALSE;\r
+ info->GetRememberClientAuthCertificate(&wantRemember);\r
+\r
+ int i;\r
+ if (!canceled)\r
+ for (i = 0, node = CERT_LIST_HEAD(certList);\r
+ !CERT_LIST_END(node, certList);\r
+ ++i, node = CERT_LIST_NEXT(node)) {\r
+\r
+ if (i == selectedIndex) {\r
+ cert = CERT_DupCertificate(node->cert);\r
+ break;\r
+ }\r
+ }\r
+\r
+ if (cars && wantRemember) {\r
+ if(clientlogin.IsEmpty()){\r
+ cars->RememberDecision(hostname, \r
+ serverCert, \r
+ canceled ? 0 : cert);\r
+ }\r
+ else{\r
+ cars->RememberDecision(hostname, \r
+ serverCert, \r
+ canceled ? 0 : cert,clientlogin);\r
+ } \r
+ }\r
+}\r
+\r
+ if (canceled) { rv = NS_ERROR_NOT_AVAILABLE; goto loser; }\r
+\r
+ if (cert == NULL) {\r
+ goto loser;\r
+ }\r
+\r
+ /* go get the private key */\r
+ privKey = PK11_FindKeyByAnyCert(cert, wincx);\r
+ if (privKey == NULL) {\r
+ keyError = PR_GetError();\r
+ if (keyError == SEC_ERROR_BAD_PASSWORD) {\r
+ /* problem with password: bail */\r
+ goto loser;\r
+ }\r
+ else {\r
+ goto noCert;\r
+ }\r
+ }\r
+ }\r
+ goto done;\r
+\r
+noCert:\r
+loser:\r
+ if (ret == SECSuccess) {\r
+ ret = SECFailure;\r
+ }\r
+ if (cert != NULL) {\r
+ CERT_DestroyCertificate(cert);\r
+ cert = NULL;\r
+ }\r
+done:\r
+ if (extracted != NULL) {\r
+ PR_Free(extracted);\r
+ }\r
+ if (nicknames != NULL) {\r
+ CERT_FreeNicknames(nicknames);\r
+ }\r
+ if (certList != NULL) {\r
+ CERT_DestroyCertList(certList);\r
+ }\r
+ if (arena != NULL) {\r
+ PORT_FreeArena(arena, PR_FALSE);\r
+ }\r
+\r
+ *pRetCert = cert;\r
+ *pRetKey = privKey;\r
+\r
+ return ret;\r
+}\r
+\r
+static SECStatus\r
+cancel_and_failure(nsNSSSocketInfo* infoObject)\r
+{\r
+ infoObject->SetCanceled(PR_TRUE);\r
+ return SECFailure;\r
+}\r
+\r
+static SECStatus\r
+nsNSSBadCertHandler(void *arg, PRFileDesc *sslSocket)\r
+{\r
+ nsNSSShutDownPreventionLock locker;\r
+ nsNSSSocketInfo* infoObject = (nsNSSSocketInfo *)arg;\r
+ if (!infoObject)\r
+ return SECFailure;\r
+\r
+ if (nsSSLThread::exitRequested())\r
+ return cancel_and_failure(infoObject);\r
+\r
+ CERTCertificate *peerCert = nsnull;\r
+ CERTCertificateCleaner peerCertCleaner(peerCert);\r
+ peerCert = SSL_PeerCertificate(sslSocket);\r
+ if (!peerCert)\r
+ return cancel_and_failure(infoObject);\r
+\r
+ nsRefPtr<nsNSSCertificate> nssCert;\r
+ nssCert = new nsNSSCertificate(peerCert);\r
+ if (!nssCert)\r
+ return cancel_and_failure(infoObject);\r
+\r
+ nsCOMPtr<nsIX509Cert> ix509 = static_cast<nsIX509Cert*>(nssCert.get());\r
+\r
+ SECStatus srv;\r
+ nsresult nsrv;\r
+ PRUint32 collected_errors = 0;\r
+ PRUint32 remaining_display_errors = 0;\r
+\r
+ PRErrorCode errorCodeTrust = SECSuccess;\r
+ PRErrorCode errorCodeMismatch = SECSuccess;\r
+ PRErrorCode errorCodeExpired = SECSuccess;\r
+ \r
+ char *hostname = SSL_RevealURL(sslSocket);\r
+ charCleaner hostnameCleaner(hostname); \r
+ nsDependentCString hostString(hostname);\r
+\r
+ PRInt32 port;\r
+ infoObject->GetPort(&port);\r
+\r
+ nsCString hostWithPortString = hostString;\r
+ hostWithPortString.AppendLiteral(":");\r
+ hostWithPortString.AppendInt(port);\r
+\r
+ NS_ConvertUTF8toUTF16 hostWithPortStringUTF16(hostWithPortString);\r
+\r
+ // Check the name field against the desired hostname.\r
+ if (hostname && hostname[0] &&\r
+ CERT_VerifyCertName(peerCert, hostname) != SECSuccess) {\r
+ collected_errors |= nsICertOverrideService::ERROR_MISMATCH;\r
+ errorCodeMismatch = SSL_ERROR_BAD_CERT_DOMAIN;\r
+ }\r
+\r
+ {\r
+ PRArenaPool *log_arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);\r
+ if (!log_arena) \r
+ return cancel_and_failure(infoObject);\r
+\r
+ PRArenaPoolCleanerFalseParam log_arena_cleaner(log_arena);\r
+\r
+ CERTVerifyLog *verify_log = PORT_ArenaZNew(log_arena, CERTVerifyLog);\r
+ if (!verify_log)\r
+ return cancel_and_failure(infoObject);\r
+\r
+ CERTVerifyLogContentsCleaner verify_log_cleaner(verify_log);\r
+\r
+ verify_log->arena = log_arena;\r
+\r
+ srv = CERT_VerifyCertificate(CERT_GetDefaultCertDB(), peerCert,\r
+ PR_TRUE, certificateUsageSSLServer,\r
+ PR_Now(), (void*)infoObject, \r
+ verify_log, NULL);\r
+\r
+ // We ignore the result code of the cert verification.\r
+ // Either it is a failure, which is expected, and we'll process the\r
+ // verify log below.\r
+ // Or it is a success, then a domain mismatch is the only \r
+ // possible failure. \r
+\r
+ CERTVerifyLogNode *i_node;\r
+ for (i_node = verify_log->head; i_node; i_node = i_node->next)\r
+ {\r
+ switch (i_node->error)\r
+ {\r
+ case SEC_ERROR_UNKNOWN_ISSUER:\r
+ case SEC_ERROR_CA_CERT_INVALID:\r
+ case SEC_ERROR_UNTRUSTED_ISSUER:\r
+ case SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE:\r
+ case SEC_ERROR_UNTRUSTED_CERT:\r
+ case SEC_ERROR_INADEQUATE_KEY_USAGE:\r
+ // We group all these errors as "cert not trusted"\r
+ collected_errors |= nsICertOverrideService::ERROR_UNTRUSTED;\r
+ if (errorCodeTrust == SECSuccess) {\r
+ errorCodeTrust = i_node->error;\r
+ }\r
+ break;\r
+ case SSL_ERROR_BAD_CERT_DOMAIN:\r
+ collected_errors |= nsICertOverrideService::ERROR_MISMATCH;\r
+ if (errorCodeMismatch == SECSuccess) {\r
+ errorCodeMismatch = i_node->error;\r
+ }\r
+ break;\r
+ case SEC_ERROR_EXPIRED_CERTIFICATE:\r
+ collected_errors |= nsICertOverrideService::ERROR_TIME;\r
+ if (errorCodeExpired == SECSuccess) {\r
+ errorCodeExpired = i_node->error;\r
+ }\r
+ break;\r
+ default:\r
+ // we are not willing to continue on any other error\r
+ nsHandleSSLError(infoObject, i_node->error);\r
+ // this error is our stop condition, so let's make sure\r
+ // this error code will be reported to the external world.\r
+ PR_SetError(i_node->error, 0);\r
+ return cancel_and_failure(infoObject);\r
+ }\r
+ }\r
+ }\r
+\r
+ if (!collected_errors)\r
+ {\r
+ NS_NOTREACHED("why did NSS call our bad cert handler if all looks good? Let's cancel the connection");\r
+ return SECFailure;\r
+ }\r
+\r
+ nsRefPtr<nsSSLStatus> status = infoObject->SSLStatus();\r
+ if (!status) {\r
+ status = new nsSSLStatus();\r
+ infoObject->SetSSLStatus(status);\r
+ }\r
+\r
+ if (status) {\r
+ if (!status->mServerCert) {\r
+ status->mServerCert = nssCert;\r
+ }\r
+\r
+ status->mHaveCertErrorBits = PR_TRUE;\r
+ status->mIsDomainMismatch = collected_errors & nsICertOverrideService::ERROR_MISMATCH;\r
+ status->mIsNotValidAtThisTime = collected_errors & nsICertOverrideService::ERROR_TIME;\r
+ status->mIsUntrusted = collected_errors & nsICertOverrideService::ERROR_UNTRUSTED;\r
+\r
+ nsSSLIOLayerHelpers::mHostsWithCertErrors->RememberCertHasError(\r
+ infoObject, status, SECFailure);\r
+ }\r
+\r
+ remaining_display_errors = collected_errors;\r
+\r
+ nsCOMPtr<nsICertOverrideService> overrideService = \r
+ do_GetService(NS_CERTOVERRIDE_CONTRACTID);\r
+ // it is fine to continue without the nsICertOverrideService\r
+\r
+ PRUint32 overrideBits = 0; \r
+\r
+ if (overrideService)\r
+ {\r
+ PRBool haveOverride;\r
+ PRBool isTemporaryOverride; // we don't care\r
+ \r
+ nsrv = overrideService->HasMatchingOverride(hostString, port,\r
+ ix509, \r
+ &overrideBits,\r
+ &isTemporaryOverride, \r
+ &haveOverride);\r
+ if (NS_SUCCEEDED(nsrv) && haveOverride) \r
+ {\r
+ // remove the errors that are already overriden\r
+ remaining_display_errors -= overrideBits;\r
+ }\r
+ }\r
+\r
+ if (!remaining_display_errors) {\r
+ // all errors are covered by override rules, so let's accept the cert\r
+ return SECSuccess;\r
+ }\r
+\r
+ // Ok, this is a full stop.\r
+ // First, deliver the technical details of the broken SSL status,\r
+ // giving the caller a chance to suppress the error messages.\r
+\r
+ PRBool suppressMessage = PR_FALSE;\r
+ nsresult rv;\r
+\r
+ // Try to get a nsIBadCertListener2 implementation from the socket consumer.\r
+ nsCOMPtr<nsIInterfaceRequestor> cb;\r
+ infoObject->GetNotificationCallbacks(getter_AddRefs(cb));\r
+ if (cb) {\r
+ nsCOMPtr<nsIInterfaceRequestor> callbacks;\r
+ NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,\r
+ NS_GET_IID(nsIInterfaceRequestor),\r
+ cb,\r
+ NS_PROXY_SYNC,\r
+ getter_AddRefs(callbacks));\r
+\r
+ nsCOMPtr<nsIBadCertListener2> bcl = do_GetInterface(callbacks);\r
+ if (bcl) {\r
+ nsCOMPtr<nsIBadCertListener2> proxy_bcl;\r
+ NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,\r
+ NS_GET_IID(nsIBadCertListener2),\r
+ bcl,\r
+ NS_PROXY_SYNC,\r
+ getter_AddRefs(proxy_bcl));\r
+ if (proxy_bcl) {\r
+ nsIInterfaceRequestor *csi = static_cast<nsIInterfaceRequestor*>(infoObject);\r
+ rv = proxy_bcl->NotifyCertProblem(csi, status, hostWithPortString, \r
+ &suppressMessage);\r
+ }\r
+ }\r
+ }\r
+\r
+ nsCOMPtr<nsIRecentBadCertsService> recentBadCertsService = \r
+ do_GetService(NS_RECENTBADCERTS_CONTRACTID);\r
+\r
+ if (recentBadCertsService) {\r
+ recentBadCertsService->AddBadCert(hostWithPortStringUTF16, status);\r
+ }\r
+\r
+ // pick the error code to report by priority\r
+ PRErrorCode errorCodeToReport = SECSuccess;\r
+ if (remaining_display_errors & nsICertOverrideService::ERROR_UNTRUSTED)\r
+ errorCodeToReport = errorCodeTrust;\r
+ else if (remaining_display_errors & nsICertOverrideService::ERROR_MISMATCH)\r
+ errorCodeToReport = errorCodeMismatch;\r
+ else if (remaining_display_errors & nsICertOverrideService::ERROR_TIME)\r
+ errorCodeToReport = errorCodeExpired;\r
+\r
+ if (!suppressMessage) {\r
+ PRBool external = PR_FALSE;\r
+ infoObject->GetExternalErrorReporting(&external);\r
+\r
+ nsHandleInvalidCertError(infoObject,\r
+ remaining_display_errors,\r
+ hostString,\r
+ hostWithPortString,\r
+ port,\r
+ errorCodeToReport,\r
+ errorCodeTrust,\r
+ errorCodeMismatch,\r
+ errorCodeExpired,\r
+ external, // wantsHtml\r
+ ix509);\r
+ }\r
+\r
+ PR_SetError(errorCodeToReport, 0);\r
+ return cancel_and_failure(infoObject);\r
+}\r
+\r
+static PRFileDesc*\r
+nsSSLIOLayerImportFD(PRFileDesc *fd,\r
+ nsNSSSocketInfo *infoObject,\r
+ const char *host,\r
+ PRBool anonymousLoad)\r
+{\r
+ nsNSSShutDownPreventionLock locker;\r
+ PRFileDesc* sslSock = SSL_ImportFD(nsnull, fd);\r
+ if (!sslSock) {\r
+ NS_ASSERTION(PR_FALSE, "NSS: Error importing socket");\r
+ return nsnull;\r
+ }\r
+ SSL_SetPKCS11PinArg(sslSock, (nsIInterfaceRequestor*)infoObject);\r
+ SSL_HandshakeCallback(sslSock, HandshakeCallback, infoObject);\r
+\r
+ // Disable this hook if we connect anonymously. See bug 466080.\r
+ if (anonymousLoad) {\r
+ SSL_GetClientAuthDataHook(sslSock, NULL, infoObject);\r
+ } else {\r
+ SSL_GetClientAuthDataHook(sslSock, \r
+ (SSLGetClientAuthData)nsNSS_SSLGetClientAuthData,\r
+ infoObject);\r
+ }\r
+ SSL_AuthCertificateHook(sslSock, AuthCertificateCallback, 0);\r
+\r
+ PRInt32 ret = SSL_SetURL(sslSock, host);\r
+ if (ret == -1) {\r
+ NS_ASSERTION(PR_FALSE, "NSS: Error setting server name");\r
+ goto loser;\r
+ }\r
+ return sslSock;\r
+loser:\r
+ if (sslSock) {\r
+ PR_Close(sslSock);\r
+ }\r
+ return nsnull;\r
+}\r
+\r
+static nsresult\r
+nsSSLIOLayerSetOptions(PRFileDesc *fd, PRBool forSTARTTLS, \r
+ const char *proxyHost, const char *host, PRInt32 port,\r
+ PRBool anonymousLoad, nsNSSSocketInfo *infoObject)\r
+{\r
+ nsNSSShutDownPreventionLock locker;\r
+ if (forSTARTTLS || proxyHost) {\r
+ if (SECSuccess != SSL_OptionSet(fd, SSL_SECURITY, PR_FALSE)) {\r
+ return NS_ERROR_FAILURE;\r
+ }\r
+ infoObject->SetHasCleartextPhase(PR_TRUE);\r
+ }\r
+\r
+ if (forSTARTTLS) {\r
+ if (SECSuccess != SSL_OptionSet(fd, SSL_ENABLE_SSL2, PR_FALSE)) {\r
+ return NS_ERROR_FAILURE;\r
+ }\r
+ if (SECSuccess != SSL_OptionSet(fd, SSL_V2_COMPATIBLE_HELLO, PR_FALSE)) {\r
+ return NS_ERROR_FAILURE;\r
+ }\r
+ }\r
+\r
+ // Let's see if we're trying to connect to a site we know is\r
+ // TLS intolerant.\r
+ nsCAutoString key;\r
+ key = nsDependentCString(host) + NS_LITERAL_CSTRING(":") + nsPrintfCString("%d", port);\r
+\r
+ if (nsSSLIOLayerHelpers::isKnownAsIntolerantSite(key)) {\r
+ if (SECSuccess != SSL_OptionSet(fd, SSL_ENABLE_TLS, PR_FALSE))\r
+ return NS_ERROR_FAILURE;\r
+\r
+ infoObject->SetAllowTLSIntoleranceTimeout(PR_FALSE);\r
+ \r
+ // We assume that protocols that use the STARTTLS mechanism should support\r
+ // modern hellos. For other protocols, if we suspect a site \r
+ // does not support TLS, let's also use V2 hellos.\r
+ // One advantage of this approach, if a site only supports the older\r
+ // hellos, it is more likely that we will get a reasonable error code\r
+ // on our single retry attempt.\r
+ \r
+ if (!forSTARTTLS &&\r
+ SECSuccess != SSL_OptionSet(fd, SSL_V2_COMPATIBLE_HELLO, PR_TRUE))\r
+ return NS_ERROR_FAILURE;\r
+ }\r
+\r
+ if (SECSuccess != SSL_OptionSet(fd, SSL_HANDSHAKE_AS_CLIENT, PR_TRUE)) {\r
+ return NS_ERROR_FAILURE;\r
+ }\r
+ if (SECSuccess != SSL_BadCertHook(fd, (SSLBadCertHandler) nsNSSBadCertHandler,\r
+ infoObject)) {\r
+ return NS_ERROR_FAILURE;\r
+ }\r
+ \r
+ if (nsSSLIOLayerHelpers::isRenegoUnrestrictedSite(nsDependentCString(host))) {\r
+ if (SECSuccess != SSL_OptionSet(fd, SSL_REQUIRE_SAFE_NEGOTIATION, PR_FALSE)) {\r
+ return NS_ERROR_FAILURE;\r
+ }\r
+ if (SECSuccess != SSL_OptionSet(fd, SSL_ENABLE_RENEGOTIATION, SSL_RENEGOTIATE_UNRESTRICTED)) {\r
+ return NS_ERROR_FAILURE;\r
+ }\r
+ }\r
+\r
+ // Set the Peer ID so that SSL proxy connections work properly.\r
+ char *peerId;\r
+ if (anonymousLoad) { // See bug #466080. Separate the caches.\r
+ peerId = PR_smprintf("anon:%s:%d", host, port);\r
+ } else {\r
+ peerId = PR_smprintf("%s:%d", host, port);\r
+ }\r
+ \r
+ if (SECSuccess != SSL_SetSockPeerID(fd, peerId)) {\r
+ PR_smprintf_free(peerId);\r
+ return NS_ERROR_FAILURE;\r
+ }\r
+\r
+ PR_smprintf_free(peerId);\r
+ return NS_OK;\r
+}\r
+\r
+nsresult\r
+nsSSLIOLayerAddToSocket(PRInt32 family,\r
+ const char* host,\r
+ PRInt32 port,\r
+ const char* proxyHost,\r
+ PRInt32 proxyPort,\r
+ PRFileDesc* fd,\r
+ nsISupports** info,\r
+ PRBool forSTARTTLS,\r
+ PRBool anonymousLoad)\r
+{\r
+ nsNSSShutDownPreventionLock locker;\r
+ PRFileDesc* layer = nsnull;\r
+ nsresult rv;\r
+\r
+ nsNSSSocketInfo* infoObject = new nsNSSSocketInfo();\r
+ if (!infoObject) return NS_ERROR_FAILURE;\r
+ \r
+ NS_ADDREF(infoObject);\r
+ infoObject->SetForSTARTTLS(forSTARTTLS);\r
+ infoObject->SetHostName(host);\r
+ infoObject->SetPort(port);\r
+\r
+ PRFileDesc *sslSock = nsSSLIOLayerImportFD(fd, infoObject, host, anonymousLoad);\r
+ if (!sslSock) {\r
+ NS_ASSERTION(PR_FALSE, "NSS: Error importing socket");\r
+ goto loser;\r
+ }\r
+\r
+ infoObject->SetFileDescPtr(sslSock);\r
+\r
+ rv = nsSSLIOLayerSetOptions(sslSock,\r
+ forSTARTTLS, proxyHost, host, port, anonymousLoad,\r
+ infoObject);\r
+\r
+ if (NS_FAILED(rv))\r
+ goto loser;\r
+\r
+ /* Now, layer ourselves on top of the SSL socket... */\r
+ layer = PR_CreateIOLayerStub(nsSSLIOLayerHelpers::nsSSLIOLayerIdentity,\r
+ &nsSSLIOLayerHelpers::nsSSLIOLayerMethods);\r
+ if (!layer)\r
+ goto loser;\r
+ \r
+ layer->secret = (PRFilePrivate*) infoObject;\r
+ rv = PR_PushIOLayer(sslSock, PR_GetLayersIdentity(sslSock), layer);\r
+ \r
+ if (NS_FAILED(rv)) {\r
+ goto loser;\r
+ }\r
+ \r
+ nsNSSShutDownList::trackSSLSocketCreate();\r
+\r
+ PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("[%p] Socket set up\n", (void*)sslSock));\r
+ infoObject->QueryInterface(NS_GET_IID(nsISupports), (void**) (info));\r
+\r
+ // We are going use a clear connection first //\r
+ if (forSTARTTLS || proxyHost) {\r
+ infoObject->SetHandshakePending(PR_FALSE);\r
+ }\r
+\r
+ return NS_OK;\r
+ loser:\r
+ NS_IF_RELEASE(infoObject);\r
+ if (layer) {\r
+ layer->dtor(layer);\r
+ }\r
+ return NS_ERROR_FAILURE;\r
+}\r
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Brian Ryner <bryner@brianryner.com>
- * Kai Engert <kengert@redhat.com>
- * Copyright (c) 2010 CASSIDIAN - All rights reserved
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either 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.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef _NSNSSIOLAYER_H
-#define _NSNSSIOLAYER_H
-
-#include "prtypes.h"
-#include "prio.h"
-#include "certt.h"
-#include "nsString.h"
-#include "nsIInterfaceRequestor.h"
-#include "nsIInterfaceRequestorUtils.h"
-#include "nsITransportSecurityInfo.h"
-#include "nsISSLSocketControl.h"
-#include "nsSSLStatus.h"
-#include "nsISSLStatusProvider.h"
-#include "nsIIdentityInfo.h"
-#include "nsIAssociatedContentSecurity.h"
-#include "nsXPIDLString.h"
-#include "nsNSSShutDown.h"
-#include "nsIClientAuthDialogs.h"
-#include "nsAutoPtr.h"
-#include "nsNSSCertificate.h"
-#include "nsDataHashtable.h"
-
-class nsIChannel;
-class nsSSLThread;
-
-/*
- * This class is used to store SSL socket I/O state information,
- * that is not being executed directly, but defered to
- * the separate SSL thread.
- */
-class nsSSLSocketThreadData
-{
-public:
- nsSSLSocketThreadData();
- ~nsSSLSocketThreadData();
-
- PRBool ensure_buffer_size(PRInt32 amount);
-
- enum ssl_state {
- ssl_invalid, // used for initializating, should never occur
- ssl_idle, // not in use by SSL thread, no activity pending
- ssl_pending_write, // waiting for SSL thread to complete writing
- ssl_pending_read, // waiting for SSL thread to complete reading
- ssl_writing_done, // SSL write completed, results are ready
- ssl_reading_done // SSL read completed, results are ready
- };
-
- ssl_state mSSLState;
-
- // Used to transport I/O error codes between SSL thread
- // and initial caller thread.
- PRErrorCode mPRErrorCode;
-
- // A buffer used to transfer I/O data between threads
- char *mSSLDataBuffer;
- PRInt32 mSSLDataBufferAllocatedSize;
-
- // The amount requested to read or write by the caller.
- PRInt32 mSSLRequestedTransferAmount;
-
- // A pointer into our buffer, to the first byte
- // that has not yet been delivered to the caller.
- // Necessary, as the caller of the read function
- // might request smaller chunks.
- const char *mSSLRemainingReadResultData;
-
- // The caller previously requested to read or write.
- // As the initial request to read or write is defered,
- // the caller might (in theory) request smaller chunks
- // in subsequent calls.
- // This variable stores the amount of bytes successfully
- // transfered, that have not yet been reported to the caller.
- PRInt32 mSSLResultRemainingBytes;
-
- // When defering SSL read/write activity to another thread,
- // we switch the SSL level file descriptor of the original
- // layered file descriptor to a pollable event,
- // so we can wake up the original caller of the I/O function
- // as soon as data is ready.
- // This variable is used to save the SSL level file descriptor,
- // to allow us to restore the original file descriptor layering.
- PRFileDesc *mReplacedSSLFileDesc;
-
- PRBool mOneBytePendingFromEarlierWrite;
- unsigned char mThePendingByte;
- PRInt32 mOriginalRequestedTransferAmount;
-};
-
-class nsNSSSocketInfo : public nsITransportSecurityInfo,
- public nsISSLSocketControl,
- public nsIInterfaceRequestor,
- public nsISSLStatusProvider,
- public nsIIdentityInfo,
- public nsIAssociatedContentSecurity,
- public nsISerializable,
- public nsIClassInfo,
- public nsIClientAuthUserDecision,
- public nsNSSShutDownObject,
- public nsOnPK11LogoutCancelObject
-{
-public:
- nsNSSSocketInfo();
- virtual ~nsNSSSocketInfo();
-
- NS_DECL_ISUPPORTS
- NS_DECL_NSITRANSPORTSECURITYINFO
- NS_DECL_NSISSLSOCKETCONTROL
- NS_DECL_NSIINTERFACEREQUESTOR
- NS_DECL_NSISSLSTATUSPROVIDER
- NS_DECL_NSIIDENTITYINFO
- NS_DECL_NSIASSOCIATEDCONTENTSECURITY
- NS_DECL_NSISERIALIZABLE
- NS_DECL_NSICLASSINFO
- NS_DECL_NSICLIENTAUTHUSERDECISION
-
- nsresult SetSecurityState(PRUint32 aState);
- nsresult SetShortSecurityDescription(const PRUnichar *aText);
- nsresult SetErrorMessage(const PRUnichar *aText);
-
- nsresult SetForSTARTTLS(PRBool aForSTARTTLS);
- nsresult GetForSTARTTLS(PRBool *aForSTARTTLS);
-
- nsresult GetFileDescPtr(PRFileDesc** aFilePtr);
- nsresult SetFileDescPtr(PRFileDesc* aFilePtr);
-
- nsresult GetHandshakePending(PRBool *aHandshakePending);
- nsresult SetHandshakePending(PRBool aHandshakePending);
-
- nsresult GetHostName(char **aHostName);
- nsresult SetHostName(const char *aHostName);
-
- nsresult GetPort(PRInt32 *aPort);
- nsresult SetPort(PRInt32 aPort);
-
- nsresult GetCert(nsIX509Cert** _result);
- nsresult SetCert(nsIX509Cert *aCert);
-
- nsresult GetPreviousCert(nsIX509Cert** _result);
-
- void SetCanceled(PRBool aCanceled);
- PRBool GetCanceled();
-
- void SetHasCleartextPhase(PRBool aHasCleartextPhase);
- PRBool GetHasCleartextPhase();
-
- void SetHandshakeInProgress(PRBool aIsIn);
- PRBool GetHandshakeInProgress() { return mHandshakeInProgress; }
- PRBool HandshakeTimeout();
-
- void SetAllowTLSIntoleranceTimeout(PRBool aAllow);
-
- nsresult GetExternalErrorReporting(PRBool* state);
- nsresult SetExternalErrorReporting(PRBool aState);
-
- nsresult RememberCAChain(CERTCertList *aCertList);
-
- /* Set SSL Status values */
- nsresult SetSSLStatus(nsSSLStatus *aSSLStatus);
- nsSSLStatus* SSLStatus() { return mSSLStatus; }
- PRBool hasCertErrors();
-
- PRStatus CloseSocketAndDestroy();
-
-protected:
- nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
- PRFileDesc* mFd;
- nsCOMPtr<nsIX509Cert> mCert;
- nsCOMPtr<nsIX509Cert> mPreviousCert; // DocShellDependent
- enum {
- blocking_state_unknown, is_nonblocking_socket, is_blocking_socket
- } mBlockingState;
- PRUint32 mSecurityState;
- PRInt32 mSubRequestsHighSecurity;
- PRInt32 mSubRequestsLowSecurity;
- PRInt32 mSubRequestsBrokenSecurity;
- PRInt32 mSubRequestsNoSecurity;
- nsString mShortDesc;
- nsString mErrorMessage;
- PRPackedBool mDocShellDependentStuffKnown;
- PRPackedBool mExternalErrorReporting; // DocShellDependent
- PRPackedBool mForSTARTTLS;
- PRPackedBool mHandshakePending;
- PRPackedBool mCanceled;
- PRPackedBool mHasCleartextPhase;
- PRPackedBool mHandshakeInProgress;
- PRPackedBool mAllowTLSIntoleranceTimeout;
- PRPackedBool mRememberClientAuthCertificate;
- PRIntervalTime mHandshakeStartTime;
- PRInt32 mPort;
- nsXPIDLCString mHostName;
-
- /* SSL Status */
- nsRefPtr<nsSSLStatus> mSSLStatus;
-
- nsresult ActivateSSL();
-
- nsSSLSocketThreadData *mThreadData;
- nsCString mClientLogin;
-
- nsresult EnsureDocShellDependentStuffKnown();
-
-private:
- virtual void virtualDestroyNSSReference();
- void destructorSafeDestroyNSSReference();
-
-friend class nsSSLThread;
-};
-
-class nsCStringHashSet;
-
-class nsSSLStatus;
-class nsNSSSocketInfo;
-
-class nsPSMRememberCertErrorsTable
-{
-private:
- struct CertStateBits
- {
- PRBool mIsDomainMismatch;
- PRBool mIsNotValidAtThisTime;
- PRBool mIsUntrusted;
- };
- nsDataHashtableMT<nsCStringHashKey, CertStateBits> mErrorHosts;
- nsresult GetHostPortKey(nsNSSSocketInfo* infoObject, nsCAutoString& result);
-
-public:
- friend class nsSSLIOLayerHelpers;
- nsPSMRememberCertErrorsTable();
- void RememberCertHasError(nsNSSSocketInfo* infoObject,
- nsSSLStatus* status,
- SECStatus certVerificationResult);
- void LookupCertErrorBits(nsNSSSocketInfo* infoObject,
- nsSSLStatus* status);
-};
-
-class nsSSLIOLayerHelpers
-{
-public:
- static nsresult Init();
- static void Cleanup();
-
- static PRBool nsSSLIOLayerInitialized;
- static PRDescIdentity nsSSLIOLayerIdentity;
- static PRIOMethods nsSSLIOLayerMethods;
-
- static PRLock *mutex;
- static nsCStringHashSet *mTLSIntolerantSites;
- static nsCStringHashSet *mTLSTolerantSites;
- static nsPSMRememberCertErrorsTable* mHostsWithCertErrors;
-
- static nsCStringHashSet *mRenegoUnrestrictedSites;
- static PRBool mTreatUnsafeNegotiationAsBroken;
-
- static void setTreatUnsafeNegotiationAsBroken(PRBool broken);
- static PRBool treatUnsafeNegotiationAsBroken();
-
- static void getSiteKey(nsNSSSocketInfo *socketInfo, nsCSubstring &key);
- static PRBool rememberPossibleTLSProblemSite(PRFileDesc* fd, nsNSSSocketInfo *socketInfo);
- static void rememberTolerantSite(PRFileDesc* ssl_layer_fd, nsNSSSocketInfo *socketInfo);
-
- static void addIntolerantSite(const nsCString &str);
- static void removeIntolerantSite(const nsCString &str);
- static PRBool isKnownAsIntolerantSite(const nsCString &str);
-
- static void setRenegoUnrestrictedSites(const nsCString &str);
- static PRBool isRenegoUnrestrictedSite(const nsCString &str);
-
- static PRFileDesc *mSharedPollableEvent;
- static nsNSSSocketInfo *mSocketOwningPollableEvent;
-
- static PRBool mPollableEventCurrentlySet;
-};
-
-nsresult nsSSLIOLayerNewSocket(PRInt32 family,
- const char *host,
- PRInt32 port,
- const char *proxyHost,
- PRInt32 proxyPort,
- PRFileDesc **fd,
- nsISupports **securityInfo,
- PRBool forSTARTTLS,
- PRBool anonymousLoad);
-
-nsresult nsSSLIOLayerAddToSocket(PRInt32 family,
- const char *host,
- PRInt32 port,
- const char *proxyHost,
- PRInt32 proxyPort,
- PRFileDesc *fd,
- nsISupports **securityInfo,
- PRBool forSTARTTLS,
- PRBool anonymousLoad);
-
-nsresult nsSSLIOLayerFreeTLSIntolerantSites();
-nsresult displayUnknownCertErrorAlert(nsNSSSocketInfo *infoObject, int error);
-
-// 16786594-0296-4471-8096-8f84497ca428
-#define NS_NSSSOCKETINFO_CID \
-{ 0x16786594, 0x0296, 0x4471, \
- { 0x80, 0x96, 0x8f, 0x84, 0x49, 0x7c, 0xa4, 0x28 } }
-
-
-#endif /* _NSNSSIOLAYER_H */
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-\r
+ *\r
+ * ***** BEGIN LICENSE BLOCK *****\r
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1\r
+ *\r
+ * The contents of this file are subject to the Mozilla Public License Version\r
+ * 1.1 (the "License"); you may not use this file except in compliance with\r
+ * the License. You may obtain a copy of the License at\r
+ * http://www.mozilla.org/MPL/\r
+ *\r
+ * Software distributed under the License is distributed on an "AS IS" basis,\r
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License\r
+ * for the specific language governing rights and limitations under the\r
+ * License.\r
+ *\r
+ * The Original Code is mozilla.org code.\r
+ *\r
+ * The Initial Developer of the Original Code is\r
+ * Netscape Communications Corporation.\r
+ * Portions created by the Initial Developer are Copyright (C) 1998\r
+ * the Initial Developer. All Rights Reserved.\r
+ *\r
+ * Contributor(s):\r
+ * Brian Ryner <bryner@brianryner.com>\r
+ * Kai Engert <kengert@redhat.com>\r
+ * Copyright (c) 2010 CASSIDIAN - All rights reserved\r
+ *\r
+ * Alternatively, the contents of this file may be used under the terms of\r
+ * either the GNU General Public License Version 2 or later (the "GPL"), or\r
+ * 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
+ * ***** END LICENSE BLOCK ***** */\r
+\r
+#ifndef _NSNSSIOLAYER_H\r
+#define _NSNSSIOLAYER_H\r
+\r
+#include "prtypes.h"\r
+#include "prio.h"\r
+#include "certt.h"\r
+#include "nsString.h"\r
+#include "nsIInterfaceRequestor.h"\r
+#include "nsIInterfaceRequestorUtils.h"\r
+#include "nsITransportSecurityInfo.h"\r
+#include "nsISSLSocketControl.h"\r
+#include "nsSSLStatus.h"\r
+#include "nsISSLStatusProvider.h"\r
+#include "nsIIdentityInfo.h"\r
+#include "nsIAssociatedContentSecurity.h"\r
+#include "nsXPIDLString.h"\r
+#include "nsNSSShutDown.h"\r
+#include "nsIClientAuthDialogs.h"\r
+#include "nsAutoPtr.h"\r
+#include "nsNSSCertificate.h"\r
+#include "nsDataHashtable.h"\r
+\r
+class nsIChannel;\r
+class nsSSLThread;\r
+\r
+/*\r
+ * This class is used to store SSL socket I/O state information,\r
+ * that is not being executed directly, but defered to \r
+ * the separate SSL thread.\r
+ */\r
+class nsSSLSocketThreadData\r
+{\r
+public:\r
+ nsSSLSocketThreadData();\r
+ ~nsSSLSocketThreadData();\r
+\r
+ PRBool ensure_buffer_size(PRInt32 amount);\r
+ \r
+ enum ssl_state { \r
+ ssl_invalid, // used for initializating, should never occur\r
+ ssl_idle, // not in use by SSL thread, no activity pending\r
+ ssl_pending_write, // waiting for SSL thread to complete writing\r
+ ssl_pending_read, // waiting for SSL thread to complete reading\r
+ ssl_writing_done, // SSL write completed, results are ready\r
+ ssl_reading_done // SSL read completed, results are ready\r
+ };\r
+ \r
+ ssl_state mSSLState;\r
+\r
+ // Used to transport I/O error codes between SSL thread\r
+ // and initial caller thread.\r
+ PRErrorCode mPRErrorCode;\r
+\r
+ // A buffer used to transfer I/O data between threads\r
+ char *mSSLDataBuffer;\r
+ PRInt32 mSSLDataBufferAllocatedSize;\r
+\r
+ // The amount requested to read or write by the caller.\r
+ PRInt32 mSSLRequestedTransferAmount;\r
+\r
+ // A pointer into our buffer, to the first byte\r
+ // that has not yet been delivered to the caller.\r
+ // Necessary, as the caller of the read function\r
+ // might request smaller chunks.\r
+ const char *mSSLRemainingReadResultData;\r
+ \r
+ // The caller previously requested to read or write.\r
+ // As the initial request to read or write is defered,\r
+ // the caller might (in theory) request smaller chunks\r
+ // in subsequent calls.\r
+ // This variable stores the amount of bytes successfully\r
+ // transfered, that have not yet been reported to the caller.\r
+ PRInt32 mSSLResultRemainingBytes;\r
+\r
+ // When defering SSL read/write activity to another thread,\r
+ // we switch the SSL level file descriptor of the original\r
+ // layered file descriptor to a pollable event,\r
+ // so we can wake up the original caller of the I/O function\r
+ // as soon as data is ready.\r
+ // This variable is used to save the SSL level file descriptor,\r
+ // to allow us to restore the original file descriptor layering.\r
+ PRFileDesc *mReplacedSSLFileDesc;\r
+\r
+ PRBool mOneBytePendingFromEarlierWrite;\r
+ unsigned char mThePendingByte;\r
+ PRInt32 mOriginalRequestedTransferAmount;\r
+};\r
+\r
+class nsNSSSocketInfo : public nsITransportSecurityInfo,\r
+ public nsISSLSocketControl,\r
+ public nsIInterfaceRequestor,\r
+ public nsISSLStatusProvider,\r
+ public nsIIdentityInfo,\r
+ public nsIAssociatedContentSecurity,\r
+ public nsISerializable,\r
+ public nsIClassInfo,\r
+ public nsIClientAuthUserDecision,\r
+ public nsNSSShutDownObject,\r
+ public nsOnPK11LogoutCancelObject\r
+{\r
+public:\r
+ nsNSSSocketInfo();\r
+ virtual ~nsNSSSocketInfo();\r
+ \r
+ NS_DECL_ISUPPORTS\r
+ NS_DECL_NSITRANSPORTSECURITYINFO\r
+ NS_DECL_NSISSLSOCKETCONTROL\r
+ NS_DECL_NSIINTERFACEREQUESTOR\r
+ NS_DECL_NSISSLSTATUSPROVIDER\r
+ NS_DECL_NSIIDENTITYINFO\r
+ NS_DECL_NSIASSOCIATEDCONTENTSECURITY\r
+ NS_DECL_NSISERIALIZABLE\r
+ NS_DECL_NSICLASSINFO\r
+ NS_DECL_NSICLIENTAUTHUSERDECISION\r
+\r
+ nsresult SetSecurityState(PRUint32 aState);\r
+ nsresult SetShortSecurityDescription(const PRUnichar *aText);\r
+ nsresult SetErrorMessage(const PRUnichar *aText);\r
+\r
+ nsresult SetForSTARTTLS(PRBool aForSTARTTLS);\r
+ nsresult GetForSTARTTLS(PRBool *aForSTARTTLS);\r
+\r
+ nsresult GetFileDescPtr(PRFileDesc** aFilePtr);\r
+ nsresult SetFileDescPtr(PRFileDesc* aFilePtr);\r
+\r
+ nsresult GetHandshakePending(PRBool *aHandshakePending);\r
+ nsresult SetHandshakePending(PRBool aHandshakePending);\r
+\r
+ nsresult GetHostName(char **aHostName);\r
+ nsresult SetHostName(const char *aHostName);\r
+\r
+ nsresult GetPort(PRInt32 *aPort);\r
+ nsresult SetPort(PRInt32 aPort);\r
+\r
+ nsresult GetCert(nsIX509Cert** _result);\r
+ nsresult SetCert(nsIX509Cert *aCert);\r
+\r
+ nsresult GetPreviousCert(nsIX509Cert** _result);\r
+\r
+ void SetCanceled(PRBool aCanceled);\r
+ PRBool GetCanceled();\r
+ \r
+ void SetHasCleartextPhase(PRBool aHasCleartextPhase);\r
+ PRBool GetHasCleartextPhase();\r
+ \r
+ void SetHandshakeInProgress(PRBool aIsIn);\r
+ PRBool GetHandshakeInProgress() { return mHandshakeInProgress; }\r
+ PRBool HandshakeTimeout();\r
+\r
+ void SetAllowTLSIntoleranceTimeout(PRBool aAllow);\r
+\r
+ nsresult GetExternalErrorReporting(PRBool* state);\r
+ nsresult SetExternalErrorReporting(PRBool aState);\r
+\r
+ nsresult RememberCAChain(CERTCertList *aCertList);\r
+\r
+ /* Set SSL Status values */\r
+ nsresult SetSSLStatus(nsSSLStatus *aSSLStatus);\r
+ nsSSLStatus* SSLStatus() { return mSSLStatus; }\r
+ PRBool hasCertErrors();\r
+ \r
+ PRStatus CloseSocketAndDestroy();\r
+ \r
+protected:\r
+ nsCOMPtr<nsIInterfaceRequestor> mCallbacks;\r
+ PRFileDesc* mFd;\r
+ nsCOMPtr<nsIX509Cert> mCert;\r
+ nsCOMPtr<nsIX509Cert> mPreviousCert; // DocShellDependent\r
+ enum { \r
+ blocking_state_unknown, is_nonblocking_socket, is_blocking_socket \r
+ } mBlockingState;\r
+ PRUint32 mSecurityState;\r
+ PRInt32 mSubRequestsHighSecurity;\r
+ PRInt32 mSubRequestsLowSecurity;\r
+ PRInt32 mSubRequestsBrokenSecurity;\r
+ PRInt32 mSubRequestsNoSecurity;\r
+ nsString mShortDesc;\r
+ nsString mErrorMessage;\r
+ PRPackedBool mDocShellDependentStuffKnown;\r
+ PRPackedBool mExternalErrorReporting; // DocShellDependent\r
+ PRPackedBool mForSTARTTLS;\r
+ PRPackedBool mHandshakePending;\r
+ PRPackedBool mCanceled;\r
+ PRPackedBool mHasCleartextPhase;\r
+ PRPackedBool mHandshakeInProgress;\r
+ PRPackedBool mAllowTLSIntoleranceTimeout;\r
+ PRPackedBool mRememberClientAuthCertificate;\r
+ PRIntervalTime mHandshakeStartTime;\r
+ PRInt32 mPort;\r
+ nsXPIDLCString mHostName;\r
+\r
+ /* SSL Status */\r
+ nsRefPtr<nsSSLStatus> mSSLStatus;\r
+\r
+ nsresult ActivateSSL();\r
+\r
+ nsSSLSocketThreadData *mThreadData;\r
+ nsCString mClientLogin;\r
+\r
+ nsresult EnsureDocShellDependentStuffKnown();\r
+\r
+private:\r
+ virtual void virtualDestroyNSSReference();\r
+ void destructorSafeDestroyNSSReference();\r
+\r
+friend class nsSSLThread;\r
+};\r
+\r
+class nsCStringHashSet;\r
+\r
+class nsSSLStatus;\r
+class nsNSSSocketInfo;\r
+\r
+class nsPSMRememberCertErrorsTable\r
+{\r
+private:\r
+ struct CertStateBits\r
+ {\r
+ PRBool mIsDomainMismatch;\r
+ PRBool mIsNotValidAtThisTime;\r
+ PRBool mIsUntrusted;\r
+ };\r
+ nsDataHashtableMT<nsCStringHashKey, CertStateBits> mErrorHosts;\r
+ nsresult GetHostPortKey(nsNSSSocketInfo* infoObject, nsCAutoString& result);\r
+\r
+public:\r
+ friend class nsSSLIOLayerHelpers;\r
+ nsPSMRememberCertErrorsTable();\r
+ void RememberCertHasError(nsNSSSocketInfo* infoObject,\r
+ nsSSLStatus* status,\r
+ SECStatus certVerificationResult);\r
+ void LookupCertErrorBits(nsNSSSocketInfo* infoObject,\r
+ nsSSLStatus* status);\r
+};\r
+\r
+class nsSSLIOLayerHelpers\r
+{\r
+public:\r
+ static nsresult Init();\r
+ static void Cleanup();\r
+\r
+ static PRBool nsSSLIOLayerInitialized;\r
+ static PRDescIdentity nsSSLIOLayerIdentity;\r
+ static PRIOMethods nsSSLIOLayerMethods;\r
+\r
+ static PRLock *mutex;\r
+ static nsCStringHashSet *mTLSIntolerantSites;\r
+ static nsCStringHashSet *mTLSTolerantSites;\r
+ static nsPSMRememberCertErrorsTable* mHostsWithCertErrors;\r
+\r
+ static nsCStringHashSet *mRenegoUnrestrictedSites;\r
+ static PRBool mTreatUnsafeNegotiationAsBroken;\r
+\r
+ static void setTreatUnsafeNegotiationAsBroken(PRBool broken);\r
+ static PRBool treatUnsafeNegotiationAsBroken();\r
+\r
+ static void getSiteKey(nsNSSSocketInfo *socketInfo, nsCSubstring &key);\r
+ static PRBool rememberPossibleTLSProblemSite(PRFileDesc* fd, nsNSSSocketInfo *socketInfo);\r
+ static void rememberTolerantSite(PRFileDesc* ssl_layer_fd, nsNSSSocketInfo *socketInfo);\r
+\r
+ static void addIntolerantSite(const nsCString &str);\r
+ static void removeIntolerantSite(const nsCString &str);\r
+ static PRBool isKnownAsIntolerantSite(const nsCString &str);\r
+\r
+ static void setRenegoUnrestrictedSites(const nsCString &str);\r
+ static PRBool isRenegoUnrestrictedSite(const nsCString &str);\r
+\r
+ static PRFileDesc *mSharedPollableEvent;\r
+ static nsNSSSocketInfo *mSocketOwningPollableEvent;\r
+ \r
+ static PRBool mPollableEventCurrentlySet;\r
+};\r
+\r
+nsresult nsSSLIOLayerNewSocket(PRInt32 family,\r
+ const char *host,\r
+ PRInt32 port,\r
+ const char *proxyHost,\r
+ PRInt32 proxyPort,\r
+ PRFileDesc **fd,\r
+ nsISupports **securityInfo,\r
+ PRBool forSTARTTLS,\r
+ PRBool anonymousLoad);\r
+\r
+nsresult nsSSLIOLayerAddToSocket(PRInt32 family,\r
+ const char *host,\r
+ PRInt32 port,\r
+ const char *proxyHost,\r
+ PRInt32 proxyPort,\r
+ PRFileDesc *fd,\r
+ nsISupports **securityInfo,\r
+ PRBool forSTARTTLS,\r
+ PRBool anonymousLoad);\r
+\r
+nsresult nsSSLIOLayerFreeTLSIntolerantSites();\r
+nsresult displayUnknownCertErrorAlert(nsNSSSocketInfo *infoObject, int error);\r
+\r
+// 16786594-0296-4471-8096-8f84497ca428\r
+#define NS_NSSSOCKETINFO_CID \\r
+{ 0x16786594, 0x0296, 0x4471, \\r
+ { 0x80, 0x96, 0x8f, 0x84, 0x49, 0x7c, 0xa4, 0x28 } }\r
+\r
+\r
+#endif /* _NSNSSIOLAYER_H */\r
/*
* CMS decoding.
*
- * $Id: cmsdecode.c,v 1.9 2006/08/05 01:19:23 julien.pierre.bugs%sun.com Exp $
+ * $Id: cmsdecode.c,v 1.9.66.1 2010/12/23 18:03:41 kaie%kuix.de Exp $
*/
#include "cmslocal.h"
PORT_Assert ((data != NULL && len) || final);
cinfo = NSS_CMSContent_GetContentInfo(p7dcx->content.pointer, p7dcx->type);
+ if (!cinfo) {
+ /* The original programmer didn't expect this to happen */
+ p7dcx->error = SEC_ERROR_LIBRARY_FAILURE;
+ goto loser;
+ }
if (cinfo->ciphcx != NULL) {
/*
/*
* CMS encoding.
*
- * $Id: cmsencode.c,v 1.6 2006/06/08 22:01:02 nelson%bolyard.com Exp $
+ * $Id: cmsencode.c,v 1.6.66.1 2010/12/23 18:03:41 kaie%kuix.de Exp $
*/
#include "cmslocal.h"
/* we got data (either from the caller, or from a lower level encoder) */
cinfo = NSS_CMSContent_GetContentInfo(p7ecx->content.pointer, p7ecx->type);
+ if (!cinfo) {
+ /* The original programmer didn't expect this to happen */
+ p7ecx->error = SEC_ERROR_LIBRARY_FAILURE;
+ return SECFailure;
+ }
/* Update the running digest. */
if (len && cinfo->digcx != NULL)
/* we are at innermost decoder */
/* find out about our inner content type - must be data */
cinfo = NSS_CMSContent_GetContentInfo(p7ecx->content.pointer, p7ecx->type);
+ if (!cinfo) {
+ /* The original programmer didn't expect this to happen */
+ p7ecx->error = SEC_ERROR_LIBRARY_FAILURE;
+ return SECFailure;
+ }
+
childtype = NSS_CMSContentInfo_GetContentTypeTag(cinfo);
if (childtype != SEC_OID_PKCS7_DATA && childtype != SEC_OID_SMIME_RECEIPT)
return SECFailure;
/* find out about our inner content type - must be data */
cinfo = NSS_CMSContent_GetContentInfo(p7ecx->content.pointer, p7ecx->type);
+ if (!cinfo) {
+ /* The original programmer didn't expect this to happen */
+ p7ecx->error = SEC_ERROR_LIBRARY_FAILURE;
+ rv = SECFailure;
+ goto loser;
+ }
childtype = NSS_CMSContentInfo_GetContentTypeTag(cinfo);
if ((childtype == SEC_OID_PKCS7_DATA || childtype == SEC_OID_SMIME_RECEIPT) && cinfo->content.data == NULL) {
SEC_ASN1EncoderClearTakeFromBuf(p7ecx->ecx);
#
CantDecryptTitle=%brand% cannot decrypt this message
CantDecryptBody=The sender encrypted this message to you using one of your digital certificates, however %brand% was not able to find this certificate and corresponding private key. <br> Possible solutions: <br><ul><li>If you have a smartcard, please insert it now. <li>If you are using a new machine, or if you are using a new %brand% profile, you will need to restore your certificate and private key from a backup. Certificate backups usually end in ".p12".</ul>
-secureinfomsg_default=L\u0027int\u00E9grit\u00E9 du message est potentiellement corrompue
+secureinfomsg_default=L\u0027int\u00E9grit\u00E9 du message est corrompue
secureinfomsgmore_default=Assurez vous que le message provient d\u0027un \u00E9metteur de confiance
secureinfomsg_ok=L\u0027int\u00E9grit\u00E9 du message est assur\u00E9e
secureinfomsgmore_ok=
secureinfomsg_notok=La signature de ce message n\u0027est pas valide
-secureinfomsgmore_notok=plusieurs causes possibles : le contenu du message a \u00E9t\u00E9 modifi\u00E9 ou la signature a \u00E9t\u00E9 modifi\u00E9e ou l\u0027\u00E9metteur du message a pu \u00eatre modifi\u00E9
-secureinfomsg_hdrnok=Un des champs d\u0027ent\u00eate a \u00E9t\u00E9 modifi\u00E9
\ No newline at end of file
+secureinfomsgmore_notok=plusieurs causes possibles : le contenu du message a \u00E9t\u00E9 modifi\u00E9, la signature a \u00E9t\u00E9 modifi\u00E9e, l\u0027\u00E9metteur du message a pu \u00eatre modifi\u00E9
+secureinfomsg_hdrnok=Un des champs d\u0027ent\u00eate a \u00E9t\u00E9 modifi\u00E9
+secureinfomsg_unsecured=Ce message n\u0027est pas s\u00E9curis\u00E9
-<!ENTITY pane.title "Entêtes Sécurisés">
-<!ENTITY secureHeaderFolderPicker.label "Fichier des entêtes sécurisés">
-<!ENTITY secureHeaderPath.label "Fichier des entêtes sécurisés">
-<!ENTITY browseFolder.label "Parcourir...">
-<!ENTITY browseFolder.accesskey "P">
-<!ENTITY useSecureHeaders.label "Activer les entêtes sécurises pour ce compte">
-<!ENTITY secureHeadersDescription.label "Définition des entêtes sécurisés">
-<!ENTITY secureHeadersDatas.label "Entêtes sécurisés" >
+<!ENTITY pane.title "Entêtes Sécurisés">\r
+<!ENTITY secureHeaderFolderPicker.label "Fichier des entêtes sécurisés">\r
+<!ENTITY secureHeaderPath.label "Fichier des entêtes sécurisés">\r
+<!ENTITY browseFolder.label "Parcourir...">\r
+<!ENTITY browseFolder.accesskey "P">\r
+<!ENTITY useSecureHeaders.label "Activer les entêtes sécurises pour ce compte">\r
+<!ENTITY secureHeadersDescription.label "Définition des entêtes sécurisés">\r
+<!ENTITY secureHeadersDatas.label "Entêtes sécurisés" >\r
<!ENTITY smime.am.infomsg.label "Indiquer l'état de sécurité de chaque message">
\ No newline at end of file
-# ***** 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 *****
-# Strings used in the Mozill AccountManager
-prefPanel-secureheaders=Ent\u00EAtes S\u00E9curis\u00E9s
-
+# ***** 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
+# Strings used in the Mozill AccountManager\r
+prefPanel-secureheaders=Ent\u00EAtes S\u00E9curis\u00E9s\r
+\r
-<!-- extracted from am-server-top.xul -->
-
-<!ENTITY securitySettings.label "Paramètres de sécurité">
-<!ENTITY serverSettings.label "Paramètres du serveur">
-<!ENTITY serverType.label "Type de serveur :">
-<!ENTITY serverName.label "Nom du serveur :">
-<!ENTITY serverName.accesskey "N">
-<!ENTITY userName.label "Nom d'utilisateur :">
-<!ENTITY userName.accesskey "o">
-<!ENTITY port.label "Port :">
-<!ENTITY port.accesskey "P">
-<!ENTITY serverPortDefault.label "Défaut :">
-<!-- LOCALIZATION NOTE (biffStart.label) : translate below 2 line with grammer dependency
- For example, in Japanese cases:
- biffStart.label "every"
- biffEnd.label "minutes for new messages Check"
--->
-<!ENTITY biffStart.label "Vérifier les nouveaux messages toutes les ">
-<!ENTITY biffStart.accesskey "V">
-<!ENTITY biffEnd.label "minutes">
-<!ENTITY connectionSecurity.label "Sécurité de la connexion :">
-<!ENTITY connectionSecurity.accesskey "S">
-<!ENTITY connectionSecurityType-0.label "Aucune">
-<!ENTITY connectionSecurityType-1.label "STARTTLS, si disponible">
-<!ENTITY connectionSecurityType-2.label "STARTTLS">
-<!ENTITY connectionSecurityType-3.label "SSL/TLS">
-<!ENTITY authMethod.label "Méthode d'authentification :">
-<!ENTITY authMethod.accesskey "i">
-<!ENTITY leaveOnServer.label "Laisser les messages sur le serveur">
-<!ENTITY leaveOnServer.accesskey "g">
-<!ENTITY headersOnly.label "Télécharger uniquement les en-têtes">
-<!ENTITY headersOnly.accesskey "e">
-<!ENTITY deleteByAgeFromServer.label "Pendant au maximum">
-<!ENTITY deleteByAgeFromServer.accesskey "x">
-<!ENTITY daysEnd.label "jours">
-<!ENTITY deleteOnServer2.label "Jusqu'Ã ce que je les supprime ">
-<!ENTITY deleteOnServer2.accesskey "u">
-<!ENTITY downloadOnBiff.label "Télécharger automatiquement les nouveaux messages">
-<!ENTITY downloadOnBiff.accesskey "m">
-<!ENTITY username.label "Votre nom de connexion">
-<!ENTITY deleteMessagePrefix.label "Lorsque je supprime un message :">
-<!ENTITY modelMoveToTrash.label "le mettre dans ce dossier :">
-<!ENTITY modelMoveToTrash.accesskey "o">
-<!ENTITY modelMarkDeleted.label "le marquer comme supprimé">
-<!ENTITY modelMarkDeleted.accesskey "q">
-<!ENTITY modelDeleteImmediately.label "le supprimer immédiatement">
-<!ENTITY modelDeleteImmediately.accesskey "d">
-<!-- LOCALIZATION NOTE (expungeOnExit.label) : do not translate two of """ in below line -->
-<!ENTITY expungeOnExit.label "Nettoyer le dossier « Courrier entrant » en quittant.">
-<!ENTITY expungeOnExit.accesskey "y">
-<!ENTITY emptyTrashOnExit.label "Vider la corbeille en quittant">
-<!ENTITY emptyTrashOnExit.accesskey "b">
-<!ENTITY loginAtStartup.label "Vérifier le courrier au lancement">
-<!ENTITY loginAtStartup.accesskey "r">
-<!-- LOCALIZATION NOTE (maxMessagesStart.label) : translate below 2 lines with grammar dependency
- maxMessengerStart.label will be followed by maxMessagesEnd.label with the number
- of messages between them
--->
-<!ENTITY maxMessagesStart.label "Me demander avant de télécharger plus de ">
-<!ENTITY maxMessagesStart.accesskey "t">
-<!-- LOCALIZATION NOTE (maxMessagesEnd.label) : see note for maxMessagesStart.label -->
-<!ENTITY maxMessagesEnd.label "messages.">
-<!ENTITY alwaysAuthenticate.label "Toujours demander une authentification lors de la connexion à ce serveur">
-<!ENTITY alwaysAuthenticate.accesskey "j">
-<!ENTITY newsrcFilePath.label "Fichier newsrc :">
-<!ENTITY localPath.label "Répertoire local :">
-<!ENTITY abbreviate.label "Afficher les noms des groupes de discussion dans le panneau des dossiers de courrier comme :">
-<!ENTITY abbreviateOn.label "des noms complets (par exemple « mozilla.dev.apps.thunderbird »)">
-<!ENTITY abbreviateOff.label "des noms abrégés (par exemple « m.d.a.thunderbird »)">
-<!ENTITY advancedButton.label "Avancés…">
-<!ENTITY advancedButton.accesskey "s">
-<!ENTITY serverDefaultCharset.label "Encodage de caractères par défaut :">
-<!ENTITY localFolderPicker.label "Sélection du répertoire local">
-<!ENTITY browseFolder.label "Parcourir…">
-<!ENTITY browseFolder.accesskey "P">
-<!ENTITY newsrcPicker.label "Sélectionner un fichier newsrc">
-<!ENTITY browseNewsrc.label "Parcourir…">
-<!ENTITY browseNewsrc.accesskey "a">
-<!ENTITY authByCert.label "Authentification par certificat, si possible">
-<!ENTITY authByCert.accesskey "c">
+<!-- extracted from am-server-top.xul -->\r
+\r
+<!ENTITY securitySettings.label "Paramètres de sécurité">\r
+<!ENTITY serverSettings.label "Paramètres du serveur">\r
+<!ENTITY serverType.label "Type de serveur :">\r
+<!ENTITY serverName.label "Nom du serveur :">\r
+<!ENTITY serverName.accesskey "N">\r
+<!ENTITY userName.label "Nom d'utilisateur :">\r
+<!ENTITY userName.accesskey "o">\r
+<!ENTITY port.label "Port :">\r
+<!ENTITY port.accesskey "P">\r
+<!ENTITY serverPortDefault.label "Défaut :">\r
+<!-- LOCALIZATION NOTE (biffStart.label) : translate below 2 line with grammer dependency\r
+ For example, in Japanese cases:\r
+ biffStart.label "every"\r
+ biffEnd.label "minutes for new messages Check"\r
+-->\r
+<!ENTITY biffStart.label "Vérifier les nouveaux messages toutes les ">\r
+<!ENTITY biffStart.accesskey "V">\r
+<!ENTITY biffEnd.label "minutes">\r
+<!ENTITY connectionSecurity.label "Sécurité de la connexion :">\r
+<!ENTITY connectionSecurity.accesskey "S">\r
+<!ENTITY connectionSecurityType-0.label "Aucune">\r
+<!ENTITY connectionSecurityType-1.label "STARTTLS, si disponible">\r
+<!ENTITY connectionSecurityType-2.label "STARTTLS">\r
+<!ENTITY connectionSecurityType-3.label "SSL/TLS">\r
+<!ENTITY authMethod.label "Méthode d'authentification :">\r
+<!ENTITY authMethod.accesskey "i">\r
+<!ENTITY leaveOnServer.label "Laisser les messages sur le serveur">\r
+<!ENTITY leaveOnServer.accesskey "g">\r
+<!ENTITY headersOnly.label "Télécharger uniquement les en-têtes">\r
+<!ENTITY headersOnly.accesskey "e">\r
+<!ENTITY deleteByAgeFromServer.label "Pendant au maximum">\r
+<!ENTITY deleteByAgeFromServer.accesskey "x">\r
+<!ENTITY daysEnd.label "jours">\r
+<!ENTITY deleteOnServer2.label "Jusqu'Ã ce que je les supprime ">\r
+<!ENTITY deleteOnServer2.accesskey "u">\r
+<!ENTITY downloadOnBiff.label "Télécharger automatiquement les nouveaux messages">\r
+<!ENTITY downloadOnBiff.accesskey "m">\r
+<!ENTITY username.label "Votre nom de connexion">\r
+<!ENTITY deleteMessagePrefix.label "Lorsque je supprime un message :">\r
+<!ENTITY modelMoveToTrash.label "le mettre dans ce dossier :">\r
+<!ENTITY modelMoveToTrash.accesskey "o">\r
+<!ENTITY modelMarkDeleted.label "le marquer comme supprimé">\r
+<!ENTITY modelMarkDeleted.accesskey "q">\r
+<!ENTITY modelDeleteImmediately.label "le supprimer immédiatement">\r
+<!ENTITY modelDeleteImmediately.accesskey "d">\r
+<!-- LOCALIZATION NOTE (expungeOnExit.label) : do not translate two of """ in below line -->\r
+<!ENTITY expungeOnExit.label "Nettoyer le dossier « Courrier entrant » en quittant.">\r
+<!ENTITY expungeOnExit.accesskey "y">\r
+<!ENTITY emptyTrashOnExit.label "Vider la corbeille en quittant">\r
+<!ENTITY emptyTrashOnExit.accesskey "b">\r
+<!ENTITY loginAtStartup.label "Vérifier le courrier au lancement">\r
+<!ENTITY loginAtStartup.accesskey "r">\r
+<!-- LOCALIZATION NOTE (maxMessagesStart.label) : translate below 2 lines with grammar dependency \r
+ maxMessengerStart.label will be followed by maxMessagesEnd.label with the number\r
+ of messages between them\r
+-->\r
+<!ENTITY maxMessagesStart.label "Me demander avant de télécharger plus de ">\r
+<!ENTITY maxMessagesStart.accesskey "t">\r
+<!-- LOCALIZATION NOTE (maxMessagesEnd.label) : see note for maxMessagesStart.label -->\r
+<!ENTITY maxMessagesEnd.label "messages.">\r
+<!ENTITY alwaysAuthenticate.label "Toujours demander une authentification lors de la connexion à ce serveur">\r
+<!ENTITY alwaysAuthenticate.accesskey "j">\r
+<!ENTITY newsrcFilePath.label "Fichier newsrc :">\r
+<!ENTITY localPath.label "Répertoire local :">\r
+<!ENTITY abbreviate.label "Afficher les noms des groupes de discussion dans le panneau des dossiers de courrier comme :">\r
+<!ENTITY abbreviateOn.label "des noms complets (par exemple « mozilla.dev.apps.thunderbird »)">\r
+<!ENTITY abbreviateOff.label "des noms abrégés (par exemple « m.d.a.thunderbird »)">\r
+<!ENTITY advancedButton.label "Avancés…">\r
+<!ENTITY advancedButton.accesskey "s">\r
+<!ENTITY serverDefaultCharset.label "Encodage de caractères par défaut :">\r
+<!ENTITY localFolderPicker.label "Sélection du répertoire local">\r
+<!ENTITY browseFolder.label "Parcourir…">\r
+<!ENTITY browseFolder.accesskey "P">\r
+<!ENTITY newsrcPicker.label "Sélectionner un fichier newsrc">\r
+<!ENTITY browseNewsrc.label "Parcourir…">\r
+<!ENTITY browseNewsrc.accesskey "a">\r
+<!ENTITY authByCert.label "Authentification par certificat, si possible">\r
+<!ENTITY authByCert.accesskey "c">\r
-<!ENTITY secureHeaders.name "Entêtes Sécurisés">
-<!ENTITY secureHeaders.field "Entêtes Sécurisés :">
-<!ENTITY secureHeadersView.label "Voir Les Entêtes Sécurisés">
-<!ENTITY secureHeadersList.label "Listes Des Entêtes Sécurisés">
-<!ENTITY headername.label "Entête">
-<!ENTITY headervalue.label "Valeur signée">
-<!ENTITY headerstatus.label "Statut">
-<!ENTITY headerencrypted.label "Chiffré">
-<!ENTITY headermimevalue.label "Valeur affichée">
+<!ENTITY secureHeaders.name "Entêtes Sécurisés">\r
+<!ENTITY secureHeaders.field "Entêtes Sécurisés :">\r
+<!ENTITY secureHeadersView.label "Voir Les Entêtes Sécurisés">\r
+<!ENTITY secureHeadersList.label "Listes Des Entêtes Sécurisés">\r
+<!ENTITY headername.label "Entête">\r
+<!ENTITY headervalue.label "Valeur signée">\r
+<!ENTITY headerstatus.label "Statut">\r
+<!ENTITY headerencrypted.label "Chiffré">\r
+<!ENTITY headermimevalue.label "Valeur affichée">\r
<!ENTITY headercanonisation.label "Canonicalisation">
\ No newline at end of file
-menu.secureheaders.label=S\u00E9curiser les ent\u00EAtes
-secureInfo.secureheaders.label=Ent\u00EAtes S\u00E9curis\u00E9s
-secureheaders.label=Ent\u00EAtes S\u00E9curis\u00E9s :
-yes.label=Oui
-no.label=Non
-notdefine.label=Non defini
-headerstatus.deleted.label=Supprim\u00E9
-headerstatus.duplicated.label=Dupliqu\u00E9
-headerstatus.modified.label=Modifi\u00E9
-headersecure.valid.label=Ent\u00EAtes valide
-headersecure.invalid.label=Ent\u00EAtes modifi\u00E9
-allsecureheaders.valid.label=L\u0027 int\u00E9grit\u00E9 des ent\u00EAtes est v\u00E9rifi\u00E9e
-allsecureheaders.invalid.label=Les ent\u00EAtes ont \u00E9t\u00E9 modifi\u00E9s
-headercanoniz.simple.label=Simple
+menu.secureheaders.label=S\u00E9curiser les ent\u00EAtes\r
+secureInfo.secureheaders.label=Ent\u00EAtes S\u00E9curis\u00E9s\r
+secureheaders.label=Ent\u00EAtes S\u00E9curis\u00E9s :\r
+yes.label=Oui\r
+no.label=Non\r
+notdefine.label=Non defini\r
+headerstatus.deleted.label=Supprim\u00E9\r
+headerstatus.duplicated.label=Dupliqu\u00E9\r
+headerstatus.modified.label=Modifi\u00E9\r
+headersecure.valid.label=Ent\u00EAtes valide\r
+headersecure.invalid.label=Ent\u00EAtes modifi\u00E9\r
+allsecureheaders.valid.label=L\u0027 int\u00E9grit\u00E9 des ent\u00EAtes est v\u00E9rifi\u00E9e\r
+allsecureheaders.invalid.label=Les ent\u00EAtes ont \u00E9t\u00E9 modifi\u00E9s\r
+headercanoniz.simple.label=Simple\r
headercanoniz.relaxed.label=Relach\u00E9
\ No newline at end of file
<Description about="urn:mozilla:install-manifest"
em:id="trustedbird3.1_l10n_fr@trustedbird.org"
em:name="Trustedbird 3.1 French Language Pack"
- em:version="3.1.1195.1+0.3.0"
+ em:version="3.1.1195.1+0.3.1"
em:type="8"
em:creator="L'equipe FrenchMozilla">
+++ /dev/null
-/* ***** 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 ***** */
-var gConsole = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
-var gJSLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].createInstance(Components.interfaces.mozIJSSubScriptLoader);
-
-gJSLoader.loadSubScript("chrome://ximfmail/content/constant-ximfmail.js");
-
-
-/*
- * read datas of a message from an valid URI
- */
-function XimfMessageAnalyser(){
- var _mailUri = null;
- var _xHdrArray =[]; // array of ximfHdr : _ximfHdrArray[ximfHdr]
-
- function xHdr(){
- this._hdrName;
- this._hdrValue;
- }
-
- if(typeof XimfMessageAnalyser.initialized == "undefined"){
-
- XimfMessageAnalyser.prototype.setOriginalURI = function(uri){
- _mailUri = uri;
- }
- /*
- * Extract Headers fields from mail
- * Create array of {[headerName][headerValue],[headerName][headerValue],...}
- */
- XimfMessageAnalyser.prototype.createXimfHdrArray = function(){
-
- var nbBytes = 0;
- var tmpBuf = "";
- var content = "";
-
- // first try to open URI
- try{
- var cmessenger = Components.classes["@mozilla.org/messenger;1"].createInstance(Components.interfaces.nsIMessenger);
- var msgSvc = cmessenger.messageServiceFromURI(_mailUri);
-
- //var xmsgHdr = _messenger.msgHdrFromURI(gCurrentMessageUri); // ok, entetes basic de messages
- var MsgStream = Components.classes["@mozilla.org/network/sync-stream-listener;1"].createInstance();
- var consumer = MsgStream.QueryInterface(Components.interfaces.nsIInputStream);
- var ScriptInput = Components.classes["@mozilla.org/scriptableinputstream;1"].createInstance();
- var ScriptInputStream = ScriptInput.QueryInterface(Components.interfaces.nsIScriptableInputStream);
- ScriptInputStream.init(consumer);
-
- try{
- msgSvc.streamMessage(_mailUri, MsgStream, msgWindow, null, false, null);
- }catch (e){
- // can't read heafer message (bad uri...)
- gConsole.logStringMessage("[ximfmail - MessageAnalyser - createXimfHdrArray ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- return;
- }
-
- if(!ScriptInputStream) return;
- // extract headers datas of selected message
- nbBytes = ScriptInputStream.available();
- tmpBuf = ScriptInputStream.read(nbBytes);
- // RFC 2822 : The body is simply a sequence of characters that
- // follows the header and is separated from the header by an empty line
- // (i.e., a line with nothing preceding the CRLF).
- var endHdrsNlock = tmpBuf.indexOf("\r\n\r\n",0);
- if(endHdrsNlock == -1) endHdrsNlock = tmpBuf.indexOf("\n\n",0);
- if(endHdrsNlock == -1) endHdrsNlock = tmpBuf.indexOf("\r\r",0);
- if(endHdrsNlock != -1){
- content = tmpBuf.substring(0,endHdrsNlock);
- }else{
- content = tmpBuf;
- }
-
- //alert(content);
- tmpBuf = null;
- ScriptInputStream.close();
- consumer.close();
-
- }catch(e){}
-
- try{
- // _mailUri can be a path : case of open file message
- if(tmpBuf == "")
- {
- var stream = Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream);
- var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
- file.initWithPath(_mailUri);
- stream.init(file, -1, 0, 0);
-
- var ScriptInput = Components.classes["@mozilla.org/scriptableinputstream;1"].createInstance();
- var ScriptInputStream = ScriptInput.QueryInterface(Components.interfaces.nsIScriptableInputStream);
- ScriptInputStream.init(stream);
-
- //if(!ScriptInputStream) return;
- // extract headers datas of selected message
- nbBytes = ScriptInputStream.available();
- tmpBuf = ScriptInputStream.read(nbBytes);
-
- // RFC 2822 : The body is simply a sequence of characters that
- // follows the header and is separated from the header by an empty line
- // (i.e., a line with nothing preceding the CRLF).
- var endHdrsNlock = tmpBuf.indexOf("\r\n\r\n",0);
- if(endHdrsNlock == -1) endHdrsNlock = tmpBuf.indexOf("\n\n",0);
- if(endHdrsNlock == -1) endHdrsNlock = tmpBuf.indexOf("\r\r",0);
- if(endHdrsNlock != -1){
- content = tmpBuf.substring(0,endHdrsNlock);
- }else{
- content = tmpBuf;
- }
-
- tmpBuf = null;
- ScriptInputStream.close();
- stream.close();
- }
-
- //msgSvc
- var separator = new RegExp("\\r\\n|\\r|\\n", "i");// end line
- var tab = content.split(separator);
-
- // filter on IMF headers - append data to array
- if(_xHdrArray.length > 0)
- _xHdrArray.splice(0,_xHdrArray.length);
- var reg_folding = new RegExp("( )","g");
- var reg_folding2 = new RegExp("(\t)","g");
- var idxTab=0;
- for(idxTab=0; idxTab<tab.length; ++idxTab){
- var header_line = tab[idxTab];
- // search for long header fields (folding) - RFC 2822
- if(header_line[0]!= " "){
- try{
- while( idxTab < tab.length ){
- var next_line = tab[idxTab+1];
- if(next_line){
- if(next_line[0] == " " || next_line[0] == "\t"){
- header_line += next_line; //next_line.toLowerCase();
- header_line = header_line.replace(reg_folding," ");
- header_line = header_line.replace(reg_folding2,"");
- ++idxTab;
- }else{ break; }
- }else{ break; }
- }
- }catch(e){}
- }
- //gConsole.logStringMessage("[ximfmail - createXimfHdrArray - decode header line : ] \n" + header_line);
-
- // fill _ximfHdrArray
- //var lowcaseTmp = header_line.toLowerCase();
- var lowcaseTmp = header_line; //String_from_utf8(header_line).toLowerCase();
- if(lowcaseTmp.indexOf(":")!=-1){
- var xhdr = new xHdr();
- xhdr._hdrName = lowcaseTmp.substring(0,lowcaseTmp.indexOf(": ",0));
- xhdr._hdrValue = lowcaseTmp.substring(lowcaseTmp.indexOf(": ",lowcaseTmp)+2);
-
- // decode MIME Header
- xhdr._hdrValue = DecodeMimeXimfheader(xhdr._hdrValue);
-
- _xHdrArray.push(xhdr);
- //gConsole.logStringMessage("[ximfmail - MessageAnalyser - push : ] \n" + xhdr._hdrName + " :: "+xhdr._hdrValue);
- }
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - MessageAnalyser - createXimfHdrArray ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- }
- }
-
- /*
- *
- */
- XimfMessageAnalyser.prototype.getHeaderValue = function(headerName){
- var value = null;
- try{
- var tmpHead = null;
- for(var idx_xHdrArray = 0 ; idx_xHdrArray < _xHdrArray.length ; ++idx_xHdrArray){
- tmpHead = _xHdrArray[idx_xHdrArray]._hdrName;
- if(headerName.toLowerCase() == tmpHead.toLowerCase()){
- value = _xHdrArray[idx_xHdrArray]._hdrValue;
- break;
- }
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - MessageAnalyser - getHeaderValue ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- }
- return value;
- }
- /*
- *
- */
- XimfMessageAnalyser.prototype.getCompleteArray = function(){
- return _xHdrArray;
- }
- /*
- * search for associated XIMF INSTANCE of account definition
- */
- XimfMessageAnalyser.prototype.hasXimfHeaders = function(currentDefinition){
- var uriInstanceXimf = null;
- var sdefinition = null;
- var sversion = null;
- var sname = null;
- sversion = this.getHeaderValue(XIMF_VERSION_HEADER);
- sname = this.getHeaderValue(XIMF_NAME_HEADER);
- gConsole.logStringMessage("DBG [ximfmail - MessageAnalyser - hasXimfHeaders ] \ndefinition uri = "+ currentDefinition +"\nXIMF version = "+ sversion+"\nXIMF name = "+sname );
-
- //if(gXimfCatalog && sname && sversion)
- if(gXimfCatalog && sname)
- uriInstanceXimf = gXimfCatalog.getInstanceUri(currentDefinition,sname,sversion);
-
- return uriInstanceXimf;
- }
-
- /*
- * add or replace Ximfheader in _xHdrArray
- */
- XimfMessageAnalyser.prototype.setHeaderValue = function(headerName, headerValue){
- try{
- var isNewHeader = true;
- for(var idx_xHdrArray = 0 ; idx_xHdrArray < _xHdrArray.length ; ++idx_xHdrArray){
- var tmpHead = _xHdrArray[idx_xHdrArray]._hdrName;
- if(tmpHead.toLowerCase() == headerName.toLowerCase()){
- _xHdrArray[idx_xHdrArray]._hdrValue = headerValue;
- isNewHeader = false;
- break;
- }
- }
- if(isNewHeader){
- var xhdr = new xHdr();
- xhdr._hdrName = headerName;
- xhdr._hdrValue = headerValue;
- _xHdrArray.push(xhdr);
- }
- }catch(e){
- gConsole.logStringMessage("[ximfmail - MessageAnalyser - setHeaderValue ] \n " + e + "\nfile : " + Error().fileName+"\nline : "+Error().lineNumber);
- }
- }
-
- // MessageAnalyser
- XimfMessageAnalyser.initialized = true;
- }
-}
\ No newline at end of file