cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prachida...@apache.org
Subject [76/91] [abbrv] git commit: updated refs/heads/planner_reserve to fb18223
Date Thu, 09 May 2013 00:21:27 GMT
CLOUDSTACK-957: Localization -- Add UK keyboard support.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b6cb23cb
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b6cb23cb
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b6cb23cb

Branch: refs/heads/planner_reserve
Commit: b6cb23cb99c9daee41b46a3fc13fffabfb791dc3
Parents: 3a41a83
Author: Sanjay Tripathi <sanjay.tripathi@citrix.com>
Authored: Wed Apr 3 11:56:17 2013 +0530
Committer: Likitha Shetty <likitha.shetty@citrix.com>
Committed: Wed May 8 12:06:07 2013 +0530

----------------------------------------------------------------------
 services/console-proxy/server/css/ajaxviewer.css   |    6 +-
 services/console-proxy/server/js/ajaxkeys.js       |  295 +++++++++++++--
 services/console-proxy/server/js/ajaxviewer.js     |  128 ++-----
 .../cloud/consoleproxy/ConsoleProxyClientBase.java |    1 +
 4 files changed, 295 insertions(+), 135 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b6cb23cb/services/console-proxy/server/css/ajaxviewer.css
----------------------------------------------------------------------
diff --git a/services/console-proxy/server/css/ajaxviewer.css b/services/console-proxy/server/css/ajaxviewer.css
index 5ea552b..fd2fb3c 100644
--- a/services/console-proxy/server/css/ajaxviewer.css
+++ b/services/console-proxy/server/css/ajaxviewer.css
@@ -91,12 +91,12 @@ body {
     position: absolute;
     top:32;
     width: 260;
-    height: 65;
+    height: 95;
     display: block;
     display: none;
     border-top: 1px solid black;
-    background-image:url(/resource/images/back.gif); 
-    background-repeat:repeat-x repeat-y; 
+    background-image:url(/resource/images/back.gif);
+    background-repeat:repeat-x repeat-y;
 }
 
 #toolbar ul li ul li {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b6cb23cb/services/console-proxy/server/js/ajaxkeys.js
----------------------------------------------------------------------
diff --git a/services/console-proxy/server/js/ajaxkeys.js b/services/console-proxy/server/js/ajaxkeys.js
index 2ecf5b5..1ed41c5 100644
--- a/services/console-proxy/server/js/ajaxkeys.js
+++ b/services/console-proxy/server/js/ajaxkeys.js
@@ -23,55 +23,286 @@ under the License.
  * They are used by the ajaxviewer.js
  */
 
-//client event type. corresponds to events in ajaxviewer. 
-X11_KEY_CIRCUMFLEX_ACCENT = 0x5e;    // ^
-X11_KEY_YEN_MARK = 0xa5;
+//client event type. corresponds to events in ajaxviewer.
+
+
+//use java AWT key modifier masks
+JS_KEY_BACKSPACE = 8;
+JS_KEY_TAB = 9;
+JS_KEY_ENTER = 13;
+JS_KEY_SHIFT = 16;
+JS_KEY_CTRL = 17;
+JS_KEY_ALT = 18;
+JS_KEY_CAPSLOCK = 20;
+JS_KEY_ESCAPE = 27;
+JS_KEY_PAGEUP = 33;
+JS_KEY_PAGEDOWN = 34;
+JS_KEY_END = 35;
+JS_KEY_HOME = 36;
+JS_KEY_LEFT = 37;
+JS_KEY_UP = 38;
+JS_KEY_RIGHT = 39;
+JS_KEY_DOWN = 40;
+JS_KEY_INSERT = 45;
+JS_KEY_DELETE = 46;
+JS_KEY_SELECT_KEY = 93;
+JS_KEY_NUMPAD0 = 96;
+JS_KEY_NUMPAD1 = 97;
+JS_KEY_NUMPAD2 = 98;
+JS_KEY_NUMPAD3 = 99;
+JS_KEY_NUMPAD4 = 100;
+JS_KEY_NUMPAD5 = 101;
+JS_KEY_NUMPAD6 = 102;
+JS_KEY_NUMPAD7 = 103;
+JS_KEY_NUMPAD8 = 104;
+JS_KEY_NUMPAD9 = 105;
+JS_KEY_MULTIPLY = 106;
+JS_KEY_ADD = 107;
+JS_KEY_SUBSTRACT = 109;
+JS_KEY_DECIMAL_POINT = 110;
+JS_KEY_DIVIDE = 111;
+JS_KEY_F1 = 112;
+JS_KEY_F2 = 113;
+JS_KEY_F3 = 114;
+JS_KEY_F4 = 115;
+JS_KEY_F5 = 116;
+JS_KEY_F6 = 117;
+JS_KEY_F7 = 118;
+JS_KEY_F8 = 119;
+JS_KEY_F9 = 120;
+JS_KEY_F10 = 121;
+JS_KEY_F11 = 122;
+JS_KEY_F12 = 123;
+JS_KEY_SEMI_COLON = 186;			// ;
+JS_KEY_COMMA = 188;				// ,
+JS_KEY_DASH = 189;				// -
+JS_KEY_PERIOD = 190;				// .
+JS_KEY_FORWARD_SLASH = 191;		// /
+JS_KEY_GRAVE_ACCENT = 192;		// `
+JS_KEY_OPEN_BRACKET = 219;		// [
+JS_KEY_BACK_SLASH = 220;			// \
+JS_KEY_CLOSE_BRACKET = 221;		// ]
+JS_KEY_SINGLE_QUOTE = 222;		// '
+
+
+//X11 keysym definitions
+X11_KEY_CAPSLOCK = 0xffe5;
+X11_KEY_BACKSPACE = 0xff08;
+X11_KEY_TAB = 0xff09;
+X11_KEY_ENTER = 0xff0d;
+X11_KEY_ESCAPE = 0xff1b;
+X11_KEY_INSERT = 0xff63;
+X11_KEY_DELETE = 0xffff;
+X11_KEY_HOME = 0xff50;
+X11_KEY_END = 0xff57;
+X11_KEY_PAGEUP = 0xff55;
+X11_KEY_PAGEDOWN = 0xff56;
+X11_KEY_LEFT = 0xff51;
+X11_KEY_UP = 0xff52;
+X11_KEY_RIGHT = 0xff53;
+X11_KEY_DOWN = 0xff54;
+X11_KEY_F1 = 0xffbe;
+X11_KEY_F2 = 0xffbf;
+X11_KEY_F3 = 0xffc0;
+X11_KEY_F4 = 0xffc1;
+X11_KEY_F5 = 0xffc2;
+X11_KEY_F6 = 0xffc3;
+X11_KEY_F7 = 0xffc4;
+X11_KEY_F8 = 0xffc5;
+X11_KEY_F9 = 0xffc6;
+X11_KEY_F10 = 0xffc7;
+X11_KEY_F11 = 0xffc8;
+X11_KEY_F12 = 0xffc9;
+X11_KEY_SHIFT = 0xffe1;
+X11_KEY_CTRL = 0xffe3;
+X11_KEY_ALT = 0xffe9;
+X11_KEY_GRAVE_ACCENT = 0x60;
+X11_KEY_SUBSTRACT = 0x2d;
+X11_KEY_ADD = 0x2b;
 X11_KEY_OPEN_BRACKET = 0x5b;
 X11_KEY_CLOSE_BRACKET = 0x5d;
+X11_KEY_BACK_SLASH = 0x7c;
+X11_KEY_REVERSE_SOLIUS = 0x5c;			// another back slash (back slash on JP keyboard)
+X11_KEY_SINGLE_QUOTE = 0x22;
+X11_KEY_COMMA = 0x3c;
+X11_KEY_PERIOD = 0x3e;
+X11_KEY_FORWARD_SLASH = 0x3f;
+X11_KEY_DASH = 0x2d;
 X11_KEY_COLON = 0x3a;
-X11_KEY_REVERSE_SOLIUS = 0x5c;       // another back slash (back slash on JP keyboard)
-X11_KEY_CAPSLOCK = 0xffe5;
 X11_KEY_SEMI_COLON = 0x3b;
-X11_KEY_SHIFT = 0xffe1;
-X11_KEY_ADD = 0x2b;
+X11_KEY_NUMPAD0 = 0x30;
+X11_KEY_NUMPAD1 = 0x31;
+X11_KEY_NUMPAD2 = 0x32;
+X11_KEY_NUMPAD3 = 0x33;
+X11_KEY_NUMPAD4 = 0x34;
+X11_KEY_NUMPAD5 = 0x35;
+X11_KEY_NUMPAD6 = 0x36;
+X11_KEY_NUMPAD7 = 0x37;
+X11_KEY_NUMPAD8 = 0x38;
+X11_KEY_NUMPAD9 = 0x39;
+X11_KEY_DECIMAL_POINT = 0x2e;
+X11_KEY_DIVIDE = 0x3f;
+X11_KEY_TILDE = 0x7e;				// ~
+X11_KEY_CIRCUMFLEX_ACCENT = 0x5e;	// ^
+X11_KEY_YEN_MARK = 0xa5;				// Japanese YEN mark
+X11_KEY_ASTERISK = 0x2a;
 
 KEY_DOWN = 5;
 KEY_UP = 6;
 
+KEYBOARD_TYPE_COOKED = "us";
+KEYBOARD_TYPE_JP = "jp";
+KEYBOARD_TYPE_UK = "uk";
+
 //JP keyboard type
-// 
+//
 var	keyboardTables = [
-           {tindex: 0, keyboardType: "EN-Cooked", mappingTable: 
-		{X11: [ {keycode: 222, entry: X11_KEY_CIRCUMFLEX_ACCENT},
+           {tindex: 0, keyboardType: KEYBOARD_TYPE_COOKED, mappingTable:
+               {X11: [ {keycode: 222, entry: X11_KEY_CIRCUMFLEX_ACCENT},
                         {keycode: 220, entry: X11_KEY_YEN_MARK},
-                        {keycode: 219, entry: X11_KEY_OPEN_BRACKET},
-                        {keycode: 221, entry: X11_KEY_CLOSE_BRACKET},
-                        {keycode: 59, entry: X11_KEY_COLON, browser: "Firefox"},
                         {keycode: 186, entry: X11_KEY_COLON, browser: "Chrome"},
                         {keycode: 9,  entry: 9, guestos: "XenServer"},
                         {keycode: 226, entry: X11_KEY_REVERSE_SOLIUS},
+
                         {keycode: 240, entry: [
                             {type: KEY_DOWN, code: X11_KEY_CAPSLOCK, modifiers: 0 },
                             {type: KEY_UP, code: X11_KEY_CAPSLOCK, modifiers: 0 },
                             ]
+                        }
+                     ],
+                keyPress: [
+                        {keycode: 59, entry: [
+                                              {type: KEY_DOWN, code: X11_KEY_SEMI_COLON,
modifiers: 0 },
+                                              {type: KEY_UP, code: X11_KEY_SEMI_COLON, modifiers:
0 },
+                                              ]
                         },
- 		      ],
-	         keyPress: [
-                      {keycode: 59, entry: [
-                         {type: KEY_DOWN, code: X11_KEY_SEMI_COLON, modifiers: 0 },
-                         {type: KEY_UP, code: X11_KEY_SEMI_COLON, modifiers: 0 },
-                         ]
-                      },
-                      {keycode: 43, entry: [
-                         {type: KEY_DOWN, code: X11_KEY_SHIFT, modifiers: 0, shift: false
},
-                         {type: KEY_DOWN, code: X11_KEY_ADD, modifiers: 0, shift: false },
-                         {type: KEY_UP, code: X11_KEY_ADD, modifiers: 0, shift: false },
-                         {type: KEY_UP, code: X11_KEY_SHIFT, modifiers: 0, shift: false },
-                         {type: KEY_DOWN, code: X11_KEY_ADD, modifiers: 0, shift: true },
-                         {type: KEY_UP, code: X11_KEY_ADD, modifiers: 0, shift: true },
-                         ]
-                      },
-                           ]
-		}
-	   }	]
+                        {keycode: 43, entry: [
+                                              {type: KEY_DOWN, code: X11_KEY_SHIFT, modifiers:
0, shift: false },
+                                              {type: KEY_DOWN, code: X11_KEY_ADD, modifiers:
0, shift: false },
+                                              {type: KEY_UP, code: X11_KEY_ADD, modifiers:
0, shift: false },
+                                              {type: KEY_UP, code: X11_KEY_SHIFT, modifiers:
0, shift: false },
+                                              {type: KEY_DOWN, code: X11_KEY_ADD, modifiers:
0, shift: true },
+                                              {type: KEY_UP, code: X11_KEY_ADD, modifiers:
0, shift: true },
+                                              ]
+                        }
+                        ]
+               }
+           }, {tindex: 1, keyboardType: KEYBOARD_TYPE_JP, mappingTable:
+           // intialize keyboard mapping for RAW keyboard
+           {X11: [
+                  {keycode: JS_KEY_CAPSLOCK,			entry : X11_KEY_CAPSLOCK},
+                  {keycode: JS_KEY_BACKSPACE,			entry : X11_KEY_BACKSPACE},
+                  {keycode: JS_KEY_TAB,					entry : X11_KEY_TAB},
+                  {keycode: JS_KEY_ENTER,				entry : X11_KEY_ENTER},
+                  {keycode: JS_KEY_ESCAPE,				entry : X11_KEY_ESCAPE},
+                  {keycode: JS_KEY_INSERT,				entry : X11_KEY_INSERT},
+                  {keycode: JS_KEY_DELETE,				entry : X11_KEY_DELETE},
+                  {keycode: JS_KEY_HOME,				entry : X11_KEY_HOME},
+                  {keycode: JS_KEY_END,					entry : X11_KEY_END},
+                  {keycode: JS_KEY_PAGEUP,				entry : X11_KEY_PAGEUP},
+                  {keycode: JS_KEY_PAGEDOWN,			entry : X11_KEY_PAGEDOWN},
+                  {keycode: JS_KEY_LEFT,				entry : X11_KEY_LEFT},
+                  {keycode: JS_KEY_UP,					entry : X11_KEY_UP},
+                  {keycode: JS_KEY_RIGHT,				entry : X11_KEY_RIGHT},
+                  {keycode: JS_KEY_DOWN,				entry : X11_KEY_DOWN},
+                  {keycode: JS_KEY_F1,					entry : X11_KEY_F1},
+                  {keycode: JS_KEY_F2,					entry : X11_KEY_F2},
+                  {keycode: JS_KEY_F3,					entry : X11_KEY_F3},
+                  {keycode: JS_KEY_F4,					entry : X11_KEY_F4},
+                  {keycode: JS_KEY_F5,					entry : X11_KEY_F5},
+                  {keycode: JS_KEY_F6,					entry : X11_KEY_F6},
+                  {keycode: JS_KEY_F7,					entry : X11_KEY_F7},
+                  {keycode: JS_KEY_F8,					entry : X11_KEY_F8},
+                  {keycode: JS_KEY_F9,					entry : X11_KEY_F9},
+                  {keycode: JS_KEY_F10,					entry : X11_KEY_F10},
+                  {keycode: JS_KEY_F11,					entry : X11_KEY_F11},
+                  {keycode: JS_KEY_F12,					entry : X11_KEY_F12},
+                  {keycode: JS_KEY_SHIFT,				entry : X11_KEY_SHIFT},
+                  {keycode: JS_KEY_CTRL,				entry : X11_KEY_CTRL},
+                  {keycode: JS_KEY_ALT,					entry : X11_KEY_ALT},
+                  {keycode: JS_KEY_GRAVE_ACCENT,		entry : X11_KEY_GRAVE_ACCENT},
+                  {keycode: JS_KEY_SUBSTRACT,			entry : X11_KEY_SUBSTRACT},
+                  {keycode: JS_KEY_ADD,					entry : X11_KEY_ADD},
+                  {keycode: JS_KEY_OPEN_BRACKET,		entry : X11_KEY_OPEN_BRACKET},
+                  {keycode: JS_KEY_CLOSE_BRACKET,		entry : X11_KEY_CLOSE_BRACKET},
+                  {keycode: JS_KEY_BACK_SLASH,			entry : X11_KEY_BACK_SLASH},
+                  {keycode: JS_KEY_SINGLE_QUOTE,		entry : X11_KEY_SINGLE_QUOTE},
+                  {keycode: JS_KEY_COMMA,				entry : X11_KEY_COMMA},
+                  {keycode: JS_KEY_PERIOD,				entry : X11_KEY_PERIOD},
+                  {keycode: JS_KEY_FORWARD_SLASH,		entry : X11_KEY_FORWARD_SLASH},
+                  {keycode: JS_KEY_DASH,				entry : X11_KEY_DASH},
+                  {keycode: JS_KEY_SEMI_COLON,			entry : X11_KEY_SEMI_COLON},
+                  {keycode: JS_KEY_NUMPAD0,				entry : X11_KEY_NUMPAD0},
+                  {keycode: JS_KEY_NUMPAD1,				entry : X11_KEY_NUMPAD1},
+                  {keycode: JS_KEY_NUMPAD2,				entry : X11_KEY_NUMPAD2},
+                  {keycode: JS_KEY_NUMPAD3,				entry : X11_KEY_NUMPAD3},
+                  {keycode: JS_KEY_NUMPAD4,				entry : X11_KEY_NUMPAD4},
+                  {keycode: JS_KEY_NUMPAD5,				entry : X11_KEY_NUMPAD5},
+                  {keycode: JS_KEY_NUMPAD6,				entry : X11_KEY_NUMPAD6},
+                  {keycode: JS_KEY_NUMPAD7,				entry : X11_KEY_NUMPAD7},
+                  {keycode: JS_KEY_NUMPAD8,				entry : X11_KEY_NUMPAD8},
+                  {keycode: JS_KEY_NUMPAD9,				entry : X11_KEY_NUMPAD9},
+                  {keycode: JS_KEY_DECIMAL_POINT,		entry : X11_KEY_DECIMAL_POINT},
+                  {keycode: JS_KEY_DIVIDE,				entry : X11_KEY_DIVIDE},
 
+                  {keycode: JS_KEY_MULTIPLY,    entry : [
+                                                         {type: KEY_DOWN, code: X11_KEY_SHIFT,
modifiers: 0 },
+                                                         {type: KEY_DOWN, code: X11_KEY_ASTERISK,
modifiers: 0 },
+                                                         {type: KEY_UP, code: X11_KEY_ASTERISK,
modifiers: 0 },
+                                                         {type: KEY_UP, code: X11_KEY_SHIFT,
modifiers: 0 }
+                                                         ]},
+                  {keycode: JS_KEY_ADD,         entry : false}
+            ],
+            keyPress: [
+                  {keycode: 61,      entry:  [
+                                              {type: KEY_DOWN, code: X11_KEY_ADD, modifiers:
0, shift: false },
+                                              {type: KEY_UP, code: X11_KEY_ADD, modifiers:
0, shift: false }
+                                              ]},
+                  {keycode: 43,      entry: [
+                                             {type: KEY_DOWN, code: X11_KEY_SHIFT, modifiers:
0, shift: false },
+                                             {type: KEY_DOWN, code: X11_KEY_ADD, modifiers:
0, shift: false },
+                                             {type: KEY_UP, code: X11_KEY_ADD, modifiers:
0, shift: false },
+                                             {type: KEY_UP, code: X11_KEY_SHIFT, modifiers:
0, shift: false },
+                                             {type: KEY_DOWN, code: X11_KEY_ADD, modifiers:
0, shift: true },
+                                             {type: KEY_UP, code: X11_KEY_ADD, modifiers:
0, shift: true }
+                                             ]}
+                  ]
+           }
+           }, {tindex: 2, keyboardType: KEYBOARD_TYPE_UK, mappingTable:
+           {X11: [],
+               keyPress: [
+                          //[34 = "]
+                          {keycode: 34, entry:
+                              [{type : KEY_DOWN, code : 0x40, modifiers : 64, shift : true}]
+                          },
+                          //[35 = #]
+                          {keycode: 35, entry:
+                              [{type : KEY_DOWN, code : 0x5c, modifiers : 0, shift : false}]
+                          },
+                          // [64 = @]
+                          {keycode: 64, entry:
+                              [{type : KEY_DOWN, code : 0x22, modifiers : 64, shift : true}]
+                          },
+                          // [92 = \]
+                          {keycode: 92, entry:
+                              [{type : KEY_DOWN, code : 0xa6, modifiers : 0, shift : false}]
+                          },
+                          // [126 = ~]
+                          {keycode: 126, entry:
+                              [{type : KEY_DOWN, code : 0x7c, modifiers : 64, shift : true}]
+                          },
+                          // [163 = £]
+                          {keycode: 163, entry:
+                              [{type : KEY_DOWN, code : 0x23, modifiers : 64, shift : true}]
+                          },
+                          // [172 = ¬]
+                          {keycode: 172, entry:
+                              [{type : KEY_DOWN, code : 0x7e, modifiers : 64, shift : true}]
+                          },
+                          // [166 = ¦]
+                          {keycode: 166, entry:
+                              [{type : KEY_DOWN, code : 0x60, modifiers : 896, shift : false}]
+                          }
+                          ]
+           }
+           }]

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b6cb23cb/services/console-proxy/server/js/ajaxviewer.js
----------------------------------------------------------------------
diff --git a/services/console-proxy/server/js/ajaxviewer.js b/services/console-proxy/server/js/ajaxviewer.js
index e95615d..a6e1eda 100644
--- a/services/console-proxy/server/js/ajaxviewer.js
+++ b/services/console-proxy/server/js/ajaxviewer.js
@@ -99,92 +99,13 @@ function KeyboardMapper() {
 //
 KeyboardMapper.KEYBOARD_TYPE_RAW = 0;
 KeyboardMapper.KEYBOARD_TYPE_COOKED = 1;
+KeyboardMapper.KEYBOARD_TYPE_UK = 2;
 
 KeyboardMapper.prototype = {
-		
+
 	setKeyboardType : function(keyboardType) {
 		this.keyboardType = keyboardType;
-		
-		if(keyboardType == KeyboardMapper.KEYBOARD_TYPE_RAW) {
-			// intialize keyboard mapping for RAW keyboard
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_CAPSLOCK] 		= AjaxViewer.X11_KEY_CAPSLOCK;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_BACKSPACE] 		= AjaxViewer.X11_KEY_BACKSPACE;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_TAB]			= AjaxViewer.X11_KEY_TAB;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_ENTER] 			= AjaxViewer.X11_KEY_ENTER;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_ESCAPE] 			= AjaxViewer.X11_KEY_ESCAPE;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_INSERT] 			= AjaxViewer.X11_KEY_INSERT;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_DELETE] 			= AjaxViewer.X11_KEY_DELETE;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_HOME] 			= AjaxViewer.X11_KEY_HOME;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_END] 			= AjaxViewer.X11_KEY_END;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_PAGEUP] 			= AjaxViewer.X11_KEY_PAGEUP;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_PAGEDOWN] 		= AjaxViewer.X11_KEY_PAGEDOWN;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_LEFT] 			= AjaxViewer.X11_KEY_LEFT;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_UP] 			= AjaxViewer.X11_KEY_UP;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_RIGHT] 			= AjaxViewer.X11_KEY_RIGHT;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_DOWN] 			= AjaxViewer.X11_KEY_DOWN;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_F1] 				= AjaxViewer.X11_KEY_F1;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_F2] 				= AjaxViewer.X11_KEY_F2;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_F3] 				= AjaxViewer.X11_KEY_F3;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_F4] 				= AjaxViewer.X11_KEY_F4;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_F5] 				= AjaxViewer.X11_KEY_F5;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_F6] 				= AjaxViewer.X11_KEY_F6;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_F7] 				= AjaxViewer.X11_KEY_F7;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_F8] 				= AjaxViewer.X11_KEY_F8;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_F9] 				= AjaxViewer.X11_KEY_F9;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_F10] 				= AjaxViewer.X11_KEY_F10;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_F11] 				= AjaxViewer.X11_KEY_F11;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_F12] 				= AjaxViewer.X11_KEY_F12;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_SHIFT] 			= AjaxViewer.X11_KEY_SHIFT;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_CTRL] 			= AjaxViewer.X11_KEY_CTRL;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_ALT] 				= AjaxViewer.X11_KEY_ALT;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_GRAVE_ACCENT] 	= AjaxViewer.X11_KEY_GRAVE_ACCENT;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_SUBSTRACT] 		= AjaxViewer.X11_KEY_SUBSTRACT;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_ADD] 				= AjaxViewer.X11_KEY_ADD;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_OPEN_BRACKET] 	= AjaxViewer.X11_KEY_OPEN_BRACKET;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_CLOSE_BRACKET] 	= AjaxViewer.X11_KEY_CLOSE_BRACKET;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_BACK_SLASH] 		= AjaxViewer.X11_KEY_BACK_SLASH;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_SINGLE_QUOTE] 	= AjaxViewer.X11_KEY_SINGLE_QUOTE;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_COMMA] 			= AjaxViewer.X11_KEY_COMMA;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_PERIOD] 			= AjaxViewer.X11_KEY_PERIOD;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_FORWARD_SLASH] 	= AjaxViewer.X11_KEY_FORWARD_SLASH;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_DASH] 			= AjaxViewer.X11_KEY_DASH;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_SEMI_COLON] 		= AjaxViewer.X11_KEY_SEMI_COLON;
-
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_NUMPAD0] 			= AjaxViewer.X11_KEY_NUMPAD0;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_NUMPAD1] 			= AjaxViewer.X11_KEY_NUMPAD1;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_NUMPAD2] 			= AjaxViewer.X11_KEY_NUMPAD2;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_NUMPAD3] 			= AjaxViewer.X11_KEY_NUMPAD3;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_NUMPAD4] 			= AjaxViewer.X11_KEY_NUMPAD4;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_NUMPAD5] 			= AjaxViewer.X11_KEY_NUMPAD5;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_NUMPAD6] 			= AjaxViewer.X11_KEY_NUMPAD6;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_NUMPAD7] 			= AjaxViewer.X11_KEY_NUMPAD7;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_NUMPAD8] 			= AjaxViewer.X11_KEY_NUMPAD8;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_NUMPAD9] 			= AjaxViewer.X11_KEY_NUMPAD9;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_DECIMAL_POINT] 	= AjaxViewer.X11_KEY_DECIMAL_POINT;
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_DIVIDE] 			= AjaxViewer.X11_KEY_DIVIDE;
-			
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_MULTIPLY] = [
-			    {type: AjaxViewer.KEY_DOWN, code: AjaxViewer.X11_KEY_SHIFT, modifiers: 0 },
-			    {type: AjaxViewer.KEY_DOWN, code: AjaxViewer.X11_KEY_ASTERISK, modifiers: 0 },
-			    {type: AjaxViewer.KEY_UP, code: AjaxViewer.X11_KEY_ASTERISK, modifiers: 0 },
-			    {type: AjaxViewer.KEY_UP, code: AjaxViewer.X11_KEY_SHIFT, modifiers: 0 }
-			];
-			
-			this.jsX11KeysymMap[AjaxViewer.JS_KEY_ADD] = false;
-			this.jsKeyPressX11KeysymMap = [];
-			this.jsKeyPressX11KeysymMap[61] = [
-			    {type: AjaxViewer.KEY_DOWN, code: AjaxViewer.X11_KEY_ADD, modifiers: 0, shift: false
},
-			    {type: AjaxViewer.KEY_UP, code: AjaxViewer.X11_KEY_ADD, modifiers: 0, shift: false
}
-			];
-			this.jsKeyPressX11KeysymMap[43] = [
-			    {type: AjaxViewer.KEY_DOWN, code: AjaxViewer.X11_KEY_SHIFT, modifiers: 0, shift: false
},
-			    {type: AjaxViewer.KEY_DOWN, code: AjaxViewer.X11_KEY_ADD, modifiers: 0, shift: false
},
-			    {type: AjaxViewer.KEY_UP, code: AjaxViewer.X11_KEY_ADD, modifiers: 0, shift: false
},
-			    {type: AjaxViewer.KEY_UP, code: AjaxViewer.X11_KEY_SHIFT, modifiers: 0, shift: false
},
-			    {type: AjaxViewer.KEY_DOWN, code: AjaxViewer.X11_KEY_ADD, modifiers: 0, shift: true
},
-			    {type: AjaxViewer.KEY_UP, code: AjaxViewer.X11_KEY_ADD, modifiers: 0, shift: true
}
-			];
-		} else {
+		if(keyboardType == KeyboardMapper.KEYBOARD_TYPE_COOKED || keyboardType == KeyboardMapper.KEYBOARD_TYPE_UK)
{
 			// initialize mapping for COOKED keyboard
 			this.jsX11KeysymMap[AjaxViewer.JS_KEY_CAPSLOCK] 		= AjaxViewer.X11_KEY_CAPSLOCK;
 			this.jsX11KeysymMap[AjaxViewer.JS_KEY_BACKSPACE] 		= AjaxViewer.X11_KEY_BACKSPACE;
@@ -325,7 +246,6 @@ KeyboardMapper.prototype = {
 			// ENTER/BACKSPACE key should already have been sent through KEY DOWN/KEY UP event
 			if(code == AjaxViewer.JS_KEY_ENTER || code == AjaxViewer.JS_KEY_BACKSPACE)
 				return;
-
 			if(code > 0) {
 				var X11Keysym = code;
 				X11Keysym = this.jsKeyPressX11KeysymMap[code];
@@ -475,6 +395,7 @@ AjaxViewer.STATUS_SENDING = 3;
 AjaxViewer.STATUS_SENT = 4;
 
 AjaxViewer.KEYBOARD_TYPE_ENGLISH = "us";
+AjaxViewer.KEYBOARD_TYPE_UK_ENGLISH = "uk";
 AjaxViewer.KEYBOARD_TYPE_JAPANESE = "jp";
 
 AjaxViewer.JS_KEY_BACKSPACE = 8;
@@ -736,6 +657,10 @@ AjaxViewer.prototype = {
 		this.keyboardMappers[AjaxViewer.KEYBOARD_TYPE_ENGLISH] = mapper;
 		mapper.setKeyboardType(KeyboardMapper.KEYBOARD_TYPE_COOKED);
 
+		var mapper = new KeyboardMapper();
+		this.keyboardMappers[AjaxViewer.KEYBOARD_TYPE_UK_ENGLISH] = mapper;
+		mapper.setKeyboardType(KeyboardMapper.KEYBOARD_TYPE_UK);
+
 		mapper = new KeyboardMapper();
 		this.keyboardMappers[AjaxViewer.KEYBOARD_TYPE_JAPANESE] = mapper;
 		mapper.setKeyboardType(KeyboardMapper.KEYBOARD_TYPE_RAW);
@@ -795,25 +720,25 @@ AjaxViewer.prototype = {
 
 */
 	// create the mapping table based on the tables input
-	if (keyboardTables != undefined	) {
+	if (keyboardTables != undefined ) {
 
-	    for(var i = 0; i < keyboardTables.length; i++) {
-		var mappingTbl = keyboardTables[i];
-                var mappings = mappingTbl.mappingTable;
-		var x11Maps = mappings.X11;
-		for (var j = 0; j < x11Maps.length; j++) {
-			var code = x11Maps[j].keycode;
-			var mappedEntry = x11Maps[j].entry;
-			mapper.jsX11KeysymMap[code] = mappedEntry;
-		}
-		var keyPressMaps = mappings.keyPress;
-		for (var j = 0; j < keyPressMaps.length; j++) {
-			var code = keyPressMaps[j].keycode;
-			var mappedEntry = keyPressMaps[j].entry;
-			mapper.jsKeyPressX11KeysymMap[code] = mappedEntry;
+		for(var i = 0; i < keyboardTables.length; i++) {
+			var mappingTbl = keyboardTables[i];
+			var keyboardType = mappingTbl.keyboardType;
+			var mappings = mappingTbl.mappingTable;
+			var x11Maps = mappings.X11;
+			for (var j = 0; j < x11Maps.length; j++) {
+				var code = x11Maps[j].keycode;
+				var mappedEntry = x11Maps[j].entry;
+				this.keyboardMappers[keyboardType].jsX11KeysymMap[code] = mappedEntry;
+			}
+			var keyPressMaps = mappings.keyPress;
+			for (var j = 0; j < keyPressMaps.length; j++) {
+				var code = keyPressMaps[j].keycode;
+				var mappedEntry = keyPressMaps[j].entry;
+				this.keyboardMappers[keyboardType].jsKeyPressX11KeysymMap[code] = mappedEntry;
+			}
 		}
-
-	    }
 	}
 
 	}, // end of the setupKeyboardTranslationTable function
@@ -867,6 +792,9 @@ AjaxViewer.prototype = {
 		} else if(cmd == "keyboard_us") {
 			$("#toolbar").find(".pulldown").find("ul").hide();
 			this.currentKeyboard = AjaxViewer.KEYBOARD_TYPE_ENGLISH;
+		} else if(cmd == "keyboard_uk") {
+			$("#toolbar").find(".pulldown").find("ul").hide();
+			this.currentKeyboard = AjaxViewer.KEYBOARD_TYPE_UK_ENGLISH;
 		} else if(cmd == "sendCtrlAltDel") {
 			this.sendKeyboardEvent(AjaxViewer.KEY_DOWN, 0xffe9, 0);		// X11 Alt
 			this.sendKeyboardEvent(AjaxViewer.KEY_DOWN, 0xffe3, 0);		// X11 Ctrl

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b6cb23cb/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyClientBase.java
----------------------------------------------------------------------
diff --git a/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyClientBase.java
b/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyClientBase.java
index 289bdab..f4c912a 100644
--- a/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyClientBase.java
+++ b/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyClientBase.java
@@ -329,6 +329,7 @@ public abstract class ConsoleProxyClientBase implements ConsoleProxyClient,
Cons
                     "</a>", 
                     "<ul>",
                         "<li><a href=\"#\" cmd=\"keyboard_us\"><span>Standard
(US) keyboard</span></a></li>",
+                        "<li><a href=\"#\" cmd=\"keyboard_uk\"><span>UK
keyboard</span></a></li>",
                         "<li><a href=\"#\" cmd=\"keyboard_jp\"><span>Japanese
keyboard</span></a></li>",
                     "</ul>",
                 "</li>",


Mime
View raw message