ymdp 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/Rakefile +13 -19
- data/VERSION +1 -1
- data/lib/new_application/Gemfile +1 -0
- data/lib/ymdp/compiler/template_compiler.rb +19 -3
- data/lib/ymdp/config.rb +4 -0
- data/lib/ymdp/deploy/ymdt.rb +118 -0
- data/lib/ymdp/support/string_masker.rb +17 -0
- data/lib/ymdp/tasks/ymdp.rake +13 -61
- data/lib/ymdp/translator/base.rb +6 -3
- data/lib/ymdp.rb +3 -0
- data/spec/data/Rakefile +3 -0
- data/spec/data/VERSION +1 -0
- data/spec/data/app/.gitignore +1 -0
- data/spec/data/app/assets/images/lightbox/lightbox_bg.png +0 -0
- data/spec/data/app/assets/javascripts/OpenMailIntl.js +291 -0
- data/spec/data/app/assets/javascripts/controls.js +965 -0
- data/spec/data/app/assets/javascripts/date.js +104 -0
- data/spec/data/app/assets/javascripts/dragdrop.js +974 -0
- data/spec/data/app/assets/javascripts/effects.js +1123 -0
- data/spec/data/app/assets/javascripts/lowpro.js +320 -0
- data/spec/data/app/assets/javascripts/prototype.js +4874 -0
- data/spec/data/app/assets/javascripts/scriptaculous.js +68 -0
- data/spec/data/app/assets/yrb/en-US/application_en-US.pres +7 -0
- data/spec/data/app/helpers/application_helper.rb +3 -0
- data/spec/data/app/javascripts/application.js +580 -0
- data/spec/data/app/javascripts/debug.js +138 -0
- data/spec/data/app/javascripts/flash.js +96 -0
- data/spec/data/app/javascripts/header.js +13 -0
- data/spec/data/app/javascripts/help.js +76 -0
- data/spec/data/app/javascripts/i18n.js +235 -0
- data/spec/data/app/javascripts/launcher.js +159 -0
- data/spec/data/app/javascripts/logger.js +61 -0
- data/spec/data/app/javascripts/tag_helper.js +178 -0
- data/spec/data/app/stylesheets/application.css +0 -0
- data/spec/data/app/stylesheets/ie.css +0 -0
- data/spec/data/app/stylesheets/ie6.css +0 -0
- data/spec/data/app/stylesheets/ie7.css +0 -0
- data/spec/data/app/stylesheets/ie8.css +0 -0
- data/spec/data/app/stylesheets/lightbox.css +30 -0
- data/spec/data/app/stylesheets/non_ie.css +0 -0
- data/spec/data/app/views/layouts/application.html.haml +35 -0
- data/spec/data/app/views/page.html.haml +1 -0
- data/spec/data/app/views/shared/_error.html.haml +8 -0
- data/spec/data/app/views/shared/_flash.html.haml +2 -0
- data/spec/data/app/views/shared/_javascripts.html.haml +22 -0
- data/spec/data/app/views/shared/_loading.html.haml +13 -0
- data/spec/data/app/views/shared/_stylesheets.html.haml +23 -0
- data/spec/data/config/categories.yml +6 -0
- data/spec/data/config/config.yml +28 -0
- data/spec/data/config/config.yml.example +30 -0
- data/spec/data/config/constants.rb +54 -0
- data/spec/data/config/content.yml +2 -0
- data/spec/data/config/servers.yml +9 -0
- data/spec/data/config/servers.yml.example +9 -0
- data/spec/data/lib/init.rb +13 -0
- data/spec/data/lib/tasks/environment.rake +4 -0
- data/spec/data/lib/tasks/keys.rake +3 -0
- data/spec/data/lib/tasks/setup.rake +13 -0
- data/spec/data/lib/tasks/ymdp.rake +4 -0
- data/spec/data/script/build +9 -0
- data/spec/data/script/config +13 -0
- data/spec/data/script/destroy +18 -0
- data/spec/data/script/generate +4 -0
- data/spec/data/script/gitrm +17 -0
- data/spec/data/script/growl +6 -0
- data/spec/data/script/images +48 -0
- data/spec/data/script/jslint.js +5072 -0
- data/spec/data/script/langs +31 -0
- data/spec/data/script/translate +5 -0
- data/spec/data/script/ymdt +1895 -0
- data/spec/data/script/ymdt.old +1890 -0
- data/spec/data/script/yuicompressor-2.4.2.jar +0 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/translator_spec.rb +9 -0
- data/spec/ymdp_spec.rb +5 -0
- data/spec/ymdt_spec.rb +149 -0
- data/ymdp.gemspec +78 -6
- metadata +78 -6
- data/test/helper.rb +0 -10
- data/test/test_ymdp.rb +0 -4
@@ -0,0 +1,68 @@
|
|
1
|
+
// script.aculo.us scriptaculous.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
|
2
|
+
|
3
|
+
// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
4
|
+
//
|
5
|
+
// Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
// a copy of this software and associated documentation files (the
|
7
|
+
// "Software"), to deal in the Software without restriction, including
|
8
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
// distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
// permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
// the following conditions:
|
12
|
+
//
|
13
|
+
// The above copyright notice and this permission notice shall be
|
14
|
+
// included in all copies or substantial portions of the Software.
|
15
|
+
//
|
16
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
//
|
24
|
+
// For details, see the script.aculo.us web site: http://script.aculo.us/
|
25
|
+
|
26
|
+
var Scriptaculous = {
|
27
|
+
Version: '1.8.3',
|
28
|
+
require: function(libraryName) {
|
29
|
+
try{
|
30
|
+
// inserting via DOM fails in Safari 2.0, so brute force approach
|
31
|
+
document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>');
|
32
|
+
} catch(e) {
|
33
|
+
// for xhtml+xml served content, fall back to DOM methods
|
34
|
+
var script = document.createElement('script');
|
35
|
+
script.type = 'text/javascript';
|
36
|
+
script.src = libraryName;
|
37
|
+
document.getElementsByTagName('head')[0].appendChild(script);
|
38
|
+
}
|
39
|
+
},
|
40
|
+
REQUIRED_PROTOTYPE: '1.6.0.3',
|
41
|
+
load: function() {
|
42
|
+
function convertVersionString(versionString) {
|
43
|
+
var v = versionString.replace(/_.*|\./g, '');
|
44
|
+
v = parseInt(v + '0'.times(4-v.length));
|
45
|
+
return versionString.indexOf('_') > -1 ? v-1 : v;
|
46
|
+
}
|
47
|
+
|
48
|
+
if((typeof Prototype=='undefined') ||
|
49
|
+
(typeof Element == 'undefined') ||
|
50
|
+
(typeof Element.Methods=='undefined') ||
|
51
|
+
(convertVersionString(Prototype.Version) <
|
52
|
+
convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE)))
|
53
|
+
throw("script.aculo.us requires the Prototype JavaScript framework >= " +
|
54
|
+
Scriptaculous.REQUIRED_PROTOTYPE);
|
55
|
+
|
56
|
+
var js = /scriptaculous\.js(\?.*)?$/;
|
57
|
+
$$('head script[src]').findAll(function(s) {
|
58
|
+
return s.src.match(js);
|
59
|
+
}).each(function(s) {
|
60
|
+
var path = s.src.replace(js, ''),
|
61
|
+
includes = s.src.match(/\?.*load=([a-z,]*)/);
|
62
|
+
(includes ? includes[1] : 'effects,dragdrop,controls').split(',').each(
|
63
|
+
function(include) { Scriptaculous.require(path+include+'.js') });
|
64
|
+
});
|
65
|
+
}
|
66
|
+
};
|
67
|
+
|
68
|
+
Scriptaculous.load();
|
@@ -0,0 +1,580 @@
|
|
1
|
+
/*
|
2
|
+
APPLICATION
|
3
|
+
|
4
|
+
*/
|
5
|
+
|
6
|
+
var APPLICATION, Browser, OIB;
|
7
|
+
|
8
|
+
/* set asset version */
|
9
|
+
APPLICATION = {
|
10
|
+
VERSION: "<%= @hash %>",
|
11
|
+
MESSAGE: "<%= @message %>",
|
12
|
+
DEPLOYED: <%= Time.now.to_i %>,
|
13
|
+
DEPLOYED_STRING: "<%= Time.now.to_s %>"
|
14
|
+
};
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
/*
|
19
|
+
GLOBAL CONSTANTS
|
20
|
+
*/
|
21
|
+
|
22
|
+
YAHOO.namespace("oib");
|
23
|
+
YAHOO.namespace("constants");
|
24
|
+
YAHOO.namespace("images");
|
25
|
+
|
26
|
+
YAHOO.constants.states = ["nil", "authorized", "inspect", "new_active", "processing", "active", "inactive", "invalid", "maintenance"];
|
27
|
+
|
28
|
+
/*
|
29
|
+
Authorze/Reauthorize NAMESPACES/CONSTANTS
|
30
|
+
*/
|
31
|
+
|
32
|
+
YAHOO.constants.check_user_interval = 3;
|
33
|
+
YAHOO.constants.error_timeout = 60;
|
34
|
+
|
35
|
+
Browser = {
|
36
|
+
version: function(v) {
|
37
|
+
var version, app_version;
|
38
|
+
app_version = navigator.appVersion;
|
39
|
+
|
40
|
+
if (app_version.match("MSIE 6.0")) {
|
41
|
+
version = 6.0;
|
42
|
+
}
|
43
|
+
|
44
|
+
if (v) {
|
45
|
+
return (version === v);
|
46
|
+
} else {
|
47
|
+
return version;
|
48
|
+
}
|
49
|
+
},
|
50
|
+
|
51
|
+
ie: function() {
|
52
|
+
return navigator.appName.match("Internet Explorer");
|
53
|
+
},
|
54
|
+
|
55
|
+
ie6: function() {
|
56
|
+
return (Browser.ie() && Browser.version(6.0));
|
57
|
+
},
|
58
|
+
|
59
|
+
ie7: function() {
|
60
|
+
return (Browser.ie() && Browser.version(7.0));
|
61
|
+
},
|
62
|
+
|
63
|
+
ie8: function() {
|
64
|
+
return (Browser.ie() && Browser.version(8.0));
|
65
|
+
}
|
66
|
+
};
|
67
|
+
|
68
|
+
|
69
|
+
function unixTimeToDate(unixtime) {
|
70
|
+
return new Date(unixtime * 1000);
|
71
|
+
}
|
72
|
+
|
73
|
+
function formatUnixDate(unixtime) {
|
74
|
+
var date;
|
75
|
+
date = unixTimeToDate(unixtime);
|
76
|
+
return date.toString("MMMM d, yyyy");
|
77
|
+
}
|
78
|
+
|
79
|
+
Try.these(function() {
|
80
|
+
|
81
|
+
/*
|
82
|
+
CALL OIB
|
83
|
+
|
84
|
+
global to every view. sends Ajax call to OtherInbox.
|
85
|
+
*/
|
86
|
+
|
87
|
+
// send an Ajax call to OtherInbox.
|
88
|
+
// takes as parameters:
|
89
|
+
// - the path to call
|
90
|
+
// - any additional query string params
|
91
|
+
// - a callback function to run when the Ajax call is a success
|
92
|
+
// - an optional error function
|
93
|
+
// - a base URL to use, if you don't want this call going to YAHOO.constants.base_url
|
94
|
+
// TODO refactor this function to take a second params hash where we could stick success_function, error_function, and base_url
|
95
|
+
|
96
|
+
YAHOO.oib.callOIB = function(oib_path, params, success_function, error_function, base_url) {
|
97
|
+
Debug.log("inside YAHOO.oib.call: ", {
|
98
|
+
"oib_path": oib_path,
|
99
|
+
"params": Object.toJSON(params)
|
100
|
+
});
|
101
|
+
var oib_url, method;
|
102
|
+
|
103
|
+
oib_url = base_url ? base_url : YAHOO.constants.base_url;
|
104
|
+
|
105
|
+
if (!(oib_path && typeof(oib_path) === "string")) {
|
106
|
+
throw("YAHOO.oib.callOIB must define oib_path");
|
107
|
+
}
|
108
|
+
if (!(params && typeof(params) === "object")) {
|
109
|
+
throw("YAHOO.oib.callOIB must define params");
|
110
|
+
}
|
111
|
+
|
112
|
+
oib_url = oib_url + oib_path;
|
113
|
+
method = "GET";
|
114
|
+
if (!params.format) {
|
115
|
+
params.format = 'json';
|
116
|
+
}
|
117
|
+
if (params.method) {
|
118
|
+
method = params.method;
|
119
|
+
delete params.method;
|
120
|
+
}
|
121
|
+
params.version = params.version || <%= @version %>;
|
122
|
+
Try.these(function() {
|
123
|
+
Debug.log("About to openmail.Application.callWebService: ", {
|
124
|
+
"url": oib_url + "?" + Object.toQueryString(params)
|
125
|
+
});
|
126
|
+
openmail.Application.callWebService(
|
127
|
+
{
|
128
|
+
url: oib_url,
|
129
|
+
method: method,
|
130
|
+
parameters: params
|
131
|
+
},
|
132
|
+
function(response) {
|
133
|
+
if (response.error) {
|
134
|
+
Debug.ajaxError("Error in YAHOO.oib.callOIB", oib_url, params, response);
|
135
|
+
if (error_function) {
|
136
|
+
error_function(response);
|
137
|
+
} else {
|
138
|
+
OIB.error(oib_url, params, response);
|
139
|
+
}
|
140
|
+
} else {
|
141
|
+
Try.these(function() {
|
142
|
+
success_function(response);
|
143
|
+
});
|
144
|
+
}
|
145
|
+
});
|
146
|
+
});
|
147
|
+
};
|
148
|
+
|
149
|
+
});
|
150
|
+
|
151
|
+
OIB = {
|
152
|
+
get: function(oib_path, params, success_function, error_function, base_url) {
|
153
|
+
params.method = "GET";
|
154
|
+
OIB.call(oib_path, params, success_function, error_function, base_url);
|
155
|
+
},
|
156
|
+
|
157
|
+
post: function(oib_path, params, success_function, error_function, base_url) {
|
158
|
+
params.method = "POST";
|
159
|
+
OIB.call(oib_path, params, success_function, error_function, base_url);
|
160
|
+
},
|
161
|
+
|
162
|
+
call: function(oib_path, params, success_function, error_function, base_url) {
|
163
|
+
var success;
|
164
|
+
|
165
|
+
success = function(response) {
|
166
|
+
response = YAHOO.lang.JSON.parse(response.data);
|
167
|
+
if (response.error) {
|
168
|
+
error_function(response);
|
169
|
+
} else {
|
170
|
+
success_function(response);
|
171
|
+
}
|
172
|
+
};
|
173
|
+
YAHOO.oib.callOIB(oib_path, params, success, error_function, base_url);
|
174
|
+
},
|
175
|
+
|
176
|
+
// overwrite this function locally if you need to
|
177
|
+
error: function(url, params, response) {
|
178
|
+
var message;
|
179
|
+
|
180
|
+
message = "OIB.error: " + Object.toJSON(response) + " calling url: " + url + "?" + Object.toQueryString(params);
|
181
|
+
Debug.error(message);
|
182
|
+
// Logger.error(message);
|
183
|
+
}
|
184
|
+
};
|
185
|
+
|
186
|
+
|
187
|
+
YAHOO.oib.showError = function() {
|
188
|
+
$('main').hide();
|
189
|
+
$('utility').show();
|
190
|
+
$('loading').hide();
|
191
|
+
$('error').show();
|
192
|
+
};
|
193
|
+
|
194
|
+
YAHOO.oib.showLoading = function() {
|
195
|
+
$('main').hide();
|
196
|
+
$('utility').show();
|
197
|
+
$('error').hide();
|
198
|
+
$('loading').show();
|
199
|
+
};
|
200
|
+
|
201
|
+
Try.these(function() {
|
202
|
+
|
203
|
+
// gets the guid from the Yahoo! environment and executes the success callback
|
204
|
+
// if there is a guid, and the error callback if it's undefined
|
205
|
+
//
|
206
|
+
// YAHOO.oib.guid
|
207
|
+
//
|
208
|
+
YAHOO.oib.getGuid = function(success_function, error_function) {
|
209
|
+
openmail.Application.getParameters(function(response) {
|
210
|
+
YAHOO.oib.guid = response.user.guid;
|
211
|
+
if (YAHOO.oib.guid !== undefined) {
|
212
|
+
Try.these(
|
213
|
+
function() { success_function(YAHOO.oib.guid); }
|
214
|
+
);
|
215
|
+
}
|
216
|
+
else {
|
217
|
+
Try.these(error_function);
|
218
|
+
}
|
219
|
+
});
|
220
|
+
};
|
221
|
+
});
|
222
|
+
|
223
|
+
Try.these(function() {
|
224
|
+
|
225
|
+
// gets the ymail_wssid from the permanent store and executes the callback function
|
226
|
+
// if there is a ymail_wssid, and the error callback if it's undefined
|
227
|
+
//
|
228
|
+
// YAHOO.oib.ymail_wssid
|
229
|
+
//
|
230
|
+
YAHOO.oib.getYmailWssid = function(success_function, error_function) {
|
231
|
+
openmail.Application.getData({keys: ["ymail_wssid"]}, function(response) {
|
232
|
+
YAHOO.oib.ymail_wssid = response.data.ymail_wssid;
|
233
|
+
if (YAHOO.oib.ymail_wssid !== undefined) {
|
234
|
+
Try.these(
|
235
|
+
function() { success_function(YAHOO.oib.ymail_wssid); }
|
236
|
+
);
|
237
|
+
}
|
238
|
+
else {
|
239
|
+
Try.these(error_function);
|
240
|
+
}
|
241
|
+
});
|
242
|
+
};
|
243
|
+
|
244
|
+
});
|
245
|
+
|
246
|
+
Try.these(function() {
|
247
|
+
|
248
|
+
// gets both guid and ymail_wssid and stores them then runs the callback_function
|
249
|
+
//
|
250
|
+
// YAHOO.oib.ymail_wssid
|
251
|
+
// YAHOO.oib.guid
|
252
|
+
//
|
253
|
+
YAHOO.oib.getGuidAndYmailWssid = function(callback_function) {
|
254
|
+
YAHOO.oib.getGuid(function(guid) {
|
255
|
+
YAHOO.oib.getYmailWssid(function(ymail_wssid) {
|
256
|
+
Try.these(
|
257
|
+
function() {callback_function(guid, ymail_wssid); }
|
258
|
+
);
|
259
|
+
});
|
260
|
+
});
|
261
|
+
};
|
262
|
+
|
263
|
+
|
264
|
+
});
|
265
|
+
|
266
|
+
Try.these(function() {
|
267
|
+
|
268
|
+
// gets user's state info from /ymdp/state
|
269
|
+
// including the user's OIB login
|
270
|
+
//
|
271
|
+
YAHOO.oib.getUserState = function(success_function) {
|
272
|
+
YAHOO.oib.callOIB("ymdp/state", {}, function(response) {
|
273
|
+
response = YAHOO.lang.JSON.parse(response.data);
|
274
|
+
YAHOO.oib.response = response;
|
275
|
+
YAHOO.oib.login = response.login;
|
276
|
+
YAHOO.oib.state = response.state;
|
277
|
+
|
278
|
+
if (success_function !== undefined) {
|
279
|
+
success_function(response);
|
280
|
+
}
|
281
|
+
},
|
282
|
+
function() {
|
283
|
+
YAHOO.logger.error("Failed to get user's state");
|
284
|
+
});
|
285
|
+
};
|
286
|
+
|
287
|
+
|
288
|
+
});
|
289
|
+
|
290
|
+
Try.these(function() {
|
291
|
+
|
292
|
+
/*
|
293
|
+
YAHOO.oib.verifyUser
|
294
|
+
|
295
|
+
global to all views. calls the 'verify' action on ymdp controller and executes
|
296
|
+
a function with the result.
|
297
|
+
*/
|
298
|
+
YAHOO.oib.verifyUser = function(success_function) {
|
299
|
+
YAHOO.oib.callOIB("ymdp/verify", {
|
300
|
+
ymail_guid: YAHOO.oib.guid,
|
301
|
+
ymail_wssid: YAHOO.oib.ymail_wssid
|
302
|
+
}, function(response) {
|
303
|
+
YAHOO.oib.user = YAHOO.lang.JSON.parse(response.data);
|
304
|
+
if (success_function !== undefined) {
|
305
|
+
success_function(YAHOO.oib.user);
|
306
|
+
}
|
307
|
+
});
|
308
|
+
};
|
309
|
+
|
310
|
+
|
311
|
+
/*
|
312
|
+
AUTHENTICATION
|
313
|
+
|
314
|
+
*/
|
315
|
+
|
316
|
+
});
|
317
|
+
|
318
|
+
Try.these(function() {
|
319
|
+
|
320
|
+
YAHOO.oib.signInUser = function() {
|
321
|
+
YAHOO.oib.callOIB("ymdp/signin", {}, function(response) {
|
322
|
+
YAHOO.oib.response = YAHOO.lang.JSON.parse(response.data);
|
323
|
+
|
324
|
+
if (YAHOO.oib.response.ymail_wssid === "false") {
|
325
|
+
// signin didn't work properly, display an error
|
326
|
+
YAHOO.showError();
|
327
|
+
} else {
|
328
|
+
// store ymail_wssid in permanent store
|
329
|
+
openmail.Application.setData({keys : {ymail_wssid: YAHOO.oib.response.ymail_wssid}});
|
330
|
+
YAHOO.oib.ymail_wssid = YAHOO.oib.response.ymail_wssid;
|
331
|
+
|
332
|
+
YAHOO.oib.verifyUser(YAHOO.launcher.launchSettings);
|
333
|
+
}
|
334
|
+
});
|
335
|
+
};
|
336
|
+
|
337
|
+
});
|
338
|
+
|
339
|
+
YAHOO.oib.clearPermanentStore = function() {
|
340
|
+
openmail.Application.setData({keys : {ymail_wssid: null}});
|
341
|
+
YAHOO.oib.guid = null;
|
342
|
+
YAHOO.oib.ymail_wssid = null;
|
343
|
+
};
|
344
|
+
|
345
|
+
|
346
|
+
YAHOO.oib.setTimeoutInSeconds = function(callback_function, interval) {
|
347
|
+
setTimeout(callback_function, interval * 1000);
|
348
|
+
};
|
349
|
+
|
350
|
+
YAHOO.oib.deactivateUser = function() {
|
351
|
+
YAHOO.oib.getGuidAndYmailWssid(function() {
|
352
|
+
var guid, ymail_wssid;
|
353
|
+
|
354
|
+
guid = YAHOO.oib.guid;
|
355
|
+
ymail_wssid = YAHOO.oib.ymail_wssid;
|
356
|
+
|
357
|
+
YAHOO.oib.clearPermanentStore();
|
358
|
+
|
359
|
+
OIB.post("/ymdp/deactivate", {
|
360
|
+
ymail_guid: guid,
|
361
|
+
ymail_wssid: ymail_wssid
|
362
|
+
},
|
363
|
+
function(response) {
|
364
|
+
// YAHOO.logger.info("Finished deactivating user");
|
365
|
+
if ("<%= @view %>" !== "deactivate") {
|
366
|
+
YAHOO.launcher.launchGoodbye();
|
367
|
+
}
|
368
|
+
});
|
369
|
+
});
|
370
|
+
};
|
371
|
+
|
372
|
+
|
373
|
+
YAHOO.oib.submitForm = function(url, form_name, success_function, error_function) {
|
374
|
+
Try.these(function() {
|
375
|
+
$('submit_link').hide();
|
376
|
+
$('submit_spinner').show();
|
377
|
+
});
|
378
|
+
|
379
|
+
var form_id, params;
|
380
|
+
|
381
|
+
form_id = form_name + "_form";
|
382
|
+
|
383
|
+
params = {};
|
384
|
+
params["method"] = "POST";
|
385
|
+
params[form_name] = Object.toJSON($(form_id).serialize(true));
|
386
|
+
|
387
|
+
YAHOO.oib.callOIB(url, params, success_function,
|
388
|
+
function(response) {
|
389
|
+
Try.these(function() {
|
390
|
+
$('submit_spinner').hide();
|
391
|
+
$('submit_link').show();
|
392
|
+
});
|
393
|
+
|
394
|
+
YAHOO.flash.t.error('PROBLEM_SUBMITTING', 'settings');
|
395
|
+
YAHOO.logger.error("Error submitting params: " + Object.toJSON(params) + " Error: " + Object.toJSON(response.error));
|
396
|
+
}
|
397
|
+
);
|
398
|
+
return false;
|
399
|
+
};
|
400
|
+
|
401
|
+
|
402
|
+
YAHOO.oib.showTranslations = function() {
|
403
|
+
Debug.log("begin YAHOO.oib.showTranslations");
|
404
|
+
Try.these(YAHOO.init.translateToolbar);
|
405
|
+
Try.these(YAHOO.init.translateFooter);
|
406
|
+
Try.these(I18n.findAndTranslateAll);
|
407
|
+
|
408
|
+
// define I18n.localTranslations in the view template
|
409
|
+
Try.these(I18n.localTranslations);
|
410
|
+
|
411
|
+
Debug.log("end YAHOO.oib.showTranslations");
|
412
|
+
};
|
413
|
+
|
414
|
+
/*
|
415
|
+
|
416
|
+
INITIALIZER CODE
|
417
|
+
|
418
|
+
*/
|
419
|
+
|
420
|
+
YAHOO.namespace("init");
|
421
|
+
|
422
|
+
// Adds behaviors/observers to elements on the page
|
423
|
+
//
|
424
|
+
YAHOO.init.addBehaviors = function() {
|
425
|
+
// overwrite this function locally
|
426
|
+
};
|
427
|
+
|
428
|
+
// hide the loading screen and show the main body of the summary
|
429
|
+
YAHOO.init.show = function() {
|
430
|
+
$('utility').hide();
|
431
|
+
$('error').hide();
|
432
|
+
$('loading').hide();
|
433
|
+
$('main').show();
|
434
|
+
};
|
435
|
+
|
436
|
+
|
437
|
+
// Local initializer. When your page starts up, this method will be called after fetching the user's guid and ymail wssid.
|
438
|
+
//
|
439
|
+
YAHOO.init.local = function() {
|
440
|
+
alert("This hasn't been overwritten.");
|
441
|
+
// overwrite this function locally
|
442
|
+
};
|
443
|
+
|
444
|
+
// To be run before any other initializers have run.
|
445
|
+
//
|
446
|
+
YAHOO.init.before = function() {
|
447
|
+
// overwrite this function locally
|
448
|
+
};
|
449
|
+
|
450
|
+
// Main startup code. Overwrite this function to execute after YAHOO.init.before and before YAHOO.init.after.
|
451
|
+
//
|
452
|
+
YAHOO.init.startup = function() {
|
453
|
+
Debug.log("init.startup");
|
454
|
+
// gets the user
|
455
|
+
YAHOO.oib.getGuid(function(guid) {
|
456
|
+
Debug.log("inside getGuid callback");
|
457
|
+
YAHOO.oib.getUserState(function(response) {
|
458
|
+
Debug.log("inside getUserState callback");
|
459
|
+
Try.these(YAHOO.init.local);
|
460
|
+
});
|
461
|
+
});
|
462
|
+
};
|
463
|
+
|
464
|
+
YAHOO.init.abTesting = function() {
|
465
|
+
// to enable abTesting in your view, overwrite this file locally.
|
466
|
+
//
|
467
|
+
// be sure to finish your post-Ajax callback with YAHOO.init.show()
|
468
|
+
//
|
469
|
+
Try.these(YAHOO.init.show);
|
470
|
+
Try.these(YAHOO.init.after);
|
471
|
+
};
|
472
|
+
|
473
|
+
// Finishing code. Runs after startup, executes translations and behaviors. Shows the page and then
|
474
|
+
// runs the A/B testing callback, which in turn will execute the last callbacks.
|
475
|
+
//
|
476
|
+
YAHOO.init.finish = function() {
|
477
|
+
Debug.info("init.finish for view <%= @view %>");
|
478
|
+
Try.these(YAHOO.oib.showTranslations);
|
479
|
+
Try.these(YAHOO.init.addBehaviors);
|
480
|
+
Try.these(YAHOO.init.abTesting);
|
481
|
+
YAHOO.oib.page_loaded = true;
|
482
|
+
Debug.info("finished init.finish for view <%= @view %>");
|
483
|
+
};
|
484
|
+
|
485
|
+
// Post-initalizer. Very last thing that runs, after content has been shown.
|
486
|
+
//
|
487
|
+
YAHOO.init.after = function() {
|
488
|
+
// overwrite this function locally
|
489
|
+
};
|
490
|
+
|
491
|
+
// Execute the before, startup and after methods. Do not overwrite. (Change YAHOO.init.startup to create a custom initializer.)
|
492
|
+
YAHOO.oib.init = function() {
|
493
|
+
// Debug.profile("loading");
|
494
|
+
Debug.info("OIB.init for view <%= @view %>", "<%= @message %>");
|
495
|
+
try {
|
496
|
+
YAHOO.init.resources();
|
497
|
+
I18n.addLanguageToBody();
|
498
|
+
I18n.translateLoading();
|
499
|
+
I18n.translateError();
|
500
|
+
YAHOO.init.before();
|
501
|
+
YAHOO.init.startup();
|
502
|
+
} catch(err_f) {
|
503
|
+
YAHOO.oib.showError();
|
504
|
+
Debug.error("Error in YAHOO.oib.init", err_f);
|
505
|
+
}
|
506
|
+
};
|
507
|
+
|
508
|
+
YAHOO.init.resources = function() {
|
509
|
+
Debug.log("about to call I18n.setResources");
|
510
|
+
|
511
|
+
I18n.assets_path = "<%= @assets_path %>/yrb";
|
512
|
+
|
513
|
+
I18n.availableLanguages = <%= supported_languages.to_json %>;
|
514
|
+
|
515
|
+
I18n.currentLanguage = OpenMailIntl.findBestLanguage(I18n.availableLanguages);
|
516
|
+
|
517
|
+
I18n.setResources();
|
518
|
+
|
519
|
+
Debug.log("finished calling I18n.setResources");
|
520
|
+
};
|
521
|
+
|
522
|
+
// Contains the last two callbacks, to show the page contents and run post-show function. Do not overwrite.
|
523
|
+
YAHOO.init.showAndFinish = function() {
|
524
|
+
Debug.log("YAHOO.init.showAndFinish");
|
525
|
+
YAHOO.init.show();
|
526
|
+
YAHOO.init.after();
|
527
|
+
};
|
528
|
+
|
529
|
+
YAHOO.init.translateToolbar = function() {
|
530
|
+
Debug.log("begin YAHOO.init.translateToolbar");
|
531
|
+
Try.these(function() {
|
532
|
+
I18n.update('help_link', 'HELP');
|
533
|
+
I18n.update('settings_link', 'SETTINGS');
|
534
|
+
I18n.update('identity_link', 'IDENTITY');
|
535
|
+
});
|
536
|
+
Try.these(YAHOO.init.translateGreeting);
|
537
|
+
Try.these(YAHOO.init.translateSubhead);
|
538
|
+
Debug.log("end YAHOO.init.translateToolbar");
|
539
|
+
};
|
540
|
+
|
541
|
+
YAHOO.init.translateGreeting = function() {
|
542
|
+
Debug.log("begin YAHOO.init.translateGreeting");
|
543
|
+
var username;
|
544
|
+
username = YAHOO.oib.login;
|
545
|
+
I18n.update('greeting', 'GREETING', [username]);
|
546
|
+
};
|
547
|
+
|
548
|
+
YAHOO.init.translateSubhead = function() {
|
549
|
+
try {
|
550
|
+
var total_organized_messages, formatted_date;
|
551
|
+
|
552
|
+
total_organized_messages = Try.these(function() {
|
553
|
+
return YAHOO.oib.response.total_organized_messages;
|
554
|
+
}
|
555
|
+
);
|
556
|
+
|
557
|
+
formatted_date = Try.these(function() {
|
558
|
+
var since_date;
|
559
|
+
since_date = YAHOO.oib.response.since_date.s;
|
560
|
+
return formatUnixDate(since_date);
|
561
|
+
});
|
562
|
+
|
563
|
+
if (total_organized_messages && formatted_date) {
|
564
|
+
I18n.update('toolbar_subhead', 'TOOLBAR_SUBHEAD', [total_organized_messages, formatted_date]);
|
565
|
+
}
|
566
|
+
} catch(err) {
|
567
|
+
Debug.log("error in YAHOO.init.translateSubhead: " + err);
|
568
|
+
}
|
569
|
+
};
|
570
|
+
|
571
|
+
|
572
|
+
YAHOO.init.translateFooter = function() {
|
573
|
+
I18n.update('copyright', 'COPYRIGHT');
|
574
|
+
I18n.update('about_link', 'ABOUT');
|
575
|
+
I18n.update('support_link', 'SUPPORT');
|
576
|
+
I18n.update('contact_link', 'CONTACT');
|
577
|
+
I18n.update('privacy_link', 'PRIVACY');
|
578
|
+
I18n.update('terms_and_conditions_link', 'TERMS_AND_CONDITIONS');
|
579
|
+
};
|
580
|
+
|