qa_robusta 0.1.8 → 0.1.9

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.
Files changed (63) hide show
  1. data/History.txt +4 -0
  2. data/Manifest.txt +41 -4
  3. data/common/lib/gems/.svn/entries +1 -1
  4. data/common/lib/gems/cache/.svn/entries +1 -1
  5. data/common/lib/gems/doc/.svn/entries +1 -1
  6. data/common/lib/gems/gems/.svn/entries +1 -1
  7. data/common/lib/gems/installed/.svn/entries +1 -1
  8. data/common/lib/gems/installed/cache/.svn/entries +1 -1
  9. data/common/lib/gems/installed/doc/.svn/entries +1 -1
  10. data/common/lib/gems/installed/gems/.svn/entries +1 -1
  11. data/common/lib/gems/installed/specifications/.svn/entries +1 -1
  12. data/common/lib/gems/specifications/.svn/entries +1 -1
  13. data/demo/public/images/arrow_left_48.png +0 -0
  14. data/demo/public/images/arrow_right_48.png +0 -0
  15. data/demo/public/images/down.gif +0 -0
  16. data/demo/public/images/header.jpg +0 -0
  17. data/demo/public/images/menu.gif +0 -0
  18. data/demo/public/images/menuhover.gif +0 -0
  19. data/demo/public/javascripts/browser.menu.js +61 -0
  20. data/demo/public/javascripts/cyberconnect_helpers.js +369 -0
  21. data/demo/public/javascripts/jquery-1.5.1.min.js +16 -0
  22. data/demo/public/javascripts/jquery-ui-1.8.10.custom.min.js +1370 -0
  23. data/demo/public/javascripts/jquery.layout.min-1.2.0.js +80 -0
  24. data/demo/public/javascripts/jqueryslidemenu.css +93 -0
  25. data/demo/public/javascripts/jqueryslidemenu.js +48 -0
  26. data/demo/public/javascripts/ui.accordion.js +477 -0
  27. data/demo/public/jquery.ui.all.css +11 -0
  28. data/demo/public/jquery.ui.base.css +11 -0
  29. data/demo/public/jquery.ui.theme.css +252 -0
  30. data/demo/public/jquery_css/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  31. data/demo/public/jquery_css/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  32. data/demo/public/jquery_css/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  33. data/demo/public/jquery_css/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  34. data/demo/public/jquery_css/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  35. data/demo/public/jquery_css/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  36. data/demo/public/jquery_css/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  37. data/demo/public/jquery_css/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  38. data/demo/public/jquery_css/images/ui-icons_222222_256x240.png +0 -0
  39. data/demo/public/jquery_css/images/ui-icons_2e83ff_256x240.png +0 -0
  40. data/demo/public/jquery_css/images/ui-icons_454545_256x240.png +0 -0
  41. data/demo/public/jquery_css/images/ui-icons_888888_256x240.png +0 -0
  42. data/demo/public/jquery_css/images/ui-icons_cd0a0a_256x240.png +0 -0
  43. data/demo/public/jquery_css/jquery-ui-1.8.10.custom.css +573 -0
  44. data/demo/public/jquery_layout.css +14 -0
  45. data/demo/public/jqueryslidemenu.css +93 -0
  46. data/demo/public/menu.css +12 -0
  47. data/demo/public/style.css +193 -1
  48. data/demo/views/index.erb +263 -9
  49. data/lib/qa_robusta.rb +1 -1
  50. data/qa_observer/lib/doc.rb +8 -4
  51. data/qa_observer/lib/form_helpers.rb +1 -1
  52. data/qa_observer/lib/watir.rb +41 -41
  53. data/qa_observer/sites/demo/elements/demo_elements.rb +50 -1
  54. data/qa_observer/sites/demo/flows/demo_flows.rb +32 -7
  55. data/qa_observer/sites/demo/test_cases/home_page.rb +34 -17
  56. data/qa_observer/sites/demo/test_cases/test_element_scroll_to.rb +9 -9
  57. data/qa_observer/sites/demo/test_cases/test_menu.rb +59 -0
  58. data/qa_observer/sites/demo/test_cases/test_registration.rb +140 -0
  59. data/qa_observer/suites/demo_release_decision/release.yaml +23 -0
  60. data/qa_observer/suites/init.rb +45 -2
  61. data/qa_observer/test_runner.rb +3 -5
  62. metadata +45 -9
  63. data/test/test_qa_robusta.rb +0 -8
@@ -1,3 +1,7 @@
1
+ === 0.1.9 / 2011-10-01
2
+ * Watir::Browser supports alert_box, where the call returns a reference to
3
+ driver.switch_to.alert
4
+ * Watir::Element supports mouseover. fireevent('mouseover') is less reliable
1
5
  === 0.1.6 / 2011-10-01
2
6
  * Element now has calls for: in_viewable_area? and scroll_to.
3
7
  in_viewable_area? returns true if the element is in the viewable area
@@ -17,10 +17,6 @@ remote_unix/lib/common.rb
17
17
  remote_unix/lib/ssh.rb
18
18
  remote_unix/lib/postfix_info.rb
19
19
  remote_unix/lib/requires.rb
20
- demo/public/javascripts/jquery-1.6.2.min.js
21
- demo/public/style.css
22
- demo/demo_site.rb
23
- demo/views/index.erb
24
20
  mechanize_interface/conf/app.yaml
25
21
  mechanize_interface/lib/get_page.rb
26
22
  mechanize_interface/lib/login.rb
@@ -30,6 +26,8 @@ mechanize_interface/lib/app_require.rb
30
26
  mechanize_interface/test/lib/mech_unit_test.rb
31
27
  qa_observer/script/generate
32
28
  qa_observer/script/destroy
29
+ qa_observer/sites/demo/test_cases/test_menu.rb
30
+ qa_observer/sites/demo/test_cases/test_registration.rb
33
31
  qa_observer/sites/demo/test_cases/home_page.rb
34
32
  qa_observer/sites/demo/test_cases/test_element_scroll_to.rb
35
33
  qa_observer/sites/demo/elements/demo_elements.rb
@@ -47,6 +45,7 @@ qa_observer/conf/dev_users.yaml
47
45
  qa_observer/conf/development.yaml
48
46
  qa_observer/conf/qa_observer_links.yaml
49
47
  qa_observer/suites/init.rb
48
+ qa_observer/suites/demo_release_decision/release.yaml
50
49
  qa_observer/suites/demo_sm_chrome/sm.yaml
51
50
  qa_observer/suites/demo_lg_chrome/lg.yaml
52
51
  qa_observer/suites/demo_md_chrome/md.yaml
@@ -100,3 +99,41 @@ common/lib/array.rb
100
99
  common/lib/gen_suite_doc.rb
101
100
  common/lib/constants.rb
102
101
  lib/monkey_patch.rb
102
+ demo/public/jquery_layout.css
103
+ demo/public/javascripts/jquery.layout.min-1.2.0.js
104
+ demo/public/javascripts/jquery-ui-1.8.10.custom.min.js
105
+ demo/public/javascripts/browser.menu.js
106
+ demo/public/javascripts/jqueryslidemenu.js
107
+ demo/public/javascripts/jquery-1.5.1.min.js
108
+ demo/public/javascripts/jquery-1.6.2.min.js
109
+ demo/public/javascripts/ui.accordion.js
110
+ demo/public/javascripts/jqueryslidemenu.css
111
+ demo/public/javascripts/cyberconnect_helpers.js
112
+ demo/public/jquery_css/images/ui-bg_glass_55_fbf9ee_1x400.png
113
+ demo/public/jquery_css/images/ui-icons_888888_256x240.png
114
+ demo/public/jquery_css/images/ui-icons_2e83ff_256x240.png
115
+ demo/public/jquery_css/images/ui-icons_222222_256x240.png
116
+ demo/public/jquery_css/images/ui-bg_glass_95_fef1ec_1x400.png
117
+ demo/public/jquery_css/images/ui-bg_glass_65_ffffff_1x400.png
118
+ demo/public/jquery_css/images/ui-bg_glass_75_dadada_1x400.png
119
+ demo/public/jquery_css/images/ui-bg_glass_75_e6e6e6_1x400.png
120
+ demo/public/jquery_css/images/ui-bg_highlight-soft_75_cccccc_1x100.png
121
+ demo/public/jquery_css/images/ui-icons_454545_256x240.png
122
+ demo/public/jquery_css/images/ui-icons_cd0a0a_256x240.png
123
+ demo/public/jquery_css/images/ui-bg_flat_0_aaaaaa_40x100.png
124
+ demo/public/jquery_css/images/ui-bg_flat_75_ffffff_40x100.png
125
+ demo/public/jquery_css/jquery-ui-1.8.10.custom.css
126
+ demo/public/style.css
127
+ demo/public/images/menuhover.gif
128
+ demo/public/images/down.gif
129
+ demo/public/images/arrow_left_48.png
130
+ demo/public/images/menu.gif
131
+ demo/public/images/arrow_right_48.png
132
+ demo/public/images/header.jpg
133
+ demo/public/menu.css
134
+ demo/public/jquery.ui.theme.css
135
+ demo/public/jqueryslidemenu.css
136
+ demo/public/jquery.ui.all.css
137
+ demo/public/jquery.ui.base.css
138
+ demo/demo_site.rb
139
+ demo/views/index.erb
@@ -1,7 +1,7 @@
1
1
  10
2
2
 
3
3
  dir
4
- 420
4
+ 435
5
5
  file:///home/cliff/l_bkup/svn/repos/trunk/cyberconnect/qa_robusta/common/lib/gems
6
6
  file:///home/cliff/l_bkup/svn/repos
7
7
 
@@ -1,7 +1,7 @@
1
1
  10
2
2
 
3
3
  dir
4
- 420
4
+ 435
5
5
  file:///home/cliff/l_bkup/svn/repos/trunk/cyberconnect/qa_robusta/common/lib/gems/cache
6
6
  file:///home/cliff/l_bkup/svn/repos
7
7
 
@@ -1,7 +1,7 @@
1
1
  10
2
2
 
3
3
  dir
4
- 420
4
+ 435
5
5
  file:///home/cliff/l_bkup/svn/repos/trunk/cyberconnect/qa_robusta/common/lib/gems/doc
6
6
  file:///home/cliff/l_bkup/svn/repos
7
7
 
@@ -1,7 +1,7 @@
1
1
  10
2
2
 
3
3
  dir
4
- 420
4
+ 435
5
5
  file:///home/cliff/l_bkup/svn/repos/trunk/cyberconnect/qa_robusta/common/lib/gems/gems
6
6
  file:///home/cliff/l_bkup/svn/repos
7
7
 
@@ -1,7 +1,7 @@
1
1
  10
2
2
 
3
3
  dir
4
- 420
4
+ 435
5
5
  file:///home/cliff/l_bkup/svn/repos/trunk/cyberconnect/qa_robusta/common/lib/gems/installed
6
6
  file:///home/cliff/l_bkup/svn/repos
7
7
 
@@ -1,7 +1,7 @@
1
1
  10
2
2
 
3
3
  dir
4
- 420
4
+ 435
5
5
  file:///home/cliff/l_bkup/svn/repos/trunk/cyberconnect/qa_robusta/common/lib/gems/installed/cache
6
6
  file:///home/cliff/l_bkup/svn/repos
7
7
 
@@ -1,7 +1,7 @@
1
1
  10
2
2
 
3
3
  dir
4
- 420
4
+ 435
5
5
  file:///home/cliff/l_bkup/svn/repos/trunk/cyberconnect/qa_robusta/common/lib/gems/installed/doc
6
6
  file:///home/cliff/l_bkup/svn/repos
7
7
 
@@ -1,7 +1,7 @@
1
1
  10
2
2
 
3
3
  dir
4
- 420
4
+ 435
5
5
  file:///home/cliff/l_bkup/svn/repos/trunk/cyberconnect/qa_robusta/common/lib/gems/installed/gems
6
6
  file:///home/cliff/l_bkup/svn/repos
7
7
 
@@ -1,7 +1,7 @@
1
1
  10
2
2
 
3
3
  dir
4
- 420
4
+ 435
5
5
  file:///home/cliff/l_bkup/svn/repos/trunk/cyberconnect/qa_robusta/common/lib/gems/installed/specifications
6
6
  file:///home/cliff/l_bkup/svn/repos
7
7
 
@@ -1,7 +1,7 @@
1
1
  10
2
2
 
3
3
  dir
4
- 420
4
+ 435
5
5
  file:///home/cliff/l_bkup/svn/repos/trunk/cyberconnect/qa_robusta/common/lib/gems/specifications
6
6
  file:///home/cliff/l_bkup/svn/repos
7
7
 
@@ -0,0 +1,61 @@
1
+ // JavaScript Document
2
+ //var menus = $.extend(defaults, menus);
3
+ (function($){
4
+
5
+ $.fn.bmenu = function(menus) {
6
+ return this.each(function() {
7
+ obj=$(this);
8
+ obj.empty();
9
+ $('<div id=shadow></div>').insertBefore(obj);
10
+ $.each(menus,function(i, menu) {
11
+ // for(i in menus) {
12
+ obj.append('<br><div><a id="'+menu.id+'" style="text-decoration:none; cursor:default;">&nbsp;&nbsp;'+menu.name+'</a></div>');
13
+ $('a#' + menu.id).click(function() {
14
+ $(obj).hide();
15
+ eval(menu.func);
16
+ });
17
+ /*
18
+ $('a#' + menus[i].id).click(function() {
19
+ $(obj).hide();
20
+ try {
21
+ eval(menus[i].func);
22
+ } catch(e) {
23
+ alert(e);
24
+ }
25
+ })
26
+ */
27
+ });
28
+ obj.append('<br>');
29
+ obj.children('div:not("#line")').hover(
30
+ function () {
31
+ $(this).css('background-color','#C9DBEE');
32
+ $(this).css('opacity','0.9');
33
+ $(this).css('cursor','default');
34
+ $(this).css('background-color','');
35
+ }
36
+ );
37
+ obj.prepend('<div id=line></div>');
38
+ $('#line').css({ 'opacity':'3', 'width':'27px',
39
+ 'background-color':obj.css('background-color'),
40
+ 'float':'left','height':obj.height()+'px', 'border-right':'solid 1px #E7E7E7'
41
+ });
42
+ });
43
+ };
44
+ /*
45
+ $.extend($.fn.bmenu, {
46
+ show: function() {
47
+ $('#shadow').hide(); obj.hide(); mheight=obj.height(); mwidth=obj.width();
48
+ if(e.pageY>=$(window).height()-(mheight+5)){ Y=e.pageY-(mheight+5); } else{ Y=e.pageY; }
49
+ if(e.pageX>=$(window).width()-(mwidth+5)){ X=e.pageX-(mwidth+5); } else{ X=e.pageX; }
50
+ obj.css('left',X); obj.css('top',Y);
51
+ $('#shadow').css({ 'display': 'none', 'position':'absolute', 'opacity':'0.4',
52
+ 'width':obj.width()+'px', 'background-color':'#000' });
53
+ $('#shadow').css('height',obj.height());
54
+ $('#shadow').css('left',X+5);
55
+ $('#shadow').css('top',Y+5);
56
+ obj.show(function(){ $('#shadow').show(); });
57
+ }
58
+ });
59
+ */
60
+ })
61
+ (jQuery);
@@ -0,0 +1,369 @@
1
+ /*
2
+ Owner: Cyberconnects LLC
3
+ Copyright 2010, 2011
4
+ */
5
+
6
+ function inline_li_width(id) {
7
+ var w = 0;
8
+ $('#' + id).find('li').each(function() {
9
+ w += $(this).width()
10
+ });
11
+ return w
12
+ }
13
+
14
+ function max_row_info(search_id, table_id, font_size) {
15
+ var max = 0;
16
+ var num_cols = 0
17
+ $('#' + search_id).find('table[id=' + table_id + ']').find('tr').each(function(row_e) {
18
+ var current=0;
19
+ $(this).find('td').each(function(col_e) {
20
+ num_cols ++;
21
+ current += $(this).text().length
22
+ max = current > max ? current:max
23
+ });
24
+ });
25
+ font_size = parseInt($('#' + search_id).css('font-size').replace(/px$/i, ''));
26
+ div_width = (font_size * (max+5))/2;
27
+ return {max_row_length: max, font_size: font_size, div_width: div_width}
28
+ }
29
+
30
+
31
+ function combined_height(id) {
32
+ item = $('#' + id)
33
+ h=0
34
+ while(item.next().length > 0) {
35
+ h += item.height();
36
+ item = item.next();
37
+ }
38
+ return h;
39
+ }
40
+
41
+
42
+ function build_menu() {
43
+ $('#main_menu').empty();
44
+ $('#main_menu').append($.fn.main_menu_content);
45
+ $('#main_menu').buildmenu();
46
+ }
47
+
48
+ function context_menu(row_n) {
49
+ var menu = []
50
+ for(i in $.fn.context_data) {
51
+ menu_item = $.fn.context_data[i]
52
+ menu_item.func = menu_item.func.replace("row_n", row_n)
53
+ menu.push(menu_item);
54
+ }
55
+ return menu;
56
+ }
57
+
58
+ function click_handler(type, id, function_str) {
59
+ elems=$.find(type)
60
+ match_ct = 0
61
+ for(i=0; i<elems.length; i++) {
62
+ itter_id = $(elems[i]).attr('id')
63
+ if(id == itter_id) {
64
+ new_id = id + '_' + match_ct;
65
+ $(elems[i]).attr('id', new_id)
66
+ match_ct += 1
67
+ $('#' + new_id).click(function() {
68
+ eval(function_str);
69
+ });
70
+ }
71
+ }
72
+ }
73
+
74
+
75
+ function close_menu() { $('#context_menu').hide(); }
76
+
77
+
78
+ function checkboxes_all_by_div(state, div_id, input_id) {
79
+ checkboxes = $('#' + div_id).find('input#' + input_id)
80
+ for(i=0; i<checkboxes.length; i++) {
81
+ if(state) {
82
+ $(checkboxes[i]).attr('checked', true);
83
+ } else if(state == false) {
84
+ $(checkboxes[i]).attr('checked', false);
85
+ }
86
+ }
87
+ }
88
+
89
+ function single_select_option(id) {
90
+ var elem = document.getElementById(id)
91
+ return elem.options[elem.selectedIndex].value
92
+ }
93
+
94
+ function select_list_options(div_id) {
95
+ return $('select#' + div_id)[0].options;
96
+ }
97
+
98
+ function select_list_options_selected(div_id) {
99
+ var selected = []
100
+ var options = select_list_options(div_id)
101
+
102
+ for(i=0; i< options.length; i++) {
103
+ if(options[i].selected)
104
+ selected.push($(options[i]).attr('value'));
105
+
106
+ }
107
+ return selected;
108
+ }
109
+
110
+ function select_option(select_id, option) {
111
+ var options = select_list_options(select_id)
112
+ for(i = 0; i < options.length; i++) {
113
+ if($(options[i]).attr('value') == option){
114
+ var index=parseInt(i)
115
+ break;
116
+ }
117
+ }
118
+ if(index > 0) {
119
+ var toggle_change = index-1
120
+ } else {
121
+ var toggle_change = index+1
122
+ }
123
+ $(options[toggle_change]).attr('selected', true);
124
+ $(options[index]).attr('selected', true);
125
+ }
126
+
127
+ function max_height(col1_div, col2_div) {
128
+ col1 =$('#' + col1_div).height();
129
+ col2 =$('#' + col2_div).height();
130
+ var max_h = ( col1 > col2 ) ? col1 : col2;
131
+ return max_h;
132
+ }
133
+
134
+ function format_table_col_height(col1_div, col2_div) {
135
+ var max_h = max_height(col1_div, col2_div)
136
+ $('#' + col1_div).height(max_h)
137
+ $('#' + col2_div).height(max_h)
138
+ }
139
+
140
+ // [{elem, value}]
141
+ function update_style_for_dialog_by_sibling_div(update_elements, div_id) {
142
+ var i = $('#' + div_id).parent();
143
+ var elements = $(i).attr('style').split(';');
144
+ for(x=0; x<update_elements.length; x++){
145
+ var found=false;
146
+ for(i=0; i<elements.length; i++) {
147
+ var re = new RegExp(update_elements[x].elem)
148
+ if( elements[i].match(re) ) {
149
+ found = true;
150
+ e = elements[i].split(':')
151
+ e[1] = update_elements[x].value
152
+ elements[i] = e.join(':')
153
+ break;
154
+ }
155
+ }
156
+ if(!found)
157
+ elements[elements.length] = update_elements[x].elem + ':' + update_elements[x].value
158
+ }
159
+ style = elements.join(';');
160
+ //$('#' + div_id).dialog(
161
+ $('#' + div_id).parent().attr('style', style);
162
+ }
163
+
164
+
165
+ function remove_field_errors(search_div, clear_fields) {
166
+ var form_fields = [$('#' + search_div).find('input'), $('#' + search_div).find('select')]
167
+ try {
168
+ for(x=0; x< form_fields.length; x++)
169
+ for(y=0; y<form_fields[x].length; y++) {
170
+ var error_id = $(form_fields[x][y]).attr('id') + '_error';
171
+ type = $(form_fields[x][y]).attr('type')
172
+ if(error_id != 'undefined_error' && type != 'hidden'){
173
+ $('#' + error_id).empty();
174
+ $(form_fields[x][y]).attr('class', '')
175
+
176
+ if(typeof clear_fields != 'undefined') {
177
+ if(type == 'checkbox' || type == 'radio')
178
+ $(form_fields[x][y]).attr('checked', false);
179
+ if(type == 'text' || type == 'password')
180
+ $(form_fields[x][y]).attr('value', '');
181
+ if(type == 'select' || type == 'password')
182
+ $(form_fields[x][y]).attr('value', '');
183
+ if(type == 'select-one')
184
+ $(form_fields[x][y].options[0]).attr('selected', true)
185
+ if(type == 'select-multiple')
186
+ for(i in form_fields[x][y].options)
187
+ $(form_fields[x][y].options[i]).attr('selected', false)
188
+ }
189
+
190
+ }
191
+ }
192
+ } catch(e) { }
193
+ }
194
+
195
+ function style_form_errors(errors, offset) {
196
+ var num_errors = errors.length;
197
+ for(i in errors) {
198
+ /*
199
+ var style = 'position: relative;';
200
+ var mov=0;
201
+ var elem = $('#' + errors[i].field + '_error').prev()
202
+ if(elem.html().match(/option/i)) {
203
+ style += "top: -20px;";
204
+ if(typeof(offset) != 'undefined')
205
+ mov += parseInt(offset)
206
+ }
207
+ mov += elem.width();
208
+ style += "width: '200px';"
209
+ //label_class = elem.prev.attr('class')
210
+ //mov += parseInt($('label.' + label_class).width());
211
+ style += "right: -" + mov + "px;";
212
+ $('#' + errors[i].field + '_error').attr('style', style);
213
+ */
214
+ $('#' + errors[i].field).attr('class', 'error');
215
+ $('#' + errors[i].field + '_error').empty();
216
+ $('#' + errors[i].field + '_error').append(errors[i].msg);
217
+ $('#' + errors[i].field + '_error').width(errors[i].msg+5);
218
+ }
219
+
220
+
221
+
222
+ }
223
+
224
+ function form_refresh(step_n, padding){
225
+ if(typeof(padding) == 'undefined')
226
+ var padding=2;
227
+ w=0
228
+ $("label." + step_n).each(function(){
229
+ if ($(this).width() > w)
230
+ w = $(this).width();
231
+ });
232
+ $("label." + step_n).width(w+padding);
233
+ }
234
+
235
+
236
+ function monetary_round(string_n) {
237
+ string_n = String(string_n);
238
+ split_n = string_n.split('.');
239
+
240
+ if(split_n.length == 2) {
241
+ dec = split_n[1];
242
+
243
+ var n_dec = dec[0] + dec[1];
244
+ if(parseInt(dec[2]) > 4)
245
+ n_dec = parseFloat("0." + n_dec) + 0.01;
246
+ else
247
+ n_dec = parseFloat('0.' + n_dec);
248
+
249
+ string_n_dec_split = String(n_dec).split('.');
250
+ if(string_n_dec_split.length == 2)
251
+ string_n_dec = string_n_dec_split[1];
252
+ else
253
+ string_n_dec = string_n_dec_split[0];
254
+
255
+ if(string_n_dec.length == 1){
256
+ string_n_dec += '0';
257
+ } else if(string_n_dec.length == 0){
258
+ string_n_dec += '00';
259
+ }
260
+ return split_n[0] + '.' + string_n_dec[0] + string_n_dec[1];
261
+ } else {
262
+ return split_n[0] + '.00'
263
+ }
264
+ }
265
+
266
+ function redirect_to_home() {
267
+ window.location = location.href.replace(location.pathname, '/home');
268
+ }
269
+
270
+ function show_page_dialog(id, title, buttons) {
271
+ if(typeof(buttons) != 'object')
272
+ var buttons = {'Close' : function () { $('#' + id).dialog('close'); } };
273
+
274
+ ops = { 'buttons': buttons, 'modla':true, 'title':title, 'width':Math.floor(window.innerWidth * 0.90), 'position':'center'}
275
+ $('#' + id).dialog(ops);
276
+ }
277
+
278
+
279
+
280
+ function check_login(callback) {
281
+ path=location.pathname.replace(/^\//, '')
282
+ $.ajax({url: '/user_sessions/logged_in', dataType: 'json', data: {path:path}, async: false,
283
+ success: function(res) {
284
+ var menu_content = "<ul>";
285
+ //var menu_content = "<ul> <li><a href='/home'>Home</a></li>";
286
+ menu_content += res.role_menu;
287
+ $.fn.context_data = res.page_menu;
288
+ $.fn.main_menu_content = menu_content;
289
+ build_menu();
290
+ if(res.logged_in) {
291
+ $.fn.is_logged_in = true;
292
+ $.fn.app_info = res.apps_info;
293
+ if(typeof($.data.logged_in_prev) == 'undefined')
294
+ $.data.logged_in_prev = false;
295
+ else
296
+ $.data.logged_in_prev = $.data.logged_in;
297
+ $.data.logged_in = true;
298
+ if(res.env == 'development')
299
+ $('#beta_site').show();
300
+ else
301
+ $('#beta_site').hide();
302
+ try {
303
+ b_info = jQuery.browser
304
+ if( b_info.msie && b_info.version.match(/^7/) ){
305
+ $('#upgrade_ie').dialog({title: 'Internet 7 Detected - Please upgrade', width : 600, height : 300, modal: true});
306
+ }
307
+ } catch(e) {
308
+ }
309
+
310
+ re = new RegExp(res.redirect_to)
311
+ // if( (res.redirect_to != '') && (!location.pathname.match(re)) )
312
+ // location.href = res.redirect_to;
313
+
314
+ tab_html = '<ul>'
315
+ var tab_divs=[];
316
+ $('div#tabs').find('div').each(function() {
317
+ try {
318
+ var id = $(this).attr('id');
319
+ if( typeof(id) == 'string') {
320
+ if(id.match(/_tab$/)) {
321
+ if( tab_divs.indexOf(id) < 0)
322
+ tab_divs.push(id);
323
+ }
324
+ }
325
+ } catch(e) { }
326
+ });
327
+ for(i in res.tabs){
328
+ tab_html += "<li><a href='#" + res.tabs[i].name + "'>" + res.tabs[i].display + "</a></li>";
329
+ try {
330
+ index = tab_divs.indexOf(res.tabs[i].name)
331
+ if(index > -1)
332
+ tab_divs[index] = null;
333
+ } catch(e) {}
334
+ }
335
+ for(i in tab_divs)
336
+ if(tab_divs[i] != null)
337
+ $('div#'+ tab_divs[i]).detach();
338
+ $('div#tabs').prepend(tab_html);
339
+ $('div#tabs').width(1000);
340
+ //$('#tabs').tabs();
341
+ //callback();
342
+ } else {
343
+ $.data.logged_in = false
344
+ $('#beta_site').hide();
345
+ }
346
+ }
347
+ });
348
+
349
+ }
350
+
351
+ function init(post_login_callback) {
352
+
353
+ check_login(post_login_callback)
354
+ $('a.new-window').click(function(){
355
+ window.open(this.href);
356
+ return false;
357
+ });
358
+
359
+ $('a#open_section').click(function() {
360
+ div_id = $(this).attr('class')
361
+ $('#' + div_id).show();
362
+ });
363
+
364
+ $('a.upgrade_ie').click(function() {
365
+ $('div#upgrade_ie').dialog('close');
366
+ window.open(this.href);
367
+ return false;
368
+ });
369
+ }