ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/WEBCONDDB/php_CondDB/DB_administration.php
Revision: 1.1
Committed: Fri Jun 29 07:53:09 2007 UTC (17 years, 10 months ago) by kdziedzi
Branch: MAIN
CVS Tags: V01-01-02, V01-01-01, V1_01_00, V01-01-00, V1_00_01, HEAD
Error occurred while calculating annotation data.
Log Message:
Introducing new order in project

File Contents

# Content
1 <?php
2 /*
3 * Created on Sep 14, 2006
4 * by Katarzyna Maria Dziedziniewicz
5 * Contains:
6 * DB_administartion subpage definition
7 */
8
9 session_start();
10 include('utils/header.php');
11 if ($_SESSION['secured']!=1)
12 {
13 $ret = $_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
14 echo '<a href="secured/security_check.php?site='.$ret.'"> Log In </a>';
15 exit(0);
16 }
17
18
19 include('utils/queryResponder.php');
20 require('utils/tableViewer.php');
21 require('utils/dropdownViewer.php');
22 //chdir($old);
23
24
25 $qResponder = new queryResponder;
26
27 ///PAGE CONTENT
28
29
30 ?>
31
32
33 <h2 class="h2cond" id="req_title"> CondDB:: Production request: </h2>
34 <form name="sendProduction" id="req_form" enctype="multipart/form-data" method="post"
35 action="<?echo $PHP_SELF;?>" onSubmit="return validate();">
36 <h4 class="h4cond">General information</h4>
37 <table class="in_form">
38 <tr>
39 <td>Detector/Task:</td>
40 <td class="left_al_form">
41
42
43 <?php
44 $detList = $qResponder->getConfigData('detector');
45 makeDropdown("detTaskSel", $detList, $_REQUEST['detTaskSel'], 'request');
46
47 ?>
48 </td>
49 </tr>
50 <tr>
51 <td>Production:</td>
52 <td class="left_al_form">
53
54
55 <?php
56 $prodList = $qResponder->getConfigData('production');
57 makeDropdown("prodSel",$prodList, $_REQUEST['prodSel'], 'request');
58 ?> </td>
59 </tr>
60 <tr>
61 <td>Service:</td>
62 <td class="left_al_form">
63
64 <?php
65 $servList = $qResponder->getConfigData('service');
66 makeDropdown("servSel",$servList, $_REQUEST['servSel'], 'request');
67 ?>
68 </td>
69 </tr>
70 <tr>
71 <td>Requestor's Email:</td>
72 <td class="left_al_form">
73 <?php
74 echo ' <input class="wide" type="text" name="email" value="'.$_POST['email'].'".>';
75 ?>
76
77 </td>
78 </tr>
79 <tr>
80 <td>Re-enter email:</td>
81 <td class="left_al_form">
82 <?
83 echo ' <input class="wide" type="text" name="re_email" value="'.$_POST['re_email'].'">';
84 ?>
85 </td>
86 </tr>
87 <tr>
88 <td>Object's name</td>
89 <td class="left_al_form">
90
91 <?
92 echo '<input class="wide" type="text" name="objName" value="'.$_POST['objName'].'">';
93 ?>
94 </td>
95 </tr>
96 <tr>
97 <td>CMSSW version</td>
98 <td class="left_al_form">
99 <?
100 echo '
101 <input class="wide" type="text" name="CMSSW_ver" value="'.$_POST['CMSSW_ver'].'">';
102 ?>
103 </td>
104 </tr>
105 </table>
106 <h4 class="h4cond">Require</h4>
107 <table class="in_form">
108 <tr>
109 <td> O2O</td>
110 <td class="left_al_form">
111
112 <?
113 $isChecked = isset($_POST['reqO2O']) ? 'checked' : '';
114 echo'
115 <input type="checkbox" name="reqO2O" '.$isChecked.' >
116 ';
117 ?>
118 </td>
119 </tr>
120 <tr>
121 <td>Custom mapping</td>
122 <td class="left_al_form">
123
124 <?
125 $isChecked = isset($_POST['custMap']) ? 'checked' : '';
126 echo'<input type="checkbox" name="custMap" '.$isChecked.'>';
127 ?>
128 </td>
129 </tr>
130 </table>
131 <h4 class="h4cond">Read/write tested on</h4>
132 <table class="in_form">
133 <!-- <tr>
134 <td>Read/write tested on</td>
135 <td></td>
136 </tr>
137 -->
138 <tr>
139 <td>sqlite</td>
140 <td class="left_al_form">
141
142 <?
143 $isChecked = isset($_POST['sqlTest']) ? 'checked' : '';
144 echo'
145 <input type="checkbox" name="sqlTest" '.$isChecked.'>';
146 ?>
147 </td>
148 </tr>
149
150 <tr>
151 <td>devdb10</td>
152 <td class="left_al_form">
153 <?
154 $isChecked = isset($_POST['db10Test']) ? 'checked' : '';
155 echo'
156 <input type="checkbox" name="db10Test" '.$isChecked.'>';
157 ?>
158 </td>
159 </tr>
160
161 <tr>
162 <td>other</td>
163 <td class="left_al_form">
164
165 <?
166 echo '<input type="text" class="wide" name="otherTest" value="'.$_POST['otherTest'].'">';
167 ?>
168 </td>
169 </tr>
170 </table>
171 <h4 class="h4cond">Attach files</h4>
172 <table class="in_form">
173 <!-- <tr>
174 <td>Attach files</td>
175 <td></td>
176 </tr>
177 --> <tr>
178 <td>Writer cfg file</td>
179 <td class="left_al_form">
180
181 <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
182 <input class="wide" name="writerCfg" type="file" />
183 </td>
184 </tr>
185
186 <tr>
187 <td>O2O query(optional)</td>
188 <td class="left_al_form">
189
190
191 <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
192 <input class="wide" name="O2Oquery" type="file" />
193
194 </td>
195 </tr>
196
197 <tr>
198 <td>Custom mapping XML(optional)</td>
199 <td class="left_al_form">
200
201
202 <input class="wide" type="hidden" name="MAX_FILE_SIZE" value="30000" />
203 <input class="wide" width="100%" name="mappingXML" type="file" />
204 </td>
205 </tr>
206
207 <tr>
208 <td>
209
210
211 <input type="submit" name="send" value="SEND" id="req_sub" />
212
213 </td>
214 </tr>
215 </table>
216 </form>
217
218
219 <?
220 if (isset($_POST['send']))
221 {
222 prepareInsert();
223 }
224 ?>
225 <h2 class="h2cond" id="ex_rec"> Existing records: </h2>
226
227 <? showExistingResults();
228 include('utils/backButton.php');
229 include('utils/footer.html');
230 ?>
231 <?
232 function prepareInsert()
233 {
234 $uploaddir = $_SESSION['CONF_UPLOADDIR'];
235 if ($_FILES['writerCfg']['name']== null)
236 {
237 echo '<br> Configuration file has to be downloaded<br>';
238 }
239 elseif ($_POST['objName']== null)
240 {
241 echo '<br> Object name is required <br>';
242 }
243 elseif ($_POST['CMSSW_ver']== null)
244 {
245 echo '<br> CMSSW version is required <br>';
246 }
247 elseif ($_POST['email']!=$_POST['re_email'] )
248 {
249 echo '<br> Emails you\'ve enetered don\'t match <br>';
250 }
251 else
252 {
253 $upload_writer_file = $uploaddir.basename($_FILES['writerCfg']['tmp_name']);
254 $upload_o2oquery_file =
255 ($_FILES['O2Oquery']['tmp_name'] ?
256 $uploaddir.basename($_FILES['O2Oquery']['tmp_name']) : null);
257 $upload_XMLmap_file =
258 ($_FILES['mappingXML']['tmp_name'] ?
259 $uploaddir.basename($_FILES['mappingXML']['tmp_name']) : null);
260
261 if (!(move_uploaded_file($_FILES['writerCfg']['tmp_name'], $upload_writer_file)))
262 {
263 echo 'Possible file upload attack!<br>
264 Try choosing configuration file once again<br>';
265 }
266 elseif ($upload_o2oquery_file!=null && !(move_uploaded_file($_FILES['O2Oquery']['tmp_name'], $upload_o2oquery_file)))
267 {
268 echo 'Possible file upload attack!<br>
269 Try choosing O2O query file once again<br>';
270 }
271 elseif ($upload_XMLmap_file!=null && !(move_uploaded_file($_FILES['mappingXML']['tmp_name'], $upload_XMLmap_file)))
272 {
273 echo 'Possible file upload attack!<br> Try choosing file once again<br>';
274 }
275 else
276 {
277
278 /// Radio buttons data transfomation
279 $_POST['sqlTest']== 'on' ? $sql_test = 1 : $sql_test = -1;
280 $_POST['db10Test']== 'on' ? $db10_test = 1 : $db10_test = -1;
281 $_POST['otherTest']== 'on' ? $other_test = 1 : $other_test = -1;
282 $_POST['reqO2O']== 'on' ? $req_o2o = 1 : $req_o2o = -1;
283 $_POST['custMap']== 'on' ? $cust_map = 1 : $cust_map = -1;
284
285 $qResponder = new queryResponder;
286 $qResponder->insertRequest($_POST['detTaskSel'], $_POST['prodSel'],
287 $_POST['servSel'], $_POST['objName'], $_POST['CMSSW_ver'],
288 $req_o2o, $cust_map, $_POST['email'], $sql_test, $db10_test,
289 $other_test, $upload_writer_file, $upload_o2oquery_file,
290 $upload_XMLmap_file);
291 }
292 }
293
294
295 }
296
297
298 function showExistingResults()
299 {
300 $qResponder = new queryResponder;
301 $rs = $qResponder->getData('cms_condweb_list_cond_objects', array(), 'true', array('0'=>'obj_cursor'));
302 echo '<link rel="stylesheet" type="text/css" href="css/cmscond_table.css">';
303 $resViewer = new tableViewer($rs);
304 $resViewer->showData();
305 echo '<script type="text/javascript" src="js/tableViewer.js"></script>';
306
307 }
308 ?>
309
310 <script type="text/javascript">
311 function validate() {
312 var er = document.getElementById('error_div');
313 var form = document.getElementById('req_form');
314 var msg = '';
315 if (form.email.value.length < 1)
316 {
317 msg += "Email has to be entered. ";
318 }
319 if (form.email.value != form.re_email.value)
320 {
321 msg += "Email fields don't match. ";
322 }
323 if (form.objName.value.length < 1)
324 {
325 msg += "Object name has to be entered. ";
326 }
327 if (form.CMSSW_ver.value.length <1)
328 {
329 msg += "CMSSW version has to be entered. ";
330 }
331 if (form.writerCfg.value.length< 1){
332 msg += "Configuration file is required. ";
333 }
334 if (msg == '')
335 {
336 return true;
337 er.style.visibility="hidden";
338 }
339 er.textContent = msg;
340 er.style.visibility="visible";
341 window.scroll(0,0);
342 return false;
343 }
344
345 </script>