Commits

Christoffer Niska committed 6ffaba6 Merge

merged heads

  • Participants
  • Parent commits 000d4a7, 65c9c44

Comments (0)

Files changed (25)

File CmsModule.php

File contents unchanged.

File assets/css/cms.css

File contents unchanged.

File components/Cms.php

 	 */
 	public $renderer = array('class'=>'cms.components.CmsBaseRenderer');
 	/**
+	// todo: do something about the flash message categories, an array maybe instead of 4 properties?
+	 */
+	public $renderer = array('class'=>'cms.components.CmsBaseRenderer');
+	/**
 	 * @var boolean indicates whether to auto create nodes when they are requested.
 	 * Defaults to true.
 	 */
     {
         parent::init();
 
-		$this->flashes = CMap::mergeArray($this->_flashCategories, $this->flashes);
+	$this->flashes = CMap::mergeArray($this->_flashCategories, $this->flashes);
 
-		// Create the renderer.
-		$this->renderer = Yii::createComponent($this->renderer);
+	// Create the renderer.
+	$this->renderer = Yii::createComponent($this->renderer);
 
-		// Register the assets.
-		$assetsUrl = $this->getAssetsUrl();
+	// Register the assets.
+	$assetsUrl = $this->getAssetsUrl();
         Yii::app()->clientScript->registerCssFile($assetsUrl.'/css/cms.css');
         Yii::app()->clientScript->registerScriptFile($assetsUrl.'/js/es5-shim.js');
     }
 	public function loadNode($name)
 	{
 		$node = CmsNode::model()->findByAttributes(array('name'=>$name));
-
-		if ($node === null)
-		{
-			$this->createNode($name);
-			$node = $this->loadNode($name);
-		}
-
 		return $node;
 	}
 
 	}
 
 	/**
+	 * Returns whether a child node of a specific page is active.
+	 * @param CmsNode $node the node
+	 * @return boolean the result
+	 */
+	protected function isChildActive($node)
+	{
+		foreach ($node->children as $child)
+			if ($this->isActive($child->name) || $this->isChildActive($child))
+				return true;
+
+		return false;
+	}
+	
+	/**
 	 * Returns whether the currently logged in user has access to update cms content.
 	 * Override this method to implement your own access control.
 	 * @return boolean

File components/CmsBaseRenderer.php

File contents unchanged.

File controllers/AdminController.php

File contents unchanged.

File controllers/NodeController.php

File contents unchanged.

File data/schema.sql

File contents unchanged.

File models/CmsContent.php

File contents unchanged.

File models/CmsLink.php

File contents unchanged.

File models/CmsNode.php

 
 		if ($this->parent !== null)
 			$breadcrumbs = $this->parent->getBreadcrumbs(true); // get the parent as a link
+		else
+		{
+			// Do not include the module breadcrumbs for pages.
+			if (Yii::app()->controller->route !== 'cms/node/page')
+			{
+				$breadcrumbs[Yii::t('CmsModule.core','Cms')] = array('admin/index');
+				$breadcrumbs[Yii::t('CmsModule.core','Nodes')] = array('node/index');
+			}
+		}
 
 		if ($this->content !== null && !empty($this->content->breadcrumb))
 			$text = $this->content->breadcrumb;
 	{
 		return (bool) $this->published;
 	}
+
+	/**
+	 * Renders this node.
+	 * @return string the rendered node
+	 */
+	public function render()
+	{
+		return Yii::app()->cms->renderer->render($this);
+	}
+
+	/**
+	 * Renders this node as a widget.
+	 * @return string the rendered widget
+	 */
+	public function renderWidget()
+	{
+		return Yii::app()->cms->renderer->renderWidget($this);
+	}
+
+	public function getPublished()
+	{
+		return (bool) $this->published;
+	}
 }

File themes/bootstrap/views/CmsBlock/block.php

File contents unchanged.

File themes/bootstrap/views/cms/layouts/cms-column1.php

File contents unchanged.

File themes/bootstrap/views/cms/layouts/cms-column2.php

File contents unchanged.

File themes/bootstrap/views/cms/layouts/cms.php

-<?php $this->beginContent(Yii::app()->cms->appLayout) ?>
-
-<div class="cms boot">
-
-	<div class="row">
-
-		<div class="span12">
-
-			<div class="cms-content">
-
-				<?php echo $content ?>
-
-			</div>
-
-		</div>
-
-		<div class="span4">
-
-			<div class="cms-sidebar">
-
-				<h3><?php echo Yii::t('CmsModule.core','Nodes') ?></h3>
-				
-				<?php echo CmsNode::model()->renderTree() ?>
-
-				<p><?php echo CHtml::link(Yii::t('CmsModule.core','Create a new node'),array('node/create'),array('class'=>'btn small')) ?></p>
-
-			</div>
-
-		</div>
-
-	</div>
-
-</div>
-
-<?php $this->endContent() ?>

File themes/bootstrap/views/cms/node/_form.php

File contents unchanged.

File themes/bootstrap/views/cms/node/create.php

File contents unchanged.

File themes/bootstrap/views/cms/node/page.php

File contents unchanged.

File themes/bootstrap/views/cms/node/update.php

File contents unchanged.

File views/admin/index.php

File contents unchanged.

File views/layouts/cms.php

-<?php $this->beginContent(Yii::app()->cms->appLayout) ?>
-
-<div class="cms bp">
-
-	<div class="clearfix">
-
-		<div class="span-18">
-
-			<div class="cms-content">
-
-				<?php echo $content ?>
-
-			</div>
-
-		</div>
-
-		<div class="span-6 last">
-
-			<div class="cms-sidebar">
-
-				<h3><?php echo Yii::t('CmsModule.core','Nodes') ?></h3>
-				
-				<?php echo CmsNode::model()->renderTree() ?>
-				
-				<p><?php echo CHtml::link(Yii::t('CmsModule.core','Create a new node'),array('node/create')) ?></p>
-
-			</div>
-
-		</div>
-
-	</div>
-
-</div>
-
-<?php $this->endContent() ?>

File views/node/create.php

File contents unchanged.

File views/node/index.php

File contents unchanged.

File views/node/page.php

File contents unchanged.

File views/node/update.php

File contents unchanged.

File widgets/views/block.php

File contents unchanged.