]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Calendar/tpls/main.tpl
Release 6.4.0
[Github/sugarcrm.git] / modules / Calendar / tpls / main.tpl
1 {*
2 /*********************************************************************************
3  * SugarCRM Community Edition is a customer relationship management program developed by
4  * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
5  * 
6  * This program is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Affero General Public License version 3 as published by the
8  * Free Software Foundation with the addition of the following permission added
9  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
10  * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
11  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
12  * 
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
16  * details.
17  * 
18  * You should have received a copy of the GNU Affero General Public License along with
19  * this program; if not, see http://www.gnu.org/licenses or write to the Free
20  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  * 02110-1301 USA.
22  * 
23  * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
24  * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
25  * 
26  * The interactive user interfaces in modified source and object code versions
27  * of this program must display Appropriate Legal Notices, as required under
28  * Section 5 of the GNU Affero General Public License version 3.
29  * 
30  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
31  * these Appropriate Legal Notices must retain the display of the "Powered by
32  * SugarCRM" logo. If the display of the logo is not reasonably feasible for
33  * technical reasons, the Appropriate Legal Notices must display the words
34  * "Powered by SugarCRM".
35  ********************************************************************************/
36
37 *}
38 <link type="text/css" href="modules/Calendar/Cal.css" rel="stylesheet" />
39 <script type="text/javascript" src="modules/Calendar/Cal.js"></script>
40 <script type="text/javascript">
41
42         {literal}
43         YAHOO.util.Event.onDOMReady(function(){
44                 dom_loaded = true;
45         });
46         
47         function check_cal_loaded(){
48                 return (typeof cal_loaded != 'undefined' && cal_loaded == true && typeof dom_loaded != 'undefined' && dom_loaded == true);
49         }
50         {/literal}
51         
52         SUGAR.util.doWhen(check_cal_loaded, function(){literal}{{/literal}
53         
54                 CAL.view = "{$view}";
55                 CAL.style = "{$style}";
56                 CAL.t_step = {$t_step};
57                 CAL.current_user_id = "{$current_user_id}";     
58                 CAL.current_user_name = "{$current_user_name}";
59                 CAL.time_format = "{$time_format}";
60                 CAL.items_draggable = "{$items_draggable}";
61                 CAL.item_text = "{$item_text}";
62                 CAL.mouseover_expand = "{$mouseover_expand}";           
63                 
64                 CAL.celcount = {$celcount};
65                 CAL.cells_per_day = {$cells_per_day};   
66                 CAL.current_params = {literal}{}{/literal};
67                 CAL.dashlet = "{$dashlet}";     
68                 
69                 CAL.grid_start_ts = {$grid_start_ts};
70                 CAL.scroll_slot = {$scroll_slot};
71
72                 CAL.lbl_create_new = "{$MOD.LBL_CREATE_NEW_RECORD}";
73                 CAL.lbl_edit = "{$MOD.LBL_EDIT_RECORD}";
74                 CAL.lbl_saving = "{$MOD.LBL_SAVING}";
75                 CAL.lbl_loading = "{$MOD.LBL_LOADING}";
76                 CAL.lbl_confirm_remove = "{$MOD.LBL_CONFIRM_REMOVE}";
77                 CAL.lbl_error_saving = "{$MOD.LBL_ERROR_SAVING}";
78                 CAL.lbl_error_loading = "{$MOD.LBL_ERROR_LOADING}";
79                 CAL.lbl_desc = "{$MOD.LBL_INFO_DESC}";
80                 CAL.lbl_start = "{$MOD.LBL_INFO_START_DT}";
81                 CAL.lbl_due = "{$MOD.LBL_INFO_DUE_DT}";
82                 CAL.lbl_duration = "{$MOD.LBL_INFO_DURATION}";
83                 CAL.lbl_name = "{$MOD.LBL_INFO_NAME}";
84                 CAL.lbl_title = "{$MOD.LBL_INFO_TITLE}";
85                 CAL.lbl_related = "{$MOD.LBL_INFO_RELATED_TO}"; 
86                 CAL.lbl_hours_abbrev = "{$MOD.LBL_HOURS_ABBREV}";
87                 CAL.lbl_mins_abbrev = "{$MOD.LBL_MINS_ABBREV}";                 
88         
89                 CAL.img_edit_inline = "{$img_edit_inline}";
90                 CAL.img_view_inline = "{$img_view_inline}";
91                 CAL.img_close = "{$img_close}";         
92                 
93                 
94                 {literal}
95                 var scrollable = CAL.get("cal-scrollable");
96                 if(scrollable){
97                         scrollable.scrollTop = 15 * CAL.scroll_slot - 1;
98                         if(CAL.view == "day")
99                                 scrollable.scrollTop++; 
100                 }
101                 {/literal}                      
102
103                 {if $view == "shared"}
104                         {counter name="un" start=0 print=false assign="un"}
105                         {foreach name="shared" from=$shared_ids key=k item=member_id}                           
106                                 CAL.shared_users['{$member_id}'] = '{$un}';
107                                 {counter name="un" print=false}
108                         {/foreach}
109                         CAL.shared_users_count = "{$shared_users_count}";
110                 {/if}
111         
112                 CAL.field_list = new Array();
113                 CAL.field_disabled_list = new Array();                  
114
115                 CAL.activity_colors = [];                               
116                 {foreach name=colors from=$activity_colors key=module item=v}
117                         CAL.activity_colors['{$module}'] = [];
118                         CAL.activity_colors['{$module}']['border'] = '{$v.border}';
119                         CAL.activity_colors['{$module}']['body'] = '{$v.body}'
120                 {/foreach}
121
122                 CAL.act_types = [];
123                 CAL.act_types['Meetings'] = 'meeting';
124                 CAL.act_types['Calls'] = 'call';
125                 CAL.act_types['Tasks'] = 'task';
126
127                 {literal}
128
129                 if(CAL.items_draggable){                        
130                         var target_slots = [];                  
131                         var slots = CAL.query('#cal-grid div.slot');
132                         CAL.each(
133                                 slots,
134                                 function(i,v){
135                                         target_slots[i] = new YAHOO.util.DDTarget(slots[i].id,"cal"); 
136                                 }
137                         );                      
138                 }       
139                 
140                 var nodes = CAL.query("#cal-grid div.slot");
141                 CAL.each(nodes, function(i,v){
142                         YAHOO.util.Event.on(nodes[i],"mouseover",function(){
143                                 if(CAL.records_openable)
144                                         this.style.backgroundColor = "#D1DCFF";                                                 
145                                 if(!this.childNodes.length)     
146                                         this.setAttribute("title",this.getAttribute("time"));
147                         });
148                         YAHOO.util.Event.on(nodes[i],"mouseout",function(){
149                                 this.style.backgroundColor = "";
150                                 this.removeAttribute("title");
151                         });
152                         YAHOO.util.Event.on(nodes[i],"click",function(){
153                                 if(!CAL.disable_creating){                                                      
154                                         CAL.dialog_create(this);
155                                 }
156                         });
157                 });                             
158                 
159                 CAL.init_edit_dialog(
160                                 {
161                                         width: "{/literal}{$editview_width}{literal}",
162                                         height: "{/literal}{$editview_height}{literal}"
163                                 }
164                 );
165                 
166                 YAHOO.util.Event.on(window, 'resize', function(){
167                         CAL.fit_grid();
168                         CAL.update_dd.fire();
169                 });             
170                                 
171                 YAHOO.util.Event.on("btn-save","click",function(){                                                                                                                                              
172                         if(!(check_form('CalendarEditView') && cal_isValidDuration())){
173                                 CAL.select_tab("cal-tab-1");
174                                 return false;
175                         }                                                               
176                         CAL.dialog_save();      
177                 });
178                 
179                 YAHOO.util.Event.on("btn-send-invites","click",function(){                                                                                                                                              
180                         if(!(check_form('CalendarEditView') && cal_isValidDuration())){
181                                 CAL.select_tab("cal-tab-1");
182                                 return false;
183                         }                       
184                         CAL.get("send_invites").value = "1";                                                    
185                         CAL.dialog_save();      
186                 });             
187                 
188
189                 YAHOO.util.Event.on("btn-apply","click",function(){
190                         if(!(check_form('CalendarEditView') && cal_isValidDuration())){
191                                 CAL.select_tab("cal-tab-1");
192                                 return false;
193                         }
194                         CAL.dialog_apply();
195                 });     
196                                 
197                 YAHOO.util.Event.on("btn-delete","click",function(){
198                         if(CAL.get("record").value != "")
199                                 if(confirm(CAL.lbl_confirm_remove))
200                                         CAL.dialog_remove();                            
201                                                 
202                 });     
203         
204                 YAHOO.util.Event.on("btn-cancel","click",function(){                    
205                         CAL.editDialog.cancel();                                                
206                 }); 
207
208                 CAL.select_tab("cal-tab-1");
209
210                 YAHOO.util.Event.on(CAL.get("btn-cancel-settings"), 'click', function(){
211                         CAL.settingsDialog.cancel();    
212                 });
213                 
214                 YAHOO.util.Event.on(CAL.get("btn-save-settings"), 'click', function(){                  
215                         CAL.get("form_settings").submit();
216                 });
217                 
218                 {/literal}
219                                 
220                 var calendar_items = [
221                         {$a_str}                
222                 ];
223                         
224                 {literal}
225                 CAL.each(calendar_items, function(i,v){                         
226                         CAL.add_item_to_grid(calendar_items[i]);                                
227                 });
228                 {/literal}
229                 
230                 {if $view != "year"}
231                 CAL.arrange_advanced();
232                 CAL.fit_grid();
233                 CAL.update_dd.fire();
234                 {/if}
235                 
236                 cal_loaded = null;              
237         });
238 </script>
239                         
240 <div id="cal-edit" style="display: none;">
241         
242         <div class="hd"><span id="title-cal-edit"></span></div>
243         <div class="bd" id="edit-dialog-content">
244                 <div id="cal-tabs" class="yui-navset yui-navset-top yui-content" style="height: auto; padding: 0 2px;">
245                         <ul class="yui-nav">
246                                 <li id="tab_general"><a tabname="cal-tab-1" id="cal-tab-1-link"><em>{$MOD.LBL_GENERAL_TAB}</em></a></li>
247                                 <li id="tab_invitees"><a tabname="cal-tab-2" id="cal-tab-2-link"><em>{$MOD.LBL_PARTICIPANTS_TAB}</em></a></li>
248                         </ul>
249                         <div id="cal-tab-1" class="yui-content">
250                                 {include file=$form}
251                         </div>                          
252                         <div id="cal-tab-2" class="yui-content">
253                                 <div class="h3Row" id="scheduler"></div>
254                         </div>
255                 </div>
256         </div>  
257         <div id="cal-edit-buttons" class="ft">
258                 <button id="btn-save" class="button" type="button">{$MOD.LBL_SAVE_BUTTON}</button>
259                 <button id="btn-apply" class="button" type="button">{$MOD.LBL_APPLY_BUTTON}</button>
260                 <button id="btn-delete" class="button" type="button">{$MOD.LBL_DELETE_BUTTON}</button>
261                 <button id="btn-cancel" class="button" type="button">{$MOD.LBL_CANCEL_BUTTON}</button>
262                 <button id="btn-send-invites" class="button" type="button">{$MOD.LBL_SEND_INVITES}</button>
263         </div>
264 </div>
265
266 {if $settings}
267 {include file=$settings}
268 {/if}
269         
270 <script type="text/javascript">                 
271 {$GRjavascript}
272 </script>
273         
274 <script type="text/javascript"> 
275 {literal}
276
277 YAHOO.util.Event.onDOMReady(function(){ 
278         var schedulerLoader = new YAHOO.util.YUILoader({
279                 require : ["jsclass_scheduler"],
280                 onSuccess: function(){
281                         var root_div = document.getElementById('scheduler');
282                         var sugarContainer_instance = new SugarContainer(document.getElementById('scheduler'));
283                         sugarContainer_instance.start(SugarWidgetScheduler);
284                 }
285         });
286         schedulerLoader.addModule({
287                 name :"jsclass_scheduler",
288                 type : "js",
289                 fullpath: "modules/Meetings/jsclass_scheduler.js",
290                 varName: "global_rpcClient",
291                 requires: []
292         });
293         schedulerLoader.insert();
294 });     
295 {/literal}      
296 </script>
297         
298 <script type="text/javascript" src="include/javascript/jsclass_base.js"></script>
299 <script type="text/javascript" src="include/javascript/jsclass_async.js"></script>      
300 <script type="text/javascript" src="include/javascript/overlibmws.js"></script>
301         
302 <style type="text/css">
303 {literal}
304         .schedulerDiv h3{
305                 display: none;
306         }
307         .schedulerDiv{
308                 width: auto !important;
309         }
310 {/literal}
311 </style>        
312 {if $view == 'day'}
313 <style type="text/css">
314 {literal}
315         .day_col, .left_time_col{
316                 border-top: 1px solid silver;   
317         }
318 {/literal}
319 </style>
320 {/if}
321