Commit 6db46ab48e24f08d5f7592b4dbddfeb01d8bd1ce

Authored by AntonioTerceiro
1 parent 35943bbb

ActionItem93: removing stuff left by comatose



git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@957 3f533792-8f58-4932-b0fe-aaf55b0a4547
public/images/comatose/collapsed.gif

176 Bytes

public/images/comatose/expanded.gif

181 Bytes

public/images/comatose/no-children.gif

51 Bytes

public/images/comatose/page.gif

471 Bytes

public/images/comatose/spinner.gif

2.44 KB

public/images/comatose/title-hover-bg.gif

1.2 KB

public/javascripts/comatose_admin.js
... ... @@ -1,424 +0,0 @@
1   -// CSS Browser Selector v0.2.3b (M@: added noscript support)
2   -// Documentation: http://rafael.adm.br/css_browser_selector
3   -// License: http://creativecommons.org/licenses/by/2.5/
4   -// Author: Rafael Lima (http://rafael.adm.br)
5   -// Contributors: http://rafael.adm.br/css_browser_selector#contributors
6   -var css_browser_selector = function() {
7   - var
8   - ua = navigator.userAgent.toLowerCase(),
9   - is = function(t){ return ua.indexOf(t) != -1; },
10   - h = document.getElementsByTagName('html')[0],
11   - b = (!(/opera|webtv/i.test(ua)) && /msie (\d)/.test(ua)) ? ((is('mac') ? 'ieMac ' : '') + 'ie ie' + RegExp.$1)
12   - : is('gecko/') ? 'gecko' : is('opera') ? 'opera' : is('konqueror') ? 'konqueror' : is('applewebkit/') ? 'webkit safari' : is('mozilla/') ? 'gecko' : '',
13   - os = (is('x11') || is('linux')) ? ' linux' : is('mac') ? ' mac' : is('win') ? ' win' : '';
14   - var c = b+os+' js';
15   - h.className = h.className.replace('noscript', '') + h.className?' '+c:c;
16   -}();
17   -
18   -// List View Functions
19   -var ComatoseList = {
20   - save_node_state: true,
21   - state_store: 'cookie', // Only 'cookie' for now
22   - state_key: 'ComatoseTreeState',
23   -
24   - init: function() {
25   - var items = ComatoseList._read_state();
26   - items.each(function(node){
27   - ComatoseList.expand_node(node.replace('page_controller_', ''))
28   - });
29   - },
30   -
31   - toggle_tree_nodes : function(img, id) {
32   - if(/expanded/.test(img.src)) {
33   - $('page_list_'+ id).addClassName('collapsed');
34   - img.src = img.src.replace(/expanded/, 'collapsed')
35   - if(ComatoseList.save_node_state) {
36   - var items = ComatoseList._read_state();
37   - items = items.select(function(id){ return id != img.id; })
38   - ComatoseList._write_state(items);
39   - }
40   - } else {
41   - $('page_list_'+ id).removeClassName('collapsed');
42   - img.src = img.src.replace(/collapsed/, 'expanded')
43   - if(ComatoseList.save_node_state) {
44   - var items = ComatoseList._read_state();
45   - items.push(img.id);
46   - ComatoseList._write_state(items);
47   - }
48   - }
49   - },
50   -
51   - expand_node: function(id) {
52   - $('page_list_'+ id).removeClassName('collapsed');
53   - $('page_controller_'+ id).src = $('page_controller_'+ id).src.replace(/collapsed/, 'expanded')
54   - },
55   -
56   - collapse_node: function(id) {
57   - $('page_list_'+ id).addClassName('collapsed');
58   - $('page_controller_'+ id).src = $('page_controller_'+ id).src.replace(/expanded/, 'collapsed')
59   - },
60   -
61   - item_hover : function(node, state, is_delete) {
62   - if( state == 'over') {
63   - $(node).addClassName( (is_delete) ? 'hover-delete' : 'hover' );
64   - } else {
65   - $(node).removeClassName( (is_delete) ? 'hover-delete' : 'hover' );
66   - }
67   - },
68   -
69   - toggle_reorder: function(node, anc, id, reorder_text, finished_text) {
70   - if( $(node).hasClassName('do-reorder') ) {
71   - $(node).removeClassName( 'do-reorder' );
72   - $(anc).removeClassName('reordering');
73   - $(anc).innerHTML = reorder_text;
74   - } else {
75   - $(node).addClassName( 'do-reorder' );
76   - $(anc).addClassName('reordering');
77   - $(anc).innerHTML = finished_text;
78   - // Make sure the children are visible...
79   - ComatoseList.expand_node(id);
80   - }
81   - },
82   -
83   - _write_state: function(items) {
84   - var cookie = {}; var options = {}; var expiration = new Date();
85   - cookie[ ComatoseList.state_key ] = items.join(',');
86   - expiration.setDate(expiration.getDate()+30)
87   - options['expires'] = expiration;
88   - Cookie.write( cookie, options );
89   - },
90   -
91   - _read_state: function() {
92   - var state = Cookie.read( ComatoseList.state_key );
93   - return (state != "" && state != null) ? state.split(',') : [];
94   - }
95   -}
96   -
97   -// Edit Form Functions
98   -var ComatoseEditForm = {
99   -
100   - default_data: {},
101   - last_preview: {},
102   - last_title_slug: '',
103   - mode : null,
104   - liquid_horiz: false, // changed from true to false by terceiro
105   - width_offset: 325,
106   -
107   - // Initialize the page...
108   - init : function(mode) {
109   - this.mode = mode;
110   - this.default_data = Form.serialize(document.forms[0]);
111   - if(mode == 'new') {
112   - this.last_title_slug = $('page_title').value.toSlug();
113   - Event.observe('page_title', 'blur', ComatoseEditForm.title_updated_aggressive);
114   - } else {
115   - Event.observe('page_title', 'blur', ComatoseEditForm.title_updated);
116   - }
117   - $('page_title').focus();
118   - Hide.these(
119   - 'preview-area',
120   - 'slug_row',
121   - 'parent_row',
122   - 'keywords_row',
123   - 'filter_row',
124   - 'created_row'
125   - );
126   - $('page_title').select();
127   - // Create the horizontal liquidity of the fields
128   - if(this.liquid_horiz) {
129   - xOffset = this.width_offset;
130   - new Layout.LiquidHoriz((xOffset + 50), 'page_title');
131   - new Layout.LiquidHoriz(xOffset, 'page_slug','page_keywords','page_parent','page_body');
132   - }
133   - },
134   - // For use when updating an existing page...
135   - title_updated : function() {
136   - slug = $('page_slug');
137   - if(slug.value == "") {
138   - title = $('page_title');
139   - slug.value = title.value.toSlug();
140   - }
141   - },
142   - // For use when creating a new page...
143   - title_updated_aggressive : function() {
144   - slug = $('page_slug');
145   - title = $('page_title');
146   - if(slug.value == "" || slug.value == this.last_title ) {
147   - slug.value = title.value.toSlug();
148   - }
149   - this.last_title = slug.value;
150   - },
151   - // Todo: Make the meta fields remember their visibility?
152   - toggle_extra_fields : function(anchor, more_label, less_label) {
153   - if(anchor.innerHTML == more_label) {
154   - Show.these(
155   - 'slug_row',
156   - 'keywords_row',
157   - 'parent_row',
158   - 'filter_row',
159   - 'created_row'
160   - );
161   - anchor.innerHTML = less_label;
162   - } else {
163   - Hide.these(
164   - 'slug_row',
165   - 'keywords_row',
166   - 'parent_row',
167   - 'filter_row',
168   - 'created_row'
169   - );
170   - anchor.innerHTML = more_label;
171   - }
172   - },
173   - // Uses server to create preview of content...
174   - preview_content : function(preview_url, preview_label) {
175   - $('preview-area').show();
176   - var params = Form.serialize(document.forms[0]);
177   - if( params != this.last_preview ) {
178   - $('preview-panel').innerHTML = "<span style='color:blue;'>" + preview_label + "</span>";
179   - new Ajax.Updater(
180   - 'preview-panel',
181   - preview_url,
182   - { parameters: params }
183   - );
184   - }
185   - this.last_preview = params;
186   - },
187   - cancel : function(url, cancel_warning) {
188   - var current_data = Form.serialize(document.forms[0]);
189   - var data_changed = (this.default_data != current_data)
190   - if(data_changed) {
191   - if( confirm(cancel_warning) ) {
192   - location.href = url;
193   - }
194   - } else {
195   - location.href = url;
196   - }
197   -
198   - }
199   -}
200   -
201   -var Hide = {
202   - these : function() {
203   - for (var i = 0; i < arguments.length; i++) {
204   - try {
205   - $(arguments[i]).hide();
206   - } catch (e) {}
207   - }
208   - }
209   -}
210   -
211   -var Show = {
212   - these : function() {
213   - for (var i = 0; i < arguments.length; i++) {
214   - try {
215   - $(arguments[i]).show();
216   - } catch (e) {}
217   - }
218   - }
219   -}
220   -
221   -// Layout namespace
222   -var Layout = {};
223   -
224   -// This class allows dom objects to stretch with the browser
225   -// (for when a good, cross-browser, CSS approach can't be found)
226   -Layout.LiquidBase = Class.create();
227   -// Base class for all Liquid* layouts...
228   -Object.extend(Layout.LiquidBase.prototype, {
229   - enabled: true,
230   - elems: [],
231   - offset: null,
232   - // Constructor is (offset, **array_of_elements)
233   - initialize: function() {
234   - args = $A(arguments)
235   - this.offset = args.shift();
236   - this.elems = args.select( function(elem){ return ($(elem) != null) } );
237   - if( this.elems.length > 0 ) {
238   - this.on_resize(); // Initial size
239   - Event.observe(window, 'resize', this.on_resize.bind(this) );
240   - Event.observe(window, 'load', this.on_resize.bind(this) );
241   - }
242   - },
243   - resize_in: function(timeout) {
244   - setTimeout( this.on_resize.bind(this), timeout );
245   - },
246   - on_resize: function() {
247   - // Need to override!
248   - alert('Override on_resize, please!');
249   - }
250   -});
251   -
252   -
253   -// Liquid vertical layout
254   -Layout.LiquidVert = Class.create();
255   -Object.extend(Layout.LiquidVert.prototype, Object.extend(Layout.LiquidBase.prototype, {
256   - on_resize: function() {
257   - if( this.offset != null && this.enabled ) {
258   - var new_height = ((window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight) - this.offset) +"px";
259   - this.elems.each(function(e){ $(e).style.height = new_height; })
260   - }
261   - }
262   -}) );
263   -
264   -
265   -// Liquid horizontal layout
266   -Layout.LiquidHoriz = Class.create();
267   -Object.extend(Layout.LiquidHoriz.prototype, Object.extend(Layout.LiquidBase.prototype, {
268   - on_resize: function() {
269   - if( this.offset != null && this.enabled ) {
270   - var new_width = ((window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) - this.offset) +"px";
271   - this.elems.each( function(e){ $(e).style.width = new_width; })
272   - }
273   - }
274   -}) );
275   -
276   -// String Extensions... Yes, these are from Radiant! ;-)
277   -Object.extend(String.prototype, {
278   - upcase: function() {
279   - return this.toUpperCase();
280   - },
281   - downcase: function() {
282   - return this.toLowerCase();
283   - },
284   - strip: function() {
285   - return this.replace(/^\s+/, '').replace(/\s+$/, '');
286   - },
287   - toInteger: function() {
288   - return parseInt(this);
289   - },
290   - toSlug: function() {
291   - // M@: Modified from Radiant's version, removes multple --'s next to each other
292   - // This is the same RegExp as the one on the page model...
293   - return this.strip().transliterate().downcase().replace(/[^-a-z0-9~\s\.:;+=_]/g, '').replace(/[\s\.:;=_+]+/g, '-').replace(/[\-]{2,}/g, '-');
294   - },
295   - transliterate: function() {
296   - var substitutions = [
297   - { from: [ 'Á', 'À', 'À', 'Â', 'Ã', 'Ä' ], to: 'A' },
298   - { from: [ 'á', 'à', 'à', 'â', 'ã', 'ä', 'ª' ], to: 'a' },
299   - { from: [ 'É', 'È', 'Ê', 'Ë' ], to: 'E' },
300   - { from: [ 'é', 'è', 'ê', 'ë' ], to: 'e' },
301   - { from: [ 'Í', 'Ì', 'Î', 'Ï' ], to: 'I' },
302   - { from: [ 'í', 'ì', 'î', 'ï' ], to: 'i' },
303   - { from: [ 'Ó', 'Ò', 'Ô', 'Ö', 'Õ', 'º' ], to: 'O' },
304   - { from: [ 'ó', 'ò', 'ô', 'ö', 'õ', 'º' ], to: 'o' },
305   - { from: [ 'Ú', 'Ù', 'Û', 'Ü' ], to: 'U' },
306   - { from: [ 'ú', 'ù', 'û', 'ü' ], to: 'u' },
307   - { from: [ 'Ç' ], to: 'C' },
308   - { from: [ 'ç' ], to: 'c' },
309   - { from: [ 'Ñ' ], to: 'N' },
310   - { from: [ 'ñ' ], to: 'n' },
311   - { from: [ 'Ÿ' ], to: 'Y' },
312   - { from: [ 'ÿ' ], to: 'y' },
313   - ]
314   - var res = this;
315   - for (i in substitutions) { for (from in substitutions[i].from) { res = res.replace(substitutions[i].from[from], substitutions[i].to); } };
316   - return res;
317   - }
318   -});
319   -
320   -// Run a spinner when an AJAX request in running...
321   -var ComatoseAJAXSpinner = {
322   - busy : function () {
323   - if($('spinner') && Ajax.activeRequestCount > 0) {
324   - Effect.Appear('spinner',{duration:0.5,queue:'end'});
325   - }
326   - },
327   -
328   - notBusy: function() {
329   - if($('spinner') && Ajax.activeRequestCount == 0) {
330   - Effect.Fade('spinner',{duration:0.5,queue:'end'});
331   - }
332   - }
333   -}
334   -// Register it with Prototype...
335   -Ajax.Responders.register({
336   - onCreate: ComatoseAJAXSpinner.busy,
337   - onComplete: ComatoseAJAXSpinner.notBusy
338   -});
339   -
340   -
341   -if(!window.Cookie)
342   - (function (){
343   - // From Mephisto!
344   - window.Cookie = {
345   - version: '0.7',
346   - cookies: {},
347   - _each: function(iterator) {
348   - $H(this.cookies).each(iterator);
349   - },
350   -
351   - getAll: function() {
352   - this.cookies = {};
353   - $A(document.cookie.split('; ')).each(function(cookie) {
354   - var seperator = cookie.indexOf('=');
355   - this.cookies[cookie.substring(0, seperator)] =
356   - unescape(cookie.substring(seperator + 1, cookie.length));
357   - }.bind(this));
358   - return this.cookies;
359   - },
360   -
361   - read: function() {
362   - var cookies = $A(arguments), results = [];
363   - this.getAll();
364   - cookies.each(function(name) {
365   - if (this.cookies[name]) results.push(this.cookies[name]);
366   - else results.push(null);
367   - }.bind(this));
368   - return results.length > 1 ? results : results[0];
369   - },
370   -
371   - write: function(cookies, options) {
372   - if (cookies.constructor == Object && cookies.name) cookies = [cookies];
373   - if (cookies.constructor == Array) {
374   - $A(cookies).each(function(cookie) {
375   - this._write(cookie.name, cookie.value, cookie.expires,
376   - cookie.path, cookie.domain);
377   - }.bind(this));
378   - } else {
379   - options = options || {expires: false, path: '', domain: ''};
380   - for (name in cookies){
381   - this._write(name, cookies[name],
382   - options.expires, options.path, options.domain);
383   - }
384   - }
385   - },
386   -
387   - _write: function(name, value, expires, path, domain) {
388   - if (name.indexOf('=') != -1) return;
389   - var cookieString = name + '=' + escape(value);
390   - if (expires) cookieString += '; expires=' + expires.toGMTString();
391   - if (path) cookieString += '; path=' + path;
392   - if (domain) cookieString += '; domain=' + domain;
393   - document.cookie = cookieString;
394   - },
395   -
396   - erase: function(cookies) {
397   - var cookiesToErase = {};
398   - $A(arguments).each(function(cookie) {
399   - cookiesToErase[cookie] = '';
400   - });
401   -
402   - this.write(cookiesToErase, {expires: (new Date((new Date()).getTime() - 1e11))});
403   - this.getAll();
404   - },
405   -
406   - eraseAll: function() {
407   - this.erase.apply(this, $H(this.getAll()).keys());
408   - }
409   - };
410   -
411   - Object.extend(Cookie, {
412   - get: Cookie.read,
413   - set: Cookie.write,
414   -
415   - add: Cookie.read,
416   - remove: Cookie.erase,
417   - removeAll: Cookie.eraseAll,
418   -
419   - wipe: Cookie.erase,
420   - wipeAll: Cookie.eraseAll,
421   - destroy: Cookie.erase,
422   - destroyAll: Cookie.eraseAll
423   - });
424   - })();