rsence 2.0.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/INSTALL.rdoc +295 -0
- data/LICENSE +622 -0
- data/README.rdoc +24 -0
- data/VERSION +1 -0
- data/bin/build_client.rb +254 -0
- data/bin/help +6 -0
- data/bin/launch.rb +120 -0
- data/bin/rdoc.sh +2 -0
- data/bin/restart +6 -0
- data/bin/rsence +120 -0
- data/bin/run +6 -0
- data/bin/run.rb +6 -0
- data/bin/save +6 -0
- data/bin/start +6 -0
- data/bin/status +6 -0
- data/bin/stop +6 -0
- data/conf/config.ru +5 -0
- data/conf/default_conf.yaml +337 -0
- data/conf/default_strings.yaml +77 -0
- data/conf/local_conf.yaml +14 -0
- data/conf/unicorn.conf +78 -0
- data/js/comm/comm/autosync/autosync.js +18 -0
- data/js/comm/comm/autosync/js.inc +0 -0
- data/js/comm/comm/comm.js +195 -0
- data/js/comm/comm/js.inc +0 -0
- data/js/comm/comm/queue/js.inc +0 -0
- data/js/comm/comm/queue/queue.js +183 -0
- data/js/comm/comm/session/js.inc +0 -0
- data/js/comm/comm/session/session.js +51 -0
- data/js/comm/comm/sessionwatcher/js.inc +0 -0
- data/js/comm/comm/sessionwatcher/sessionwatcher.js +43 -0
- data/js/comm/comm/transporter/js.inc +0 -0
- data/js/comm/comm/transporter/transporter.js +257 -0
- data/js/comm/comm/urlresponder/js.inc +0 -0
- data/js/comm/comm/urlresponder/urlresponder.js +148 -0
- data/js/comm/comm/values/js.inc +0 -0
- data/js/comm/comm/values/values.js +432 -0
- data/js/comm/jsloader/js.inc +0 -0
- data/js/comm/jsloader/jsloader.js +114 -0
- data/js/comm/reloadapp/js.inc +0 -0
- data/js/comm/reloadapp/reloadapp.js +150 -0
- data/js/comm/reloadapp/themes/default/reloadapp_warning-ie6.gif +0 -0
- data/js/comm/reloadapp/themes/default/reloadapp_warning.png +0 -0
- data/js/comm/sha/js.inc +0 -0
- data/js/comm/sha/sha.js +432 -0
- data/js/comm/values/value/js.inc +0 -0
- data/js/comm/values/value/value.js +182 -0
- data/js/comm/values/valuematrix/js.inc +0 -0
- data/js/comm/values/valuematrix/valuematrix.js +138 -0
- data/js/controls/button/button.js +57 -0
- data/js/controls/button/js.inc +0 -0
- data/js/controls/button/themes/bright/button.css +89 -0
- data/js/controls/button/themes/bright/button.html +7 -0
- data/js/controls/button/themes/bright/button_parts1-ie6.gif +0 -0
- data/js/controls/button/themes/bright/button_parts1.png +0 -0
- data/js/controls/button/themes/default/button.css +89 -0
- data/js/controls/button/themes/default/button.html +7 -0
- data/js/controls/button/themes/default/button_parts1-ie6.gif +0 -0
- data/js/controls/button/themes/default/button_parts1.png +0 -0
- data/js/controls/checkbox/checkbox.js +47 -0
- data/js/controls/checkbox/js.inc +0 -0
- data/js/controls/checkbox/themes/default/checkbox.css +69 -0
- data/js/controls/checkbox/themes/default/checkbox.html +5 -0
- data/js/controls/checkbox/themes/default/checkbox_parts1-ie6.gif +0 -0
- data/js/controls/checkbox/themes/default/checkbox_parts1.png +0 -0
- data/js/controls/datetime/calendar/calendar.js +197 -0
- data/js/controls/datetime/calendar/js.inc +0 -0
- data/js/controls/datetime/calendar/themes/default/calendar.css +108 -0
- data/js/controls/datetime/calendar/themes/default/calendar.html +9 -0
- data/js/controls/datetime/calendar/themes/default/calendar_arrows-ie6.gif +0 -0
- data/js/controls/datetime/calendar/themes/default/calendar_arrows.png +0 -0
- data/js/controls/datetime/datetimevalue/datetimevalue.js +246 -0
- data/js/controls/datetime/datetimevalue/js.inc +0 -0
- data/js/controls/datetime/timesheet/js.inc +0 -0
- data/js/controls/datetime/timesheet/themes/default/timesheet.css +30 -0
- data/js/controls/datetime/timesheet/themes/default/timesheet.html +2 -0
- data/js/controls/datetime/timesheet/timesheet.js +182 -0
- data/js/controls/datetime/timesheet_item/js.inc +0 -0
- data/js/controls/datetime/timesheet_item/themes/default/timesheet_item.css +42 -0
- data/js/controls/datetime/timesheet_item/themes/default/timesheet_item.html +8 -0
- data/js/controls/datetime/timesheet_item/timesheet_item.js +247 -0
- data/js/controls/datetime/timesheet_item_edit/js.inc +0 -0
- data/js/controls/datetime/timesheet_item_edit/timesheet_item_edit.js +274 -0
- data/js/controls/dialogs/alert_sheet/alert_sheet.js +62 -0
- data/js/controls/dialogs/alert_sheet/js.inc +0 -0
- data/js/controls/dialogs/confirm_sheet/confirm_sheet.js +36 -0
- data/js/controls/dialogs/confirm_sheet/js.inc +0 -0
- data/js/controls/dialogs/sheet/js.inc +0 -0
- data/js/controls/dialogs/sheet/sheet.js +83 -0
- data/js/controls/dialogs/sheet/themes/default/sheet.css +64 -0
- data/js/controls/dialogs/sheet/themes/default/sheet.html +14 -0
- data/js/controls/dialogs/sheet/themes/default/sheet_bg-ie6.gif +0 -0
- data/js/controls/dialogs/sheet/themes/default/sheet_bg.png +0 -0
- data/js/controls/dialogs/sheet/themes/default/sheet_dim-ie6.gif +0 -0
- data/js/controls/dialogs/sheet/themes/default/sheet_dim.png +0 -0
- data/js/controls/dialogs/sheet/themes/default/sheet_parts1-ie6.gif +0 -0
- data/js/controls/dialogs/sheet/themes/default/sheet_parts1.png +0 -0
- data/js/controls/dialogs/sheet/themes/default/sheet_parts2-ie6.gif +0 -0
- data/js/controls/dialogs/sheet/themes/default/sheet_parts2.png +0 -0
- data/js/controls/dialogs/sheet/themes/default/sheet_warning-ie6.gif +0 -0
- data/js/controls/dialogs/sheet/themes/default/sheet_warning.png +0 -0
- data/js/controls/imageview/imageview.js +108 -0
- data/js/controls/imageview/js.inc +0 -0
- data/js/controls/imageview/themes/default/blank.gif +0 -0
- data/js/controls/lists/checkboxlist/checkboxlist.js +170 -0
- data/js/controls/lists/checkboxlist/js.inc +0 -0
- data/js/controls/lists/listitems/js.inc +0 -0
- data/js/controls/lists/listitems/listitems.js +65 -0
- data/js/controls/lists/radiobuttonlist/js.inc +0 -0
- data/js/controls/lists/radiobuttonlist/radiobuttonlist.js +126 -0
- data/js/controls/passwordcontrol/js.inc +0 -0
- data/js/controls/passwordcontrol/passwordcontrol.js +22 -0
- data/js/controls/passwordcontrol/themes/default/passwordcontrol.css +0 -0
- data/js/controls/passwordcontrol/themes/default/passwordcontrol.html +18 -0
- data/js/controls/progress/progressbar/js.inc +0 -0
- data/js/controls/progress/progressbar/progressbar.js +36 -0
- data/js/controls/progress/progressbar/themes/default/progressbar.css +16 -0
- data/js/controls/progress/progressbar/themes/default/progressbar.html +2 -0
- data/js/controls/progress/progressindicator/js.inc +0 -0
- data/js/controls/progress/progressindicator/progressindicator.js +43 -0
- data/js/controls/radiobutton/js.inc +0 -0
- data/js/controls/radiobutton/radiobutton.js +41 -0
- data/js/controls/radiobutton/themes/default/radiobutton.css +69 -0
- data/js/controls/radiobutton/themes/default/radiobutton.html +5 -0
- data/js/controls/radiobutton/themes/default/radiobutton_parts1-ie6.gif +0 -0
- data/js/controls/radiobutton/themes/default/radiobutton_parts1.png +0 -0
- data/js/controls/sliders/slider/js.inc +0 -0
- data/js/controls/sliders/slider/slider.js +356 -0
- data/js/controls/sliders/slider/themes/default/hslider_tracks-ie6.gif +0 -0
- data/js/controls/sliders/slider/themes/default/hslider_tracks.png +0 -0
- data/js/controls/sliders/slider/themes/default/slider.css +108 -0
- data/js/controls/sliders/slider/themes/default/slider.html +5 -0
- data/js/controls/sliders/slider/themes/default/slider_thumbs-ie6.gif +0 -0
- data/js/controls/sliders/slider/themes/default/slider_thumbs.png +0 -0
- data/js/controls/sliders/vslider/js.inc +0 -0
- data/js/controls/sliders/vslider/themes/default/vslider.css +52 -0
- data/js/controls/sliders/vslider/themes/default/vslider.html +5 -0
- data/js/controls/sliders/vslider/themes/default/vslider_tracks-ie6.gif +0 -0
- data/js/controls/sliders/vslider/themes/default/vslider_tracks.png +0 -0
- data/js/controls/sliders/vslider/vslider.js +40 -0
- data/js/controls/stepper/js.inc +0 -0
- data/js/controls/stepper/stepper.js +212 -0
- data/js/controls/stepper/themes/default/stepper-ie6.gif +0 -0
- data/js/controls/stepper/themes/default/stepper.css +14 -0
- data/js/controls/stepper/themes/default/stepper.html +2 -0
- data/js/controls/stepper/themes/default/stepper.png +0 -0
- data/js/controls/stringview/js.inc +0 -0
- data/js/controls/stringview/stringview.js +49 -0
- data/js/controls/stringview/themes/default/stringview.css +8 -0
- data/js/controls/stringview/themes/default/stringview.html +1 -0
- data/js/controls/tab/js.inc +0 -0
- data/js/controls/tab/tab.js +276 -0
- data/js/controls/tab/themes/bright/tab.css +76 -0
- data/js/controls/tab/themes/bright/tab.html +6 -0
- data/js/controls/tab/themes/bright/tab_bg_color-ie6.gif +0 -0
- data/js/controls/tab/themes/bright/tab_bg_color.png +0 -0
- data/js/controls/tab/themes/bright/tab_border_pattern-ie6.gif +0 -0
- data/js/controls/tab/themes/bright/tab_border_pattern.png +0 -0
- data/js/controls/tab/themes/bright/tab_parts1-ie6.gif +0 -0
- data/js/controls/tab/themes/bright/tab_parts1.png +0 -0
- data/js/controls/tab/themes/default/tab.css +77 -0
- data/js/controls/tab/themes/default/tab.html +6 -0
- data/js/controls/tab/themes/default/tab_bg_color-ie6.gif +0 -0
- data/js/controls/tab/themes/default/tab_bg_color.png +0 -0
- data/js/controls/tab/themes/default/tab_border_pattern-ie6.gif +0 -0
- data/js/controls/tab/themes/default/tab_border_pattern.png +0 -0
- data/js/controls/tab/themes/default/tab_parts1-ie6.gif +0 -0
- data/js/controls/tab/themes/default/tab_parts1.png +0 -0
- data/js/controls/textarea/js.inc +0 -0
- data/js/controls/textarea/textarea.js +23 -0
- data/js/controls/textarea/themes/default/textarea.css +21 -0
- data/js/controls/textarea/themes/default/textarea.html +18 -0
- data/js/controls/textcontrol/js.inc +0 -0
- data/js/controls/textcontrol/textcontrol.js +372 -0
- data/js/controls/textcontrol/themes/default/textcontrol.css +107 -0
- data/js/controls/textcontrol/themes/default/textcontrol.html +18 -0
- data/js/controls/textcontrol/themes/default/textcontrol_parts1-ie6.gif +0 -0
- data/js/controls/textcontrol/themes/default/textcontrol_parts1.png +0 -0
- data/js/controls/textcontrol/themes/default/textcontrol_parts2-ie6.gif +0 -0
- data/js/controls/textcontrol/themes/default/textcontrol_parts2.png +0 -0
- data/js/controls/textcontrol/themes/default/textcontrol_parts3-ie6.gif +0 -0
- data/js/controls/textcontrol/themes/default/textcontrol_parts3.png +0 -0
- data/js/controls/uploader/js.inc +0 -0
- data/js/controls/uploader/themes/default/upload_progress.gif +0 -0
- data/js/controls/uploader/themes/default/uploader.css +108 -0
- data/js/controls/uploader/themes/default/uploader.html +27 -0
- data/js/controls/uploader/uploader.js +153 -0
- data/js/controls/validatorview/js.inc +0 -0
- data/js/controls/validatorview/themes/default/validator-ie6.gif +0 -0
- data/js/controls/validatorview/themes/default/validator.png +0 -0
- data/js/controls/validatorview/themes/default/validatorview.css +0 -0
- data/js/controls/validatorview/themes/default/validatorview.html +0 -0
- data/js/controls/validatorview/validatorview.js +55 -0
- data/js/controls/window/js.inc +0 -0
- data/js/controls/window/themes/default/window.css +219 -0
- data/js/controls/window/themes/default/window.html +17 -0
- data/js/controls/window/themes/default/window_bg_active-ie6.gif +0 -0
- data/js/controls/window/themes/default/window_bg_active.png +0 -0
- data/js/controls/window/themes/default/window_bg_inactive-ie6.gif +0 -0
- data/js/controls/window/themes/default/window_bg_inactive.png +0 -0
- data/js/controls/window/themes/default/window_buttons-ie6.gif +0 -0
- data/js/controls/window/themes/default/window_buttons.png +0 -0
- data/js/controls/window/themes/default/window_parts1-ie6.gif +0 -0
- data/js/controls/window/themes/default/window_parts1.png +0 -0
- data/js/controls/window/themes/default/window_parts2-ie6.gif +0 -0
- data/js/controls/window/themes/default/window_parts2.png +0 -0
- data/js/controls/window/window.js +284 -0
- data/js/core/class/class.js +317 -0
- data/js/core/class/js.inc +0 -0
- data/js/core/elem/elem.js +1376 -0
- data/js/core/elem/js.inc +0 -0
- data/js/core/event/event.js +1021 -0
- data/js/core/event/js.inc +0 -0
- data/js/core/iefix/ie_css_element.htc +5 -0
- data/js/core/iefix/ie_css_style.htc +5 -0
- data/js/core/iefix/iefix.js +359 -0
- data/js/core/iefix/js.inc +0 -0
- data/js/debugg/debugg.js +43 -0
- data/js/debugg/js.inc +0 -0
- data/js/foundation/application/application.js +209 -0
- data/js/foundation/application/js.inc +0 -0
- data/js/foundation/control/control.js +342 -0
- data/js/foundation/control/controldefaults/controldefaults.js +59 -0
- data/js/foundation/control/controldefaults/js.inc +0 -0
- data/js/foundation/control/dummyvalue/dummyvalue.js +50 -0
- data/js/foundation/control/dummyvalue/js.inc +0 -0
- data/js/foundation/control/dyncontrol/dyncontrol.js +494 -0
- data/js/foundation/control/dyncontrol/js.inc +0 -0
- data/js/foundation/control/dyncontrol/themes/default/dyncontrol.css +0 -0
- data/js/foundation/control/dyncontrol/themes/default/dyncontrol.html +0 -0
- data/js/foundation/control/eventresponder/eventresponder.js +713 -0
- data/js/foundation/control/eventresponder/js.inc +0 -0
- data/js/foundation/control/js.inc +0 -0
- data/js/foundation/control/valueresponder/js.inc +0 -0
- data/js/foundation/control/valueresponder/valueresponder.js +77 -0
- data/js/foundation/geom/point/js.inc +0 -0
- data/js/foundation/geom/point/point.js +202 -0
- data/js/foundation/geom/rect/js.inc +0 -0
- data/js/foundation/geom/rect/rect.js +610 -0
- data/js/foundation/json_renderer/js.inc +0 -0
- data/js/foundation/json_renderer/json_renderer.js +231 -0
- data/js/foundation/system/js.inc +0 -0
- data/js/foundation/system/system.js +369 -0
- data/js/foundation/thememanager/js.inc +0 -0
- data/js/foundation/thememanager/thememanager.js +387 -0
- data/js/foundation/view/js.inc +0 -0
- data/js/foundation/view/markupview/js.inc +0 -0
- data/js/foundation/view/markupview/markupview.js +113 -0
- data/js/foundation/view/morphanimation/js.inc +0 -0
- data/js/foundation/view/morphanimation/morphanimation.js +236 -0
- data/js/foundation/view/view.js +1804 -0
- data/js/foundation/view/viewdefaults/js.inc +0 -0
- data/js/foundation/view/viewdefaults/viewdefaults.js +25 -0
- data/js/views/centerview/centerview.js +45 -0
- data/js/views/centerview/js.inc +0 -0
- data/js/views/inlineview/inlineview.js +14 -0
- data/js/views/inlineview/js.inc +0 -0
- data/js/views/scrollview/js.inc +0 -0
- data/js/views/scrollview/scrollview.js +39 -0
- data/lib/conf/default.rb +220 -0
- data/lib/conf/wizard.rb +303 -0
- data/lib/daemon/daemon.rb +293 -0
- data/lib/http/broker.rb +102 -0
- data/lib/http/rackup.rb +88 -0
- data/lib/http/request.rb +69 -0
- data/lib/http/response.rb +63 -0
- data/lib/plugins/gui_plugin.rb +129 -0
- data/lib/plugins/guiparser.rb +114 -0
- data/lib/plugins/plugin.rb +652 -0
- data/lib/plugins/plugin_plugins.rb +47 -0
- data/lib/plugins/plugin_sqlite_db.rb +72 -0
- data/lib/plugins/plugin_util.rb +96 -0
- data/lib/plugins/pluginmanager.rb +517 -0
- data/lib/plugins/servlet.rb +69 -0
- data/lib/session/msg.rb +291 -0
- data/lib/session/sessionmanager.rb +491 -0
- data/lib/session/sessionstorage.rb +314 -0
- data/lib/transporter/transporter.rb +254 -0
- data/lib/util/gzstring.rb +5 -0
- data/lib/values/hvalue.rb +323 -0
- data/lib/values/valuemanager.rb +152 -0
- data/plugins/client_pkg/client_pkg.rb +186 -0
- data/plugins/client_pkg/info.yaml +25 -0
- data/plugins/client_pkg/lib/client_pkg_build.rb +569 -0
- data/plugins/client_pkg/lib/client_pkg_cache.rb +50 -0
- data/plugins/client_pkg/lib/client_pkg_serve.rb +210 -0
- data/plugins/client_pkg/log/build_log +0 -0
- data/plugins/index_html/img/loading.gif +0 -0
- data/plugins/index_html/img/riassence.gif +0 -0
- data/plugins/index_html/index_html.rb +150 -0
- data/plugins/index_html/tmpl/index.html +22 -0
- data/plugins/index_html/tmpl/startup_index.html +29 -0
- data/plugins/legacy/disabled +0 -0
- data/plugins/legacy/disabled- +0 -0
- data/plugins/legacy/info.yaml +22 -0
- data/plugins/legacy/legacy.rb +15 -0
- data/plugins/main/js/riassence_ns.js +87 -0
- data/plugins/main/main.rb +234 -0
- data/plugins/main/values.yaml +8 -0
- data/plugins/ticketservices/lib/common.rb +300 -0
- data/plugins/ticketservices/lib/favicon.rb +38 -0
- data/plugins/ticketservices/lib/file.rb +58 -0
- data/plugins/ticketservices/lib/img.rb +50 -0
- data/plugins/ticketservices/lib/objblob.rb +66 -0
- data/plugins/ticketservices/lib/rsrc.rb +34 -0
- data/plugins/ticketservices/lib/upload.rb +206 -0
- data/plugins/ticketservices/ticketservices.rb +268 -0
- data/var/db/.git_include +0 -0
- data/var/log/.git_include +0 -0
- data/var/run/.git_include +0 -0
- metadata +390 -0
File without changes
|
@@ -0,0 +1,51 @@
|
|
1
|
+
/* Riassence Framework
|
2
|
+
* Copyright 2009 Riassence Inc.
|
3
|
+
* http://riassence.com/
|
4
|
+
*
|
5
|
+
* You should have received a copy of the GNU General Public License along
|
6
|
+
* with this software package. If not, contact licensing@riassence.com
|
7
|
+
*/
|
8
|
+
|
9
|
+
/*** = Description
|
10
|
+
** COMM.Session is the session key manager.
|
11
|
+
**
|
12
|
+
** COMM.Session is used by COMM.Transporter to generate key hashes for
|
13
|
+
** the session management of COMM.Transporter's keys.
|
14
|
+
**
|
15
|
+
** The server expects this exact algorithm and refuses to serve unless
|
16
|
+
** the SHA1 hash sum of the keys matches.
|
17
|
+
**
|
18
|
+
** Uses a +SHAClass+ instance for generation.
|
19
|
+
**
|
20
|
+
** +COMM.Queue+ runs as a single instance, dan't try to reconstruct it.
|
21
|
+
***/
|
22
|
+
COMM.Session = HClass.extend({
|
23
|
+
|
24
|
+
/** The constructor takes no arguments.
|
25
|
+
**/
|
26
|
+
constructor: function(){
|
27
|
+
var _this = this;
|
28
|
+
_this.sha = SHAClass.nu(8);
|
29
|
+
_this.sha_key = _this.sha.hexSHA1(((new Date().getTime())*Math.random()*1000).toString());
|
30
|
+
_this.ses_key = '0:.o.:'+_this.sha_key;
|
31
|
+
_this.req_num = 0;
|
32
|
+
},
|
33
|
+
|
34
|
+
/** = Description
|
35
|
+
* Generates a new SHA1 sum using a combination of
|
36
|
+
* the previous sum and the +_newKey+ given.
|
37
|
+
*
|
38
|
+
* Sets +self.ses_key+ and +self.sha_key+
|
39
|
+
*
|
40
|
+
* = Parameters:
|
41
|
+
* +_newKey+:: A key set by the server.
|
42
|
+
*
|
43
|
+
**/
|
44
|
+
newKey: function(_sesKey){
|
45
|
+
var _this = this,
|
46
|
+
_shaKey = _this.sha.hexSHA1(_sesKey+_this.sha_key);
|
47
|
+
_this.req_num++;
|
48
|
+
_this.ses_key = _this.req_num+':.o.:'+_shaKey;
|
49
|
+
_this.sha_key = _shaKey;
|
50
|
+
}
|
51
|
+
}).nu();
|
File without changes
|
@@ -0,0 +1,43 @@
|
|
1
|
+
/* Riassence Framework
|
2
|
+
* Copyright 2009 Riassence Inc.
|
3
|
+
* http://riassence.com/
|
4
|
+
*
|
5
|
+
* You should have received a copy of the GNU General Public License along
|
6
|
+
* with this software package. If not, contact licensing@riassence.com
|
7
|
+
*/
|
8
|
+
|
9
|
+
|
10
|
+
/*** = Description
|
11
|
+
** The single instance of this class is constructed after the first
|
12
|
+
** handshake request with the server by the 'main' plugin.
|
13
|
+
**
|
14
|
+
** It has dual functionality:
|
15
|
+
** - It tells the the client time.
|
16
|
+
** It's available as the server HValue instance
|
17
|
+
** +msg.session[:main][:client_time]+ from
|
18
|
+
** any Plugin instance.
|
19
|
+
** - It polls the server on regular intervals.
|
20
|
+
** The polling interval is defined by the server
|
21
|
+
** as the _timeoutSecs constructor parameter.
|
22
|
+
**
|
23
|
+
***/
|
24
|
+
COMM.SessionWatcher = HApplication.extend({
|
25
|
+
constructor: function( _timeoutSecs, _sesTimeoutValueId ){
|
26
|
+
|
27
|
+
// onIdle is called when HSystem's ticker count % 100 == 0
|
28
|
+
// this means it's 5 seconds with HSystemTickerInterval 50
|
29
|
+
this.base(10, 'SesWatcher');
|
30
|
+
|
31
|
+
// gets the HValue represented by
|
32
|
+
// sesTimeoutValueId (:client_time in server)
|
33
|
+
this.sesTimeoutValue = HVM.values[_sesTimeoutValueId];
|
34
|
+
this.timeoutSecs = _timeoutSecs;
|
35
|
+
},
|
36
|
+
|
37
|
+
// Tells the server the client's current time
|
38
|
+
onIdle: function(){
|
39
|
+
if((new Date().getTime() - this.sesTimeoutValue.value) > this.timeoutSecs ){
|
40
|
+
this.sesTimeoutValue.set( new Date().getTime() );
|
41
|
+
}
|
42
|
+
}
|
43
|
+
});
|
File without changes
|
@@ -0,0 +1,257 @@
|
|
1
|
+
/* Riassence Framework
|
2
|
+
* Copyright 2009 Riassence Inc.
|
3
|
+
* http://riassence.com/
|
4
|
+
*
|
5
|
+
* You should have received a copy of the GNU General Public License along
|
6
|
+
* with this software package. If not, contact licensing@riassence.com
|
7
|
+
*/
|
8
|
+
|
9
|
+
/*** = Description
|
10
|
+
** Implements the client-server interface.
|
11
|
+
**
|
12
|
+
** COMM.Transporter manages the client side of the server-client-server
|
13
|
+
** data synchronization and the server-client command channel.
|
14
|
+
**
|
15
|
+
** It uses COMM.Session for session key handling, COMM.Queue for command
|
16
|
+
** queuing and COMM.Values for data value management.
|
17
|
+
**
|
18
|
+
** COMM.Transporter operates in a fully automatic mode and starts when
|
19
|
+
** the document has been loaded.
|
20
|
+
**
|
21
|
+
** Don't call any of its methods from your code.
|
22
|
+
***/
|
23
|
+
COMM.Transporter = HApplication.extend({
|
24
|
+
|
25
|
+
/** Sets up the default settings upon construction.
|
26
|
+
**/
|
27
|
+
constructor: function(){
|
28
|
+
var _this = this;
|
29
|
+
this.serverLostMessage = 'Server Connection Lost: Reconnecting...';
|
30
|
+
_this.label = 'Transporter';
|
31
|
+
_this.url = false;
|
32
|
+
_this.busy = false;
|
33
|
+
_this.stop = true;
|
34
|
+
_this._serverInterruptView = false;
|
35
|
+
_this._clientEvalError = false;
|
36
|
+
_this._busyFlushTimeout = false;
|
37
|
+
_this.base(1);
|
38
|
+
},
|
39
|
+
|
40
|
+
/** Tries to (re)connect to the server as often as possible,
|
41
|
+
* mandated essentially by the priority of its
|
42
|
+
* HApplication instance.
|
43
|
+
**/
|
44
|
+
onIdle: function(){
|
45
|
+
this.sync();
|
46
|
+
},
|
47
|
+
|
48
|
+
/** (Re)sets the priority of itself, effects how
|
49
|
+
* frequently +onIdle+ is called.
|
50
|
+
* Usually set by the server.
|
51
|
+
**/
|
52
|
+
poll: function(_pri){
|
53
|
+
HSystem.reniceApp(this.appId,_pri);
|
54
|
+
},
|
55
|
+
|
56
|
+
/** Returns the last transaction error of itself. Used by +sync+
|
57
|
+
* to report js errors to the server.
|
58
|
+
* If no error, returns an empty string.
|
59
|
+
**/
|
60
|
+
getClientEvalError: function(){
|
61
|
+
var _this = COMM.Transporter;
|
62
|
+
return _this._clientEvalError?'&err_msg=' +
|
63
|
+
COMM.Values._encodeString(_this._clientEvalError):'';
|
64
|
+
},
|
65
|
+
|
66
|
+
/** = Description
|
67
|
+
* Handles synchronization responses.
|
68
|
+
*
|
69
|
+
* Upon a successful request, this method is called by
|
70
|
+
* the onSuccess event of the XMLHttpRequest.
|
71
|
+
*
|
72
|
+
* It splits up the response string and passes the response
|
73
|
+
* messages to COMM.Queue for execution.
|
74
|
+
*
|
75
|
+
* Parameters:
|
76
|
+
* +resp+:: The response object.
|
77
|
+
*
|
78
|
+
**/
|
79
|
+
success: function(resp){
|
80
|
+
var _this = COMM.Transporter;
|
81
|
+
if(!resp.X.responseText){
|
82
|
+
_this.failure(resp);
|
83
|
+
return;
|
84
|
+
}
|
85
|
+
var _responseArray = eval(resp.X.responseText),
|
86
|
+
i = 1,
|
87
|
+
_responseArrayLen = _responseArray.length,
|
88
|
+
_sesKey = _responseArray[0],
|
89
|
+
_session = COMM.Session,
|
90
|
+
_queue = COMM.Queue;
|
91
|
+
if(_sesKey === ''){
|
92
|
+
console.log('Invalid session, error message should follow...');
|
93
|
+
}
|
94
|
+
else {
|
95
|
+
_session.newKey(_sesKey);
|
96
|
+
}
|
97
|
+
for(;i<_responseArrayLen;i++){
|
98
|
+
try {
|
99
|
+
_queue.pushEval( _responseArray[i] );
|
100
|
+
}
|
101
|
+
catch(e) {
|
102
|
+
console.log( 'clientError:'+e+" - "+e.description+' - '+_responseArray[i]);
|
103
|
+
_this._clientEvalError = e+" - "+e.description+' - '+_responseArray[i];
|
104
|
+
}
|
105
|
+
}
|
106
|
+
if(_this._serverInterruptView){
|
107
|
+
_this._serverInterruptView.die();
|
108
|
+
_this._serverInterruptView = false;
|
109
|
+
}
|
110
|
+
_queue.push( function(){COMM.Transporter.flushBusy();} );
|
111
|
+
_queue.flush();
|
112
|
+
},
|
113
|
+
|
114
|
+
/** Sets the +busy+ flag to false and resynchronizes immediately,
|
115
|
+
* if COMM.Values contain any unsynchronized values.
|
116
|
+
**/
|
117
|
+
flushBusy: function(){
|
118
|
+
var _this = COMM.Transporter;
|
119
|
+
_this.busy = false;
|
120
|
+
COMM.Values.tosync.length !== 0 && _this.sync();
|
121
|
+
},
|
122
|
+
failMessage: function(_title,_message){
|
123
|
+
var _this = COMM.Transporter,
|
124
|
+
_queue = COMM.Queue;
|
125
|
+
console.log('failMessage?');
|
126
|
+
_this.stop = true;
|
127
|
+
_queue.push(function(){jsLoader.load('default_theme');});
|
128
|
+
_queue.push(function(){jsLoader.load('controls');});
|
129
|
+
_queue.push(function(){jsLoader.load('servermessage');});
|
130
|
+
_queue.push(function(){ReloadApp.nu(_title,_message);});
|
131
|
+
},
|
132
|
+
|
133
|
+
/** Called by the XMLHttpRequest, when there was a failure in communication.
|
134
|
+
**/
|
135
|
+
failure: function(_resp){
|
136
|
+
var _this = COMM.Transporter;
|
137
|
+
// server didn't respond, likely network issue.. retry.
|
138
|
+
if(_resp.X.status===0){
|
139
|
+
console.log(_this.serverLostMessage);
|
140
|
+
if(!_this._serverInterruptView){
|
141
|
+
_this._serverInterruptView = HView.extend({
|
142
|
+
_setFailedResp: function(_resp){
|
143
|
+
if(_resp!==undefined){
|
144
|
+
this._failedResp = _resp;
|
145
|
+
}
|
146
|
+
this._errorIndex++;
|
147
|
+
return this;
|
148
|
+
},
|
149
|
+
_retry: function(){
|
150
|
+
this._retryIndex++;
|
151
|
+
var _resp = this._failedResp;
|
152
|
+
COMM.request(
|
153
|
+
_resp.url,
|
154
|
+
_resp.options
|
155
|
+
);
|
156
|
+
},
|
157
|
+
onIdle: function(){
|
158
|
+
var _currentDate = new Date().getTime();
|
159
|
+
this.bringToFront();
|
160
|
+
if( this._errorIndex > 0 &&
|
161
|
+
(this._retryIndex !== this._errorIndex) &&
|
162
|
+
(this._lastError + 2000 < _currentDate) &&
|
163
|
+
this._failedResp ){
|
164
|
+
this._lastError = _currentDate;
|
165
|
+
this._retry();
|
166
|
+
}
|
167
|
+
this.base();
|
168
|
+
},
|
169
|
+
_errorIndex: 0,
|
170
|
+
_retryIndex: 0,
|
171
|
+
_lastError: new Date().getTime(),
|
172
|
+
die: function(){
|
173
|
+
var _app = this.app;
|
174
|
+
HSystem.reniceApp(_app.appId,this._origPriority);
|
175
|
+
this.base();
|
176
|
+
_app.sync();
|
177
|
+
},
|
178
|
+
drawSubviews: function(){
|
179
|
+
var _style = [
|
180
|
+
['padding-left', '8px'],
|
181
|
+
['background-color', '#600'],
|
182
|
+
['text-align','center'],
|
183
|
+
['color', '#fff'],
|
184
|
+
['font-size', '16px'],
|
185
|
+
['opacity', 0.85]
|
186
|
+
], i = 0;
|
187
|
+
for( ; i<_style.length; i++ ){
|
188
|
+
this.setStyle( _style[i][0], _style[i][1] );
|
189
|
+
}
|
190
|
+
this.setHTML(this.app.serverLostMessage);
|
191
|
+
this._origPriority = HSystem.appPriorities[this.appId];
|
192
|
+
if(HSystem.appPriorities[this.appId]<10){
|
193
|
+
HSystem.reniceApp(this.appId,10);
|
194
|
+
}
|
195
|
+
this._anim = HView.extend({
|
196
|
+
_animIndex: 0,
|
197
|
+
_anim: function(){
|
198
|
+
var _targetRect,
|
199
|
+
_width = ELEM.getSize(this.parent.elemId)[0];
|
200
|
+
this._animIndex++;
|
201
|
+
if(this._animIndex%2===0){
|
202
|
+
_targetRect = HRect.nu(0,0,80,20);
|
203
|
+
}
|
204
|
+
else {
|
205
|
+
_targetRect = HRect.nu(_width-80,0,_width,20);
|
206
|
+
}
|
207
|
+
this.animateTo(_targetRect,2000);
|
208
|
+
},
|
209
|
+
onAnimationEnd: function(){
|
210
|
+
if(this.drawn){
|
211
|
+
this._anim();
|
212
|
+
}
|
213
|
+
}
|
214
|
+
}
|
215
|
+
).nu( [0,0,80,20], this ).setStyle('background-color','#fff').setStyle('opacity',0.8)._anim();
|
216
|
+
}
|
217
|
+
}).nu([0,0,200,20,0,null],_this)._setFailedResp(_resp);
|
218
|
+
}
|
219
|
+
else {
|
220
|
+
_this._serverInterruptView._setFailedResp();
|
221
|
+
}
|
222
|
+
}
|
223
|
+
else {
|
224
|
+
_this.failMessage('Transporter Error','Transporter was unable to complete the synchronization request.');
|
225
|
+
}
|
226
|
+
},
|
227
|
+
|
228
|
+
/** Starts requests.
|
229
|
+
**/
|
230
|
+
sync: function(){
|
231
|
+
if(this.stop){
|
232
|
+
// console.log('sync stop');
|
233
|
+
return;
|
234
|
+
}
|
235
|
+
if(this.busy){
|
236
|
+
// console.log('sync busy');
|
237
|
+
return;
|
238
|
+
}
|
239
|
+
// console.log('sync.');
|
240
|
+
this.busy = true;
|
241
|
+
var _this = this,
|
242
|
+
_values = COMM.Values.sync(),
|
243
|
+
_sesKey = 'ses_key='+COMM.Session.ses_key,
|
244
|
+
_errorMessage = _this.getClientEvalError(),
|
245
|
+
_body = [_sesKey,_errorMessage,_values?'&values='+_values:''].join('');
|
246
|
+
COMM.request(
|
247
|
+
_this.url, {
|
248
|
+
_this: _this,
|
249
|
+
onSuccess: COMM.Transporter.success,
|
250
|
+
onFailure: COMM.Transporter.failure,
|
251
|
+
method: 'POST',
|
252
|
+
async: true,
|
253
|
+
body: _body
|
254
|
+
}
|
255
|
+
);
|
256
|
+
}
|
257
|
+
}).nu();
|
File without changes
|
@@ -0,0 +1,148 @@
|
|
1
|
+
/* Riassence Framework
|
2
|
+
* Copyright 2009 Riassence Inc.
|
3
|
+
* http://riassence.com/
|
4
|
+
*
|
5
|
+
* You should have received a copy of the GNU General Public License along
|
6
|
+
* with this software package. If not, contact licensing@riassence.com
|
7
|
+
*/
|
8
|
+
|
9
|
+
/*** = Description
|
10
|
+
** This application registers url responders to hide/show
|
11
|
+
** certain views automatically whenever the anchor
|
12
|
+
** part of the url is changed.
|
13
|
+
**
|
14
|
+
** It is bound to the server HValue instance
|
15
|
+
** +msg.session[:main][:location_href]+ by
|
16
|
+
** the 'main' plugin. By default it runs with
|
17
|
+
** a client-side-only HValue instance until then.
|
18
|
+
**
|
19
|
+
***/
|
20
|
+
COMM.URLResponder = HApplication.extend({
|
21
|
+
constructor: function(){
|
22
|
+
this.urlMatchers = [];
|
23
|
+
this.urlCallBacks = [];
|
24
|
+
this.defaultCallBacks = [];
|
25
|
+
this.prevCallBacks = [];
|
26
|
+
this.prevMatchStrs = [];
|
27
|
+
this.base(1, 'URLResponder');
|
28
|
+
this.value = 0;
|
29
|
+
},
|
30
|
+
|
31
|
+
// sets the view to show when there is
|
32
|
+
// no matches (like a virtual 404)
|
33
|
+
setDefaultResponder: function(_callBack){
|
34
|
+
this.defaultCallBacks = [ _callBack ];
|
35
|
+
this.refresh();
|
36
|
+
},
|
37
|
+
|
38
|
+
addDefaultResponder: function(_callBack){
|
39
|
+
this.defaultCallBacks.push( _callBack );
|
40
|
+
this.refresh();
|
41
|
+
},
|
42
|
+
|
43
|
+
delDefaultResponder: function(_callBack){
|
44
|
+
this.defaultCallBacks.splice(this.defaultCallbacks.indexOf(_callBack),1);
|
45
|
+
this.refresh();
|
46
|
+
},
|
47
|
+
|
48
|
+
// Removes responder
|
49
|
+
// - matchStr is an url that the callBack will
|
50
|
+
// respond to
|
51
|
+
// - callBack is the component registered
|
52
|
+
delResponder: function(_matchStr,_callBack){
|
53
|
+
_callBack.hide();
|
54
|
+
if(this.prevCallBacks.indexOf(_callBack) !== -1){
|
55
|
+
this.prevCallBacks.splice(this.prevCallBacks.indexOf(_callBack),1);
|
56
|
+
this.prevMatchStrs.splice(this.prevMatchStrs.indexOf(_matchStr),1);
|
57
|
+
}
|
58
|
+
var i=0, _urlMatch, _urlCallBack;
|
59
|
+
for(;i<this.urlMatchers.length;i++){
|
60
|
+
_urlMatch = this.urlMatchers[i].test(_matchStr);
|
61
|
+
if(_urlMatch){
|
62
|
+
this.urlMatchers.splice(i,1);
|
63
|
+
this.urlCallBacks.splice(i,1);
|
64
|
+
return 1;
|
65
|
+
}
|
66
|
+
}
|
67
|
+
this.refresh();
|
68
|
+
return 0;
|
69
|
+
},
|
70
|
+
|
71
|
+
// Adds responder
|
72
|
+
// - matchRegExp is the regular expression
|
73
|
+
// that matches the anchor part of the uri
|
74
|
+
// - callBack is the component that will receive hide/show calls
|
75
|
+
// - activate is a flag that tells the view to be immediately
|
76
|
+
// activate (and the previous one to deactivate)
|
77
|
+
addResponder: function(_matchRegExp,_callBack,_activate){
|
78
|
+
this.urlMatchers.push(new RegExp(_matchRegExp));
|
79
|
+
this.urlCallBacks.push(_callBack);
|
80
|
+
this.checkMatch(this.value);
|
81
|
+
if(_activate!==undefined){
|
82
|
+
window.location.href=_activate;
|
83
|
+
}
|
84
|
+
this.refresh();
|
85
|
+
},
|
86
|
+
|
87
|
+
// Checks the matchStr agains regular expressions
|
88
|
+
checkMatch: function(_matchStr){
|
89
|
+
if(this.prevMatchStrs.indexOf( _matchStr ) !== -1 ){
|
90
|
+
return 0;
|
91
|
+
}
|
92
|
+
var i=0, _urlMatch, _urlCallBacks=[], _urlCallBack;
|
93
|
+
for(;i<this.urlMatchers.length;i++){
|
94
|
+
_urlMatch = this.urlMatchers[i].test(_matchStr);
|
95
|
+
if(_urlMatch){
|
96
|
+
_urlCallBacks.push(this.urlCallBacks[i]);
|
97
|
+
}
|
98
|
+
}
|
99
|
+
if(_urlCallBacks.length !== 0){
|
100
|
+
for(i=0;i<_urlCallBacks.length;i++){
|
101
|
+
_urlCallBack = _urlCallBacks[i];
|
102
|
+
_urlCallBack.show();
|
103
|
+
if(this.prevMatchStrs.indexOf(_matchStr)!==-1){
|
104
|
+
this.prevMatchStrs.push( _matchStr );
|
105
|
+
}
|
106
|
+
}
|
107
|
+
var _prevCallBack;
|
108
|
+
for(i=0;i<this.prevCallBacks.length;i++){
|
109
|
+
_prevCallBack = this.prevCallBacks[i];
|
110
|
+
if(_urlCallBacks.indexOf(_prevCallBack) === -1){
|
111
|
+
this.prevCallBacks[i].hide();
|
112
|
+
}
|
113
|
+
}
|
114
|
+
this.prevCallBacks = _urlCallBacks;
|
115
|
+
return 1;
|
116
|
+
}
|
117
|
+
if(this.defaultCallBacks.length !== 0){
|
118
|
+
if(this.prevCallBacks.length !== 0){
|
119
|
+
for(i=0;i<this.prevCallBacks.length;i++){
|
120
|
+
this.prevCallBacks[i].hide();
|
121
|
+
}
|
122
|
+
}
|
123
|
+
this.prevCallBacks = [];
|
124
|
+
for(i=0;i<this.defaultCallBacks.length;i++){
|
125
|
+
this.defaultCallBacks[i].show();
|
126
|
+
this.prevCallBacks.push( this.defaultCallBacks[i] );
|
127
|
+
}
|
128
|
+
}
|
129
|
+
return -1;
|
130
|
+
},
|
131
|
+
|
132
|
+
refresh: function(){
|
133
|
+
var _value = this.value;
|
134
|
+
if(_value.length === 0){ return; }
|
135
|
+
if(window.location.href !== _value){
|
136
|
+
window.location.href = _value;
|
137
|
+
}
|
138
|
+
this.checkMatch( _value );
|
139
|
+
},
|
140
|
+
|
141
|
+
onIdle: function(){
|
142
|
+
if(!this['valueObj']){return;}
|
143
|
+
var _href = window.location.href;
|
144
|
+
if(_href!==this.value){
|
145
|
+
this.setValue(_href);
|
146
|
+
}
|
147
|
+
}
|
148
|
+
});
|