Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.
 All Data Structures Functions Variables Pages
BuilderCanvasElement.php
1 <?php
2  /*********************************************************************************
3  * Zurmo is a customer relationship management program developed by
4  * Zurmo, Inc. Copyright (C) 2017 Zurmo Inc.
5  *
6  * Zurmo is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Affero General Public License version 3 as published by the
8  * Free Software Foundation with the addition of the following permission added
9  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
10  * IN WHICH THE COPYRIGHT IS OWNED BY ZURMO, ZURMO DISCLAIMS THE WARRANTY
11  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
12  *
13  * Zurmo is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Affero General Public License along with
19  * this program; if not, see http://www.gnu.org/licenses or write to the Free
20  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  * 02110-1301 USA.
22  *
23  * You can contact Zurmo, Inc. with a mailing address at 27 North Wacker Drive
24  * Suite 370 Chicago, IL 60606. or at email address contact@zurmo.com.
25  *
26  * The interactive user interfaces in original and modified versions
27  * of this program must display Appropriate Legal Notices, as required under
28  * Section 5 of the GNU Affero General Public License version 3.
29  *
30  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
31  * these Appropriate Legal Notices must retain the display of the Zurmo
32  * logo and Zurmo copyright notice. If the display of the logo is not reasonably
33  * feasible for technical reasons, the Appropriate Legal Notices must display the words
34  * "Copyright Zurmo Inc. 2017. All rights reserved".
35  ********************************************************************************/
36 
38  {
39  protected $shouldWrapCenterTagAroundTdForNonEditable = true;
40 
41  public static function resolveLabel()
42  {
43  return Zurmo::t('EmailTemplatesModule', 'Canvas');
44  }
45 
46  protected function resolveWrapperNonEditable($elementContent, array $customDataAttributes,
47  $actionsOverlay)
48  {
49  $content = parent::resolveWrapperNonEditable($elementContent, $customDataAttributes,
50  $actionsOverlay);
51  $content = $this->normalizeHtmlContent($content);
52  return $content;
53  }
54 
55  protected function resolveNonEditableContentWrappingTdHtmlOptions()
56  {
57  return array('class' => BaseBuilderElement::BUILDER_ELEMENT_SORTABLE_ROWS_CLASS . ' ui-sortable', 'align' => 'center', 'valign' => 'top');
58  }
59 
60  protected function renderSettingsTab(ZurmoActiveForm $form)
61  {
62  $propertiesForm = BuilderElementBackgroundPropertiesEditableElementsUtil::render($this->model, $form);
63  $propertiesForm .= BuilderElementTextPropertiesEditableElementsUtil::render($this->model, $form);
64  $propertiesForm .= BuilderElementBorderPropertiesEditableElementsUtil::render($this->model, $form);
65  return $propertiesForm;
66  }
67 
68  protected function resolveAvailableNonEditableActionsArray()
69  {
70  return array(static::OVERLAY_ACTION_EDIT);
71  }
72 
78  protected function resolveAvailableNonEditableActionLinkSpan($action)
79  {
80  $iconContent = ZurmoHtml::tag('i', array('class' => 'icon-' . $action), '');
81  return ZurmoHtml::tag('span', array('class' => $action, 'style' => 'display:none;'), $iconContent);
82  }
83 
84  protected function resolveNonEditableWrapperHtmlOptions()
85  {
86  $parentOptions = parent::resolveNonEditableWrapperHtmlOptions();
87  $parentOptions['class'] .= ' body';
88  return $parentOptions;
89  }
90 
96  protected function normalizeHtmlContent($content)
97  {
98  $doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
99  $headContent = $this->renderHtmlHead();
100  $bodyContent = $this->renderHtmlBody($content);
101  $html = ZurmoHtml::tag('html', array('xmlns' => 'http://www.w3.org/1999/xhtml'), $headContent . $bodyContent);
102  $content = $doctype . $html;
103  return $content;
104  }
105 
106  protected function renderHtmlBody($content)
107  {
108  $bodyContent = ZurmoHtml::tag('body', array(), $content);
109  return $bodyContent;
110  }
111 
112  protected function renderHtmlHead()
113  {
114  $headContent = $this->renderMetaTag();
115  $headContent .= $this->renderCss();
116  if ($this->renderForCanvas)
117  {
118  if (MINIFY_SCRIPTS)
119  {
120  $headContent .= $this->renderBuilderCssTools();
121  }
122  else
123  {
124  $headContent .= $this->renderLess();
125  }
126  }
127  $headContent = ZurmoHtml::tag('head', array(), $headContent);
128  return $headContent;
129  }
130 
131  protected function renderMetaTag()
132  {
133  return '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'; // Not Coding Standard
134  }
135 
136  protected function renderCss()
137  {
138  $css = $this->renderIconFontCss();
139  $css .= $this->resolveCanvasGlobalCssContent();
140  return $css;
141  }
142 
143  protected function renderBuilderCssTools()
144  {
145  $cs = Yii::app()->getClientScript();
146  $themeName = Yii::app()->theme->name;
147  $baseUrl = Yii::app()->themeManager->baseUrl . '/default';
148  $cs->registerCssFile($baseUrl . '/css/builder-iframe-tools.css' .
149  ZurmoAssetManager::getCssAndJavascriptHashQueryString("themes/$themeName/css/builder-iframe-tools.css"));
150  }
151 
152  protected function renderLess()
153  {
154  $baseUrl = Yii::app()->themeManager->baseUrl . '/default';
155  $publishedAssetsPath = Yii::app()->assetManager->publish(Yii::getPathOfAlias("application.core.views.assets"));
156  $less = '<link rel="stylesheet/less" type="text/css" id="default-theme" href="' . $baseUrl . '/less/builder-iframe-tools.less"/>
157  <script type="text/javascript" src="' . $publishedAssetsPath . '/less-1.2.0.min.js"></script>';
158  return $less;
159  }
160 
161  protected function renderIconFontCss()
162  {
163  //TODO: @sergio: Shouldnt we move this thing to a file too?
164  if ($this->renderForCanvas)
165  {
166  $publishedAssetsPath = Yii::app()->assetManager->publish(Yii::getPathOfAlias("application.core.views.assets.fonts"));
167  $iconsFont = "<style>" .
168  "@font-face" .
169  "{" .
170  "font-family: 'zurmo_gamification_symbly_rRg';" .
171  "src: url('{$publishedAssetsPath}/zurmogamificationsymblyregular-regular-webfont.eot');" .
172  "src: url('{$publishedAssetsPath}/zurmogamificationsymblyregular-regular-webfont.eot?#iefix') format('embedded-opentype'), " .
173  "url('{$publishedAssetsPath}/zurmogamificationsymblyregular-regular-webfont.woff') format('woff'), " .
174  "url('{$publishedAssetsPath}/zurmogamificationsymblyregular-regular-webfont.ttf') format('truetype'), " .
175  "url('{$publishedAssetsPath}/zurmogamificationsymblyregular-regular-webfont.svg#zurmo_gamification_symbly_rRg') format('svg');" .
176  "font-weight: normal;" .
177  "font-style: normal;" .
178  "unicode-range: U+00-FFFF;" . // Not Coding Standard
179  "}" .
180  "</style>";
181  return $iconsFont;
182  }
183  }
184 
185  protected function resolveCanvasGlobalCssPath()
186  {
187  $path = Yii::getPathOfAlias('application.modules.emailTemplates.widgets.assets');
188  Yii::app()->getAssetManager()->publish($path);
189  return $path . '/zurb.css';
190  }
191 
192  protected function resolveCanvasOverrideCssPath()
193  {
194  $path = Yii::getPathOfAlias('application.modules.emailTemplates.widgets.assets');
195  Yii::app()->getAssetManager()->publish($path);
196  return $path . '/zurmo-zurb.css';
197  }
198 
199  protected function resolveCanvasGlobalCssContent()
200  {
201  $path = $this->resolveCanvasGlobalCssPath();
202  $overridePath = $this->resolveCanvasOverrideCssPath();
203  $css = ZurmoHtml::tag('style', array('type' => 'text/css' ), file_get_contents($path) . file_get_contents($overridePath));
204  return $css;
205  }
206  }
207 ?>
const BUILDER_ELEMENT_SORTABLE_ROWS_CLASS
resolveAvailableNonEditableActionLinkSpan($action)
static getCssAndJavascriptHashQueryString($filePath)
Generated on Thu Oct 22 2020 07:10:29
Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.