Skip to content

Commit a810e0c

Browse files
committed
supro demo 2014-04-23
1 parent a2be685 commit a810e0c

File tree

421 files changed

+62453
-15
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

421 files changed

+62453
-15
lines changed

.files

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!ls -1 *exe *dll *pak | sort >.files
2+
icudt.dll
3+
libEGL.dll
4+
libGLESv2.dll
5+
node.exe
6+
nw.exe
7+
nw.pak

.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
bin/*.exe
2+
bin/*.dll
3+
*.exe
4+
*.dll
5+
*.pak
6+
log
7+
tmp
8+
extjs.txt
9+
nbproject

LICENSE

+12-13
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2014 Oleg Verych
3+
Copyright (c) 2012-2014 Oleg Verych
44

5-
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
7-
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
the Software, and to permit persons to whom the Software is furnished to do so,
10+
subject to the following conditions:
1111

1212
The above copyright notice and this permission notice shall be included in all
1313
copies or substantial portions of the Software.
1414

1515
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
supro-demo
2-
==========
1+
supro demo
2+
======
33

44
Sources of an app with web http://supro.dela.by:3007/ and local http://supro.dela.by/ftp/supro-demo_linux_win32.zip parts.
5+
6+
Features ExtJS, Node.JS and node-webkit JavaScript trio.
7+
8+
Using MS Windows 32 bit binaries (see `.files`):
9+
- [node.js](http://nodejs.org/download/)
10+
- [node-webkit](https://github.com/rogerwang/node-webkit)
11+
- [cygwin](http://www.cygwin.com/)

_devel_backend.cmd

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@set CYGWIN=nodosfilewarning
2+
bin\sh.exe _devel_backend.sh
3+
pause

_devel_backend.sh

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/bin/sh
2+
3+
set -e
4+
PATH=.:bin:$PATH
5+
6+
trap 'echo "
7+
Unexpected Script Error! Use /bin/sh -x $0 to trace it.
8+
"
9+
set +e
10+
11+
trap "" 0
12+
exit 0
13+
' 0
14+
15+
normal_exit(){
16+
echo "
17+
Normal Exit${1:- (backend is running)}
18+
"
19+
set +e
20+
trap '' 0
21+
exit 0
22+
}
23+
24+
trap 'normal_exit' HUP TERM INT
25+
26+
echo '
27+
reading config in $ENV
28+
'
29+
NODEJS_CONFIG=`dd if=./config/cfg_default.js`
30+
echo 'exporting it for childs
31+
'
32+
export NODEJS_CONFIG
33+
BACKEND_PORT=`sed '/ctl_port/{s/^[^:]*: \([^,]*\),/\1/p};d' <<!
34+
$NODEJS_CONFIG
35+
!`
36+
37+
echo "BACKEND_PORT: $BACKEND_PORT"'
38+
39+
running first Node.JS backend
40+
'
41+
42+
_lftp_http() { # $1=timeout $2=cmd
43+
{ # http head request with contentlength=0 reply
44+
echo "[lftp->nodeJS:$JSAPPCTLPORT] sending '$2'"
45+
lftp -c '
46+
set net:timeout 2;
47+
set cmd:long-running 2;
48+
set net:max-retries 2;
49+
set net:reconnect-interval-base '"$1"';
50+
set net:reconnect-interval-multiplier 1;
51+
52+
cd http://127.0.0.1:'"$BACKEND_PORT"'/ && cat '"$2"' && exit 0 || exit 1
53+
'
54+
} 0</dev/null
55+
return $?
56+
}
57+
58+
BACKEND='node ./app_main/app_back.js'
59+
exec 7>&1 8>&2
60+
61+
$BACKEND 1>&7 2>&8 &
62+
63+
while echo '
64+
Press "Enter" key to reload, "CTRL+D" stop backend || CTRL+C to break...
65+
'
66+
do
67+
read A || {
68+
echo '
69+
Stop backend (y/n)? '
70+
read A && {
71+
[ 'y' = "$A" ] && {
72+
_lftp_http 1 'cmd_exit'
73+
A='.'
74+
normal_exit "$A"
75+
}
76+
} || normal_exit
77+
}
78+
79+
_lftp_http 1 'cmd_exit' || :
80+
$BACKEND 1>&7 2>&8 &
81+
done

app_main/app.css

+111
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
/* simply:
2+
text: '<img height=64 width=64 src="css/usersman_shortcut.png"/><br/><br/>' +
3+
'Пользователи<br/>'
4+
than all this stuff:
5+
------
6+
js:
7+
text: '<br/><br/><br/><br/>Пользователи'
8+
,iconCls: 'appdesktop-shortcut appdesktop-usersman'
9+
,iconAlign: 'top'
10+
css:
11+
.appdesktop-shortcut {
12+
height: 64px!important;
13+
margin: 10px;
14+
}
15+
.appdesktop-procman {
16+
background-image: url(css/procman_shortcut.png);
17+
}
18+
.appdesktop-usersman {
19+
background-image: url(css/usersman_shortcut.png);
20+
}
21+
*/
22+
23+
/* "Yellow dollar sign" from Feifei http://www.favicon.cc/?action=icon&file_id=586714 */
24+
body { background: #FFFFFF url(css/supro.png) no-repeat center !important }
25+
26+
.x-gray-toolbar-default {
27+
border-color: #bcb0b0;
28+
border-width: 1px 1px 2px 1px;
29+
background-image: none;
30+
background-color: #d8d8d8;
31+
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #e6e6e6), color-stop(100%, #efefef));
32+
background-image: -webkit-linear-gradient(top, #e6e6e6, #efefef);
33+
background-image: -moz-linear-gradient(top, #e6e6e6, #efefef);
34+
background-image: -o-linear-gradient(top, #e6e6e6, #efefef);
35+
background-image: linear-gradient(top, #e6e6e6, #efefef);
36+
}
37+
.x-gray-toolbar {
38+
font-size: 11px;
39+
border-style: solid;
40+
padding: 2px 0 2px 2px;
41+
}
42+
43+
/* line 101, ../../../ext-theme-neutral/sass/src/toolbar/Toolbar.scss */
44+
.x-gray-toolbar-item {
45+
margin: 0 2px 0 0;
46+
}
47+
48+
/* line 112, ../../../ext-theme-neutral/sass/src/toolbar/Toolbar.scss */
49+
.x-gray-toolbar-text {
50+
margin: 0 6px 0 4px;
51+
color: black;
52+
line-height: 16px;
53+
font-family: tahoma, arial, verdana, sans-serif;
54+
font-size: 11px;
55+
font-weight: normal;
56+
}
57+
58+
/* line 121, ../../../ext-theme-neutral/sass/src/toolbar/Toolbar.scss */
59+
.x-gray-toolbar-separator-horizontal {
60+
margin: 0 2px 0 0;
61+
height: 14px;
62+
border-style: solid;
63+
border-width: 0 1px;
64+
border-left-color: #aca899;
65+
border-right-color: white;
66+
}
67+
68+
/* line 137, ../../../ext-theme-neutral/sass/src/toolbar/Toolbar.scss */
69+
.x-gray-toolbar-footer {
70+
background: transparent;
71+
border: 0;
72+
margin: 3px 0 0;
73+
padding: 2px 0 2px 6px;
74+
}
75+
/* line 144, ../../../ext-theme-neutral/sass/src/toolbar/Toolbar.scss */
76+
.x-gray-toolbar-footer .x-gray-toolbar-item {
77+
margin: 0 6px 0 0;
78+
}
79+
80+
/* line 149, ../../../ext-theme-neutral/sass/src/toolbar/Toolbar.scss */
81+
.x-gray-toolbar-spacer {
82+
width: 2px;
83+
}
84+
85+
/* line 154, ../../../ext-theme-neutral/sass/src/toolbar/Toolbar.scss */
86+
.x-gray-toolbar-more-icon {
87+
background-image: url(css/gray-toolbar/more.gif) !important;
88+
background-position: center center !important;
89+
background-repeat: no-repeat;
90+
}
91+
92+
.x-grid-row .x-grid-cell-inner {
93+
font-family: verdana !important;
94+
}
95+
/* TODO flag: background-color: red !important; */
96+
97+
.sg-c { background-image:url(css/comments_delete.png); }
98+
.sg-e { background-image:url(css/script_link.png); }
99+
.sg-r { background-image:url(css/link_go.png); }
100+
.sg-k { background-image:url(css/link_delete.png); }
101+
.sg-m { background-image:url(css/comments.png); }
102+
103+
.redwhite { background-color: #FF0000 !important; color: #FFFFFF; }
104+
.new-bold-row .x-grid-cell { font-weight: bold; }
105+
#stscount { color: blue; }
106+
107+
.row-unread { background-image:url(css/itemunread.png); background-repeat: no-repeat; }
108+
.row-read { background-image:url(css/itemread.png); background-repeat: no-repeat; }
109+
110+
.transparent > div { background: transparent!important; }
111+
.ok { background-image:url(css/ok.png)!important; }

app_main/app.htm

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<html>
2+
<head>
3+
<meta charset="utf-8">
4+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5+
<meta name="google" value="notranslate" />
6+
<title>SUPro Demo 2014-04-23</title>
7+
<!-- "Yellow dollar sign" from Feifei http://www.favicon.cc/?action=icon&file_id=586714 -->
8+
<link rel="icon" type="image/x-icon" href="data:image/x-icon;base64,AAABAAEAEBA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uCgA9DQA9DQA4ijI4ijIANAAANAAANAA+kTkAAAD8fwAA/H8AAPAPAADgBwAAwAMAAMQDAAD8QwAA8AMAAOAHAADADwAAwn8AAMIHAADAAwAA4AcAAPAPAAD8fwAA" />
9+
<link rel="stylesheet" href="app.css" />
10+
<!-- l10n can be configured and/or changed by server side view engine and template
11+
for now it's static: -->
12+
<script type="text/javascript" src="l10n/ru.js" charset="utf-8"></script>
13+
<script type="text/javascript">(
14+
function pre_load(w, d ,l10n, c){
15+
var b, s = "FATAL ERROR: no language! File './l10n/ru.js' or similar."
16+
if(!l10n)
17+
return d.write(s) && alert(s)
18+
19+
w.addEventListener('error' ,function(errEvent){// show any errors early
20+
c && c.error(errEvent)
21+
d.write(
22+
'<pre><div style="color:white;background-color:red;">' +
23+
'filename: "' + (errEvent.filename || 'app_front.js" or "extjs_load.js') + '"\n' +
24+
errEvent.error.stack.replace(/</g, '&lt;') +
25+
'</div></pre>'
26+
)
27+
w.alert && w.alert(l10n.uncaughtException + errEvent.message)
28+
w.alert = null// show fatal error once
29+
})
30+
31+
if(!(s = localStorage.l10n) || l10n.lang == s)
32+
return load_front()
33+
34+
b = d.head.getElementsByTagName('script')
35+
d.head.removeChild(b[1])
36+
d.head.removeChild(b[0])
37+
b = d.createElement('script')
38+
b.setAttribute('type' ,'application/javascript')
39+
b.setAttribute('charset' ,'utf-8')
40+
b.setAttribute('src' ,'l10n/' + s + '.js')
41+
d.head.appendChild(b)
42+
43+
return setTimeout(load_front, 1)
44+
45+
function load_front(){
46+
b = d.createElement('b')
47+
w.addEventListener('load' ,function pre_onload(e){
48+
e.target.removeEventListener(e.type ,pre_onload)
49+
b.innerHTML = l10n.loading
50+
d.getElementById('startup').appendChild(b)
51+
startup(true)// preload ExtJS stuff
52+
setTimeout(startup, 0)// schedule heavy loading after html && dom
53+
})
54+
}
55+
56+
function startup(extjs){
57+
b = new XMLHttpRequest()
58+
b.open('GET', (extjs ? 'extjs_load.js' : 'app_front.js'), false)
59+
b.send()
60+
if(b.responseText){
61+
d.head.removeChild(d.head.getElementsByTagName('script')[0])
62+
b = d.createElement('script')
63+
.appendChild(d.createTextNode(b.responseText))
64+
.parentNode
65+
b.setAttribute('type' ,'application/javascript')
66+
b.setAttribute('charset' ,'utf-8')
67+
d.head.appendChild(b)
68+
} else {
69+
d.write(l10n.errload_no_app + '<br>' + l10n.errload)
70+
}
71+
b = null// mark for GC
72+
}
73+
})(window, document, window.l10n, window.console)
74+
</script>
75+
</head>
76+
<body style="color:black;background-color:white;margin:0;">
77+
<center id='startup'>
78+
<noscript><br/>
79+
<h2 style="color:red">
80+
Error: NO JavaScript. Sorry!<br/>
81+
Без включенного JavaScript ждать нечего!
82+
</h2></noscript>
83+
<a href="http://www.sencha.com/products/extjs/">
84+
<img src="css/powered.gif" title="ExtJS" alt="ExtJS"/>
85+
</a><br/>
86+
<img src='css/loading.gif'/><br/>
87+
<a href='credits_node-webkit.html'>node-webkit credits</a><br/><br/>
88+
<center id="e" style="background-color:red;color:white;display:none">
89+
<h2 id="d"></h2><br>
90+
</center>
91+
</center>
92+
</body>
93+
</html>

app_main/app_back.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
(function uglify_js_closure(con){
2+
var cfg = require('./lib/read_config.js')
3+
4+
global._log = _log
5+
global._err = _err
6+
7+
require('./lib/response.js')
8+
require('./lib/process.js')(process)
9+
require('./lib/ctl_backend.js')(cfg, run_backend)
10+
11+
function _log(m){ con.log(m) }
12+
function _err(e){ con.error(e) }
13+
14+
function run_backend(){
15+
_log('^ app is starting http @ port ' + cfg.backend.job_port + '\n' +
16+
new Date().toISOString()
17+
)
18+
require('./lib/api.js').set_api(cfg, con, _log, _err)
19+
require('./lib/app.js')()
20+
}
21+
22+
})(console)

0 commit comments

Comments
 (0)