source: trunk/instant_messenger/js/im_templates.js @ 81

Revision 81, 10.7 KB checked in by niltonneto, 16 years ago (diff)

Atualização do CVS Interno com CVS Externo.
Modificações, vide changelog no arquivo changelog.txt ou no site do Expresso.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1/**
2* @AUTHOR: Alexandre Correia / Rodrigo Souza
3* @DATE: 2006/10/24 17:03:00
4* @LAST CHANGE: Seg 11 Dez 2006 10:21:34 BRST::
5* Instant Messenger
6* im_templates.js
7**/
8
9        function Templates(){
10
11                this.element    = document.getElementById("im_expresso");
12                this.form               = "";
13                this.time_set   = "";
14                this.transfer   = 0;
15                this.arquivo    = "";
16        }
17
18   /*
19        * Conf forms
20        */
21
22        Templates.prototype.conf_form = function(pName,pWidth,pHeight,pHTML,pTitle)
23        {
24             var params = new Array();
25         params['body'] = pHTML;
26         params['height'] = pHeight;
27         params['id'] = pName;
28         params['maximize'] = false;
29         params['minimize'] = false;
30         params['title'] = pTitle;
31         params['width'] = pWidth;
32                 im_win.create_window(params);
33        }
34
35   /*
36        * Add Usuario
37        */
38
39        Templates.prototype.add_user = function()
40        {
41                var _this = this;
42                var _XmlAddUser = '<adduser>' +
43                                                        '<top lang1="'+IM.get_lang('Selecione uma Organização')+'" />' +
44                                                        '<bottom lang1="'+IM.get_lang('Jid Contact')+'" lang2="'+IM.get_lang('Nickname')+'" lang3="'+IM.get_lang('Group')+'" lang4="'+IM.get_lang('Add')+'"/>' +
45                                                  '</adduser>';
46               
47                _this.conf_form("divAddUser",525,295,parse_XmlXsl(_XmlAddUser,'add_user.xsl'),":: " + IM.get_lang('Add New Contact') + " - Expresso ::");
48        }
49       
50        Templates.prototype.AcceptRequestUser = function()
51        {
52                var _this = this;
53                var _XmlupdUser = '<updUser>' +
54                                                        '<body lang1="'+IM.get_lang('Nickname')+'" lang2="'+IM.get_lang('Group')+'" lang3="'+IM.get_lang('Update')+'" />' +             
55                                                  '</updUser>';
56                                                 
57                _this.conf_form("divUpdateUser",300,110,parse_XmlXsl(_XmlupdUser,'upd_user.xsl'),":: " + IM.get_lang('Add New Contact') + " - Expresso ::");
58        }
59       
60        Templates.prototype.Status_AddUser = function()
61        {
62                if( document.getElementById('im_status_add') != null )
63                        if( document.getElementById('im_status_add').innerHTML != "" )
64                                document.getElementById('im_status_add').innerHTML = "";
65                        else
66                                document.getElementById('im_status_add').innerHTML = IM.get_lang('Contact Add') + ' ... !!!';
67        }
68
69   /*
70        * Del Usuario
71        */
72
73        Templates.prototype.remove_user = function()
74        {
75                var _this = this;
76                var _XmlDelUser = '<deluser>' +
77                                                        '<body lang1="'+IM.get_lang('Contact')+'" lang2="'+IM.get_lang('Remove')+'" lang3="'+IM.get_lang('close')+'"/>' +
78                                                  '</deluser>';
79
80                _this.conf_form("divDelUser",300,110,parse_XmlXsl(_XmlDelUser,'del_user.xsl'),":: " + IM.get_lang('Remove Contact') + " - Expresso ::");
81        }
82
83   /*
84        * Update Usuario
85        */
86
87        Templates.prototype.Users_Not_Auth = function (jids)
88        {
89                var _this = this;
90                var _XmlUserNAuth = '<jids>';   
91                for(var i in jids)
92                {               
93                        _XmlUserNAuth += '<item id="im_cell_'+jids[i]+'" jid="'+jids[i]+'" />';
94                }
95                _XmlUserNAuth += '</jids>';
96                if(document.getElementById('divFormAuthUser_im') == null){
97                        _this.conf_form("divFormAuthUser",360,250,parse_XmlXsl(_XmlUserNAuth,'user_not_auth.xsl'), ":: Contatos sem Cadastro - Expresso ::");
98                }else{
99                        document.getElementById('divFormAuthUser_im').innerHTML = '';
100                        document.getElementById('divFormAuthUser_im').innerHTML = parse_XmlXsl(_XmlUserNAuth,'user_not_auth.xsl');
101                }
102        }
103
104   /*
105        * Vcard Usuario
106        */
107
108        Templates.prototype.information_user = function(pVcardUser)
109        {
110                var _this = this;
111                var _XmlInfoUser = '<info_user>' +
112                                                                '<vcard>' +
113                                                                        pVcardUser +   
114                                                                '</vcard>' +
115                                                            '<getlang>' +
116                                                                        '<FN>' + IM.get_lang('Full Name') + '</FN>'+
117                                                                        '<NICKNAME>' + IM.get_lang('NickName') + '</NICKNAME>' +
118                                                                        '<ORGNAME>' + IM.get_lang('Orgname') + '</ORGNAME>' +
119                                                                        '<ORGUNIT>' + IM.get_lang('Orgunit') + '</ORGUNIT>' +
120                                                                        '<ROLE>' + IM.get_lang('Role') + '</ROLE>' +
121                                                                        '<BDAY>' + IM.get_lang('Birthday') + '</BDAY>' +
122                                                                        '<DESC>' + IM.get_lang('Status') + '</DESC>' +
123                                                                        '<SAVE>' +IM.get_lang('save') + '</SAVE>' +
124                                                                        '<CLOSE>' +IM.get_lang('close') + '</CLOSE>' +                                                                 
125                                                                '</getlang>' +
126                                                   '</info_user>';     
127                _this.conf_form("divInfoUser",400,220,parse_XmlXsl(_XmlInfoUser,'information_user.xsl'), ":: " + IM.get_lang('Information User') + " - Expresso ::");
128        }
129
130        Templates.prototype.information_Contact = function(pVcardContact)
131        {
132                var _this = this;
133                var _XmlInfoContact = '<info_contact>' +
134                                                                 '<vcard> ' +
135                                                                        pVcardContact +
136                                                                 '</vcard> ' +         
137                                                                 '<getlang>'+
138                                                                        '<FN>' + IM.get_lang('Full Name') + '</FN>' +
139                                                                        '<NICKNAME>' + IM.get_lang('NickName') + '</NICKNAME>' +       
140                                                                        '<ORGUNIT>' + IM.get_lang('Orgunit') + '</ORGUNIT>' +   
141                                                                        '<ROLE>' + IM.get_lang('Role') + '</ROLE>' +   
142                                                                        '<BDAY>' + IM.get_lang('Birthday') + '</BDAY>' +       
143                                                             '</getlang>' +
144                                                          '</info_contact>';
145                _this.conf_form("divInfoContact",430,110,parse_XmlXsl(_XmlInfoContact,'info_contact.xsl'),":: Informações do Contato - Expresso ::");
146
147        }
148
149   Templates.prototype.emotions = function()
150   {
151          var smiles = new Array("\':)\'#smile_1.src","\':d\'#smile_2.src","\';)\'#smile_3.src","\':o\'#smile_4.src","\':p\'#smile_5.src","\'(h)\'#smile_6.src","\':@\'#smile_7.src","\':$\'#smile_8.src","\':s\'#smile_9.src","\':(\'#smile_10.src","\':\\\'\(\'#smile_11.src","\':|\'#smile_12.src");
152          var grid = '';
153              grid += '<table cellpadding="0" cellspacing="0" border="0">';
154              grid += '<tr>';
155                  for(var i = 0 ; i < 4; i++)   
156                      grid += '<td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion('+smiles[i].substr(0,smiles[i].indexOf('#'))+')" id="sendMessageMenuId"><img width="19" height="19" src="'+eval(smiles[i].substr(smiles[i].indexOf('#') + 1))+'" /></div></td>';
157                  grid += '</tr>';     
158              grid += '<tr>';
159                  for(var i = 4 ; i < 8; i++)   
160                      grid += '<td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion('+smiles[i].substr(0,smiles[i].indexOf('#'))+')" id="sendMessageMenuId"><img width="19" height="19" src="'+eval(smiles[i].substr(smiles[i].indexOf('#') + 1))+'" /></div></td>';
161                  grid += '</tr>';     
162              grid += '<tr>';
163                  for(var i = 8 ; i < 12; i++) 
164                      grid += '<td><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.addEmotion('+smiles[i].substr(0,smiles[i].indexOf('#'))+')" id="sendMessageMenuId"><img width="19" height="19" src="'+eval(smiles[i].substr(smiles[i].indexOf('#') + 1))+'" /></div></td>';
165                  grid += '</tr>';     
166              grid += '<tr>';
167              grid += '<td colspan="18"><hr style="background:#cccccc;margin:1px:size:1px;"/></td>';
168              grid += '</tr>';
169              grid += '<tr>';
170              grid += '<td colspan="18"><div class="emotionItem" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.hideEmotionSelection()" id="closeEmotionSelectionDiv">Close This Menu</div></td>';
171              grid += '</tr>';
172              grid += '</table>';
173      return grid;
174   }
175
176   Templates.prototype.font_name = function()
177   {
178          var fonts_n = new Array("Arial:Arial","Courier:Courier","Times:Times New Roman");
179          var grid = '';
180
181          for( var i = 0 ; i < fonts_n.length; i++ )
182          grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFont(\'' + fonts_n[i].substr(0,fonts_n[i].indexOf(':') + 1 )+'\')" id="fontStyle1" style="width:120px;font-family:'+fonts_n[i].substr(fonts_n[i].indexOf(':') + 1 )+'">' + fonts_n[i].substr(fonts_n[i].indexOf(':') + 1 ) + '</div>';       
183
184      grid += '<hr style="background:#cccccc;margin:1px:size:1px;width:120px;"/>';
185          grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.hideFontNameSelection()" id="fontStyle1" style="width:120px">Close This Menu</div>';
186
187      return grid;
188   }
189
190   Templates.prototype.font_size = function()
191   {
192      var fonts_s = new Array("9pt:9","10pt:10","11pt:11","12pt:12","14pt:14","16pt:16","18pt:18");
193      var grid = '';
194
195          for( var i = 0 ; i < fonts_s.length ; i++ )
196              grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeSizeFont(\'' + fonts_s[i].substr(0,fonts_s[i].indexOf(':')) + '\');" id="fontStyle1" style="width:100px">' + fonts_s[i].substr(fonts_s[i].indexOf(':') + 1 ) + '</div>';
197
198      grid += '<hr style="background:#cccccc;margin:1px:size:1px;width:120px;"/>';
199      grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.hideFontSizeSelection()" id="fontStyle1" style="width:100px">Close This Menu</div>';
200
201      return grid;
202   }
203
204   Templates.prototype.font_color = function()
205   {
206      var fonts_c = new Array("#000000:Black","#c0c0c0:Silver","#ffff00:Yellow","#ff0000:Red","#ff00ff:Pink","#00ff00:Green","#1111ff:Blue","#800080:Magenta");
207          var grid = '';                 
208         
209          for( var i = 0; i < fonts_c.length ; i++ )   
210              grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFontColor(\'' + fonts_c[i].substr(0,fonts_c[i].indexOf(':')) + '\')" id="fontStyle1" style="width:100px">' + fonts_c[i].substr(fonts_c[i].indexOf(':') + 1 )  + '</div>';
211
212      grid += '<hr style="background:#cccccc;margin:1px:size:1px;width:120px;"/>';
213      grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.hideFontColorSelection()" id="fontStyle1" style="width:100px">Close This Menu</div>';
214                     
215      return grid;
216   }
217
218   Templates.prototype.font_style = function()
219   {
220     var fonts_st = new Array("normal:Regular","italic:Italic","bold:Bold");
221     var grid = '';
222     
223     for( var i = 0 ; i < fonts_st.length; i++ )
224        grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_conf_font.changeFontStyle(\'' + fonts_st[i].substr(0,fonts_st.indexOf(':')) + '\')" id="fontStyle1" style="width:100px">' + fonts_st[i].substr( fonts_st[i].indexOf(':') + 1 ) + '</div>';
225     grid += '<hr style="background:#cccccc;margin:1px:size:1px;width:120px;"/>';
226     grid += '<div class="menuitems" onMouseover="im_win.highlightie5(this)" onMouseout="im_win.lowlightie5(this)" onclick="im_win.hideFontStyleSelection()" id="fontStyle1" style="width:100px">Close This Menu</div>';
227         
228     return grid;
229   }
230
231  /*
232   * Preferências do usuário
233   */
234   
235   Templates.prototype.yourPreferences = function()
236   {
237                var _this = this;
238                var _XmlPreferences = '<preferences />';
239                _this.conf_form("divYourPreferences",345,222,parse_XmlXsl(_XmlPreferences,'preferences.xsl'),":: Informações do Contato - Expresso ::");
240                IM_Preferences.LoadPreferences(null);
241   }
242
243   //Templates
244   var Templates = new Templates();
Note: See TracBrowser for help on using the repository browser.