<?xml version="1.0" encoding="UTF-8"?>
<!--
  FoxyProxy
  Copyright (C) 2006-2008 Eric H. Jung and LeahScape, Inc.
  http://foxyproxy.mozdev.org/
  eric.jung@yahoo.com

  This source code is released under the GPL license,
  available in the LICENSE file at the root of this installation
  and also online at http://www.gnu.org/licenses/gpl.txt
-->

<!-- use https://addons.mozilla.org/en-US/firefox/addon/1693 for a better colorpicker -->
<?xml-stylesheet href="foxyproxy.css" type="text/css"?>
<?xul-overlay href="includes.xul"?>
<!DOCTYPE overlay SYSTEM "chrome://foxyproxy/locale/foxyproxy.dtd">

<dialog buttons="accept"
  id="foxyproxyaddproxydlg2"
  ondialogaccept="return onOK();"
  onload="onLoad();"
  title="&foxyproxy.label; - &foxyproxy.add.title;"
  windowtype="foxyproxy"
 	xmlns:html="http://www.w3.org/1999/xhtml"
  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  persist="screenX screenY">

<script src="addeditproxy.js"/>
<script src="../modules/nsProxyAutoConfig.js"/>

<vbox observes="torwiz-broadcaster" flex="1">
  <tabbox flex="1">
  	<tabs id="tabs" style="-moz-appearance: none;">
  		<tab label="&foxyproxy.tab.general.label;" accesskey="&foxyproxy.tab.general.accesskey;"
  		  tooltiptext="&foxyproxy.tab.general.tooltip;" selected="true"/>
  		<tab label="&foxyproxy.tab.proxy.label;" accesskey="&foxyproxy.tab.proxy.accesskey;"
  		  tooltiptext="&foxyproxy.tab.proxy.tooltip;"/>
  		<tab id="urlpatternstab" label="&foxyproxy.urlpatterns.label;" accesskey="&foxyproxy.urlpatterns.accesskey;"
  		  tooltiptext="&foxyproxy.urlpatterns.tooltip;"/>
   	</tabs>

	<tabpanels style="-moz-appearance: none;" flex="1">
	  <tabpanel flex="1" orient="vertical">
			<separator class="thin" />
      <hbox>
        <checkbox id="proxyenabled" flex="1" observes="default-proxy-broadcaster" checked="true" label="&foxyproxy.enabled.label;" accesskey="&foxyproxy.enabled.accesskey;"/>
      </hbox>
			<!--  thanks Teo! -->
	    <grid class="indent">
	      <columns>
	        <column/>
	        <column flex="1"/>
	      </columns>
	    <rows>
	      <row align="center">
	        <label value="&foxyproxy.proxy.name.label;" observes="default-proxy-broadcaster" control="proxyname" accesskey="&foxyproxy.proxy.name.accesskey;"
	        	tooltiptext="&foxyproxy.proxy.name.tooltip;"/>
	        <textbox id="proxyname" flex="1"/>
	      </row>
	      <row align="center">
	        <label value="&foxyproxy.proxy.notes.label;" control="proxynotes" accesskey="&foxyproxy.proxy.notes.accesskey;"
	        	tooltiptext="&foxyproxy.proxy.notes.tooltip;" observes="default-proxy-broadcaster"/>
	        <textbox id="proxynotes" flex="1" multiline="true"/>
	      </row>
	    </rows>
	    </grid>
      <checkbox id="animatedIcons"
	      class="indent"
        label="&foxyproxy.animatedicons.label;"
        accesskey="&foxyproxy.animatedicons.accesskey;"
        tooltiptext="&foxyproxy.animatedicons.tooltip;"/>
      <checkbox id="cycleEnabled"
	      class="indent"
        label="&foxyproxy.includeincycle.label;"
        accesskey="&foxyproxy.includeincycle.accesskey;"
        tooltiptext="&foxyproxy.includeincycle.tooltip;"/>
	  </tabpanel>
		<tabpanel flex="1" orient="vertical">
				<separator class="thin" />
        <radiogroup id="mode">
					<groupbox>
          <radio id="direct" value="direct" label="&foxyproxy.add.option.direct.label;"
            oncommand="toggleMode('direct');"
            accesskey="&foxyproxy.add.option.direct.accesskey;"
            tooltiptext="&foxyproxy.add.option.direct.tooltip;"/>
        	</groupbox>
        	<separator class="thin"/>
        	<groupbox>
          <radio id="manual" value="manual" label="&foxyproxy.add.option.manual.label;"
            oncommand="toggleMode('manual');"
            accesskey="&foxyproxy.add.option.manual.accesskey;"
            tooltiptext="&foxyproxy.add.option.manual.tooltip;"/>
              <hbox align="center" class="indent">
				        <label value="&foxyproxy.changes.msg1;" class="text-link" popup="newGUIPopup" tooltiptext="&foxyproxy.changes.msg1;"/>
				      </hbox>
							<separator class="thin"/>
              <hbox align="center" class="indent">
	              <label value="&foxyproxy.host.label;" accesskey="&foxyproxy.host.accesskey;"
	              	tooltiptext="&foxyproxy.host.tooltip;"
	              	control="host"/>
	              <textbox id="host" flex="1" observes="disabled-broadcaster" tooltiptext="&foxyproxy.host.tooltip;"/>
	              <label value="&foxyproxy.port.label;" control="port" accesskey="&foxyproxy.port.accesskey;" tooltiptext="&foxyproxy.port.tooltip;"/>
	              <textbox id="port" size="5" oninput="if (/\D/.test(this.value)) this.value='';" observes="disabled-broadcaster" tooltiptext="&foxyproxy.port.tooltip;"/>
              </hbox>
              <hbox class="indent">
                <checkbox id="isSocks"
									label="&foxyproxy.issocks.label;"
	               	accesskey="&foxyproxy.issocks.accesskey;"
	               	tooltiptext="&foxyproxy.issocks.tooltip;"
	               	observes="disabled-broadcaster"
	               	oncommand="onIsSocks(this.checked)"/>
                <radiogroup id="socksversion" orient="horizontal">
                  <radio id="socks4" value="4" label="&foxyproxy.socks.v4;" accesskey="4" observes="disabled-broadcaster"/>
                  <radio id="socks5" value="5" label="&foxyproxy.socks.v5;" accesskey="5" observes="disabled-broadcaster"/>
                </radiogroup>
              </hbox>
            </groupbox>
          <separator class="thin"/>
          <groupbox>
            <hbox align="center">
            <radio id="auto"
              value="auto"
              label="&foxyproxy.auto.url.label;"
              oncommand="toggleMode('auto');"
              accesskey="&foxyproxy.auto.url.accesskey;"
              tooltiptext="&foxyproxy.auto.url.tooltip;"
              control="autoconfurl"/>
            <label value="&foxyproxy.auto.url.note.label;" tooltiptext="&foxyproxy.auto.url.note.tooltip;" style="font-size: x-small;"/>
            </hbox>
          <grid class="indent" flex="1">
            <columns>
              <column flex="1"/>
              <column/>
            </columns>
             <rows>
               <row align="center">
	          	  <textbox id="autoconfurl" size="50" observes="autoconf-broadcaster1"
	          		  tooltiptext="&foxyproxy.auto.url.tooltip;"
	          		  oninput="onAutoConfUrlInput();"/>
								<button style="min-width: 0.5em;" oncommand="onSelectAutoConf();"
									label="..." tooltiptext="&foxyproxy.auto.url.tooltip;" observes="autoconf-broadcaster1"/>
         			  <button command="viewAutoConfCmd"/>
         			  <button command="testAutoConfCmd"/>
								<toolbarbutton class="foxyproxy-ref"
									popup="pacTipsPopup"
									tooltiptext="&foxyproxy.tip.label;"
									observes="autoconf-broadcaster2"/>
         	    </row>
              <row align="center">
              	<hbox align="center">
	                <checkbox id="autoConfURLReloadEnabled"
	                	label="&foxyproxy.autoconfurl.reload.label;"
	               	  accesskey="&foxyproxy.autoconfurl.reload.accesskey;"
	               	  tooltiptext="&foxyproxy.autoconfurl.reload.tooltip;"
                	  observes="autoconf-broadcaster1"/>
		          	  <textbox id="autoConfReloadFreq" size="3" observes="autoconf-broadcaster1"
		          		  tooltiptext="&foxyproxy.autoconfurl.reload.tooltip;"
		          		  oninput="if (/\D/.test(this.value)) this.value='';"/>
		          		<label value="&foxyproxy.minutes.label;" tooltiptext="&foxyproxy.minutes.tooltip;"/>
		          	</hbox>
         	    </row>
         	    <separator class="thin"/>
							<groupbox>
								<caption
									label="&foxyproxy.notifications.label;"
									tooltiptext="&foxyproxy.notifications.tooltip;"/>
								<row align="center">
									<checkbox
										id="pacLoadNotificationEnabled"
										label="&foxyproxy.pacloadnotification.label;"
										accesskey="&foxyproxy.pacloadnotification.accesskey;"
										tooltiptext="&foxyproxy.pacloadnotification.tooltip;"
										observes="autoconf-broadcaster1"/>
								</row>
								<row align="center">
									<checkbox
										id="pacErrorNotificationEnabled"
										label="&foxyproxy.pacerrornotification.label;"
										accesskey="&foxyproxy.pacerrornotification.accesskey;"
										tooltiptext="&foxyproxy.pacerrornotification.tooltip;"
										observes="autoconf-broadcaster1"/>
								</row>
							</groupbox>
             </rows>
           </grid>
					</groupbox>
        </radiogroup>
    </tabpanel>

 		<tabpanel flex="1" orient="vertical">
 			<separator class="thin" />
      <description>&foxyproxy.pattern.description;</description>
      <separator class="thin"/>
      <hbox>
        <button command="addURLPatternCmd" flex="1"/>
        <button command="editURLPatternSelectionCmd" flex="1"/>
        <button command="deleteURLPatternSelectionCmd" flex="1"/>
        <button command="helpURLPatternCmd" flex="1"/>
				<button id="wildcardURLPatternRefBtn" command="wildcardURLPatternReferenceCmd" flex="1"/>
      </hbox>
      <separator class="thin"/>
      <hbox flex="1">
        <tree id="urlsTree" flex="1" align="stretch" enableColumnDrag="true" seltype="single" onselect="setButtons('urls-tree-row-selected', urlsTree);"
       	onclick="overlay.onTreeClick(event, this);">
        <treecols id="treeCols" pickertooltiptext="&foxyproxy.tree.pickertooltiptext.label;">
          <treecol id="enabledCol" label="&foxyproxy.enabled.label;" type="checkbox" flex="1" persist="width ordinal hidden"/><splitter class="tree-splitter"/>
          <treecol id="nameCol" label="&foxyproxy.pattern.name.label;" flex="1" persist="width ordinal hidden"/><splitter class="tree-splitter"/>
          <treecol id="patternCol" label="&foxyproxy.url.pattern.label;" flex="1" persist="width ordinal hidden"/><splitter class="tree-splitter"/>
          <treecol id="patternTypeCol" label="&foxyproxy.pattern.type.label;" flex="1" persist="width ordinal hidden"/><splitter class="tree-splitter"/>
          <treecol id="blackCol" label="&foxyproxy.whitelist.blacklist.label;" flex="1" persist="width ordinal hidden"/><splitter class="tree-splitter"/>
          <treecol id="caseSensitiveCol" label="&foxyproxy.casesensitive.label;" flex="1" persist="width ordinal hidden"/><splitter class="tree-splitter"/>            
          <treecol id="tempCol" label="&foxyproxy.temp.label;" flex="1" persist="width ordinal hidden"/><splitter class="tree-splitter"/>            
        </treecols>
          <treechildren context="urlsTreeContext" ondblclick="onAddEditURLPattern(false);"/>
    </tree>
    </hbox>

    </tabpanel>    
  </tabpanels>
  </tabbox>
</vbox>

<vbox width="&foxyproxy.torwiz.width;" height="&foxyproxy.torwiz.height;" observes="not-torwiz-broadcaster" flex="1">
  <iframe class="foxyproxy-border" src="chrome://foxyproxy/content/torwizhelp.xhtml" flex="1"/>
  <separator/>
  <description>&foxyproxy.pattern.description;</description>
  <separator class="thin"/>
  <hbox>
    <button command="addURLPatternCmd" flex="1"/>
    <button command="editURLPatternSelectionCmd" flex="1"/>
    <button command="deleteURLPatternSelectionCmd" flex="1"/>
    <button command="helpURLPatternCmd" flex="1"/>
		<button id="wildcardURLPatternRefBtn" command="wildcardURLPatternReferenceCmd" flex="1"/>
  </hbox>
  <separator/>
  <hbox flex="1">
    <tree id="torWizUrlsTree" flex="1" align="stretch" enableColumnDrag="true" seltype="single" onselect="setButtons('urls-tree-row-selected', urlsTree);">
      <treecols id="treeCols" pickertooltiptext="&foxyproxy.tree.pickertooltiptext.label;">
        <treecol id="enabledCol" label="&foxyproxy.enabled.label;" type="checkbox" flex="1" persist="width ordinal hidden"/><splitter class="tree-splitter"/>
        <treecol id="nameCol" label="&foxyproxy.pattern.name.label;" flex="1" persist="width ordinal hidden"/><splitter class="tree-splitter"/>
        <treecol id="patternCol" label="&foxyproxy.url.pattern.label;" flex="1" persist="width ordinal hidden"/><splitter class="tree-splitter"/>
        <treecol id="patternTypeCol" label="&foxyproxy.pattern.type.label;" flex="1" persist="width ordinal hidden"/><splitter class="tree-splitter"/>
        <treecol id="blackCol" label="&foxyproxy.whitelist.blacklist.label;" flex="1" persist="width ordinal hidden"/><splitter class="tree-splitter"/>
        <treecol id="caseSensitiveCol" label="&foxyproxy.casesensitive.label;" flex="1" persist="width ordinal hidden"/><splitter class="tree-splitter"/>            
        <treecol id="tempCol" label="&foxyproxy.temp.label;" flex="1" persist="width ordinal hidden"/><splitter class="tree-splitter"/>        
      </treecols>
      <treechildren context="urlsTreeContext" ondblclick="onAddEditURLPattern(false);"/>
     </tree>
  </hbox>
</vbox>

<popupset>
  <popup id="wildcardURLPatternReferencePopup"/>
	<popup id="newGUIPopup">
		<vbox class="foxyproxy-border" style="height: &foxyproxy.newGUI.popup.height;; width: &foxyproxy.newGUI.popup.width;; padding: .5em;">
			<description class="foxyproxy-tooltip">
				&foxyproxy.newGUI1.label;</description>        
      <separator class="thin"/>
			<description class="foxyproxy-tooltip">&foxyproxy.newGUI2.label;</description>
      <separator class="thin"/>      
			<description class="text-link" onclick="fpc.openAndReuseOneTabPerURL('http://foxyproxy.mozdev.org/settings-gui.html');">
				&foxyproxy.newGUI4.label;</description>
		</vbox>
	</popup>
	<popup id="pacTipsPopup">
		<vbox class="foxyproxy-border foxyproxy-tooltip" height="175">
			<label value="&foxyproxy.pactip1.label;"/>
      <separator class="thin"/>
      <label value="&foxyproxy.pactip2.label;"/>
      <separator class="thin"/>
      <label value="&foxyproxy.pactip3.label;"/>
      <separator class="thin"/>
			<description width="1"><!-- weirdness on ff3 if no width specified -->&foxyproxy.pactip4.label;
      <html:a class="link"        
        onclick="fpc.openAndReuseOneTabPerURL('http://foxyproxy.mozdev.org/relativescheme.html');">&foxyproxy.pactip5.label;</html:a>
      &foxyproxy.pactip6.label;
      <html:a class="link"
        onclick="fpc.openAndReuseOneTabPerURL('http://www.mozilla.org/support/firefox/profile#locate');">&foxyproxy.pactip7.label;</html:a>
      &foxyproxy.pactip8.label;</description>
		</vbox>
	</popup>
  <popup id="urlsTreeContext" onpopupshowing="onTreeMenuPopupShowing(this.firstChild, proxy.matches, urlsTree);">
		<menuitem id="enabledPopUpMenuItem" command="toggleURLPatternEnabledCmd" type="checkbox"/>
    <menuseparator/>
    <menuitem class="menuitem-non-iconic" command="addURLPatternCmd"/>
    <menuitem class="menuitem-non-iconic" command="editURLPatternSelectionCmd"/>
    <menuitem class="menuitem-non-iconic" command="deleteURLPatternSelectionCmd"/>
    <menuseparator/>
    <menuitem class="menuitem-non-iconic" command="helpURLPatternCmd"/>
    <menuitem class="menuitem-non-iconic" command="closeCmd"/>
  </popup>

</popupset>

<command id="toggleURLPatternEnabledCmd"
  label="&foxyproxy.enabled.label;"
  tooltiptext="&foxyproxy.enabled.tooltip;"
  accesskey="&foxyproxy.enabled.accesskey;"
  observes="urls-tree-row-selected"
  oncommand="toggleEnabled(proxy.matches, urlsTree);"/>

<command id="addURLPatternCmd"
  label="&foxyproxy.add.new.pattern.label;"
  oncommand="onAddEditURLPattern(true);"
  accesskey="&foxyproxy.add.new.pattern.accesskey;"
  tooltiptext="&foxyproxy.add.new.pattern.tooltip;"/>

<command id="deleteURLPatternSelectionCmd"
  label="&foxyproxy.delete.selection.label;"
  accesskey="&foxyproxy.delete.selection.accesskey;"
  tooltiptext="&foxyproxy.delete.selection.tooltip;"
  observes="urls-tree-row-selected"
  oncommand="onRemoveURLPattern();"/>

<command id="editURLPatternSelectionCmd"
  label="&foxyproxy.edit.selection.label;"
  accesskey="&foxyproxy.edit.selection.accesskey;"
  tooltiptext="&foxyproxy.edit.selection.tooltip;"
  observes="urls-tree-row-selected"
  oncommand="onAddEditURLPattern(false);"/>

<command id="helpURLPatternCmd"
  label="&foxyproxy.help.label;"
  accesskey="&foxyproxy.help.accesskey;"
  tooltiptext="&foxyproxy.help.tooltip;"
  oncommand="fpc.openAndReuseOneTabPerURL('http://foxyproxy.mozdev.org/patterns.html');"/>

<command id="wildcardURLPatternReferenceCmd"
  label="&foxyproxy.wildcard.reference.label;"
  accesskey="&foxyproxy.wildcard.reference.accesskey;"
  tooltiptext="&foxyproxy.wildcard.reference.tooltip;"
  oncommand="onWildcardReference('wildcardURLPatternReferencePopup', 'wildcardURLPatternRefBtn');"/>


<command id="closeCmd"
  label="&foxyproxy.close.label;"
  accesskey="&foxyproxy.close.accesskey;"
  tooltiptext="&foxyproxy.close.tooltip;"
  oncommand="window.close();"/>

<command id="viewAutoConfCmd"
	disabled="true"
	label="&foxyproxy.autoconfurl.view.label;"
  accesskey="&foxyproxy.autoconfurl.view.accesskey;"
  tooltiptext="&foxyproxy.autoconfurl.view.tooltip;"
  oncommand="onViewAutoConf();"
  observes="autoconf-broadcaster2"/>

<command id="testAutoConfCmd"
	disabled="true"
	label="&foxyproxy.autoconfurl.test.label;"
  accesskey="&foxyproxy.autoconfurl.test.accesskey;"
  tooltiptext="&foxyproxy.autoconfurl.test.tooltip;"
  oncommand="onTestAutoConf();"
  observes="autoconf-broadcaster2"/>

<broadcasterset>
  <broadcaster id="autoconf-broadcaster1" disabled="true"/>
  <broadcaster id="autoconf-broadcaster2" disabled="true"/>
  <broadcaster id="urls-tree-row-selected" disabled="true"/>
  <broadcaster id="torwiz-broadcaster" hidden="false"/>
  <broadcaster id="not-torwiz-broadcaster" hidden="true"/>
  <broadcaster id="disabled-broadcaster" disabled="false"/>
  <broadcaster id="default-proxy-broadcaster" disabled="false"/>
  <broadcaster id="issocks-broadcaster" disabled="false"/>
</broadcasterset>

</dialog>
