// TV 2 Developer Plugin
// Javascript Implementation
// @author Kristian Kræmmer Nielsen <jkkn@tv2.dk>
+//
+// Keyboard shortcuts
+// . = Prompttest
+// A = Template
+// B = Robot
+// C = Back from i2
+// C = Lookup content
+// D = Dynamic version
+// E = Node info
+// F = Tango interface
+// G = Look in tango
+// I = I2 tree
+// L = Live
+// M = W3c markup validator
+// N = Node lookup
+// O = Opdatering
+// P = Ttv page
+// P = Ttvpumpe
+// R = Requeue in tango
+// S = Snapshot
+// T = Test
+// U = Node query tool
+// V = Viewcvs
+// W = Webroot
+// X = Examine database queries
+
var TV2Developer = {
return this._strs;
},
+ getStr: function(str) {
+ try {
+ return this.strs.getString(str);
+ } catch(e) {
+ alert('Missing string: ' + str);
+ }
+ },
+
_prefs: null,
get prefs() {
if (!this._prefs)
}
},
- TV2Link: function(type, domain, uri, flags) {
+ TV2Link: function(type, domain, uri, accesskey, flags) {
this.type = type;
this.label = domain;
this.url = 'http://' + domain + uri;
+ if (accesskey) this.accesskey = accesskey;
this.disabled = false;
this.flags = (flags ? flags : '');
},
this.type = 'split';
},
- TV2LinkWithLabel: function(type, label, url, flags, disabled) {
+ TV2LinkWithLabel: function(type, label, url, accesskey, flags, disabled) {
this.type = type;
this.label = label;
this.url = url;
+ if (accesskey) this.accesskey = accesskey;
this.disabled = typeof(disabled)!='undefined' ? disabled : false;
this.flags = (flags ? flags : '');
},
} else {
item = document.createElement('menuitem');
item.setAttribute('label', tv2link.label);
+ if (tv2link.accesskey)
+ item.setAttribute('accesskey', tv2link.accesskey);
item.setAttribute('url', tv2link.url);
item.setAttribute('tooltiptext', tv2link.label);
item.setAttribute('disabled', tv2link.disabled);
//_reg_php5: /^(www|i2|common|ttvpumpe|1234|nyhederne)$/,
_reg_php5: /^(1234|i2|nyhederne)$/,
_reg_fromviewcvs: /^http:\/\/viewcvs\.tv2.dk:7467\/cgi-bin\/viewvc\.cgi\/([^/]+)\.tv2\.dk\/(webroot|robot|opdatering|template)([^#\?]+)/,
- _reg_fromi2if: /^\/(tango\/(entry|requeue|dynamic)|tool\/pdo_log\/frameset)\.php\?url=([^&]+)/,
+ _reg_fromi2if: /^\/(tango\/(entry|requeue|dynamic)|tool\/pdo_log\/frameset)\.php.*?(\?|&)url=([^&]+)/,
getLinks: function() {
var links = new Array();
var currentURL = getBrowser().currentURI.spec;
// Add the two urls we are not at
if (!tv2_testsite) { // always add swaps to snapshot and the test site
- links.push(new this.TV2Link('test_live_swap', testurl, tv2_uri));
- links.push(new this.TV2Link('snapshot_live_swap', snapshoturl, tv2_uri));
- links.push(new this.TV2Link('testprompt_swap', testprompturl, tv2_uri, 'promptInitials'));
+ links.push(new this.TV2Link('test_live_swap', testurl, tv2_uri, 't'));
+ links.push(new this.TV2Link('snapshot_live_swap', snapshoturl, tv2_uri, 's'));
+ links.push(new this.TV2Link('testprompt_swap', testprompturl, tv2_uri, '.', 'promptInitials'));
} else if (tv2_testtype == 'snapshot') {
- links.push(new this.TV2Link('snapshot_live_swap', liveurl, tv2_uri));
- links.push(new this.TV2Link('test_snapshot_swap', testurl, tv2_uri));
- links.push(new this.TV2Link('testprompt_swap', testprompturl, tv2_uri, 'promptInitials'));
+ links.push(new this.TV2Link('snapshot_live_swap', liveurl, tv2_uri, 'l'));
+ links.push(new this.TV2Link('test_snapshot_swap', testurl, tv2_uri, 't'));
+ links.push(new this.TV2Link('testprompt_swap', testprompturl, tv2_uri, '.', 'promptInitials'));
} else { // must be test
- links.push(new this.TV2Link('test_live_swap', liveurl, tv2_uri));
- links.push(new this.TV2Link('test_snapshot_swap', snapshoturl, tv2_uri));
+ links.push(new this.TV2Link('test_live_swap', liveurl, tv2_uri, 'l'));
+ links.push(new this.TV2Link('test_snapshot_swap', snapshoturl, tv2_uri, 's'));
if (tv2_user != initials) {
- links.push(new this.TV2Link('test_swap', testurl, tv2_uri));
+ links.push(new this.TV2Link('test_swap', testurl, tv2_uri, 't'));
}
- links.push(new this.TV2Link('testprompt_swap', testprompturl, tv2_uri, 'promptInitials'));
+ links.push(new this.TV2Link('testprompt_swap', testprompturl, tv2_uri, '.', 'promptInitials'));
}
links.push(new this.TV2LinkSplit());
var robot = _prefix + '.robot' + _postfix;
var normal = (tv2_testsite ? _prefix + '.' + tv2_testsite + '.tv2.dk'
: live_sitename + 'tv2.dk');
- links.push(new this.TV2Link('opdatering_swap', (tv2_sitetype!='opdatering')?opdatering:normal, '/'));
- //links.push(new this.TV2Link('template_swap', (tv2_sitetype!='template')?template:normal, '/'));
- links.push(new this.TV2Link('robot_swap', (tv2_sitetype!='robot')?robot:normal, '/'));
+ links.push(new this.TV2Link('opdatering_swap', (tv2_sitetype!='opdatering')?opdatering:normal, '/', (tv2_sitetype!='opdatering')?'o':'w'));
+ //links.push(new this.TV2Link('template_swap', (tv2_sitetype!='template')?template:normal, '/', (tv2_sitetype!='template')?'a':'w'));
+ links.push(new this.TV2Link('robot_swap', (tv2_sitetype!='robot')?robot:normal, '/', (tv2_sitetype!='robot')?'b':'w'));
links.push(new this.TV2LinkSplit());
} else {
viewcvs_type = 'viewcvs_test';
}
- links.push(new this.TV2LinkWithLabel(viewcvs_type, this.strs.getString('lookupInViewCVS'), viewcvs));
+ links.push(new this.TV2LinkWithLabel(viewcvs_type, this.getStr('lookupInViewCVS'), viewcvs,
+ this.getStr('lookupInViewCVS.accesskey')));
// Update and I2 base URL
var updatepostfix = (tv2_user ? '.' + tv2_user : '')
var tangoif = this._reg_fromi2if.exec(tv2_uri);
if (tangoif) {
onI2interface = tangoif[1];
- onI2interface_url = decodeURIComponent(tangoif[3]);
+ onI2interface_url = decodeURIComponent(tangoif[4]);
}
}
var docWin = getBrowser().contentWindow;
if (docWin.wrappedJSObject && docWin.wrappedJSObject.Tango_URL) {
tango = encodeURIComponent(docWin.wrappedJSObject.Tango_URL);
- links.push(new this.TV2LinkWithLabel('tango/dynamic', this.strs.getString('viewDynamicVersion'),
- i2link + '/tango/dynamic.php?url='+tango+'&referer='+encodedURL, 'flushCache'));
+ links.push(new this.TV2LinkWithLabel('tango/dynamic', this.getStr('viewDynamicVersion'),
+ i2link + '/tango/dynamic.php?url='+tango+'&referer='+encodedURL,
+ this.getStr('viewDynamicVersion.accesskey'),
+ 'flushCache'));
}
if (onI2interface != 'tango/entry' && onI2interface != 'tango/requeue') {
- links.push(new this.TV2LinkWithLabel('tango/entry', this.strs.getString('lookupInTango'),
- i2link + '/tango/entry.php?url=' + tango));
- links.push(new this.TV2LinkWithLabel('tango/requeue', this.strs.getString('requeueInTango'),
- i2link + '/tango/requeue.php?url=' + tango));
+ links.push(new this.TV2LinkWithLabel('tango/entry', this.getStr('lookupInTango'),
+ i2link + '/tango/entry.php?url=' + tango, this.getStr('lookupInTango.accesskey')));
+ links.push(new this.TV2LinkWithLabel('tango/requeue', this.getStr('requeueInTango'),
+ i2link + '/tango/requeue.php?url=' + tango, this.getStr('requeueInTango.accesskey')));
}
// Add run pdo_log link
if (onI2interface != 'tool/pdo_log/frameset') {
- links.push(new this.TV2LinkWithLabel('tool/pdo_log/frameset', this.strs.getString('performDbPdoLog'),
- i2link + '/tool/pdo_log/frameset.php?url='+tango+'&autostop=1&prefix='+initials, 'flushCache'));
+ links.push(new this.TV2LinkWithLabel('tool/pdo_log/frameset', this.getStr('performDbPdoLog'),
+ i2link + '/tool/pdo_log/frameset.php?url='+tango+'&autostop=1&prefix='+initials,
+ this.getStr('performDbPdoLog.accesskey'),
+ 'flushCache'));
}
if (onI2interface_url) {
/* link entered in I2 interface */
links.push(new this.TV2LinkSplit());
/* tango/entry, tango/requeue, tango/dynamic, tool/pdo_log */
- links.push(new this.TV2LinkWithLabel(onI2interface, onI2interface_url, onI2interface_url));
+ links.push(new this.TV2LinkWithLabel(onI2interface, onI2interface_url, onI2interface_url, 'c'));
}
// Some special cases for some sites
var ttv_page = /side=([0-9]+)/.exec(tv2_uri);
if (ttv_page) {
skip_treenodes = true;
- links.push(new this.TV2LinkWithLabel('ttvpage', this.strs.getString('lookupTTVPage') + ' ' + ttv_page[1],
- i2link + '/tool/ttv/?1=' + ttv_page[1] + '&2=0')); /* hardcoded to TV 2 TTV */
+ links.push(new this.TV2LinkWithLabel('ttvpage', this.getStr('lookupTTVPage') + ' ' + ttv_page[1],
+ i2link + '/tool/ttv/?1=' + ttv_page[1] + '&2=0', /* hardcoded to TV 2 TTV */
+ this.getStr('lookupTTVPage.accesskey')));
}
- /*links.push(new this.TV2Link('ttvpumpe', 'ttvpumpe'+updatepostfix, '/'));*/
- links.push(new this.TV2Link('ttvpumpe', 'ttvpumpe.opdatering.tv2.dk', '/'));
+ /*links.push(new this.TV2Link('ttvpumpe', 'ttvpumpe'+updatepostfix, '/', 'p'));*/
+ links.push(new this.TV2Link('ttvpumpe', 'ttvpumpe.opdatering.tv2.dk', '/', 'p'));
}
// I2-Files and I2-Images
}
}
links.push(new this.TV2LinkSplit());
- links.push(new this.TV2LinkWithLabel('i2files', this.strs.getString('lookupContent')+ ' ' + contentId[1] + ', ' +
- this.strs.getString('lookupContent.type') + ' ' + typeName,
+ links.push(new this.TV2LinkWithLabel('i2files', this.getStr('lookupContent') + ' ' + contentId[1] + ', ' +
+ this.getStr('lookupContent.type') + ' ' + typeName,
i2link +
- '/tool/query/?id=&_checkbox=1&2=&3='+typeId+'&content_id='+contentId[1]+'&4=&5=0&6=&action=Query&timeout=1'));
+ '/tool/query/?id=&_checkbox=1&2=&3='+typeId+'&content_id='+contentId[1]+'&4=&5=0&6=&action=Query&timeout=1',
+ this.getStr('lookupContent.accesskey')
+ ));
}
}
links.push(new this.TV2LinkSplit());
first = false;
}
- links.push(new this.TV2LinkWithLabel('node', this.strs.getString('lookupTreeNode') + ' ' + nodeids[1],
- i2node + nodeids[1]));
+ links.push(new this.TV2LinkWithLabel('node', this.getStr('lookupTreeNode') + ' ' + nodeids[1],
+ i2node + nodeids[1],
+ this.getStr('lookupTreeNode.accesskey')
+ ));
}
}
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));
- links.push(new this.TV2Link('viewcvs_test', tv2_sitename + '.' + initials + '.' + type + 'test' + testType + '.tv2.dk', tv2_uri));
- links.push(new this.TV2Link('viewcvs_snapshot', tv2_sitename + '.' + type + 'snapshot' + testType + '.tv2.dk', tv2_uri));
- links.push(new this.TV2Link('viewcvs_testprompt', tv2_sitename + '.?.' + type + 'test' + testType + '.tv2.dk', tv2_uri, 'promptInitials'));
+ links.push(new this.TV2Link('viewcvs_live', live_sitename + type + 'tv2.dk', tv2_uri, 'l'));
+ links.push(new this.TV2Link('viewcvs_test', tv2_sitename + '.' + initials + '.' + type + 'test' + testType + '.tv2.dk', tv2_uri, 't'));
+ links.push(new this.TV2Link('viewcvs_snapshot', tv2_sitename + '.' + type + 'snapshot' + testType + '.tv2.dk', tv2_uri, 's'));
+ links.push(new this.TV2Link('viewcvs_testprompt', tv2_sitename + '.?.' + type + 'test' + testType + '.tv2.dk', tv2_uri, '.', 'promptInitials'));
} else {
- links.push(new this.TV2LinkWithLabel('disabled', this.strs.getString('notTV2Site'), null, '', true));
+ links.push(new this.TV2LinkWithLabel('disabled', this.getStr('notTV2Site'), null, '', null, true));
links.push(new this.TV2LinkSplit());
- links.push(new this.TV2Link('tv2dk', 'tv2.dk', '/'));
+ links.push(new this.TV2Link('tv2dk', 'tv2.dk', '/', 't'));
}
}
// Utility links
links.push(new this.TV2LinkSplit());
- links.push(new this.TV2LinkWithLabel('link_tree', this.strs.getString('i2Tree'), 'http://i2.opdatering2.tv2.dk/tree/'));
- links.push(new this.TV2LinkWithLabel('node', this.strs.getString('nodeInformationTool'), 'http://i2.opdatering2.tv2.dk/tool/node/'));
- links.push(new this.TV2LinkWithLabel('link_query', this.strs.getString('nodeQueryTool'), 'http://i2.opdatering2.tv2.dk/tool/query/'));
- links.push(new this.TV2LinkWithLabel('tango/entry', this.strs.getString('tangoInterface'), 'http://i2.opdatering2.tv2.dk/tango/'));
- links.push(new this.TV2LinkWithLabel('w3c', this.strs.getString('w3c'),
- 'http://validator.w3.org/check?uri=' + encodedURL));
+ links.push(new this.TV2LinkWithLabel('link_tree', this.getStr('i2Tree'), 'http://i2.opdatering2.tv2.dk/tree/', this.getStr('i2Tree.accesskey')));
+ links.push(new this.TV2LinkWithLabel('node', this.getStr('nodeInformationTool'), 'http://i2.opdatering2.tv2.dk/tool/node/', this.getStr('nodeInformationTool.accesskey')));
+ links.push(new this.TV2LinkWithLabel('link_query', this.getStr('nodeQueryTool'), 'http://i2.opdatering2.tv2.dk/tool/query/', this.getStr('nodeQueryTool.accesskey')));
+ links.push(new this.TV2LinkWithLabel('tango/entry', this.getStr('tangoInterface'), 'http://i2.opdatering2.tv2.dk/tango/', this.getStr('tangoInterface.accesskey')));
+ links.push(new this.TV2LinkWithLabel('w3c', this.getStr('w3c'),
+ 'http://validator.w3.org/check?uri=' + encodedURL, this.getStr('w3c.accesskey')));
return links;
},