{local var="projectWarning"} <section> <header class="page-header"> <h1>{local var="actionHeader"} Object - {local var="formName"}</h1> {local var="parentHeader"} </header> <nav id="breadcrumbs"> <ul class="breadcrumb"> <li><a href="{local var="siteRoot"}">Home</a></li> <li><a href="{local var="siteRoot"}dataEntry/selectForm.php">Select a Form</a></li> <!-- FLoat Right --> <?php if (mfcsPerms::isAdmin($engine->cleanGet['MYSQL']['formID'])) { ?> <li class="pull-right noDivider"><a href="{local var="siteRoot"}formCreator/index.php?id={local var="formID"}">Edit Form</a></li> <?php } if (!isnull($engine->cleanGet['MYSQL']['objectID']) and $revisions->hasRevisions($engine->cleanGet['MYSQL']['objectID'])) { ?> <li class="pull-right noDivider"><a href="{local var="siteRoot"}dataEntry/revisions/index.php?objectID={local var="objectID"}">Revisions</a></li> <?php } ?> </ul> </nav> <div class="container-fluid"> <div class="span3">
$type = "zip"; try { $error = FALSE; if (!isset($engine->cleanGet['MYSQL']['objectID'])) { throw new Exception("No ObjectID Provided."); } // If we have an objectID and no formID, lookup the formID from the object and set it back into the GET if (isset($engine->cleanGet['MYSQL']['objectID']) and !isset($engine->cleanGet['MYSQL']['formID'])) { $object = objects::get($engine->cleanGet['MYSQL']['objectID']); http::setGet('formID', $object['formID']); } // Object ID Validation if (objects::validID(TRUE, $engine->cleanGet['MYSQL']['objectID']) === FALSE) { throw new Exception("ObjectID Provided is invalid."); } if (mfcsPerms::isViewer($engine->cleanGet['MYSQL']['formID']) === FALSE) { $permissions = FALSE; throw new Exception("Permission Denied to view objects created with this form."); } if (isset($engine->cleanGet['MYSQL']['type']) && $engine->cleanGet['MYSQL']['type'] == "tar") { $type = "tar"; } if (is_array($object['data']['digitalFiles'])) { $files = array(); foreach ($object['data']['digitalFiles']['files']['archive'] as $file) { $files[] = sprintf("%s", $file['name']); } $files = implode(" ", $files); $destinationFile = sys_get_temp_dir() . "/" . time() . "." . $type; if ($type == "zip") { $cmdLine = sprintf("zip -j %s %s", $destinationFile, $files);
<?php include "../../header.php"; // Setup revision control $revisions = revisions::create(); ############################################################################################################### try { if (!isset($engine->cleanGet['MYSQL']['objectID']) || !validate::integer($engine->cleanGet['MYSQL']['objectID'])) { throw new Exception('No Object ID Provided.'); } $objectID = $engine->cleanGet['MYSQL']['objectID']; $object = objects::get($objectID); $form = forms::get($object['formID']); $fields = $form['fields']; if (mfcsPerms::isEditor($form['ID']) === FALSE) { throw new Exception("Permission Denied to view objects created with this form."); } log::insert("Data Entry: Revision: View Page", $objectID); ############################################################################################################### // Catch a form submition (which would be a revision being reverted to) if (isset($engine->cleanPost['MYSQL']['revisionID'])) { log::insert("Data Entry: Revision: Revert", $objectID); // @TODO this should use revert2Revision() method instead of this ... $revisionID = $revisions->getRevisionID($engine->cleanGet['MYSQL']['objectID'], $engine->cleanPost['MYSQL']['revisionID']); if (($revision = $revisions->getMetadataForID($revisionID)) === FALSE) { throw new Exception('Could not load revision.'); } if (objects::update($engine->cleanGet['MYSQL']['objectID'], $revision['formID'], decodeFields($revision['data']), $revision['metadata'], $revision['parentID']) !== FALSE) { // Reload the object - To refresh the data $object = objects::get($objectID, TRUE); } else {
public static function generateFormSelectListForFormCreator($metadata = TRUE) { if ($metadata === TRUE) { if (($forms = forms::getMetadataForms()) === FALSE) { errorHandle::errorMsg("Error getting Metadata Forms"); return FALSE; } } else { if ($metadata === FALSE) { if (($forms = forms::getObjectForms()) === FALSE) { errorHandle::errorMsg("Error getting Object Forms"); return FALSE; } } } $formList = '<ul class="pickList">'; foreach ($forms as $form) { if (!mfcsPerms::isViewer($form['ID'])) { continue; } $formList .= sprintf('<li><a href="index.php?id=%s" class="btn">%s</a></li>', htmlSanitize($form['ID']), forms::title($form['ID'])); } $formList .= "<ul>"; return $formList; }
include "../header.php"; $permissions = TRUE; try { if (!isset($engine->cleanGet['MYSQL']['objectID']) && isset($engine->cleanPost['MYSQL']['objectID'])) { http::setGet("objectID", $engine->cleanPost['MYSQL']['objectID']); } if (objects::validID() === FALSE) { throw new Exception("ObjectID Provided is invalid."); } if (($object = objects::get($engine->cleanGet['MYSQL']['objectID'])) === FALSE) { throw new Exception("Error retrieving Object"); } if (($form = forms::get($object['formID'])) === FALSE) { throw new Exception("Error retrieving form."); } if (mfcsPerms::isAdmin($object['formID']) === FALSE) { $permissions = FALSE; throw new Exception("Permission Denied to view objects created with this form."); } if (forms::isMetadataForm($object['formID']) === FALSE) { throw new Exception("Object provided (Only Metadata can be moved)."); } // handle submission $return = NULL; if (isset($engine->cleanPost['MYSQL']['moveMetadata'])) { } if (($compatibleForms = forms::compatibleForms($form['ID'])) === FALSE) { throw new Exception("Error getting compatible forms"); } $temp = '<option value="NULL">-- Select an Item --</option>'; foreach ($compatibleForms as $cform) {
} if (isset($engine->cleanPost['MYSQL']['submitPermissions'])) { try { // trans: begin transaction $engine->openDB->transBegin(); // update permissions if (mfcsPerms::delete($formID) === FALSE) { throw new Exception("MySQL Error - Wipe Permissions ({$sqlResult['error']} -- {$sql})"); } $tmp = array("selectedViewUsers" => mfcs::AUTH_VIEW, "selectedEntryUsers" => mfcs::AUTH_ENTRY, "selectedUsersAdmins" => mfcs::AUTH_ADMIN); foreach ($tmp as $I => $K) { if (!isset($engine->cleanPost['MYSQL'][$I]) || !is_array($engine->cleanPost['MYSQL'][$I])) { continue; } foreach ($engine->cleanPost['MYSQL'][$I] as $userID) { if (mfcsPerms::add($userID, $formID, $K) === FALSE) { throw new Exception("Error adding Permissions"); } } } // If we get here then the permissions successfully updated! $engine->openDB->transCommit(); $engine->openDB->transEnd(); errorHandle::successMsg("Successfully updated Permissions"); } catch (Exception $e) { errorHandle::newError("{$e->getFile()}:{$e->getLine()} {$e->getMessage()}", errorHandle::DEBUG); errorHandle::errorMsg("Error Updating Project"); $engine->openDB->transRollback(); $engine->openDB->transEnd(); } }