]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - include/ListView/ListViewGeneric.tpl
Release 6.5.0
[Github/sugarcrm.git] / include / ListView / ListViewGeneric.tpl
1 {*
2
3 /*********************************************************************************
4  * SugarCRM Community Edition is a customer relationship management program developed by
5  * SugarCRM, Inc. Copyright (C) 2004-2012 SugarCRM Inc.
6  * 
7  * This program is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU Affero General Public License version 3 as published by the
9  * Free Software Foundation with the addition of the following permission added
10  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11  * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
13  * 
14  * This program is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
17  * details.
18  * 
19  * You should have received a copy of the GNU Affero General Public License along with
20  * this program; if not, see http://www.gnu.org/licenses or write to the Free
21  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22  * 02110-1301 USA.
23  * 
24  * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25  * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
26  * 
27  * The interactive user interfaces in modified source and object code versions
28  * of this program must display Appropriate Legal Notices, as required under
29  * Section 5 of the GNU Affero General Public License version 3.
30  * 
31  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32  * these Appropriate Legal Notices must retain the display of the "Powered by
33  * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34  * technical reasons, the Appropriate Legal Notices must display the words
35  * "Powered by SugarCRM".
36  ********************************************************************************/
37
38
39
40
41 *}
42
43 <script type='text/javascript' src='{sugar_getjspath file='include/javascript/popup_helper.js'}'></script>
44
45
46 <script>
47 {literal}
48         $(document).ready(function(){
49             $("ul.clickMenu").each(function(index, node){
50                         $(node).sugarActionMenu();
51                 });
52
53         $('.selectActionsDisabled').children().each(function(index) {
54             $(this).attr('onclick','').unbind('click');
55         });
56         
57         var selectedTopValue = $("#selectCountTop").attr("value");
58         if(typeof(selectedTopValue) != "undefined" && selectedTopValue != "0"){
59                 sugarListView.prototype.toggleSelected();
60         }
61         });
62 {/literal}      
63 </script>
64 {assign var="currentModule" value = $pageData.bean.moduleDir}
65 {assign var="singularModule" value = $moduleListSingular.$currentModule}
66 {assign var="hideTable" value=false}
67
68 {if count($data) == 0}
69         {assign var="hideTable" value=true}
70         <div class="list view listViewEmpty">
71     {if $displayEmptyDataMesssages}
72         {if strlen($query) == 0}
73                 {capture assign="createLink"}<a href="?module={$pageData.bean.moduleDir}&action=EditView&return_module={$pageData.bean.moduleDir}&return_action=DetailView">{$APP.LBL_CREATE_BUTTON_LABEL}</a>{/capture}
74                 {capture assign="importLink"}<a href="?module=Import&action=Step1&import_module={$pageData.bean.moduleDir}&return_module={$pageData.bean.moduleDir}&return_action=index">{$APP.LBL_IMPORT}</a>{/capture}
75                 {capture assign="helpLink"}<a target="_blank" href='?module=Administration&action=SupportPortal&view=documentation&version={$sugar_info.sugar_version}&edition={$sugar_info.sugar_flavor}&lang=&help_module={$currentModule}&help_action=&key='>{$APP.LBL_CLICK_HERE}</a>{/capture}
76                 <p class="msg">
77                     {$APP.MSG_EMPTY_LIST_VIEW_NO_RESULTS|replace:"<item2>":$createLink|replace:"<item3>":$importLink}
78                 </p>
79                 <p class="submsg">
80                     {$APP.MSG_EMPTY_LIST_VIEW_NO_RESULTS_SUBMSG|replace:"<item1>":$pageData.bean.moduleName|replace:"<item4>":$helpLink}
81                 </p>
82         {elseif $query == "-advanced_search"}
83             <p class="msg">
84                 {$APP.MSG_LIST_VIEW_NO_RESULTS_BASIC}
85             </p>
86         {else}
87             <p class="msg">
88                 {capture assign="quotedQuery"}"{$query}"{/capture}
89                 {$APP.MSG_LIST_VIEW_NO_RESULTS|replace:"<item1>":$quotedQuery}
90             </p>
91             <p class = "submsg">
92                 <a href="?module={$pageData.bean.moduleDir}&action=EditView&return_module={$pageData.bean.moduleDir}&return_action=DetailView">
93                     {$APP.MSG_LIST_VIEW_NO_RESULTS_SUBMSG|replace:"<item1>":$quotedQuery|replace:"<item2>":$singularModule}
94                 </a>
95
96             </p>
97         {/if}
98     {else}
99         <p class="msg">
100             {$APP.LBL_NO_DATA}
101         </p>
102         {/if}
103         </div>
104 {/if}
105 {$multiSelectData}
106
107 {if $hideTable == false}
108         <table cellpadding='0' cellspacing='0' width='100%' border='0' class='list view'>
109     {assign var="link_select_id" value="selectLinkTop"}
110     {assign var="link_action_id" value="actionLinkTop"}
111     {assign var="actionsLink" value=$actionsLinkTop}
112     {assign var="selectLink" value=$selectLinkTop}
113     {assign var="action_menu_location" value="top"}
114         {include file='include/ListView/ListViewPagination.tpl'}
115         <tr height='20'>
116                         {if $prerow}
117                                 <td width='1%' class="td_alt">
118                                         &nbsp;
119                                 </td>
120                         {/if}
121                         {if !empty($quickViewLinks)}
122                         <td class='td_alt' width='1%' style="padding: 0px;">&nbsp;</td>
123                         {/if}
124                         {counter start=0 name="colCounter" print=false assign="colCounter"}
125                         {foreach from=$displayColumns key=colHeader item=params}
126                                 <th scope='col' width='{$params.width}%'>
127                                         <div style='white-space: normal;'width='100%' align='{$params.align|default:'left'}'>
128                         {if $params.sortable|default:true}
129                             {if $params.url_sort}
130                                 <a href='{$pageData.urls.orderBy}{$params.orderBy|default:$colHeader|lower}' class='listViewThLinkS1'>
131                             {else}
132                                 {if $params.orderBy|default:$colHeader|lower == $pageData.ordering.orderBy}
133                                     <a href='javascript:sListView.order_checks("{$pageData.ordering.sortOrder|default:ASCerror}", "{$params.orderBy|default:$colHeader|lower}" , "{$pageData.bean.moduleDir}{"2_"}{$pageData.bean.objectName|upper}{"_ORDER_BY"}")' class='listViewThLinkS1'>
134                                 {else}
135                                     <a href='javascript:sListView.order_checks("ASC", "{$params.orderBy|default:$colHeader|lower}" , "{$pageData.bean.moduleDir}{"2_"}{$pageData.bean.objectName|upper}{"_ORDER_BY"}")' class='listViewThLinkS1'>
136                                 {/if}
137                             {/if}
138                             {sugar_translate label=$params.label module=$pageData.bean.moduleDir}
139                                                 &nbsp;&nbsp;
140                                                 {if $params.orderBy|default:$colHeader|lower == $pageData.ordering.orderBy}
141                                                         {if $pageData.ordering.sortOrder == 'ASC'}
142                                                                 {capture assign="imageName"}arrow_down.{$arrowExt}{/capture}
143                                     {capture assign="alt_sort"}{sugar_translate label='LBL_ALT_SORT_DESC'}{/capture}
144                                                                 {sugar_getimage name=$imageName attr='align="absmiddle" border="0" ' alt="$alt_sort"}
145                                                         {else}
146                                                                 {capture assign="imageName"}arrow_up.{$arrowExt}{/capture}
147                                     {capture assign="alt_sort"}{sugar_translate label='LBL_ALT_SORT_ASC'}{/capture}
148                                                                 {sugar_getimage name=$imageName attr='align="absmiddle" border="0" ' alt="$alt_sort"}
149                                                         {/if}
150                                                 {else}
151                                                         {capture assign="imageName"}arrow.{$arrowExt}{/capture}
152                                 {capture assign="alt_sort"}{sugar_translate label='LBL_ALT_SORT'}{/capture}
153                                                         {sugar_getimage name=$imageName attr='align="absmiddle" border="0" ' alt="$alt_sort"}
154                                                 {/if}
155                             </a>
156                                         {else}
157                             {if !isset($params.noHeader) || $params.noHeader == false} 
158                                                   {sugar_translate label=$params.label module=$pageData.bean.moduleDir}
159                             {/if}
160                                         {/if}
161                                         </div>
162                                 </th>
163                                 {counter name="colCounter"}
164                         {/foreach}
165                         <td class='td_alt' nowrap="nowrap" width='1%'>&nbsp;</td>
166                 </tr>
167                         
168                 {counter start=$pageData.offsets.current print=false assign="offset" name="offset"}     
169                 {foreach name=rowIteration from=$data key=id item=rowData}
170                     {counter name="offset" print=false}
171                 {assign var='scope_row' value=true}
172         
173                         {if $smarty.foreach.rowIteration.iteration is odd}
174                                 {assign var='_rowColor' value=$rowColor[0]}
175                         {else}
176                                 {assign var='_rowColor' value=$rowColor[1]}
177                         {/if}
178                         <tr height='20' class='{$_rowColor}S1'>
179                                 {if $prerow}
180                                 <td width='1%' class='nowrap'>
181                                  {if !$is_admin && is_admin_for_user && $rowData.IS_ADMIN==1}
182                                                 <input type='checkbox' disabled="disabled" class='checkbox' value='{$rowData.ID}'>
183                                  {else}
184                             <input title="{sugar_translate label='LBL_SELECT_THIS_ROW_TITLE'}" onclick='sListView.check_item(this, document.MassUpdate)' type='checkbox' class='checkbox' name='mass[]' value='{$rowData.ID}'>
185                                  {/if}
186                                 </td>
187                                 {/if}
188                                 {if !empty($quickViewLinks)}
189                     {capture assign=linkModule}{if $params.dynamic_module}{$rowData[$params.dynamic_module]}{else}{$pageData.bean.moduleDir}{/if}{/capture}
190                     {capture assign=action}{if $act}{$act}{else}EditView{/if}{/capture}
191                                 <td width='2%' nowrap>
192                         {if $pageData.rowAccess[$id].edit}
193                         <a title='{$editLinkString}' id="edit-{$rowData.ID}"
194         href="index.php?module={$linkModule}&offset={$offset}&stamp={$pageData.stamp}&return_module={$linkModule}&action={$action}&record={$rowData.ID}"
195                         >
196                             {capture name='tmp1' assign='alt_edit'}{sugar_translate label="LNK_EDIT"}{/capture}
197                             {sugar_getimage name="edit_inline.gif" attr='border="0" ' alt="$alt_edit"}</a>
198                         {/if}
199                     </td>
200         
201                                 {/if}
202                                 {counter start=0 name="colCounter" print=false assign="colCounter"}
203                                 {foreach from=$displayColumns key=col item=params}
204                                     {strip}
205                                         <td {if $scope_row} scope='row' {/if} align='{$params.align|default:'left'}' valign="top" class="{if ($params.type == 'teamset')}nowrap{/if}{if preg_match('/PHONE/', $col)} phone{/if}">
206                                                 {if $col == 'NAME' || $params.bold}<b>{/if}
207                                             {if $params.link && !$params.customCode}
208         {capture assign=linkModule}{if $params.dynamic_module}{$rowData[$params.dynamic_module]}{else}{$params.module|default:$pageData.bean.moduleDir}{/if}{/capture}
209         {capture assign=action}{if $act}{$act}{else}DetailView{/if}{/capture}
210         {capture assign=record}{$rowData[$params.id]|default:$rowData.ID}{/capture}
211         {capture assign=url}index.php?module={$linkModule}&offset={$offset}&stamp={$pageData.stamp}&return_module={$linkModule}&action={$action}&record={$record}{/capture}
212                                 <{$pageData.tag.$id[$params.ACLTag]|default:$pageData.tag.$id.MAIN} href="{sugar_ajax_url url=$url}">
213                                                 {/if}
214                                                 {if $params.customCode} 
215                                                         {sugar_evalcolumn_old var=$params.customCode rowData=$rowData}
216                                                 {else}  
217                                {sugar_field parentFieldArray=$rowData vardef=$params displayType=ListView field=$col}
218                                
219                                                 {/if}
220                                                 {if empty($rowData.$col) && empty($params.customCode)}&nbsp;{/if}
221                                                 {if $params.link && !$params.customCode}
222                                                         </{$pageData.tag.$id[$params.ACLTag]|default:$pageData.tag.$id.MAIN}>
223                             {/if}
224                             {if $col == 'NAME' || $params.bold}</b>{/if}
225                                         </td>
226                                         {/strip}
227                         {assign var='scope_row' value=false}
228                                         {counter name="colCounter"}
229                                 {/foreach}
230                                 <td align='right'>{$pageData.additionalDetails.$id}</td>
231                         </tr>
232                 {foreachelse}
233                 <tr height='20' class='{$rowColor[0]}S1'>
234                     <td colspan="{$colCount}">
235                         <em>{$APP.LBL_NO_DATA}</em>
236                     </td>
237                 </tr> 
238                 {/foreach}
239     {assign var="link_select_id" value="selectLinkBottom"}
240     {assign var="link_action_id" value="actionLinkBottom"}
241     {assign var="selectLink" value=$selectLinkBottom}
242     {assign var="actionsLink" value=$actionsLinkBottom}
243     {assign var="action_menu_location" value="bottom"}
244     {include file='include/ListView/ListViewPagination.tpl'}
245         </table>
246 {/if}
247 {if $contextMenus}
248 <script type="text/javascript">
249 {$contextMenuScript}
250 {literal}
251 function lvg_nav(m,id,act,offset,t){
252     if(t.href.search(/#/) < 0){return;}
253     else{
254         if(act=='pte'){
255             act='ProjectTemplatesEditView';
256         }
257         else if(act=='d'){
258             act='DetailView';
259         }else if( act =='ReportsWizard'){
260             act = 'ReportsWizard';
261         }else{
262             act='EditView';
263         }
264     {/literal}
265         url = 'index.php?module='+m+'&offset=' + offset + '&stamp={$pageData.stamp}&return_module='+m+'&action='+act+'&record='+id;
266         t.href=url;
267     {literal}
268     }
269 }{/literal}
270 {literal}
271     function lvg_dtails(id){{/literal}
272         return SUGAR.util.getAdditionalDetails( '{$pageData.bean.moduleDir|default:$params.module}',id, 'adspan_'+id);{literal}}{/literal}
273 </script>
274 {/if}