} else {
// determind action
var cur_action = document.getElementById('action').selectedItem;
- if (this._reg_ttv.exec(site)) {
- auto_action = 'go-ttv-page';
- } else if (this._reg_nodeid.exec(site)) {
- auto_action = 'go-node';
- } else if (this._reg_classname.exec(shorturl)) {
- auto_action = 'go-viewcvs';
- } else {
- // if we are using the user input as an url we keep an eventually already selected action
- if (!this._shouldMakeURL(cur_action.id)) {
- auto_action = 'go-site';
- } else {
+ // lock action and environment for these actions
+ switch (cur_action.id) {
+ case 'go-content-id':
+ case 'go-userid':
+ case 'go-username':
auto_action = cur_action.id;
+ break;
+ default:
+ if (this._reg_ttv.exec(site)) {
+ auto_action = 'go-ttv-page';
+ } else if (this._reg_nodeid.exec(site)) {
+ auto_action = 'go-node';
+ } else if (this._reg_classname.exec(shorturl)) {
+ auto_action = 'go-viewcvs';
+ } else {
+ // if we are using the user input as an url we keep an eventually already selected action
+ if (!this._shouldMakeURL(cur_action.id)) {
+ auto_action = 'go-site';
+ } else {
+ auto_action = cur_action.id;
+ }
}
}
// set options
// Handle actions - part one set host
var longest_id = null;
- var action_uses_i2_opdatering = false;
+ var action_uses_opdatering = false;
var action_on_url_encoded;
+ var go_username;
switch (action) {
case 'go-node':
case 'go-content-id':
case 'go-ttv-page':
+ case 'go-userid':
// find longest id in entered url
var max_len = 0;
var cur_id;
validState = false;
longest_id = '?';
}
- action_uses_i2_opdatering = true;
+ action_uses_opdatering = true;
+ site = (action == 'go-userid' ? 'login' : 'i2');
break;
case 'go-pdolog':
php4 = false; // not allowed
case 'go-tango-requeue':
case 'go-dynamic':
action_on_url_encoded = encodeURIComponent(this._makeUrl(protocol, env, sitetype, php4, username, site, uri, true));
- action_uses_i2_opdatering = true;
+ action_uses_opdatering = true;
+ site = 'i2';
break;
case 'go-viewcvs':
break;
+ case 'go-username':
+ action_uses_opdatering = true;
+ go_username = site;
+ site = 'login';
+ break;
}
- if (action_uses_i2_opdatering) {
+ if (action_uses_opdatering) {
protocol='http';
- site = 'i2';
sitetype = 'opdatering';
php4 = false;
- }
+ }
// Handle actions - part two set uri
switch (action) {
- case 'go-user-id':
+ case 'go-userid':
// Use longest_id as the userid
- site = 'login';
- uri = 'opslag.php?user_id=' + longest_id;
+ uri = '/opslag.php?user_id=' + longest_id;
break;
- case 'go-user-name':
- site = 'login';
+ case 'go-username':
// Just assume a username was entered
- uri = 'opslag.php?username=' + shorturl;
+ uri = '/opslag.php?username=' + go_username;
break;
case 'go-node':
uri = '/tool/node/?id=' + longest_id;
_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_fromi2if: /^http:\/\/i2\.(?:[^.]+\.)?opdatering\.(?:(?:test|snapshot)\.)?tv2\.dk\/(tango\/(entry|requeue|dynamic)|tool\/pdo_log\/frameset)\.php.*?(\?|&)url=([^&]+)/,
+ _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)=([^&]+)/,
_extractURL: function(url) {
var action = 'go-site';
action = 'go-pdolog';
break;
}
- url = decodeURIComponent(tangoif[4]);
+ url = decodeURIComponent(tangoif[3]);
+ }
+
+ /* Extract from login interface */
+ var loginif = this._reg_fromloginif.exec(url);
+ if (loginif) {
+ switch (loginif[3]) {
+ case 'user_id':
+ action = 'go-userid';
+ break;
+ case 'username':
+ action = 'go-username';
+ break;
+ }
+ url = loginif[4]; /* username or user_id */
+ /* extract environment */
+ if (loginif[2]) {
+ var env = loginif[2];
+ if (env == 'test') {
+ var current_user = TV2Util.getPref('developer-initials');
+ if (loginif[1] != current_user) {
+ url += '.' + loginif[1] + '.t'; // othertest
+ } else {
+ url += '.t'; // test
+ }
+ } else {
+ url += '.s'; // snapshot
+ }
+ document.getElementById('environment').selectedItem = document.getElementById(env);
+ }
}
+
/* Extract link from ViewCVS site */
var fromviewcvs = this._reg_fromviewcvs.exec(url);
if (fromviewcvs) {
/* onload */
setupQuickbox: function() {
+ // extract parameters
if (window.arguments && window.arguments[0]) {
this._extractURL(window.arguments[0]);
}
+ // init saved fields
+ document.getElementById('testname').value = TV2Util.getPref('alternativ-initials', '');
+ // init box
this.updateQuickbox();
document.getElementById('php4site').addEventListener('CheckboxStateChange',
function() { TV2DeveloperQuickBox.setManuel(this); }, false);
function() { TV2DeveloperQuickBox.setManuel(this); }, false);
document.getElementById('viewsource').addEventListener('CheckboxStateChange',
function() { TV2DeveloperQuickBox.setManuel(this); }, false);
- // init saved fields
- document.getElementById('testname').value = TV2Util.getPref('alternativ-initials', '');
// auto go (ALT+4)
if (window.arguments && window.arguments[1]) {
this.goQuickbox();
<groupbox flex="2">
<caption label="&quickbox.sitetype;" />
<radiogroup id="sitetype" onselect="TV2DeveloperQuickBox.setManuel(this)">
- <radio id="webroot" label="webroot" accesskey="w"/>
+ <radio id="webroot" label="webroot" accesskey="w" selected="true"/>
<radio id="opdatering" label="opdatering" accesskey="o"/>
<radio id="robot" label="robot" accesskey="r"/>
<radio id="template" label="template" accesskey="e"/>
<groupbox flex="1">
<caption label="&quickbox.environment;"/>
<radiogroup id="environment" onselect="TV2DeveloperQuickBox.setManuel(this)">
- <radio id="live" label="Live site" accesskey="l"/>
+ <radio id="live" label="Live site" accesskey="l" selected="true"/>
<radio id="test" label="Test site" accesskey="t"/>
<radio id="snapshot" label="Snapshot site" accesskey="s"/>
<hbox>
<radio id="go-node" label="&quickbox.nodeid;" accesskey="&quickbox.nodeid.accesskey;"/>
<radio id="go-content-id" label="&quickbox.contentid;" accesskey="&quickbox.contentid.accesskey;"/>
<radio id="go-ttv-page" label="&quickbox.ttvpage;" accesskey="&quickbox.ttvpage.accesskey;"/>
- <radio id="go-user-id" label="&quickbox.userid;" accesskey="&quickbox.userid.accesskey;"/>
- <radio id="go-user-name" label="&quickbox.username;" accesskey="&quickbox.username.accesskey;"/>
+ <radio id="go-userid" label="&quickbox.userid;" accesskey="&quickbox.userid.accesskey;"/>
+ <radio id="go-username" label="&quickbox.username;" accesskey="&quickbox.username.accesskey;"/>
</groupbox>
</hbox>
</radiogroup>