added accesskeys
authorjkkn <jkkn>
Wed, 17 Oct 2007 14:06:46 +0000 (14:06 +0000)
committerjkkn <jkkn>
Wed, 17 Oct 2007 14:06:46 +0000 (14:06 +0000)
content/tv2developer.js
locale/en-US/tv2developer.properties
version

index 685a57bbd521c71e66bdc16cb4934481d70b1ed9..e3605498fa4499e0d38f7f76de5ba2c9cd5827ed 100755 (executable)
@@ -1,6 +1,32 @@
 // 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 = {
     
@@ -45,6 +71,14 @@ 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)
@@ -96,10 +130,11 @@ var TV2Developer = {
         }
     },
     
-    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 : '');
     },
@@ -108,10 +143,11 @@ var TV2Developer = {
         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 : '');
     },
@@ -124,6 +160,8 @@ var TV2Developer = {
         } 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);
@@ -145,7 +183,7 @@ var TV2Developer = {
     //_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;
@@ -193,20 +231,20 @@ var TV2Developer = {
             
             // 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());
@@ -219,9 +257,9 @@ var TV2Developer = {
             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());
             
@@ -246,7 +284,8 @@ var TV2Developer = {
             } 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 : '')
@@ -261,7 +300,7 @@ var TV2Developer = {
                 var tangoif = this._reg_fromi2if.exec(tv2_uri);
                 if (tangoif) {
                     onI2interface = tangoif[1];
-                    onI2interface_url = decodeURIComponent(tangoif[3]);
+                    onI2interface_url = decodeURIComponent(tangoif[4]);
                 }
             }
             
@@ -271,27 +310,31 @@ var TV2Developer = {
             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 
@@ -300,11 +343,12 @@ var TV2Developer = {
                 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
@@ -325,10 +369,12 @@ var TV2Developer = {
                         }
                     }
                     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')
+                            ));
                 }
             }
             
@@ -342,8 +388,10 @@ var TV2Developer = {
                         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')
+                                ));
                }
             }
             
@@ -369,26 +417,26 @@ var TV2Developer = {
                 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;
         
     },
index c7c90867ee16c52fe802aa751bb78f935cc3da0e..8f4e788ecaa28da9f95529bf0f74acbe0b8ad05c 100755 (executable)
@@ -1,18 +1,42 @@
 lookupInViewCVS=Lookup this page in ViewCVS
+lookupInViewCVS.accesskey=v
+
 viewDynamicVersion=View dynamic version of this page
+viewDynamicVersion.accesskey=d
+
 lookupInTango=Tango: Lookup this page
+lookupInTango.accesskey=g
+
 requeueInTango=Tango: Open requeue
+requeueInTango.accesskey=r
+
 performDbPdoLog=Examine database queries
+performDbPdoLog.accesskey=x
+
 lookupTTVPage=Lookup TTV page
+lookupTTVPage.accesskey=p
+
 lookupContent=Lookup content ID
 lookupContent.type=type
+lookupContent.accesskey=c
+
 lookupTreeNode=Lookup tree node with ID
+lookupTreeNode.accesskey=n
 notTV2Site=Not a tv2.dk site
 
 i2Tree=I2 Tree
+i2Tree.accesskey=i
+
 nodeInformationTool=Node Information Tool
+nodeInformationTool.accesskey=e
+
 nodeQueryTool=Node Query Tool
+nodeQueryTool.accesskey=u
+
 tangoInterface=Tango Interface
+tangoInterface.accesskey=f
+
 w3c=W3C Markup Validator
+w3c.accesskey=m
 
 enterInitials=Enter TV 2 initials (e.x. jkkn):
diff --git a/version b/version
index 8f0916f768f0487bcf8d33827ce2c8dcecb645c1..4b9fcbec101a6ff8ec68e0f95131ccda4861407f 100644 (file)
--- a/version
+++ b/version
@@ -1 +1 @@
-0.5.0
+0.5.1