/** * @requiresRight id WRITE */ public function commitResource() { $resource = new \core_kernel_classes_Resource($this->getRequestParameter('id')); // prevent escaping on input $message = isset($_POST['message']) ? $_POST['message'] : ''; $revision = RevisionService::commit($resource, $message); $this->returnJson(array('success' => true, 'id' => $revision->getVersion(), 'modified' => \tao_helpers_Date::displayeDate($revision->getDateCreated()), 'author' => UserHelper::renderHtmlUser($revision->getAuthorId()), 'message' => $revision->getMessage(), 'commitMessage' => __('%s has been committed', $resource->getLabel()))); }
/** * actions that get prevented by a lock are forwareded to this action * parameter view is currently ignored */ public function locked() { $resource = new core_kernel_classes_Resource($this->getRequestParameter('id')); $lockData = LockManager::getImplementation()->getLockData($resource); $this->setData('topclass-label', $this->hasRequestParameter('topclass-label') ? $this->getRequestParameter('topclass-label') : __('Resource')); if (AclProxy::hasAccess(common_session_SessionManager::getSession()->getUser(), __CLASS__, 'forceRelease', array('uri' => $resource->getUri()))) { $this->setData('id', $resource->getUri()); $this->setData('forceRelease', true); } $this->setData('lockDate', $lockData->getCreationTime()); $this->setData('ownerHtml', UserHelper::renderHtmlUser($lockData->getOwnerId())); if ($this->hasRequestParameter('view') && $this->hasRequestParameter('ext')) { $this->setView($this->getRequestParameter('view'), $this->getRequestParameter('ext')); } else { $this->setView('Lock/locked.tpl', 'tao'); } }