sibtracker/system/inc/newsimg/addimg.php
2019-05-18 13:46:03 +08:00

79 lines
2.4 KiB
PHP

<?php
if( ! defined( 'DATALIFEENGINE' ) ) {
die( "Hacking attempt!" );
}
require_once ROOT_DIR.'/language/'.$config['langs'].'/img.lng';
#### IMG
echo "<script language=\"javascript\" type=\"text/javascript\">
function ShowOrHideEx(id, show) {
var item = null;
if (document.getElementById) {
item = document.getElementById(id);
} else if (document.all) {
item = document.all[id];
} else if (document.layers){
item = document.layers[id];
}
if (item && item.style) {
item.style.display = show ? \"\" : \"none\";
}
}
var total_allow_rows = {$config['max_file_count']};
function AddImages() {
var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length;
if (total_allow_rows && lastRow == total_allow_rows ) return;
// if there's no header row in the table, then iteration = lastRow + 1
var iteration = lastRow+1;
var row = tbl.insertRow(lastRow);
var cellRight = row.insertCell(0);
var el = document.createElement('input');
el.setAttribute('type', 'file');
el.setAttribute('name', 'addimg_' + iteration);
el.setAttribute('size', '41');
el.setAttribute('value', iteration);
cellRight.appendChild(el);
document.getElementById('images_number').value = iteration;
}
function RemoveImages() {
var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length;
if (lastRow > 1){
tbl.deleteRow(lastRow - 1);
document.getElementById('images_number').value = document.getElementById('images_number').value - 1;
}
}
</script>";
echo <<<HTML
<tr><td height="29" style="padding-left:5px;" colspan="2"><div class="hr_line"></div></td></tr>
<tr><td height="29" style="padding-left:5px;">{$lang['images_uphard']}</td>
<td>
<input type="hidden" name="images_number" id="images_number" value="1">
<div id="dle_tabView1">
<table id="tblSample" class="upload">
<tr id="row">
<td><input type="file" size="41" name="addimg_1"></td>
</tr>
</table>
<div>
<input type=button class=buttons value=' - ' style="width:30px;" title='{$lang['images_rem_tl']}' onClick="RemoveImages();return false;">
<input type=button class=buttons value=' + ' style="width:30px;" title='{$lang['images_add_tl']}' onClick="AddImages();return false;"> &nbsp;
</div>
</td></tr>
HTML;
#### IMG
?>