Projet

Général

Profil

suggestions.tpl.php

Alexandre Boucher, 11/09/2013 13:51

 
1
<?php
2
// +-------------------------------------------------+
3
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
4
// +-------------------------------------------------+
5
// $Id: suggestions.tpl.php,v 1.36 2013-04-11 08:47:35 mbertin Exp $
6

    
7
if (stristr($_SERVER['REQUEST_URI'], ".tpl.php")) die("no access");
8

    
9
//        ------------------------------------------------------------------------------
10
//        $search_form : template de recherche pour les suggestions
11
//        ------------------------------------------------------------------------------
12

    
13
$sug_search_form = "
14
<form class='form-".$current_module."' id='search' name='search' method='post' action=\"!!action!!\">
15
        <h3>!!form_title!!</h3>
16
        <!--    Contenu du form    -->
17
        <div class='form-contenu'>
18
                
19
                <div class='row'>
20
                        <div class='colonne3'>
21
                                <input type='text' class='saisie-30em' id='user_input' name='user_input' value='!!user_input!!' />
22
                        </div>
23
                </div>
24
                <div class='row'>        
25
                        ";
26
if ($acquisition_sugg_localises == '1') {
27
        $sug_search_form.="
28
                        <div class='colonne3'>
29
                                <label class='etiquette'>".htmlentities($msg['acquisition_location'], ENT_QUOTES, $charset)."</label>
30
                                <div class='row'>
31
                                        <!-- sel_location -->
32
                                </div>        
33
                        </div>";
34
}
35
if ($acquisition_sugg_categ == '1') {
36
        $sug_search_form.="
37
                          <div class='colonne3'>
38
                                <label class='etiquette'>".htmlentities($msg['acquisition_categ'], ENT_QUOTES, $charset)."</label>
39
                                <div class='row'>        
40
                                        <!-- sel_categ -->
41
                                </div>
42
                        </div>";
43
}                        
44
$sug_search_form.= "
45
                        <script type='text/javascript'>
46
                                function filtrer_user(){
47
                                        document.forms['search'].submit();
48
                                }
49
                        </script>
50
                        <div class='colonne3'>
51
                                <label class='etiquette'>".htmlentities($msg['acquisition_sug_etat'], ENT_QUOTES, $charset)."</label>
52
                                <div class='row'>
53
                                        <!-- sel_state -->
54
                                </div>
55
                        </div>
56
                        <div class='colonne3'>
57
                                <label class='etiquette'>".htmlentities($msg['acquisition_sugg_filtre_src'], ENT_QUOTES, $charset)."</label>
58
                                <div class='row'>
59
                                        !!sug_filtre_src!!
60
                                </div>
61
                        </div>
62
                        <div class='colonne3'>
63
                                <label class='etiquette'>".htmlentities($msg['acquisition_sugg_filtre_user'], ENT_QUOTES, $charset)."</label>
64
                                <div class='row'>
65
                                        <input type='hidden' id='user_id' name='user_id' value='!!user_id!!'/>
66
                                        <input type='hidden' id='user_statut' name='user_statut' value='!!user_statut!!' />
67
                                        <input type='text' id='user_txt' name='user_txt' class='saisie-20emr' value='!!user_txt!!'/>
68
                                        <input type='button' class='bouton_small' value='...' onclick=\"openPopUp('./select.php?what=origine&caller=search&param1=user_id&param2=user_txt&param3=user_statut&deb_rech='+".pmb_escape()."(this.form.user_txt.value)+'&callback=filtrer_user', 'select_user', 400, 400, -2, -2, 'scrollbars=yes, toolbar=no, dependent=yes, resizable=yes')\" />                                
69
                                        <input type='button' class='bouton_small' value='X'  onclick=\"this.form.user_id.value=0;this.form.user_statut.value=0;this.form.user_txt.value=''\"/>                        
70
                                </div>
71
                        </div>
72
                </div>
73
                
74
                <div class='row'></div>
75
        </div>                
76
        
77
        <div class='row'>
78
                <div class='left'>
79
                        <input type='submit' class='bouton' value='".$msg['142']."' />
80
                        <!-- bouton_add -->
81
                </div>
82
                <div class='right'>
83
                        <!-- lien_last -->
84
                </div>
85
        </div>
86

87
        <div class='row'></div>
88
</form>
89
<br />
90
";
91

    
92
//        ------------------------------------------------------------------------------
93
// $sug_list_form : template de liste pour les suggestions
94
//        ------------------------------------------------------------------------------
95

    
96
$sug_list_form ="
97
<form class='form-$current_module' id='sug_list_form' name='sug_list_form' method='post' action=\"\" >
98
        <div class='form-contenu'>
99
                <table width='100%'><tr>
100
                        <th>".htmlentities($msg['acquisition_sug_dat_cre'], ENT_QUOTES, $charset)."</th>
101
                        <th>".htmlentities($msg['acquisition_sug_tit'], ENT_QUOTES, $charset)."</th>
102
                        <th>".htmlentities($msg['acquisition_sug_edi'], ENT_QUOTES, $charset)."</th>
103
                        <th>".htmlentities($msg['acquisition_sug_aut'], ENT_QUOTES, $charset)."</th>
104
                        <th>".htmlentities($msg['acquisition_sug_etat'], ENT_QUOTES, $charset)."</th>        
105
                        <th>".htmlentities($msg['acquisition_sug_iscat'], ENT_QUOTES, $charset)."</th>";
106

    
107
if ($acquisition_sugg_categ == '1') {
108
        $sug_list_form.="<th>".htmlentities($msg['acquisition_categ'], ENT_QUOTES, $charset)."</th>";
109
}                
110
$sug_list_form.="
111
        <th>".htmlentities($msg['acquisition_sugg_src'], ENT_QUOTES, $charset)."</th>
112
        <th>".htmlentities($msg['acquisition_sugg_date_publication'], ENT_QUOTES, $charset)."</th>        
113
        <th>".htmlentities($msg['acquisition_sugg_piece_jointe'], ENT_QUOTES, $charset)."</th>"
114
;        
115
$sug_list_form.="                                
116
                        <th>&nbsp;</th></tr>
117
                        <!-- sug_list -->
118
                </table>
119
        </div>
120
        <div class='row'>
121
                <div class='left'><!-- bt_imp -->&nbsp;<!-- bt_exporter -->&nbsp;<!-- bt_todo --><span class='child' ><!-- to_categ --></span></div>
122
                <div class='right'><!-- bt_chk --></div>
123
        </div>
124
        <div class='row'>&nbsp;</div>
125
        <div class='row'>
126
                <div class='left'><!-- bt_list --></div>
127
                <div class='right'><!-- bt_sup --></div>
128
        </div>
129
</form>
130
<!-- script -->
131
<br />
132
<div class='form' >
133
        <!-- nav_bar -->
134
</div>
135
";
136

    
137
//        ------------------------------------------------------------------------------
138
// $sug_modif_form : template du form de suggestions
139
//        ------------------------------------------------------------------------------
140
$sug_modif_form = "
141
<script language='javascript' type='text/javascript'>
142
function isnum(sText){
143
        var valid_chars = '0123456789.';
144
        for (var i = 0; i < sText.length; i++) {                
145
                if (valid_chars.indexOf(sText.charAt(i)) == -1) {
146
                        if(i == 0) {
147
                                if(sText.charAt(i) != '-')
148
                                        return false;
149
                        } else return false;                
150
                } 
151
                
152
        }        
153
        return true;
154
}
155
                
156
function add_numeric_obj(obj,inc) {
157
        var id_obj = document.getElementById(obj);
158
        if(!isnum(id_obj.value)) id_obj.value=0;
159
        id_obj.value = parseInt(id_obj.value) + inc ;
160
}
161
</script>
162
<form class='form-$current_module' id='sug_modif_form' name='sug_modif_form' method='post' action='!!action!!' enctype='multipart/form-data'>
163
        <h3>!!form_title!!</h3>
164
        <div class='form-contenu'>
165
        
166
                <div class='row'>
167
                        <div class='colonne5'>
168
                                <label class='etiquette' >".htmlentities($msg['acquisition_sug_dat_cre'], ENT_QUOTES, $charset)."</label>
169
                        </div>
170
                        <div class='colonne5'>
171
                                <label class='etiquette' >".htmlentities($msg['acquisition_sug_orig'], ENT_QUOTES, $charset)."</label>
172
                        </div>
173
                        <div class='colonne5'>
174
                                <label class='etiquette' >".htmlentities($msg['acquisition_sug_poi'], ENT_QUOTES, $charset)."</label>
175
                        </div>
176
                        <div class='colonne5'>
177
                                <label class='etiquette' >".htmlentities($msg['acquisition_sug_etat'], ENT_QUOTES, $charset)."</label>
178
                        </div>
179
                        <div class='colonne5'>
180
                        ";
181
if ($acquisition_sugg_categ=='1'){
182
        $sug_modif_form.= "<label class='etiquette' >".htmlentities($msg['acquisition_categ'], ENT_QUOTES, $charset)."</label>";
183
} else {
184
        $sug_modif_form.= "&nbsp;";
185
}
186
$sug_modif_form.="                
187
                        </div>
188
                </div>
189
                <div class='row'>
190
                        <div class='colonne5'>
191
                                !!dat_cre!!
192
                        </div>
193
                        <div class='colonne5'>
194
                                <input type='hidden' id='orig' name='orig' value='!!orig!!' />
195
                                <input type='hidden' id='typ' name='typ' value='!!typ!!' />
196
                                <input type='hidden' id='id_notice' name='id_notice' value='!!id_notice!!' />
197
                                !!lib_orig!!
198
                                !!creator_ajout!!
199
                                !!list_user!!
200
                                <div id='user_list'></div>
201
                        </div>
202
<!--
203
                        <div class='colonne5'>
204
                                <input type='hidden' id='poi' name='poi' value='!!poi!!' />
205
                                <input type='text' id='poi_tot' name='poi_tot' class='saisie-10emd' readonly='readonly' value='!!poi_tot!!' />
206
                        </div>
207
-->
208
                        <div class='colonne5'>
209
                                <input type='hidden' id='poi' name='poi' value='!!poi!!' />
210
                                <input type='hidden' id='poi_tot' name='poi_tot' value='!!poi_tot!!' />
211
                                <span id='aff_poi_tot' >!!poi_tot!!</span>
212
                        </div>
213
                        <div class='colonne5'>
214
                                <input type='hidden' id='statut' name='statut' value='!!statut!!' />
215
                                !!lib_statut!!
216
                        </div>
217
                        <div class='colonne5'>";
218
if ($acquisition_sugg_categ=='1'){
219
        $sug_modif_form.= "!!categ!!";
220
} else {
221
        $sug_modif_form.= "&nbsp;";
222
}
223
$sug_modif_form.="
224
                        </div>
225
                </div>
226
                
227
                <div class='row'>
228
                
229
                        <div class='colonne5'>
230
                                <label class='etiquette'>".htmlentities($msg['acquisition_sug_qte'], ENT_QUOTES, $charset)."</label>
231
                                <div class='row'>
232
                                        <!-- nombre_expl -->
233
                                        <input  class='bouton_small' type='button' value='-' onclick=\"add_numeric_obj('nombre_expl',-1)\">
234
                                        <input maxLength='4' size='2' value='!!nombre_expl!!' id='nombre_expl' name='nombre_expl' >
235
                                        <input class='bouton_small' type='button' value='+' onclick=\"add_numeric_obj('nombre_expl',1)\">
236
                                </div>        
237
                        </div>
238
                
239
";        
240
if ($acquisition_sugg_localises == '1') {
241
$sug_modif_form.="
242
                        <div class='colonne5'>
243
                                <label class='etiquette'>".htmlentities($msg['acquisition_location'], ENT_QUOTES, $charset)."</label>
244
                                <div class='row'>
245
                                        <!-- sel_location -->
246
                                </div>        
247
                        </div>";
248
                }
249
$sug_modif_form.="        
250
                <div class='colonne5'>
251
                        <label class='etiquette' >".htmlentities($msg['acquisition_sugg_filtre_src'], ENT_QUOTES, $charset)."</label>
252
                        <div class='row'>
253
                                !!liste_source!!
254
                        </div>
255
                </div>
256
                </div>        
257
                <div class='row'></div>
258
                <div class='row'><hr /></div>
259

260
                <div class='row'>
261
                        <label class='etiquette' >".htmlentities($msg['acquisition_sug_tit'], ENT_QUOTES, $charset)."</label>
262
                </div>
263
                <div class='row'>
264
                        <input type='text/javascript' id='tit' name='tit' class='saisie-60em' value='!!tit!!' />
265
                        !!lien!!
266
                </div>
267

268
                <div class='row'>
269
                        <label class='etiquette' >".htmlentities($msg['acquisition_sug_edi'], ENT_QUOTES, $charset)."</label>
270
                </div>
271
                <div class='row'>
272
                        <input type='text/javascript' id='edi' name='edi' class='saisie-30em' value='!!edi!!' />
273
                </div>
274

275
                <div class='row'>
276
                        <label class='etiquette' >".htmlentities($msg['acquisition_sug_aut'], ENT_QUOTES, $charset)."</label>
277
                </div>
278
                <div class='row'>
279
                        <input type='text/javascript' id='aut' name='aut' class='saisie-30em' value='!!aut!!' />
280
                </div>
281

282
                <div class='row'>
283
                        <label class='etiquette' >".htmlentities($msg['acquisition_sug_cod'], ENT_QUOTES, $charset)."</label>
284
                </div>
285
                <div class='row'>
286
                        <input type='text/javascript' id='cod' name='cod' class='saisie-30em' value='!!cod!!' />
287
                </div>
288

289
                <div class='row'>
290
                        <label class='etiquette' >".htmlentities($msg['acquisition_sug_pri'], ENT_QUOTES, $charset)."</label>
291
                </div>
292
                <div class='row'>
293
                        <input type='text/javascript' id='pri' name='pri' class='saisie-10em' value='!!pri!!' />
294
                </div>
295

296
                <div class='row'>
297
                        <label class='etiquette' >".htmlentities($msg['acquisition_sug_url'], ENT_QUOTES, $charset)."</label>
298
                </div>
299
                <div class='row'>
300
                        <input type='text/javascript' id='url_sug' name='url_sug' class='saisie-80em' value='!!url_sug!!' />
301
                        <!-- url_sug -->
302
                </div>
303
                <div class='row'>
304
                        <label class='etiquette' >".htmlentities($msg['acquisition_sug_com'], ENT_QUOTES, $charset)."</label>
305
                </div>
306
                <div class='row'>
307
                        <textarea id='com' name='com' class='saisie-80em' cols='62' rows='6' wrap='virtual'>!!com!!</textarea>
308
                </div>
309
                <div class='row'>
310
                        <label class='etiquette' >".htmlentities($msg['acquisition_sug_com_gestion'], ENT_QUOTES, $charset)."</label>
311
                </div>
312
                <div class='row'>
313
                        <textarea id='com_gestion' name='com_gestion' class='saisie-80em' cols='62' rows='6' wrap='virtual'>!!com_gestion!!</textarea>
314
                </div>                
315
                <div class='row'>
316
                        <label class='etiquette' >".htmlentities($msg['acquisition_sugg_date_publication'], ENT_QUOTES, $charset)."</label>
317
                </div>
318
                <div class='row'>
319
                        <input type='text' id='date_publi' name='date_publi' value='!!date_publi!!'>
320
                        <input type='button' class='bouton' id='date_publi_sug' name='date_publi_sug' value='...' onClick=\"openPopUp('./select.php?what=calendrier&caller=sug_modif_form&param1=date_publi&param2=date_publi&auto_submit=NO&date_anterieure=YES', 'date_publi', 250, 300, -2, -2, 'toolbar=no, dependent=yes, resizable=yes')\"/>
321
                </div>
322
                <div class='row'>
323
                        <label class='etiquette' >".htmlentities($msg['acquisition_sugg_piece_jointe'], ENT_QUOTES, $charset)."</label>
324
                </div>
325
                !!div_pj!!
326
                <div class='row'></div>                
327
        </div>        
328

329
        <!--        boutons        -->
330
        <div class='row'>
331
                <div class='left'>
332
                        <input type='button' class='bouton' value='$msg[76]' $back_url />
333
                        <input type='submit' class='bouton' value='$msg[77]' onClick=\"return test_form(this.form);  \" />
334
                        <!-- bouton_cat -->
335
                </div>
336
                <div class='right'>
337
                        <!-- bouton_sup -->
338
                </div>
339
        </div>
340

341
        <div class='row'></div>
342
</form>
343

344

345
<script type='text/javascript'>
346

347
        document.getElementById('tit').focus();
348
        function test_form(form) {
349
                
350
                var ret = true;
351
                if((form.tit.value.replace(/^\s+|\s+$/g, '').length == 0) || (((form.aut.value.replace(/^\s+|\s+$/g, '').length == 0) && (form.edi.value.replace(/^\s+|\s+$/g, '').length == 0)) 
352
                        && (form.cod.value.replace(/^\s+|\s+$/g, '').length == 0) 
353
                        && (form.piece_jointe_sug.value.length == 0))){                    
354
                        ret = false;
355
            }
356
            
357
            if(!ret)
358
                     alert(\"$msg[acquisition_sug_ko]\");
359
                return ret;
360
                        
361
        }
362
        
363
        function ajax_origine(){
364
                
365
                var action = new http_request();
366
                var url = './ajax.php?module=acquisition&categ=sugg&id_sugg=!!id_sug!!&quoifaire=ajout_origine';
367
                action.request(url, true, \"orig=\"+document.getElementById('orig').value+\"&type_orig=\"+document.getElementById('typ').value);
368
                if(action.get_status() == 0){
369
                        if(document.getElementById('ori')){
370
                                document.getElementById('ori').style.display = 'none';
371
                                document.getElementById('oriChild').style.display = 'none';
372
                        }
373
                        if(document.getElementById('creator_lib_orig')){
374
                                document.getElementById('creator_lib_orig').style.display = 'none';
375
                                document.getElementById('creator_btn_orig').style.display = 'none';
376
                        }
377
                        document.getElementById('user_list').innerHTML = action.get_text();
378
                        document.getElementById('orig').value = 0;
379
                        document.getElementById('typ').value = 0;
380
                        document.getElementById('creator_lib_orig').value = '';
381
                        document.getElementById('creator_lib_orig_ajax').value = '';
382
                }
383
                
384
        }
385
        
386
        function ajax_suppr_origine(origine, type){
387
                
388
                var action = new http_request();
389
                var url = './ajax.php?module=acquisition&categ=sugg&id_sugg=!!id_sug!!&quoifaire=suppr_origine';
390
                action.request(url, true, \"orig=\"+origine+\"&type_orig=\"+type);
391
                if(action.get_status() == 0){
392
                        if(document.getElementById('ori')){
393
                                document.getElementById('ori').style.display = 'none';
394
                                document.getElementById('oriChild').style.display = 'none';
395
                        }
396
                        document.getElementById('user_list').innerHTML = action.get_text();
397
                }
398
                
399
        }
400
        
401

402
</script>
403
";
404

    
405

    
406
$orig_form_mod = "
407
        <input type='text' id='lib_orig' name='lib_orig' class='saisie-10emr' value='!!lib_orig!!' onchange=\"openPopUp('./select.php?what=origine&caller=sug_modif_form&param1=orig&param2=lib_orig&param3=typ&param4=poi&param5=poi_tot&param6=aff_poi_tot&deb_rech='+".pmb_escape()."(this.form.lib_orig.value), 'select_orig', 400, 400, -2, -2, 'scrollbars=yes, toolbar=no, dependent=yes, resizable=yes')\" />
408
        <input type='button' class='bouton_small' value='...' onclick=\"openPopUp('./select.php?what=origine&caller=sug_modif_form&param1=orig&param2=lib_orig&param3=typ&param4=poi&param5=poi_tot&param6=aff_poi_tot&deb_rech='+".pmb_escape()."(this.form.lib_orig.value), 'select_orig', 400, 400, -2, -2, 'scrollbars=yes, toolbar=no, dependent=yes, resizable=yes')\" />";
409

    
410
$bt_chk ="<input type='button' id='bt_chk' class='bouton_small' value='".$msg[acquisition_sug_checkAll]."' onClick=\"checkAll('sug_list_form', 'chk', check); return false;\" />";
411
$bt_supChk = "<input type='button' class='bouton_small' value='$msg[63]' onClick=\"supChk();\" />";
412

    
413

    
414
$bt_imp = "<input type='button' class='bouton_small' value='$msg[imprimer]' onClick=\"!!imp!!\" />";
415
$bt_exporter = "<input type='button' class='bouton_small' value='".$msg['admin_Expvers']."' onClick=\"!!exp!!\" /><!-- list_export -->";
416

    
417
$lk_url_sug = "<a href='!!url_sug!!' target='_blank'><img src='./images/globe.gif' border='0'/></a>";
418

    
419

    
420
$script = "
421
<script type='text/javascript'>
422

423
        var check = true;
424

425
        //Coche et décoche les éléments de la liste
426
        function checkAll(the_form, the_objet, do_check) {
427
        
428
                var elts = document.forms[the_form].elements[the_objet+'[]'] ;
429
                var elts_cnt  = (typeof(elts.length) != 'undefined')
430
                      ? elts.length
431
                      : 0;
432
        
433
                if (elts_cnt) {
434
                        for (var i = 0; i < elts_cnt; i++) {
435
                                elts[i].checked = do_check;
436
                        } 
437
                } else {
438
                        elts.checked = do_check;
439
                }
440
                if (check == true) {
441
                        check = false;
442
                        document.getElementById('bt_chk').value = '".$msg[acquisition_sug_uncheckAll]."';
443
                } else {
444
                        check = true;
445
                        document.getElementById('bt_chk').value = '".$msg[acquisition_sug_checkAll]."';        
446
                }
447
                return true;
448
        }
449

450

451
        //Vérifie que le nb d'élements minimum passé en paramètre est coché
452
        function verifChk(nb_to_chk) {
453
                
454
                var elts = document.forms['sug_list_form'].elements['chk[]'];
455
                var elts_cnt  = (typeof(elts.length) != 'undefined')
456
                      ? elts.length
457
                      : 0;
458
                nb_chk = 0;
459
                if (elts_cnt) {
460
                        for(var i=0; i < elts.length; i++) {
461
                                if (elts[i].checked) nb_chk++;
462
                        }
463
                } else {
464
                        if (elts.checked) nb_chk++;
465
                }
466
                if (nb_chk < nb_to_chk) {
467
                        alert(\"".$msg['acquisition_sug_msg_nocheck']." \"+nb_to_chk+\" ".$msg['acquisition_sug_msg_nocheck2']."\");
468
                        return false;        
469
                }
470
                return true;
471
        }
472

473
        <!-- script_list -->
474
";
475

    
476
$script.="
477

478
        function fusVal(){
479
                if(!verifChk(1)) return false;
480
                r = confirm(\"".$msg['acquisition_sug_msg_fusVal']."\");
481
                if (r) {
482
                        document.forms['sug_list_form'].setAttribute('action', './acquisition.php?categ=sug&action=fusVal&nb_per_page=".$nb_per_page."');
483
                        document.forms['sug_list_form'].submit();
484
                        return true;        
485
                }
486
                return false;
487
        }
488

489
</script>";
490

    
491
$bt_fusVal = "<input type='button' class='bouton' value='$msg[acquisition_sug_bt_fus]' onClick=\"fusVal(); \" />";
492