rsence-pre 2.1.0.1.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.yardopts +10 -0
- data/INSTALL.rdoc +330 -0
- data/LICENSE.txt +622 -0
- data/README.rdoc +98 -0
- data/VERSION +1 -0
- data/bin/rsence +25 -0
- data/bin/rsence-pre +25 -0
- data/conf/default_conf.yaml +346 -0
- data/conf/default_strings.yaml +76 -0
- data/conf/rsence_command_strings.yaml +444 -0
- data/docs/ExampleGuiPlugin.rdoc +193 -0
- data/docs/JavascriptBundles.rdoc +0 -0
- data/docs/PluginBundleInfo.rdoc +173 -0
- data/docs/PluginBundles.rdoc +96 -0
- data/docs/Values.rdoc +163 -0
- data/js/comm/autosync/autosync.js +17 -0
- data/js/comm/autosync/js.inc +0 -0
- data/js/comm/comm.js +203 -0
- data/js/comm/js.inc +0 -0
- data/js/comm/jsloader/js.inc +0 -0
- data/js/comm/jsloader/jsloader.js +112 -0
- data/js/comm/queue/js.inc +0 -0
- data/js/comm/queue/queue.js +184 -0
- data/js/comm/session/js.inc +0 -0
- data/js/comm/session/session.js +52 -0
- data/js/comm/sessionwatcher/js.inc +0 -0
- data/js/comm/sessionwatcher/sessionwatcher.js +44 -0
- data/js/comm/transporter/js.inc +0 -0
- data/js/comm/transporter/transporter.js +261 -0
- data/js/comm/urlresponder/js.inc +0 -0
- data/js/comm/urlresponder/urlresponder.js +149 -0
- data/js/comm/values/js.inc +0 -0
- data/js/comm/values/values.js +433 -0
- data/js/controls/button/button.js +72 -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 +49 -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/dialogs/alert_sheet/alert_sheet.js +63 -0
- data/js/controls/dialogs/alert_sheet/js.inc +0 -0
- data/js/controls/dialogs/confirm_sheet/confirm_sheet.js +37 -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 +84 -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 +109 -0
- data/js/controls/imageview/js.inc +0 -0
- data/js/controls/imageview/themes/default/blank.gif +0 -0
- data/js/controls/passwordcontrol/js.inc +0 -0
- data/js/controls/passwordcontrol/passwordcontrol.js +23 -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 +40 -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 +44 -0
- data/js/controls/radiobutton/js.inc +0 -0
- data/js/controls/radiobutton/radiobutton.js +43 -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 +357 -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 +41 -0
- data/js/controls/stepper/js.inc +0 -0
- data/js/controls/stepper/stepper.js +213 -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 +280 -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 +24 -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 +374 -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 +154 -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 +62 -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 +286 -0
- data/js/core/class/class.js +318 -0
- data/js/core/class/js.inc +0 -0
- data/js/core/elem/elem.js +1383 -0
- data/js/core/elem/js.inc +0 -0
- data/js/core/event/event.js +153 -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/core/rsence_ns/js.inc +0 -0
- data/js/core/rsence_ns/rsence_ns.js +21 -0
- data/js/datetime/calendar/calendar.js +198 -0
- data/js/datetime/calendar/js.inc +0 -0
- data/js/datetime/calendar/themes/default/calendar.css +108 -0
- data/js/datetime/calendar/themes/default/calendar.html +9 -0
- data/js/datetime/calendar/themes/default/calendar_arrows-ie6.gif +0 -0
- data/js/datetime/calendar/themes/default/calendar_arrows.png +0 -0
- data/js/datetime/datetimevalue/datetimevalue.js +247 -0
- data/js/datetime/datetimevalue/js.inc +0 -0
- data/js/datetime/timesheet/js.inc +0 -0
- data/js/datetime/timesheet/themes/default/timesheet.css +30 -0
- data/js/datetime/timesheet/themes/default/timesheet.html +2 -0
- data/js/datetime/timesheet/timesheet.js +183 -0
- data/js/datetime/timesheet_item/js.inc +0 -0
- data/js/datetime/timesheet_item/themes/default/timesheet_item.css +42 -0
- data/js/datetime/timesheet_item/themes/default/timesheet_item.html +8 -0
- data/js/datetime/timesheet_item/timesheet_item.js +248 -0
- data/js/datetime/timesheet_item_edit/js.inc +0 -0
- data/js/datetime/timesheet_item_edit/timesheet_item_edit.js +274 -0
- data/js/foundation/application/application.js +208 -0
- data/js/foundation/application/js.inc +0 -0
- data/js/foundation/control/control.js +339 -0
- data/js/foundation/control/controldefaults/controldefaults.js +56 -0
- data/js/foundation/control/controldefaults/js.inc +0 -0
- data/js/foundation/control/dummyvalue/dummyvalue.js +51 -0
- data/js/foundation/control/dummyvalue/js.inc +0 -0
- data/js/foundation/control/dyncontrol/dyncontrol.js +500 -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 +750 -0
- data/js/foundation/control/eventresponder/js.inc +0 -0
- data/js/foundation/control/js.inc +0 -0
- data/js/foundation/control/valuematrix/js.inc +0 -0
- data/js/foundation/control/valuematrix/valuematrix.js +135 -0
- data/js/foundation/control/valueresponder/js.inc +0 -0
- data/js/foundation/control/valueresponder/valueresponder.js +79 -0
- data/js/foundation/eventmanager/eventmanager.js +991 -0
- data/js/foundation/eventmanager/js.inc +0 -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 +651 -0
- data/js/foundation/json_renderer/js.inc +0 -0
- data/js/foundation/json_renderer/json_renderer.js +246 -0
- data/js/foundation/system/js.inc +0 -0
- data/js/foundation/system/system.js +381 -0
- data/js/foundation/thememanager/js.inc +0 -0
- data/js/foundation/thememanager/thememanager.js +393 -0
- data/js/foundation/value/js.inc +0 -0
- data/js/foundation/value/value.js +183 -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 +114 -0
- data/js/foundation/view/morphanimation/js.inc +0 -0
- data/js/foundation/view/morphanimation/morphanimation.js +237 -0
- data/js/foundation/view/view.js +1812 -0
- data/js/foundation/view/viewdefaults/js.inc +0 -0
- data/js/foundation/view/viewdefaults/viewdefaults.js +26 -0
- data/js/lists/checkboxlist/checkboxlist.js +171 -0
- data/js/lists/checkboxlist/js.inc +0 -0
- data/js/lists/listitems/js.inc +0 -0
- data/js/lists/listitems/listitems.js +88 -0
- data/js/lists/propertylist/js.inc +0 -0
- data/js/lists/propertylist/propertylist.js +326 -0
- data/js/lists/radiobuttonlist/js.inc +0 -0
- data/js/lists/radiobuttonlist/radiobuttonlist.js +116 -0
- data/js/util/reloadapp/js.inc +0 -0
- data/js/util/reloadapp/reloadapp.js +152 -0
- data/js/util/reloadapp/themes/default/reloadapp_warning-ie6.gif +0 -0
- data/js/util/reloadapp/themes/default/reloadapp_warning.png +0 -0
- data/js/util/sha/js.inc +0 -0
- data/js/util/sha/sha.js +426 -0
- data/js/views/centerview/centerview.js +75 -0
- data/js/views/centerview/js.inc +0 -0
- data/js/views/inlineview/inlineview.js +15 -0
- data/js/views/inlineview/js.inc +0 -0
- data/js/views/scrollview/js.inc +0 -0
- data/js/views/scrollview/scrollview.js +40 -0
- data/lib/conf/argv.rb +850 -0
- data/lib/conf/default.rb +219 -0
- data/lib/daemon/daemon.rb +387 -0
- data/lib/daemon/sigcomm.rb +64 -0
- data/lib/http/broker.rb +150 -0
- data/lib/http/rackup.rb +91 -0
- data/lib/http/request.rb +66 -0
- data/lib/http/response.rb +65 -0
- data/lib/plugins/dependencies.rb +285 -0
- data/lib/plugins/gui_plugin.rb +160 -0
- data/lib/plugins/guiparser.rb +123 -0
- data/lib/plugins/plugin.rb +438 -0
- data/lib/plugins/plugin_base.rb +162 -0
- data/lib/plugins/plugin_plugins.rb +81 -0
- data/lib/plugins/plugin_sqlite_db.rb +98 -0
- data/lib/plugins/pluginmanager.rb +635 -0
- data/lib/plugins/plugins.rb +169 -0
- data/lib/plugins/servlet.rb +108 -0
- data/lib/rsence.rb +32 -0
- data/lib/session/msg.rb +327 -0
- data/lib/session/sessionmanager.rb +522 -0
- data/lib/session/sessionstorage.rb +340 -0
- data/lib/transporter/transporter.rb +263 -0
- data/lib/util/gzstring.rb +9 -0
- data/lib/util/ruby19_fixes.rb +18 -0
- data/lib/values/hvalue.rb +378 -0
- data/lib/values/valuemanager.rb +172 -0
- data/plugins/client_pkg/client_pkg.rb +157 -0
- data/plugins/client_pkg/info.yaml +25 -0
- data/plugins/client_pkg/lib/client_pkg_build.rb +561 -0
- data/plugins/client_pkg/lib/client_pkg_cache.rb +50 -0
- data/plugins/client_pkg/lib/client_pkg_serve.rb +218 -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 +120 -0
- data/plugins/index_html/info.yaml +18 -0
- data/plugins/index_html/tmpl/index.html +15 -0
- data/plugins/main/info.yaml +18 -0
- data/plugins/main/js/main.js +84 -0
- data/plugins/main/main.rb +255 -0
- data/plugins/main/values.yaml +8 -0
- data/plugins/ticket/info.yaml +21 -0
- data/plugins/ticket/lib/common.rb +392 -0
- data/plugins/ticket/lib/favicon.rb +39 -0
- data/plugins/ticket/lib/file.rb +58 -0
- data/plugins/ticket/lib/img.rb +50 -0
- data/plugins/ticket/lib/objblob.rb +66 -0
- data/plugins/ticket/lib/rsrc.rb +34 -0
- data/plugins/ticket/lib/upload.rb +236 -0
- data/plugins/ticket/ticket.rb +333 -0
- data/setup/welcome/gui/welcome.yaml +92 -0
- data/setup/welcome/info.yaml +13 -0
- data/setup/welcome/text/welcome.html +9 -0
- data/setup/welcome/values.yaml +9 -0
- data/setup/welcome/welcome.rb +54 -0
- metadata +407 -0
@@ -0,0 +1,393 @@
|
|
1
|
+
/* RSence
|
2
|
+
* Copyright 2006 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
|
+
/** The default path where to look for themes.
|
10
|
+
**/
|
11
|
+
var//RSence.Foundation
|
12
|
+
HDefaultThemePath = '/H/themes';
|
13
|
+
|
14
|
+
|
15
|
+
/** Name of the default theme.
|
16
|
+
**/
|
17
|
+
var//RSence.Foundation
|
18
|
+
HDefaultThemeName = 'default';
|
19
|
+
|
20
|
+
/** List of themes without component-specific theme files.
|
21
|
+
**/
|
22
|
+
var//RSence.Foundation
|
23
|
+
HNoComponentCSS = [];
|
24
|
+
|
25
|
+
/** List of themes without a common.css file to load.
|
26
|
+
**/
|
27
|
+
var//RSence.Foundation
|
28
|
+
HNoCommonCSS = [];
|
29
|
+
|
30
|
+
/** List of IE6-savvy themes.
|
31
|
+
**/
|
32
|
+
var//RSence.Foundation
|
33
|
+
HThemeHasIE6GifsInsteadOfPng = ['default'];
|
34
|
+
|
35
|
+
/*** = Description
|
36
|
+
** A single instance class.
|
37
|
+
** The theme manager knows the name of the currently loaded theme and handles
|
38
|
+
** the loading of theme specific markup snippets and style declarations.
|
39
|
+
**
|
40
|
+
** = Instance variables
|
41
|
+
** +themePath+:: Default root path of the themes path, should contain
|
42
|
+
** at least the default theme.
|
43
|
+
** +currentTheme+:: The name of the theme currently in use. Initially the
|
44
|
+
** default unnamed theme is used.
|
45
|
+
**
|
46
|
+
***/
|
47
|
+
var//RSence.Foundation
|
48
|
+
HThemeManager = HClass.extend({
|
49
|
+
|
50
|
+
constructor: null,
|
51
|
+
|
52
|
+
init: function(){
|
53
|
+
this.themePath = HDefaultThemePath;
|
54
|
+
this._tmplCache = {};
|
55
|
+
this._cssCache = {};
|
56
|
+
this.currentTheme = HDefaultThemeName;
|
57
|
+
},
|
58
|
+
|
59
|
+
setThemePath: function( _path ){
|
60
|
+
this.themePath = _path;
|
61
|
+
},
|
62
|
+
|
63
|
+
// Error messages, should be refined.
|
64
|
+
_errTemplateNotFound: function( _url ) {
|
65
|
+
console.log( "ERROR: Template Not Found: '" + _url + "' ");
|
66
|
+
},
|
67
|
+
_errTemplateFailure: function( _url ) {
|
68
|
+
console.log( "ERROR: Template Failure: '" + _url + "' ");
|
69
|
+
},
|
70
|
+
_errTemplateException: function( _url ) {
|
71
|
+
console.log( "ERROR: Template Exception: '" + _url + "' ");
|
72
|
+
},
|
73
|
+
|
74
|
+
/** = Description
|
75
|
+
* Loads a template file and returns its contents.
|
76
|
+
* If errors occurred, calls the error management functions.
|
77
|
+
*
|
78
|
+
* = Parameters
|
79
|
+
* +_url+:: A valid local file path or http url pointing to the
|
80
|
+
* resource to load.
|
81
|
+
* +_contentType+:: An optional parameter, specifies the content type wanted,
|
82
|
+
* defaults to text/html.
|
83
|
+
*
|
84
|
+
* = Returns
|
85
|
+
* The contents of the path.
|
86
|
+
**/
|
87
|
+
fetch: function( _url, _contentType, _callBack, _async ) {
|
88
|
+
var _callBackFun;
|
89
|
+
if( !_contentType ){
|
90
|
+
_contentType = 'text/html; charset=UTF-8';
|
91
|
+
}
|
92
|
+
if(_async){
|
93
|
+
_callBackFun = function( resp ){
|
94
|
+
_callBack( resp.X.responseText );
|
95
|
+
};
|
96
|
+
}
|
97
|
+
else{
|
98
|
+
// console.log('WARNING: Fetching synchronously using HThemeManager is not recommended. Use pre-packaged themes instead.');
|
99
|
+
var _respText;
|
100
|
+
_callBackFun = function( resp ){
|
101
|
+
_respText = resp.X.responseText;
|
102
|
+
};
|
103
|
+
}
|
104
|
+
COMM.request(
|
105
|
+
_url, {
|
106
|
+
onSuccess: _callBackFun,
|
107
|
+
on404: function(resp){ HThemeManager._errTemplateNotFound( resp.url ); },
|
108
|
+
onFailure: function(resp){ HThemeManager._errTemplateFailure( resp.url ); },
|
109
|
+
onException: function(resp){ HThemeManager._errTemplateException( resp.url ); },
|
110
|
+
method: 'GET',
|
111
|
+
async: _async
|
112
|
+
}
|
113
|
+
);
|
114
|
+
if(!_async){
|
115
|
+
return _respText;
|
116
|
+
}
|
117
|
+
},
|
118
|
+
|
119
|
+
|
120
|
+
/** Returns the theme/component -specific path, called from inside css
|
121
|
+
* themes, a bit kludgy approach to tell the theme graphics file paths.
|
122
|
+
**/
|
123
|
+
getThemeGfxPath: function() {
|
124
|
+
var _themeName = this._cssEvalParams[0],
|
125
|
+
_componentName = this._cssEvalParams[1],
|
126
|
+
_themePath = this._cssEvalParams[2],
|
127
|
+
_urlPrefix = this._urlPrefix( _themeName, _componentName, _themePath );
|
128
|
+
return this._joinPath( _urlPrefix, 'gfx' );
|
129
|
+
},
|
130
|
+
|
131
|
+
/** = Description
|
132
|
+
* Returns the theme/component -specific graphics file path with proper css wrappers.
|
133
|
+
* Used from inside css themes, a bit kludgy approach to tell the file name path.
|
134
|
+
*
|
135
|
+
* = Parameters
|
136
|
+
* +_fileName+:: The File name to load.
|
137
|
+
*
|
138
|
+
**/
|
139
|
+
getCssFilePath: function( _fileName ){
|
140
|
+
var _themeName = this._cssEvalParams[0];
|
141
|
+
if((HThemeHasIE6GifsInsteadOfPng.indexOf(_themeName)!==-1) && (BROWSER_TYPE.ie6 || BROWSER_TYPE.symbian) ){
|
142
|
+
return "url('"+this._joinPath( this.getThemeGfxPath(), _fileName.replace('.png','-ie6.gif') )+"')";
|
143
|
+
}
|
144
|
+
else {
|
145
|
+
return "url('"+this._joinPath( this.getThemeGfxPath(), _fileName )+"')";
|
146
|
+
}
|
147
|
+
},
|
148
|
+
|
149
|
+
/** = Description
|
150
|
+
* Loads a css file based on the given url (or file path).
|
151
|
+
* Evaluates the css data.
|
152
|
+
* Makes sure the browser uses the data for component styles.
|
153
|
+
*
|
154
|
+
* = Parameter
|
155
|
+
* +_url+:: A valid url that points to a valid css file.
|
156
|
+
*
|
157
|
+
* = Returns
|
158
|
+
* The source of the url.
|
159
|
+
*
|
160
|
+
**/
|
161
|
+
loadCSS: function( _url ) {
|
162
|
+
var _contentType = 'text/css',
|
163
|
+
_cssFun = function(_cssText){
|
164
|
+
// Don't try to do anything with empty or invalid css data:
|
165
|
+
if (!_cssText || _cssText === "") {
|
166
|
+
return;
|
167
|
+
}
|
168
|
+
HThemeManager.useCSS( _cssText );
|
169
|
+
};
|
170
|
+
this.fetch( _url, _contentType, _cssFun, true );
|
171
|
+
},
|
172
|
+
|
173
|
+
useCSS: function( _cssText ){
|
174
|
+
var _contentType = 'text/css';
|
175
|
+
// Evaluate the css text
|
176
|
+
_cssText = this._bindCSSVariables( _cssText );
|
177
|
+
|
178
|
+
var _style, _styleSheet, _head;
|
179
|
+
|
180
|
+
if(BROWSER_TYPE.ie) {
|
181
|
+
// Internet Explorer (at least 6.x; check what 7.x does)
|
182
|
+
_style = document.createStyleSheet();
|
183
|
+
_style.cssText = _cssText;
|
184
|
+
}
|
185
|
+
|
186
|
+
else {
|
187
|
+
// Common, standard <style> tag generation in <head>
|
188
|
+
_style = document.createElement( "style" );
|
189
|
+
_style.type = _contentType;
|
190
|
+
_style.media = "all";
|
191
|
+
|
192
|
+
_head = document.getElementsByTagName('head')[0];
|
193
|
+
_head.appendChild(_style);
|
194
|
+
|
195
|
+
if (BROWSER_TYPE.safari) {
|
196
|
+
// Work-around for safari
|
197
|
+
var _cssTextElement = document.createTextNode(_cssText);
|
198
|
+
_style.appendChild(_cssTextElement);
|
199
|
+
}
|
200
|
+
else {
|
201
|
+
// This works for others (add more checks, if problems with new browsers)
|
202
|
+
_style.innerHTML = _cssText;
|
203
|
+
}
|
204
|
+
}
|
205
|
+
|
206
|
+
},
|
207
|
+
|
208
|
+
_addSlash: function( _str ){
|
209
|
+
if( _str[ _str.length-1 ] !== '/' ){
|
210
|
+
_str += '/';
|
211
|
+
}
|
212
|
+
return _str;
|
213
|
+
},
|
214
|
+
|
215
|
+
_joinPath: function( _str1, _str2 ){
|
216
|
+
return this._addSlash( _str1 ) + _str2;
|
217
|
+
},
|
218
|
+
|
219
|
+
// Makes a common url prefix for template files
|
220
|
+
_urlPrefix: function( _themeName, _componentName, _themePath ) {
|
221
|
+
|
222
|
+
var _path = _themePath;
|
223
|
+
|
224
|
+
// Usually null
|
225
|
+
if( _themePath === null ) {
|
226
|
+
_path = this.themePath;
|
227
|
+
}
|
228
|
+
|
229
|
+
_path = this._joinPath( _path, _themeName );
|
230
|
+
|
231
|
+
return _path;
|
232
|
+
},
|
233
|
+
|
234
|
+
// Makes a valid css template url
|
235
|
+
_cssUrl: function( _themeName, _componentName, _themePath ) {
|
236
|
+
this._cssEvalParams = [_themeName, _componentName, _themePath];
|
237
|
+
var _cssPrefix = this._urlPrefix( _themeName, _componentName, _themePath ),
|
238
|
+
_cssSuffix = this._joinPath( 'css', _componentName+'.css' ),
|
239
|
+
_cssUrl = this._joinPath( _cssPrefix, _cssSuffix );
|
240
|
+
return _cssUrl;
|
241
|
+
},
|
242
|
+
|
243
|
+
// Makes a valid html template url
|
244
|
+
_markupUrl: function( _themeName, _componentName, _themePath ) {
|
245
|
+
var _htmlPrefix = this._urlPrefix( _themeName, _componentName, _themePath ),
|
246
|
+
_htmlSuffix = this._joinPath( 'html', _componentName+'.html' ),
|
247
|
+
_htmlUrl = this._joinPath( _htmlPrefix, _htmlSuffix );
|
248
|
+
return _htmlUrl;
|
249
|
+
},
|
250
|
+
|
251
|
+
/** = Description
|
252
|
+
* Loads HTML templates of components. Handles caching independently and
|
253
|
+
* intelligently.
|
254
|
+
*
|
255
|
+
* = Parameters
|
256
|
+
* +_themeName+:: The name of the template to use.
|
257
|
+
* +_componentName+:: The name of the component template (css/html) to load.
|
258
|
+
* +_themePath+:: Optional, parameter to override the global theme path.
|
259
|
+
*
|
260
|
+
* = Returns
|
261
|
+
* The Pre-Evaluated HTML Template.
|
262
|
+
*
|
263
|
+
**/
|
264
|
+
loadMarkup: function( _themeName, _componentName, _themePath ) {
|
265
|
+
if( !this._tmplCache[_themeName] ){
|
266
|
+
this._tmplCache[_themeName] = {};
|
267
|
+
}
|
268
|
+
var _cached = this._tmplCache[_themeName][_componentName];
|
269
|
+
|
270
|
+
if (null === _cached || undefined === _cached) {
|
271
|
+
var _markupUrl = this._markupUrl( _themeName, _componentName, _themePath ),
|
272
|
+
_markup = this.fetch( _markupUrl, null, null, false );
|
273
|
+
return this.setMarkup( _themeName, _componentName, _markup );
|
274
|
+
}
|
275
|
+
return _cached;
|
276
|
+
},
|
277
|
+
|
278
|
+
/** = Description
|
279
|
+
* Sets the html template for the theme and component name combination.
|
280
|
+
*
|
281
|
+
* = Parameters
|
282
|
+
* +_themeName+:: The name of the template to use..
|
283
|
+
* +_componentName+:: The name of the component template.
|
284
|
+
* +_markup+:: The content of the html markup.
|
285
|
+
**/
|
286
|
+
setMarkup: function( _themeName, _componentName, _markup ){
|
287
|
+
// Save an empty string to template cache to prevent repeated failing
|
288
|
+
// requests.
|
289
|
+
if (null === _markup || undefined === _markup) {
|
290
|
+
_markup = "";
|
291
|
+
}
|
292
|
+
this._tmplCache[_themeName][_componentName] = _markup;
|
293
|
+
return _markup;
|
294
|
+
},
|
295
|
+
|
296
|
+
/** = Description
|
297
|
+
* Loads CSS and HTML templates of components. Called from HView#_loadMarkup.
|
298
|
+
* Returns the HTML Template as text.
|
299
|
+
* Manages file caches independently and intelligently.
|
300
|
+
*
|
301
|
+
* = Parameters
|
302
|
+
* +_themeName+:: The name of the template to use.
|
303
|
+
* +_componentName+:: The name of the component template (css/html) to load.
|
304
|
+
* +_themePath+:: Optional, parameter to override the global theme path.
|
305
|
+
*
|
306
|
+
* = Returns
|
307
|
+
* The Pre-Evaluated HTML Template.
|
308
|
+
*
|
309
|
+
**/
|
310
|
+
getMarkup: function( _themeName, _componentName, _themePath ) {
|
311
|
+
/* Load Theme-Specific CSS: */
|
312
|
+
if(!this._cssCache[_themeName]){
|
313
|
+
this._cssCache[_themeName] = {};
|
314
|
+
if(HNoCommonCSS.indexOf(_themeName)===-1){
|
315
|
+
var _commonCssUrl = this._cssUrl( _themeName, 'common', _themePath, null );
|
316
|
+
this.loadCSS( _commonCssUrl );
|
317
|
+
}
|
318
|
+
}
|
319
|
+
|
320
|
+
/* Load Component-Specific CSS, unless configured to only load the common css: */
|
321
|
+
if(HNoComponentCSS.indexOf(_themeName)===-1){
|
322
|
+
if (!this._cssCache[_themeName][_componentName]){
|
323
|
+
var _componentCssUrl = this._cssUrl( _themeName, _componentName, _themePath );
|
324
|
+
this._cssCache[_themeName][_componentName] = true;
|
325
|
+
this.loadCSS( _componentCssUrl );
|
326
|
+
}
|
327
|
+
}
|
328
|
+
|
329
|
+
/* Load/Return Component-Specific HTML: */
|
330
|
+
return this.loadMarkup( _themeName, _componentName, _themePath );
|
331
|
+
},
|
332
|
+
|
333
|
+
|
334
|
+
_componentGfxPath: function( _themeName, _componentName, _themePath ) {
|
335
|
+
var _urlPrefix = this._urlPrefix( _themeName, _componentName, _themePath ),
|
336
|
+
_url = this._joinPath( _urlPrefix, 'gfx' );
|
337
|
+
return _url;
|
338
|
+
},
|
339
|
+
_componentGfxFile: function( _themeName, _componentName, _themePath, _fileName ){
|
340
|
+
if((HThemeHasIE6GifsInsteadOfPng.indexOf(_themeName)!==-1) && BROWSER_TYPE.ie6){
|
341
|
+
return this._joinPath( this._componentGfxPath(_themeName, _componentName, _themePath), _fileName.replace('.png','-ie6.gif') );
|
342
|
+
}
|
343
|
+
return this._joinPath( this._componentGfxPath(_themeName, _componentName, _themePath), _fileName );
|
344
|
+
},
|
345
|
+
|
346
|
+
|
347
|
+
/** = Description
|
348
|
+
* Returns the full path of the +_fileName+ given. Uses the default theme.
|
349
|
+
**/
|
350
|
+
getThemeGfxFile: function( _fileName ) {
|
351
|
+
return this.getThemeGfxPath() + _fileName;
|
352
|
+
},
|
353
|
+
|
354
|
+
|
355
|
+
/** = Description
|
356
|
+
* Sets the active theme.
|
357
|
+
*
|
358
|
+
* = Parameters
|
359
|
+
* +_theme+:: The name of the theme to be set as the active theme.
|
360
|
+
*
|
361
|
+
**/
|
362
|
+
setTheme: function(_theme) {
|
363
|
+
this.currentTheme = _theme;
|
364
|
+
},
|
365
|
+
|
366
|
+
/** Sets the default theme ( HDefaultTheme ) to be the active theme.
|
367
|
+
**/
|
368
|
+
restoreDefaultTheme: function() {
|
369
|
+
this.setTheme( HDefaultThemeName );
|
370
|
+
},
|
371
|
+
|
372
|
+
/** regexp: _variable_match
|
373
|
+
* A regular expression to match the template evaluation syntax: #{stuff_to_evaluate}
|
374
|
+
**/
|
375
|
+
_variable_match: new RegExp(/#\{([^\}]*)\}/),
|
376
|
+
|
377
|
+
/** = Description
|
378
|
+
* Evaluates the _variable_match regular expression for the string _markup.
|
379
|
+
*
|
380
|
+
* = Parameters
|
381
|
+
* +_cssTmpl+:: The css template file to be evaluated.
|
382
|
+
*
|
383
|
+
* = Returns
|
384
|
+
* An evaluated CSS Template.
|
385
|
+
**/
|
386
|
+
_bindCSSVariables: function( _cssTmpl ) {
|
387
|
+
while ( this._variable_match.test( _cssTmpl ) ) {
|
388
|
+
_cssTmpl = _cssTmpl.replace( this._variable_match, eval( RegExp.$1 ) );
|
389
|
+
}
|
390
|
+
return _cssTmpl;
|
391
|
+
}
|
392
|
+
|
393
|
+
});
|
File without changes
|
@@ -0,0 +1,183 @@
|
|
1
|
+
/* RSence
|
2
|
+
* Copyright 2006 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
|
+
** Data value synchonization container object.
|
11
|
+
**
|
12
|
+
** +HValue+ is the default class to use for data syrchronization purposes.
|
13
|
+
** It's smart enough to tell COMM.Values (Value Manager) that it has
|
14
|
+
** been changed.
|
15
|
+
**
|
16
|
+
** A single HValue instance can be bound to any number of responders, the
|
17
|
+
** main client-side responder class is +HControl+.
|
18
|
+
**
|
19
|
+
** When you change the value in one of the instances bound to the HValue
|
20
|
+
** instances, all other instances get notified too and the server is also
|
21
|
+
** notified and can be further bound on the server side to any number of
|
22
|
+
** responders there too.
|
23
|
+
**
|
24
|
+
** An instance constructed with "false" (Boolean) as its id is not reported
|
25
|
+
** to the server. Such an instance can be used for client-side responder
|
26
|
+
** synchronization.
|
27
|
+
**
|
28
|
+
** Priority-wise, only the server can create a value id. If a value id is
|
29
|
+
** created on the client, the server won't recognize nor accept it.
|
30
|
+
**
|
31
|
+
** If a value is changed on the server, it overrides the changes on
|
32
|
+
** the client, so no server-client lock is needed in this model.
|
33
|
+
**
|
34
|
+
** = Instance variables:
|
35
|
+
** +id+:: Value Id, used by the whole value management system to identify individual values.
|
36
|
+
** +type+:: '[HValue]'
|
37
|
+
** +value+:: The container/"payload" data value itself.
|
38
|
+
** +views+:: A list of Components that uses this value.
|
39
|
+
** Used for automatic value syncronization between responders.
|
40
|
+
***/
|
41
|
+
var//RSence.Foundation
|
42
|
+
HValue = HClass.extend({
|
43
|
+
|
44
|
+
/** = Description
|
45
|
+
* Constructs a value with the initial value +_value+ and the unique id +_id+.
|
46
|
+
*
|
47
|
+
* Only the server can create value id's, so use false when constructing
|
48
|
+
* from the client. A value with a false id is not reported to the server.
|
49
|
+
*
|
50
|
+
* = Parameters
|
51
|
+
* +_id+:: The source id (ideally set by server, should be unique)
|
52
|
+
* +_value+:: The initial data
|
53
|
+
*
|
54
|
+
**/
|
55
|
+
constructor: function(_id,_value){
|
56
|
+
this.id = _id;
|
57
|
+
this.value = _value;
|
58
|
+
this.views = [];
|
59
|
+
if(_id){
|
60
|
+
COMM.Values.add(_id,this);
|
61
|
+
}
|
62
|
+
},
|
63
|
+
|
64
|
+
/** Destructor method. Releases all bindings.
|
65
|
+
**/
|
66
|
+
die: function(){
|
67
|
+
for(var _viewNum=0;_viewNum<this.views.length;_viewNum++){
|
68
|
+
var _tryObj = this.views[_viewNum];
|
69
|
+
_tryObj.setValueObj( HDummyValue.nu() );
|
70
|
+
this.views.splice(_viewNum,1);
|
71
|
+
}
|
72
|
+
if(this.id){
|
73
|
+
COMM.Values.del(this.id);
|
74
|
+
}
|
75
|
+
},
|
76
|
+
|
77
|
+
/** = Description
|
78
|
+
* Replaces the data of the value.
|
79
|
+
*
|
80
|
+
* Extend this method, if you want client-side validation in the value itself.
|
81
|
+
*
|
82
|
+
* = Parameters
|
83
|
+
* +_value+:: The new data to replace the old data with.
|
84
|
+
*
|
85
|
+
**/
|
86
|
+
set: function(_value){
|
87
|
+
if(this.differs(_value)){
|
88
|
+
this.value = _value;
|
89
|
+
if(this.id){
|
90
|
+
COMM.Values.changed(this);
|
91
|
+
}
|
92
|
+
this.refresh();
|
93
|
+
}
|
94
|
+
},
|
95
|
+
|
96
|
+
/** Compares +_value+ with +self.value+.
|
97
|
+
* = Returns
|
98
|
+
* true or false, depending on the equality
|
99
|
+
**/
|
100
|
+
differs: function(_value){
|
101
|
+
return (COMM.Values.encode(_value) !== COMM.Values.encode(this.value));
|
102
|
+
},
|
103
|
+
|
104
|
+
/** = Description
|
105
|
+
* Setter for the server.
|
106
|
+
*
|
107
|
+
* Just as +self.set+, but doesn't re-notify the server about the change.
|
108
|
+
**/
|
109
|
+
s: function(_value){
|
110
|
+
this.value = _value;
|
111
|
+
this.refresh();
|
112
|
+
},
|
113
|
+
|
114
|
+
/** = Description
|
115
|
+
* Return the data, returns the +self.value+ instance variable
|
116
|
+
*
|
117
|
+
* Returns:
|
118
|
+
* The value instance variable (the data "payload")
|
119
|
+
**/
|
120
|
+
get: function(){
|
121
|
+
return this.value;
|
122
|
+
},
|
123
|
+
|
124
|
+
/** = Description
|
125
|
+
* Bind a responder to the value, use to attach HValues to responders derived from HControl.
|
126
|
+
*
|
127
|
+
* = Parameters
|
128
|
+
* +_responder+:: Any responder that is derived from HControl or any other
|
129
|
+
* class instance that implements HValueResponder or has
|
130
|
+
* compatible typing.
|
131
|
+
**/
|
132
|
+
bind: function(_responder){
|
133
|
+
if(_responder===undefined){
|
134
|
+
throw("HValueBindError: responder is undefined!");
|
135
|
+
}
|
136
|
+
if(this.views.indexOf(_responder)===-1){
|
137
|
+
this.views.push(_responder);
|
138
|
+
_responder.setValueObj( this );
|
139
|
+
}
|
140
|
+
},
|
141
|
+
|
142
|
+
/** = Description
|
143
|
+
* Release a responder bound to the HValue instance itself.
|
144
|
+
*
|
145
|
+
* = Parameters
|
146
|
+
* +_responder+:: Any responder that is derived from HControl or any other
|
147
|
+
* class instance that implements HValueResponder or has
|
148
|
+
* compatible typing.
|
149
|
+
**/
|
150
|
+
unbind: function(_responder){
|
151
|
+
for(var _viewNum=0;_viewNum<this.views.length;_viewNum++){
|
152
|
+
var _tryObj = this.views[_viewNum];
|
153
|
+
if(_tryObj===_responder){
|
154
|
+
this.views.splice(_viewNum,1);
|
155
|
+
return;
|
156
|
+
}
|
157
|
+
}
|
158
|
+
},
|
159
|
+
|
160
|
+
/** Alias of +self.unbind+, opposite of +bind+.
|
161
|
+
**/
|
162
|
+
release: function(_responder){
|
163
|
+
return this.unbind(_responder);
|
164
|
+
},
|
165
|
+
|
166
|
+
/** Calls the setValue method all responders bound to this HValue.
|
167
|
+
**/
|
168
|
+
refresh: function(){
|
169
|
+
for(var _viewNum=0;_viewNum<this.views.length;_viewNum++){
|
170
|
+
var _responder = this.views[_viewNum];
|
171
|
+
if(_responder.value !== this.value){
|
172
|
+
if(!_responder._valueIsBeingSet){
|
173
|
+
_responder._valueIsBeingSet=true;
|
174
|
+
_responder.setValue( this.value );
|
175
|
+
_responder._valueIsBeingSet=false;
|
176
|
+
}
|
177
|
+
}
|
178
|
+
}
|
179
|
+
}
|
180
|
+
|
181
|
+
});
|
182
|
+
|
183
|
+
|
File without changes
|
File without changes
|
@@ -0,0 +1,114 @@
|
|
1
|
+
/* RSence
|
2
|
+
* Copyright 2006 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
|
+
** Serves as a mixin class for classes that need to draw markup but don't
|
11
|
+
** inherit from the HView.
|
12
|
+
**
|
13
|
+
** = Instance variables
|
14
|
+
** +markup+:: The markup from the component's HTML template.
|
15
|
+
***/
|
16
|
+
var//RSence.Foundation
|
17
|
+
HMarkupView = HClass.extend({
|
18
|
+
|
19
|
+
/** = Description
|
20
|
+
* Evaluates the pieces of code defined in the markup template marked with
|
21
|
+
* syntax #{}.
|
22
|
+
* Can't use } characters in the code though.
|
23
|
+
* --
|
24
|
+
* This might need another look...
|
25
|
+
* ++
|
26
|
+
* Places the resulting markup in the instance variable.
|
27
|
+
*
|
28
|
+
**/
|
29
|
+
bindMarkupVariables: function() {
|
30
|
+
|
31
|
+
var _markup = this.markup;
|
32
|
+
|
33
|
+
while ( HMarkupView._assignment_match.test(_markup) ) {
|
34
|
+
_markup = _markup.replace( HMarkupView._assignment_match, this.evalMarkupVariable(RegExp.$1,true) );
|
35
|
+
}
|
36
|
+
while ( HMarkupView._variable_match.test(_markup) ) {
|
37
|
+
_markup = _markup.replace( HMarkupView._variable_match, this.evalMarkupVariable(RegExp.$1) );
|
38
|
+
}
|
39
|
+
|
40
|
+
this.markup = _markup;
|
41
|
+
|
42
|
+
return this;
|
43
|
+
},
|
44
|
+
/** = Description
|
45
|
+
* Evaluates a string and throws an error into console.log
|
46
|
+
* if the string doesn't pass evaluation.
|
47
|
+
* If _isAssignment flag is set to true returns empty string.
|
48
|
+
* if _isAssignment is set to false will return string if it passes
|
49
|
+
* evaluation.
|
50
|
+
*
|
51
|
+
* = Parameters
|
52
|
+
* +_strToEval+:: A String to evaluate.
|
53
|
+
*
|
54
|
+
* +_isAssignment+:: Flag to indicate return the String upon passed
|
55
|
+
* evaluation(false) or return of an empty String(true).
|
56
|
+
*
|
57
|
+
* = Returns
|
58
|
+
* +String+
|
59
|
+
*
|
60
|
+
**/
|
61
|
+
evalMarkupVariable: function(_strToEval,_isAssignment){
|
62
|
+
try {
|
63
|
+
var _ID = this.elemId.toString(),
|
64
|
+
_WIDTH = this.rect.width,
|
65
|
+
_HEIGHT = this.rect.height,
|
66
|
+
_result = eval(_strToEval);
|
67
|
+
if(_isAssignment){
|
68
|
+
return '';
|
69
|
+
}
|
70
|
+
if(_result===undefined){
|
71
|
+
return '';
|
72
|
+
}
|
73
|
+
else {
|
74
|
+
return _result;
|
75
|
+
}
|
76
|
+
}
|
77
|
+
catch(e) {
|
78
|
+
console.log("Warning, the markup string '"+_strToEval+"' failed evaluation. Reason:"+e+' '+e.description);
|
79
|
+
return '';
|
80
|
+
}
|
81
|
+
},
|
82
|
+
|
83
|
+
/** = Description
|
84
|
+
* Sets or unsets the _cssClass into a DOM element that goes by the ID
|
85
|
+
* _elementId.
|
86
|
+
*
|
87
|
+
* = Parameters
|
88
|
+
* +_elementId+:: ID of the DOM element, or the element itself, to be
|
89
|
+
* modified.
|
90
|
+
* +_cssClass+:: Name of the CSS class to be added or removed.
|
91
|
+
* +_setOn+:: Boolean value that tells should the CSS class be added or
|
92
|
+
* removed.
|
93
|
+
*
|
94
|
+
* = Returns
|
95
|
+
* +self+
|
96
|
+
*
|
97
|
+
**/
|
98
|
+
toggleCSSClass: function(_elementId, _cssClass, _setOn) {
|
99
|
+
if(_elementId) {
|
100
|
+
if (_setOn) {
|
101
|
+
ELEM.addClassName(_elementId, _cssClass);
|
102
|
+
}
|
103
|
+
else {
|
104
|
+
ELEM.removeClassName(_elementId, _cssClass);
|
105
|
+
}
|
106
|
+
}
|
107
|
+
return this;
|
108
|
+
}
|
109
|
+
|
110
|
+
},{
|
111
|
+
_variable_match: new RegExp(/#\{([^\}]*)\}/),
|
112
|
+
_assignment_match: new RegExp(/\$\{([^\}]*)\}/)
|
113
|
+
});
|
114
|
+
|
File without changes
|