Exemplo n.º 1
0
        $cpc = new Permissions($stackToEdit);
        $showApprovalButton = false;
        $hasPendingPageApproval = false;
        $workflowList = PageWorkflowProgress::getList($stackToEdit);
        foreach ($workflowList as $wl) {
            $wr = $wl->getWorkflowRequestObject();
            $wrk = $wr->getWorkflowRequestPermissionKeyObject();
            if ($wrk->getPermissionKeyHandle() == 'approve_page_versions') {
                $hasPendingPageApproval = true;
                break;
            }
        }
        if (!$hasPendingPageApproval) {
            $vo = $stackToEdit->getVersionObject();
            $composer = Core::make('helper/concrete/composer');
            if ($cpc->canApprovePageVersions()) {
                $publishTitle = $composer->getPublishButtonTitle($stackToEdit);
                $showApprovalButton = true;
            }
        }
        $deleteLabels = null;
        ?>
        <nav class="navbar navbar-default">
            <div class="container-fluid">
                <ul class="nav navbar-nav">
                    <li class="dropdown">
                        <a class="dropdown-toggle" data-toggle="dropdown" href="#"><?php 
        echo t('Add Block');
        ?>
</a>
                        <ul class="dropdown-menu">
<?php

defined('C5_EXECUTE') or die("Access Denied.");
if (!Loader::helper('validation/numbers')->integer($_GET['cID'])) {
    die(t('Access Denied'));
}
$valt = Loader::helper('validation/token');
$fh = Loader::helper('file');
$token = '&' . $valt->getParameter();
$c = Page::getByID($_REQUEST['cID']);
$cID = $c->getCollectionID();
$cp = new Permissions($c);
$u = new User();
$isCheckedOut = $c->isCheckedOut() && !$c->isEditMode();
if (!$cp->canViewPageVersions() && !$cp->canApprovePageVersions()) {
    die(t("Access Denied."));
}
if ($_GET['vtask'] == 'view_versions') {
    ?>
		
		<div class="ccm-ui">
		
		<?php 
    $ih = Loader::helper('concrete/interface');
    $display = 'block';
    $i = 0;
    if (count($_REQUEST['cvID']) > 0) {
        $tabs = array();
        foreach ($_REQUEST['cvID'] as $cvID) {
            $tabs[] = array('view-version-' . $cvID, t('Version %s', $cvID), $i == 0);
            $i++;
Exemplo n.º 3
0
?>
?cID=<?php 
echo $c->getCollectionID();
?>
&ctask=check-in">';
<? $valt = Loader::helper('validation/token'); ?>
menuHTML += '<?php 
echo $valt->output('', true);
?>
';
menuHTML += '<h4><?php 
echo t('Version Comments');
?>
</h4>';
menuHTML += '<p><input type="text" name="comments" id="ccm-check-in-comments" style="width:520px" maxlength="255" /></p>';
<? if ($cp->canApprovePageVersions()) { ?>
	<? 
	$publishTitle = t('Publish My Edits');
	$pk = PermissionKey::getByHandle('approve_page_versions');
	$pk->setPermissionObject($c);
	$pa = $pk->getPermissionAccessObject();
	if (is_object($pa) && count($pa->getWorkflows()) > 0) {
		$publishTitle = t('Submit to Workflow');
	}
?>
menuHTML += '<a href="javascript:void(0)" id="ccm-check-in-publish" class="btn primary" style="float: right"><span><?php 
echo $publishTitle;
?>
</span></a>';
<? } ?>
menuHTML += '<a href="javascript:void(0)" id="ccm-check-in-preview" class="btn" style="float: right"><span><?php 
Exemplo n.º 4
0
 function approve($doReindexImmediately = true)
 {
     $db = Loader::db();
     $u = new User();
     $uID = $u->getUserID();
     $cvID = $this->cvID;
     $cID = $this->cID;
     $c = Page::getByID($cID, $this->cvID);
     $ov = Page::getByID($cID, 'ACTIVE');
     $oldHandle = $ov->getCollectionHandle();
     $newHandle = $this->cvHandle;
     // update a collection updated record
     $dh = Loader::helper('date');
     $db->query('update Collections set cDateModified = ? where cID = ?', array($dh->getLocalDateTime(), $cID));
     // first we remove approval for the other version of this collection
     $v = array($cID);
     $q = "update CollectionVersions set cvIsApproved = 0 where cID = ?";
     $r = $db->query($q, $v);
     $ov->refreshCache();
     // now we approve our version
     $v2 = array($uID, $cID, $cvID);
     $q2 = "update CollectionVersions set cvIsNew = 0, cvIsApproved = 1, cvApproverUID = ? where cID = ? and cvID = ?";
     $r = $db->query($q2, $v2);
     // next, we rescan our collection paths for the particular collection, but only if this isn't a generated collection
     // I don't know why but this just isn't reliable. It might be a race condition with the cached page objects?
     /*
     if ((($oldHandle != $newHandle) || $oldHandle == '') && (!$c->isGeneratedCollection())) {
     */
     $c->rescanCollectionPath();
     //}
     // check for related version edits. This only gets applied when we edit global areas.
     $r = $db->Execute('select cRelationID, cvRelationID from CollectionVersionRelatedEdits where cID = ? and cvID = ?', array($cID, $cvID));
     while ($row = $r->FetchRow()) {
         $cn = Page::getByID($row['cRelationID'], $row['cvRelationID']);
         $cnp = new Permissions($cn);
         if ($cnp->canApprovePageVersions()) {
             $v = $cn->getVersionObject();
             $v->approve();
             $r = $db->Execute('delete from CollectionVersionRelatedEdits where cID = ? and cvID = ? and cRelationID = ? and cvRelationID = ?', array($cID, $cvID, $row['cRelationID'], $row['cvRelationID']));
         }
     }
     if ($c->getCollectionInheritance() == 'TEMPLATE') {
         // we make sure to update the cInheritPermissionsFromCID value
         $ct = CollectionType::getByID($c->getCollectionTypeID());
         $masterC = $ct->getMasterTemplate();
         $db->Execute('update Pages set cInheritPermissionsFromCID = ? where cID = ?', array($masterC->getCollectionID(), $c->getCollectioniD()));
     }
     Events::fire('on_page_version_approve', $c);
     $c->reindex(false, $doReindexImmediately);
     $this->refreshCache();
 }
            $valt = Loader::helper('validation/token');
            ?>
menuHTML += '<?php 
            echo $valt->output('', true);
            ?>
';
menuHTML += '<h4><?php 
            echo t('Version Comments');
            ?>
</h4>';
menuHTML += '<p><input type="text" name="comments" id="ccm-check-in-comments" value="<?php 
            echo addslashes($c->getNextVersionComments());
            ?>
" onclick="this.select()" style="width:520px"/></p>';
<?php 
            if ($cp->canApprovePageVersions()) {
                ?>
	<?php 
                $publishTitle = t('Publish My Edits');
                $pk = PermissionKey::getByHandle('approve_page_versions');
                $pk->setPermissionObject($c);
                $pa = $pk->getPermissionAccessObject();
                if (is_object($pa) && count($pa->getWorkflows()) > 0) {
                    $publishTitle = t('Submit to Workflow');
                }
                ?>
menuHTML += '<a href="javascript:void(0)" id="ccm-check-in-publish" class="btn primary" style="float: right"><span><?php 
                echo $publishTitle;
                ?>
</span></a>';
<?php