Skip to content

Commit

Permalink
CS-5684 - Front-end is not support correctly percent values from AES
Browse files Browse the repository at this point in the history
replace 'var' declaration with public

added height to editor_image.tpl

change width to height in editor_image

remove not needed code
  • Loading branch information
takeit committed Mar 12, 2015
1 parent 9834873 commit 3b0a9ed
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 30 deletions.
4 changes: 2 additions & 2 deletions newscoop/classes/ArticleData.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
class ArticleData extends DatabaseObject
{
var $m_columnNames = array('NrArticle', 'IdLanguage');
var $m_keyColumnNames = array('NrArticle', 'IdLanguage');
public $m_columnNames = array('NrArticle', 'IdLanguage');
public $m_keyColumnNames = array('NrArticle', 'IdLanguage');
public $m_dbTableName;
public $m_articleTypeName;
private $m_articleTypeObject = null;
Expand Down
59 changes: 32 additions & 27 deletions newscoop/template_engine/metaclasses/MetaSubtitle.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ final class MetaSubtitle
*/
public function MetaSubtitle($p_number = null, $p_fieldName = null,
$p_count = null, $p_name = null, $p_content = null, $p_formattingStart = '',
$p_formattingEnd = '') {
$p_formattingEnd = '')
{
$this->m_number = $p_number;
$this->m_fieldName = $p_fieldName;
$this->m_count = $p_count;
Expand Down Expand Up @@ -128,7 +129,7 @@ public function __get($p_property)
default:
$this->trigger_invalid_property_error($p_property);

return null;
return;
}
}

Expand All @@ -155,12 +156,13 @@ protected function getFormattedName($p_formattingStart = '<p>', $p_formattingEnd
* @return array of MetaSubtitle
*/
public static function ReadSubtitles($p_content, $p_fieldName, $p_firstSubtitle = '',
$p_headerFormatStart = null, $p_headerFormatEnd = null) {
$p_headerFormatStart = null, $p_headerFormatEnd = null)
{
$result = preg_match_all('/('.MetaSubtitle::GetFindPattern().')/i', $p_content, $subtitlesNames);

$contentParts = preg_split('/'.MetaSubtitle::GetSplitPattern().'/i', $p_content);
$subtitlesContents = array();
foreach ($contentParts as $index=>$contentPart) {
foreach ($contentParts as $index => $contentPart) {
$name = $index > 0 ? $subtitlesNames[3][$index-1] : $p_firstSubtitle;
if (empty($p_headerFormatStart)) {
$formatStart = $index > 0 ? $subtitlesNames[2][$index-1] : '';
Expand Down Expand Up @@ -273,12 +275,15 @@ public static function ProcessImageLink(array $p_matches)
}
}

$defaultOptions = array('ratio'=>'EditorImageRatio', 'width'=>'EditorImageResizeWidth',
'height'=>'EditorImageResizeHeight');
$defaultOptions = array('ratio' => 'EditorImageRatio', 'width' => 'EditorImageResizeWidth',
'height' => 'EditorImageResizeHeight', );
foreach (array('ratio', 'width', 'height') as $imageOption) {
$defaultOption = (int) $preferencesService->get($defaultOptions[$imageOption]);
if (isset($detailsArray[$imageOption]) && $detailsArray[$imageOption] > 0) {
$imageOptions .= " $imageOption " . (int) $detailsArray[$imageOption];
if (strpos($detailsArray[$imageOption], '%') === false) {
$imageOptions .= " $imageOption ".(int) $detailsArray[$imageOption];
$detailsArray[$imageOption] = $detailsArray[$imageOption]."px";
}
} elseif ($imageOption != 'ratio' && $defaultOption > 0) {
$imageOptions .= " $imageOption $defaultOption";
} elseif ($imageOption == 'ratio' && $defaultOption != 100) {
Expand All @@ -289,7 +294,7 @@ public static function ProcessImageLink(array $p_matches)

$imgZoomLink = '';
if ($preferencesService->EditorImageZoom == 'Y' && strlen($imageOptions) > 0) {
$imgZoomLink = '/' . $image->filerpath;
$imgZoomLink = '/'.$image->filerpath;
}

try {
Expand All @@ -307,23 +312,23 @@ public static function ProcessImageLink(array $p_matches)
}
}

/**
* Process the Snippet markup and return the Snippet rendered
*
* @param array $p_matches
* @return string
*/
public static function ProcessSnippet(array $p_matches)
{
$snippet = '';
if (array_key_exists(1, $p_matches)) {
$em = \Zend_Registry::get('container')->getService('doctrine.em');
$snippet = $em->getRepository('Newscoop\Entity\Snippet')->getSnippetById($p_matches[1]);
$snippet = $snippet->render();
}

return $snippet;
}
/**
* Process the Snippet markup and return the Snippet rendered
*
* @param array $p_matches
* @return string
*/
public static function ProcessSnippet(array $p_matches)
{
$snippet = '';
if (array_key_exists(1, $p_matches)) {
$em = \Zend_Registry::get('container')->getService('doctrine.em');
$snippet = $em->getRepository('Newscoop\Entity\Snippet')->getSnippetById($p_matches[1]);
$snippet = $snippet->render();
}

return $snippet;
}

/**
* Process the internal link statement given in Campsite internal formatting.
Expand Down Expand Up @@ -379,8 +384,8 @@ private static function GetFindPattern()

protected function trigger_invalid_property_error($p_property, $p_smarty = null)
{
$errorMessage = INVALID_PROPERTY_STRING . " $p_property "
. OF_OBJECT_STRING . ' subtitle';
$errorMessage = INVALID_PROPERTY_STRING." $p_property "
.OF_OBJECT_STRING.' subtitle';
CampTemplate::singleton()->trigger_error($errorMessage, $p_smarty);
}
}
2 changes: 1 addition & 1 deletion newscoop/themes/system_templates/editor_image.tpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{ dynamic }}
{{ if $imageDetails['align'] }} <div align="center"> {{ /if }}
<div class="cs_img {{ if $imageDetails['align'] }}cs_fl_{{ $imageDetails['align'] }}{{ /if }}" {{ if $imageDetails['width'] }}style="width:{{ $imageDetails['width'] }}px;"{{ /if }}>
<div class="cs_img {{ if $imageDetails['align'] }}cs_fl_{{ $imageDetails['align'] }}{{ /if }}" style="{{ if $imageDetails['width'] }}width:{{ $imageDetails['width'] }};{{ /if }}{{ if $imageDetails['height'] }} height: {{ $imageDetails['height'] }}{{ /if }}">
{{ if strlen($imgZoomLink) > 0 }} <p><a href="{{ $imgZoomLink }}" class="photoViewer" title="{{ $imageDetails['sub'] }}"> {{ else }}<p> {{ /if }}
<img src="{{ $uri->uri }}" {{ if isset($imageDetails['alt']) }}alt="{{ $imageDetails['alt'] }}"{{ /if }} {{ if isset($imageDetails['sub']) }}title="{{ $imageDetails['alt'] }}" {{ /if }} border="0"/>
{{ if strlen($imgZoomLink) > 0 }} </a></p> {{ else }}</p> {{ /if }}
Expand Down

0 comments on commit 3b0a9ed

Please sign in to comment.