Project

General

Profile

1811p_all_changes_1.txt

Sergey Ivanovskiy, 07/31/2015 01:54 PM

Download (16.3 KB)

 
1
=== modified file 'src/com/goldencode/p2j/ui/client/chui/driver/web/res/p2j.clipboard_helpers.js'
2
--- src/com/goldencode/p2j/ui/client/chui/driver/web/res/p2j.clipboard_helpers.js	2015-05-18 20:48:28 +0000
3
+++ src/com/goldencode/p2j/ui/client/chui/driver/web/res/p2j.clipboard_helpers.js	2015-07-31 17:40:15 +0000
4
@@ -10,8 +10,12 @@
5
 **
6
 ** -#- -I- --Date-- ------------------------------Description----------------------------------
7
 ** 001 GES 20150324 First version, with refactored content moved from tty.clipboard.js.
8
+** 002 SBI 20150731 Applied "use strict" directive, fixed undeclared variables
9
+**                  and corrected the selection rectangle coordinates.
10
 */
11
 
12
+"use strict";
13
+
14
 p2j.clipboard_helpers = (function() 
15
 {
16
    /** Clipboard helper object which will be returned from this initialization function. */
17
@@ -71,8 +75,8 @@
18
     */
19
    me.mouseDown = function(e) 
20
    {
21
-      var x = (e.pageX - this.offsetLeft) | 0;
22
-      var y = (e.pageY - this.offsetTop) | 0;
23
+      var x = (e.pageX - canvas.offsetLeft) | 0;
24
+      var y = (e.pageY - canvas.offsetTop) | 0;
25
       cells.startX = (x / charWidth) | 0;
26
       cells.startY = (y / charHeight) | 0;         
27
       rect.startX = cells.startX * charWidth;
28
@@ -87,8 +91,8 @@
29
     */
30
    me.mouseMove = function(e) 
31
    {
32
-      var x = (e.pageX - this.offsetLeft | 0);
33
-      var y = (e.pageY - this.offsetTop | 0);
34
+      var x = (e.pageX - canvas.offsetLeft) | 0;
35
+      var y = (e.pageY - canvas.offsetTop) | 0;
36
       cells.startX1 = (x / charWidth) | 0;
37
       cells.startY1 = (y / charHeight) | 0;
38
 
39

    
40
=== modified file 'src/com/goldencode/p2j/ui/client/chui/driver/web/res/p2j.screen.js'
41
--- src/com/goldencode/p2j/ui/client/chui/driver/web/res/p2j.screen.js	2015-05-18 20:48:28 +0000
42
+++ src/com/goldencode/p2j/ui/client/chui/driver/web/res/p2j.screen.js	2015-07-31 17:40:15 +0000
43
@@ -19,8 +19,12 @@
44
 ** 007 MAG 20140821 Extended color palette.
45
 ** 008 GES 20150325 Renamed objects to match the more generic web client approach (not just
46
 **                  ChUI). Moved some logic to common code locations.
47
+** 009 SBI 20150731 Applied "use strict" directive, fixed undeclared variables,
48
+**                  added end-lines on copy.
49
 */
50
 
51
+"use strict";
52
+
53
 p2j.screen = (function()
54
 {
55
    /** Screen object which will be returned from this initialization function. */
56
@@ -76,10 +80,10 @@
57
       {
58
          me.color = color;
59
          memo = new Array(rows);
60
-         for (i = 0; i < rows; i++)
61
+         for (var i = 0; i < rows; i++)
62
          {
63
             memo[i] = new Array(cols);
64
-            for (j = 0; j < cols; j++)
65
+            for (var j = 0; j < cols; j++)
66
             {
67
                var cell = {'c': ' ', 'f': 'white', 'b': 'black', 'a': 0, 'k': 0};
68
                cell.f = color.f;
69
@@ -97,9 +101,9 @@
70
        */
71
       me.clear = function(rows, cols)
72
       {
73
-         for (i = 0; i < rows; i++)
74
+         for (var i = 0; i < rows; i++)
75
          {
76
-            for (j = 0; j < cols; j++)
77
+            for (var j = 0; j < cols; j++)
78
             {
79
                var v = memo[i][j];
80
                v.c = ' ';
81
@@ -156,14 +160,17 @@
82
        */
83
       me.copy = function(begRow, endRow, begCol, endCol)
84
       {
85
-         var text = "";         
86
-         for (i = begRow; i <= endRow; i++)
87
+         var text = "";
88
+         for (var i = begRow; i <= endRow; i++)
89
          {
90
-            for (j = begCol; j <= endCol; j++)
91
+            for (var j = begCol; j <= endCol; j++)
92
             {
93
                text += memo[i][j].c;
94
             }
95
-         }         
96
+            if (i < endRow) {
97
+               text += "\n";//add end of line
98
+            }
99
+         }
100
          return text;
101
       };
102
 
103

    
104
=== modified file 'src/com/goldencode/p2j/ui/client/driver/web/index.html'
105
--- src/com/goldencode/p2j/ui/client/driver/web/index.html	2015-05-18 20:48:28 +0000
106
+++ src/com/goldencode/p2j/ui/client/driver/web/index.html	2015-07-31 12:09:20 +0000
107
@@ -4,7 +4,6 @@
108
       <title>P2J ${client_title} Web Client</title>
109
       
110
       <link rel="stylesheet" type="text/css" href="/dojo-toolkit/dijit/themes/claro/claro.css">
111
-      
112
       <!-- load dojo -->      
113
       <script src="/dojo-toolkit/dojo/dojo.js" data-dojo-config="async: true"></script>  
114
             
115
@@ -17,11 +16,12 @@
116
       <script type="text/javascript" src="/client/p2j.clipboard_helpers.js"></script>
117
       <script type="text/javascript" src="/common/p2j.clipboard.js"></script>
118
       
119
-      <script>    
120
+      <script>
121
       require(["dojo"], function(dojo)
122
       {
123
          dojo.ready(function()
124
-         {               
125
+         {   
126
+            "use strict";
127
             p2j.init({
128
                'isGui' : ${isGui},
129
                'canvas' : {'id' : 'def_win', 'size' : {'${height_name}' : ${height_val}, '${width_name}' : ${width_val}}, 'mouse' : false},
130

    
131
=== modified file 'src/com/goldencode/p2j/ui/client/driver/web/res/p2j.clipboard.js'
132
--- src/com/goldencode/p2j/ui/client/driver/web/res/p2j.clipboard.js	2015-05-18 20:48:28 +0000
133
+++ src/com/goldencode/p2j/ui/client/driver/web/res/p2j.clipboard.js	2015-07-31 17:40:15 +0000
134
@@ -14,8 +14,12 @@
135
 **                  can be used for both ChUI and GUI web clients. Client-specific portions have
136
 **                  been moved to p2j.clipboard_helpers which will have different versions for
137
 **                  ChUI and GUI.
138
+** 003 SBI 20150731 Applied "use strict" directive, fixed undeclared variables
139
+**                  and end of lines (EOLs) by simulating key "Enter" pressed.
140
 */
141
 
142
+"use strict";
143
+
144
 /**
145
  * Core clipboard implementation that calls client-specific callbacks for ChUI or GUI selection
146
  * and rendering.  The user drags the mouse to select text and the hooks are called to capture
147
@@ -69,13 +73,13 @@
148
       require(["dijit/Menu", "dijit/MenuItem", "dijit/CheckedMenuItem", "dijit/MenuSeparator", "dijit/PopupMenuItem"], 
149
       function(Menu, MenuItem, CheckedMenuItem, MenuSeparator, PopupMenuItem)
150
       {   
151
-         pMenu = new dijit.Menu(
152
+         var pMenu = new dijit.Menu(
153
          {
154
             targetNodeIds:[cfg.clipboard.id]
155
          });
156
 
157
          // select 
158
-         pMenuSelect = new dijit.CheckedMenuItem(
159
+         var pMenuSelect = new dijit.CheckedMenuItem(
160
          {
161
             iconClass:"dijitEditorIcon dijitEditorIconSelectAll",
162
             label: "Enable Clipboard",
163
@@ -196,21 +200,26 @@
164
    {
165
       if (text.length > 0)
166
       {
167
-         var msg = new Uint8Array(text.length * 2 + 1);
168
+         /**
169
+          *  Replace eol lines in order to be handled properly on the thin client
170
+          *  as it would be "Enter" pressed.
171
+          */
172
+         var text2 = text.replace(/\n/g,"\r");
173
+         var msg = new Uint8Array(text2.length * 2 + 1);
174
          msg[0] = 0x03;
175
 
176
-         for (var i = 0, j = 1;i < text.length;i++, j += 2)
177
+         for (var i = 0, j = 1;i < text2.length;i++, j += 2)
178
          {
179
-            var c = text.charCodeAt(i);
180
+            var c = text2.charCodeAt(i);
181
             msg[j + 1] = c & 0xff;
182
             c = c >> 8;
183
             msg[j] = c & 0xff;
184
          }
185
          
186
-         p2j.socket.send(msg); 
187
+         p2j.socket.send(msg.buffer); 
188
       }                     
189
    }
190
-
191
+   
192
    /**
193
     * Clipboard copy handler.
194
     * 
195
@@ -222,8 +231,8 @@
196
       if (!me.enabled)
197
          return;
198
 
199
-      // value to copy
200
-      var text = inputText.value;
201
+      // restore value to copy
202
+      var text = decodeURIComponent(inputText.value);
203
       
204
       // copy to clipboard
205
       if (window.clipboardData) 
206
@@ -255,7 +264,7 @@
207
          var text = p2j.clipboard_helpers.getSelectedText();
208
          
209
          // copy selection to clipboard
210
-         inputText.value = text;
211
+         inputText.value = encodeURIComponent(text); // to escape "\n"
212
          inputText.focus();
213
          inputText.select();
214
       }
215

    
216
=== modified file 'src/com/goldencode/p2j/ui/client/driver/web/res/p2j.js'
217
--- src/com/goldencode/p2j/ui/client/driver/web/res/p2j.js	2015-05-18 20:48:28 +0000
218
+++ src/com/goldencode/p2j/ui/client/driver/web/res/p2j.js	2015-07-31 17:40:15 +0000
219
@@ -14,8 +14,11 @@
220
 ** 003 MAG 20140702 Add tty.clipboard module.
221
 ** 004 GES 20150324 Moved this class to a common resource base and made it generic (so that it
222
 **                  can be used for both ChUI and GUI web clients.
223
+** 005 SBI 20150731 Applied "use strict" directive, fixed undeclared variables.
224
 */
225
 
226
+"use strict";
227
+
228
 /**
229
  * Create a top-level JavaScript object (which acts as a namespace for the web client code)
230
  * and initialize all submodules.
231
@@ -31,7 +34,7 @@
232
  *    <li> p2j.clipboard
233
  * </ol>
234
  */
235
-p2j = (function()
236
+var p2j = (function()
237
 {
238
    /** The top-level web client object which will be returned from this function. */
239
    var me = {};
240

    
241
=== modified file 'src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keyboard.js'
242
--- src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keyboard.js	2015-05-18 20:48:28 +0000
243
+++ src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keyboard.js	2015-07-31 17:40:15 +0000
244
@@ -16,8 +16,11 @@
245
 ** 005 MAG 20140701 Use CTRL-C and CTRL-V to copy/paste.
246
 ** 006 GES 20150324 Moved this class to a common resource base and made it generic (so that it
247
 **                  can be used for both ChUI and GUI web clients.
248
+** 007 SBI 20150731 Applied "use strict" directive, fixed undeclared variables.
249
 */
250
 
251
+"use strict";
252
+
253
 p2j.keyboard = (function()
254
 {
255
    /** Keyboard object which will be returned from this initialization function. */
256

    
257
=== modified file 'src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keymap.js'
258
--- src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keymap.js	2015-05-18 20:48:28 +0000
259
+++ src/com/goldencode/p2j/ui/client/driver/web/res/p2j.keymap.js	2015-07-31 17:40:15 +0000
260
@@ -13,80 +13,84 @@
261
 ** 002 MAG 20140228 Add javadoc.
262
 ** 003 GES 20150324 Moved this class to a common resource base and made it generic (so that it
263
 **                  can be used for both ChUI and GUI web clients.
264
+** 004 SBI 20150731 Applied "use strict" directive, fixed undeclared variables.
265
 */
266
 
267
+"use strict";
268
+
269
 /**
270
  * Global definitions for common key values.
271
  */
272
-keys = 
273
-{
274
-   BACKSPACE: 8,
275
-   TAB: 9,
276
-   CLEAR: 12,
277
-   ENTER: 13,
278
-   SHIFT: 16,
279
-   CTRL: 17,
280
-   ALT: 18,
281
-   PAUSE: 19,
282
-   CAPS_LOCK: 20,
283
-   ESCAPE: 27,
284
-   SPACE: 32,
285
-   PAGE_UP: 33,
286
-   PAGE_DOWN: 34,
287
-   END: 35,
288
-   HOME: 36,
289
-   LEFT_ARROW: 37,
290
-   UP_ARROW: 38,
291
-   RIGHT_ARROW: 39,
292
-   DOWN_ARROW: 40,
293
-   INSERT: 45,
294
-   DELETE: 46,
295
-   HELP: 47,
296
-   LEFT_WINDOW: 91,
297
-   RIGHT_WINDOW: 92,
298
-   SELECT: 93,
299
-   NUMPAD_0: 96,
300
-   NUMPAD_1: 97,
301
-   NUMPAD_2: 98,
302
-   NUMPAD_3: 99,
303
-   NUMPAD_4: 100,
304
-   NUMPAD_5: 101,
305
-   NUMPAD_6: 102,
306
-   NUMPAD_7: 103,
307
-   NUMPAD_8: 104,
308
-   NUMPAD_9: 105,
309
-   NUMPAD_MULTIPLY: 106,
310
-   NUMPAD_PLUS: 107,
311
-   NUMPAD_ENTER: 108,
312
-   NUMPAD_MINUS: 109,
313
-   NUMPAD_PERIOD: 110,
314
-   NUMPAD_DIVIDE: 111,
315
-   F1: 112,
316
-   F2: 113,
317
-   F3: 114,
318
-   F4: 115,
319
-   F5: 116,
320
-   F6: 117,
321
-   F7: 118,
322
-   F8: 119,
323
-   F9: 120,
324
-   F10: 121,
325
-   F11: 122,
326
-   F12: 123,
327
-   F13: 124,
328
-   F14: 125,
329
-   F15: 126,
330
-   NUM_LOCK: 144,
331
-   SCROLL_LOCK: 145,
332
-   UP_DPAD: 175,
333
-   DOWN_DPAD: 176,
334
-   LEFT_DPAD: 177,
335
-   RIGHT_DPAD: 178
336
+var keys = {
337
+   BACKSPACE : 8,
338
+   TAB : 9,
339
+   CLEAR : 12,
340
+   ENTER : 13,
341
+   SHIFT : 16,
342
+   CTRL : 17,
343
+   ALT : 18,
344
+   PAUSE : 19,
345
+   CAPS_LOCK : 20,
346
+   ESCAPE : 27,
347
+   SPACE : 32,
348
+   PAGE_UP : 33,
349
+   PAGE_DOWN : 34,
350
+   END : 35,
351
+   HOME : 36,
352
+   LEFT_ARROW : 37,
353
+   UP_ARROW : 38,
354
+   RIGHT_ARROW : 39,
355
+   DOWN_ARROW : 40,
356
+   INSERT : 45,
357
+   DELETE : 46,
358
+   HELP : 47,
359
+   LEFT_WINDOW : 91,
360
+   RIGHT_WINDOW : 92,
361
+   SELECT : 93,
362
+   NUMPAD_0 : 96,
363
+   NUMPAD_1 : 97,
364
+   NUMPAD_2 : 98,
365
+   NUMPAD_3 : 99,
366
+   NUMPAD_4 : 100,
367
+   NUMPAD_5 : 101,
368
+   NUMPAD_6 : 102,
369
+   NUMPAD_7 : 103,
370
+   NUMPAD_8 : 104,
371
+   NUMPAD_9 : 105,
372
+   NUMPAD_MULTIPLY : 106,
373
+   NUMPAD_PLUS : 107,
374
+   NUMPAD_ENTER : 108,
375
+   NUMPAD_MINUS : 109,
376
+   NUMPAD_PERIOD : 110,
377
+   NUMPAD_DIVIDE : 111,
378
+   F1 : 112,
379
+   F2 : 113,
380
+   F3 : 114,
381
+   F4 : 115,
382
+   F5 : 116,
383
+   F6 : 117,
384
+   F7 : 118,
385
+   F8 : 119,
386
+   F9 : 120,
387
+   F10 : 121,
388
+   F11 : 122,
389
+   F12 : 123,
390
+   F13 : 124,
391
+   F14 : 125,
392
+   F15 : 126,
393
+   NUM_LOCK : 144,
394
+   SCROLL_LOCK : 145,
395
+   UP_DPAD : 175,
396
+   DOWN_DPAD : 176,
397
+   LEFT_DPAD : 177,
398
+   RIGHT_DPAD : 178
399
 };
400
 
401
 p2j.keymap = (function()
402
 {
403
-   /** Key mapping object which will be returned from this initialization function. */
404
+   /**
405
+    * Key mapping object which will be returned from this initialization function.
406
+    */
407
    var me = {};
408
    
409
    /* normal key mapping */   
410
@@ -94,7 +98,7 @@
411
    
412
    /* ALT key mapping */
413
    me.xlateAlt = {};         
414
-       
415
+   
416
    /**
417
     * Init function.
418
     */
419

    
420
=== modified file 'src/com/goldencode/p2j/ui/client/driver/web/res/p2j.socket.js'
421
--- src/com/goldencode/p2j/ui/client/driver/web/res/p2j.socket.js	2015-05-18 20:48:28 +0000
422
+++ src/com/goldencode/p2j/ui/client/driver/web/res/p2j.socket.js	2015-07-31 17:40:15 +0000
423
@@ -17,8 +17,11 @@
424
 ** 006 MAG 20140402 Implements interactive child process mode.
425
 ** 007 GES 20150324 Moved this class to a common resource base and made it generic (so that it
426
 **                  can be used for both ChUI and GUI web clients.
427
+** 008 SBI 20150731 Applied "use strict" directive, fixed undeclared variables.
428
 */
429
 
430
+"use strict";
431
+
432
 p2j.socket = (function()
433
 {
434
    /** Socket object which will be returned from this initialization function. */
435

    
436
=== modified file 'src/com/goldencode/p2j/ui/client/driver/web/res/p2j.sound.js'
437
--- src/com/goldencode/p2j/ui/client/driver/web/res/p2j.sound.js	2015-05-18 20:48:28 +0000
438
+++ src/com/goldencode/p2j/ui/client/driver/web/res/p2j.sound.js	2015-07-31 17:40:15 +0000
439
@@ -13,8 +13,11 @@
440
 ** 002 MAG 20140228 Add javadoc.
441
 ** 003 GES 20150324 Moved this class to a common resource base and made it generic (so that it
442
 **                  can be used for both ChUI and GUI web clients.
443
+** 004 SBI 20150731 Applied "use strict" directive, fixed undeclared variables.
444
 */
445
 
446
+"use strict";
447
+
448
 p2j.sound = (function()
449
 {
450
    /** Sound object which will be returned from this initialization function. */
451
@@ -48,5 +51,5 @@
452
       }
453
    };
454
    
455
-   return me;       
456
+   return me;
457
 }());
458

    
459
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.clipboard_helpers.js'
460
--- src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.clipboard_helpers.js	2015-05-18 20:48:28 +0000
461
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.clipboard_helpers.js	2015-07-31 17:40:15 +0000
462
@@ -10,8 +10,12 @@
463
 **
464
 ** -#- -I- --Date-- ------------------------------Description----------------------------------
465
 ** 001 GES 20150324 First version, with refactored content moved from tty.clipboard.js.
466
+** 002 SBI 20150731 Applied "use strict" directive, fixed undeclared variables
467
+**                  and corrected the selection rectangle coordinates.
468
 */
469
 
470
+"use strict";
471
+
472
 p2j.clipboard_helpers = (function() 
473
 {
474
    /** Clipboard helper object which will be returned from this initialization function. */
475
@@ -71,8 +75,8 @@
476
     */
477
    me.mouseDown = function(e) 
478
    {
479
-      var x = (e.pageX - this.offsetLeft) | 0;
480
-      var y = (e.pageY - this.offsetTop) | 0;
481
+      var x = (e.pageX - canvas.offsetLeft) | 0;
482
+      var y = (e.pageY - canvas.offsetTop) | 0;
483
       cells.startX = (x / charWidth) | 0;
484
       cells.startY = (y / charHeight) | 0;         
485
       rect.startX = cells.startX * charWidth;
486
@@ -87,8 +91,8 @@
487
     */
488
    me.mouseMove = function(e) 
489
    {
490
-      var x = (e.pageX - this.offsetLeft | 0);
491
-      var y = (e.pageY - this.offsetTop | 0);
492
+      var x = (e.pageX - canvas.offsetLeft) | 0;
493
+      var y = (e.pageY - canvas.offsetTop) | 0;
494
       cells.startX1 = (x / charWidth) | 0;
495
       cells.startY1 = (y / charHeight) | 0;
496
 
497

    
498
=== modified file 'src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js'
499
--- src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js	2015-05-18 20:48:28 +0000
500
+++ src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js	2015-07-31 17:40:15 +0000
501
@@ -12,8 +12,11 @@
502
 ** 001 GES 20150325 Created GUI version from ChUI version. Right now it is not functional.
503
 **                  Renamed objects to match the more generic web client approach (not just
504
 **                  ChUI). Moved some logic to common code locations.
505
+** 002 SBI 20150731 Applied "use strict" directive, fixed undeclared variables.
506
 */
507
 
508
+"use strict";
509
+
510
 p2j.screen = (function()
511
 {
512
    /** Screen object which will be returned from this initialization function. */
513