Commit e9cda9339e96498c276f34347dd083c968670834

Authored by Conrad Vermeulen
1 parent f98e9fb5

KTS-3769

"Javascript error when the user navigates to a saved search in the French translation."
Fixed. 

Committed By: Conrad Vermeulen
Reviewed By: Philip Arkoll

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@9480 c91229c3-7414-0410-bfa2-8a42b809f60b
templates/ktcore/search2/search_results.smarty
1 -{$context->oPage->requireJSResource('resources/js/toggleselect.js')}  
2 -  
3 -<div class="collapsible">  
4 -<h4 onclick="toggleElementClass('expanded', this.parentNode)">{i18n}Search Criteria{/i18n}</h4>  
5 -<div class="collapsiblebody">  
6 -<fieldset>  
7 - <legend>{i18n}Search Criteria{/i18n}</legend>  
8 - {$txtQuery}  
9 - <br>  
10 -{if empty($iSavedID)}  
11 - {capture assign=options}  
12 - <a href="{addQS}action=queryBuilder{/addQS}">{i18n}Search Critieria Editor{/i18n}</a>  
13 - {/capture}  
14 - {i18n arg_options=$options}Use the #options# to extend your search criteria.{/i18n}  
15 -{/if}  
16 -{if !$search2_anonymous && !empty($iSavedID)}  
17 - {capture assign=options}  
18 - <a href="{addQS}action=queryBuilder&fSavedSearchId={$iSavedID}{/addQS}">Query Editor</a>  
19 - {/capture}  
20 - {i18n arg_options=$options}To edit the search criteria, use the #options#.{/i18n}  
21 -{/if}  
22 - <font color=brown><div id="savedSearch" style="display: none">{i18n}The search criteria has been saved.{/i18n}</div></font>  
23 -</fieldset>  
24 -<br>  
25 -{if !$search2_anonymous && !empty($iSavedID)}  
26 -<fieldset>  
27 - <legend>{i18n}Saved Search{/i18n}</legend>  
28 - {i18n}This is the saved search criteria:{/i18n} {$txtSavedName}. <br/>  
29 - {capture assign=options}  
30 - <a href="{addQS}action=manage{/addQS}">{i18n}Manage Saved Search Criteria{/i18n}</a>  
31 - {/capture}  
32 - {i18n arg_options=$options}To delete this saved search criteria or to edit other saved search criteria, #options#.{/i18n}  
33 -</fieldset>  
34 -{/if}  
35 -{literal}  
36 -<script language="javascript">  
37 -function saveSearch()  
38 -{  
39 - var txtName = $('txtSaveName');  
40 - var txtQuery = '{/literal}{$txtQuery|escape:'quotes'}{literal}';  
41 - if (txtName.value == '')  
42 - {  
43 - alert('{/literal}{i18n}Please enter a name for the search expression.{/i18n}{literal}');  
44 - txtName.focus();  
45 - return;  
46 - }  
47 - url='{/literal}{$rootUrl}{literal}/search2/ajax/saveExpr.php';  
48 -  
49 - Ext.Ajax.request(  
50 - {  
51 - url: url,  
52 - method: 'GET',  
53 - success: function callBack(o)  
54 - {  
55 - if (o.responseText != '{}')  
56 - {  
57 - var resp = eval('(' + o.responseText + ')');  
58 -  
59 - if (resp.status == 0)  
60 - {  
61 - parseSuccess = true;  
62 - $('saveSearch').style.display='none';  
63 - $('savedSearch').style.display='block';  
64 - }  
65 - else  
66 - {  
67 - alert('{/literal}{i18n}There is a problem saving the expression expression.{/i18n}{literal}\n\n' + resp.message );  
68 - }  
69 - }  
70 - },  
71 - failure: function(o)  
72 - {  
73 - alert('{/literal}{i18n}There is a problem communicating with the server.{/i18n}{literal}' + o.responseText);  
74 - },  
75 - params: {  
76 - txtName: txtName.value,  
77 - txtQuery: txtQuery  
78 - }  
79 - });  
80 -}  
81 -  
82 -function onSelectAll()  
83 -{  
84 - var cbSelectAll = $('cbSelectAll');  
85 -  
86 - for(var i={/literal}{$firstRec}{literal};i<{/literal}{$lastRec}{literal};i++)  
87 - {  
88 - var cb = $('cb' + i);  
89 -  
90 - cb.checked = cbSelectAll.checked;  
91 - }  
92 -}  
93 -  
94 -function onShowAll(showall)  
95 -{  
96 - url = "{/literal}{addQS}{literal}action=searchResults&pageOffset={/literal}{$pageOffset}{literal}&showAll=" + showall + "{/literal}{/addQS}{literal}";  
97 -  
98 - document.location = url;  
99 -}  
100 -  
101 -</script>  
102 -{/literal}  
103 -</div>  
104 -</div>  
105 -{if !$search2_anonymous && empty($iSavedID)}  
106 -<div id="saveSearch">  
107 -<fieldset>  
108 - <legend>{i18n}You can save this search:{/i18n}</legend>  
109 - <input id=txtSaveName>  
110 - <input type=button value="{i18n}Save{/i18n}" onclick="saveSearch()">  
111 -</fieldset>  
112 -</div>  
113 -{/if}  
114 -  
115 -  
116 -<fieldset>  
117 -  
118 -<legend>{i18n}Search Results{/i18n}</legend>  
119 -  
120 -{if $numResults == 0}  
121 -  
122 - {i18n}There are no search results matching your search criteria.{/i18n}  
123 -  
124 - <p>  
125 - {capture assign=options}  
126 - <a href="{addQS}action=queryBuilder{/addQS}">{i18n}Search Criteria Editor{/i18n}</a>  
127 - {/capture}  
128 -  
129 - {i18n arg_options=$options}Use the #options# to extend this query.{/i18n}  
130 -  
131 -{else}  
132 -  
133 - <form method=post action="{$rootUrl}/action.php">  
134 - <table border=0 cellpadding="1" cellspacing="1" width="100%" align=center>  
135 - {assign var=cbid value=0}  
136 -  
137 - {i18n arg_count=$numResults}Search results found: #count#{/i18n}  
138 - <br/>  
139 - <br/>  
140 -  
141 - {foreach item=hit from=$results}  
142 - <tr><td>  
143 - <input type="checkbox" {if $hit->IsDocument}name="selection_d[]"{else}name="selection_f[]"{/if} id="cb{$cbid}" value="{$hit->Id}"><nobr>  
144 - <span class="contenttype {$hit->MimeIconPath}">  
145 -  
146 - {if $hit->IsDocument}  
147 - &nbsp;&nbsp;<a href="{$rootUrl}/view.php?fDocumentId={$hit->Id}"><B>{$hit->Title|truncate:80}</b></a>  
148 - {if $hit->Title != $hit->Filename}  
149 - &nbsp;&nbsp;  
150 - <font style=" color: green "> - {i18n}Filename:{/i18n} {$hit->Filename|truncate:40}</font>  
151 - {/if}  
152 - {if $hit->IsAvailable}  
153 - &nbsp;&nbsp;  
154 - <img src="{$rootUrl}/resources/graphics/download.png" title="Download Document" onclick="document.location='{$rootUrl}/action.php?kt_path_info=ktcore.actions.document.view&fDocumentId={$hit->Id}';"></a>  
155 -  
156 - {/if}  
157 -  
158 -  
159 - {if !$hit->IsAvailable}  
160 - &nbsp;&nbsp;  
161 - <font style=" color: red "><B> * {i18n}NOT AVAILABLE{/i18n} * </B></font>  
162 - {/if}  
163 -  
164 - {else}  
165 - &nbsp;&nbsp;<a href="{$rootUrl}/browse.php?fFolderId={$hit->RealId}{if $hit->IsProxy}&fShortcutFolder={$hit->Id}{/if}"><B>{$hit->Title|truncate:80}</b></a>  
166 -  
167 - {/if}  
168 -  
169 - </nobr>  
170 - </td><td align=right>  
171 - {if $hit->IsDocument}  
172 - <font style="color: green ">{i18n}Document ID:{/i18n} {$hit->Id}</font>  
173 - &nbsp;&nbsp;  
174 - <font style=" color: orange ">{i18n}Version:{/i18n} {$hit->Version}</font></td>  
175 - {else}  
176 - <font style="color: green ">{i18n}Folder ID:{/i18n} {$hit->Id}</font>  
177 - {/if}  
178 - </tr>  
179 - <tr><td colspan=2>{$hit->Text}</td></tr>  
180 - <tr><td>  
181 - {if $hit->IsDocument}  
182 - <font style=" color: green "><a href="{$rootUrl}/browse.php?fFolderId={$hit->FolderId}" tag="{$hit->FullPath}">{$hit->FullPath|truncate:40}</a>/{$hit->Title|truncate:40} - {$hit->Filesize}</font>  
183 - {else}  
184 - <font style=" color: green "><a href="{$rootUrl}/browse.php?fFolderId={$hit->FolderId}" tag="{$hit->FullPath}">{$hit->FullPath|truncate:40}</a></font>  
185 - {/if}  
186 - </td>  
187 - <td align=right><nobr>  
188 - <font style="color: orange ">  
189 - {i18n}Created By:{/i18n} {$hit->CreatedBy}  
190 - {if $hit->IsDocument}  
191 - {i18n}on{/i18n} {$hit->DateCreated}  
192 - {/if}  
193 - </font>  
194 - </td>  
195 - {if $hit->IsDocument}  
196 - <tr><td>  
197 - {if $workflow != ''}  
198 - <font style="color: orange ">{i18n}Workflow:{/i18n} $hit->Workflow}</font>  
199 - {/if}  
200 - </td>  
201 - <td align=right><nobr>  
202 - <font style="color: brown ">  
203 - {if $hit->CheckedOutUser != ''}  
204 - <b>{i18n}Checked out by:{/i18n} {$hit->CheckedOutUser}  
205 - {i18n}on{/i18n} {$hit->DateCheckedOut}</b>  
206 - {else}  
207 - {i18n}Modified by:{/i18n} {$hit->ModifiedBy}  
208 - {i18n}on{/i18n} {$hit->DateModified}  
209 - {/if}  
210 - </font>  
211 - </td>  
212 - {/if}  
213 -  
214 - <tr><td colspan=2><br></br></td></tr></tr>  
215 -  
216 - {assign var=cbid value=$cbid+1}  
217 - {/foreach}  
218 -  
219 - <tr><td>  
220 - <input type="checkbox" id="cbSelectAll" onclick="onSelectAll()">&nbsp;&nbsp;{i18n}Select All{/i18n}  
221 - {if $showAll}  
222 - <input type="checkbox" onclick="onShowAll('false')" checked>&nbsp;&nbsp;{i18n}Show All{/i18n}  
223 - {/if}  
224 - {if !$showAll}  
225 - <input type="checkbox" onclick="onShowAll('true')">&nbsp;&nbsp;{i18n}Show All{/i18n}  
226 - {/if}  
227 - <br>  
228 - <input type="hidden" name="fFolderId" value="1" />  
229 - <input type="hidden" name="sListCode" value="" />  
230 - <input type="hidden" name="action" value="bulkaction" />  
231 - <input type="hidden" name="fReturnAction" value="search2" />  
232 - <input type="hidden" name="fReturnData" value="1" />  
233 -  
234 - <nobr>  
235 - {foreach from=$bulkactions item=bulkaction}  
236 - <input type="submit" name="submit[{$bulkaction->getName()}]" value="{$bulkaction->getDisplayName()}" />  
237 - {/foreach}  
238 - </nobr>  
239 -</table>  
240 -</form>  
241 -  
242 -{/if}  
243 -  
244 -  
245 -</fieldset>  
246 -  
247 -{if $endMovement - $startMovement > 0}  
248 -<br>  
249 -<br>  
250 -<table align="center">  
251 -<tr>  
252 - {foreach item=move from=$pageMovement}  
253 - {if $move == $startMovement}  
254 - <td></td>  
255 - {/if}  
256 - <td><a href="{$rootUrl}/search2.php?action=searchResults&pageOffset={$move}">{$move}</a></td>  
257 - {if $move == $endMovement}  
258 - <td></td>  
259 - {/if}  
260 - {/foreach}  
261 -</tr>  
262 -</table>  
263 -{/if} 1 +{$context->oPage->requireJSResource('resources/js/toggleselect.js')}
  2 +
  3 +<div class="collapsible">
  4 +<h4 onclick="toggleElementClass('expanded', this.parentNode)">{i18n}Search Criteria{/i18n}</h4>
  5 +<div class="collapsiblebody">
  6 +<fieldset>
  7 + <legend>{i18n}Search Criteria{/i18n}</legend>
  8 + {$txtQuery}
  9 + <br>
  10 +{if empty($iSavedID)}
  11 + {capture assign=options}
  12 + <a href="{addQS}action=queryBuilder{/addQS}">{i18n}Search Critieria Editor{/i18n}</a>
  13 + {/capture}
  14 + {i18n arg_options=$options}Use the #options# to extend your search criteria.{/i18n}
  15 +{/if}
  16 +{if !$search2_anonymous && !empty($iSavedID)}
  17 + {capture assign=options}
  18 + <a href="{addQS}action=queryBuilder&fSavedSearchId={$iSavedID}{/addQS}">Query Editor</a>
  19 + {/capture}
  20 + {i18n arg_options=$options}To edit the search criteria, use the #options#.{/i18n}
  21 +{/if}
  22 + <font color=brown><div id="savedSearch" style="display: none">{i18n}The search criteria has been saved.{/i18n}</div></font>
  23 +</fieldset>
  24 +<br>
  25 +{if !$search2_anonymous && !empty($iSavedID)}
  26 +<fieldset>
  27 + <legend>{i18n}Saved Search{/i18n}</legend>
  28 + {i18n}This is the saved search criteria:{/i18n} {$txtSavedName}. <br/>
  29 + {capture assign=options}
  30 + <a href="{addQS}action=manage{/addQS}">{i18n}Manage Saved Search Criteria{/i18n}</a>
  31 + {/capture}
  32 + {i18n arg_options=$options}To delete this saved search criteria or to edit other saved search criteria, #options#.{/i18n}
  33 +</fieldset>
  34 +{/if}
  35 +{literal}
  36 +<script language="javascript">
  37 +function saveSearch()
  38 +{
  39 + var txtName = $('txtSaveName');
  40 + var txtQuery = '{/literal}{$txtQuery|escape:'quotes'}{literal}';
  41 + if (txtName.value == '')
  42 + {
  43 + alert("{/literal}{i18n}Please enter a name for the search expression.{/i18n}{literal}");
  44 + txtName.focus();
  45 + return;
  46 + }
  47 + url='{/literal}{$rootUrl}{literal}/search2/ajax/saveExpr.php';
  48 +
  49 + Ext.Ajax.request(
  50 + {
  51 + url: url,
  52 + method: 'GET',
  53 + success: function callBack(o)
  54 + {
  55 + if (o.responseText != '{}')
  56 + {
  57 + var resp = eval('(' + o.responseText + ')');
  58 +
  59 + if (resp.status == 0)
  60 + {
  61 + parseSuccess = true;
  62 + $('saveSearch').style.display='none';
  63 + $('savedSearch').style.display='block';
  64 + }
  65 + else
  66 + {
  67 + alert("{/literal}{i18n}There is a problem saving the expression expression.{/i18n}{literal}\n\n" + resp.message );
  68 + }
  69 + }
  70 + },
  71 + failure: function(o)
  72 + {
  73 + alert("{/literal}{i18n}There is a problem communicating with the server.{/i18n}{literal}" + o.responseText);
  74 + },
  75 + params: {
  76 + txtName: txtName.value,
  77 + txtQuery: txtQuery
  78 + }
  79 + });
  80 +}
  81 +
  82 +function onSelectAll()
  83 +{
  84 + var cbSelectAll = $('cbSelectAll');
  85 +
  86 + for(var i={/literal}{$firstRec}{literal};i<{/literal}{$lastRec}{literal};i++)
  87 + {
  88 + var cb = $('cb' + i);
  89 +
  90 + cb.checked = cbSelectAll.checked;
  91 + }
  92 +}
  93 +
  94 +function onShowAll(showall)
  95 +{
  96 + url = "{/literal}{addQS}{literal}action=searchResults&pageOffset={/literal}{$pageOffset}{literal}&showAll=" + showall + "{/literal}{/addQS}{literal}";
  97 +
  98 + document.location = url;
  99 +}
  100 +
  101 +</script>
  102 +{/literal}
  103 +</div>
  104 +</div>
  105 +{if !$search2_anonymous && empty($iSavedID)}
  106 +<div id="saveSearch">
  107 +<fieldset>
  108 + <legend>{i18n}You can save this search:{/i18n}</legend>
  109 + <input id=txtSaveName>
  110 + <input type=button value="{i18n}Save{/i18n}" onclick="saveSearch()">
  111 +</fieldset>
  112 +</div>
  113 +{/if}
  114 +
  115 +
  116 +<fieldset>
  117 +
  118 +<legend>{i18n}Search Results{/i18n}</legend>
  119 +
  120 +{if $numResults == 0}
  121 +
  122 + {i18n}There are no search results matching your search criteria.{/i18n}
  123 +
  124 + <p>
  125 + {capture assign=options}
  126 + <a href="{addQS}action=queryBuilder{/addQS}">{i18n}Search Criteria Editor{/i18n}</a>
  127 + {/capture}
  128 +
  129 + {i18n arg_options=$options}Use the #options# to extend this query.{/i18n}
  130 +
  131 +{else}
  132 +
  133 + <form method=post action="{$rootUrl}/action.php">
  134 + <table border=0 cellpadding="1" cellspacing="1" width="100%" align=center>
  135 + {assign var=cbid value=0}
  136 +
  137 + {i18n arg_count=$numResults}Search results found: #count#{/i18n}
  138 + <br/>
  139 + <br/>
  140 +
  141 + {foreach item=hit from=$results}
  142 + <tr><td>
  143 + <input type="checkbox" {if $hit->IsDocument}name="selection_d[]"{else}name="selection_f[]"{/if} id="cb{$cbid}" value="{$hit->Id}"><nobr>
  144 + <span class="contenttype {$hit->MimeIconPath}">
  145 +
  146 + {if $hit->IsDocument}
  147 + &nbsp;&nbsp;<a href="{$rootUrl}/view.php?fDocumentId={$hit->Id}"><B>{$hit->Title|truncate:80}</b></a>
  148 + {if $hit->Title != $hit->Filename}
  149 + &nbsp;&nbsp;
  150 + <font style=" color: green "> - {i18n}Filename:{/i18n} {$hit->Filename|truncate:40}</font>
  151 + {/if}
  152 + {if $hit->IsAvailable}
  153 + &nbsp;&nbsp;
  154 + <img src="{$rootUrl}/resources/graphics/download.png" title="Download Document" onclick="document.location='{$rootUrl}/action.php?kt_path_info=ktcore.actions.document.view&fDocumentId={$hit->Id}';"></a>
  155 +
  156 + {/if}
  157 +
  158 +
  159 + {if !$hit->IsAvailable}
  160 + &nbsp;&nbsp;
  161 + <font style=" color: red "><B> * {i18n}NOT AVAILABLE{/i18n} * </B></font>
  162 + {/if}
  163 +
  164 + {else}
  165 + &nbsp;&nbsp;<a href="{$rootUrl}/browse.php?fFolderId={$hit->RealId}{if $hit->IsProxy}&fShortcutFolder={$hit->Id}{/if}"><B>{$hit->Title|truncate:80}</b></a>
  166 +
  167 + {/if}
  168 +
  169 + </nobr>
  170 + </td><td align=right>
  171 + {if $hit->IsDocument}
  172 + <font style="color: green ">{i18n}Document ID:{/i18n} {$hit->Id}</font>
  173 + &nbsp;&nbsp;
  174 + <font style=" color: orange ">{i18n}Version:{/i18n} {$hit->Version}</font></td>
  175 + {else}
  176 + <font style="color: green ">{i18n}Folder ID:{/i18n} {$hit->Id}</font>
  177 + {/if}
  178 + </tr>
  179 + <tr><td colspan=2>{$hit->Text}</td></tr>
  180 + <tr><td>
  181 + {if $hit->IsDocument}
  182 + <font style=" color: green "><a href="{$rootUrl}/browse.php?fFolderId={$hit->FolderId}" tag="{$hit->FullPath}">{$hit->FullPath|truncate:40}</a>/{$hit->Title|truncate:40} - {$hit->Filesize}</font>
  183 + {else}
  184 + <font style=" color: green "><a href="{$rootUrl}/browse.php?fFolderId={$hit->FolderId}" tag="{$hit->FullPath}">{$hit->FullPath|truncate:40}</a></font>
  185 + {/if}
  186 + </td>
  187 + <td align=right><nobr>
  188 + <font style="color: orange ">
  189 + {i18n}Created By:{/i18n} {$hit->CreatedBy}
  190 + {if $hit->IsDocument}
  191 + {i18n}on{/i18n} {$hit->DateCreated}
  192 + {/if}
  193 + </font>
  194 + </td>
  195 + {if $hit->IsDocument}
  196 + <tr><td>
  197 + {if $workflow != ''}
  198 + <font style="color: orange ">{i18n}Workflow:{/i18n} $hit->Workflow}</font>
  199 + {/if}
  200 + </td>
  201 + <td align=right><nobr>
  202 + <font style="color: brown ">
  203 + {if $hit->CheckedOutUser != ''}
  204 + <b>{i18n}Checked out by:{/i18n} {$hit->CheckedOutUser}
  205 + {i18n}on{/i18n} {$hit->DateCheckedOut}</b>
  206 + {else}
  207 + {i18n}Modified by:{/i18n} {$hit->ModifiedBy}
  208 + {i18n}on{/i18n} {$hit->DateModified}
  209 + {/if}
  210 + </font>
  211 + </td>
  212 + {/if}
  213 +
  214 + <tr><td colspan=2><br></br></td></tr></tr>
  215 +
  216 + {assign var=cbid value=$cbid+1}
  217 + {/foreach}
  218 +
  219 + <tr><td>
  220 + <input type="checkbox" id="cbSelectAll" onclick="onSelectAll()">&nbsp;&nbsp;{i18n}Select All{/i18n}
  221 + {if $showAll}
  222 + <input type="checkbox" onclick="onShowAll('false')" checked>&nbsp;&nbsp;{i18n}Show All{/i18n}
  223 + {/if}
  224 + {if !$showAll}
  225 + <input type="checkbox" onclick="onShowAll('true')">&nbsp;&nbsp;{i18n}Show All{/i18n}
  226 + {/if}
  227 + <br>
  228 + <input type="hidden" name="fFolderId" value="1" />
  229 + <input type="hidden" name="sListCode" value="" />
  230 + <input type="hidden" name="action" value="bulkaction" />
  231 + <input type="hidden" name="fReturnAction" value="search2" />
  232 + <input type="hidden" name="fReturnData" value="1" />
  233 +
  234 + <nobr>
  235 + {foreach from=$bulkactions item=bulkaction}
  236 + <input type="submit" name="submit[{$bulkaction->getName()}]" value="{$bulkaction->getDisplayName()}" />
  237 + {/foreach}
  238 + </nobr>
  239 +</table>
  240 +</form>
  241 +
  242 +{/if}
  243 +
  244 +
  245 +</fieldset>
  246 +
  247 +{if $endMovement - $startMovement > 0}
  248 +<br>
  249 +<br>
  250 +<table align="center">
  251 +<tr>
  252 + {foreach item=move from=$pageMovement}
  253 + {if $move == $startMovement}
  254 + <td></td>
  255 + {/if}
  256 + <td><a href="{$rootUrl}/search2.php?action=searchResults&pageOffset={$move}">{$move}</a></td>
  257 + {if $move == $endMovement}
  258 + <td></td>
  259 + {/if}
  260 + {/foreach}
  261 +</tr>
  262 +</table>
  263 +{/if}