Added MD5 encoding methods
[ajatus.git] / js / ajatus.types.js
blob9b7c15941fa11f9120d8939252275a45820e8b04
1 /*
2  * This file is part of
3  *
4  * Ajatus - Distributed CRM
5  * @requires jQuery v1.2.1
6  * 
7  * Copyright (c) 2007 Jerry Jalava <jerry.jalava@gmail.com>
8  * Copyright (c) 2007 Nemein Oy <http://nemein.com>
9  * Website: http://ajatus.info
10  * Licensed under the GPL license
11  * http://www.gnu.org/licenses/gpl.html
12  * 
13  */
15 (function($){
16     $.ajatus = $.ajatus || {};
18     $.ajatus.types = {};
20     $.ajatus.types.init = function(on_ready)
21     {
22         if (typeof on_ready != 'function') {
23             var on_ready = function(){return;};
24         }
25         
26         $.ajatus.events.named_lock_pool.increase('init_types');
27         $.ajatus.extensions.lock = new $.ajatus.events.lock({
28                 watch: {
29                     validate: function(){return $.ajatus.events.named_lock_pool.count('init_types') == 0;},
30                     interval: 200,
31                 safety_runs: 0
32                 },
33                 on_release: on_ready
34             });
35             
36         $.each($.ajatus.preferences.client.types.system, function(i,type){
37             var type_url = $.ajatus.preferences.client.application_url + 'js/content_types/'+type+'.js';
38             
39             $.ajatus.events.named_lock_pool.increase('init_types');
40             
41             $.ajatus.utils.load_script(type_url, "$.ajatus.types.type_loaded", [type]);
42         });
44         $.each($.ajatus.preferences.client.types.in_use, function(i,type){
45             var type_url = $.ajatus.preferences.client.application_url + 'js/content_types/'+type+'.js';
46             
47             $.ajatus.events.named_lock_pool.increase('init_types');
48             
49             $.ajatus.utils.load_script(type_url, "$.ajatus.types.type_loaded", [type]);
50         });        
52         $.ajatus.events.named_lock_pool.decrease('init_types');
53     }
54     
55     $.ajatus.types.type_loaded = function(type)
56     {
57         // $.ajatus.preferences.client.content_types[type] = new $.ajatus.content_type[type]();
58         
59         $.ajatus.events.named_lock_pool.decrease('init_types');
60     }
61     
62 })(jQuery);