]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Calendar/tpls/main.tpl
Release 6.5.8
[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-2012 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="{sugar_getjspath file="modules/Calendar/Cal.css"}" rel="stylesheet" />
39 {sugar_getscript file="modules/Calendar/Cal.js"}
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.enable_repeat = "{$enable_repeat}";
61                 CAL.items_draggable = "{$items_draggable}";
62                 CAL.items_resizable = "{$items_resizable}";
63                 CAL.cells_per_day = {$cells_per_day};   
64                 CAL.current_params = {literal}{}{/literal};
65                 CAL.dashlet = "{$dashlet}";             
66                 CAL.grid_start_ts = {$grid_start_ts};
67                 CAL.scroll_slot = {$scroll_slot};
68                 CAL.basic.min_height = {$basic_min_height};
69
70                 CAL.lbl_create_new = "{$MOD.LBL_CREATE_NEW_RECORD}";
71                 CAL.lbl_edit = "{$MOD.LBL_EDIT_RECORD}";
72                 CAL.lbl_saving = "{$MOD.LBL_SAVING}";
73                 CAL.lbl_loading = "{$MOD.LBL_LOADING}";
74                 CAL.lbl_sending = "{$MOD.LBL_SENDING_INVITES}";
75                 CAL.lbl_confirm_remove = "{$MOD.LBL_CONFIRM_REMOVE}";
76                 CAL.lbl_confirm_remove_all_recurring = "{$MOD.LBL_CONFIRM_REMOVE_ALL_RECURRING}";
77                 
78                 CAL.lbl_error_saving = "{$MOD.LBL_ERROR_SAVING}";
79                 CAL.lbl_error_loading = "{$MOD.LBL_ERROR_LOADING}";
80                 CAL.lbl_repeat_limit_error = "{$MOD.LBL_REPEAT_LIMIT_ERROR}";
81                 
82                 CAL.year = {$year};
83                 CAL.month = {$month};
84                 CAL.day = {$day};
85
86                 CAL.print = {$isPrint};
87                 
88                 {literal}
89                 var scrollable = CAL.get("cal-scrollable");
90                 if(scrollable){
91                         scrollable.scrollTop = (CAL.slot_height + 1) * CAL.scroll_slot - 1;
92                         if(CAL.view == "day")
93                                 scrollable.scrollTop++;
94                 }
95                 {/literal}                      
96
97                 {if $view == "shared"}
98                         {counter name="un" start=0 print=false assign="un"}
99                         {foreach name="shared" from=$shared_ids key=k item=member_id}                           
100                                 CAL.shared_users['{$member_id}'] = '{$un}';
101                                 {counter name="un" print=false}
102                         {/foreach}
103                         CAL.shared_users_count = "{$shared_users_count}";
104                 {/if}
105         
106                 CAL.field_list = new Array();
107                 CAL.field_disabled_list = new Array();                  
108
109                 CAL.activity_colors = [];                               
110                 {foreach name=colors from=$activity_colors key=module item=v}
111                         CAL.activity_colors['{$module}'] = [];
112                         CAL.activity_colors['{$module}']['border'] = '{$v.border}';
113                         CAL.activity_colors['{$module}']['body'] = '{$v.body}'
114                 {/foreach}
115
116                 CAL.act_types = [];
117                 CAL.act_types['Meetings'] = 'meeting';
118                 CAL.act_types['Calls'] = 'call';
119                 CAL.act_types['Tasks'] = 'task';
120
121                 {literal}
122
123                 if(CAL.items_draggable){                        
124                         var target_slots = [];                  
125                         var slots = CAL.query('#cal-grid div.slot');
126                         var cnt = 0;
127                         CAL.each(
128                                 slots,
129                                 function(i,v){                                  
130                                         target_slots[i] = new YAHOO.util.DDTarget(slots[i].id,"cal");
131                                         cnt++;
132                                 }
133                         );
134                         slots = CAL.query('#cal-grid div.basic_slot');
135                         CAL.each(
136                                 slots,
137                                 function(i,v){
138                                         target_slots[cnt + i] = new YAHOO.util.DDTarget(slots[i].id,"basic_cal");
139                                 }
140                         );                              
141                 }       
142                 
143                 var nodes = CAL.query("#cal-grid div.slot, #cal-grid div.basic_slot");
144                 CAL.each(nodes, function(i,v){
145                         YAHOO.util.Event.on(nodes[i],"mouseover",function(){
146                                 if(CAL.records_openable && !CAL.disable_creating)
147                                         this.style.backgroundColor = "#D1DCFF";                                                 
148                                 if(!this.childNodes.length)     
149                                         this.setAttribute("title",this.getAttribute("time"));
150                         });
151                         YAHOO.util.Event.on(nodes[i],"mouseout",function(){
152                                 this.style.backgroundColor = "";
153                                 this.removeAttribute("title");
154                         });
155                         YAHOO.util.Event.on(nodes[i],"click",function(){
156                                 if(!CAL.disable_creating){                                                      
157                                         CAL.dialog_create(this);
158                                 }
159                         });
160                 });                             
161                 
162                 CAL.init_edit_dialog({
163                         width: "{/literal}{$editview_width}{literal}",
164                         height: "{/literal}{$editview_height}{literal}"
165                 });
166                 
167                 YAHOO.util.Event.on(window, 'resize', function(){
168                         CAL.fit_grid();
169                         CAL.update_dd.fire();
170                 });             
171                                 
172                 YAHOO.util.Event.on("btn-save","click",function(){                                                                                                                                      
173                         if(!CAL.check_forms())
174                                 return false;                                                                                   
175                         CAL.dialog_save();      
176                 });
177                 
178                 YAHOO.util.Event.on("btn-send-invites","click",function(){                                                                                                                                                              
179                         if(!CAL.check_forms())
180                                 return false;   
181                         CAL.get("send_invites").value = "1";                                                    
182                         CAL.dialog_save();      
183                 });             
184                                 
185                 YAHOO.util.Event.on("btn-delete","click",function(){
186                         if(CAL.get("record").value != "")
187                                 if(confirm(CAL.lbl_confirm_remove))
188                                         CAL.dialog_remove();
189                                                 
190                 });     
191         
192                 YAHOO.util.Event.on("btn-cancel","click",function(){                    
193                         document.schedulerwidget.reset();
194             if(document.getElementById('empty-search-message')) {
195                 document.getElementById('empty-search-message').style.display = 'none';
196             }
197             CAL.editDialog.cancel();                                            
198                 }); 
199                 
200                 YAHOO.util.Event.on("btn-full-form","click",function(){                 
201                         CAL.full_form();                                                
202                 }); 
203
204                 CAL.select_tab("cal-tab-1");
205
206                 YAHOO.util.Event.on(CAL.get("btn-cancel-settings"), 'click', function(){
207                         CAL.settingsDialog.cancel();    
208                 });
209                 
210                 YAHOO.util.Event.on(CAL.get("btn-save-settings"), 'click', function(){                  
211                         CAL.get("form_settings").submit();
212                 });
213                 
214                 {/literal}
215                                 
216                 var calendar_items = {$a_str};
217                                         
218                 {literal}
219                 CAL.each(calendar_items, function(i,v){
220                         CAL.add_item_to_grid(calendar_items[i]);
221                 });
222                 {/literal}
223                 
224                 {if $view != "year"}
225                 CAL.arrange_advanced();
226                 CAL.basic.populate_grid();              
227                 CAL.fit_grid();
228                 CAL.update_dd.fire();
229                 {/if}
230                 
231                 cal_loaded = null;      
232         });
233 </script>
234                         
235 <div id="cal-edit" style="display: none;">
236         
237         <div class="hd"><span id="title-cal-edit"></span></div>
238         <div class="bd" id="edit-dialog-content">
239                 <div id="cal-tabs" class="yui-navset yui-navset-top yui-content" style="height: auto; padding: 0 2px;">
240                         <ul class="yui-nav">
241                                 <li id="tab_general"><a tabname="cal-tab-1" id="cal-tab-1-link"><em>{$MOD.LBL_GENERAL_TAB}</em></a></li>
242                                 <li id="tab_invitees"><a tabname="cal-tab-2" id="cal-tab-2-link"><em>{$MOD.LBL_PARTICIPANTS_TAB}</em></a></li>
243                                 {if $enable_repeat}
244                                 <li id="tab_repeat"><a tabname="cal-tab-3" id="cal-tab-3-link"><em>{$MOD.LBL_REPEAT_TAB}</em></a></li>
245                                 {/if}
246                         </ul>
247                         <div id="cal-tab-1" class="yui-content">
248                                 {include file=$form}
249                         </div>                          
250                         <div id="cal-tab-2" class="yui-content">
251                                 <div class="h3Row" id="scheduler"></div>
252                         </div>
253                         {if $enable_repeat}
254                         <div id="cal-tab-3" class="yui-content">
255                                 {include file=$repeat}
256                         </div>
257                         {/if}
258                 </div>
259         </div>  
260         <div id="cal-edit-buttons" class="ft">
261                 <button id="btn-save" class="button" type="button">{$MOD.LBL_SAVE_BUTTON}</button>
262                 <button id="btn-cancel" class="button" type="button">{$MOD.LBL_CANCEL_BUTTON}</button>
263                 <button id="btn-delete" class="button" type="button">{$MOD.LBL_DELETE_BUTTON}</button>
264                 <button id="btn-send-invites" class="button" type="button">{$MOD.LBL_SEND_INVITES}</button>
265                 <button id="btn-full-form" class="button" type="button">{$APP.LBL_FULL_FORM_BUTTON_LABEL}</button>
266         </div>
267 </div>
268
269 {if $settings}
270 {include file=$settings}
271 {/if}
272         
273 <script type="text/javascript"> 
274 {$GRjavascript}
275 </script>
276         
277 <script type="text/javascript"> 
278 {literal}
279 YAHOO.util.Event.onDOMReady(function(){ 
280         var schedulerLoader = new YAHOO.util.YUILoader({
281                 require : ["jsclass_scheduler"],
282                 onSuccess: function(){
283                         var root_div = document.getElementById('scheduler');
284                         var sugarContainer_instance = new SugarContainer(document.getElementById('scheduler'));
285                         sugarContainer_instance.start(SugarWidgetScheduler);
286                 }
287         });
288         schedulerLoader.addModule({
289                 name :"jsclass_scheduler",
290                 type : "js",
291                 fullpath: "modules/Meetings/jsclass_scheduler.js",
292                 varName: "global_rpcClient",
293                 requires: []
294         });
295         schedulerLoader.insert();
296 });     
297 {/literal}      
298 </script>
299         
300 <script type="text/javascript" src="include/javascript/jsclass_base.js"></script>
301 <script type="text/javascript" src="include/javascript/jsclass_async.js"></script>      
302         
303 <style type="text/css">
304 {literal}
305         .schedulerDiv h3{
306                 display: none;
307         }
308         .schedulerDiv{
309                 width: auto !important;
310         }
311 {/literal}
312 </style>        
313 {if $view == 'day'}
314 <style type="text/css">
315 {literal}
316         #cal-grid div.col, #cal-grid div.left_col{
317                 border-top: 1px solid silver;   
318         }
319 {/literal}
320 </style>
321 {/if}
322
323 <div id="cal-width-helper" style="width: auto;"></div>
324