'; echo 'alert(\''.__('Attachment removed!').'\');'; echo 'location.href = \'iframe_attach.php\';'; echo ''; } if (isset($_POST['bid']) AND isset($_POST['remove'])) { $bid = (integer)$_POST['bid']; $file = (integer)$_POST['remove']; // query file data from database $file_q = $dbs->query('SELECT * FROM files WHERE file_id='.$file); $file_d = $file_q->fetch_assoc(); // attachment data delete $sql_op = new simbio_dbop($dbs); $sql_op->delete('biblio_attachment', "file_id=$file AND biblio_id=$bid"); echo ''; } // if biblio ID is set if ($biblioID) { $table = new simbio_table(); $table->table_attr = 'align="center" style="width: 100%;" cellpadding="2" cellspacing="0"'; // database list $biblio_attach_q = $dbs->query('SELECT att.*,fl.* FROM biblio_attachment AS att LEFT JOIN files AS fl ON att.file_id=fl.file_id WHERE biblio_id='.$biblioID); $row = 1; $row_class = 'alterCell2'; while ($biblio_attach_d = $biblio_attach_q->fetch_assoc()) { // alternate the row color $row_class = ($row%2 == 0)?'alterCell':'alterCell2'; // remove link $remove_link = 'Delete'; // edit link $edit_link = 'Edit'; // file link if (preg_match('@(video|audio|image)/.+@i', $biblio_attach_d['mime_type'])) { $file = ''.$biblio_attach_d['file_title'].''; } else { $file = ''.$biblio_attach_d['file_title'].''; } $table->appendTableRow(array($remove_link, $edit_link, $file, $biblio_attach_d['file_desc'])); $table->setCellAttr($row, 0, 'valign="top" class="'.$row_class.'" style="font-weight: bold; width: 5%;"'); $table->setCellAttr($row, 1, 'valign="top" class="'.$row_class.'" style="font-weight: bold; width: 5%;"'); $table->setCellAttr($row, 2, 'valign="top" class="'.$row_class.'" style="width: 40%;"'); $table->setCellAttr($row, 3, 'valign="top" class="'.$row_class.'" style="width: 50%;"'); $row++; } echo $table->printTable(); // hidden form echo '
'; } else { if ($_SESSION['biblioAttach']) { $table = new simbio_table(); $table->table_attr = 'align="center" style="width: 100%;" cellpadding="2" cellspacing="0"'; $row = 1; $row_class = 'alterCell2'; foreach ($_SESSION['biblioAttach'] as $idx=>$biblio_session) { // remove link $remove_link = 'Remove'; $table->appendTableRow(array($remove_link, $biblio_session['file_name'], $biblio_session['last_update'])); $table->setCellAttr($row, 0, 'valign="top" class="'.$row_class.'" style="font-weight: bold; background-color: #ffc466; width: 10%;"'); $table->setCellAttr($row, 1, 'valign="top" class="'.$row_class.'" style="background-color: #ffc466; width: 60%;"'); $table->setCellAttr($row, 2, 'valign="top" class="'.$row_class.'" style="background-color: #ffc466; width: 30%;"'); $row++; } echo $table->printTable(); } } /* main content end */ $content = ob_get_clean(); // include the page template require SB.'/admin/'.$sysconf['admin_template']['dir'].'/notemplate_page_tpl.php';