fm_updateAuditLog("Updated File Submission ID: {$_CLEAN['fid']}"); $data['cid'] = $_CLEAN['folder']; $data['tags'] = $_CLEAN['tags']; } else { // Allow updating the category, title, description and image for the current version and primary file record if ($_CLEAN['version'] == $curVersion) { $newcid = $_CLEAN['folder']; DB_query("UPDATE {$_TABLES['nxfile_files']} SET title='{$_CLEAN['filetitle']}', date='{$date}' WHERE fid={$_CLEAN['fid']}"); DB_query("UPDATE {$_TABLES['nxfile_filedetail']} SET description='{$_CLEAN['description']}' WHERE fid={$_CLEAN['fid']}"); // Test if user has selected a different directory and if they have perms then move else return false; $filemoved = nexdoc_movefile($_CLEAN['fid'], $newcid); $data['cid'] = $newcid; // Return the tags for the AJAX handler to update the page. Use the cloud function to get tags so we are sure they were added $tpl = new Template($_CONF['path_layout'] . 'nexfile'); $tpl->set_file(array('tag_link' => 'taglink_record.thtml', 'tag_rec' => 'tagdesc_record.thtml')); $tags = nexdoc_formatfiletags($tpl, $tagcloud->get_itemtags($_CLEAN['fid'])); $data['tags'] = $tags; } DB_query("UPDATE {$_TABLES['nxfile_fileversions']} SET notes='{$_CLEAN['vernote']}' WHERE fid={$_CLEAN['fid']} and version={$_CLEAN['version']}"); $data['tagcloud'] = $tagcloud->displaycloud(); fm_updateAuditLog("Updated File FID: {$_CLEAN['fid']}"); } $data['description'] = nl2br($_WEB['description']); $data['fid'] = $_CLEAN['fid']; $data['filename'] = $_WEB['filetitle']; $data['filemoved'] = $filemoved; $retval = json_encode($data); break; case 'deletefile': $fid = $filter->getCleanData('int', $_GET['fid']); $reportmode = $filter->getCleanData('char', $_GET['reportmode']);
function nexdoc_displayTagSearchListing($query, &$data) { global $_CONF, $_TABLES, $_FMCONF, $allowableViewFoldersSql, $paddingsize, $filedescriptionOffset; $tpl = new Template($_CONF['path_layout'] . 'nexfile'); $tpl->set_file(array('filedetails' => 'filedetails.thtml', 'subfolder' => 'filelisting_subfolder_record.thtml', 'emptyfolder' => 'filelisting_emptyfolder.thtml', 'filelisting_rec' => 'filelisting_record.thtml', 'folderlisting_rec' => 'leftnav_folder_record.thtml', 'movefolder' => 'folder_onhover_move.thtml', 'tag_link' => 'taglink_record.thtml', 'tag_rec' => 'tagdesc_record.thtml', 'download_action' => 'download_link.thtml', 'editfile_action' => 'editfile_link.thtml')); $tpl->set_var('layout_url', $_CONF['layout_url']); $tpl->set_var('imgset', "{$_CONF['layout_url']}/nexfile/images"); $sql = "SELECT file.fid as fid,file.cid,file.title,file.fname,file.date,file.version,file.submitter,file.status,"; $sql .= "detail.description,category.name,category.pid "; $sql .= "FROM {$_TABLES['nxfile_files']} file "; $sql .= "LEFT JOIN {$_TABLES['nxfile_filedetail']} detail ON detail.fid=file.fid "; $sql .= "LEFT JOIN {$_TABLES['nxfile_categories']} category ON file.cid=category.cid "; $sql .= "WHERE 1=1 "; if (!empty($allowableViewFoldersSql)) { $sql .= "AND file.cid in ({$allowableViewFoldersSql}) "; } $tagcloud = new nexfileTagCloud(); $itemids = $tagcloud->search($query); if ($itemids !== FALSE) { $itemids = implode(',', $itemids); } if (!empty($itemids)) { $sql .= "AND file.fid in ({$itemids}) "; } else { $sql .= "AND 1 = 2"; // No tags match query - return 0 records } $sql .= "ORDER BY file.date DESC "; $resFiles = DB_query($sql); if (DB_numRows($resFiles) > 0) { // Show any files in this directory $i = 1; $query = stripslashes($query); while (list($fid, $subfolderId, $title, $fname, $date, $version, $submitter, $status, $description, $category, $pid) = DB_fetchARRAY($resFiles)) { $tpl->set_var('padding_left', 2 * $paddingsize); $tpl->set_var('file_desc_padding_left', $filedescriptionOffset); if ($status == 2) { $tpl->set_var('showlock', ''); } else { $tpl->set_var('showlock', 'none'); } $tpl->set_var('details_link_parms', "?fid={$fid}"); $tpl->set_var('fid', $fid); $tpl->set_var('file_name', $title); $tpl->set_var('modified_date', strftime($_CONF['shortdate'], $date)); $tpl->set_var('folder_link', "{$_CONF['site_url']}/nexfile/index.php?cid={$subfolderId}"); $tpl->set_var('folder_name', $category); $tpl->set_var('subfolder_id', $subfolderId); $tags = $tagcloud->get_itemtags($fid); nexdoc_formatfiletags($tpl, $tags, $query); nexdoc_formatFavoriteImage($tpl, $fid); $tpl->set_var('file_description', nl2br($description)); $tpl->set_var('download_link', "{$_CONF['site_url']}/nexfile/download.php?op=download&fid={$fid}"); $tpl->parse('download_action_link', 'download_action'); if ($uid > 1) { $tpl->set_var('edit_link', "{$_CONF['site_url']}/nexfile/download.php?op=editfile&fid={$fid}"); $tpl->parse('edit_action_link', 'editfile_action'); } else { $tpl->set_var('edit_action_link', ''); } $pos = strrpos($fname, '.') + 1; $ext = strtolower(substr($fname, $pos)); if (array_key_exists($ext, $_FMCONF['iconlib'])) { $icon = $_FMCONF['imagesurl'] . key($_FMCONF['iconlib'][$ext]); } else { $icon = $_FMCONF['imagesurl'] . key($_FMCONF['iconlib']['none']); } $tpl->set_var('extension_icon', $icon); if ($i == 1) { $tpl->parse('filelisting', 'filelisting_rec'); } else { $tpl->parse('filelisting', 'filelisting_rec', true); } $i++; } } else { $tpl->set_var('folder_desc_padding_left', $filedescriptionOffset); // Version 3.0 - not presently used $tpl->parse('filelisting', 'emptyfolder'); } $data['displayhtml'] = $tpl->finish($tpl->get_var('filelisting')); $data['tagcloud'] = $tagcloud->displaycloud(); }