Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2670 | bpr | 1 | |
2 | Processing search request. |
||
33 | reyssat | 3 | !nocache |
4 | !if $wims_referer!=$empty and $wims_user=$empty and $wims_new_session=yes |
||
5 | refcut=!replace internal :// by $ $ in $wims_referer |
||
6 | refcut=!word 2 of $refcut |
||
7 | refcut=!translate internal /. to $ , in $refcut |
||
8 | !distribute words $refcut into refsite, refsearch |
||
9 | refdom=!item -2 of $refsite |
||
10 | refdom=!lower $refdom |
||
11 | reffields=!defof $refdom in searchengines |
||
12 | !if $reffields!=$empty |
||
13 | !distribute items $reffields into refs,refl |
||
14 | refsearch=!translate internal ?&= to ,, $ in $refsearch |
||
15 | !for rs in $refsearch |
||
16 | refw1=!word 1 of $rs |
||
17 | !if $refw1=$refs |
||
18 | refS=!word 2 to -1 of $rs |
||
19 | refS=!lower $refS |
||
20 | refS=!unhttp $refS |
||
21 | refS=!translate internal + to $ 4 in $refS |
||
22 | refS=!replace word wims by $ in $refS |
||
23 | refS=!trim $refS |
||
24 | !endif |
||
25 | !if $refw1=$refl |
||
26 | refL=!word 2 of $rs |
||
27 | !endif |
||
28 | !next rs |
||
29 | !if $refS!=$empty |
||
30 | search_category=A |
||
31 | search_keywords=$refS |
||
32 | !endif |
||
33 | !endif |
||
34 | !endif |
||
35 | |||
36 | s2dir=!replace internal sessions/ by s2/ in $wims_sesdir |
||
37 | s2dir=!translate internal _ to $ $ in $s2dir |
||
38 | s2dir=!word 1 of $s2dir |
||
39 | !if $wims_accessright!=$empty and $wims_class!=$empty |
||
40 | !default search_package=!getdef package in wimshome/$s2dir/home_search |
||
41 | !bound search_package within $wims_accessright default bases/site |
||
42 | !else |
||
43 | search_package=bases/site |
||
44 | !endif |
||
45 | !if $search_package=bases/site |
||
46 | search_package1=wimshome/public_html/$search_package |
||
47 | search_package2=$search_package |
||
48 | !else |
||
49 | search_package1=wimshome/public_html/modules/$search_package/.index |
||
50 | search_package2=modules/$search_package/.index |
||
51 | !endif |
||
52 | |||
53 | # Limit of shown items |
||
54 | gotlim=1000 |
||
55 | gotlim2=50 |
||
56 | list_batch=20 |
||
2725 | bpr | 57 | !default search_lang=$lang |
2671 | bpr | 58 | !read adm/search_engine/mklist_form.proc $search_lang |
1532 | guerimand | 59 | !!rel_A=D,S |
60 | !!rel_T=X,D,R |
||
61 | !!rel_D=X,T,S,R |
||
62 | !!rel_X=T,D,S,R |
||
63 | !!rel_R=X,T,D,S |
||
64 | !!rel_P=T,X,D |
||
65 | !!rel_O=X,S,T,D,R |
||
66 | !!rel_S=X,R,T,D |
||
33 | reyssat | 67 | |
1532 | guerimand | 68 | !!slist=A D T X R P O S |
69 | !!module_P=wimshome/public_html/modules/tool/popup |
||
70 | !!wims_trustfile=$module_P.$lang/search.phtml $module_P.$lang/search.proc |
||
71 | !!test=!record 0 of $module_P.$lang/.test |
||
72 | !!!if yes notin $test |
||
73 | !! slist=!translate P to $ $ in $slist |
||
74 | !!!endif |
||
75 | !!cnt=!record 0 of wimshome/public_html/bases/sheet/index/count.$lang |
||
76 | !!!if $cnt<=0 |
||
77 | !! slist=!translate S to $ $ in $slist |
||
78 | !!!endif |
||
79 | !!slist=!words2items $slist |
||
80 | !!plist= |
||
81 | !!!for i in $slist |
||
82 | !! plist=!append item $(C_$i) to $plist |
||
83 | !!!next i |
||
33 | reyssat | 84 | |
85 | !if $wims_user=supervisor |
||
86 | !default search_level=$class_level |
||
87 | !endif |
||
88 | |||
89 | !if $list=clear |
||
90 | search_category=V |
||
91 | search_keywords= |
||
92 | list= |
||
93 | !writefile wimshome/$s2dir/home_search package=$search_package |
||
94 | gotcnt=0 |
||
95 | !exit |
||
96 | !endif |
||
97 | |||
98 | !if _tool isin $wims_session |
||
99 | search_category=T |
||
100 | !endif |
||
101 | |||
102 | search_keywords=!trim $search_keywords |
||
103 | search_keywords=!translate " to $ $ in $search_keywords |
||
104 | !if $search_category$search_keywords=$empty |
||
105 | !read wimshome/$s2dir/home_search |
||
106 | readback=yes |
||
107 | !else |
||
108 | search_level=!nospace $search_level |
||
109 | search_domain=!trim $search_domain |
||
110 | search_keywords=!trim $search_keywords |
||
111 | !endif |
||
112 | |||
113 | search_category=!replace exercise by X in $search_category |
||
114 | search_category=!replace tool by T in $search_category |
||
115 | search_category=!replace recreation by R in $search_category |
||
116 | search_category=!trim $search_category |
||
117 | search_category=!char 1 of $search_category |
||
118 | !bound search_category within $slist default V |
||
119 | !if $search_category=V |
||
120 | gotcnt=0 |
||
121 | !exit |
||
122 | !endif |
||
123 | |||
124 | !if $search_keywords!=$empty |
||
4649 | bpr | 125 | search_keywords_cnt=!wordcnt $search_keywords |
126 | !!! the keyword should be the address of a module - if it is found, no other search is done |
||
4718 | bpr | 127 | !if (/ isin $search_keywords or %2F isin $search_keywords) and $search_keywords_cnt=1 |
4649 | bpr | 128 | k_=!replace internal module= by in $search_keywords |
4718 | bpr | 129 | k_=!replace internal %2F by / in $k_ |
130 | dictionary=$search_package2/serial |
||
131 | translator_unknown=leave |
||
4649 | bpr | 132 | try=!exec translator $k_ |
4718 | bpr | 133 | !if $try!= and $try != $k_ |
4649 | bpr | 134 | gotcnt=1 |
135 | gotm=$try |
||
136 | search_keywords=$k_ |
||
137 | !goto bailout |
||
138 | !endif |
||
139 | !endif |
||
33 | reyssat | 140 | k_=!lower $search_keywords |
141 | k_=!deaccent $k_ |
||
142 | l_=[ |
||
143 | e_== |
||
144 | !if f isvarof $k_ or g isvarof $k_ or x isvarof $k_ or y isvarof $k_ or\ |
||
145 | z isvarof $k_ or b isvarof $k_ or c isvarof $k_ or i isvarof $k_ or\ |
||
146 | ^ isin $k_ or / isin $k_ or $e_ isin $k_ or\ |
||
147 | .0 isin $k_ or .1 isin $k_ or .2 isin $k_ or .3 isin $k_ or\ |
||
148 | .4 isin $k_ or .5 isin $k_ or .6 isin $k_ or .7 isin $k_ or\ |
||
149 | .8 isin $k_ or .9 isin $k_ or $l_ isin $k_ |
||
150 | error=expression |
||
151 | gotcnt=0 |
||
152 | !goto bailout |
||
153 | !endif |
||
154 | srch=!translate internal `'".+-_()[]{};: to $ $ in $search_keywords |
||
155 | srch=!replace , by , $ in $srch |
||
156 | srch=!deaccent $srch |
||
157 | srch=!lower $srch |
||
2670 | bpr | 158 | dictionary=bases/sys/words.$search_lang |
2857 | bpr | 159 | suffix_dictionary=bases/sys/suffix.$search_lang |
33 | reyssat | 160 | translator_unknown=leave |
161 | srch=!exec translator $srch |
||
162 | srch=!trim $srch |
||
163 | !endif |
||
164 | !writefile wimshome/$s2dir/home_search search_level=$search_level\ |
||
165 | search_category=$search_category\ |
||
166 | search_domain=$search_domain\ |
||
167 | search_keywords=$search_keywords\ |
||
168 | package=$search_package\ |
||
2670 | bpr | 169 | search_lang=$search_lang |
33 | reyssat | 170 | |
171 | !if $search_category isin LPS |
||
172 | !changeto search.$search_category |
||
173 | !endif |
||
174 | |||
2670 | bpr | 175 | !read search.ker $search_lang |
33 | reyssat | 176 | :bailout |
177 | |||
178 | translator_switch=leaveline |
||
179 | !bound list_start between integer 0 and 10000 default 0 |
||
180 | list_start=$[$list_batch*floor($list_start/$list_batch)] |
||
181 | !if $gotcnt=0 |
||
182 | gottype=popular |
||
183 | # sp=!replace internal wimshome/public_html/ by $ in $search_package1 |
||
2670 | bpr | 184 | # gotM=!sh head -c 10000 $sp/pop/$search_category.$search_lang |
185 | gotM=!record 0 of $search_package1/pop/$search_category.$search_lang |
||
33 | reyssat | 186 | gotM=!line 1 to $gotlim of $gotM |
187 | list_cc=!linecnt $gotM |
||
188 | !if $list_start>$list_cc |
||
189 | list_start=$[$list_batch*max(0,floor(($list_cc-1)/$list_batch))] |
||
190 | !endif |
||
191 | gotm= |
||
192 | !for i=1 to $list_batch |
||
193 | l_=!line $i+$list_start of $gotM |
||
194 | !distribute words $l_ into m_,w_ |
||
195 | !default w_=0 |
||
196 | gotm=$gotm $m_ |
||
197 | gotw=$gotw $w_ |
||
198 | !next i |
||
199 | gotcnt=!wordcnt $gotm |
||
200 | gotm=!words2lines $gotm |
||
201 | gotw=!words2lines $gotw |
||
202 | !else |
||
203 | gottype=search |
||
204 | !endif |
||
205 | |||
206 | !if / isin $gotm |
||
207 | dictionary=$search_package2/serial |
||
208 | translator_unknown=leave |
||
209 | gotm=!exec translator $gotm |
||
210 | !endif |
||
211 | |||
212 | dictionary=$search_package2/title |
||
213 | gott=!exec translator $gotm |
||
214 | dictionary=$search_package2/description |
||
215 | gotd=!exec translator $gotm |
||
216 | dictionary=$search_package2/language |
||
217 | gotl=!exec translator $gotm |
||
218 | dictionary=$search_package2/author |
||
219 | translator_unknown=? |
||
220 | gota=!exec translator $gotm |
||
221 | |||
222 | !if / notin $gotm and $gotcnt>0 |
||
223 | dictionary=$search_package2/addr |
||
224 | gotm=!exec translator $gotm |
||
225 | !endif |
||
226 | |||
227 | !if $search_category isin AT and $search_keywords!=$empty and\ |
||
228 | P isin $slist and ($gotcnt<=8 or $gottype!=search) |
||
229 | gotm1=$gotm |
||
230 | gotcnt1=$gotcnt |
||
231 | gottype1=$gottype |
||
232 | !read search.P |
||
233 | !exchange gottype,gottype1 |
||
234 | !exchange gotcnt,gotcnt1 |
||
235 | !exchange gotm,gotm1 |
||
236 | !else |
||
237 | gotcnt1=0 |
||
238 | !endif |
||
239 |