diff --git a/CHANGELOG.md b/CHANGELOG.md
index d1cf28ec5..c0022eefa 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,8 +13,9 @@ Full changelog for Dlayer since the v1.00 release.
* Added shortcut buttons to Column, Row and Page tools. [UX]
* The column contains content query only looks at enabled content. [Bugfix]
* Added a toggle ribbon button to the right side of the control bar, it expands the ribbon to open up the form. [UX]
+* Control bar padding left and right set to 15px, was 0. [Bugfix]
+* Added a rich text content item to the Content Manager (disabled until I add a renderer for quill). [Disabled Feature]
* Refactoring.
-* Control bar padding left and right set to 15px, was 0. [Bugfix]
* Minor fixes and improvements.
## v1.13: 18th February 2017
diff --git a/application/configs/environment.php b/application/configs/environment.php
index bbda11de2..6fb3a154f 100644
--- a/application/configs/environment.php
+++ b/application/configs/environment.php
@@ -16,4 +16,4 @@
// Version number for current release
$version_no = 'v1.14';
// Release date for current release
-$version_release_date = 'In Progress';
+$version_release_date = '23rd February 2017';
diff --git a/application/modules/dlayer/views/scripts/index/index.phtml b/application/modules/dlayer/views/scripts/index/index.phtml
index 3db3a77f3..d21cac5d9 100644
--- a/application/modules/dlayer/views/scripts/index/index.phtml
+++ b/application/modules/dlayer/views/scripts/index/index.phtml
@@ -42,6 +42,7 @@
Added shortcut buttons to Column, Row and Page tools. [UX]
The column contains content query only looks at enabled content. [Bugfix]
Control bar padding left and right set to 15px, was 0. [Bugfix]
+
Added a rich text content item to the Content Manager (disabled until I add a renderer for quill). [Disabled Feature]
Refactoring.
Minor fixes and improvements.
diff --git a/application/modules/setup/models/Import.php b/application/modules/setup/models/Import.php
index 7e310e3d0..5b95856e8 100644
--- a/application/modules/setup/models/Import.php
+++ b/application/modules/setup/models/Import.php
@@ -44,6 +44,7 @@ class Setup_Model_Import extends Zend_Db_Table_Abstract
'user_site_content_html',
'user_site_content_jumbotron',
'user_site_content_text',
+ 'user_site_content_richtext',
'user_site_form',
'user_site_form_field',
'user_site_form_field_attribute',
@@ -64,6 +65,7 @@ class Setup_Model_Import extends Zend_Db_Table_Abstract
'user_site_page_content_item_html',
'user_site_page_content_item_image',
'user_site_page_content_item_jumbotron',
+ 'user_site_page_content_item_richtext',
'user_site_page_content_item_text',
'user_site_page_meta',
'user_site_page_structure_column',
diff --git a/application/views/layouts/content-manager.phtml b/application/views/layouts/content-manager.phtml
index 8f9038c34..2340db85d 100644
--- a/application/views/layouts/content-manager.phtml
+++ b/application/views/layouts/content-manager.phtml
@@ -26,10 +26,13 @@
layout()->js_include as $include) { ?>
+
+
+
layout()->css_include as $include) { ?>
-
diff --git a/library/Dlayer/DesignerTool/ContentManager/Shared/Model/Content.php b/library/Dlayer/DesignerTool/ContentManager/Shared/Model/Content.php
index 719e3bcf3..52d1c8b3b 100644
--- a/library/Dlayer/DesignerTool/ContentManager/Shared/Model/Content.php
+++ b/library/Dlayer/DesignerTool/ContentManager/Shared/Model/Content.php
@@ -239,6 +239,10 @@ protected function contentItemTable($content_type)
$table = 'user_site_page_content_item_text';
break;
+ case 'rich-text':
+ $table = 'user_site_page_content_item_richtext';
+ break;
+
case 'html':
$table = 'user_site_page_content_item_html';
break;
@@ -278,6 +282,10 @@ protected function contentItemDataTable($content_type)
$table = 'user_site_content_text';
break;
+ case 'rich-text':
+ $table = 'user_site_content_richtext';
+ break;
+
case 'html':
$table = 'user_site_content_html';
break;
diff --git a/library/Dlayer/Form/Element/Quill.php b/library/Dlayer/Form/Element/Quill.php
new file mode 100644
index 000000000..7e9489643
--- /dev/null
+++ b/library/Dlayer/Form/Element/Quill.php
@@ -0,0 +1,17 @@
+html($row['content_id']);
break;
+ case 'rich-text':
+ $content_item = $this->richText($row['content_id']);
+ break;
+
default:
$content_item = false;
break;
@@ -347,4 +351,18 @@ private function form($id)
return $model_form->data($this->site_id, $this->page_id, $id);
}
+
+ /**
+ * Fetch all the data for a 'rich-text' content item
+ *
+ * @param integer $id Id of the content item
+ *
+ * @return array|false Either an array of the data for the content item or false upon error
+ */
+ private function richText($id)
+ {
+ $model = new Dlayer_Model_View_Page_Content_RichText();
+
+ return $model->data($this->site_id, $this->page_id, $id);
+ }
}
diff --git a/library/Dlayer/Model/View/Page/Content/RichText.php b/library/Dlayer/Model/View/Page/Content/RichText.php
new file mode 100644
index 000000000..161141ddc
--- /dev/null
+++ b/library/Dlayer/Model/View/Page/Content/RichText.php
@@ -0,0 +1,45 @@
+
+ * @copyright G3D Development Limited
+ * @license https://github.com/Dlayer/dlayer/blob/master/LICENSE
+ */
+class Dlayer_Model_View_Page_Content_RichText extends Zend_Db_Table_Abstract
+{
+ /**
+ * Fetch the core data needed to create a 'html'snippet
+ *
+ * @param integer $site_id
+ * @param integer $page_id
+ * @param integer $id Id of the content item
+ *
+ * @return array|false Either the content item data array or FALSE upon error
+ */
+ public function data($site_id, $page_id, $id)
+ {
+ $sql = "SELECT
+ `uspcirt`.`content_id`,
+ `uscrt`.`content`
+ FROM
+ `user_site_page_content_item_richtext` `uspcirt`
+ INNER JOIN
+ `user_site_content_richtext` `uscrt` ON
+ `uspcirt`.`data_id` = uscrt.id AND
+ `uscrt`.`site_id` = :site_id
+ WHERE
+ `uspcirt`.`content_id` = :content_id AND
+ `uspcirt`.`site_id` = :site_id AND
+ `uspcirt`.`page_id` = :page_id";
+ $stmt = $this->_db->prepare($sql);
+ $stmt->bindValue(':site_id', $site_id, PDO::PARAM_INT);
+ $stmt->bindValue(':page_id', $page_id, PDO::PARAM_INT);
+ $stmt->bindValue(':content_id', $id, PDO::PARAM_INT);
+ $stmt->execute();
+
+ return $stmt->fetch();
+ }
+}
diff --git a/library/Dlayer/Ribbon/Handler/Content.php b/library/Dlayer/Ribbon/Handler/Content.php
index 7d8961f4e..fd32ea79d 100644
--- a/library/Dlayer/Ribbon/Handler/Content.php
+++ b/library/Dlayer/Ribbon/Handler/Content.php
@@ -57,11 +57,11 @@ class Dlayer_Ribbon_Handler_Content
* @param string $tab
* @param integer $multi_use
* @param boolean $edit_mode
- * @param integer|NULL $row_id
- * @param integer|NULL $column_id
- * @param integer|NULL $content_id
+ * @param integer|null $row_id
+ * @param integer|null $column_id
+ * @param integer|null $content_id
*
- * @return array|FALSE Returns an array of the data necessary to create the tool tab for the tool or FALSE if
+ * @return array|false Returns an array of the data necessary to create the tool tab for the tool or FALSE if
* there is no data or something went wrong
*/
public function viewData(
@@ -132,6 +132,10 @@ public function viewData(
$data = $this->text($tool, $tab);
break;
+ case 'RichText':
+ $data = $this->richText($tool, $tab);
+ break;
+
default:
$data = false;
break;
@@ -567,4 +571,29 @@ private function headingDate($tool, $tab)
return $data;
}
+
+ /**
+ * Fetch the view tab data for the Rich text tool, returns an array containing the form and the data for
+ * the tool
+ *
+ * @param string $tool The tool name
+ * @param string $tab The tool tab name
+ *
+ * @return array|false
+ */
+ private function richText($tool, $tab)
+ {
+ switch ($tab) {
+ case 'rich-text':
+ $ribbon_rich_text = new Dlayer_DesignerTool_ContentManager_RichText_Ribbon();
+ $data = $ribbon_rich_text->viewData($this->toolParams($tool));
+ break;
+
+ default:
+ $data = false;
+ break;
+ }
+
+ return $data;
+ }
}
diff --git a/library/Dlayer/View/Codehinting.php b/library/Dlayer/View/Codehinting.php
index ae90f6542..1dd148fee 100644
--- a/library/Dlayer/View/Codehinting.php
+++ b/library/Dlayer/View/Codehinting.php
@@ -471,4 +471,27 @@ public function htmlPreview(array $data)
public function trimToLength($string, $length = 50)
{
}
+
+ /**
+ * Rich text content item view helper
+ *
+ * @param array $data Content item data array
+ * @param boolean $selectable
+ * @param boolean $selected
+ *
+ * @return Dlayer_View_RichText
+ */
+ public function richText(array $data, $selectable = false, $selected = false)
+ {
+ }
+
+ /**
+ * Preview version of the rich text content item view helper
+ *
+ * @param array $data Content item data array
+ * @return Dlayer_View_RichTextPreview
+ */
+ public function richTextPreview(array $data)
+ {
+ }
}
diff --git a/library/Dlayer/View/Content.php b/library/Dlayer/View/Content.php
index 1b8b6e96c..1ff4c1753 100644
--- a/library/Dlayer/View/Content.php
+++ b/library/Dlayer/View/Content.php
@@ -157,6 +157,10 @@ public function render()
$html .= $this->view->html($content['data'], $selectable, $selected);
break;
+ case 'rich-text':
+ $html .= $this->view->richText($content['data'], $selectable, $selected);
+ break;
+
default:
break;
}
diff --git a/library/Dlayer/View/ContentPreview.php b/library/Dlayer/View/ContentPreview.php
index 62d3fce86..955291a88 100644
--- a/library/Dlayer/View/ContentPreview.php
+++ b/library/Dlayer/View/ContentPreview.php
@@ -107,6 +107,10 @@ public function render()
$html .= $this->view->htmlPreview($content['data']);
break;
+ case 'rich-text':
+ $html .= $this->view->richTextPreview($content['data']);
+ break;
+
default:
break;
}
diff --git a/library/Dlayer/View/FormElementQuill.php b/library/Dlayer/View/FormElementQuill.php
new file mode 100644
index 000000000..023404e9e
--- /dev/null
+++ b/library/Dlayer/View/FormElementQuill.php
@@ -0,0 +1,35 @@
+
+ * @copyright G3D Development Limited
+ * @license https://github.com/Dlayer/dlayer/blob/master/LICENSE
+ */
+class Dlayer_View_FormElementQuill extends Zend_View_Helper_FormElement
+{
+ public function formElementQuill($name, $value = null, $attribs = null)
+ {
+ $info = $this->_getInfo($name, $value, $attribs);
+ extract($info); // name, value, attribs, options, listsep, disable
+
+ // build the element
+ $disabled = '';
+ if ($disable) {
+ // disabled
+ $disabled = ' disabled="disabled"';
+ }
+
+ $xhtml = '_htmlAttribs($attribs)
+ . $this->getClosingBracket()
+ . '';
+
+ return $xhtml;
+ }
+}
diff --git a/library/Dlayer/View/RichText.php b/library/Dlayer/View/RichText.php
new file mode 100644
index 000000000..6300195fa
--- /dev/null
+++ b/library/Dlayer/View/RichText.php
@@ -0,0 +1,102 @@
+
+ * @copyright G3D Development Limited
+ * @license https://github.com/Dlayer/dlayer/blob/master/LICENSE
+ */
+class Dlayer_View_RichText extends Zend_View_Helper_Abstract
+{
+ /**
+ * Override the hinting for the view property so that we can see the view
+ * helpers that have been defined
+ *
+ * @var Dlayer_View_Codehinting
+ */
+ public $view;
+
+ /**
+ * @var array Data array for the content item
+ */
+ private $data;
+
+ /**
+ * @var boolean Is the content item selectable?
+ */
+ private $selectable;
+
+ /**
+ * @var boolean Is the content item selected?
+ */
+ private $selected;
+
+ /**
+ * Constructor for view helper, data is set via the setter methods
+ *
+ * @param array $data Content item data array
+ * @param boolean $selectable
+ * @param boolean $selected
+ * @return Dlayer_View_RichText
+ */
+ public function richText(array $data, $selectable = FALSE, $selected = FALSE)
+ {
+ $this->resetParams();
+
+ $this->data = $data;
+ $this->selectable = $selectable;
+ $this->selected = $selected;
+
+ return $this;
+ }
+
+ /**
+ * Reset any internal params, we do this because the view helper could be called many times within the view script
+ *
+ * @return void
+ */
+ private function resetParams()
+ {
+ $this->data = array();
+ $this->selectable = FALSE;
+ $this->selected = FALSE;
+ }
+
+ /**
+ * Generate the html for the content item
+ *
+ * @return string
+ */
+ private function render()
+ {
+ $class = 'content';
+
+ if($this->selectable === TRUE)
+ {
+ $class .= ' selectable';
+ }
+ if($this->selected === TRUE)
+ {
+ $class .= ' selected';
+ }
+
+ $html = '
';
+
+ return $html;
+ }
+
+ /**
+ * The view helper can be output directly, there is no need to call the render method, simply echo or print
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return $this->render();
+ }
+}
diff --git a/library/Dlayer/View/RichTextPreview.php b/library/Dlayer/View/RichTextPreview.php
new file mode 100644
index 000000000..053a57992
--- /dev/null
+++ b/library/Dlayer/View/RichTextPreview.php
@@ -0,0 +1,71 @@
+
+ * @copyright G3D Development Limited
+ * @license https://github.com/Dlayer/dlayer/blob/master/LICENSE
+ */
+class Dlayer_View_RichTextPreview extends Zend_View_Helper_Abstract
+{
+ /**
+ * Override the hinting for the view property so that we can see the view
+ * helpers that have been defined
+ *
+ * @var Dlayer_View_Codehinting
+ */
+ public $view;
+
+ /**
+ * @var array Data array for the content item
+ */
+ private $data;
+
+ /**
+ * Constructor for view helper, data is set via the setter methods
+ *
+ * @param array $data Content item data array
+ * @return Dlayer_View_RichTextPreview
+ */
+ public function richTextPreview(array $data)
+ {
+ $this->resetParams();
+
+ $this->data = $data;
+
+ return $this;
+ }
+
+ /**
+ * Reset any internal params, we do this because the view helper could be called many times within the view script
+ *
+ * @return void
+ */
+ private function resetParams()
+ {
+ $this->data = array();
+ }
+
+ /**
+ * Generate the html for the content item
+ *
+ * @return string
+ */
+ private function render()
+ {
+ $html = '