home *** CD-ROM | disk | FTP | other *** search
/ PC World 2003 May / PCWorld_2003-05_cd.bin / Komunik / phoenix / chrome / browser.jar / content / browser / pref / pref-privacy.xul < prev    next >
Extensible Markup Language  |  2002-11-16  |  6KB  |  132 lines

  1. <?xml version="1.0"?> 
  2.  
  3. <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
  4.  
  5. <!DOCTYPE window SYSTEM "chrome://browser/locale/pref/pref-privacy.dtd" >
  6. <page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  7.       onload="parent.initPanel('chrome://browser/content/pref/pref-privacy.xul');"
  8.       headertitle="&lHeader;">
  9.  
  10.   <script type="application/x-javascript">
  11.   <![CDATA[
  12.     var _elementIDs = ["histDay", "browserCacheDiskCache", "enableCookies",
  13.                        "enableCookiesForOriginatingSiteOnly", "enableCookiesForCurrentSessionOnly",
  14.                        "enableCookiesButAskFirst"];
  15.     function Startup() {
  16.       var cookiesEnabled = document.getElementById("enableCookies").checked;
  17.       updateBroadcaster(!cookiesEnabled);
  18.       var clearHistButton = document.getElementById("browserClearHistory");
  19.       try {
  20.         var isBtnLocked = parent.hPrefWindow.getPrefIsLocked(clearHistButton.getAttribute("prefstring"));
  21.         var globalHistory = Components.classes["@mozilla.org/browser/global-history;1"]
  22.                                       .getService(Components.interfaces.nsIBrowserHistory);
  23.         clearHistButton.disabled = ( globalHistory.count == 0) || isBtnLocked;
  24.       }
  25.       catch(ex) {
  26.       }
  27.     }
  28.     
  29.     function viewCookies() {
  30.       window.openDialog("chrome://communicator/content/wallet/CookieViewer.xul","_blank",
  31.                         "chrome,resizable=yes", "cookieManager");
  32.     }
  33.  
  34.     function clearCacheOfType(aType)
  35.     {
  36.         var classID = Components.classes["@mozilla.org/network/cache-service;1"];
  37.         var cacheService = classID.getService(Components.interfaces.nsICacheService);
  38.         cacheService.evictEntries(aType);
  39.     }
  40.     
  41.     function clearCache()
  42.     {
  43.         clearCacheOfType(Components.interfaces.nsICache.STORE_ON_DISK);
  44.         clearCacheOfType(Components.interfaces.nsICache.STORE_IN_MEMORY);
  45.     }
  46.  
  47.     function prefClearGlobalHistory()
  48.     {
  49.       var globalHistory = Components.classes["@mozilla.org/browser/global-history;1"]
  50.                                     .getService(Components.interfaces.nsIBrowserHistory);
  51.       globalHistory.removeAllPages();
  52.     }
  53.     
  54.     function updateBroadcaster(aDisable)
  55.     {
  56.       var broadcaster = document.getElementById("cookieBroadcaster");
  57.       var checkbox1 = document.getElementById("enableCookiesForOriginatingSiteOnly");
  58.       var checkbox2 = document.getElementById("enableCookiesForCurrentSessionOnly");
  59.       var checkbox3 = document.getElementById("enableCookiesButAskFirst");
  60.       if (aDisable) {
  61.         broadcaster.setAttribute("disabled", "true");
  62.         checkbox1.checked = false;
  63.         checkbox2.checked = false;
  64.         checkbox3.checked = false;
  65.       }
  66.       else
  67.         broadcaster.removeAttribute("disabled");
  68.     }
  69.   ]]>
  70.   </script>
  71.  
  72.   <broadcaster id="cookieBroadcaster"/>
  73.   <groupbox orient="horizontal" align="center">
  74.     <caption label="&history.label;"/>
  75.       <label value="&pageHis.label;" accesskey="&pageHis.accesskey;" control="histDay"/>
  76.       <textbox id="histDay" size="3"
  77.                  preftype="int" prefstring="browser.history_expire_days"/>
  78.       <label value="&days.label;"/>
  79.       <spacer flex="1"/>
  80.       <button label="&clearHistory.label;" accesskey="&clearHistory.accesskey;"
  81.               oncommand="prefClearGlobalHistory(); this.disabled = true;"
  82.               id="browserClearHistory"
  83.               prefstring="pref.browser.history.disable_button.clear_hist"/>
  84.   </groupbox> 
  85.   <groupbox>
  86.     <caption label="&cache.label;"/>
  87.        <label value="&cacheExplanation.label;"/>
  88.        <separator class="thin"/>
  89.        <hbox align="center">
  90.          <label value="&diskCache.label;" accesskey="&diskCache.accesskey;" control="browserCacheDiskCache"/>
  91.          <textbox id="browserCacheDiskCache" size="8" preftype="int"
  92.                     prefstring="browser.cache.disk.capacity" prefattribute="value"/>
  93.          <label value="&kbytes;"/>
  94.          <spacer flex="1"/>
  95.          <button label="&clearCache.label;"
  96.                  oncommand="clearCache();"
  97.                  id="clearDiskCache"
  98.                  prefstring="pref.advanced.cache.disable_button.clear_disk"/>
  99.      </hbox>
  100.   </groupbox>
  101.   <groupbox orient="horizontal">
  102.     <caption label="&cookies.label;"/>
  103.     <vbox flex="1">
  104.       <label value="&cookieExplanation.label;"/>
  105.       <separator class="thin"/>
  106.       <checkbox id="enableCookies"
  107.                 oncommand="updateBroadcaster(!this.checked);"
  108.                 label="&enableCookies.label;" accesskey="&enableCookies.accesskey;"
  109.                 prefstring="network.cookie.enable"/>
  110.       <checkbox id="enableCookiesForOriginatingSiteOnly" observes="cookieBroadcaster"
  111.                 label="&forOriginatingSiteOnly.label;" accesskey="&forOriginatingSiteOnly.accesskey;"
  112.                 prefstring="network.cookie.enableForOriginatingWebsiteOnly"
  113.                 style="margin-left: 23px;"/>
  114.       <checkbox id="enableCookiesForCurrentSessionOnly" observes="cookieBroadcaster"
  115.                 label="&forCurrentSessionOnly.label;" accesskey="&forCurrentSessionOnly.accesskey;"
  116.                 prefstring="network.cookie.enableForCurrentSessionOnly"
  117.                 style="margin-left: 23px;"/>
  118.       <checkbox id="enableCookiesButAskFirst" observes="cookieBroadcaster"
  119.                 label="&butAskFirst.label;" accesskey="&butAskFirst.accesskey;"
  120.                 prefstring="network.cookie.warnAboutCookies"
  121.                 style="margin-left: 23px;"/>
  122.     </vbox>
  123.     <vbox>
  124.       <button id="manageCookies"
  125.               label="&manageCookies.label;" accesskey="&manageCookies.accesskey;"
  126.               oncommand="viewCookies();"
  127.               prefstring="pref.advanced.cookies.disable_button.view_cookies"/>
  128.     </vbox>
  129.   </groupbox>
  130. </page>
  131.     
  132.