Пример #1
0
 function testCoreImageBlockWithNoOverridesHasCorrectTemplates()
 {
     // Test a.
     $p = Page::getByID(1);
     $blocks = $p->getBlocks('Header');
     $b = $blocks[0];
     $bvt = new BlockViewTemplate($b);
     $this->assertEqual($bvt->getTemplate(), DIR_BASE_CORE . '/blocks/image/view.php', 'Test A');
     // Test b.
     $bt = BlockType::getByHandle('image');
     global $a, $ap, $c, $cp;
     if (is_object($bt)) {
         ob_start();
         $bv = new BlockView();
         $bv->render($bt, 'add', array('a' => $a, 'ap' => $ap, 'c' => $c, 'cp' => $cp));
         ob_end_clean();
     }
     $this->assertEqual($bv->getTemplate(), DIR_BASE_CORE . '/blocks/image/add.php', 'Test B');
 }
    ?>
	</div>
	<div class="ccm-pane-body ccm-pane-body-footer clearfix" id="ccm-stack-container">
	<?php 
    $a = Area::get($stack, 'Main');
    $bv = new BlockView();
    $bv->renderElement('block_area_header', array('a' => $a));
    $bv->renderElement('block_area_header_view', array('a' => $a));
    foreach ($blocks as $b) {
        $bv = new BlockView();
        $bv->setAreaObject($a);
        $p = new Permissions($b);
        if ($p->canViewBlock()) {
            $bv->renderElement('block_controls', array('a' => $a, 'b' => $b, 'p' => $p));
            $bv->renderElement('block_header', array('a' => $a, 'b' => $b, 'p' => $p));
            $bv->render($b);
            $bv->renderElement('block_footer');
        }
    }
    $bv->renderElement('block_area_footer_view', array('a' => $a));
    print '</div>';
    // instead  of loading block area footer view
    ?>
	
	</div>
	<?php 
    echo Loader::helper('concrete/dashboard')->getDashboardPaneFooterWrapper(false);
    ?>

<?php 
} else {
Пример #3
0
							</div>
							<div class="view">
								<a onclick="GlobalScrapbook.toggleRename(<?=intval($b->bID) ?>)" >
									<?=$bt->getBlockTypeName()?>: "<?=$b->getBlockName() ?>"
								</a>&nbsp;
							</div>
							<div class="edit">
								<form method="post" action="<?php echo $this->action('rename_block')?>">
									<?php $valt->output('rename_scrapbook_block')?>
									<input name="bID" type="hidden" value="<?=intval($b->bID) ?>" />
									<input name="scrapbookName" type="hidden" value="<?=$scrapbookName ?>" />
									<input name="bName" type="text" value="<?=$b->getBlockName() ?>" />
									<input name="Submit" type="submit" value="<?=t('Save')?>" />
									<input onclick="GlobalScrapbook.toggleRename(<?=intval($b->bID) ?>)" name="cancel" type="button" value="<?=t('Cancel')?>" />
									&nbsp;
								</form>
							</div>
						</div>
						<div class="ccm-scrapbook-list-item-detail">	
							<?= $bv->render($b, 'scrapbook'); ?>
						</div>
					</div>
				</div>
			<? } ?>	
			
		</div> 	
		
	
	</div>

<? } ?>
Пример #4
0
            ?>
" />
									<input onclick="GlobalScrapbook.toggleRename(<?php 
            echo intval($b->bID);
            ?>
)" name="cancel" type="button" value="<?php 
            echo t('Cancel');
            ?>
" />
									&nbsp;
								</form>
							</div>
						</div>
						<div class="ccm-scrapbook-list-item-detail">	
							<?php 
            echo $bv->render($b, 'scrapbook');
            ?>
						</div>
					</div>
				</div>
			<?php 
        }
    }
    ?>
	
			
		</div> 	
		
	
	</div><?php 
    echo Loader::helper('concrete/dashboard')->getDashboardPaneFooterWrapper(false);
Пример #5
0
 /**
  * displays the Area in the page
  * ex: $a = new Area('Main'); $a->display($c);
  * @param Page|Collection $c
  * @param Block[] $alternateBlockArray optional array of blocks to render instead of default behavior
  * @return void
  */
 function display(&$c, $alternateBlockArray = null)
 {
     if (!intval($c->cID)) {
         //Invalid Collection
         return false;
     }
     if ($this->arIsGlobal) {
         $stack = Stack::getByName($this->arHandle);
     }
     $currentPage = Page::getCurrentPage();
     $ourArea = self::getOrCreate($c, $this->arHandle, $this->arIsGlobal);
     if (count($this->customTemplateArray) > 0) {
         $ourArea->customTemplateArray = $this->customTemplateArray;
     }
     if (count($this->attributes) > 0) {
         $ourArea->attributes = $this->attributes;
     }
     if ($this->maximumBlocks > -1) {
         $ourArea->maximumBlocks = $this->maximumBlocks;
     }
     $ap = new Permissions($ourArea);
     if (!$ap->canViewArea()) {
         return false;
     }
     $blocksToDisplay = $alternateBlockArray ? $alternateBlockArray : $ourArea->getAreaBlocksArray($c, $ap);
     $this->totalBlocks = $ourArea->getTotalBlocksInArea();
     $u = new User();
     $bv = new BlockView();
     // now, we iterate through these block groups (which are actually arrays of block objects), and display them on the page
     if ($this->showControls && $c->isEditMode() && $ap->canViewAreaControls()) {
         $bv->renderElement('block_area_header', array('a' => $ourArea));
     }
     $bv->renderElement('block_area_header_view', array('a' => $ourArea));
     //display layouts tied to this area
     //Might need to move this to a better position
     $areaLayouts = $this->getAreaLayouts($c);
     if (is_array($areaLayouts) && count($areaLayouts)) {
         foreach ($areaLayouts as $layout) {
             $layout->display($c, $this);
         }
         if ($this->showControls && ($c->isArrangeMode() || $c->isEditMode())) {
             echo '<div class="ccm-layouts-block-arrange-placeholder ccm-block-arrange"></div>';
         }
     }
     $blockPositionInArea = 1;
     //for blockWrapper output
     foreach ($blocksToDisplay as $b) {
         $includeEditStrip = false;
         $bv = new BlockView();
         $bv->setAreaObject($ourArea);
         // this is useful for rendering areas from one page
         // onto the next and including interactive elements
         if ($currentPage->getCollectionID() != $c->getCollectionID()) {
             $b->setBlockActionCollectionID($c->getCollectionID());
         }
         if ($this->arIsGlobal && is_object($stack)) {
             $b->setBlockActionCollectionID($stack->getCollectionID());
         }
         $p = new Permissions($b);
         if ($c->isEditMode() && $this->showControls && $p->canViewEditInterface()) {
             $includeEditStrip = true;
         }
         if ($p->canViewBlock()) {
             if (!$c->isEditMode()) {
                 $this->outputBlockWrapper(true, $b, $blockPositionInArea);
             }
             if ($includeEditStrip) {
                 $bv->renderElement('block_controls', array('a' => $ourArea, 'b' => $b, 'p' => $p));
                 $bv->renderElement('block_header', array('a' => $ourArea, 'b' => $b, 'p' => $p));
             }
             $bv->render($b);
             if ($includeEditStrip) {
                 $bv->renderElement('block_footer');
             }
             if (!$c->isEditMode()) {
                 $this->outputBlockWrapper(false, $b, $blockPositionInArea);
             }
         }
         $blockPositionInArea++;
     }
     $bv->renderElement('block_area_footer_view', array('a' => $ourArea));
     if ($this->showControls && $c->isEditMode() && $ap->canViewAreaControls()) {
         $bv->renderElement('block_area_footer', array('a' => $ourArea));
     }
 }
Пример #6
0
                if ($_REQUEST['subtask'] == 'delete_custom_style_preset') {
                    $styleToDelete = CustomStylePreset::getByID($_REQUEST['deleteCspID']);
                    $styleToDelete->delete();
                }
                $refreshAction = REL_DIR_FILES_TOOLS_REQUIRED . '/edit_block_popup?btask=block_css&cID=' . $c->getCollectionID() . '&arHandle=' . $a->getAreaHandle() . '&bID=' . $b->getBlockID() . '&isGlobal=' . $_REQUEST['isGlobal'] . '&refresh=1';
                $bv->renderElement('custom_style', array('b' => $b, 'rcID' => $rcID, 'c' => $c, 'a' => $a, 'style' => $style, 'action' => $action, 'refreshAction' => $refreshAction));
            }
            break;
        case 'template':
            if ($bp->canWrite()) {
                $bv->renderElement('block_custom_template', array('b' => $b, 'rcID' => $rcID));
            }
            break;
        case 'view':
            if ($bp->canRead()) {
                $bv->render($b, 'view', array('c' => $c, 'a' => $a));
            }
            break;
        case 'view_edit_mode':
            if ($bp->canWrite() || $c->canWrite() && $b->isGlobalBlock() && $b->canRead()) {
                $btc = $b->getInstance();
                // now we inject any custom template CSS and JavaScript into the header
                if ('Controller' != get_class($btc)) {
                    $btc->outputAutoHeaderItems();
                }
                $btc->runTask('on_page_view', array($bv));
                $v = View::getInstance();
                $items = $v->getHeaderItems();
                if (count($items) > 0) {
                    ?>
				<script type="text/javascript">				
Пример #7
0
<?php

defined('C5_EXECUTE') or die("Access Denied.");
$bo = Block::getByID($bOriginalID);
$bp = new Permissions($bo);
$bo->setProxyBlock($b);
if ($bp->canWrite()) {
    $bv = new BlockView();
    ?>
	
		<div class="ccm-ui">
			<div class="alert alert-info"><?php 
    echo t("This block was copied from another location. Editing it will create a new instance of it.");
    ?>
</div>
		</div>
		
	<?php 
    $bv->render($bo, 'edit', array('c' => $c, 'a' => $a));
}
Пример #8
0
?>
&arHandle=<?php 
echo $a->getAreaHandle();
?>
&btask=alias_existing_block&<?php 
echo $token;
?>
', function(r) { ccm_parseBlockResponse(r, false, 'add'); })"><?php 
echo $bt->getBlockTypeName();
?>
</a>
					<div class="ccm-scrapbook-list-item-detail">	
						<?	
						try {
							$bv = new BlockView();
							$bv->render($item, 'scrapbook');
						} catch(Exception $e) {
							print BLOCK_NOT_AVAILABLE_TEXT;
						}	
						?>
					</div>
				</div>
			</div>	
			<?
			$i++;
		} else { ?>
		
		
			<div class="ccm-scrapbook-list-item" id="ccm-pc-<?php 
echo $obj->getPileContentID();
?>
Пример #9
0
 public function display($view = 'view', $args = array())
 {
     if ($this->getBlockTypeID() < 1) {
         return;
     }
     $bv = new BlockView();
     $bt = BlockType::getByID($this->getBlockTypeID());
     $bv->render($this, $view, $args);
 }
Пример #10
0
            echo $ak->render('composer', $value, true);
            ?>
				</div>
			</div>
		
		<?php 
        } else {
            $b = $ci;
            $b = $entry->getComposerBlockInstance($b);
            ?>
		
		<div class="control-group">
		<?php 
            if (is_object($b)) {
                $bv = new BlockView();
                $bv->render($b, 'composer');
            } else {
                print t('Block not found. Unable to edit in composer.');
            }
            ?>
		
		</div>
		
		<?php 
        }
        ?>
	<?php 
    }
    ?>
	</fieldset>
	
Пример #11
0
		/** 
		 * Renders a particular view of a block type, using the public $controller variable as the block type's controller
		 * @param string template 'view' for the default
		 * @return void
		 */
		public function render($view = 'view') {
			$bv = new BlockView();
			$bv->setController($this->controller);
			$bv->render($this, $view);
		}			
Пример #12
0
if (!is_object($a)) {
	exit;
}
$ap = new Permissions($a);
$canContinue = ($_REQUEST['btask'] == 'alias') ? $ap->canAddBlocks() : $ap->canAddBlock($bt);

if (!$canContinue) {
	exit;
}
	
$c->loadVersionObject('RECENT');
require_once(DIR_FILES_ELEMENTS_CORE . '/dialog_header.php');

if ($ap->canAddBlock($bt)) {
	$cnt = $bt->getController();
	if (!is_a($cnt, 'BlockController')) {
		$jsh = Loader::helper('concrete/interface');
		print '<div class="ccm-error">' . t('Unable to load the controller for this block type. Perhaps it has been moved or removed.') . '</div>';
		print '<br><br>';
		print $jsh->button_js(t('Close'), 'jQuery.fn.dialog.closeTop()', 'left');
	} else {
		$bv = new BlockView();
		$bv->render($bt, 'add', array(
			'a' => $a,
			'cp' => $cp,
			'ap' => $ap
		));
	}
}

require_once(DIR_FILES_ELEMENTS_CORE . '/dialog_footer.php'); ?>
Пример #13
0
<?
	defined('C5_EXECUTE') or die("Access Denied.");
?>
<div class="ccm-ui">
<?
$bo = Block::getByID($bOriginalID);
$bp = new Permissions($bo);
if ($bp->canWrite()) {
	$bv = new BlockView(); ?>
	
		<div class="alert-message block-message info" style="margin-bottom: 10px" ><p><?php 
echo t("This block was copied from another location. Editing it will create a new instance of it.");
?>
</p></div>

	<?
	
	$bv->render($bo, 'edit', array(
		'c' => $c,
		'a' => $a,
		'proxyBlock' => $b
	));
} else { ?>
	<div class="alert-message error"><?php 
echo t("You don't have access to edit the original instance of this block.");
?>
</div>
<? } ?>
</div>
Пример #14
0
         if ($_REQUEST['subtask'] == 'delete_custom_style_preset') {
             $styleToDelete = CustomStylePreset::getByID($_REQUEST['deleteCspID']);
             $styleToDelete->delete();
         }
         $refreshAction = REL_DIR_FILES_TOOLS_REQUIRED . '/edit_block_popup?btask=block_css&cID=' . $c->getCollectionID() . '&arHandle=' . $a->getAreaHandle() . '&bID=' . $b->getBlockID() . '&refresh=1';
         $bv->renderElement('custom_style', array('b' => $b, 'rcID' => $rcID, 'c' => $c, 'a' => $a, 'style' => $style, 'action' => $action, 'refreshAction' => $refreshAction));
     }
     break;
 case 'template':
     if ($bp->canEditBlockCustomTemplate()) {
         $bv->renderElement('block_custom_template', array('b' => $b, 'rcID' => $rcID));
     }
     break;
 case 'view':
     if ($bp->canViewBlock()) {
         $bv->render($b, 'view', array('c' => $c, 'a' => $a));
     }
     break;
 case 'view_edit_mode':
     if ($bp->canViewEditInterface()) {
         $btc = $b->getInstance();
         // now we inject any custom template CSS and JavaScript into the header
         if ('Controller' != get_class($btc)) {
             $btc->outputAutoHeaderItems();
         }
         $btc->runTask('on_page_view', array($bv));
         $v = View::getInstance();
         $items = $v->getHeaderItems();
         $csr = $b->getBlockCustomStyleRule();
         if (is_object($csr)) {
             $styleHeader = '#' . $csr->getCustomStyleRuleCSSID(1) . ' {' . $csr->getCustomStyleRuleText() . "}";