diff --git a/console-proxy/css/ajaxviewer.css b/console-proxy/css/ajaxviewer.css
index e6e150d0cb2..af306eaced4 100644
--- a/console-proxy/css/ajaxviewer.css
+++ b/console-proxy/css/ajaxviewer.css
@@ -71,8 +71,8 @@ body {
#toolbar ul li ul {
position: absolute;
top:32;
- width: 130;
- height: 66;
+ width: 260;
+ height: 99;
display: block;
display: none;
border-top: 1px solid black;
@@ -103,7 +103,7 @@ body {
}
#toolbar ul li ul li a:hover span {
- background: url(/resource/images/right.png) no-repeat right center;
+ background: url(/resource/images/right2.png) no-repeat right center;
}
span.dark {
diff --git a/console-proxy/images/right2.png b/console-proxy/images/right2.png
new file mode 100644
index 00000000000..cca9379fe5b
Binary files /dev/null and b/console-proxy/images/right2.png differ
diff --git a/console-proxy/js/ajaxviewer.js b/console-proxy/js/ajaxviewer.js
index eaeca1a95a5..3ee621636f5 100644
--- a/console-proxy/js/ajaxviewer.js
+++ b/console-proxy/js/ajaxviewer.js
@@ -280,7 +280,8 @@ AjaxViewer.STATUS_SENDING = 3;
AjaxViewer.STATUS_SENT = 4;
AjaxViewer.KEYBOARD_TYPE_ENGLISH = 0;
-AjaxViewer.KEYBOARD_TYPE_JAPANESE = 1;
+AjaxViewer.KEYBOARD_TYPE_JAPANESE_TO_ENGLISH = 1;
+AjaxViewer.KEYBOARD_TYPE_JAPANESE_TO_JAPANESE = 2;
AjaxViewer.getEventName = function(type) {
switch(type) {
@@ -442,7 +443,11 @@ AjaxViewer.prototype = {
setupKeyboardTranslationTable : function() {
this.keyboardMappers = [];
this.keyboardMappers[AjaxViewer.KEYBOARD_TYPE_ENGLISH] = new KeyboardMapper(true, null, null, null, null);
-
+ this.setupJapaneseKeyboardToEnglishVmMapping();
+ this.setupJapaneseKeyboardToJapaneseVmMapping();
+ },
+
+ setupJapaneseKeyboardToEnglishVmMapping : function() {
var keyCodeMap = [];
var shiftedKeyCodeMap = [];
var charCodeMap = [];
@@ -593,10 +598,30 @@ AjaxViewer.prototype = {
keyCodeMap[110] = { code: 190, shift : 0 }; // JP NUM .
charCodeMap[46] = { code: 46, shift : 0 };
}
- this.keyboardMappers[AjaxViewer.KEYBOARD_TYPE_JAPANESE] = new KeyboardMapper(false, keyCodeMap, shiftedKeyCodeMap,
+ this.keyboardMappers[AjaxViewer.KEYBOARD_TYPE_JAPANESE_TO_ENGLISH] = new KeyboardMapper(false, keyCodeMap, shiftedKeyCodeMap,
charCodeMap, shiftedCharCodeMap);
},
+ setupJapaneseKeyboardToJapaneseVmMapping : function() {
+
+ var keyCodeMap = [];
+ var shiftedKeyCodeMap = [];
+ var charCodeMap = [];
+ var shiftedCharCodeMap = [];
+
+ var currentLanguage = getCurrentLanguage();
+ if(currentLanguage == 'ja' || currentLanguage == 'ja-JP') {
+ // TODO
+ // two keys need to be handled in this case, one is the one that is at left of BACKSPACE KEY
+ // the other one is at left of RIGHT SHIFT key
+ } else {
+ // TODO
+ }
+
+ this.keyboardMappers[AjaxViewer.KEYBOARD_TYPE_JAPANESE_TO_ENGLISH] = new KeyboardMapper(false, keyCodeMap, shiftedKeyCodeMap,
+ charCodeMap, shiftedCharCodeMap);
+ },
+
getCurrentKeyboardMapper : function() {
return this.keyboardMappers[this.currentKeyboard];
},
@@ -642,7 +667,10 @@ AjaxViewer.prototype = {
onCommand : function(cmd) {
if(cmd == "keyboard_jp") {
$("#toolbar").find(".pulldown").find("ul").hide();
- this.currentKeyboard = AjaxViewer.KEYBOARD_TYPE_JAPANESE;
+ this.currentKeyboard = AjaxViewer.KEYBOARD_TYPE_JAPANESE_TO_ENGLISH;
+ } else if(cmd == "keyboard_jp_jp") {
+ $("#toolbar").find(".pulldown").find("ul").hide();
+ this.currentKeyboard = AjaxViewer.KEYBOARD_TYPE_JAPANESE_TO_JAPANESE;
} else if(cmd == "keyboard_en") {
$("#toolbar").find(".pulldown").find("ul").hide();
this.currentKeyboard = AjaxViewer.KEYBOARD_TYPE_ENGLISH;
@@ -1143,11 +1171,11 @@ AjaxViewer.prototype = {
installMouseHook: function() {
var ajaxViewer = this;
- var target = $(document);
+ var target = $(document.body);
target.mousemove(function(e) {
if(!ajaxViewer.ptInPanel(e.pageX, e.pageY))
- return true;
+ return true;
var pt = ajaxViewer.pageToPanel(e.pageX, e.pageY);
ajaxViewer.onMouseMove(pt.x, pt.y);
@@ -1161,11 +1189,11 @@ AjaxViewer.prototype = {
if(!ajaxViewer.ptInPanel(e.pageX, e.pageY))
return true;
-
+
var modifiers = ajaxViewer.getKeyModifiers(e);
var whichButton = e.button;
- var pt = ajaxViewer.pageToPanel(e.pageX, e.pageY);
+ var pt = ajaxViewer.pageToPanel(e.pageX, e.pageY);
ajaxViewer.onMouseDown(pt.x, pt.y, whichButton, modifiers);
e.stopPropagation();
@@ -1174,12 +1202,13 @@ AjaxViewer.prototype = {
target.mouseup(function(e) {
if(!ajaxViewer.ptInPanel(e.pageX, e.pageY))
- return true;
+ return true;
var modifiers = ajaxViewer.getKeyModifiers(e);
var whichButton = e.button;
var pt = ajaxViewer.pageToPanel(e.pageX, e.pageY);
+
ajaxViewer.onMouseUp(pt.x, pt.y, whichButton, modifiers);
e.stopPropagation();
return false;
diff --git a/console-proxy/src/com/cloud/consoleproxy/ConsoleProxyViewer.java b/console-proxy/src/com/cloud/consoleproxy/ConsoleProxyViewer.java
index 4585b57387d..371f4c49448 100644
--- a/console-proxy/src/com/cloud/consoleproxy/ConsoleProxyViewer.java
+++ b/console-proxy/src/com/cloud/consoleproxy/ConsoleProxyViewer.java
@@ -1048,8 +1048,9 @@ public class ConsoleProxyViewer implements java.lang.Runnable, RfbViewer, RfbPro
"
Keyboard",
"",
"