function linkFileToEntity() { setFuncMessages(__FUNCTION__, array('OK' => 71)); assertUIntArg('file_id'); global $sic; usePreparedInsertBlade('FileLink', array('file_id' => $sic['file_id'], 'entity_type' => etypeByPageno(), 'entity_id' => getBypassValue())); $fi = spotEntity('file', $sic['file_id']); showFuncMessage(__FUNCTION__, 'OK', array(htmlspecialchars($fi['name']))); }
function renderTripletForm($bypass_id) { renderSLBTriplets2(spotEntity(etypeByPageno(), $bypass_id), TRUE); }
function renderFilesForEntity($entity_id) { $entity_type = etypeByPageno(); startPortlet('Upload and link new'); echo "<table border=0 cellspacing=0 cellpadding='5' align='center' class='widetable'>\n"; echo "<tr><th>File</th><th>Comment</th><th></th></tr>\n"; printOpFormIntro('addFile', array(), TRUE); echo "<tr>"; echo "<td class=tdleft><input type='file' size='10' name='file'></td>\n"; echo "<td class=tdleft><textarea name=comment rows=10 cols=80></textarea></td><td>\n"; printImageHREF('CREATE', 'Upload file', TRUE); echo "</td></tr></form>"; echo "</table><br>\n"; finishPortlet(); $files = getAllUnlinkedFiles($entity_type, $entity_id); if (count($files)) { startPortlet('Link existing (' . count($files) . ')'); printOpFormIntro('linkFile'); echo "<table border=0 cellspacing=0 cellpadding='5' align='center'>\n"; echo '<tr><td class=tdleft>'; printSelect($files, array('name' => 'file_id')); echo '</td><td class=tdleft>'; printImageHREF('ATTACH', 'Link file', TRUE); echo '</td></tr></table>'; echo "</form>\n"; finishPortlet(); } $filelist = getFilesOfEntity($entity_type, $entity_id); if (count($filelist)) { startPortlet('Manage linked (' . count($filelist) . ')'); echo "<table border=0 cellspacing=0 cellpadding='5' align='center' class='widetable'>\n"; echo "<tr><th>File</th><th>Comment</th><th>Unlink</th></tr>\n"; foreach ($filelist as $file_id => $file) { echo "<tr valign=top><td class=tdleft>"; renderCell(spotEntity('file', $file_id)); echo "</td><td class=tdleft>{$file['comment']}</td><td class=tdcenter>"; echo getOpLink(array('op' => 'unlinkFile', 'link_id' => $file['link_id']), '', 'CUT', 'Unlink file'); echo "</td></tr>\n"; } echo "</table><br>\n"; finishPortlet(); } }