| 1 | <script type="text/javascript">
|
|---|
| 2 | $(document).ready(function(){
|
|---|
| 3 | var timeValue;
|
|---|
| 4 | var meas;
|
|---|
| 5 | var meas2;
|
|---|
| 6 | var getTableId;
|
|---|
| 7 | window.cnt=2;
|
|---|
| 8 | var table = document.createElement("table");
|
|---|
| 9 | table.setAttribute('id',"table2");
|
|---|
| 10 | table.setAttribute('width','100%');
|
|---|
| 11 | var tr = document.createElement('tr');
|
|---|
| 12 | var td3=document.createElement('td');
|
|---|
| 13 | td3.setAttribute('style','border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;');
|
|---|
| 14 | td3.appendChild(
|
|---|
| 15 | input = document.createElement("input"),
|
|---|
| 16 | input.setAttribute("type","time"),
|
|---|
| 17 | input.setAttribute("id","Time1"),
|
|---|
| 18 | input.setAttribute("max","24"),
|
|---|
| 19 | input.setAttribute("min","1"),
|
|---|
| 20 | input.setAttribute("required",true)
|
|---|
| 21 |
|
|---|
| 22 | );
|
|---|
| 23 | td3.appendChild(
|
|---|
| 24 | button=document.createElement('input'),
|
|---|
| 25 | button.setAttribute('type','button'),
|
|---|
| 26 | button.setAttribute('value','[+]'),
|
|---|
| 27 | button.setAttribute('id','btnAddTime'),
|
|---|
| 28 | button.onclick=function(){
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 | if($('#Time1').val() != ""){ var splitting = $('#Time1').val().split(':'); var add = 01;
|
|---|
| 33 |
|
|---|
| 34 | timeValue = pad((Number(splitting[0]) + Number(add)),2)+':'+splitting[1];
|
|---|
| 35 |
|
|---|
| 36 | function pad(number, length) {
|
|---|
| 37 |
|
|---|
| 38 | var str = '' + number;
|
|---|
| 39 | while (str.length < length) {
|
|---|
| 40 | str = '0' + str;
|
|---|
| 41 | }
|
|---|
| 42 |
|
|---|
| 43 | return str;
|
|---|
| 44 |
|
|---|
| 45 | }
|
|---|
| 46 |
|
|---|
| 47 | meas = "name"; meas2 = "time"; getTableId = '#table2'; split1(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 | }
|
|---|
| 51 | );
|
|---|
| 52 | var td=document.createElement('td');
|
|---|
| 53 | td.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
|---|
| 54 | td.appendChild(
|
|---|
| 55 | sourcecbo= document.createElement('select'),
|
|---|
| 56 | sourcecbo.setAttribute('id','source1'),
|
|---|
| 57 | <?php
|
|---|
| 58 | $source=mysql_query("SELECT*FROM source");
|
|---|
| 59 | while($rowsource=mysql_fetch_array($source))
|
|---|
| 60 | {
|
|---|
| 61 | ?>
|
|---|
| 62 | sourcecbo.appendChild(
|
|---|
| 63 | option=document.createElement('option'),
|
|---|
| 64 |
|
|---|
| 65 | option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
|
|---|
| 66 | option.setAttribute('selected',true),
|
|---|
| 67 |
|
|---|
| 68 | option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
|
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 | ),
|
|---|
| 72 | <?php
|
|---|
| 73 | }
|
|---|
| 74 | ?>
|
|---|
| 75 | sourcecbo.setAttribute('id','source1')
|
|---|
| 76 |
|
|---|
| 77 | );
|
|---|
| 78 | var td1=document.createElement('td');
|
|---|
| 79 | td1.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
|---|
| 80 | td1.appendChild(
|
|---|
| 81 | measurementcbo= document.createElement('select'),
|
|---|
| 82 | measurementcbo.setAttribute('id','measurement1'),
|
|---|
| 83 | <?php
|
|---|
| 84 | $measure=mysql_query("SELECT*FROM measurement");
|
|---|
| 85 | while($rowmeasure=mysql_fetch_array($measure))
|
|---|
| 86 | {
|
|---|
| 87 | ?>
|
|---|
| 88 | measurementcbo.appendChild(
|
|---|
| 89 | option=document.createElement('option'),
|
|---|
| 90 | option.setAttribute('value','<?php echo $rowmeasure['fMeasurementKey']; ?>'),
|
|---|
| 91 | option.setAttribute('selected',true),
|
|---|
| 92 | option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
|
|---|
| 93 | ),
|
|---|
| 94 | <?php
|
|---|
| 95 | }
|
|---|
| 96 | ?>
|
|---|
| 97 | measurementcbo.setAttribute('id','measurement1')
|
|---|
| 98 | );
|
|---|
| 99 | td1.appendChild(
|
|---|
| 100 | button=document.createElement('input'),
|
|---|
| 101 | button.setAttribute('type','button'),
|
|---|
| 102 | button.setAttribute('value','[+]'),
|
|---|
| 103 | button.setAttribute('id','btnAddTime'),
|
|---|
| 104 | button.onclick=function(){
|
|---|
| 105 | if($('#Time1').val() != ""){ timeValue = $('#Time1').val(); meas = "hidden"; meas2 = true; getTableId = '#table2'; split1(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 | }
|
|---|
| 109 | );
|
|---|
| 110 | var td2=document.createElement('td');
|
|---|
| 111 | td2.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
|---|
| 112 | td2.appendChild(
|
|---|
| 113 | input = document.createElement('input'),
|
|---|
| 114 | input.setAttribute('type','text'),
|
|---|
| 115 | input.setAttribute('id','txtData1')
|
|---|
| 116 |
|
|---|
| 117 |
|
|---|
| 118 | );
|
|---|
| 119 | var td4=document.createElement('td');
|
|---|
| 120 | td4.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
|---|
| 121 | td4.appendChild(
|
|---|
| 122 | button = document.createElement('input'),
|
|---|
| 123 | button.setAttribute("type",'button'),
|
|---|
| 124 | button.setAttribute('id','btnSplit'),
|
|---|
| 125 | button.setAttribute('value','Split'),
|
|---|
| 126 | button.onclick= function()
|
|---|
| 127 | {
|
|---|
| 128 |
|
|---|
| 129 | if($('#Time1').val() != ""){ var splitting = $('#Time1').val().split(':'); var add = 30;
|
|---|
| 130 |
|
|---|
| 131 |
|
|---|
| 132 | timeValue =pad(splitting[0],2)+':'+ pad((Number(splitting[1]) + Number(add)),2);
|
|---|
| 133 |
|
|---|
| 134 | function pad(number, length) {
|
|---|
| 135 |
|
|---|
| 136 | var str = '' + number;
|
|---|
| 137 | while (str.length < length) {
|
|---|
| 138 | str = '0' + str;
|
|---|
| 139 | }
|
|---|
| 140 |
|
|---|
| 141 | return str;
|
|---|
| 142 |
|
|---|
| 143 | };
|
|---|
| 144 |
|
|---|
| 145 | meas = "name"; meas2 = "time"; getTableId = '#table2'; split1(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 146 |
|
|---|
| 147 |
|
|---|
| 148 |
|
|---|
| 149 | }
|
|---|
| 150 | );
|
|---|
| 151 | td4.appendChild(
|
|---|
| 152 | button=document.createElement('input'),
|
|---|
| 153 | button.setAttribute('type','button'),
|
|---|
| 154 | button.setAttribute('value','Delete'),
|
|---|
| 155 | button.setAttribute('id','btnDelete'),
|
|---|
| 156 | button.onclick=function(){
|
|---|
| 157 | $('#table2').remove();
|
|---|
| 158 | }
|
|---|
| 159 | );
|
|---|
| 160 |
|
|---|
| 161 | tr.appendChild(td3);
|
|---|
| 162 | tr.appendChild(td1);
|
|---|
| 163 | tr.appendChild(td);
|
|---|
| 164 |
|
|---|
| 165 | tr.appendChild(td2);
|
|---|
| 166 | tr.appendChild(td4);
|
|---|
| 167 | table.appendChild(tr);
|
|---|
| 168 |
|
|---|
| 169 | $('#TableH1').append(table);
|
|---|
| 170 |
|
|---|
| 171 |
|
|---|
| 172 |
|
|---|
| 173 | var table = document.createElement("table");
|
|---|
| 174 | table.setAttribute('id',"table1");
|
|---|
| 175 | table.setAttribute('width','100%');
|
|---|
| 176 | var tr = document.createElement('tr');
|
|---|
| 177 | tr.setAttribute('id','');
|
|---|
| 178 | tr.setAttribute('class','');
|
|---|
| 179 | var td3=document.createElement('td');
|
|---|
| 180 | td3.setAttribute('style','border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;');
|
|---|
| 181 | td3.appendChild(
|
|---|
| 182 | input = document.createElement("input"),
|
|---|
| 183 | input.setAttribute("type","time"),
|
|---|
| 184 | input.setAttribute("id","Time2"),
|
|---|
| 185 | input.setAttribute("max","24"),
|
|---|
| 186 | input.setAttribute("min","1"),
|
|---|
| 187 | input.setAttribute("required",true)
|
|---|
| 188 | );
|
|---|
| 189 | td3.appendChild(
|
|---|
| 190 | button=document.createElement('input'),
|
|---|
| 191 | button.setAttribute('type','button'),
|
|---|
| 192 | button.setAttribute('value','[+]'),
|
|---|
| 193 | button.setAttribute('id','btnAddTime'),
|
|---|
| 194 | button.onclick=function(){
|
|---|
| 195 | if($('#Time2').val() != ""){ var splitting = $('#Time2').val().split(':'); var add = 01;
|
|---|
| 196 |
|
|---|
| 197 | timeValue = pad((Number(splitting[0]) + Number(add)),2)+':'+splitting[1];
|
|---|
| 198 |
|
|---|
| 199 | function pad(number, length) {
|
|---|
| 200 |
|
|---|
| 201 | var str = '' + number;
|
|---|
| 202 | while (str.length < length) {
|
|---|
| 203 | str = '0' + str;
|
|---|
| 204 | }
|
|---|
| 205 |
|
|---|
| 206 | return str;
|
|---|
| 207 |
|
|---|
| 208 | }; meas = "name"; meas2 = "time"; getTableId = '#table1'; split(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 209 |
|
|---|
| 210 |
|
|---|
| 211 | }
|
|---|
| 212 | );
|
|---|
| 213 | var td=document.createElement('td');
|
|---|
| 214 | td.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
|---|
| 215 | td.appendChild(
|
|---|
| 216 | sourcecbo= document.createElement('select'),
|
|---|
| 217 | sourcecbo.setAttribute('id','source2'),
|
|---|
| 218 | <?php
|
|---|
| 219 | $source=mysql_query("SELECT*FROM source");
|
|---|
| 220 | while($rowsource=mysql_fetch_array($source))
|
|---|
| 221 | {
|
|---|
| 222 | ?>
|
|---|
| 223 | sourcecbo.appendChild(
|
|---|
| 224 | option=document.createElement('option'),
|
|---|
| 225 | option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
|
|---|
| 226 | option.setAttribute('selected',true),
|
|---|
| 227 | option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
|
|---|
| 228 |
|
|---|
| 229 | ),
|
|---|
| 230 | <?php
|
|---|
| 231 | }
|
|---|
| 232 | ?>
|
|---|
| 233 | sourcecbo.setAttribute('id','source2')
|
|---|
| 234 |
|
|---|
| 235 | );
|
|---|
| 236 | var td1=document.createElement('td');
|
|---|
| 237 | td1.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
|---|
| 238 | td1.appendChild(
|
|---|
| 239 | measurementcbo= document.createElement('select'),
|
|---|
| 240 | measurementcbo.setAttribute('id','measurement2'),
|
|---|
| 241 | <?php
|
|---|
| 242 | $measure=mysql_query("SELECT*FROM measurement");
|
|---|
| 243 | while($rowmeasure=mysql_fetch_array($measure))
|
|---|
| 244 | {
|
|---|
| 245 | ?>
|
|---|
| 246 | measurementcbo.appendChild(
|
|---|
| 247 | option=document.createElement('option'),
|
|---|
| 248 | option.setAttribute('value','<?php echo $rowmeasure['fMeasurementKey']; ?>'),
|
|---|
| 249 | option.setAttribute('selected',true),
|
|---|
| 250 | option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
|
|---|
| 251 | ),
|
|---|
| 252 | <?php
|
|---|
| 253 | }
|
|---|
| 254 | ?>
|
|---|
| 255 | measurementcbo.setAttribute('id','measurement2')
|
|---|
| 256 | );
|
|---|
| 257 | td1.appendChild(
|
|---|
| 258 | button=document.createElement('input'),
|
|---|
| 259 | button.setAttribute('type','button'),
|
|---|
| 260 | button.setAttribute('value','[+]'),
|
|---|
| 261 | button.setAttribute('id','btnAddTime'),
|
|---|
| 262 | button.onclick=function(){
|
|---|
| 263 | if($('#Time2').val() != ""){ timeValue = $('#Time2').val(); meas = "hidden"; meas2 = true; getTableId = '#table1'; split(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 264 |
|
|---|
| 265 |
|
|---|
| 266 | }
|
|---|
| 267 | );
|
|---|
| 268 | var td2=document.createElement('td');
|
|---|
| 269 | td2.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
|---|
| 270 | td2.appendChild(
|
|---|
| 271 | input = document.createElement('input'),
|
|---|
| 272 | input.setAttribute('type','text'),
|
|---|
| 273 | input.setAttribute('id','txtData2')
|
|---|
| 274 |
|
|---|
| 275 | );
|
|---|
| 276 | var td4=document.createElement('td');
|
|---|
| 277 | td4.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
|---|
| 278 | td4.appendChild(
|
|---|
| 279 | button = document.createElement('input'),
|
|---|
| 280 | button.setAttribute("type",'button'),
|
|---|
| 281 | button.setAttribute('id','btnSplit'),
|
|---|
| 282 | button.setAttribute('value','Split'),
|
|---|
| 283 | button.onclick= function()
|
|---|
| 284 | {
|
|---|
| 285 | if($('#Time2').val() != ""){ var splitting = $('#Time2').val().split(':'); var add = 30;
|
|---|
| 286 |
|
|---|
| 287 | timeValue =pad(splitting[0],2)+':'+ pad((Number(splitting[1]) + Number(add)),2);
|
|---|
| 288 |
|
|---|
| 289 | function pad(number, length) {
|
|---|
| 290 |
|
|---|
| 291 | var str = '' + number;
|
|---|
| 292 | while (str.length < length) {
|
|---|
| 293 | str = '0' + str;
|
|---|
| 294 | }
|
|---|
| 295 |
|
|---|
| 296 | return str;
|
|---|
| 297 |
|
|---|
| 298 | }
|
|---|
| 299 |
|
|---|
| 300 | meas = "name"; meas2 = "time"; getTableId = '#table1'; split(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 301 |
|
|---|
| 302 | }
|
|---|
| 303 | );
|
|---|
| 304 | td4.appendChild(
|
|---|
| 305 | button=document.createElement('input'),
|
|---|
| 306 | button.setAttribute('type','button'),
|
|---|
| 307 | button.setAttribute('value','Delete'),
|
|---|
| 308 | button.setAttribute('id','btnDelete'),
|
|---|
| 309 | button.onclick=function(){
|
|---|
| 310 | $('#table1').remove();
|
|---|
| 311 |
|
|---|
| 312 | }
|
|---|
| 313 | );
|
|---|
| 314 |
|
|---|
| 315 | tr.appendChild(td3);
|
|---|
| 316 | tr.appendChild(td1);
|
|---|
| 317 | tr.appendChild(td);
|
|---|
| 318 |
|
|---|
| 319 | tr.appendChild(td2);
|
|---|
| 320 | tr.appendChild(td4);
|
|---|
| 321 | table.appendChild(tr);
|
|---|
| 322 |
|
|---|
| 323 | $('#TableH1').append(table);
|
|---|
| 324 |
|
|---|
| 325 | var meas;
|
|---|
| 326 | var timeValue;
|
|---|
| 327 | var pad;
|
|---|
| 328 |
|
|---|
| 329 | function split()
|
|---|
| 330 | {
|
|---|
| 331 |
|
|---|
| 332 | cnt++;
|
|---|
| 333 | var table = document.createElement("table");
|
|---|
| 334 | table.setAttribute('id',"table"+cnt);
|
|---|
| 335 | table.setAttribute('width','100%');
|
|---|
| 336 | var tr = document.createElement('tr');
|
|---|
| 337 | tr.setAttribute('id','');
|
|---|
| 338 | tr.setAttribute('class','');
|
|---|
| 339 |
|
|---|
| 340 | var td3=document.createElement('td');
|
|---|
| 341 | td3.setAttribute('style','border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;');
|
|---|
| 342 | td3.setAttribute('class','first');
|
|---|
| 343 |
|
|---|
| 344 | td3.appendChild(
|
|---|
| 345 | input = document.createElement("input"),
|
|---|
| 346 | input.setAttribute("type","time"),
|
|---|
| 347 | input.setAttribute("id","Time"+cnt),
|
|---|
| 348 | input.setAttribute("max","24"),
|
|---|
| 349 | input.setAttribute("min","1"),
|
|---|
| 350 | input.setAttribute("required",true),
|
|---|
| 351 | input.setAttribute(meas,meas2),
|
|---|
| 352 | input.setAttribute("value",timeValue)
|
|---|
| 353 |
|
|---|
| 354 | );
|
|---|
| 355 | td3.appendChild(
|
|---|
| 356 | button=document.createElement('input'),
|
|---|
| 357 | button.setAttribute('type','button'),
|
|---|
| 358 | button.setAttribute('value','[+]'),
|
|---|
| 359 | button.setAttribute('id','btnAddTime'),
|
|---|
| 360 | button.setAttribute(meas,meas2),
|
|---|
| 361 | button.onclick=function(){
|
|---|
| 362 | if($('#Time'+cnt).val() != ""){var splitting = $('#Time'+cnt).val().split(':'); var add = 01;
|
|---|
| 363 |
|
|---|
| 364 | timeValue = pad((Number(splitting[0]) + Number(add)),2)+':'+splitting[1];
|
|---|
| 365 |
|
|---|
| 366 | function pad(number, length) {
|
|---|
| 367 |
|
|---|
| 368 | var str = '' + number;
|
|---|
| 369 | while (str.length < length) {
|
|---|
| 370 | str = '0' + str;
|
|---|
| 371 | }
|
|---|
| 372 |
|
|---|
| 373 | return str;
|
|---|
| 374 |
|
|---|
| 375 | } meas = "name"; meas2 = "time"; getTableId = '#table'+cnt; split1(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 376 |
|
|---|
| 377 |
|
|---|
| 378 | }
|
|---|
| 379 | );
|
|---|
| 380 |
|
|---|
| 381 | var td=document.createElement('td');
|
|---|
| 382 | td.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
|---|
| 383 | td.appendChild(
|
|---|
| 384 | sourcecbo= document.createElement('select'),
|
|---|
| 385 | sourcecbo.setAttribute('id','source'+cnt),
|
|---|
| 386 | <?php
|
|---|
| 387 | $source=mysql_query("SELECT*FROM source");
|
|---|
| 388 | while($rowsource=mysql_fetch_array($source))
|
|---|
| 389 | {
|
|---|
| 390 | ?>
|
|---|
| 391 | sourcecbo.appendChild(
|
|---|
| 392 | option=document.createElement('option'),
|
|---|
| 393 | option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
|
|---|
| 394 | option.setAttribute('selected',true),
|
|---|
| 395 | option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
|
|---|
| 396 |
|
|---|
| 397 | ),
|
|---|
| 398 | <?php
|
|---|
| 399 | }
|
|---|
| 400 | ?>
|
|---|
| 401 | sourcecbo.setAttribute('id','source'+cnt)
|
|---|
| 402 |
|
|---|
| 403 | );
|
|---|
| 404 | var td1=document.createElement('td');
|
|---|
| 405 | td1.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
|---|
| 406 | td1.appendChild(
|
|---|
| 407 | measurementcbo= document.createElement('select'),
|
|---|
| 408 | measurementcbo.setAttribute('id','measurement'+cnt),
|
|---|
| 409 | <?php
|
|---|
| 410 | $measure=mysql_query("SELECT*FROM measurement");
|
|---|
| 411 | while($rowmeasure=mysql_fetch_array($measure))
|
|---|
| 412 | {
|
|---|
| 413 | ?>
|
|---|
| 414 | measurementcbo.appendChild(
|
|---|
| 415 | option=document.createElement('option'),
|
|---|
| 416 | option.setAttribute('value','<?php echo $rowmeasure['fMeasurementKey']; ?>'),
|
|---|
| 417 | option.setAttribute('selected',true),
|
|---|
| 418 | option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
|
|---|
| 419 | ),
|
|---|
| 420 | <?php
|
|---|
| 421 | }
|
|---|
| 422 | ?>
|
|---|
| 423 | measurementcbo.setAttribute('id','measurement'+cnt)
|
|---|
| 424 | );
|
|---|
| 425 | td1.appendChild(
|
|---|
| 426 | button=document.createElement('input'),
|
|---|
| 427 | button.setAttribute('type','button'),
|
|---|
| 428 | button.setAttribute('value','[+]'),
|
|---|
| 429 | button.setAttribute('id','btnAddTime'),
|
|---|
| 430 | button.onclick=function(){
|
|---|
| 431 |
|
|---|
| 432 | if($('#Time'+cnt).val() != "")
|
|---|
| 433 | {
|
|---|
| 434 | timeValue = $('#Time'+cnt).val();
|
|---|
| 435 | meas = "hidden";
|
|---|
| 436 | meas2 = true;
|
|---|
| 437 | getTableId = '#table'+cnt;
|
|---|
| 438 | split1();
|
|---|
| 439 | }
|
|---|
| 440 | else
|
|---|
| 441 | {
|
|---|
| 442 | alert("please enter value for time to add measurement");
|
|---|
| 443 | }
|
|---|
| 444 |
|
|---|
| 445 |
|
|---|
| 446 | }
|
|---|
| 447 | );
|
|---|
| 448 |
|
|---|
| 449 | var td2=document.createElement('td');
|
|---|
| 450 | td2.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
|---|
| 451 | td2.appendChild(
|
|---|
| 452 | input = document.createElement('input'),
|
|---|
| 453 | input.setAttribute('type','text'),
|
|---|
| 454 | input.setAttribute('id','txtData'+cnt)
|
|---|
| 455 |
|
|---|
| 456 | );
|
|---|
| 457 | var td4=document.createElement('td');
|
|---|
| 458 | td4.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
|---|
| 459 | td4.appendChild(
|
|---|
| 460 | button = document.createElement('input'),
|
|---|
| 461 | button.setAttribute("type",'button'),
|
|---|
| 462 | button.setAttribute('id','btnSplit'),
|
|---|
| 463 | button.setAttribute('value','Split'),
|
|---|
| 464 | button.onclick=function(){
|
|---|
| 465 | if($('#Time'+cnt).val() != ""){ var splitting = $('#Time'+cnt).val().split(':'); var add = 30;
|
|---|
| 466 |
|
|---|
| 467 | timeValue =pad(splitting[0],2)+':'+ pad((Number(splitting[1]) + Number(add)),2);
|
|---|
| 468 |
|
|---|
| 469 | function pad(number, length) {
|
|---|
| 470 |
|
|---|
| 471 | var str = '' + number;
|
|---|
| 472 | while (str.length < length) {
|
|---|
| 473 | str = '0' + str;
|
|---|
| 474 | }
|
|---|
| 475 |
|
|---|
| 476 | return str;
|
|---|
| 477 |
|
|---|
| 478 | }
|
|---|
| 479 |
|
|---|
| 480 | meas = "name"; meas2 = "time"; getTableId = '#table'+cnt; split(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 481 | }
|
|---|
| 482 | );
|
|---|
| 483 | td4.appendChild(
|
|---|
| 484 | button=document.createElement('input'),
|
|---|
| 485 | button.setAttribute('type','button'),
|
|---|
| 486 | button.setAttribute('value','Delete'),
|
|---|
| 487 | button.setAttribute('id','btnDelete'),
|
|---|
| 488 | button.onclick=function(){
|
|---|
| 489 | $('#table'+cnt).remove();
|
|---|
| 490 | cnt--;
|
|---|
| 491 | }
|
|---|
| 492 | );
|
|---|
| 493 |
|
|---|
| 494 | tr.appendChild(td3);
|
|---|
| 495 | tr.appendChild(td1);
|
|---|
| 496 | tr.appendChild(td);
|
|---|
| 497 |
|
|---|
| 498 | tr.appendChild(td2);
|
|---|
| 499 | tr.appendChild(td4);
|
|---|
| 500 | table.appendChild(tr);
|
|---|
| 501 |
|
|---|
| 502 | $(table).insertAfter($(getTableId));
|
|---|
| 503 |
|
|---|
| 504 |
|
|---|
| 505 |
|
|---|
| 506 | }
|
|---|
| 507 | function split1()
|
|---|
| 508 | {
|
|---|
| 509 |
|
|---|
| 510 | cnt++;
|
|---|
| 511 | var table = document.createElement("table");
|
|---|
| 512 | table.setAttribute('id',"table"+cnt);
|
|---|
| 513 | table.setAttribute('width','100%');
|
|---|
| 514 | var tr = document.createElement('tr');
|
|---|
| 515 | tr.setAttribute('id','');
|
|---|
| 516 | tr.setAttribute('class','');
|
|---|
| 517 |
|
|---|
| 518 | var td3=document.createElement('td');
|
|---|
| 519 | td3.setAttribute('style','border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;');
|
|---|
| 520 | td3.setAttribute('class','first');
|
|---|
| 521 | td3.appendChild(
|
|---|
| 522 | input = document.createElement("input"),
|
|---|
| 523 | input.setAttribute("type","time"),
|
|---|
| 524 | input.setAttribute("id","Time"+cnt),
|
|---|
| 525 | input.setAttribute("max","24"),
|
|---|
| 526 | input.setAttribute("min","1"),
|
|---|
| 527 | input.setAttribute("required",true),
|
|---|
| 528 | input.setAttribute(meas,meas2),
|
|---|
| 529 | input.setAttribute("value",timeValue)
|
|---|
| 530 | );
|
|---|
| 531 | td3.appendChild(
|
|---|
| 532 | button=document.createElement('input'),
|
|---|
| 533 | button.setAttribute('type','button'),
|
|---|
| 534 | button.setAttribute('value','[+]'),
|
|---|
| 535 | button.setAttribute('id','btnAddTime'),
|
|---|
| 536 | button.setAttribute(meas,meas2),
|
|---|
| 537 | button.onclick=function(){
|
|---|
| 538 | if($('#Time'+cnt).val() != ""){ var splitting = $('#Time'+cnt).val().split(':'); var add = 01;
|
|---|
| 539 |
|
|---|
| 540 | timeValue = pad((Number(splitting[0]) + Number(add)),2)+':'+splitting[1];
|
|---|
| 541 |
|
|---|
| 542 | function pad(number, length) {
|
|---|
| 543 |
|
|---|
| 544 | var str = '' + number;
|
|---|
| 545 | while (str.length < length) {
|
|---|
| 546 | str = '0' + str;
|
|---|
| 547 | }
|
|---|
| 548 |
|
|---|
| 549 | return str;
|
|---|
| 550 |
|
|---|
| 551 | } meas = "name"; meas2 = "time"; getTableId = '#table'+cnt; split1(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 552 |
|
|---|
| 553 |
|
|---|
| 554 | }
|
|---|
| 555 | );
|
|---|
| 556 |
|
|---|
| 557 | var td=document.createElement('td');
|
|---|
| 558 | td.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
|---|
| 559 | td.appendChild(
|
|---|
| 560 | sourcecbo= document.createElement('select'),
|
|---|
| 561 | sourcecbo.setAttribute('id','source'+cnt),
|
|---|
| 562 | <?php
|
|---|
| 563 | $source=mysql_query("SELECT*FROM source");
|
|---|
| 564 | while($rowsource=mysql_fetch_array($source))
|
|---|
| 565 | {
|
|---|
| 566 | ?>
|
|---|
| 567 | sourcecbo.appendChild(
|
|---|
| 568 | option=document.createElement('option'),
|
|---|
| 569 | option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
|
|---|
| 570 | option.setAttribute('selected',true),
|
|---|
| 571 | option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
|
|---|
| 572 |
|
|---|
| 573 | ),
|
|---|
| 574 | <?php
|
|---|
| 575 | }
|
|---|
| 576 | ?>
|
|---|
| 577 | sourcecbo.setAttribute('id','source'+cnt)
|
|---|
| 578 |
|
|---|
| 579 | );
|
|---|
| 580 | var td1=document.createElement('td');
|
|---|
| 581 | td1.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
|---|
| 582 |
|
|---|
| 583 | td1.appendChild(
|
|---|
| 584 | measurementcbo= document.createElement('select'),
|
|---|
| 585 | measurementcbo.setAttribute('id','measurement'+cnt),
|
|---|
| 586 | <?php
|
|---|
| 587 | $measure=mysql_query("SELECT*FROM measurement");
|
|---|
| 588 | while($rowmeasure=mysql_fetch_array($measure))
|
|---|
| 589 | {
|
|---|
| 590 | ?>
|
|---|
| 591 | measurementcbo.appendChild(
|
|---|
| 592 | option=document.createElement('option'),
|
|---|
| 593 | option.setAttribute('value','<?php echo $rowmeasure['fMeasurementKey']; ?>'),
|
|---|
| 594 | option.setAttribute('selected',true),
|
|---|
| 595 | option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
|
|---|
| 596 | ),
|
|---|
| 597 | <?php
|
|---|
| 598 | }
|
|---|
| 599 | ?>
|
|---|
| 600 | measurementcbo.setAttribute('id','measurement'+cnt)
|
|---|
| 601 | );
|
|---|
| 602 | td1.appendChild(
|
|---|
| 603 | button=document.createElement('input'),
|
|---|
| 604 | button.setAttribute('type','button'),
|
|---|
| 605 | button.setAttribute('value','[+]'),
|
|---|
| 606 | button.setAttribute('id','btnAddTime'),
|
|---|
| 607 | button.onclick=function(){
|
|---|
| 608 |
|
|---|
| 609 | if($('#Time'+cnt).val() != ""){ timeValue = $('#Time'+cnt).val(); meas = "hidden"; meas2 = true; getTableId = '#table'+cnt; split1(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 610 |
|
|---|
| 611 |
|
|---|
| 612 | }
|
|---|
| 613 | );
|
|---|
| 614 |
|
|---|
| 615 | var td2=document.createElement('td');
|
|---|
| 616 | td2.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
|---|
| 617 | td2.appendChild(
|
|---|
| 618 | input = document.createElement('input'),
|
|---|
| 619 | input.setAttribute('type','text'),
|
|---|
| 620 | input.setAttribute('id','txtData'+cnt)
|
|---|
| 621 |
|
|---|
| 622 | );
|
|---|
| 623 | var td4=document.createElement('td');
|
|---|
| 624 | td4.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
|---|
| 625 | td4.appendChild(
|
|---|
| 626 | button = document.createElement('input'),
|
|---|
| 627 | button.setAttribute("type",'button'),
|
|---|
| 628 | button.setAttribute('id','btnSplit'),
|
|---|
| 629 | button.setAttribute('value','Split'),
|
|---|
| 630 | button.onclick=function(){
|
|---|
| 631 | if($('#Time'+cnt).val() != ""){ var splitting = $('#Time'+cnt).val().split(':'); var add = 30;
|
|---|
| 632 |
|
|---|
| 633 | timeValue =pad(splitting[0],2)+':'+ pad((Number(splitting[1]) + Number(add)),2);
|
|---|
| 634 |
|
|---|
| 635 | function pad(number, length) {
|
|---|
| 636 |
|
|---|
| 637 | var str = '' + number;
|
|---|
| 638 | while (str.length < length) {
|
|---|
| 639 | str = '0' + str;
|
|---|
| 640 | }
|
|---|
| 641 |
|
|---|
| 642 | return str;
|
|---|
| 643 |
|
|---|
| 644 | }
|
|---|
| 645 |
|
|---|
| 646 | meas = "name"; meas2 = "time"; getTableId = '#table'+cnt; split(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 647 | }
|
|---|
| 648 | );
|
|---|
| 649 | td4.appendChild(
|
|---|
| 650 | button=document.createElement('input'),
|
|---|
| 651 | button.setAttribute('type','button'),
|
|---|
| 652 | button.setAttribute('value','Delete'),
|
|---|
| 653 | button.setAttribute('id','btnDelete'),
|
|---|
| 654 | button.onclick=function(){
|
|---|
| 655 | $('#table'+cnt).remove();
|
|---|
| 656 | cnt--;
|
|---|
| 657 | });
|
|---|
| 658 |
|
|---|
| 659 | tr.appendChild(td3);
|
|---|
| 660 | tr.appendChild(td1);
|
|---|
| 661 | tr.appendChild(td);
|
|---|
| 662 |
|
|---|
| 663 | tr.appendChild(td2);
|
|---|
| 664 | tr.appendChild(td4);
|
|---|
| 665 | table.appendChild(tr);
|
|---|
| 666 |
|
|---|
| 667 | $(table).insertAfter($(getTableId));
|
|---|
| 668 | }
|
|---|
| 669 |
|
|---|
| 670 | });
|
|---|
| 671 | </script> |
|---|