/* @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);
// 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
// first take site name
if (!site) {
site = part;
+ // auto php4 if known php4 site
+ auto_php4 |= this._isPhp4(site);
continue;
}
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];
}
}
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) {
// 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;
}
- // auto php4 if known php4 site
- auto_php4 |= this._isPhp4(site);
-
// defaults
if (!protocol) protocol = 'http';
if (!uri) uri = '/';
}
}
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
},
/* 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':
}
/* 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':
}
/* 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]) {
}
/* 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];
},
/* 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() {
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;
}
}
- 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
// 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')));
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) {
// 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
// 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'),
} 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];
// 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));