Subversion Repositories wimsdev

Rev

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
125
 k_=!lower $search_keywords
126
 k_=!deaccent $k_
127
 l_=[
128
 e_==
129
 !if f isvarof $k_ or g isvarof $k_ or x isvarof $k_ or y isvarof $k_ or\
130
	z isvarof $k_ or b isvarof $k_ or c isvarof $k_ or i isvarof $k_ or\
131
	^ isin $k_ or / isin $k_ or $e_ isin $k_ or\
132
	.0 isin $k_ or .1 isin $k_ or .2 isin $k_ or .3 isin $k_ or\
133
	.4 isin $k_ or .5 isin $k_ or .6 isin $k_ or .7 isin $k_ or\
134
	.8 isin $k_ or .9 isin $k_ or $l_ isin $k_
135
   error=expression
136
   gotcnt=0
137
   !goto bailout
138
 !endif
139
 srch=!translate internal `'".+-_()[]{};: to $             $ in $search_keywords
140
 srch=!replace , by , $ in $srch
141
 srch=!deaccent $srch
142
 srch=!lower $srch
2670 bpr 143
 dictionary=bases/sys/words.$search_lang
2857 bpr 144
 suffix_dictionary=bases/sys/suffix.$search_lang
33 reyssat 145
 translator_unknown=leave
146
 srch=!exec translator $srch
147
 srch=!trim $srch
148
!endif
149
!writefile wimshome/$s2dir/home_search search_level=$search_level\
150
search_category=$search_category\
151
search_domain=$search_domain\
152
search_keywords=$search_keywords\
153
package=$search_package\
2670 bpr 154
search_lang=$search_lang
33 reyssat 155
 
156
!if $search_category isin LPS
157
 !changeto search.$search_category
158
!endif
159
 
2670 bpr 160
!read search.ker $search_lang
33 reyssat 161
:bailout
162
 
163
translator_switch=leaveline
164
!bound list_start between integer 0 and 10000 default 0
165
list_start=$[$list_batch*floor($list_start/$list_batch)]
166
!if $gotcnt=0
167
 gottype=popular
168
 # sp=!replace internal wimshome/public_html/ by $ in $search_package1
2670 bpr 169
 # gotM=!sh head -c 10000 $sp/pop/$search_category.$search_lang
170
 gotM=!record 0 of $search_package1/pop/$search_category.$search_lang
33 reyssat 171
 gotM=!line 1 to $gotlim of $gotM
172
 list_cc=!linecnt $gotM
173
 !if $list_start>$list_cc
174
  list_start=$[$list_batch*max(0,floor(($list_cc-1)/$list_batch))]
175
 !endif
176
 gotm=
177
 !for i=1 to $list_batch
178
  l_=!line $i+$list_start of $gotM
179
  !distribute words $l_ into m_,w_
180
  !default w_=0
181
  gotm=$gotm $m_
182
  gotw=$gotw $w_
183
 !next i
184
 gotcnt=!wordcnt $gotm
185
 gotm=!words2lines $gotm
186
 gotw=!words2lines $gotw
187
!else
188
 gottype=search
189
!endif
190
 
191
!if / isin $gotm
192
 dictionary=$search_package2/serial
193
 translator_unknown=leave
194
 gotm=!exec translator $gotm
195
!endif
196
 
197
dictionary=$search_package2/title
198
gott=!exec translator $gotm
199
dictionary=$search_package2/description
200
gotd=!exec translator $gotm
201
dictionary=$search_package2/language
202
gotl=!exec translator $gotm
203
dictionary=$search_package2/author
204
translator_unknown=?
205
gota=!exec translator $gotm
206
 
207
!if / notin $gotm and $gotcnt>0
208
 dictionary=$search_package2/addr
209
 gotm=!exec translator $gotm
210
!endif 
211
 
212
!if $search_category isin AT and $search_keywords!=$empty and\
213
	P isin $slist and ($gotcnt<=8 or $gottype!=search)
214
 gotm1=$gotm
215
 gotcnt1=$gotcnt
216
 gottype1=$gottype
217
 !read search.P
218
 !exchange gottype,gottype1
219
 !exchange gotcnt,gotcnt1
220
 !exchange gotm,gotm1
221
!else
222
 gotcnt1=0
223
!endif
224