- Swapped behaviour so php4 is speciel instead of php5 sites
authorunknown <JKKN@.tv2.local>
Thu, 7 Aug 2008 00:28:12 +0000 (02:28 +0200)
committerunknown <JKKN@.tv2.local>
Thu, 7 Aug 2008 00:28:12 +0000 (02:28 +0200)
- Added auto php4 selection in Quickbox for known php4 sites
- Made PHP5 branch default for globals viewcvs lookup in Quickbox.
- Made View Source on top of viewcvs links in dropdown
- Fixed a bug detected php5 branch when coming from a viewcvs link into the quickbox
- Made dropdown display upto 25 chars of the uri of the links
- Added option to select where to open link in the quickbox.
Bombed to version 0.10.0

content/options.js
content/options.xul
content/quickbox.js
content/quickbox.xul
content/tv2developer.js
defaults/preferences/tv2developer.js
locale/da-DK/tv2developer.dtd
locale/da-DK/tv2developer.properties
locale/en-US/tv2developer.dtd
locale/en-US/tv2developer.properties
version

index d62eb33d6ff1cea6d534b6c4f46f36ccf37d1eda..c581a11255b5c917ccc72e56660a3c7c6e2d4a62 100644 (file)
@@ -19,76 +19,76 @@ var TV2Options = {
             document.getElementById('mac-accesskeys').checked =
                 (this._keyBranch.getIntPref('menuAccessKey') != 0);
         }
-        // fill in php5 sites
-        this.php5sitesFillIn(TV2Util.getPref('php5sites', ''));
-        document.getElementById('php5auto').selectedIndex =
-            (TV2Util.hasPref('php5sites') ? 1 : 0);
+        // fill in php4 sites
+        this.php4sitesFillIn(TV2Util.getPref('php4sites', ''));
+        document.getElementById('php4auto').selectedIndex =
+            (TV2Util.hasPref('php4sites') ? 1 : 0);
     },
     
     /* fill in list */
-    php5sitesFillIn: function(php5set) {
-        var php5sites = php5set.split(',').sort();
-        var php5list = document.getElementById('php5sites');
-        var child = php5list.childNodes;
+    php4sitesFillIn: function(php4set) {
+        var php4sites = php4set.split(',').sort();
+        var php4list = document.getElementById('php4sites');
+        var child = php4list.childNodes;
         for (var i=child.length-1; i>=0; --i) {
             if (child[i].tagName == 'listitem') {
-                php5list.removeChild(child[i]);
+                php4list.removeChild(child[i]);
             }
         }
-        for (var i=0; i<php5sites.length; i++) {
-            if (php5sites[i] == '') continue;
-            var php5item = document.createElement('listitem');
-            php5item.setAttribute('label', php5sites[i]);
-            php5list.appendChild(php5item);
+        for (var i=0; i<php4sites.length; i++) {
+            if (php4sites[i] == '') continue;
+            var php4item = document.createElement('listitem');
+            php4item.setAttribute('label', php4sites[i]);
+            php4list.appendChild(php4item);
         }
     },
     
-    php5sitesSelect: function(obj) {
-        document.getElementById('php5sites_remove').disabled = (obj.selectedItem) ? false : true;
+    php4sitesSelect: function(obj) {
+        document.getElementById('php4sites_remove').disabled = (obj.selectedItem) ? false : true;
     },
     
-    php5sitesAdd: function(obj) {
-        var add = prompt(TV2Util.getStr('optionsDialog.enterphp5site'), '');
+    php4sitesAdd: function(obj) {
+        var add = prompt(TV2Util.getStr('optionsDialog.enterphp4site'), '');
         if (add && add != '') {
-            var php5sites  = document.getElementById('php5sites');
-            var php5childs = php5sites.childNodes;
+            var php4sites  = document.getElementById('php4sites');
+            var php4childs = php4sites.childNodes;
             var insertBefore = null;
             // place at right sorted place in list
-            for (var i=0; i<php5childs.length; i++) {
-                if (php5childs[i].tagName == 'listitem') {
-                    var item = php5childs[i].getAttribute('label');
+            for (var i=0; i<php4childs.length; i++) {
+                if (php4childs[i].tagName == 'listitem') {
+                    var item = php4childs[i].getAttribute('label');
                     if (item > add) {
-                        insertBefore = php5childs[i];
+                        insertBefore = php4childs[i];
                         break;
                     }
                 }
             }
             var newItem = document.createElement('listitem');
             newItem.setAttribute('label', add);
-            php5sites.insertBefore(newItem, insertBefore);
-            php5sites.selectedItem = newItem;
+            php4sites.insertBefore(newItem, insertBefore);
+            php4sites.selectedItem = newItem;
             this.update();
-            php5sites.focus();
+            php4sites.focus();
         }
     },
     
-    php5sitesRemove: function(obj) {
-        var php5sites = document.getElementById('php5sites');
-        php5sites.removeChild(php5sites.selectedItem);
+    php4sitesRemove: function(obj) {
+        var php4sites = document.getElementById('php4sites');
+        php4sites.removeChild(php4sites.selectedItem);
         this.update();
-        php5sites.focus();
+        php4sites.focus();
     },
     
-    php5sitesAuto: function(obj) {
-        var php5sites = document.getElementById('php5sites');
+    php4sitesAuto: function(obj) {
+        var php4sites = document.getElementById('php4sites');
         var useDefaults = (obj.selectedIndex == 0);
-        if (useDefaults && !php5sites.disabled) {
-            this.php5sitesFillIn(TV2Util.getDefaultPref('php5sites'));
+        if (useDefaults && !php4sites.disabled) {
+            this.php4sitesFillIn(TV2Util.getDefaultPref('php4sites'));
         } else {
-            php5sites.focus();
+            php4sites.focus();
         }
-        php5sites.disabled = useDefaults;
-        document.getElementById('php5sites_add').disabled = useDefaults;
+        php4sites.disabled = useDefaults;
+        document.getElementById('php4sites_add').disabled = useDefaults;
         this.update();
     },
     
@@ -101,20 +101,20 @@ var TV2Options = {
                 this._keyBranch.clearUserPref('menuAccessKey');
             }
         }
-        // save php5 sites list
-        var php5auto = document.getElementById('php5auto');
-        if (php5auto.selectedIndex == 1) {
-            var php5childs = document.getElementById('php5sites').childNodes;
-            var php5sites = [];
-            for (var i=0; i<php5childs.length; i++) {
-                if (php5childs[i].tagName == 'listitem') {
-                    php5sites.push(php5childs[i].getAttribute('label'));
+        // save php4 sites list
+        var php4auto = document.getElementById('php4auto');
+        if (php4auto.selectedIndex == 1) {
+            var php4childs = document.getElementById('php4sites').childNodes;
+            var php4sites = [];
+            for (var i=0; i<php4childs.length; i++) {
+                if (php4childs[i].tagName == 'listitem') {
+                    php4sites.push(php4childs[i].getAttribute('label'));
                 }
             }
-            TV2Util.setPref('php5sites', php5sites.join(','));
+            TV2Util.setPref('php4sites', php4sites.join(','));
         } else {
-            if (TV2Util.hasPref('php5sites')) {
-                TV2Util.clearPref('php5sites');
+            if (TV2Util.hasPref('php4sites')) {
+                TV2Util.clearPref('php4sites');
             }
         }
     },
index d6e42917c03c077d9c1dcb059ee9949ea866a6b9..60157bd57f3531b40cdaaa4404fd4046b3f5a8b4 100644 (file)
     </groupbox>
     
     <groupbox>
-        <caption label="&optionsDialog.php5sites.label;" tooltiptext="&optionsDialog.php5sites.tooltiptext;"/>
-        <radiogroup id="php5auto" onselect="TV2Options.php5sitesAuto(this)">
-            <radio label="&optionsDialog.php5sites.defaults;"/>
-            <radio label="&optionsDialog.php5sites.custom;"/>
+        <caption label="&optionsDialog.php4sites.label;" tooltiptext="&optionsDialog.php4sites.tooltiptext;"/>
+        <radiogroup id="php4auto" onselect="TV2Options.php4sitesAuto(this)">
+            <radio label="&optionsDialog.php4sites.defaults;"/>
+            <radio label="&optionsDialog.php4sites.custom;"/>
         </radiogroup>
-        <listbox id="php5sites" onselect="TV2Options.php5sitesSelect(this)"/>
+        <listbox id="php4sites" onselect="TV2Options.php4sitesSelect(this)"/>
         <hbox align="center">
             <spacer flex="1"/>
-            <button label="&optionsDialog.php5sites.addsite;" accesskey="&optionsDialog.php5sites.addsite.accesskey;" id="php5sites_add" oncommand="TV2Options.php5sitesAdd()" disabled="true"/>
-            <button label="&optionsDialog.php5sites.removesite;" accesskey="&optionsDialog.php5sites.removesite.accesskey;" id="php5sites_remove" oncommand="TV2Options.php5sitesRemove()" disabled="true"/>
+            <button label="&optionsDialog.php4sites.addsite;" accesskey="&optionsDialog.php4sites.addsite.accesskey;" id="php4sites_add" oncommand="TV2Options.php4sitesAdd()" disabled="true"/>
+            <button label="&optionsDialog.php4sites.removesite;" accesskey="&optionsDialog.php4sites.removesite.accesskey;" id="php4sites_remove" oncommand="TV2Options.php4sitesRemove()" disabled="true"/>
             <spacer flex="1"/>
         </hbox>
     </groupbox>
index 1a57e2044a6b896fd503b706560f81c2be640a37..518eedad9990ddff9e3bfb0fbb9e2683aba959c1 100644 (file)
@@ -216,6 +216,9 @@ var TV2DeveloperQuickBox = {
           
             }
             
+            // auto php4 if known php4 site
+            auto_php4 |= this._isPhp4(site);
+            
             // defaults
             if (!protocol) protocol = 'http';
             if (!uri) uri = '/';
@@ -363,7 +366,12 @@ var TV2DeveloperQuickBox = {
                     site = 'globals';
                     // must update entered url manually since it was stored before these changes
                     entered_url = this._makeUrl(protocol, env, sitetype, php4, username, site, uri, false);
-                    //php5branch = true; // may want this auto default
+                    if (!manual && !php5branch) {
+                       // auto default to php5branch
+                           this._autoChange = true;
+                       php5branch = document.getElementById('php5branch').checked = true;
+                       this._autoChange = false;
+                    }
                 }
                 var cvs_sitename = (!site) ? 'www' : site.replace(/-(static|dyn)/, '');
                 url = 'http://viewcvs.tv2.dk:7467/cgi-bin/viewvc.cgi/';
@@ -443,8 +451,8 @@ var TV2DeveloperQuickBox = {
     
     /* method to extract short url */
     _reg_fromviewcvs: /^http:\/\/viewcvs\.tv2.dk:7467\/cgi-bin\/viewvc\.cgi\/(([^/.]+)(?:\.tv2\.dk)?(?:\/(?:(webroot|robot|opdatering|template\/))|(\/[^#?/]*))([^#?]*)(.*)?)?/,
-    _reg_viewcvsbranch: /^\?(?:.*&)?pathrev=PHP5(?:&|$)/,
-    _reg_viewcvsviewsource: /^\?(?:.*&)?view=markup(?:&|$)/,
+    _reg_viewcvsbranch: /^\?(?:.*&)?pathrev=PHP5(?:&|#|$)/,
+    _reg_viewcvsviewsource: /^\?(?:.*&)?view=markup(?:&|#|$)/,
     _reg_fromi2if: /^http:\/\/i2\.(?:[^.]+\.)?opdatering\.(?:(?:test|snapshot)\.)?tv2\.dk\/(tango\/(entry|requeue|dynamic)|tool\/pdo_log\/frameset)\.php.*?(\?|&)url=([^&]+)/,
     _extractURL: function(url) {
         var action = 'go-site';
@@ -542,8 +550,19 @@ var TV2DeveloperQuickBox = {
             TV2Util.setPref('alternativ-initials', document.getElementById('testname').value);
         }
         window.close();
-        opener.openUILink(document.getElementById('url').value, 'current', false, false, false);
-        /* allow ctrl, alt, but don't google */
-    }
+        
+        // Open in selection
+        var openin = document.getElementById('openin').selectedItem.id;
+        if (openin == 'openin-newtab') openin = 'tab'
+        else if (openin == 'openin-newwindow') openin = 'window'
+        else openin = 'current';
+
+        opener.openUILinkIn(document.getElementById('url').value, openin);
+    },
+    
+    _isPhp4: function(site) {
+        if (!site) site = 'www';
+        return ((','+TV2Util.getPref('php4sites')+',').indexOf(','+site+',') != -1);
+    },
     
 };
index 9f30864b3befea5a97e758f3e677f72d13ed2c4a..fe140c716d12da21b86eb0179385694fcdfd451a 100644 (file)
       </groupbox>
      </hbox>
     </radiogroup>
+    
+    <radiogroup id="openin">
+      <groupbox flex="1">
+        <caption label="&quickbox.openin;"/>
+        <hbox>
+                 <radio id="openin-current" label="&quickbox.openin.current;" accesskey="&quickbox.openin.current.accesskey;"/>
+                 <radio id="openin-newtab" label="&quickbox.openin.newtab;" accesskey="&quickbox.openin.newtab.accesskey;"/>
+         <radio id="openin-newwindow" label="&quickbox.openin.newwindow;" accesskey="&quickbox.openin.newwindow.accesskey;"/>
+       </hbox>
+      </groupbox>
+    </radiogroup>
 
 </dialog>
index 60062b8cad26a97c6b2ecc917a041bc419b13169..43dce511bb0785436a7ed8d96af17d63ad1cf94b 100644 (file)
@@ -116,7 +116,13 @@ var TV2Developer = {
     
     TV2Link: function(type, domain, uri, accesskey, flags) {
         this.type = type;
+        // Postfix label with up to 25 chars of uri
         this.label = domain; 
+        if (uri.length > 25) {
+               this.label += uri.substr(0, 23) + '\u2026';
+        } else {
+               this.label += uri;
+        }
         this.url = 'http://' + domain + uri;
         if (accesskey) this.accesskey = accesskey;
         this.disabled = false;
@@ -160,9 +166,9 @@ var TV2Developer = {
         return def;
     },
     
-    _isPhp5: function(site) {
+    _isPhp4: function(site) {
         if (!site) site = 'www';
-        return ((','+TV2Util.getPref('php5sites')+',').indexOf(','+site+',') != -1);
+        return ((','+TV2Util.getPref('php4sites')+',').indexOf(','+site+',') != -1);
     },
  
     /* Main function for adding all the links for the menu popup */   
@@ -194,9 +200,9 @@ var TV2Developer = {
             if (tv2_sitename) tv2_sitename = tv2_sitename.replace(/-(dyn|static)$/, '');
             if (tv2_user) tv2_user = tv2_user.replace(/^\./, '');
 
-            // php5 site
-            var php5 = this._isPhp5(tv2_sitename);
-            var testType = php5 ? '' : '3';
+            // php4 site
+            var php4 = this._isPhp4(tv2_sitename);
+            var testType = php4 ? '3' : '';
             
             // Find live, test and snapshot url for current site
             var liveurl;
@@ -275,10 +281,10 @@ var TV2Developer = {
             } else {
                 viewcvs_type = 'viewcvs_test';
             }
-            links.push(new this.TV2LinkWithLabel(viewcvs_type, TV2Util.getStr('lookupInViewCVS'), viewcvs,
-                                                 TV2Util.getStr('lookupInViewCVS.accesskey')));
             links.push(new this.TV2LinkWithLabel(viewcvs_type, TV2Util.getStr('lookupInViewCVSSource'), viewcvs_source,
                                                  TV2Util.getStr('lookupInViewCVSSource.accesskey')));
+            links.push(new this.TV2LinkWithLabel(viewcvs_type, TV2Util.getStr('lookupInViewCVS'), viewcvs,
+                                                 TV2Util.getStr('lookupInViewCVS.accesskey')));
 
             // Update and I2 base URL
             var updatepostfix = (tv2_user ? '.' + tv2_user : '')
@@ -317,7 +323,7 @@ var TV2Developer = {
             
             // Add run pdo_log link
             if ((onI2interface != 'tool/pdo_log/frameset') &&
-                ((!tv2_testsite && php5) || // only php5 live sites
+                ((!tv2_testsite && !php4) || // only php5 live sites
                 (tv2_testsite && tv2_testsite != 'snapshot3' && tv2_testsite != 'test3'))) { /* not supported on php4 sites */
                 links.push(new this.TV2LinkWithLabel('tool/pdo_log/frameset', TV2Util.getStr('performDbPdoLog'),
                    i2link + '/tool/pdo_log/frameset.php?url='+tango+'&autostop=1&prefix='+initials,
@@ -407,9 +413,9 @@ var TV2Developer = {
                     tv2_uri = tv2_uri.substr(0, tv2_uri.length-9);
                 }
 
-                // php5 sites
-                var php5 = this._isPhp5(tv2_sitename);
-                var testType = php5 ? '' : '3';
+                // php4 sites
+                var php4 = this._isPhp4(tv2_sitename);
+                var testType = php4 ? '3' : '';
 
                 var live_sitename = (tv2_sitetype=='webroot' && tv2_sitename=='www') ? '': (tv2_sitename+'.');
                 var type = (tv2_sitetype=='webroot')? '' : tv2_sitetype+'.';
index c0bb843499b305fe91ebda83b09792d35c2585df..d8b2d3c5a56fb7a293f6619d6b471d130ebcdc4c 100644 (file)
@@ -3,4 +3,4 @@
 pref('tv2developer.firstRun', true);
 pref('tv2developer.developer-initials', 'CHANGE-THIS');
 pref('tv2developer.lastaction-linktype', 'tango/entry');
-pref('tv2developer.php5sites', 'www,i2,common,ttvpumpe,1234,nyhederne,krimi,radio');
+pref('tv2developer.php4sites', '2000,ally,annonceinfo,arkivsalg,auth,betaling,betalingsputnik,bryllup,dagsdato,finans,formel1,harris,hovsa,inc,it,konsol,loginsputnik,louth,million,piszulu,playmoney,podcast-files,pokermoney,rss,sms,spil,spil-deal,spil-million,spil-solo,sputnikmobil,swim,titoonic,trafikken,tv2,tv2r,tvsputnik,wimbledon,wptmoney,zulu');
index 16cb94b739d5408f3b693a6d6e0fc595dd52e469..7e472cee799c697b86a30416003456dfcf4c9328 100644 (file)
 <!ENTITY optionsDialog.mac.accesskeys "Slå genvejstaster til i Firefox på Mac">
 <!ENTITY optionsDialog.mac.accesskeys.tooltiptext "Ændring af dette felt kræver genstart af Firefox">
 
-<!ENTITY optionsDialog.php5sites.label "PHP 5 konverterede sites">
-<!ENTITY optionsDialog.php5sites.tooltiptext "Sites i denne liste vil blive betragtet som PHP 5 sites.">
-<!ENTITY optionsDialog.php5sites.defaults "Brug standard PHP 5 sites">
-<!ENTITY optionsDialog.php5sites.custom "Vælg manuelt PHP 5 sites:">
-<!ENTITY optionsDialog.php5sites.addsite "Tilføj site">
-<!ENTITY optionsDialog.php5sites.addsite.accesskey "t">
-<!ENTITY optionsDialog.php5sites.removesite "Fjern site">
-<!ENTITY optionsDialog.php5sites.removesite.accesskey "f">
+<!ENTITY optionsDialog.php4sites.label "Gamle PHP 4 sites">
+<!ENTITY optionsDialog.php4sites.tooltiptext "Sites i denne liste vil blive betragtet som PHP 4 sites.">
+<!ENTITY optionsDialog.php4sites.defaults "Brug standard PHP 4 sites">
+<!ENTITY optionsDialog.php4sites.custom "Vælg manuelt PHP 4 sites:">
+<!ENTITY optionsDialog.php4sites.addsite "Tilføj site">
+<!ENTITY optionsDialog.php4sites.addsite.accesskey "t">
+<!ENTITY optionsDialog.php4sites.removesite "Fjern site">
+<!ENTITY optionsDialog.php4sites.removesite.accesskey "f">
 
 <!ENTITY config.label "Konfigurér">
 <!ENTITY config.accesskey "c">
 <!ENTITY quickbox.contentid.accesskey "i">
 
 <!ENTITY quickbox.ttvpage "Slå op som TTV side i I2">
-<!ENTITY quickbox.ttvpage.accesskey "a">
+<!ENTITY quickbox.ttvpage.accesskey "v">
+
+<!ENTITY quickbox.openin "Åbn i">
+<!ENTITY quickbox.openin.current "nuværende vindue">
+<!ENTITY quickbox.openin.current.accesskey "z">
+
+<!ENTITY quickbox.openin.newtab "ny tab">
+<!ENTITY quickbox.openin.newtab.accesskey "a">
+
+<!ENTITY quickbox.openin.newwindow "nyt window">
+<!ENTITY quickbox.openin.newwindow.accesskey "y">
index 5b9fb7625e96130f845206938749dd7db6fa40e6..a760a8a5f417c7a243b3df3d119779e664f84648 100644 (file)
@@ -70,4 +70,4 @@ quickbox.accesskey=q
 
 # Options dialog
 
-optionsDialog.enterphp5site=Indtast navn på PHP 5 site:
+optionsDialog.enterphp4site=Indtast navn på PHP 4 site:
index b6c48df93985ec59bce635b008b74c63e2614560..b1d628e7b59236cbdf445f3e51cbcf7c1a29c056 100644 (file)
 <!ENTITY optionsDialog.mac.accesskeys "Enable accesskeys in Firefox on Mac">
 <!ENTITY optionsDialog.mac.accesskeys.tooltiptext "Changing this requires restart of Firefox">
 
-<!ENTITY optionsDialog.php5sites.label "PHP 5 enabled sites">
-<!ENTITY optionsDialog.php5sites.tooltiptext "Sites listed here will be seen as PHP 5 sites.">
-<!ENTITY optionsDialog.php5sites.defaults "Use default PHP 5 sites">
-<!ENTITY optionsDialog.php5sites.custom "Custom PHP 5 sites:">
-<!ENTITY optionsDialog.php5sites.addsite "Add site">
-<!ENTITY optionsDialog.php5sites.addsite.accesskey "a">
-<!ENTITY optionsDialog.php5sites.removesite "Remove site">
-<!ENTITY optionsDialog.php5sites.removesite.accesskey "r">
+<!ENTITY optionsDialog.php4sites.label "PHP 4 legacy sites">
+<!ENTITY optionsDialog.php4sites.tooltiptext "Sites listed here will be seen as PHP 4 sites.">
+<!ENTITY optionsDialog.php4sites.defaults "Use default PHP 4 sites">
+<!ENTITY optionsDialog.php4sites.custom "Custom PHP 4 sites:">
+<!ENTITY optionsDialog.php4sites.addsite "Add site">
+<!ENTITY optionsDialog.php4sites.addsite.accesskey "a">
+<!ENTITY optionsDialog.php4sites.removesite "Remove site">
+<!ENTITY optionsDialog.php4sites.removesite.accesskey "r">
 
 <!ENTITY config.label "Configure">
 <!ENTITY config.accesskey "c">
 <!ENTITY quickbox.contentid.accesskey "i">
 
 <!ENTITY quickbox.ttvpage "Lookup as TTV Page">
-<!ENTITY quickbox.ttvpage.accesskey "a">
+<!ENTITY quickbox.ttvpage.accesskey "v">
+
+<!ENTITY quickbox.openin "Open in">
+<!ENTITY quickbox.openin.current "current window">
+<!ENTITY quickbox.openin.current.accesskey "z">
+
+<!ENTITY quickbox.openin.newtab "new tab">
+<!ENTITY quickbox.openin.newtab.accesskey "a">
+
+<!ENTITY quickbox.openin.newwindow "new window">
+<!ENTITY quickbox.openin.newwindow.accesskey "y">
index 0fd4a5f3b6c5704d95916348e32715c9be41a912..b669f3bba4eeaa6458f1d6b5c6d3a4ce2433d853 100644 (file)
@@ -70,4 +70,4 @@ quickbox.accesskey=q
 
 # Options dialog
 
-optionsDialog.enterphp5site=Enter name of PHP 5 site:
+optionsDialog.enterphp4site=Enter name of PHP 4 site:
diff --git a/version b/version
index 56f3151140cc57c0ac49cfaeabf8c5c4118b7ef4..78bc1abd14f2c1f6330989d876c4ee7d5daf7ff6 100644 (file)
--- a/version
+++ b/version
@@ -1 +1 @@
-0.9.10
+0.10.0