Updated TEST URLs, Updated ViewCVS URLS for new test environment
authorunknown <JKKN@.(none)>
Fri, 2 Oct 2009 14:09:25 +0000 (16:09 +0200)
committerunknown <JKKN@.(none)>
Fri, 2 Oct 2009 14:09:25 +0000 (16:09 +0200)
content/quickbox.js
content/tv2developer.js
version
webroot/whatsnew.xhtml

index d757a57a8e4cf85a1d7c03901e9aa29f0a256382..310c72d28c4b38693fd45f18f107e5e5b0be4616 100644 (file)
@@ -2,7 +2,7 @@
 /* @author Kristian Kræmmer Nielsen <jkkn@tv2.dk> */
 
 var TV2DeveloperQuickBox = {
-        
+
     _addCheckbox: function(here, id, label, accesskey) {
         var radio = document.createElement('radio');
         radio.setAttribute('id', id);
@@ -58,8 +58,12 @@ var TV2DeveloperQuickBox = {
       // handle site type
       if (sitetype != 'webroot') domain += sitetype + '.';
       if (env != 'live') {
+                 if (php4) {
+                       domain += 'php4.';
+                 } else {
+                       domain += 'php5.';
+                 }
           domain += env;
-          if (php4) domain += '3';
           domain += '.';
       }
       // finish url
@@ -158,6 +162,8 @@ var TV2DeveloperQuickBox = {
                 // first take site name
                 if (!site) {
                     site = part;
+                                       // auto php4 if known php4 site
+                                       auto_php4 |= this._isPhp4(site);
                     continue;
                 }
                 
@@ -165,10 +171,20 @@ var TV2DeveloperQuickBox = {
                 var used = false;
                 var env_part = part;
                 var env_php4 = false;
-                if (part.substr(part.length-1, 1) == '3') {
-                    env_part = part.substr(0, part.length-1); // handle t3, te3, test3, snapshot3
+                               var env_php4_set = false;
+                               
+                               var lastChar = part.substr(part.length-1, 1);
+                if (lastChar == '4') {
+                    env_part = part.substr(0, part.length-1); // handle t4, te4, test4, snapshot4
                     env_php4 = true;
+                                       env_php4_set = true;
+                } else
+                               if (lastChar == '5') {
+                    env_part = part.substr(0, part.length-1); // handle t5, te5, test5, snapshot5
+                    env_php4 = false;
+                                       env_php4_set = true;
                 }
+                               
                 for (var j=0; j<this._envs.length; j++) {
                     if (this._envs[j].substr(0, env_part.length) == env_part) {
                         auto_env = this._envs[j];
@@ -176,15 +192,24 @@ var TV2DeveloperQuickBox = {
                     }
                 }
                 if (used) {
-                    auto_php4 = env_php4;
+                    if (env_php4_set) auto_php4 = env_php4;
                     continue;
                 }
+                               
+                               // optional app type (php4 or php5)
+                               if (part == 'php4' || part == 'php5') {
+                                       auto_php4 = (part == 'php4');
+                                       continue;
+                               }
 
                 // optional username
                 if (!auto_username) {
-                    if (part.length == 5 && part.substr(part.length-1, 1) == '3') {
-                        part = part.substr(0, part.length-1); // handle 'jkkn3' as short for php4 site, ...
-                        auto_php4 = true;
+                    if (part.length == 5) {
+                                               var lastChar = part.substr(part.length-1, 1);
+                                               if (lastChar == '4' || lastChar == '5') {
+                                                       part = part.substr(0, part.length-1); // handle 'jkkn4' as short for php4 site, ...
+                                                       auto_php4 = (lastChar == '4');
+                                               }
                         // will also continue into next if-statement since we cut off one character
                     }
                     if (part.length == 4) {
@@ -208,8 +233,8 @@ var TV2DeveloperQuickBox = {
 
                 // handle other kinds of usernames
                 if (!auto_username) {
-                    if (part.substr(part.length-1, 1) == '3') {
-                        part = part.substr(0, part.length-1); // handle 'certus3' as short for php4 site, ...
+                    if (part.substr(part.length-1, 1) == '4') {
+                        part = part.substr(0, part.length-1); // handle 'certus4' as short for php4 site, ...
                         auto_php4 = true;
                     }
                     auto_username = part;
@@ -217,9 +242,6 @@ var TV2DeveloperQuickBox = {
           
             }
             
-            // auto php4 if known php4 site
-            auto_php4 |= this._isPhp4(site);
-            
             // defaults
             if (!protocol) protocol = 'http';
             if (!uri) uri = '/';
@@ -429,7 +451,7 @@ var TV2DeveloperQuickBox = {
                     }
                 }
                 var cvs_sitename = (!site) ? 'www' : site.replace(/-(static|dyn)/, '');
-                url = 'http://viewcvs.tv2.dk:7467/cgi-bin/viewvc.cgi/';
+                url = 'http://flimmer.tv2.dk/viewvc/';
                 var cvs_root = '/' + sitetype;
                 if (cvs_sitename == 'globals') {
                     // special support for globals
@@ -529,17 +551,18 @@ 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_fromviewcvs: /^https?:\/\/flimmer\.tv2.dk\/viewvc\/(([^/.]+)(?:\.tv2\.dk)?(?:\/(?:(webroot|robot|opdatering|template\/))|(\/[^#?/]*))([^#?]*)(.*)?)?/,
     _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=([^&]+)/,
-    _reg_fromloginif: /^http:\/\/login\.(?:([^.]+)\.)?opdatering\.(?:(test|snapshot)\.)?tv2\.dk\/opslag\.php.*?(?:\?|&)(user_id|username)=([^&]+)/,
+    _reg_fromi2if: /^http:\/\/i2\.(?:[^.]+\.)?opdatering\.(?:php5\.(?:test|snapshot)\.)?tv2\.dk\/(tango\/(entry|requeue|dynamic)|tool\/pdo_log\/frameset)\.php.*?(?:\?|&)url=([^&]+)/,
+    _reg_fromloginif: /^http:\/\/login\.(?:([^.]+)\.)?opdatering\.(?:php5\.(test|snapshot)\.)?tv2\.dk\/opslag\.php.*?(?:\?|&)(user_id|username)=([^&]+)/,
     _reg_frombugzilla: /^http:\/\/bugzilla\.tv2\.dk\/(show_bug.cgi.*?(?:\?|&)id=([0-9]+))?/,
-    _extractURL: function(url) {
+    _extractURL: function(paramUrl) {
         var action = 'go-site';
+               var url = paramUrl;
         
         // Check if we are on an Tango or I2 interface, then we can extract the URL again
-        var tangoif = this._reg_fromi2if.exec(url);
+        var tangoif = this._reg_fromi2if.exec(paramUrl);
         if (tangoif) {
             switch (tangoif[1]) {
                 case 'tango/entry':
@@ -559,7 +582,7 @@ var TV2DeveloperQuickBox = {
         }
         
         /* Extract from login interface */
-        var loginif = this._reg_fromloginif.exec(url);
+        var loginif = this._reg_fromloginif.exec(paramUrl);
         if (loginif) {
             switch (loginif[3]) {
                 case 'user_id':
@@ -588,7 +611,7 @@ var TV2DeveloperQuickBox = {
         }
         
         /* Extract from bugzilla site */
-        var bugzillaif = this._reg_frombugzilla.exec(url);
+        var bugzillaif = this._reg_frombugzilla.exec(paramUrl);
         if (bugzillaif) {
             action = 'go-bugzilla';
             if (bugzillaif[2]) {
@@ -599,7 +622,7 @@ var TV2DeveloperQuickBox = {
         }
         
         /* Extract link from ViewCVS site */
-        var fromviewcvs = this._reg_fromviewcvs.exec(url);
+        var fromviewcvs = this._reg_fromviewcvs.exec(paramUrl);
         if (fromviewcvs) {
             var tv2_sitename    = fromviewcvs[2];
             var tv2_sitetype    = fromviewcvs[3];
index 840b631263195af942d5049c616351895b3356eb..cedc3a17e6353341d21d4421d5b742f241926a4a 100644 (file)
@@ -200,11 +200,11 @@ var TV2Developer = {
     },
  
     /* Main function for adding all the links for the menu popup */   
-    _reg_tv2: /^https?:\/\/([^/.]*)?([^/]*?)(\.(robot|opdatering|template)\.?)?(\.((test|snapshot)3?)\.)?tv2\.dk((\/[^#\?]*).*)?$/,
+    _reg_tv2: /^https?:\/\/([^/.]*)?([^/]*?)(\.(robot|opdatering|template)\.?)?(\.(php4|php5)\.?)?(\.((test|snapshot)3?)\.)?tv2\.dk((\/[^#\?]*).*)?$/,
     _reg_php: /^(.*\.php)/,
     _reg_nodeid: /([0-9]{2,})/g,
     _reg_i2files: /\/([0-9]+)-/,
-    _reg_fromviewcvs: /^http:\/\/viewcvs\.tv2.dk:7467\/cgi-bin\/viewvc\.cgi\/([^/]+)\.tv2\.dk\/(webroot|robot|opdatering|template)([^#\?]+)/,
+    _reg_fromviewcvs: /^https?:\/\/flimmer\.tv2\.dk\/viewvc\/([^/]+)\.tv2\.dk\/(webroot|robot|opdatering|template)([^#\?]+)/,
     _reg_fromi2if: /^\/(tango\/(entry|requeue|dynamic)|tool\/pdo_log\/frameset)\.php.*?(\?|&)url=([^&]+)/,
     _reg_cutdomain: /^(.*)\.tv2\.dk$/,
     getLinks: function() {
@@ -213,25 +213,41 @@ var TV2Developer = {
         var encodedURL = encodeURIComponent(currentURL);
         var initials = TV2Util.getPref('developer-initials');
 
+               /* Check if we are on the ViewCVS site */
+               var fromviewcvs = this._reg_fromviewcvs.exec(currentURL);
+               
         // Adding links as appropiate if tv2.dk site
         var tv2 = this._reg_tv2.exec(currentURL);
-        if (tv2) {
+               
+        if (tv2 && !fromviewcvs) {
             var skip_treenodes = false;
             var tv2_sitename = tv2[1];
             var tv2_user     = tv2[2];
             var tv2_sitetype = tv2[4];
-            var tv2_testsite = tv2[6];
-            var tv2_testtype = tv2[7]; /* no 3 */
-            var tv2_uri      = tv2[8];
-            var tv2_uriOnly  = tv2[9]; // no parameters, anchers
+                       var tv2_apptype  = tv2[6]; // php4 or php5
+            var tv2_testsite = tv2[8];
+            var tv2_testtype = tv2[9]; /* no 3 */
+            var tv2_uri      = tv2[10];
+            var tv2_uriOnly  = tv2[11]; // no parameters, anchers
 
             // Strip -dyn and -static
             if (tv2_sitename) tv2_sitename = tv2_sitename.replace(/-(dyn|static)$/, '');
             if (tv2_user) tv2_user = tv2_user.replace(/^\./, '');
 
+                       // convert old URLs (.test3 / .snapshot3)
+                       if (tv2_testsite == 'test3') {
+                               tv2_testsite = 'test';
+                               tv2_apptype = 'php4';
+                       } else if (tv2_testsite == 'snapshot3') {
+                               tv2_testsite = 'snapshot';
+                               tv2_apptype = 'php4';
+                       }
+                       
             // php4 site
             var php4 = this._isPhp4(tv2_sitename);
-            var testType = php4 ? '3' : '';
+                       if (!tv2_apptype) {
+                               tv2_apptype = php4 ? 'php4' : 'php5';
+                       }
 
             // Handle sites with aliases (e.g. ol2008.tv2.dk is ol.tv2.dk on live... )
             var cvs_sitename;
@@ -270,9 +286,9 @@ var TV2Developer = {
                 }
             }
             
-            var testprompturl = cvs_sitename+'.'+'?'+(tv2_sitetype?'.'+tv2_sitetype:'')+'.test'+testType+'.tv2.dk';
-            var testurl       = cvs_sitename+'.'+initials+(tv2_sitetype?'.'+tv2_sitetype:'')+'.test'+testType+'.tv2.dk';
-            var snapshoturl   = cvs_sitename+(tv2_sitetype?'.'+tv2_sitetype:'')+'.snapshot'+testType+'.tv2.dk';
+            var testprompturl = cvs_sitename+'.'+'?'+(tv2_sitetype?'.'+tv2_sitetype:'')+'.'+tv2_apptype+'.test'+'.tv2.dk';
+            var testurl       = cvs_sitename+'.'+initials+(tv2_sitetype?'.'+tv2_sitetype:'')+'.'+tv2_apptype+'.test'+'.tv2.dk';
+            var snapshoturl   = cvs_sitename+(tv2_sitetype?'.'+tv2_sitetype:'')+'.'+tv2_apptype+'.snapshot'+'.tv2.dk';
             
             // Add the two urls we are not at
             if (!tv2_testsite) { // always add swaps to snapshot and the test site
@@ -296,11 +312,11 @@ var TV2Developer = {
             
             // Add link to .opdatering, .template, .robot
             var _prefix = (tv2_testsite ? cvs_sitename : live_sitename) + (tv2_user ? '.' + tv2_user : '');
-            var _postfix = (tv2_testsite ? '.' + tv2_testsite : '') + '.tv2.dk';
+            var _postfix = (tv2_testsite ? '.'+tv2_apptype+'.'+tv2_testsite : '') + '.tv2.dk';
             var opdatering = _prefix + '.opdatering' + _postfix;
             //var template = _prefix + '.template' + _postfix;
             var robot = _prefix + '.robot' + _postfix;
-            var normal = (tv2_testsite ? _prefix + '.' + tv2_testsite + '.tv2.dk'
+            var normal = (tv2_testsite ? _prefix + '.' + tv2_apptype + '.' + tv2_testsite + '.tv2.dk'
                                        : live_sitename_complete);
             links.push(new this.TV2Link('opdatering_swap', (tv2_sitetype!='opdatering')?opdatering:normal, '/',
                                         (tv2_sitetype!='opdatering') ? TV2Util.getStr('opdatering.accesskey') : TV2Util.getStr('webroot.accesskey')));
@@ -312,7 +328,7 @@ var TV2Developer = {
             links.push(new this.TV2LinkSplit());
             
             // Add the ViewCVS link, inspired by Adrian Bak (ADBA)
-            var viewcvs = 'http://viewcvs.tv2.dk:7467/cgi-bin/viewvc.cgi/'
+            var viewcvs = 'http://flimmer.tv2.dk/viewvc/'
                         + cvs_sitename + '.tv2.dk/' + (tv2_sitetype?tv2_sitetype:'webroot');
             var php = this._reg_php.exec(tv2_uriOnly);
             if (php) {
@@ -342,7 +358,7 @@ var TV2Developer = {
             // Update and I2 base URL
             var updatepostfix = (tv2_user ? '.' + tv2_user : '')
                               + '.opdatering'
-                              + (tv2_testtype ? '.' + tv2_testtype : '') + '.tv2.dk'
+                              + (tv2_testtype ? '.php5.' + tv2_testtype : '') + '.tv2.dk'
             var i2link = 'http://i2' + updatepostfix;
 
             // Check if we are on an Tango or I2 interface, then we can extract the URL again
@@ -377,7 +393,7 @@ var TV2Developer = {
             // Add run pdo_log link
             if ((onI2interface != 'tool/pdo_log/frameset') &&
                 ((!tv2_testsite && !php4) || // only php5 live sites
-                (tv2_testsite && tv2_testsite != 'snapshot3' && tv2_testsite != 'test3'))) { /* not supported on php4 sites */
+                (tv2_testsite && tv2_apptype != 'php4'))) { /* 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,
                    TV2Util.getStr('performDbPdoLog.accesskey'),
@@ -455,8 +471,7 @@ var TV2Developer = {
             
         } else {
             
-            /* Add links to the site if viewing info at ViewCVS site */
-            var fromviewcvs = this._reg_fromviewcvs.exec(currentURL);
+                       /* Add links to the site if viewing info at ViewCVS site */
             if (fromviewcvs) {
                 var tv2_sitename = fromviewcvs[1];
                 var tv2_sitetype = fromviewcvs[2];
@@ -469,15 +484,15 @@ var TV2Developer = {
 
                 // php4 sites
                 var php4 = this._isPhp4(tv2_sitename);
-                var testType = php4 ? '3' : '';
+                var appType = php4 ? 'php4.' : 'php5.';
 
                 var live_sitename = (tv2_sitetype=='webroot' && tv2_sitename=='www') ? '': (tv2_sitename+'.');
                 var type = (tv2_sitetype=='webroot')? '' : tv2_sitetype+'.';
                 
                 links.push(new this.TV2Link('viewcvs_live', live_sitename + type + 'tv2.dk', tv2_uri, TV2Util.getStr('live.accesskey')));
-                links.push(new this.TV2Link('viewcvs_test', tv2_sitename + '.' + initials + '.' + type + 'test' + testType + '.tv2.dk', tv2_uri, TV2Util.getStr('test.accesskey')));
-                links.push(new this.TV2Link('viewcvs_snapshot', tv2_sitename + '.' + type + 'snapshot' + testType + '.tv2.dk', tv2_uri, TV2Util.getStr('snapshot.accesskey')));
-                links.push(new this.TV2Link('viewcvs_testprompt', tv2_sitename + '.?.' + type + 'test' + testType + '.tv2.dk', tv2_uri, TV2Util.getStr('testprompt.accesskey'), 'promptInitials'));
+                links.push(new this.TV2Link('viewcvs_test', tv2_sitename + '.' + initials + '.' + type + appType + 'test' + '.tv2.dk', tv2_uri, TV2Util.getStr('test.accesskey')));
+                links.push(new this.TV2Link('viewcvs_snapshot', tv2_sitename + '.' + type + appType + 'snapshot' + '.tv2.dk', tv2_uri, TV2Util.getStr('snapshot.accesskey')));
+                links.push(new this.TV2Link('viewcvs_testprompt', tv2_sitename + '.?.' + type + appType + 'test' + '.tv2.dk', tv2_uri, TV2Util.getStr('testprompt.accesskey'), 'promptInitials'));
                 
             } else {
                 links.push(new this.TV2LinkWithLabel('disabled', TV2Util.getStr('notTV2Site'), null, '', null, true));
diff --git a/version b/version
index 24b197ac924b3c051d879c96640681cac8cb697d..ac454c6a1fc3f05f60d3772b45f0b1a5db4b9f87 100644 (file)
--- a/version
+++ b/version
@@ -1 +1 @@
-0.11.9
+0.12.0
index c1481fd6e4dfb1be06e66b9fc5d309dab8d0eec7..0e4621e12f6c825ddf8ab31317a7f3ed89152b20 100644 (file)
@@ -6,6 +6,10 @@
     </head>
     <body>
         <h1>What's new:</h1>
+        <ul>
+            <li>Test URLs where updated for new environment</li>
+                       <li>ViewVC URLs wehre updated.</li>
+        </ul>
         <ul>
             <li>Updated for Firefox 3.5</li>
         </ul>