Commit f6fc2fee032dc37ba2df24d29af51da2cd758dcc

Authored by conradverm
1 parent ac0d7619

KTS-673

"The search algorithm needs some work"
Updated. Internationalised advanced query builder.

Committed By: Conrad Vermeulen
Reviewed By: Kevin Fourie

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7250 c91229c3-7414-0410-bfa2-8a42b809f60b
templates/ktcore/search2/adv_query_builder.smarty
@@ -78,8 +78,8 @@ function createUserList(groupid, fid) @@ -78,8 +78,8 @@ function createUserList(groupid, fid)
78 var html = "<table><tr><td width=\"140\">"; 78 var html = "<table><tr><td width=\"140\">";
79 79
80 html += "<SELECT style=\"width: 140px \" id=\"field" + groupid + "_" + fid + "op\">"; 80 html += "<SELECT style=\"width: 140px \" id=\"field" + groupid + "_" + fid + "op\">";
81 - html += "<option value=\"is\">is";  
82 - html += "<option value=\"is not\">is not"; 81 + html += "<option value=\"is\">{/literal}{i81n}is{/i81n}{literal}";
  82 + html += "<option value=\"is not\">{/literal}{i81n}is not{/i81n}{literal}";
83 html += "</SELECT>" 83 html += "</SELECT>"
84 84
85 html += "<td>" 85 html += "<td>"
@@ -101,8 +101,8 @@ function createDocTypes(groupid, fid) @@ -101,8 +101,8 @@ function createDocTypes(groupid, fid)
101 var html = "<table><tr><td width=\"140\">"; 101 var html = "<table><tr><td width=\"140\">";
102 102
103 html += "<SELECT style=\"width: 140px \" id=\"field" + groupid + "_" + fid + "op\">"; 103 html += "<SELECT style=\"width: 140px \" id=\"field" + groupid + "_" + fid + "op\">";
104 - html += "<option value=\"is\">is";  
105 - html += "<option value=\"is not\">is not"; 104 + html += "<option value=\"is\">{/literal}{i81n}is{/i81n}{literal}";
  105 + html += "<option value=\"is not\">{/literal}{i81n}is not{/i81n}{literal}";
106 html += "</SELECT>" 106 html += "</SELECT>"
107 107
108 html += "<td>" 108 html += "<td>"
@@ -124,8 +124,8 @@ function createMimeTypes(groupid, fid) @@ -124,8 +124,8 @@ function createMimeTypes(groupid, fid)
124 var html = "<table><tr><td width=\"140\">"; 124 var html = "<table><tr><td width=\"140\">";
125 125
126 html += "<SELECT style=\"width: 140px \" id=\"field" + groupid + "_" + fid + "op\">"; 126 html += "<SELECT style=\"width: 140px \" id=\"field" + groupid + "_" + fid + "op\">";
127 - html += "<option value=\"is\">is";  
128 - html += "<option value=\"is not\">is not"; 127 + html += "<option value=\"is\">{/literal}{i81n}is{/i81n}{literal}";
  128 + html += "<option value=\"is not\">{/literal}{i81n}is not{/i81n}{literal}";
129 html += "</SELECT>" 129 html += "</SELECT>"
130 130
131 html += "<td>" 131 html += "<td>"
@@ -181,11 +181,11 @@ function createRange(groupid, fid, type) @@ -181,11 +181,11 @@ function createRange(groupid, fid, type)
181 switch(type) 181 switch(type)
182 { 182 {
183 case 'DATE': 183 case 'DATE':
184 - html += "<option value=\"\>=\">after";  
185 - html += "<option value=\"between\">between";  
186 - html += "<option value=\"<=\">before";  
187 - html += "<option value=\"is\">on";  
188 - html += "<option value=\"is not\">not on"; 184 + html += "<option value=\"\>=\">{/literal}{i81n}after{/i81n}{literal}";
  185 + html += "<option value=\"between\">{/literal}{i81n}between{/i81n}{literal}";
  186 + html += "<option value=\"<=\">{/literal}{i81n}before{/i81n}{literal}";
  187 + html += "<option value=\"is\">{/literal}{i81n}on{/i81n}{literal}";
  188 + html += "<option value=\"is not\">{/literal}{i81n}not on{/i81n}{literal}";
189 break; 189 break;
190 default: 190 default:
191 html += "<option value=\"is\">="; 191 html += "<option value=\"is\">=";
@@ -194,7 +194,7 @@ function createRange(groupid, fid, type) @@ -194,7 +194,7 @@ function createRange(groupid, fid, type)
194 html += "<option value=\"\>=\">\>="; 194 html += "<option value=\"\>=\">\>=";
195 html += "<option value=\"\<\">\<"; 195 html += "<option value=\"\<\">\<";
196 html += "<option value=\"\<=\">\<="; 196 html += "<option value=\"\<=\">\<=";
197 - html += "<option value=\"between\">between"; 197 + html += "<option value=\"between\">{/literal}{i81n}between{/i81n}{literal}";
198 break; 198 break;
199 } 199 }
200 html += "</SELECT>"; 200 html += "</SELECT>";
@@ -316,10 +316,10 @@ function createFilesize(groupid, fid) @@ -316,10 +316,10 @@ function createFilesize(groupid, fid)
316 html += "<td valign=top width=\"50px\"><div id=\"field"+ groupid + '_' + fid +"input\"></div>"; 316 html += "<td valign=top width=\"50px\"><div id=\"field"+ groupid + '_' + fid +"input\"></div>";
317 html += "<td>"; 317 html += "<td>";
318 html += "<SELECT id=\"field" + groupid + "_" + fid + "factor\" onchange=\"onFilesizeChange( " + groupid + "," + fid + ")\">"; 318 html += "<SELECT id=\"field" + groupid + "_" + fid + "factor\" onchange=\"onFilesizeChange( " + groupid + "," + fid + ")\">";
319 - html += "<option>bytes";  
320 - html += "<option>kilobytes";  
321 - html += "<option>megabytes";  
322 - html += "<option>gigabytes"; 319 + html += "<option>{/literal}{i81n}bytes{/i81n}{literal}";
  320 + html += "<option>{/literal}{i81n}kilobytes{/i81n}{literal}";
  321 + html += "<option>{/literal}{i81n}megabytes{/i81n}{literal}";
  322 + html += "<option>{/literal}{i81n}gigabytes{/i81n}{literal}";
323 html += "</SELECT>"; 323 html += "</SELECT>";
324 html += "<input style=\"display: none\" value=\"1\" id=\"field" + groupid + "_" + fid + "start\">"; 324 html += "<input style=\"display: none\" value=\"1\" id=\"field" + groupid + "_" + fid + "start\">";
325 html += "<td width=\"100%\">&nbsp;"; 325 html += "<td width=\"100%\">&nbsp;";
@@ -333,17 +333,17 @@ function createDateDiff(groupid, fid) @@ -333,17 +333,17 @@ function createDateDiff(groupid, fid)
333 var html = "<table><tr><td width=\"140\""; 333 var html = "<table><tr><td width=\"140\"";
334 334
335 html += "<SELECT style=\"width: 140px\" id=\"field" + groupid + "_" + fid + "op\">"; 335 html += "<SELECT style=\"width: 140px\" id=\"field" + groupid + "_" + fid + "op\">";
336 - html += "<option value=\"is\">is";  
337 - html += "<option value=\"is not\">is not"; 336 + html += "<option value=\"is\">{/literal}{i81n}is{/i81n}{literal}";
  337 + html += "<option value=\"is not\">{/literal}{i81n}is not{/i81n}{literal}";
338 html += "</SELECT>" 338 html += "</SELECT>"
339 339
340 340
341 html += "<td valign=top width=\"50px\"><div id=\"field"+ groupid + '_' + fid +"input\"></div>"; 341 html += "<td valign=top width=\"50px\"><div id=\"field"+ groupid + '_' + fid +"input\"></div>";
342 html += "<td>"; 342 html += "<td>";
343 html += "<SELECT id=\"field" + groupid + "_" + fid + "period\" onchange=\"onDateDiffChange( " + groupid + "," + fid + ")\">"; 343 html += "<SELECT id=\"field" + groupid + "_" + fid + "period\" onchange=\"onDateDiffChange( " + groupid + "," + fid + ")\">";
344 - html += "<option>days";  
345 - html += "<option>months";  
346 - html += "<option>years"; 344 + html += "<option>{/literal}{i81n}days{/i81n}{literal}";
  345 + html += "<option>{/literal}{i81n}months{/i81n}{literal}";
  346 + html += "<option>{/literal}{i81n}years{/i81n}{literal}";
347 html += "</SELECT>"; 347 html += "</SELECT>";
348 html += "<td>ago" 348 html += "<td>ago"
349 html += "<input style=\"display: none\" value=\"1\" id=\"field" + groupid + "_" + fid + "start\">"; 349 html += "<input style=\"display: none\" value=\"1\" id=\"field" + groupid + "_" + fid + "start\">";
@@ -358,8 +358,8 @@ function createSelect(groupid, fid, options) @@ -358,8 +358,8 @@ function createSelect(groupid, fid, options)
358 var html = "<table><tr><td width=\"140\">"; 358 var html = "<table><tr><td width=\"140\">";
359 359
360 html += "<select id=\"field"+ groupid + "_" + fid +"op\" style=\"width: 140px\">"; 360 html += "<select id=\"field"+ groupid + "_" + fid +"op\" style=\"width: 140px\">";
361 - html += "<option value=\"is\">is";  
362 - html += "<option value=\"is not\">is not"; 361 + html += "<option value=\"is\">{/literal}{i81n}is{/i81n}{literal}";
  362 + html += "<option value=\"is not\">{/literal}{i81n}is not{/i81n}{literal}";
363 html += "</select>&nbsp;&nbsp;"; 363 html += "</select>&nbsp;&nbsp;";
364 364
365 html += "<td valign=top>"; 365 html += "<td valign=top>";
@@ -384,22 +384,22 @@ function createText(groupid, fid, type) @@ -384,22 +384,22 @@ function createText(groupid, fid, type)
384 { 384 {
385 case 'STRINGMATCH': 385 case 'STRINGMATCH':
386 readonly = 'readonly'; 386 readonly = 'readonly';
387 - html += "<option value=\"is\">is";  
388 - html += "<option value=\"is not\">is not"; 387 + html += "<option value=\"is\">{/literal}{i81n}is{/i81n}{literal}";
  388 + html += "<option value=\"is not\">{/literal}{i81n}is not{/i81n}{literal}";
389 break; 389 break;
390 case 'STRING': 390 case 'STRING':
391 - html += "<option value=\"is\">is";  
392 - html += "<option value=\"is not\">is not";  
393 - html += "<option value=\"contains\">contains";  
394 - html += "<option value=\"does not contain\">does not contain";  
395 - html += "<option value=\"is like\">like";  
396 - html += "<option value=\"is not like\">not like";  
397 - html += "<option value=\"starts with\">starts with";  
398 - html += "<option value=\"ends with\">ends with"; 391 + html += "<option value=\"is\">{/literal}{i81n}is{/i81n}{literal}";
  392 + html += "<option value=\"is not\">{/literal}{i81n}is not{/i81n}{literal}";
  393 + html += "<option value=\"contains\">{/literal}{i81n}contains{/i81n}{literal}";
  394 + html += "<option value=\"does not contain\">{/literal}{i81n}does not contain{/i81n}{literal}";
  395 + html += "<option value=\"is like\">{/literal}{i81n}like{/i81n}{literal}";
  396 + html += "<option value=\"is not like\">{/literal}{i81n}not like{/i81n}{literal}";
  397 + html += "<option value=\"starts with\">{/literal}{i81n}starts with{/i81n}{literal}";
  398 + html += "<option value=\"ends with\">{/literal}{i81n}ends with{/i81n}{literal}";
399 break; 399 break;
400 case 'FULLTEXT': 400 case 'FULLTEXT':
401 - html += "<option value=\"contains\">contains";  
402 - html += "<option value=\"does not contain\">does not contain"; 401 + html += "<option value=\"contains\">{/literal}{i81n}contains{/i81n}{literal}";
  402 + html += "<option value=\"does not contain\">{/literal}{i81n}does not contain{/i81n}{literal}";
403 break; 403 break;
404 } 404 }
405 405
@@ -416,12 +416,12 @@ function createText(groupid, fid, type) @@ -416,12 +416,12 @@ function createText(groupid, fid, type)
416 function createBool(groupid, fid) 416 function createBool(groupid, fid)
417 { 417 {
418 var html = "<select style=\"width: 140px\" id=\"field"+ groupid + "_" + fid +"op\"\>"; 418 var html = "<select style=\"width: 140px\" id=\"field"+ groupid + "_" + fid +"op\"\>";
419 - html += "<option value=\"is\">is";  
420 - html += "<option value=\"is not\">is not"; 419 + html += "<option value=\"is\">{/literal}{i81n}is{/i81n}{literal}";
  420 + html += "<option value=\"is not\">{/literal}{i81n}is not{/i81n}{literal}";
421 html += "</select>&nbsp;&nbsp;"; 421 html += "</select>&nbsp;&nbsp;";
422 html += "<select id=\"field"+ groupid + "_" + fid +"start\"\>"; 422 html += "<select id=\"field"+ groupid + "_" + fid +"start\"\>";
423 - html += "<option value=\"true\">True";  
424 - html += "<option value=\"false\">False"; 423 + html += "<option value=\"true\">{/literal}{i81n}True{/i81n}{literal}";
  424 + html += "<option value=\"false\">{/literal}{i81n}False{/i81n}{literal}";
425 html += "</select>&nbsp;&nbsp;"; 425 html += "</select>&nbsp;&nbsp;";
426 426
427 return html; 427 return html;
@@ -747,7 +747,7 @@ function butSearchClick() @@ -747,7 +747,7 @@ function butSearchClick()
747 var expr = buildExpression(); 747 var expr = buildExpression();
748 if (expr == '') 748 if (expr == '')
749 { 749 {
750 - alert('Please select some search criteria'); 750 + alert('{/literal}{i81n}Please select some search criteria{/i81n}{literal}');
751 return; 751 return;
752 } 752 }
753 753
@@ -766,20 +766,20 @@ function butSearchClick() @@ -766,20 +766,20 @@ function butSearchClick()
766 <legend>{i18n}Metadata Query{/i18n}</legend> 766 <legend>{i18n}Metadata Query{/i18n}</legend>
767 767
768 768
769 - Return items which match <select id="allop">  
770 - <option value="AND">all  
771 - <option value="OR" SELECTED>any  
772 - </select> of the criteria groups specified. 769 + {i18n}Return items which match{/i18n} <select id="allop">
  770 + <option value="AND">{i18n}all{/i18n}
  771 + <option value="OR" SELECTED>{i18n}any{/i18n}
  772 + </select> {i18n}of the criteria groups specified.{/i18n}
773 773
774 <div id="groupwrapping"> 774 <div id="groupwrapping">
775 <div id="groupwrapper0"> 775 <div id="groupwrapper0">
776 <fieldset> 776 <fieldset>
777 <legend>{i18n}Criteria Group{/i18n}</legend> 777 <legend>{i18n}Criteria Group{/i18n}</legend>
778 778
779 - Return items which match <select id="groupop0">  
780 - <option value="AND">all  
781 - <option value="OR" SELECTED>any  
782 - </select> of the criteria specified below. 779 + {i18n}Return items which match{/i18n} <select id="groupop0">
  780 + <option value="AND">{i18n}all{/i18n}
  781 + <option value="OR" SELECTED>{i18n}any{/i18n}
  782 + </select> {i18n}of the criteria specified below.{/i18n}
783 <br> 783 <br>
784 784
785 <div id="criteria0"> 785 <div id="criteria0">
@@ -789,9 +789,9 @@ function butSearchClick() @@ -789,9 +789,9 @@ function butSearchClick()
789 <tr> 789 <tr>
790 <td width="50%" valign="top"> 790 <td width="50%" valign="top">
791 <br> 791 <br>
792 - <div id="criteria_nofields0" style="color: brown">No fields have been selected for the criteria group. 792 + <div id="criteria_nofields0" style="color: brown">{i81n}No fields have been selected for the criteria group.{i81n}
793 <p> 793 <p>
794 - <input type=button value="Remove Criteria Group" onclick="removeCriteriaGroup(0)" id="removeCriteriaGroup0" style="display: none"> 794 + <input type=button value="{i81n}Remove Criteria Group{/i81n}" onclick="removeCriteriaGroup(0)" id="removeCriteriaGroup0" style="display: none">
795 </div> 795 </div>
796 <div id="criteria_fields0"> 796 <div id="criteria_fields0">
797 797
@@ -802,26 +802,26 @@ function butSearchClick() @@ -802,26 +802,26 @@ function butSearchClick()
802 <tr> 802 <tr>
803 <td valign=top> 803 <td valign=top>
804 <select id="selector0" style="width: 200px" onchange="selectorChange(0)"> 804 <select id="selector0" style="width: 200px" onchange="selectorChange(0)">
805 - <option value="0">Available Fields  
806 - <option value="1">Available Fieldsets  
807 - <option value="2">Available Workflows 805 + <option value="0">{i81n}Available Fields{/i81n}
  806 + <option value="1">{i81n}Available Fieldsets{/i81n}
  807 + <option value="2">{i81n}Available Workflows{/i81n}
808 </select> 808 </select>
809 <br> 809 <br>
810 <div> 810 <div>
811 <select id="fields0" size="5" style="width: 200px; height: 100px; display: block" onclick="fieldChange(0)"> 811 <select id="fields0" size="5" style="width: 200px; height: 100px; display: block" onclick="fieldChange(0)">
812 - <option value="" selected>--- Select a field --- 812 + <option value="" selected>--- {i81n}Select a field{/i81n} ---
813 {foreach from=$metainfo.fields item=field} 813 {foreach from=$metainfo.fields item=field}
814 <option>{$field.display} 814 <option>{$field.display}
815 {/foreach} 815 {/foreach}
816 </select> 816 </select>
817 <select id="fieldsets0" size="5" style="width: 200px; height: 100px; display: none" onclick="fieldsetsChange(0)"> 817 <select id="fieldsets0" size="5" style="width: 200px; height: 100px; display: none" onclick="fieldsetsChange(0)">
818 - <option value="" selected>--- Select a fieldset --- 818 + <option value="" selected>--- {i81n}Select a fieldset{/i81n} ---
819 {foreach from=$metainfo.fieldsets item=fieldset} 819 {foreach from=$metainfo.fieldsets item=fieldset}
820 <option>{$fieldset.name} 820 <option>{$fieldset.name}
821 {/foreach} 821 {/foreach}
822 </select> 822 </select>
823 <select id="workflows0" size="5" style="width: 200px; height: 100px; display: none" onclick="workflowsChange(0)" > 823 <select id="workflows0" size="5" style="width: 200px; height: 100px; display: none" onclick="workflowsChange(0)" >
824 - <option value="" selected>--- Select a workflow --- 824 + <option value="" selected>--- {i81n}Select a workflow{/i81n} ---
825 {foreach from=$metainfo.workflows item=workflow} 825 {foreach from=$metainfo.workflows item=workflow}
826 <option>{$workflow.name} 826 <option>{$workflow.name}
827 {/foreach} 827 {/foreach}
@@ -844,7 +844,7 @@ function butSearchClick() @@ -844,7 +844,7 @@ function butSearchClick()
844 </td> 844 </td>
845 <tr> 845 <tr>
846 <td colspan=5> 846 <td colspan=5>
847 - Click on a field above to add it to the criteria group. 847 + {i81n}Click on a field above to add it to the criteria group.{/i81n}
848 </td> 848 </td>
849 </tr> 849 </tr>
850 </table> 850 </table>
@@ -857,8 +857,8 @@ function butSearchClick() @@ -857,8 +857,8 @@ function butSearchClick()
857 </div> 857 </div>
858 </div> 858 </div>
859 <div id=""> 859 <div id="">
860 -<input type=button value="Add another set of criteria" onclick="addCriteriaSet()">  
861 -<input type=button value="Search" onclick="butSearchClick()"> 860 +<input type=button value="{/literal}{i81n}Add another set of criteria{/i81n}{literal}" onclick="addCriteriaSet()">
  861 +<input type=button value="{/literal}{i81n}Search{/i81n}{literal}" onclick="butSearchClick()">
862 </div> 862 </div>
863 863
864 864