\n"
. "\n";
return $script;
}
function PrepareEditorInlineScript()
{
global $homeurl, $fckeditordir;
$script ="\n"
. "\n";
/*** Commented because of inconsistencies
$script .= ""
. "\n";
***/
return $script;
}
function PrepareEditorScript($fieldtype=null)
{
global $defaulthtmleditormode;
if (isset($_SESSION['htmleditormode']) &&
$_SESSION['htmleditormode'] == 'none')
{
return "\n";
}
if (!isset($_SESSION['htmleditormode']) ||
($_SESSION['htmleditormode'] != 'inline' &&
$_SESSION['htmleditormode'] != 'popup') )
{
$htmleditormode = $defaulthtmleditormode;
}
else
{
$htmleditormode = $_SESSION['htmleditormode'];
}
if ($htmleditormode == 'popup' ||
$fieldtype == 'editanswer' ||
$fieldtype == 'addanswer' ||
$fieldtype == 'editlabel' ||
$fieldtype == 'addlabel')
{
return PrepareEditorPopupScript();
}
elseif ($htmleditormode == 'inline')
{
return PrepareEditorInlineScript();
}
else
{
return '';
}
}
function getEditor($fieldtype,$fieldname,$fieldtext, $surveyID=null,$gID=null,$qID=null,$action=null)
{
global $defaulthtmleditormode;
if (isset($_SESSION['htmleditormode']) &&
$_SESSION['htmleditormode'] == 'none')
{
return '';
}
if (!isset($_SESSION['htmleditormode']) ||
($_SESSION['htmleditormode'] != 'inline' &&
$_SESSION['htmleditormode'] != 'popup') )
{
$htmleditormode = $defaulthtmleditormode;
}
else
{
$htmleditormode = $_SESSION['htmleditormode'];
}
if ( ($fieldtype == 'email-inv' ||
$fieldtype == 'email-reg' ||
$fieldtype == 'email-conf' ||
$fieldtype == 'email-rem' ) &&
getEmailFormat($surveyID) != 'html')
{
return '';
}
if ($htmleditormode == 'popup' ||
$fieldtype == 'editanswer' ||
$fieldtype == 'addanswer' ||
$fieldtype == 'editlabel' ||
$fieldtype == 'addlabel')
{
return getPopupEditor($fieldtype,$fieldname,$fieldtext, $surveyID,$gID,$qID,$action);
}
elseif ($htmleditormode == 'inline')
{
return getInlineEditor($fieldtype,$fieldname,$fieldtext, $surveyID,$gID,$qID,$action);
}
else
{
return '';
}
}
function getPopupEditor($fieldtype,$fieldname,$fieldtext, $surveyID=null,$gID=null,$qID=null,$action=null)
{
global $clang, $imagefiles, $homeurl;
$htmlcode = '';
$imgopts = '';
$toolbarname = 'Basic';
if ($fieldtype == 'editanswer' ||
$fieldtype == 'addanswer' ||
$fieldtype == 'editlabel' ||
$fieldtype == 'addlabel')
{
$imgopts = "width='14px' height='14px'";
}
$htmlcode .= ""
. "gTview("Start HTML Editor in a Popup Window")."\">
gT("Start HTML Editor in a Popup Window")."\" id='".$fieldname."_popupctrlena' name='".$fieldname."_popupctrlena' border='0' src='".$imagefiles."/edithtmlpopup.png' $imgopts />
gT("Give focus to the HTML Editor Popup Window")."\" id='".$fieldname."_popupctrldis' name='".$fieldname."_popupctrldis' border='0' src='".$imagefiles."/edithtmlpopup_disabled.png' style='display: none' $imgopts align='top'/>";
return $htmlcode;
}
function getInlineEditor($fieldtype,$fieldname,$fieldtext, $surveyID=null,$gID=null,$qID=null,$action=null)
{
global $clang, $imagefiles, $homeurl, $rooturl, $fckeditordir;
$htmlcode = '';
$imgopts = '';
$toolbarname = 'Basic';
$toolbaroption="";
$htmlformatoption="";
if ($fieldtype == 'editanswer' ||
$fieldtype == 'addanswer' ||
$fieldtype == 'editlabel' ||
$fieldtype == 'addlabel')
{
$toolbarname = 'LimeSurveyToolbarfull';
$toolbaroption="oFCKeditor_$fieldname.Config[\"ToolbarLocation\"]=\"Out:xToolbar\";\n"
. "oFCKeditor_$fieldname.Config[\"ToolbarStartExpanded\"]=true;\n"
. "oFCKeditor_$fieldname.Config[\"ToolbarCanCollapse\"]=false;\n"
. "oFCKeditor_$fieldname.Height = \"50\"\n";
}
if ( $fieldtype == 'email-inv' ||
$fieldtype == 'email-reg' ||
$fieldtype == 'email-conf' ||
$fieldtype == 'email-rem' )
{
$htmlformatoption = "oFCKeditor_$fieldname.Config[\"FullPage\"]=true;\n";
}
$htmlcode .= ""
. "';
return $htmlcode;
}
?>