Skip to content

Commit ee87412

Browse files
authorization from other namespace fix, some translations to russian, /sql namespace fix, other small fixes
1 parent 16d9687 commit ee87412

File tree

11 files changed

+379
-103
lines changed

11 files changed

+379
-103
lines changed

%WebTerminal/Engine.cls.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<Description>
55
This class represents the core of web terminal.
66
All operations with opened WebSocket placed here.
7-
CLASS USES GLOBAL ^%WebTerminal.Engine.AuthorizationKey for client
7+
CLASS USES GLOBAL ^|"%SYS"|%WebTerminal.AuthKey for client
88
authorization.</Description>
99
<Super>%CSP.WebSocket,%Library.Routine</Super>
1010
<TimeCreated>63047,60359.445979</TimeCreated>
@@ -565,7 +565,7 @@ system classes generates one time and forever. </Description>
565565
Generating new authorization key</Description>
566566
<ClassMethod>1</ClassMethod>
567567
<ReturnType>%String</ReturnType>
568-
<Implementation><![CDATA[ set ^CacheTemp.WebTerminal.AuthKey = $SYSTEM.Util.CreateGUID()
568+
<Implementation><![CDATA[ set ^|"%SYS"|%WebTerminal.AuthKey = $SYSTEM.Util.CreateGUID()
569569
]]></Implementation>
570570
</Method>
571571

@@ -576,10 +576,10 @@ If the key is empty, generates new key value.</Description>
576576
<ClassMethod>1</ClassMethod>
577577
<ReturnType>%String</ReturnType>
578578
<Implementation><![CDATA[
579-
if ($get(^CacheTemp.WebTerminal.AuthKey) = "") {
579+
if ($get(^|"%SYS"|%WebTerminal.AuthKey) = "") {
580580
Do ..GenerateAuthKey()
581581
}
582-
quit ^CacheTemp.WebTerminal.AuthKey
582+
quit ^|"%SYS"|%WebTerminal.AuthKey
583583
]]></Implementation>
584584
</Method>
585585

@@ -789,7 +789,7 @@ Method description:
789789
if ('$$$ISOK(result)) {
790790
set result = ..RemoveWatch(data)
791791
if ('$$$ISOK(result)) {
792-
do ..SendData("unreal", ..ConstClientWatch)
792+
do ..SendData("!" _ data, ..ConstClientWatch)
793793
}
794794
}
795795
@@ -813,7 +813,7 @@ Method description:
813813
} elseif (action = ..ConstServerActionEcho) {
814814
815815
do ..StartClearIO()
816-
do ..SendData(data)
816+
write data
817817
do ..EndClearIO()
818818
819819
} else { // something scary

csp/webTerminal/css/base.css.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ tr, td {
3131
border-spacing: 0;
3232
}
3333
34+
input {
35+
margin-left: 20px;
36+
}
37+
38+
input:first-child {
39+
margin-left: 0;
40+
}
41+
3442
p {
3543
text-indent: 40px;
3644
}]]></CSP>

csp/webTerminal/css/terminal.css.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,6 @@ terminal-base tr, td {
130130
vertical-align: top;
131131
}
132132
133-
#terminal-themes-container > input {
134-
margin-left: 20px;
135-
}
136-
137133
#terminal-control-closeButton {
138134
float: right;
139135
cursor: pointer;

csp/webTerminal/index.csp.xml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@
1616
<link rel="stylesheet" href="css/terminal.css">
1717
<link rel="stylesheet" href="css/extra.css">
1818
<link rel="stylesheet" href="css/theme-default.css" id="terminal-color-theme">
19-
<script type="text/javascript" src="js/base.js"></script>
20-
<script type="text/javascript" src="js/parser.js"></script>
21-
<script type="text/javascript" src="js/hid.js"></script>
22-
<script type="text/javascript" src="js/application.js"></script>
23-
<script type="text/javascript" src="js/server.js"></script>
24-
<script type="text/javascript" src="js/terminal.js"></script>
25-
<script type="text/javascript" src="js/unit.js"></script>
26-
<script type="text/javascript" src="js/storage.js"></script>
19+
<script type="text/javascript" src="js/storage.js"></script> <!-- first loading storage independent module -->
20+
<script type="text/javascript" src="js/parser.js"></script> <!-- parser is independent module -->
21+
<script type="text/javascript" src="js/hid.js"></script> <!-- hid is independent module -->
22+
<script type="text/javascript" src="js/language.js"></script> <!-- language module reads setting from storage -->
23+
<script type="text/javascript" src="js/base.js"></script> <!-- dom/settings uses storage, parser and language -->
24+
<script type="text/javascript" src="js/application.js"></script> <!-- application module uses language, settings, storage -->
25+
<script type="text/javascript" src="js/server.js"></script> <!-- server uses parser -->
26+
<script type="text/javascript" src="js/terminal.js"></script> <!-- terminal uses almost all modules above -->
27+
<script type="text/javascript" src="js/unit.js"></script> <!-- unit-test module, not necessary -->
2728
</head>
2829
2930
<body>
@@ -91,6 +92,16 @@
9192
Saves your history, favorites, definitions and autocompletion automatically after browser tab closed and loads it later.
9293
</td>
9394
</tr>
95+
<tr>
96+
<td>
97+
Language
98+
</td>
99+
<td>
100+
<label id="terminal-languages-container">
101+
102+
</label>
103+
</td>
104+
</tr>
94105
<tr>
95106
<td>
96107
Color theme

csp/webTerminal/js/application.js.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
var application = new function() {
88
9-
var version = "0.9.7.1 beta";
9+
var version = "0.9.7.8 beta";
1010
this.debug = false; // remove for release
1111
this.debugUrlPart = "127.0.0.1:57772"; // in-debug mode
1212

csp/webTerminal/js/base.js.xml

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ var dom = new function() {
8383
settingsParseOutput: null,
8484
themeCSS: null,
8585
themesContainer: null,
86+
languagesContainer: null,
8687
body: null,
8788
startupScript: null,
8889
@@ -96,13 +97,17 @@ var dom = new function() {
9697
dul.moveToElementText(object);
9798
sel.text = c;
9899
var len = dul.text.indexOf(c);
99-
sel.moveStart('character',-1);
100+
sel.moveStart("character", -1);
100101
sel.text = "";
101102
return len;
102103
},
103104
104105
getThemeSelectorObject: function(themeName) {
105106
return dom.element("terminal-color-theme-" + themeName);
107+
},
108+
109+
getLanguageSelectorObject: function(langName) {
110+
return dom.element("terminal-language-unit-" + langName);
106111
}
107112
};
108113
@@ -204,6 +209,7 @@ var dom = new function() {
204209
objects.settingsCleanStartup = dom.element("settings-cleanStartup");
205210
objects.themesContainer = dom.element("terminal-themes-container");
206211
objects.settingsParseOutput = dom.element("settings-parse-output");
212+
objects.languagesContainer = dom.element("terminal-languages-container");
207213
objects.startupScript = dom.element("startup");
208214
objects.body = document.body;
209215
};
@@ -238,7 +244,13 @@ var dom = new function() {
238244
if (!application.themes.hasOwnProperty(theme) || !theme) continue;
239245
this.objects.themesContainer.innerHTML += "<input id=\"terminal-color-theme-" + theme + "\" " +
240246
"type=\"radio\" name=\"terminal-color-scheme\" value=\"" + theme + "\">" + theme[0].toUpperCase() +
241-
theme.substr(1)
247+
theme.substr(1);
248+
}
249+
250+
for (var l in lang.availableLanguages) {
251+
if (!lang.availableLanguages.hasOwnProperty(l) || !l) continue;
252+
this.objects.languagesContainer.innerHTML += "<input id=\"terminal-language-unit-" + l + "\" " +
253+
"type=\"radio\" name=\"terminal-language-unit\" value=\"" + l + "\">" + l.toUpperCase();
242254
}
243255
244256
return this.objectsReady();
@@ -268,16 +280,15 @@ var settings = new function() {
268280
colorTheme = "default",
269281
restoreSession = 0,
270282
parseOutput = 0,
271-
cleanStartup = 0;
283+
cleanStartup = 0,
284+
language = "en";
272285
273286
this.get_restoreSession = function() { return restoreSession == 1 };
274287
this.get_cleanStartup = function() { return cleanStartup == 1 && !terminal.ready };
275288
this.get_parseOutput = function() { return parseOutput };
276289
this.get_animations = function() { return animations };
277-
278-
this.get_theme = function() {
279-
return colorTheme;
280-
};
290+
this.get_language = function() { return language };
291+
this.get_theme = function() { return colorTheme };
281292
282293
this.export = function() {
283294
return {
@@ -287,15 +298,17 @@ var settings = new function() {
287298
colorTheme: colorTheme,
288299
restoreSession: restoreSession,
289300
cleanStartup: cleanStartup,
290-
parseOutput: parseOutput
301+
parseOutput: parseOutput,
302+
language: language
291303
};
292304
};
293305
294306
this.import = function(settingImportObject) {
295307
if (!(typeof settingImportObject === "object" && settingImportObject.hasOwnProperty("!export:settings") &&
296308
settingImportObject.hasOwnProperty("animations") && settingImportObject.hasOwnProperty("highlighting") &&
297309
settingImportObject.hasOwnProperty("colorTheme") && settingImportObject.hasOwnProperty("restoreSession") &&
298-
settingImportObject.hasOwnProperty("cleanStartup") && settingImportObject.hasOwnProperty("cleanStartup"))) {
310+
settingImportObject.hasOwnProperty("cleanStartup") && settingImportObject.hasOwnProperty("parseOutput") &&
311+
settingImportObject.hasOwnProperty("language"))) {
299312
log.write("Wrong settings object to import. Use /reset to restore settings.");
300313
return;
301314
}
@@ -305,6 +318,7 @@ var settings = new function() {
305318
parseOutput = settingImportObject["parseOutput"];
306319
restoreSession = (settingImportObject["restoreSession"] == 1)?1:0;
307320
cleanStartup = settingImportObject["cleanStartup"];
321+
language = settingImportObject["language"];
308322
this.update();
309323
};
310324
@@ -315,6 +329,7 @@ var settings = new function() {
315329
restoreSession = 0;
316330
parseOutput = 0;
317331
cleanStartup = 0;
332+
language = "en";
318333
this.update();
319334
};
320335
@@ -337,6 +352,14 @@ var settings = new function() {
337352
if (obj.checked) colorTheme = theme;
338353
}
339354
355+
language = "en";
356+
for (var l in lang.availableLanguages) {
357+
if (!lang.availableLanguages.hasOwnProperty(l)) continue;
358+
var obj2 = dom.objects.getLanguageSelectorObject(l);
359+
if (!obj2) continue;
360+
if (obj2.checked) language = l;
361+
}
362+
340363
dom.objects.themeCSS.href = "css/theme-" + colorTheme + ".css";
341364
if (!animations) {
342365
dom.removeClass(dom.objects.body,"noAnimations");
@@ -385,6 +408,12 @@ var settings = new function() {
385408
if (!obj) continue;
386409
obj.checked = colorTheme === theme;
387410
}
411+
for (var l in lang.availableLanguages) {
412+
if (!lang.availableLanguages.hasOwnProperty(l)) continue;
413+
var obj2 = dom.objects.getLanguageSelectorObject(l);
414+
if (!obj2) continue;
415+
obj2.checked = language === l;
416+
}
388417
};
389418
390419
this.update = function() {

0 commit comments

Comments
 (0)