home *** CD-ROM | disk | FTP | other *** search
/ PC World 2003 May / PCWorld_2003-05_cd.bin / Komunik / phoenix / chrome / comm.jar / content / cookie / p3p.xul < prev    next >
Extensible Markup Language  |  2002-04-22  |  9KB  |  267 lines

  1. <?xml version="1.0"?>
  2. <!-- 
  3.    - Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.    -
  5.    - The contents of this file are subject to the Mozilla Public License Version
  6.    - 1.1 (the "License"); you may not use this file except in compliance with
  7.    - the License. You may obtain a copy of the License at
  8.    - http://www.mozilla.org/MPL/
  9.    -
  10.    - Software distributed under the License is distributed on an "AS IS" basis,
  11.    - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.    - for the specific language governing rights and limitations under the
  13.    - License.
  14.    -
  15.    - The Original Code is Mozilla.org code.
  16.    -
  17.    - The Initial Developer of the Original Code is
  18.    - Netscape Communications Corp.
  19.    - Portions created by Netscape Communications Corp are Copyright (C) 2001
  20.    - Netscape Communications Corp. All Rights Reserved.
  21.    -
  22.    - Contributor(s):
  23.    -
  24.    - Alternatively, the contents of this file may be used under the terms of
  25.    - either the GNU General Public License Version 2 or later (the "GPL"), or
  26.    - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27.    - in which case the provisions of the GPL or the LGPL are applicable instead
  28.    - of those above. If you wish to allow use of your version of this file only
  29.    - under the terms of either the GPL or the LGPL, and not to allow others to
  30.    - use your version of this file under the terms of the MPL, indicate your
  31.    - decision by deleting the provisions above and replace them with the notice
  32.    - and other provisions required by the LGPL or the GPL. If you do not delete
  33.    - the provisions above, a recipient may use your version of this file under
  34.    - the terms of any one of the MPL, the GPL or the LGPL.
  35.    -
  36. -->
  37.  
  38. <!-- CHANGE THIS WHEN MOVING FILES -->
  39. <?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?> 
  40. <?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
  41.  
  42. <!-- CHANGE THIS WHEN MOVING FILES -->
  43. <!DOCTYPE window SYSTEM "chrome://cookie/locale/p3p.dtd">
  44.  
  45. <dialog id="privacySettings"
  46.         buttons="accept,cancel,help"
  47.         class="dialog"
  48.         title="&windowtitle.label;"
  49.         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  50.         orient="vertical"
  51.         onload="init();"
  52.         ondialogaccept="return onOK(event);"
  53.         ondialoghelp="return doHelpButton();"
  54.         style="width: 45em;">
  55.  
  56.   <script type="application/x-javascript" src="chrome://help/content/contextHelp.js" />
  57.   <script type="application/x-javascript">
  58.   <![CDATA[
  59.  
  60.   var pref;
  61.  
  62.   var low = 0;
  63.   var medium = 1;
  64.   var high = 2;
  65.   var custom = 3;
  66.  
  67.   var p3pLength = 8;
  68.  
  69.   function init()
  70.   {
  71.     // get pref service
  72.     pref = Components.classes['@mozilla.org/preferences-service;1'];
  73.     pref = pref.getService();
  74.     pref = pref.QueryInterface(Components.interfaces.nsIPrefBranch);
  75.  
  76.     var p3pLevel = medium;
  77.     try {
  78.       // set prefLevel radio button
  79.       p3pLevel = pref.getIntPref("network.cookie.p3plevel");
  80.       var radio = document.getElementById("p3pLevel");
  81.       radio.selectedItem = radio.childNodes[p3pLevel];
  82.  
  83.       // set custom settings
  84.       if (p3pLevel == custom) {
  85.         for (var i=0; i<p3pLength; i++) {
  86.           document.getElementById("menulist_"+i).value =
  87.             pref.getCharPref("network.cookie.p3p").charAt(i);
  88.         }
  89.       }
  90.     } catch(e) {
  91.     }
  92.  
  93.     // initialize the settings display
  94.     settings(p3pLevel);
  95.   }
  96.  
  97.   function onOK(){
  98.  
  99.     var p3pLevel = document.getElementById("p3pLevel").selectedItem.value;
  100.     pref.setIntPref("network.cookie.p3plevel",p3pLevel);
  101.  
  102.     var value = "";
  103.     for (var i=0; i<p3pLength; i++) {
  104.       value += document.getElementById("menulist_"+i).value;
  105.     }
  106.     pref.setCharPref("network.cookie.p3p", value);
  107.  
  108.     return true;
  109.   }
  110.  
  111.   function settings(level) {
  112.     var settings = [];
  113.  
  114.     switch (level) {
  115.       case low:
  116.         settings = "afafaaaa";
  117.         break;
  118.       case medium:
  119.         settings = "ffffaaaa";
  120.         break;
  121.       case high:
  122.         settings = "frfradaa";
  123.         break;
  124.       case custom:
  125.         break;
  126.     }
  127.  
  128.     var hide = (level != custom);
  129.     var menulist;
  130.  
  131.     for (var j=0; j<p3pLength; j++) {
  132.       menulist = document.getElementById("menulist_" + j);
  133.       menulist.disabled = hide;
  134.       if (hide) {
  135.         menulist.value = settings[j];
  136.       }
  137.     }
  138.  
  139.   }
  140.  
  141.   function doHelpButton()
  142.   {
  143.     openHelp('privacy_levels');
  144.   }
  145.  
  146.   ]]>
  147.   </script>
  148.  
  149.   <keyset id="dialogKeys"/>
  150.            
  151.   <groupbox orient="vertical">
  152.     <caption label="&privacyLevel.label;"/>
  153.  
  154.     <description>&p3pDetails;</description>
  155.     <spacer/>
  156.     <description>&choose;</description>
  157.  
  158.     <radiogroup id="p3pLevel" orient="horizontal" align="center">
  159.       <radio group="p3pLevel" value="0" label="&low.label;"
  160.              accesskey="&low.accesskey;" oncommand="settings(low);"/>
  161.       <radio group="p3pLevel" value="1" label="&medium.label;"
  162.              accesskey="&medium.accesskey;" oncommand="settings(medium);"/>
  163.       <radio group="p3pLevel" value="2" label="&high.label;"
  164.              accesskey="&high.accesskey;" oncommand="settings(high);"/>
  165.       <radio group="p3pLevel" value="3" label="&custom.label;"
  166.              accesskey="&custom.accesskey;" oncommand="settings(custom);"/>
  167.     </radiogroup>
  168.  
  169.   </groupbox>
  170.  
  171.   <groupbox id="customSettingBox" orient="vertical">
  172.     <caption label="&customSettings.label;"/>
  173.     <grid>
  174.       <columns>
  175.         <column flex="1"/>
  176.         <column width="120"/>
  177.         <column width="120"/>
  178.       </columns>
  179.       <rows>
  180.         <row align="center">
  181.           <spacer/>
  182.           <description>&firstParty.label;</description>
  183.           <description>&thirdParty.label;</description>
  184.         </row>
  185.         <row align="center">
  186.           <description>&noPolicy.label;</description>
  187.           <menulist flex="1" id="menulist_0">
  188.             <menupopup>
  189.               <menuitem value="a" label="&accept.label;"/>
  190.               <menuitem value="f" label="&flag.label;"/>
  191.               <menuitem value="d" label="&downgrade.label;"/>
  192.               <menuitem value="r" label="&reject.label;"/>
  193.             </menupopup>
  194.           </menulist>
  195.           <menulist flex="1" id="menulist_1">
  196.             <menupopup>
  197.               <menuitem value="a" label="&accept.label;"/>
  198.               <menuitem value="f" label="&flag.label;"/>
  199.               <menuitem value="d" label="&downgrade.label;"/>
  200.               <menuitem value="r" label="&reject.label;"/>
  201.             </menupopup>
  202.           </menulist>
  203.         </row>
  204.         <row align="center">
  205.           <description>&noConsent.label;</description>
  206.           <menulist flex="1" id="menulist_2">
  207.             <menupopup>
  208.               <menuitem value="a" label="&accept.label;"/>
  209.               <menuitem value="f" label="&flag.label;"/>
  210.               <menuitem value="d" label="&downgrade.label;"/>
  211.               <menuitem value="r" label="&reject.label;"/>
  212.             </menupopup>
  213.           </menulist>
  214.           <menulist flex="1" id="menulist_3">
  215.             <menupopup>
  216.               <menuitem value="a" label="&accept.label;"/>
  217.               <menuitem value="f" label="&flag.label;"/>
  218.               <menuitem value="d" label="&downgrade.label;"/>
  219.               <menuitem value="r" label="&reject.label;"/>
  220.             </menupopup>
  221.           </menulist>
  222.         </row>
  223.         <row align="center">
  224.           <description>&implicitConsent.label;</description>
  225.           <menulist flex="1" id="menulist_4">
  226.             <menupopup>
  227.               <menuitem value="a" label="&accept.label;"/>
  228.               <menuitem value="f" label="&flag.label;"/>
  229.               <menuitem value="d" label="&downgrade.label;"/>
  230.               <menuitem value="r" label="&reject.label;"/>
  231.             </menupopup>
  232.           </menulist>
  233.           <menulist flex="1" id="menulist_5">
  234.             <menupopup>
  235.               <menuitem value="a" label="&accept.label;"/>
  236.               <menuitem value="f" label="&flag.label;"/>
  237.               <menuitem value="d" label="&downgrade.label;"/>
  238.               <menuitem value="r" label="&reject.label;"/>
  239.             </menupopup>
  240.           </menulist>
  241.         </row>
  242.         <row align="center">
  243.           <description>&explicitConsent.label;</description>
  244.           <menulist flex="1" id="menulist_6">
  245.             <menupopup>
  246.               <menuitem value="a" label="&accept.label;"/>
  247.               <menuitem value="f" label="&flag.label;"/>
  248.               <menuitem value="d" label="&downgrade.label;"/>
  249.               <menuitem value="r" label="&reject.label;"/>
  250.             </menupopup>
  251.           </menulist>
  252.           <menulist flex="1" id="menulist_7">
  253.             <menupopup>
  254.               <menuitem value="a" label="&accept.label;"/>
  255.               <menuitem value="f" label="&flag.label;"/>
  256.               <menuitem value="d" label="&downgrade.label;"/>
  257.               <menuitem value="r" label="&reject.label;"/>
  258.             </menupopup>
  259.           </menulist>
  260.         </row>
  261.       </rows>
  262.     </grid>
  263.   </groupbox>
  264.  
  265.   <separator class="thin"/>
  266. </dialog>
  267.