cancelLabel: 'No', closable: 'true', buttonClass: 'btn', ok: function(win) { window.location = '<?php echo COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL; ?> ?section=move-file&id='+id+'&share_id='+$F('share_id'); return true; } } ); } <?php } if (shares_file_module_access($RECORD_ID, "delete-revision")) { ?> function revisionDelete(id) { Dialog.confirm('Do you really wish to deactivate the '+ $('file-version-' + id + '-title').innerHTML +' revision?<br /><br />If you confirm this action, you will no longer be able to download this version of the file.', { id: 'requestDialog', width: 350, height: 125, title: 'Delete Confirmation', className: 'medtech', okLabel: 'Yes', cancelLabel: 'No', closable: 'true', buttonClass: 'btn', ok: function(win) {
if (!defined("COMMUNITY_INCLUDED") || !defined("IN_SHARES")) { exit; } elseif (!$COMMUNITY_LOAD) { exit; } $HEAD[] = "<link href=\"" . ENTRADA_URL . "/javascript/calendar/css/xc2_default.css?release=" . html_encode(APPLICATION_VERSION) . "\" rel=\"stylesheet\" type=\"text/css\" media=\"all\" />"; $HEAD[] = "<script type=\"text/javascript\" src=\"" . ENTRADA_URL . "/javascript/calendar/config/xc2_default.js?release=" . html_encode(APPLICATION_VERSION) . "\"></script>"; $HEAD[] = "<script type=\"text/javascript\" src=\"" . ENTRADA_URL . "/javascript/calendar/script/xc2_inpage.js?release=" . html_encode(APPLICATION_VERSION) . "\"></script>"; $HEAD[] = "<script type=\"text/javascript\" src=\"" . COMMUNITY_URL . "/javascript/shares.js?release=" . html_encode(APPLICATION_VERSION) . "\"></script>"; echo "<h1>Edit File</h1>\n"; if ($RECORD_ID) { $query = "\n\t\t\t\t\tSELECT a.*, b.`folder_title`, b.`admin_notifications`\n\t\t\t\t\tFROM `community_share_files` AS a\n\t\t\t\t\tLEFT JOIN `community_shares` AS b\n\t\t\t\t\tON a.`cshare_id` = b.`cshare_id`\n\t\t\t\t\tWHERE a.`community_id` = " . $db->qstr($COMMUNITY_ID) . "\n\t\t\t\t\tAND a.`csfile_id` = " . $db->qstr($RECORD_ID) . "\n\t\t\t\t\tAND b.`cpage_id` = " . $db->qstr($PAGE_ID) . "\n\t\t\t\t\tAND a.`file_active` = '1'\n\t\t\t\t\tAND b.`folder_active` = '1'"; $file_record = $db->GetRow($query); if ($file_record) { if ((int) $file_record["file_active"]) { if (shares_file_module_access($RECORD_ID, "edit-file")) { $BREADCRUMB[] = array("url" => COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=view-folder&id=" . $file_record["cshare_id"], "title" => limit_chars($file_record["folder_title"], 32)); $BREADCRUMB[] = array("url" => COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=view-file&id=" . $RECORD_ID, "title" => limit_chars($file_record["file_title"], 32)); $BREADCRUMB[] = array("url" => COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=edit-file&id=" . $RECORD_ID, "title" => "Edit File"); // Error Checking switch ($STEP) { case 2: /** * Required field "title" / File Title. */ if (isset($_POST["file_title"]) && ($title = clean_input($_POST["file_title"], array("notags", "trim")))) { $PROCESSED["file_title"] = $title; } elseif (isset($PROCESSED["file_filename"]) && $PROCESSED["file_filename"]) { $PROCESSED["file_title"] = $PROCESSED["file_filename"]; } else { $ERROR++;
* @copyright Copyright 2010 Queen's University. All Rights Reserved. * */ if (!defined("COMMUNITY_INCLUDED") || !defined("IN_SHARES")) { exit; } elseif (!$COMMUNITY_LOAD) { exit; } $HEAD[] = "<script type=\"text/javascript\" src=\"" . COMMUNITY_URL . "/javascript/shares.js?release=" . html_encode(APPLICATION_VERSION) . "\"></script>"; echo "<h1>Upload Revised File</h1>\n"; if ($RECORD_ID) { $query = "\n\t\t\t\t\tSELECT a.*, b.`folder_title`, b.`allow_member_read`, \n\t\t\t\t\tb.`allow_troll_read`, b.`allow_member_upload`, b.`allow_troll_upload`\n\t\t\t\t\tFROM `community_share_files` AS a\n\t\t\t\t\tLEFT JOIN `community_shares` AS b\n\t\t\t\t\tON a.`cshare_id` = b.`cshare_id`\n\t\t\t\t\tWHERE a.`community_id` = " . $db->qstr($COMMUNITY_ID) . "\n\t\t\t\t\tAND b.`cpage_id` = " . $db->qstr($PAGE_ID) . "\n\t\t\t\t\tAND a.`csfile_id` = " . $db->qstr($RECORD_ID) . "\n\t\t\t\t\tAND a.`file_active` = '1'\n\t\t\t\t\tAND b.`folder_active` = '1'"; $file_record = $db->GetRow($query); if ($file_record) { if ((int) $file_record["file_active"]) { if (shares_file_module_access($RECORD_ID, "add-revision")) { $BREADCRUMB[] = array("url" => COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=view-folder&id=" . $file_record["cshare_id"], "title" => limit_chars($file_record["folder_title"], 25)); $BREADCRUMB[] = array("url" => COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=view-file&id=" . $RECORD_ID, "title" => limit_chars($file_record["file_title"], 25)); $BREADCRUMB[] = array("url" => COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=add-revision&id=" . $RECORD_ID, "title" => "Upload Revised File"); // Error Checking switch ($STEP) { case 2: if (isset($_FILES["uploaded_file"])) { switch ($_FILES["uploaded_file"]["error"]) { case 0: if (($file_filesize = (int) trim($_FILES["uploaded_file"]["size"])) <= $VALID_MAX_FILESIZE) { $query = "\n\t\t\t\t\t\t\t\t\t\t\t\tSELECT `file_version`\n\t\t\t\t\t\t\t\t\t\t\t\tFROM `community_share_file_versions`\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE `csfile_id` = " . $db->qstr($RECORD_ID) . "\n\t\t\t\t\t\t\t\t\t\t\t\tAND `cshare_id` = " . $db->qstr($file_record["cshare_id"]) . "\n\t\t\t\t\t\t\t\t\t\t\t\tAND `community_id` = " . $db->qstr($COMMUNITY_ID) . "\n\t\t\t\t\t\t\t\t\t\t\t\tAND `file_active` = '1'\n\t\t\t\t\t\t\t\t\t\t\t\tORDER BY `file_version` DESC\n\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 0, 1"; $result = $db->GetRow($query); if ($result) { $PROCESSED["file_version"] = $result["file_version"] + 1; } else {
* @author Unit: School of Medicine * @author Developer: Brandon Thorn <*****@*****.**> * @copyright Copyright 2012 Queen's University. All Rights Reserved. * */ if (!defined("COMMUNITY_INCLUDED") || !defined("IN_SHARES")) { exit; } elseif (!$COMMUNITY_LOAD) { exit; } if ($RECORD_ID) { $query = "\n\t\t\t\t\tSELECT a.*, b.`file_title`, b.`file_active` AS `parent_file_active`\n\t\t\t\t\tFROM `community_share_file_versions` AS a\n\t\t\t\t\tLEFT JOIN `community_share_files` AS b\n\t\t\t\t\tON a.`csfile_id` = b.`csfile_id`\n\t\t\t\t\tLEFT JOIN `community_shares` AS c\n\t\t\t\t\tON a.`cshare_id` = c.`cshare_id`\n\t\t\t\t\tWHERE a.`csfversion_id` = " . $db->qstr($RECORD_ID) . "\n\t\t\t\t\tAND c.`cpage_id` = " . $db->qstr($PAGE_ID) . "\n\t\t\t\t\tAND a.`community_id` = " . $db->qstr($COMMUNITY_ID); $file_record = $db->GetRow($query); if ($file_record) { if ((int) $file_record["file_active"] && (int) $file_record["parent_file_active"]) { if (shares_file_module_access($file_record["csfile_id"], "delete-revision")) { if ($db->AutoExecute("community_share_file_versions", array("file_active" => 0, "updated_date" => time(), "updated_by" => $ENTRADA_USER->getID()), "UPDATE", "`csfversion_id` = " . $db->qstr($RECORD_ID) . " AND `csfile_id` = " . $db->qstr($file_record["csfile_id"]) . " AND `cshare_id` = " . $db->qstr($file_record["cshare_id"]) . " AND `community_id` = " . $db->qstr($COMMUNITY_ID))) { add_statistic("community:" . $COMMUNITY_ID . ":shares", "revision_delete", "csfversion_id", $RECORD_ID); communities_deactivate_history($COMMUNITY_ID, $PAGE_ID, $RECORD_ID); } else { application_log("error", "Failed to deactivate [" . $RECORD_ID . "] file version from community. Database said: " . $db->ErrorMsg()); } } } else { application_log("error", "The provided file revision id [" . $RECORD_ID . "] is already deactivated."); } header("Location: " . COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=view-file&id=" . $file_record["csfile_id"]); exit; } else { application_log("error", "The provided file revision id [" . $RECORD_ID . "] was invalid."); }
*/ if (!defined("COMMUNITY_INCLUDED") || !defined("IN_SHARES")) { exit; } elseif (!$COMMUNITY_LOAD) { exit; } if ($RECORD_ID) { if (isset($_GET["share_id"]) && ($share_id = (int) $_GET["share_id"])) { $query = "\tSELECT a.*\n\t\t\t\t\t\t\tFROM `community_share_files` AS a\n\t\t\t\t\t\t\tLEFT JOIN `community_shares` AS b\n\t\t\t\t\t\t\tON a.`cshare_id` = b.`cshare_id`\n\t\t\t\t\t\t\tWHERE a.`csfile_id` = " . $db->qstr($RECORD_ID) . "\n\t\t\t\t\t\t\tAND a.`community_id` = " . $db->qstr($COMMUNITY_ID) . "\n\t\t\t\t\t\t\tAND a.`cshare_id` != " . $db->qstr($share_id) . "\n\t\t\t\t\t\t\tAND b.`cpage_id` = " . $db->qstr($PAGE_ID) . "\n\t\t\t\t\t\t\tAND b.`folder_active` = '1'"; $file_record = $db->GetRow($query); if ($file_record) { $query = "\tSELECT b.`page_url`\n\t\t\t\t\t\t\t\tFROM `community_shares` AS a\n\t\t\t\t\t\t\t\tLEFT JOIN `community_pages` AS b\n\t\t\t\t\t\t\t\tON b.`cpage_id` = a.`cpage_id`\n\t\t\t\t\t\t\t\tWHERE a.`cshare_id` = " . $db->qstr($share_id) . "\n\t\t\t\t\t\t\t\tAND a.`community_id` = " . $db->qstr($COMMUNITY_ID) . "\n\t\t\t\t\t\t\t\tAND a.`folder_active` = '1'"; $share_record = $db->GetRow($query); if ($share_record) { if ((int) $file_record["file_active"]) { if (shares_file_module_access($RECORD_ID, "move-file")) { if ($db->AutoExecute("community_share_files", array("cshare_id" => $share_id, "updated_date" => time(), "updated_by" => $ENTRADA_USER->getID()), "UPDATE", "`csfile_id` = " . $db->qstr($RECORD_ID) . " AND `cshare_id` = " . $db->qstr($file_record["cshare_id"]) . " AND `community_id` = " . $db->qstr($COMMUNITY_ID))) { @$db->AutoExecute("community_share_file_versions", array("cshare_id" => $share_id, "updated_date" => time(), "updated_by" => $ENTRADA_USER->getID()), "UPDATE", "`csfile_id` = " . $db->qstr($RECORD_ID) . " AND `cshare_id` = " . $db->qstr($file_record["cshare_id"]) . " AND `community_id` = " . $db->qstr($COMMUNITY_ID)); @$db->AutoExecute("community_share_comments", array("cshare_id" => $share_id, "updated_date" => time(), "updated_by" => $ENTRADA_USER->getID()), "UPDATE", "`csfile_id` = " . $db->qstr($RECORD_ID) . " AND `cshare_id` = " . $db->qstr($file_record["cshare_id"]) . " AND `community_id` = " . $db->qstr($COMMUNITY_ID)); communities_log_history($COMMUNITY_ID, $PAGE_ID, $RECORD_ID, "community_history_move_file", true, $share_id); add_statistic("community:" . $COMMUNITY_ID . ":shares", "file_move", "csfile_id", $RECORD_ID); $db->AutoExecute("community_history", array("history_display" => 0), "UPDATE", "`community_id` = " . $db->qstr($COMMUNITY_ID) . " AND `module_id` = " . $db->qstr($MODULE_ID) . " AND `record_id` = " . $db->qstr($RECORD_ID)); } else { application_log("error", "Failed to move [" . $RECORD_ID . "] file to folder. Database said: " . $db->ErrorMsg()); } } } else { application_log("error", "The provided file id [" . $RECORD_ID . "] is deactivated."); } header("Location: " . COMMUNITY_URL . $COMMUNITY_URL . ":" . $share_record["page_url"] . "?section=view-folder&id=" . $share_id); exit;
$params = array("action" => "file_download", "action_field" => "csfile_id", "action_value" => $result["csfile_id"], "module" => "community:" . $COMMUNITY_ID . ":shares"); $statistics = Models_Statistic::getCountByParams($params); if ($result["release_date"] && $result["release_date"] > time() || $result["release_until"] && $result["release_until"] < time()) { $accessible = false; } echo "<tr" . (!$accessible ? " class=\"na\"" : "") . ">\n"; echo " <td style=\"vertical-align: top\">"; echo "\t\t<a href=\"" . COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=view-file&id=" . $result["csfile_id"] . "&download=latest\"><img src=\"" . ENTRADA_URL . "/community/templates/default/images/btn_save.gif\" alt=\"Download File\" title=\"Download File\"width=\"15\" border=\"0\" /></a>"; echo "\t</td>"; echo "\t<td style=\"vertical-align: top\">\n"; echo "\t\t<img src=\"" . ENTRADA_URL . "/serve-icon.php?ext=" . $ext . "\" width=\"16\" height=\"16\" alt=\"" . strtoupper($ext) . " Document\" title=\"" . strtoupper($ext) . " Document\" style=\"vertical-align: middle; margin-right: 4px\" /> <a id=\"file-" . (int) $result["csfile_id"] . "-title\" href=\"" . COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=view-file&id=" . $result["csfile_id"] . "\" style=\"font-weight: bold; vertical-align: middle\">" . limit_chars(html_encode($result["file_title"]), 50, true) . "</a>\n"; echo "\t\t<div class=\"content-small\" style=\"padding-left: 23px\">"; echo shares_file_module_access($result["csfile_id"], "edit-file") ? " <span style=\"vertical-align: middle\">(<a class=\"action\" href=\"" . COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=edit-file&id=" . $result["csfile_id"] . "\">edit</a>)</span>" : ""; echo shares_file_module_access($result["csfile_id"], "delete-file") ? " <span style=\"vertical-align: middle\">(<a class=\"action\" href=\"javascript:fileDelete('" . $result["csfile_id"] . "')\">delete</a>)</span>" : ""; if ($community_shares_select != "") { echo shares_file_module_access($result["csfile_id"], "move-file") ? " <span style=\"vertical-align: middle\">(<a class=\"action\" href=\"javascript:fileMove('" . $result["csfile_id"] . "')\">move</a>)</span>" : ""; } echo "\t\t<span style=\"vertical-align: middle\">" . html_encode(limit_chars($result["file_description"], 125)) . "</span>"; echo "\t\t</div>\n"; echo "\t</td>\n"; echo "\t<td style=\"font-size: 10px; white-space: nowrap; overflow: hidden\"><a href=\"" . ENTRADA_URL . "/people?profile=" . html_encode($result["owner_username"]) . "\" style=\"font-size: 10px\">" . html_encode($result["owner"]) . "</a></td>\n"; echo "\t<td style=\"font-size: 10px; white-space: nowrap; overflow: hidden\">" . date(DEFAULT_DATE_FORMAT, $result["updated_date"]) . "</td>\n"; if ($COMMUNITY_ADMIN) { echo "\t<td class=\"accesses\" style=\"text-align: center\"><a class=\"views-dialog\" href=\"#file-views\" data-action='" . $params['action'] . "' data-action_field='" . $params['action_field'] . "' data-action_value='" . $params['action_value'] . "' title=\"Click to see access log " . html_encode($statistics['views']) . "\" style=\"font-weight: bold\">" . html_encode($statistics['views']) . "</a></td>\n"; } echo "</tr>\n"; } ?> </tbody> </table> <script type="text/javascript">
* @author Unit: School of Medicine * @author Developer: Brandon Thorn <*****@*****.**> * @copyright Copyright 2012 Queen's University. All Rights Reserved. * */ if (!defined("COMMUNITY_INCLUDED") || !defined("IN_SHARES")) { exit; } elseif (!$COMMUNITY_LOAD) { exit; } if ($RECORD_ID) { $query = "\n\t\t\t\t\tSELECT a.*\n\t\t\t\t\tFROM `community_share_files` AS a\n\t\t\t\t\tLEFT JOIN `community_shares` AS b\n\t\t\t\t\tON a.`cshare_id` = b.`cshare_id`\n\t\t\t\t\tWHERE a.`csfile_id` = " . $db->qstr($RECORD_ID) . "\n\t\t\t\t\tAND b.`cpage_id` = " . $db->qstr($PAGE_ID) . "\n\t\t\t\t\tAND a.`community_id` = " . $db->qstr($COMMUNITY_ID); $file_record = $db->GetRow($query); if ($file_record) { if ((int) $file_record["file_active"]) { if (shares_file_module_access($RECORD_ID, "delete-file")) { if ($db->AutoExecute("community_share_files", array("file_active" => 0, "updated_date" => time(), "updated_by" => $ENTRADA_USER->getID()), "UPDATE", "`csfile_id` = " . $db->qstr($RECORD_ID) . " AND `cshare_id` = " . $db->qstr($file_record["cshare_id"]) . " AND `community_id` = " . $db->qstr($COMMUNITY_ID))) { @$db->AutoExecute("community_share_file_versions", array("file_active" => 0, "updated_date" => time(), "updated_by" => $ENTRADA_USER->getID()), "UPDATE", "`csfile_id` = " . $db->qstr($RECORD_ID) . " AND `cshare_id` = " . $db->qstr($file_record["cshare_id"]) . " AND `community_id` = " . $db->qstr($COMMUNITY_ID)); @$db->AutoExecute("community_share_comments", array("comment_active" => 0, "updated_date" => time(), "updated_by" => $ENTRADA_USER->getID()), "UPDATE", "`csfile_id` = " . $db->qstr($RECORD_ID) . " AND `cshare_id` = " . $db->qstr($file_record["cshare_id"]) . " AND `community_id` = " . $db->qstr($COMMUNITY_ID)); communities_deactivate_history($COMMUNITY_ID, $PAGE_ID, $RECORD_ID); add_statistic("community:" . $COMMUNITY_ID . ":shares", "file_delete", "csfile_id", $RECORD_ID); $db->AutoExecute("community_history", array("history_display" => 0), "UPDATE", "`community_id` = " . $db->qstr($COMMUNITY_ID) . " AND `module_id` = " . $db->qstr($MODULE_ID) . " AND `record_id` = " . $db->qstr($RECORD_ID)); } else { application_log("error", "Failed to deactivate [" . $RECORD_ID . "] file from community. Database said: " . $db->ErrorMsg()); } } } else { application_log("error", "The provided file id [" . $RECORD_ID . "] is already deactivated."); } header("Location: " . COMMUNITY_URL . $COMMUNITY_URL . ":" . $PAGE_URL . "?section=view-folder&id=" . $file_record["cshare_id"]); exit;