Skip to content
Permalink
Browse files

Mediadir: Bug fix: WYSIWYG editor gets white when switching between t…

…he lang options.

git-svn-id: http://svn.contrexxlabs.com/contrexx/branches/contrexx_3_1@30515 5ce06e5d-2b28-0410-aa6a-b3cd9cf52d8a
  • Loading branch information...
ss4u
ss4u committed May 22, 2014
1 parent 4c0c37a commit ba36977dd3d4be278ac1969f527ceef74bba8f0d
Showing with 33 additions and 7 deletions.
  1. +6 −6 modules/mediadir/lib/inputfields/wysiwyg.class.php
  2. +27 −1 modules/mediadir/lib/lib.class.php
@@ -102,36 +102,36 @@ function getInputfield($intView, $arrInputfield, $intEntryId=null)
if ($objInit->mode == 'backend') {
//$strInputfield = '<span id="'.$this->moduleName.'Inputfield_'.$intId.'_Minimized" style="display: block;"><textarea name="'.$this->moduleName.'Inputfield['.$intId.'][0]" id="'.$this->moduleName.'Inputfield_'.$intId.'_0" style="width: 300px; height: 60px;" onfocus="this.select();" />'.$arrValue[0].'</textarea>&nbsp;<a href="javascript:ExpandMinimizeMultiple(\''.$intId.'\');">'.$_ARRAYLANG['TXT_MEDIADIR_MORE'].'&nbsp;&raquo;</a></span>';
$strInputfield = '<span id="'.$this->moduleName.'Inputfield_'.$intId.'_ELEMENT_Minimized" style="display: block;">'.new \Cx\Core\Wysiwyg\Wysiwyg($this->moduleName.'Inputfield['.$intId.'][0]', $arrValue[0]).'&nbsp;<a href="javascript:ExpandMinimizeMultiple(\''.$intId.'\', \'ELEMENT\');">'.$_ARRAYLANG['TXT_MEDIADIR_MORE'].'&nbsp;&raquo;</a></span>';
$strInputfield = '<span id="'.$this->moduleName.'Inputfield_'.$intId.'_ELEMENT_Minimized" style="display: block;">'.new \Cx\Core\Wysiwyg\Wysiwyg($this->moduleName.'Inputfield['.$intId.'][0]', $arrValue[0]).'&nbsp;<a href="javascript:updateWysiwygEditor(\''.$intId.'\', \'ELEMENT\');javascript:ExpandMinimizeMultiple(\''.$intId.'\', \'ELEMENT\');">'.$_ARRAYLANG['TXT_MEDIADIR_MORE'].'&nbsp;&raquo;</a></span>';
$strInputfield .= '<span id="'.$this->moduleName.'Inputfield_'.$intId.'_ELEMENT_Expanded" style="display: none;">';
foreach ($this->arrFrontendLanguages as $key => $arrLang) {
$intLangId = $arrLang['id'];
$strInputfield .= new \Cx\Core\Wysiwyg\Wysiwyg($this->moduleName.'Inputfield['.$intId.']['.$intLangId.']', $arrValue[$intLangId]).'&nbsp;'.$arrLang['name'].'<br />';
}
$strInputfield .= "&nbsp;<a href=\"javascript:ExpandMinimizeMultiple('".$intId."', 'ELEMENT');\">&laquo;&nbsp;".$_ARRAYLANG['TXT_MEDIADIR_MINIMIZE']."</a>";
$strInputfield .= "&nbsp;<a href=\"javascript:updateWysiwygEditor('".$intId."', 'ELEMENT');javascript:ExpandMinimizeMultiple('".$intId."', 'ELEMENT');\">&laquo;&nbsp;".$_ARRAYLANG['TXT_MEDIADIR_MINIMIZE']."</a>";
$strInputfield .= '<textarea name="'.$this->moduleName.'Inputfield['.$intId.'][old]" style="display: none;" onfocus="this.select();" />'.$arrValue[0].'</textarea>';
$strInputfield .= '</span>';
} else {
//$strInputfield = '<textarea name="'.$this->moduleName.'Inputfield['.$intId.'][0]" id="'.$this->moduleName.'Inputfield_'.$intId.'_0" class="'.$this->moduleName.'InputfieldTextarea" onfocus="this.select();" />'.$arrValue[0].'</textarea>';
//$strInputfield = '<span id="'.$this->moduleName.'Inputfield_'.$intId.'_Minimized" style="display: block; float: left;" class="'.$this->moduleName.'GroupMultilang"><textarea name="'.$this->moduleName.'Inputfield['.$intId.'][0]" id="'.$this->moduleName.'Inputfield_'.$intId.'_0" class="'.$this->moduleName.'InputfieldTextarea '.$strInfoClass.'" '.$arrInfoValue[0].' onfocus="this.select();" />'.$arrValue[0].'</textarea>&nbsp;<a href="javascript:ExpandMinimize(\''.$intId.'\');">'.$_ARRAYLANG['TXT_MEDIADIR_MORE'].'&nbsp;&raquo;</a></span>';
$strInputfield = '<span class="editorFix"><span id="'.$this->moduleName.'Inputfield_'.$intId.'_Minimized" style="display: block;" class="'.$this->moduleName.'GroupMultilang">'.new \Cx\Core\Wysiwyg\Wysiwyg($this->moduleName.'Inputfield['.$intId.'][0]', $arrValue[0]).'&nbsp;<a href="javascript:ExpandMinimizeMultiple(\''.$intId.'\', \'ELEMENT\');">'.$_ARRAYLANG['TXT_MEDIADIR_MORE'].'&nbsp;&raquo;</a></span>';
$strInputfield = '<span class="editorFix"><span id="'.$this->moduleName.'Inputfield_'.$intId.'_Minimized" style="display: block;" class="'.$this->moduleName.'GroupMultilang">'.new \Cx\Core\Wysiwyg\Wysiwyg($this->moduleName.'Inputfield['.$intId.'][0]', $arrValue[0]).'&nbsp;<a href="javascript:updateWysiwygEditor(\''.$intId.'\', \'ELEMENT\');javascript:ExpandMinimizeMultiple(\''.$intId.'\', \'ELEMENT\');">'.$_ARRAYLANG['TXT_MEDIADIR_MORE'].'&nbsp;&raquo;</a></span>';
$strInputfield .= '<span id="'.$this->moduleName.'Inputfield_'.$intId.'_Expanded" style="display: none;" class="'.$this->moduleName.'GroupMultilang">';
foreach ($this->arrFrontendLanguages as $key => $arrLang) {
$intLangId = $arrLang['id'];
if (($key+1) == count($this->arrFrontendLanguages)) {
$minimize = "&nbsp;<a href=\"javascript:ExpandMinimizeMultiple('".$intId."', 'ELEMENT');\">&laquo;&nbsp;".$_ARRAYLANG['TXT_MEDIADIR_MINIMIZE']."</a>";
$minimize = "&nbsp;<a href=\"javascript:updateWysiwygEditor('".$intId."', 'ELEMENT');javascript:ExpandMinimizeMultiple('".$intId."', 'ELEMENT');\">&laquo;&nbsp;".$_ARRAYLANG['TXT_MEDIADIR_MINIMIZE']."</a>";
} else {
$minimize = "";
}
//$strInputfield .= '<textarea name="'.$this->moduleName.'Inputfield['.$intId.']['.$intLangId.']" id="'.$this->moduleName.'Inputfield_'.$intId.'_'.$intLangId.'" class="'.$this->moduleName.'InputfieldTextarea '.$strInfoClass.'" '.$arrInfoValue[$intLangId].' onfocus="this.select();" />'.$arrValue[$intLangId].'</textarea>&nbsp;'.$arrLang['name'].'<a href="javascript:ExpandMinimize(\''.$intId.'\');">&nbsp;'.$minimize.'</a><br />';
$strInputfield .= new \Cx\Core\Wysiwyg\Wysiwyg($this->moduleName.'Inputfield['.$intId.']['.$intLangId.']', $arrValue[$intLangId]).'&nbsp;'.$arrLang['name'].'<a href="javascript:ExpandMinimizeMultiple(\''.$intId.'\', \'ELEMENT\');">&nbsp;'.$minimize.'</a><br />';
$strInputfield .= new \Cx\Core\Wysiwyg\Wysiwyg($this->moduleName.'Inputfield['.$intId.']['.$intLangId.']', $arrValue[$intLangId]).'&nbsp;'.$arrLang['name'].'<a href="javascript:updateWysiwygEditor(\''.$intId.'\', \'ELEMENT\');javascript:ExpandMinimizeMultiple(\''.$intId.'\', \'ELEMENT\');">&nbsp;'.$minimize.'</a><br />';
}
$strInputfield .= '<textarea name="'.$this->moduleName.'Inputfield['.$intId.'][old]" style="display: none;" onfocus="this.select();" />'.$arrValue[0].'</textarea>';
$strInputfield .= '</span></span>';
@@ -302,4 +302,4 @@ function getFormOnSubmit($intInputfieldId)
{
return null;
}
}
}
@@ -628,7 +628,33 @@ function ExpandMinimizeMultiple(toggleId, toggleKey){
elm1.style.display = (elm1.style.display=='none') ? 'block' : 'none';
elm2.style.display = (elm2.style.display=='none') ? 'block' : 'none';
}
function updateWysiwygEditor(fieldId, toggleKey){
defaultLang = '$_LANGID';
activeLang = new Array($arrActiveLang);
\$minimized = \$J('#mediadirInputfield_' + fieldId + '_' + toggleKey + '_Minimized');
\$expand = \$J('#mediadirInputfield_' + fieldId + '_' + toggleKey + '_Expanded');
elmMaster = CKEDITOR.instances['mediadirInputfield['+ fieldId +'][0]'];
elmDefault = CKEDITOR.instances['mediadirInputfield['+ fieldId +']['+ defaultLang +']'];
for(i=0;i<activeLang.length;i++) {
elmCurrent = CKEDITOR.instances['mediadirInputfield['+ fieldId +']['+ activeLang[i] +']'];
if(elmCurrent.getData() == '') {
elmCurrent.setData(elmMaster.getData());
}
}
if(\$minimized.is(":visible")) {
elmDefault.setData(elmMaster.getData());
} else {
elmMaster.setData(elmDefault.getData());
}
for ( instance in CKEDITOR.instances )
{
CKEDITOR.instances[instance].updateElement();
}
}
EOF;
return $strSelectorJavascript;

0 comments on commit ba36977

Please sign in to comment.
You can’t perform that action at this time.