if (target.id == 'action') {
document.getElementById('sitetype').disabled = !makeSiteURL;
document.getElementById('php5branch').disabled = (action != 'go-viewcvs');
+ document.getElementById('viewsource').disabled = (action != 'go-viewcvs');
document.getElementById('environment').disabled = (action == 'go-viewcvs');
}
document.getElementById('php4site').disabled = (!makeSiteURL || action == 'go-pdolog' || action == 'go-viewcvs')
document.getElementById('othertest');
}
this.updateQuickbox(true);
+ document.getElementById('shorturl').focus();
}
},
_reg_extract_nums: /([0-9]+)/g,
_reg_shortlink: /^((https?):\/?\/?)?([^/]*?)(tv2\.dk)?((\/[^#\?]*).*)?$/,
_reg_classname: /^[A-Z][a-zA-Z0-9_/]*(\.(p(hp?)?)?)?$/,
+ _reg_cvs_nopostfix: /^(?:archive|conf|default|phpincludes|symfoni|titoonic-includes)$/,
+ _reg_cvs_rootfolders: /^\/(((Java|build|inc|opdatering|robot|scripts|sql|template|views|php|php5|fonts|webroot)(\/|$)|\/))/,
_sitetypes: ['opdatering', 'robot', 'template'],
_envs: ['test', 'snapshot'],
updateQuickbox: function(manual) {
case 'go-viewcvs':
// Magically handle classnames (Enter as e.x. Tree_Node)
var classname = this._reg_classname.exec(shorturl);
+ var php5branch = document.getElementById('php5branch').checked;
+ var cvs_viewsource = document.getElementById('viewsource').checked;
if (classname) { // may want to move this section up a bit due to entered_url already set
var clsname = classname[0];
// remove ".php" :
if (classname[1]) {
clsname = clsname.substring(0, clsname.length-classname[1].length);
}
- clsname = clsname.replace(/_/,'/');
- // add php if not entered ends on a slash:
+ clsname = clsname.replace(/_/g,'/');
+ // add php if not entered path ends on a slash:
if (clsname.substr(-1) != '/') clsname += '.php';
uri = uriOnly = '/' + clsname;
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
+ //php5branch = true; // may want this auto default
}
var cvs_sitename = (!site) ? 'www' : site.replace(/-(static|dyn)/, '');
- var php5branch = document.getElementById('php5branch').checked;
url = 'http://viewcvs.tv2.dk:7467/cgi-bin/viewvc.cgi/';
+ var cvs_root = '/' + sitetype;
if (cvs_sitename == 'globals') {
// special support for globals
- url += 'globals/php/TV2';
+ url += cvs_sitename;
+ cvs_root = '/php/TV2';
+ } else if (this._reg_cvs_nopostfix.exec(cvs_sitename)) {
+ url += cvs_sitename;
+ cvs_root = '';
} else {
- url += cvs_sitename + '.tv2.dk/' + sitetype;
+ url += cvs_sitename + '.tv2.dk';
+ }
+ var entered_root = null;
+ if (uriOnly && (entered_root=this._reg_cvs_rootfolders.exec(uriOnly))) {
+ cvs_root = '';
+ if (entered_root[1]=='/') {
+ // you can exclude 'webroot' by written two slashes: '//'
+ uriOnly = uriOnly.substr(1);
+ }
}
+ var cvs_view = (!cvs_viewsource ? 'log' : 'markup')
+ url += cvs_root; // webroot, opdatering, robot,...
if (uriOnly) {
var php = /^(.*\.php)/.exec(uriOnly);
if (php) {
- url += php[1] + '?view=log';
+ url += php[1] + '?view=' + cvs_view;
} else if(uriOnly.substr(-1) == '/') {
- // we show the directory listing :-)
- url += uriOnly;
+ if (cvs_viewsource) {
+ url += uriOnly + 'index.php?view=' + cvs_view;
+ } else {
+ // we show the directory listing :-)
+ url += uriOnly;
+ }
} else {
- url += uriOnly + '?view=log';
+ url += uriOnly + '?view=' + cvs_view;
}
} else {
url += '/';
}
if (php5branch) {
url += (url.indexOf('?')!=-1?'&':'?') + 'pathrev=PHP5';
+ if (cvs_viewsource) {
+ url += '&revision=PHP5';
+ }
}
break;
case 'go-pdolog':
},
/* method to extract short url */
- _reg_fromviewcvs: /^http:\/\/viewcvs\.tv2.dk:7467\/cgi-bin\/viewvc\.cgi\/(([^/]+)\.tv2\.dk\/(webroot|robot|opdatering|template)|globals\/php\/TV2)([^#?]+)(.*)?/,
+ _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=([^&]+)/,
_extractURL: function(url) {
var action = 'go-site';
/* Extract link from ViewCVS site */
var fromviewcvs = this._reg_fromviewcvs.exec(url);
if (fromviewcvs) {
- var tv2_cvspath = fromviewcvs[1];
- var tv2_sitename = fromviewcvs[2];
- var tv2_sitetype = fromviewcvs[3];
- var tv2_uri = fromviewcvs[4];
- var tv2_php5branch = fromviewcvs[5];
+ var tv2_sitename = fromviewcvs[2];
+ var tv2_sitetype = fromviewcvs[3];
+ var tv2_rootfolder = fromviewcvs[4];
+ var tv2_uri = fromviewcvs[5];
+ var tv2_params = fromviewcvs[6];
action = 'go-viewcvs';
- if (tv2_sitename && tv2_sitetype) {
- url = tv2_sitename + (tv2_sitetype == 'webroot' ? '' : '.'+tv2_sitetype) + tv2_uri;
- } else { // must be globals match
- url = 'globals' + tv2_uri;
- }
- if (this._reg_viewcvsbranch.exec(tv2_php5branch)) {
- document.getElementById('php5branch').checked = true;
+ if (tv2_sitename) {
+ if (tv2_sitename == 'globals' && tv2_uri.indexOf('/php/TV2')==0) {
+ tv2_uri = '';
+ }
+ url = tv2_sitename;
+ if (tv2_sitetype) {
+ url += (tv2_sitetype == 'webroot' ? '' : '.'+tv2_sitetype);
+ } else if (this._reg_cvs_rootfolders.exec(tv2_rootfolder)) {
+ url += tv2_rootfolder;
+ } else {
+ url += '/' + tv2_rootfolder;
+ }
+ url += tv2_uri;
+ if (tv2_params) {
+ if (this._reg_viewcvsbranch.exec(tv2_params)) {
+ document.getElementById('php5branch').checked = true;
+ }
+ if (this._reg_viewcvsviewsource.exec(tv2_params)) {
+ document.getElementById('viewsource').checked = true;
+ }
+ }
+ } else {
+ url = '';
}
}
function() { TV2DeveloperQuickBox.setManuel(this); }, false);
document.getElementById('php5branch').addEventListener('CheckboxStateChange',
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)
// E = Node info
// F = Tango interface
// G = Look in tango
+// H = View source in ViewCVS
// I = I2 tree
// K = Lookup content
// L = Live
// V = W3C markup validator
// W = Webroot
// X = Examine database queries
+// Y = Flush cache
var TV2Developer = {
} else {
viewcvs += tv2_uriOnly;
}
+ var viewcvs_source = viewcvs + '?view=markup';
viewcvs += '?view=log';
// we set a nice type so we can swap between using the button (test<>viewcvs, live<>viewcvs,...)
var viewcvs_type;
}
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')));
// Update and I2 base URL
var updatepostfix = (tv2_user ? '.' + tv2_user : '')
var tv2_uri = fromviewcvs[3];
// cut off 'index.php'
- if (tv2_uri.substr(-9) == 'index.php') {
+ if (tv2_uri.substr(-10) == '/index.php') {
tv2_uri = tv2_uri.substr(0, tv2_uri.length-9);
}
links.push(new this.TV2LinkWithLabel('tango/entry', TV2Util.getStr('tangoInterface'), 'http://i2.opdatering.tv2.dk/tango/', TV2Util.getStr('tangoInterface.accesskey')));
links.push(new this.TV2LinkWithLabel('w3c', TV2Util.getStr('w3c'),
'http://validator.w3.org/check?uri=' + encodedURL, TV2Util.getStr('w3c.accesskey')));
+ links.push(new this.TV2LinkWithLabel('flushcache', TV2Util.getStr('flushCache'),
+ '', TV2Util.getStr('flushCache.accesskey'), 'flushCache'));
+
return links;
},
}
}
/* follow link */
- openUILink(url, event, false, true, false); /* allow ctrl, not alt, and don't google */
+ if (url != '') {
+ openUILink(url, event, false, true, false); /* allow ctrl, not alt, and don't google */
+ }
if (tv2linktype) {
this._lastAction = tv2linktype;
TV2Util.setPref('lastaction-linktype', tv2linktype);