Ejemplo n.º 1
0
 function GetPublicEditHTML($arProperty, $value, $strHTMLControlName)
 {
     if (!Loader::includeModule("fileman")) {
         return Loc::getMessage("IBLOCK_PROP_HTML_NOFILEMAN_ERROR");
     }
     if (!is_array($value["VALUE"])) {
         $value = CIBlockPropertyHTML::ConvertFromDB($arProperty, $value);
     }
     $settings = CIBlockPropertyHTML::PrepareSettings($arProperty);
     $id = preg_replace("/[^a-z0-9]/i", '', $strHTMLControlName['VALUE']);
     ob_start();
     echo '<input type="hidden" name="' . $strHTMLControlName["VALUE"] . '[TYPE]" value="html">';
     $LHE = new CHTMLEditor();
     $LHE->Show(array('name' => $strHTMLControlName["VALUE"] . '[TEXT]', 'id' => $id, 'inputName' => $strHTMLControlName["VALUE"] . '[TEXT]', 'content' => $value["VALUE"]['TEXT'], 'width' => '100%', 'minBodyWidth' => 350, 'normalBodyWidth' => 555, 'height' => '200', 'bAllowPhp' => false, 'limitPhpAccess' => false, 'autoResize' => true, 'autoResizeOffset' => 40, 'useFileDialogs' => false, 'saveOnBlur' => true, 'showTaskbars' => false, 'showNodeNavi' => false, 'askBeforeUnloadPage' => true, 'bbCode' => false, 'siteId' => SITE_ID, 'controlsMap' => array(array('id' => 'Bold', 'compact' => true, 'sort' => 80), array('id' => 'Italic', 'compact' => true, 'sort' => 90), array('id' => 'Underline', 'compact' => true, 'sort' => 100), array('id' => 'Strikeout', 'compact' => true, 'sort' => 110), array('id' => 'RemoveFormat', 'compact' => true, 'sort' => 120), array('id' => 'Color', 'compact' => true, 'sort' => 130), array('id' => 'FontSelector', 'compact' => false, 'sort' => 135), array('id' => 'FontSize', 'compact' => false, 'sort' => 140), array('separator' => true, 'compact' => false, 'sort' => 145), array('id' => 'OrderedList', 'compact' => true, 'sort' => 150), array('id' => 'UnorderedList', 'compact' => true, 'sort' => 160), array('id' => 'AlignList', 'compact' => false, 'sort' => 190), array('separator' => true, 'compact' => false, 'sort' => 200), array('id' => 'InsertLink', 'compact' => true, 'sort' => 210), array('id' => 'InsertImage', 'compact' => false, 'sort' => 220), array('id' => 'InsertVideo', 'compact' => true, 'sort' => 230), array('id' => 'InsertTable', 'compact' => false, 'sort' => 250), array('separator' => true, 'compact' => false, 'sort' => 290), array('id' => 'Fullscreen', 'compact' => false, 'sort' => 310), array('id' => 'More', 'compact' => true, 'sort' => 400))));
     $s = ob_get_contents();
     ob_end_clean();
     return $s;
 }
Ejemplo n.º 2
0
 protected function connectionHtmlEditor($fieldId, $fieldNameForHtml, $params, $content)
 {
     $html = '';
     if (Loader::includeModule('fileman')) {
         ob_start();
         $editor = new CHTMLEditor();
         $res = array('name' => $fieldNameForHtml, 'inputName' => $fieldNameForHtml, 'id' => $fieldId . $params['iblockId'], 'width' => $params['width'], 'height' => $params['height'], 'content' => $content, 'minBodyWidth' => 350, 'normalBodyWidth' => 555, 'bAllowPhp' => false, 'limitPhpAccess' => false, 'showTaskbars' => false, 'showNodeNavi' => false, 'beforeUnloadHandlerAllowed' => true, 'askBeforeUnloadPage' => false, 'bbCode' => false, 'siteId' => SITE_ID, 'autoResize' => true, 'autoResizeOffset' => 40, 'saveOnBlur' => true, 'controlsMap' => array(array('id' => 'Bold', 'compact' => true, 'sort' => 80), array('id' => 'Italic', 'compact' => true, 'sort' => 90), array('id' => 'Underline', 'compact' => true, 'sort' => 100), array('id' => 'Strikeout', 'compact' => true, 'sort' => 110), array('id' => 'RemoveFormat', 'compact' => true, 'sort' => 120), array('id' => 'Color', 'compact' => true, 'sort' => 130), array('id' => 'FontSelector', 'compact' => false, 'sort' => 135), array('id' => 'FontSize', 'compact' => false, 'sort' => 140), array('separator' => true, 'compact' => false, 'sort' => 145), array('id' => 'OrderedList', 'compact' => true, 'sort' => 150), array('id' => 'UnorderedList', 'compact' => true, 'sort' => 160), array('id' => 'AlignList', 'compact' => false, 'sort' => 190), array('separator' => true, 'compact' => false, 'sort' => 200), array('id' => 'InsertLink', 'compact' => true, 'sort' => 210, 'wrap' => 'bx-htmleditor-' . $this->formId), array('id' => 'InsertImage', 'compact' => false, 'sort' => 220), array('id' => 'InsertVideo', 'compact' => true, 'sort' => 230, 'wrap' => 'bx-htmleditor-' . $this->formId), array('id' => 'InsertTable', 'compact' => false, 'sort' => 250), array('id' => 'Code', 'compact' => true, 'sort' => 260), array('id' => 'Quote', 'compact' => true, 'sort' => 270, 'wrap' => 'bx-htmleditor-' . $this->formId), array('id' => 'Smile', 'compact' => false, 'sort' => 280), array('separator' => true, 'compact' => false, 'sort' => 290), array('id' => 'Fullscreen', 'compact' => false, 'sort' => 310), array('id' => 'BbCode', 'compact' => true, 'sort' => 340), array('id' => 'More', 'compact' => true, 'sort' => 400)));
         $editor->show($res);
         $html = ob_get_contents();
         ob_end_clean();
     }
     return $html;
 }
Ejemplo n.º 3
0
    public function GetFieldInputControl($documentType, $fieldType, $fieldName, $fieldValue, $allowSelection = false, $publicMode = false)
    {
        $iblockId = intval(substr($documentType, strlen("iblock_")));
        if ($iblockId <= 0) {
            throw new CBPArgumentOutOfRangeException("documentType", $documentType);
        }
        static $documentFieldTypes = array();
        if (!array_key_exists($documentType, $documentFieldTypes)) {
            $documentFieldTypes[$documentType] = self::getDocumentFieldTypes($documentType);
        }
        $fieldType["BaseType"] = "string";
        $fieldType["Complex"] = false;
        if (array_key_exists($fieldType["Type"], $documentFieldTypes[$documentType])) {
            $fieldType["BaseType"] = $documentFieldTypes[$documentType][$fieldType["Type"]]["BaseType"];
            $fieldType["Complex"] = $documentFieldTypes[$documentType][$fieldType["Type"]]["Complex"];
        }
        if (!is_array($fieldValue) || is_array($fieldValue) && CBPHelper::isAssociativeArray($fieldValue)) {
            $fieldValue = array($fieldValue);
        }
        $customMethodName = "";
        $customMethodNameMulty = "";
        if (strpos($fieldType["Type"], ":") !== false) {
            $ar = CIBlockProperty::getUserType(substr($fieldType["Type"], 2));
            if (array_key_exists("GetPublicEditHTML", $ar)) {
                $customMethodName = $ar["GetPublicEditHTML"];
            }
            if (array_key_exists("GetPublicEditHTMLMulty", $ar)) {
                $customMethodNameMulty = $ar["GetPublicEditHTMLMulty"];
            }
        }
        ob_start();
        if ($fieldType["Type"] == "select") {
            $fieldValueTmp = $fieldValue;
            ?>
			<select id="id_<?php 
            echo htmlspecialcharsbx($fieldName["Field"]);
            ?>
" name="<?php 
            echo htmlspecialcharsbx($fieldName["Field"]) . ($fieldType["Multiple"] ? "[]" : "");
            ?>
"<?php 
            echo $fieldType["Multiple"] ? ' size="5" multiple' : '';
            ?>
>
				<?php 
            if (!$fieldType["Required"]) {
                echo '<option value="">[' . GetMessage("BPCGHLP_NOT_SET") . ']</option>';
            }
            foreach ($fieldType["Options"] as $k => $v) {
                if (is_array($v) && count($v) == 2) {
                    $v1 = array_values($v);
                    $k = $v1[0];
                    $v = $v1[1];
                }
                $ind = array_search($k, $fieldValueTmp);
                echo '<option value="' . htmlspecialcharsbx($k) . '"' . ($ind !== false ? ' selected' : '') . '>' . htmlspecialcharsbx($v) . '</option>';
                if ($ind !== false) {
                    unset($fieldValueTmp[$ind]);
                }
            }
            ?>
			</select>
			<?php 
            if ($allowSelection) {
                ?>
				<br /><input type="text" id="id_<?php 
                echo htmlspecialcharsbx($fieldName["Field"]);
                ?>
_text" name="<?php 
                echo htmlspecialcharsbx($fieldName["Field"]);
                ?>
_text" value="<?php 
                if (count($fieldValueTmp) > 0) {
                    $a = array_values($fieldValueTmp);
                    echo htmlspecialcharsbx($a[0]);
                }
                ?>
">
				<input type="button" value="..." onclick="BPAShowSelector('id_<?php 
                echo htmlspecialcharsbx($fieldName["Field"]);
                ?>
_text', 'select');">
			<?php 
            }
        } elseif ($fieldType["Type"] == "user") {
            $fieldValue = CBPHelper::usersArrayToString($fieldValue, null, array("lists", get_called_class(), $documentType));
            ?>
<input type="text" size="40" id="id_<?php 
            echo htmlspecialcharsbx($fieldName["Field"]);
            ?>
" name="<?php 
            echo htmlspecialcharsbx($fieldName["Field"]);
            ?>
" value="<?php 
            echo htmlspecialcharsbx($fieldValue);
            ?>
"><input type="button" value="..." onclick="BPAShowSelector('id_<?php 
            echo htmlspecialcharsbx($fieldName["Field"]);
            ?>
', 'user');"><?php 
        } elseif (strpos($fieldType["Type"], ":") !== false && $fieldType["Multiple"] && (is_array($customMethodNameMulty) && count($customMethodNameMulty) > 0 || !is_array($customMethodNameMulty) && strlen($customMethodNameMulty) > 0)) {
            if (!is_array($fieldValue)) {
                $fieldValue = array();
            }
            if ($allowSelection) {
                $fieldValueTmp1 = array();
                $fieldValueTmp2 = array();
                foreach ($fieldValue as $v) {
                    $vTrim = trim($v);
                    if (\CBPDocument::IsExpression($vTrim)) {
                        $fieldValueTmp1[] = $vTrim;
                    } else {
                        $fieldValueTmp2[] = $v;
                    }
                }
            } else {
                $fieldValueTmp1 = array();
                $fieldValueTmp2 = $fieldValue;
            }
            if ($fieldType["Type"] == "S:employee" && COption::getOptionString("bizproc", "employee_compatible_mode", "N") != "Y") {
                $fieldValueTmp2 = CBPHelper::stripUserPrefix($fieldValueTmp2);
            }
            foreach ($fieldValueTmp2 as &$fld) {
                if (!isset($fld['VALUE'])) {
                    $fld = array("VALUE" => $fld);
                }
            }
            if ($fieldType["Type"] == "E:EList") {
                static $fl = true;
                if ($fl) {
                    if (!empty($_SERVER['HTTP_BX_AJAX'])) {
                        $GLOBALS["APPLICATION"]->showAjaxHead();
                    }
                    $GLOBALS["APPLICATION"]->addHeadScript('/bitrix/js/iblock/iblock_edit.js');
                }
                $fl = false;
            }
            echo call_user_func_array($customMethodNameMulty, array(array("LINK_IBLOCK_ID" => $fieldType["Options"]), $fieldValueTmp2, array("FORM_NAME" => $fieldName["Form"], "VALUE" => htmlspecialcharsbx($fieldName["Field"])), true));
            if ($allowSelection) {
                ?>
				<br /><input type="text" id="id_<?php 
                echo htmlspecialcharsbx($fieldName["Field"]);
                ?>
_text" name="<?php 
                echo htmlspecialcharsbx($fieldName["Field"]);
                ?>
_text" value="<?php 
                if (count($fieldValueTmp1) > 0) {
                    $a = array_values($fieldValueTmp1);
                    echo htmlspecialcharsbx($a[0]);
                }
                ?>
">
				<input type="button" value="..." onclick="BPAShowSelector('id_<?php 
                echo htmlspecialcharsbx($fieldName["Field"]);
                ?>
_text', 'user', '<?php 
                echo $fieldType["Type"] == 'S:employee' ? 'employee' : '';
                ?>
');">
			<?php 
            }
        } else {
            if (!array_key_exists("CBPVirtualDocumentCloneRowPrinted", $GLOBALS) && $fieldType["Multiple"]) {
                $GLOBALS["CBPVirtualDocumentCloneRowPrinted"] = 1;
                ?>
				<script language="JavaScript">
					function CBPVirtualDocumentCloneRow(tableID)
					{
						var tbl = document.getElementById(tableID);
						var cnt = tbl.rows.length;
						var oRow = tbl.insertRow(cnt);
						var oCell = oRow.insertCell(0);
						var sHTML = tbl.rows[cnt - 1].cells[0].innerHTML;
						var p = 0;
						while (true)
						{
							var s = sHTML.indexOf('[n', p);
							if (s < 0)
								break;
							var e = sHTML.indexOf(']', s);
							if (e < 0)
								break;
							var n = parseInt(sHTML.substr(s + 2, e - s));
							sHTML = sHTML.substr(0, s) + '[n' + (++n) + ']' + sHTML.substr(e + 1);
							p = s + 1;
						}
						var p = 0;
						while (true)
						{
							var s = sHTML.indexOf('__n', p);
							if (s < 0)
								break;
							var e = sHTML.indexOf('_', s + 2);
							if (e < 0)
								break;
							var n = parseInt(sHTML.substr(s + 3, e - s));
							sHTML = sHTML.substr(0, s) + '__n' + (++n) + '_' + sHTML.substr(e + 1);
							p = e + 1;
						}
						oCell.innerHTML = sHTML;
						var patt = new RegExp('<' + 'script' + '>[^\000]*?<' + '\/' + 'script' + '>', 'ig');
						var code = sHTML.match(patt);
						if (code)
						{
							for (var i = 0; i < code.length; i++)
							{
								if (code[i] != '')
								{
									var s = code[i].substring(8, code[i].length - 9);
									jsUtils.EvalGlobal(s);
								}
							}
						}
					}
					function createAdditionalHtmlEditor(tableId)
					{
						var tbl = document.getElementById(tableId);
						var cnt = tbl.rows.length-1;
						var name = tableId.replace(/(?:CBPVirtualDocument_)(.*)(?:_Table)/, '$1')
						var idEditor = 'id_'+name+'__n'+cnt+'_';
						var inputNameEditor = name+'[n'+cnt+']';
						window.BXHtmlEditor.Show(
							{
								'id':idEditor,
								'inputName':inputNameEditor,
								'content':'',
								'useFileDialogs':false,
								'width':'100%',
								'height':'200',
								'allowPhp':false,
								'limitPhpAccess':false,
								'templates':[],
								'templateId':'',
								'templateParams':[],
								'componentFilter':'',
								'snippets':[],
								'placeholder':'Text here...',
								'actionUrl':'/bitrix/tools/html_editor_action.php',
								'cssIframePath':'/bitrix/js/fileman/html_editor/iframe-style.css?1412693817',
								'bodyClass':'',
								'bodyId':'',
								'spellcheck_path':'/bitrix/js/fileman/html_editor/html-spell.js?v=1412693817',
								'usePspell':'N',
								'useCustomSpell':'Y',
								'bbCode':false,
								'askBeforeUnloadPage':true,
								'settingsKey':'user_settings_1',
								'showComponents':true,
								'showSnippets':true,
								'view':'wysiwyg',
								'splitVertical':false,
								'splitRatio':'1',
								'taskbarShown':false,
								'taskbarWidth':'250',
								'lastSpecialchars':false,
								'cleanEmptySpans':true,
								'lazyLoad':false,
								'showTaskbars':false,
								'showNodeNavi':false,
								'controlsMap':[
									{'id':'Bold','compact':true,'sort':'80'},
									{'id':'Italic','compact':true,'sort':'90'},
									{'id':'Underline','compact':true,'sort':'100'},
									{'id':'Strikeout','compact':true,'sort':'110'},
									{'id':'RemoveFormat','compact':true,'sort':'120'},
									{'id':'Color','compact':true,'sort':'130'},
									{'id':'FontSelector','compact':false,'sort':'135'},
									{'id':'FontSize','compact':false,'sort':'140'},
									{'separator':true,'compact':false,'sort':'145'},
									{'id':'OrderedList','compact':true,'sort':'150'},
									{'id':'UnorderedList','compact':true,'sort':'160'},
									{'id':'AlignList','compact':false,'sort':'190'},
									{'separator':true,'compact':false,'sort':'200'},
									{'id':'InsertLink','compact':true,'sort':'210','wrap':'bx-b-link-'+idEditor},
									{'id':'InsertImage','compact':false,'sort':'220'},
									{'id':'InsertVideo','compact':true,'sort':'230','wrap':'bx-b-video-'+idEditor},
									{'id':'InsertTable','compact':false,'sort':'250'},
									{'id':'Code','compact':true,'sort':'260'},
									{'id':'Quote','compact':true,'sort':'270','wrap':'bx-b-quote-'+idEditor},
									{'id':'Smile','compact':false,'sort':'280'},
									{'separator':true,'compact':false,'sort':'290'},
									{'id':'Fullscreen','compact':false,'sort':'310'},
									{'id':'BbCode','compact':true,'sort':'340'},
									{'id':'More','compact':true,'sort':'400'}],
								'autoResize':true,
								'autoResizeOffset':'40',
								'minBodyWidth':'350',
								'normalBodyWidth':'555'
							});
						var htmlEditor = BX.findChildrenByClassName(BX(tableId), 'bx-html-editor');
						for(var k in htmlEditor)
						{
							var editorId = htmlEditor[k].getAttribute('id');
							var frameArray = BX.findChildrenByClassName(BX(editorId), 'bx-editor-iframe');
							if(frameArray.length > 1)
							{
								for(var i = 0; i < frameArray.length - 1; i++)
								{
									frameArray[i].parentNode.removeChild(frameArray[i]);
								}
							}

						}
					}
				</script>
			<?php 
            }
            if ($fieldType["Multiple"]) {
                echo '<table width="100%" border="0" cellpadding="2" cellspacing="2" id="CBPVirtualDocument_' . htmlspecialcharsbx($fieldName["Field"]) . '_Table">';
            }
            $fieldValueTmp = $fieldValue;
            if (sizeof($fieldValue) == 0) {
                $fieldValue[] = null;
            }
            $ind = -1;
            foreach ($fieldValue as $key => $value) {
                $ind++;
                $fieldNameId = 'id_' . htmlspecialcharsbx($fieldName["Field"]) . '__n' . $ind . '_';
                $fieldNameName = htmlspecialcharsbx($fieldName["Field"]) . ($fieldType["Multiple"] ? "[n" . $ind . "]" : "");
                if ($fieldType["Multiple"]) {
                    echo '<tr><td>';
                }
                if (is_array($customMethodName) && count($customMethodName) > 0 || !is_array($customMethodName) && strlen($customMethodName) > 0) {
                    if ($fieldType["Type"] == "S:HTML") {
                        if (Loader::includeModule("fileman")) {
                            $editor = new CHTMLEditor();
                            $res = array_merge(array('useFileDialogs' => false, 'height' => 200, 'useFileDialogs' => false, 'minBodyWidth' => 350, 'normalBodyWidth' => 555, 'bAllowPhp' => false, 'limitPhpAccess' => false, 'showTaskbars' => false, 'showNodeNavi' => false, 'askBeforeUnloadPage' => true, 'bbCode' => false, 'siteId' => SITE_ID, 'autoResize' => true, 'autoResizeOffset' => 40, 'saveOnBlur' => true, 'controlsMap' => array(array('id' => 'Bold', 'compact' => true, 'sort' => 80), array('id' => 'Italic', 'compact' => true, 'sort' => 90), array('id' => 'Underline', 'compact' => true, 'sort' => 100), array('id' => 'Strikeout', 'compact' => true, 'sort' => 110), array('id' => 'RemoveFormat', 'compact' => true, 'sort' => 120), array('id' => 'Color', 'compact' => true, 'sort' => 130), array('id' => 'FontSelector', 'compact' => false, 'sort' => 135), array('id' => 'FontSize', 'compact' => false, 'sort' => 140), array('separator' => true, 'compact' => false, 'sort' => 145), array('id' => 'OrderedList', 'compact' => true, 'sort' => 150), array('id' => 'UnorderedList', 'compact' => true, 'sort' => 160), array('id' => 'AlignList', 'compact' => false, 'sort' => 190), array('separator' => true, 'compact' => false, 'sort' => 200), array('id' => 'InsertLink', 'compact' => true, 'sort' => 210, 'wrap' => 'bx-b-link-' . $fieldNameId), array('id' => 'InsertImage', 'compact' => false, 'sort' => 220), array('id' => 'InsertVideo', 'compact' => true, 'sort' => 230, 'wrap' => 'bx-b-video-' . $fieldNameId), array('id' => 'InsertTable', 'compact' => false, 'sort' => 250), array('id' => 'Code', 'compact' => true, 'sort' => 260), array('id' => 'Quote', 'compact' => true, 'sort' => 270, 'wrap' => 'bx-b-quote-' . $fieldNameId), array('id' => 'Smile', 'compact' => false, 'sort' => 280), array('separator' => true, 'compact' => false, 'sort' => 290), array('id' => 'Fullscreen', 'compact' => false, 'sort' => 310), array('id' => 'BbCode', 'compact' => true, 'sort' => 340), array('id' => 'More', 'compact' => true, 'sort' => 400))), array('name' => $fieldNameName, 'inputName' => $fieldNameName, 'id' => $fieldNameId, 'width' => '100%', 'content' => htmlspecialcharsBack($value)));
                            $editor->show($res);
                        } else {
                            ?>
<textarea rows="5" cols="40" id="<?php 
                            echo $fieldNameId;
                            ?>
" name="<?php 
                            echo $fieldNameName;
                            ?>
"><?php 
                            echo htmlspecialcharsbx($value);
                            ?>
</textarea><?php 
                        }
                    } else {
                        $value1 = $value;
                        if ($allowSelection && \CBPDocument::IsExpression(trim($value1))) {
                            $value1 = null;
                        } else {
                            unset($fieldValueTmp[$key]);
                        }
                        if ($fieldType["Type"] == "S:employee" && COption::getOptionString("bizproc", "employee_compatible_mode", "N") != "Y") {
                            $value1 = CBPHelper::stripUserPrefix($value1);
                        }
                        echo call_user_func_array($customMethodName, array(array("LINK_IBLOCK_ID" => $fieldType["Options"]), array("VALUE" => $value1), array("FORM_NAME" => $fieldName["Form"], "VALUE" => $fieldNameName), true));
                    }
                } else {
                    switch ($fieldType["Type"]) {
                        case "int":
                        case "double":
                            unset($fieldValueTmp[$key]);
                            ?>
<input type="text" size="10" id="<?php 
                            echo $fieldNameId;
                            ?>
" name="<?php 
                            echo $fieldNameName;
                            ?>
" value="<?php 
                            echo htmlspecialcharsbx($value);
                            ?>
"><?php 
                            break;
                        case "file":
                            if ($publicMode) {
                                //unset($fieldValueTmp[$key]);
                                ?>
<input type="file" id="<?php 
                                echo $fieldNameId;
                                ?>
" name="<?php 
                                echo $fieldNameName;
                                ?>
"><?php 
                            }
                            break;
                        case "bool":
                            if (in_array($value, array("Y", "N"))) {
                                unset($fieldValueTmp[$key]);
                            }
                            ?>
							<select id="<?php 
                            echo $fieldNameId;
                            ?>
" name="<?php 
                            echo $fieldNameName;
                            ?>
">
								<?php 
                            if (!$fieldType["Required"]) {
                                echo '<option value="">[' . GetMessage("BPCGHLP_NOT_SET") . ']</option>';
                            }
                            ?>
								<option value="Y"<?php 
                            echo in_array("Y", $fieldValue) ? ' selected' : '';
                            ?>
><?php 
                            echo GetMessage("BPCGHLP_YES");
                            ?>
</option>
								<option value="N"<?php 
                            echo in_array("N", $fieldValue) ? ' selected' : '';
                            ?>
><?php 
                            echo GetMessage("BPCGHLP_NO");
                            ?>
</option>
							</select>
							<?php 
                            break;
                        case "text":
                            unset($fieldValueTmp[$key]);
                            ?>
<textarea rows="5" cols="40" id="<?php 
                            echo $fieldNameId;
                            ?>
" name="<?php 
                            echo $fieldNameName;
                            ?>
"><?php 
                            echo htmlspecialcharsbx($value);
                            ?>
</textarea><?php 
                            break;
                        case "date":
                        case "datetime":
                            if (defined("ADMIN_SECTION") && ADMIN_SECTION) {
                                $v = "";
                                if (!\CBPDocument::IsExpression(trim($value))) {
                                    $v = $value;
                                    unset($fieldValueTmp[$key]);
                                }
                                require_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/interface/init_admin.php";
                                echo CAdminCalendar::calendarDate($fieldNameName, $v, 19, $fieldType["Type"] != "date");
                            } else {
                                $value1 = $value;
                                if ($allowSelection && \CBPDocument::IsExpression(trim($value1))) {
                                    $value1 = null;
                                } else {
                                    unset($fieldValueTmp[$key]);
                                }
                                if ($fieldType["Type"] == "date") {
                                    $type = "Date";
                                } else {
                                    $type = "DateTime";
                                }
                                $ar = CIBlockProperty::getUserType($type);
                                echo call_user_func_array($ar["GetPublicEditHTML"], array(array("LINK_IBLOCK_ID" => $fieldType["Options"]), array("VALUE" => $value1), array("FORM_NAME" => $fieldName["Form"], "VALUE" => $fieldNameName), true));
                            }
                            break;
                        default:
                            unset($fieldValueTmp[$key]);
                            ?>
<input type="text" size="40" id="<?php 
                            echo $fieldNameId;
                            ?>
" name="<?php 
                            echo $fieldNameName;
                            ?>
" value="<?php 
                            echo htmlspecialcharsbx($value);
                            ?>
"><?php 
                    }
                }
                if ($allowSelection) {
                    if (!in_array($fieldType["Type"], array("file", "bool", "date", "datetime")) && (is_array($customMethodName) && count($customMethodName) <= 0 || !is_array($customMethodName) && strlen($customMethodName) <= 0)) {
                        ?>
<input type="button" value="..." onclick="BPAShowSelector('<?php 
                        echo $fieldNameId;
                        ?>
', '<?php 
                        echo htmlspecialcharsbx($fieldType["BaseType"]);
                        ?>
');"><?php 
                    }
                }
                if ($fieldType["Multiple"]) {
                    echo '</td></tr>';
                }
            }
            if ($fieldType["Multiple"]) {
                echo "</table>";
            }
            if ($fieldType["Multiple"] && $fieldType["Type"] != "S:HTML" && ($fieldType["Type"] != "file" || $publicMode)) {
                echo '<input type="button" value="' . GetMessage("BPCGHLP_ADD") . '" onclick="CBPVirtualDocumentCloneRow(\'CBPVirtualDocument_' . $fieldName["Field"] . '_Table\')"/><br />';
            } elseif ($fieldType["Multiple"] && $fieldType["Type"] == "S:HTML") {
                $functionOnclick = 'CBPVirtualDocumentCloneRow(\'CBPVirtualDocument_' . $fieldName["Field"] . '_Table\');createAdditionalHtmlEditor(\'CBPVirtualDocument_' . $fieldName["Field"] . '_Table\');';
                echo '<input type="button" value="' . GetMessage("BPCGHLP_ADD") . '" onclick="' . $functionOnclick . '"/><br />';
            }
            if ($allowSelection) {
                if (in_array($fieldType["Type"], array("file", "bool", "date", "datetime")) || (is_array($customMethodName) && count($customMethodName) > 0 || !is_array($customMethodName) && strlen($customMethodName) > 0)) {
                    ?>
					<input type="text" id="id_<?php 
                    echo htmlspecialcharsbx($fieldName["Field"]);
                    ?>
_text" name="<?php 
                    echo htmlspecialcharsbx($fieldName["Field"]);
                    ?>
_text" value="<?php 
                    if (count($fieldValueTmp) > 0) {
                        $a = array_values($fieldValueTmp);
                        echo htmlspecialcharsbx($a[0]);
                    }
                    ?>
">
					<input type="button" value="..." onclick="BPAShowSelector('id_<?php 
                    echo htmlspecialcharsbx($fieldName["Field"]);
                    ?>
_text', '<?php 
                    echo htmlspecialcharsbx($fieldType["BaseType"]);
                    ?>
', '<?php 
                    echo $fieldType["Type"] == 'S:employee' ? 'employee' : '';
                    ?>
');">
				<?php 
                }
            }
        }
        $s = ob_get_contents();
        ob_end_clean();
        return $s;
    }
Ejemplo n.º 4
0
	public static function GetComponents($Params, $bClearCache = false)
	{
		global $CACHE_MANAGER;

		$allowed = trim(COption::GetOptionString('fileman', "~allowed_components", ''));
		$mask = $allowed === '' ? 0 : substr(md5($allowed), 0, 10);

		$lang = isset($Params['lang']) ? $Params['lang'] : LANGUAGE_ID;
		$cache_name = 'component_tree_array_'.$lang.'_'.$mask;
		$table_id = "fileman_component_tree";

		if ($bClearCache)
		{
			$CACHE_MANAGER->CleanDir($table_id);
		}

		if($CACHE_MANAGER->Read(self::CACHE_TIME, $cache_name, $table_id))
		{
			self::$arComponents = $CACHE_MANAGER->Get($cache_name);
		}

		if (empty(self::$arComponents))
		{
			// Name filter exists
			if ($allowed !== '')
			{
				$arAC = explode("\n", $allowed);
				$arAC = array_unique($arAC);
				$arAllowed = Array();
				foreach ($arAC as $f)
				{
					$f = preg_replace("/\s/is", "", $f);
					$f = preg_replace("/\./is", "\\.", $f);
					$f = preg_replace("/\*/is", ".*", $f);
					$arAllowed[] = '/^'.$f.'$/';
				}
				$namespace = 'bitrix';
			}
			else
			{
				$arAllowed = false;
				$namespace = false;
			}

			$arTree = CComponentUtil::GetComponentsTree($namespace, $arAllowed);
			self::$arComponents = array(
				'items' => array(),
				'groups' => array()
			);
			self::$thirdLevelId = 0;

			if (isset($arTree['#']))
			{
				self::_HandleComponentElement($arTree['#'], '');
			}

			$CACHE_MANAGER->Set($cache_name, self::$arComponents);
		}

		return self::$arComponents;
	}
Ejemplo n.º 5
0
             $description = intval($propertyID) > 0 ? $arResult["ELEMENT_PROPERTIES"][$propertyID][$i]["DESCRIPTION"] : "";
         } elseif ($i == 0) {
             $value = intval($propertyID) <= 0 ? "" : $arResult["PROPERTY_LIST_FULL"][$propertyID]["DEFAULT_VALUE"];
             $description = "";
         } else {
             $value = "";
             $description = "";
         }
         echo call_user_func_array($arResult["PROPERTY_LIST_FULL"][$propertyID]["GetPublicEditHTML"], array($arResult["PROPERTY_LIST_FULL"][$propertyID], array("VALUE" => $value, "DESCRIPTION" => $description), array("VALUE" => "PROPERTY[" . $propertyID . "][" . $i . "][VALUE]", "DESCRIPTION" => "PROPERTY[" . $propertyID . "][" . $i . "][DESCRIPTION]", "FORM_NAME" => "iblock_add")));
     }
     break;
 case "TAGS":
     $APPLICATION->IncludeComponent("bitrix:search.tags.input", "", array("VALUE" => $arResult["ELEMENT"][$propertyID], "NAME" => "PROPERTY[" . $propertyID . "][0]", "TEXT" => 'size="' . $arResult["PROPERTY_LIST_FULL"][$propertyID]["COL_COUNT"] . '"'), null, array("HIDE_ICONS" => "Y"));
     break;
 case "HTML":
     $LHE = new CHTMLEditor();
     $LHE->Show(array('name' => "PROPERTY[" . $propertyID . "][0]", 'id' => preg_replace("/[^a-z0-9]/i", '', "PROPERTY[" . $propertyID . "][0]"), 'inputName' => "PROPERTY[" . $propertyID . "][0]", 'content' => $arResult["ELEMENT"][$propertyID], 'width' => '100%', 'minBodyWidth' => 350, 'normalBodyWidth' => 555, 'height' => '200', 'bAllowPhp' => false, 'limitPhpAccess' => false, 'autoResize' => true, 'autoResizeOffset' => 40, 'useFileDialogs' => false, 'saveOnBlur' => true, 'showTaskbars' => false, 'showNodeNavi' => false, 'askBeforeUnloadPage' => true, 'bbCode' => false, 'siteId' => SITE_ID, 'controlsMap' => array(array('id' => 'Bold', 'compact' => true, 'sort' => 80), array('id' => 'Italic', 'compact' => true, 'sort' => 90), array('id' => 'Underline', 'compact' => true, 'sort' => 100), array('id' => 'Strikeout', 'compact' => true, 'sort' => 110), array('id' => 'RemoveFormat', 'compact' => true, 'sort' => 120), array('id' => 'Color', 'compact' => true, 'sort' => 130), array('id' => 'FontSelector', 'compact' => false, 'sort' => 135), array('id' => 'FontSize', 'compact' => false, 'sort' => 140), array('separator' => true, 'compact' => false, 'sort' => 145), array('id' => 'OrderedList', 'compact' => true, 'sort' => 150), array('id' => 'UnorderedList', 'compact' => true, 'sort' => 160), array('id' => 'AlignList', 'compact' => false, 'sort' => 190), array('separator' => true, 'compact' => false, 'sort' => 200), array('id' => 'InsertLink', 'compact' => true, 'sort' => 210), array('id' => 'InsertImage', 'compact' => false, 'sort' => 220), array('id' => 'InsertVideo', 'compact' => true, 'sort' => 230), array('id' => 'InsertTable', 'compact' => false, 'sort' => 250), array('separator' => true, 'compact' => false, 'sort' => 290), array('id' => 'Fullscreen', 'compact' => false, 'sort' => 310), array('id' => 'More', 'compact' => true, 'sort' => 400))));
     break;
 case "T":
     for ($i = 0; $i < $inputNum; $i++) {
         if ($arParams["ID"] > 0 || count($arResult["ERRORS"]) > 0) {
             $value = intval($propertyID) > 0 ? $arResult["ELEMENT_PROPERTIES"][$propertyID][$i]["VALUE"] : $arResult["ELEMENT"][$propertyID];
         } elseif ($i == 0) {
             $value = intval($propertyID) > 0 ? "" : $arResult["PROPERTY_LIST_FULL"][$propertyID]["DEFAULT_VALUE"];
         } else {
             $value = "";
         }
         ?>
             <textarea class="questInput" name="PROPERTY[<?php 
         echo $propertyID;
         ?>
Ejemplo n.º 6
0
    function ShowHTMLEditControl($name, $content, $arParams = array())
    {
        global $USER;
        // We have to avoid of showing HTML-editor with probably unsecure content when loosing the session [mantis:#0007986]
        if ($_SERVER["REQUEST_METHOD"] == "POST" && !check_bitrix_sessid()) {
            return;
        }
        CUtil::InitJSCore(array('window', 'ajax'));
        $relPath = isset($arParams["path"]) ? $arParams["path"] : "/";
        $site = isset($arParams["site"]) ? $arParams["site"] : "";
        $__path = Rel2Abs("/", $relPath);
        $site = CFileMan::__CheckSite($site);
        $name = preg_replace("/[^a-zA-Z0-9_:\\.]/is", "", $name);
        if (!isset($arParams["limit_php_access"])) {
            $arParams["limit_php_access"] = false;
        }
        $arParams["light_mode"] = defined('BX_PUBLIC_MODE') && BX_PUBLIC_MODE == 1 || isset($arParams["light_mode"]) && $arParams["light_mode"] == 'Y';
        $io = CBXVirtualIo::GetInstance();
        $direction_rtl = false;
        if ($site) {
            $DOC_ROOT = CSite::GetSiteDocRoot($site);
            $abs_path = $DOC_ROOT . $__path;
            if ($io->FileExists($abs_path)) {
                $relPath = substr($relPath, 0, strrpos($relPath, "/"));
                if ($relPath == "") {
                    $relPath = "/";
                }
            }
        }
        static $bFirstUsed;
        $template = $arParams["templateID"];
        if (!isset($template) && defined('SITE_TEMPLATE_ID')) {
            $template = SITE_TEMPLATE_ID;
        }
        if (!isset($template) && isset($_GET['siteTemplateId'])) {
            $template = $_GET['siteTemplateId'];
        }
        if (!isset($template) && isset($site)) {
            $dbSiteRes = CSite::GetTemplateList($site);
            $SITE_TEMPLATE = array();
            while ($arSiteRes = $dbSiteRes->Fetch()) {
                if ($arSiteRes['CONDITION'] == "" || !isset($template)) {
                    $template = $arSiteRes['TEMPLATE'];
                }
            }
        }
        if (isset($arParams['use_editor_3'])) {
            $useEditor3 = $arParams['use_editor_3'] == "Y";
        } else {
            $useEditor3 = COption::GetOptionString('fileman', "use_editor_3", "Y") == "Y";
        }
        if ($useEditor3) {
            $Editor = new CHTMLEditor();
            $Editor->Show(array('name' => $name, 'id' => $name, 'siteId' => $arParams["site"], 'width' => $arParams["width"], 'height' => $arParams["height"], 'content' => $content, 'bAllowPhp' => !$arParams["bWithoutPHP"] && $USER->CanDoOperation('edit_php'), "limitPhpAccess" => $arParams["limit_php_access"], "display" => $arParams['bDisplay'], "componentFilter" => isset($arParams['componentFilter']) ? $arParams['componentFilter'] : false, "setFocusAfterShow" => isset($arParams['setFocusAfterShow']) ? $arParams['setFocusAfterShow'] : true, "relPath" => $relPath, "templateId" => $template));
            return;
        }
        //Taskbars
        $arTaskbars = isset($arParams["arTaskbars"]) ? $arParams["arTaskbars"] : array();
        //Toolbars
        $arToolbars = isset($arParams["arToolbars"]) ? $arParams["arToolbars"] : false;
        // Toolbar config
        $arParams["toolbarConfig"] = is_array($arParams["toolbarConfig"]) ? $arParams["toolbarConfig"] : false;
        $arParams["use_advanced_php_parser"] = COption::GetOptionString("fileman", "use_advanced_php_parser", "Y");
        $arParams["ar_entities"] = COption::GetOptionString("fileman", "ar_entities", 'umlya,greek,other');
        if ($arParams["ar_entities"] == 'none') {
            $arParams["ar_entities"] = '';
        }
        if (!isset($arParams["usePspell"])) {
            $arParams["usePspell"] = COption::GetOptionString("fileman", "use_pspell", "N");
        }
        if (!isset($arParams["useCustomSpell"])) {
            $arParams["useCustomSpell"] = COption::GetOptionString("fileman", "use_custom_spell", "Y");
        }
        $arParams['allowRenderComp2'] = COption::GetOptionString('fileman', "allow_render_components", "N") == 'Y';
        $arParams['renderComponents'] = $arParams['allowRenderComp2'] && CUserOptions::GetOption('fileman', "render_components", "Y") == 'Y';
        $lca = COption::GetOptionString("fileman", "use_lca", "N");
        $styleList_render_style = COption::GetOptionString("fileman", "render_styles_in_classlist", "Y") == 'Y' ? 'true' : 'false';
        $arAdditionalParams = isset($arParams["arAdditionalParams"]) ? $arParams["arAdditionalParams"] : array();
        $arResult = CFileman::GetAllTemplateParams($template, $site, $arParams["bWithoutPHP"] != true, $arAdditionalParams);
        $arParams["TEMPLATE"] = $arResult;
        if ($bUseOnlyDefinedStyles && !is_set($arResult, "STYLES_TITLE")) {
            $bUseOnlyDefinedStyles = false;
        }
        $arParams["body_class"] = COption::GetOptionString("fileman", "editor_body_class", "");
        $arParams["body_id"] = COption::GetOptionString("fileman", "editor_body_id", "");
        ?>
		<script bxrunfirst="true">
			var relPath = "<?php 
        echo CUtil::JSEscape($relPath);
        ?>
";
			var <?php 
        echo 'ar_' . $name . '_taskbars';
        ?>
 = {};
			<?php 
        for ($k = 0, $l = count($arTaskbars); $k < $l; $k++) {
            echo 'ar_' . $name . '_taskbars["' . $arTaskbars[$k] . '"] = true;';
        }
        if ($arToolbars !== false) {
            echo 'var  ar_' . $name . '_toolbars = {};';
            for ($k = 0, $l = count($arToolbars); $k < $l; $k++) {
                echo 'ar_' . $name . '_toolbars["' . $arToolbars[$k] . '"] = true;';
            }
        } else {
            echo 'var  ar_' . $name . '_toolbars = false;';
        }
        ?>

			window.ar_<?php 
        echo $name;
        ?>
_config = <?php 
        echo CUtil::PhpToJSObject($arParams);
        ?>
; // editor-config
		</script>
		<?php 
        $str_taskbars = "";
        CFileman::GetHTMLEditorSettings($name, $arParams["light_mode"], $arTaskbars, $str_taskbars);
        $str_taskbars .= '_' . CFileman::GetVersion();
        if (!$bFirstUsed) {
            $arTemplates = array(array('value' => '.default', 'name' => GetMessage("FILEMAN_DEFTEMPL")));
            $db_site_templates = CSiteTemplate::GetList(array(), array(), array());
            while ($ar_site_templates = $db_site_templates->Fetch()) {
                $arTemplates[] = array('value' => $ar_site_templates['ID'], 'name' => $ar_site_templates['NAME']);
            }
            ?>
			<script bxrunfirst="true">
				var
					arBXTemplates = <?php 
            echo CUtil::PhpToJSObject($arTemplates);
            ?>
,
					BXSite = "<?php 
            echo CUtil::JSEscape($site);
            ?>
",
					BXLang = "<?php 
            echo CUtil::JSEscape(LANGUAGE_ID);
            ?>
",
					styleList_render_style = <?php 
            echo $styleList_render_style;
            ?>
,
					limit_php_access = <?php 
            echo $arParams["limit_php_access"] ? 'true' : 'false';
            ?>
,
					lca = <?php 
            echo $lca == 'Y' ? 'true' : 'false';
            ?>
,
					lightMode = <?php 
            echo $arParams["light_mode"] ? 'true' : 'false';
            ?>
,
					BX_PERSONAL_ROOT = "<?php 
            echo BX_PERSONAL_ROOT;
            ?>
";

				window.limit_php_access = top.limit_php_access = limit_php_access;
				window.lightMode = top.lightMode = lightMode;
				window.lca = top.lca = lca;
				window.BXLang = top.BXLang = BXLang;
				window.BXSite = top.BXSite = BXSite;
				window.BX_PERSONAL_ROOT = top.BX_PERSONAL_ROOT = BX_PERSONAL_ROOT;
			</script>
			<?php 
            $arJS = array();
            $arCSS = array();
            $events = GetModuleEvents("fileman", "OnBeforeHTMLEditorScriptsGet");
            while ($arEvent = $events->Fetch()) {
                $tmp = ExecuteModuleEventEx($arEvent, array($name, $arParams));
                if (!is_array($tmp)) {
                    continue;
                }
                if (is_array($tmp['JS'])) {
                    $arJS = array_merge($arJS, $tmp['JS']);
                }
                if (is_array($tmp['CSS'])) {
                    $arCSS = array_merge($arCSS, $tmp['CSS']);
                }
            }
            $arr = array();
            // Additional JS files from event OnBeforeHtmlEditorScriptGet
            for ($i = 0, $c = count($arJS); $i < $c; $i++) {
                $arJS[$i] = preg_replace("/[^a-zA-Z0-9_:\\.]/is", "", $arJS[$i]);
                if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/admin/htmleditor2/' . $arJS[$i])) {
                    $arr[] = $arJS[$i];
                }
            }
            ?>
			<script type="text/javascript" src="/bitrix/admin/fileman_js.php?lang=<?php 
            echo LANGUAGE_ID;
            ?>
&v=<?php 
            echo @filemtime($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/fileman/lang/' . LANGUAGE_ID . '/admin/fileman_js.php');
            ?>
"></script>
			<script type="text/javascript" src="/bitrix/admin/fileman_common_js.php?s=<?php 
            echo $str_taskbars;
            ?>
"></script>
			<?php 
            for ($i = 0, $l = count($arr); $i < $l; $i++) {
                $script_filename = $arr[$i];
                ?>
<script type="text/javascript" src="/bitrix/admin/htmleditor2/<?php 
                echo $script_filename;
                ?>
?v=<?php 
                echo @filemtime($_SERVER['DOCUMENT_ROOT'] . '/bitrix/admin/htmleditor2/' . $script_filename);
                ?>
"></script><?php 
            }
            ?>
			<script type="text/javascript" src="/bitrix/js/main/popup_menu.js?v=<?php 
            echo @filemtime($_SERVER['DOCUMENT_ROOT'] . '/bitrix/js/main/popup_menu.js');
            ?>
"></script>
			<?php 
            for ($i = 0, $l = count($arCSS); $i < $l; $i++) {
                $arCSS[$i] = preg_replace("/[^a-zA-Z0-9_:\\.]/is", "", $arCSS[$i]);
                if (!file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/admin/htmleditor2/' . $arCSS[$i])) {
                    continue;
                }
                ?>
<link rel="stylesheet" type="text/css" href="/bitrix/admin/htmleditor2/<?php 
                echo $arCSS[$i];
                ?>
?v=<?php 
                echo @filemtime($_SERVER['DOCUMENT_ROOT'] . '/bitrix/admin/htmleditor2/' . $arCSS[$i]);
                ?>
"/><?php 
            }
            $db_events = GetModuleEvents("fileman", "OnIncludeHTMLEditorScript");
            while ($arEvent = $db_events->Fetch()) {
                ExecuteModuleEventEx($arEvent);
            }
            $bFirstUsed = true;
        }
        ?>
		<div class="bxedmain-cont" id="<?php 
        echo $name . '_object';
        ?>
"><table id="<?php 
        echo $name;
        ?>
_pFrame" class="bxedmainframe dim100x100" style="display:none;">
				<tr style="height: 1%;"><td id="<?php 
        echo $name;
        ?>
_toolBarSet0" colspan="2" style="width: 100%; display: none; border-bottom: 1px solid #808080 !important;"></td></tr>
				<tr>
					<td id="<?php 
        echo $name;
        ?>
_toolBarSet1" style="width:0%; display: none; border-right: 1px solid #808080 !important;"></td>
					<td vAlign="top" style="width: 4000px; padding: 0!important;">
						<table class="dim100x100">
							<tr>
								<td class="bx-ceditor" id="<?php 
        echo $name;
        ?>
_cEditor"></td>
								<td id="<?php 
        echo $name;
        ?>
_taskBarSet2" class="bxedtaskbarset" style="width:0%; display: none;">
									<table>
										<tr><td class="bx-move-col-v" rowSpan="3"><img src="/bitrix/images/1.gif" /></td><td style="height:26px;"></td></tr>
										<tr><td style="vertical-align: top;"></td></tr>
										<tr><td class="bx-taskbar-tabs"></td></tr>
									</table>
								</td>
							</tr>
							<tr style="height:0%; display: none;">
								<td id="<?php 
        echo $name;
        ?>
_taskBarSet3" colspan="2">
									<table>
										<tr><td class="bx-move-col-h"><img src="/bitrix/images/1.gif" /></td></tr>
										<tr><td style="height:26px;"></td></tr>
										<tr><td style="vertical-align: top; background: #F4F4F4 none !important;"></td></tr>
										<tr><td class="bx-taskbar-tabs"></td></tr>
									</table>
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr id="bx-css-tt"><td id="<?php 
        echo $name;
        ?>
_taskBarTabs" colspan="2" class="tasktabcell"></td></tr>
			</table>
		</div>
		<script>
			BX.loadCSS('/bitrix/admin/htmleditor2/editor.css');
			var bEd = BX("bxed_<?php 
        echo $name;
        ?>
_editor");
			if (bEd && !bEd.checked)
				BX("<?php 
        echo $name;
        ?>
_object").style.display = "none";
		</script>
		<?php 
        if (!$arParams["bFromTextarea"]) {
            echo '<input type="hidden" name="' . $name . '" id="bxed_' . $name . '" value="' . htmlspecialcharsbx($content) . '">';
        }
        if ($arParams["bDisplay"] !== false) {
            setEditorEventHandlers($name);
            ?>
			<script>
				BX.ready(function(){
					BX.showWait();
					BX("bxed_<?php 
            echo $name;
            ?>
").pMainObj  = new BXHTMLEditor("<?php 
            echo $name;
            ?>
");
				});
			</script>
		<?php 
        }
    }
Ejemplo n.º 7
0
								<?php 
    echo ShowError('Cannot include fileman module');
    ?>
							<?php 
} else {
    ?>

								<?php 
    // check if we use BBCODE
    $bbCode = $arData['DESCRIPTION_IN_BBCODE'] === 'Y';
    if ($bbCode) {
        $rawDescription = $arData['META:DESCRIPTION_FOR_BBCODE'];
    } else {
        $rawDescription = $arData['DESCRIPTION'];
    }
    $Editor = new CHTMLEditor();
    $res = array_merge(array('minBodyWidth' => 350, 'minBodyHeight' => 200, 'normalBodyWidth' => 555, 'bAllowPhp' => false, 'limitPhpAccess' => false, 'showTaskbars' => false, 'showNodeNavi' => false, 'askBeforeUnloadPage' => true, 'bbCode' => $bbCode, 'siteId' => SITE_ID, 'autoResize' => true, 'autoResizeOffset' => 40, 'saveOnBlur' => true, 'setFocusAfterShow' => false, 'controlsMap' => array(array('id' => 'Bold', 'compact' => true, 'sort' => 80), array('id' => 'Italic', 'compact' => true, 'sort' => 90), array('id' => 'Underline', 'compact' => true, 'sort' => 100), array('id' => 'Strikeout', 'compact' => true, 'sort' => 110), array('id' => 'RemoveFormat', 'compact' => true, 'sort' => 120), array('id' => 'Color', 'compact' => true, 'sort' => 130), array('id' => 'FontSelector', 'compact' => false, 'sort' => 135), array('id' => 'FontSize', 'compact' => false, 'sort' => 140), array('separator' => true, 'compact' => false, 'sort' => 145), array('id' => 'OrderedList', 'compact' => true, 'sort' => 150), array('id' => 'UnorderedList', 'compact' => true, 'sort' => 160), array('id' => 'AlignList', 'compact' => false, 'sort' => 190), array('separator' => true, 'compact' => false, 'sort' => 200), array('id' => 'InsertLink', 'compact' => true, 'sort' => 210), array('id' => 'InsertImage', 'compact' => false, 'sort' => 220), array('id' => 'InsertVideo', 'compact' => true, 'sort' => 230), array('id' => 'InsertTable', 'compact' => false, 'sort' => 250), array('id' => 'Code', 'compact' => true, 'sort' => 260), array('id' => 'Quote', 'compact' => true, 'sort' => 270), array('separator' => true, 'compact' => false, 'sort' => 290), array('id' => 'Fullscreen', 'compact' => false, 'sort' => 310), array('id' => 'BbCode', 'compact' => true, 'sort' => 340), array('id' => 'More', 'compact' => true, 'sort' => 400))), array('name' => 'DESCRIPTION', 'id' => $taskDescriptionEditorId, 'width' => '100%', 'arSmiles' => array(), 'content' => htmlspecialcharsBack($rawDescription), 'iframeCss' => 'body{font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; font-size: 13px;}' . '.bx-spoiler {border:1px solid #C0C0C0;background-color:#fff4ca;padding: 4px 4px 4px 24px;color:#373737;border-radius:2px;min-height:1em;margin: 0;}'));
    $Editor->Show($res);
    ?>

							<?php 
}
?>
							
						</div>
					</div>
				</div>

				<div class="webform-row task-description-row">
					<?php 
$APPLICATION->IncludeComponent("bitrix:tasks.task.detail.parts", ".default", array('MODE' => 'CREATE TASK FORM', 'BLOCKS' => array("checklist"), 'IS_IFRAME' => $arResult['IS_IFRAME'], 'GROUP_ID' => $arParams['GROUP_ID'], 'PATH_TO_TASKS_TASK' => $arParams['PATH_TO_TASKS_TASK'], 'PATH_TO_USER_PROFILE' => $arParams['PATH_TO_USER_PROFILE'], 'NAME_TEMPLATE' => $arParams['NAME_TEMPLATE'], 'ALLOWED_ACTIONS' => array('ACTION_CHECKLIST_ADD_ITEMS' => true), 'TASK_ID' => $arResult['DATA']['ID'], 'CHECKLIST_ITEMS' => $arResult['DATA']['CHECKLIST_ITEMS']), null, array('HIDE_ICONS' => 'Y'));
Ejemplo n.º 8
0
	obForm.elements.submitbtn.click();
}

function BXSetSessionID(new_sessid)
{
	document.forms.editor_form.sessid.value = new_sessid;
}
</script>

<?
if (!$bDisableEditor)
{
	/* ************* HTML EDITOR 3.0 ************* */
	if ($useEditor3)
	{
		$Editor = new CHTMLEditor;
		$Editor->Show(array(
			'name' => $editor_name,
			'id' => $editor_name,
			'width' => '100%',
			'height' => '490',
			'content' => $filesrc,
			'bAllowPhp' => $USER->CanDoOperation('edit_php'),
			"limitPhpAccess" => $limit_php_access,
			"site" => $site,
			"templateID" => $_REQUEST['templateID'],
		));

		?>
		<script>
			(function() {
Ejemplo n.º 9
0
	public static function GetComponents($Params, $bClearCache = false)
	{
		

		$allowed = trim(COption::GetOptionString('fileman', "~allowed_components", ''));
		$mask = $allowed === '' ? 0 : substr(md5($allowed), 0, 10);

		if (empty(self::$arComponents))
		{
			// Name filter exists
			if ($allowed !== '')
			{
				$arAC = explode("\n", $allowed);
				$arAC = array_unique($arAC);
				$arAllowed = Array();
				foreach ($arAC as $f)
				{
					$f = preg_replace("/\s/is", "", $f);
					$f = preg_replace("/\./is", "\\.", $f);
					$f = preg_replace("/\*/is", ".*", $f);
					$arAllowed[] = '/^'.$f.'$/';
				}
				$namespace = 'freetrix';
			}
			else
			{
				$arAllowed = false;
				$namespace = false;
			}

			$arTree = CComponentUtil::GetComponentsTree($namespace, $arAllowed);
			self::$arComponents = array(
				'items' => array(),
				'groups' => array()
			);
			self::$thirdLevelId = 0;

			if (isset($arTree['#']))
			{
				self::_HandleComponentElement($arTree['#'], '');
			}

		}

		return self::$arComponents;
	}
Ejemplo n.º 10
0
?>
";
		FE_MESS.FILEMAN_HTMLED_MANAGE_TB = "<?php 
echo GetMessage("FILEMAN_HTMLED_MANAGE_TB");
?>
";
		window.bEditProps = <?php 
echo $bEditProps ? 'true' : 'false';
?>
;

		var _bEdit = <?echo ($bEdit) ? 'true' : 'false'; ?>
		</script>
		<?if ($useEditor3):?>
			<?
			$Editor = new CHTMLEditor;
			$Editor->Show(array(
				'name' => 'filesrc',
				'id' => 'filesrc',
				'width' => '100%',
				'height' => '650',
				'content' => $filesrc,
				'bAllowPhp' => $USER->CanDoOperation('edit_php'),
				"limitPhpAccess" => $limit_php_access
			));
			?>
		<?else:?>
			<? CFileman::ShowHTMLEditControl("filesrc", $filesrc, Array(
				"site"=>$site,
				"templateID"=>$templateID,
				"bUseOnlyDefinedStyles"=>COption::GetOptionString("fileman", "show_untitled_styles", "N")!="Y",
<?php

define("NO_KEEP_STATISTIC", "Y");
define("NO_AGENT_STATISTIC", "Y");
define("NO_AGENT_CHECK", true);
define("DisableEventsCheck", true);
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
//$APPLICATION->ShowAjaxHead();
CModule::IncludeModule("fileman");
//if(CModule::IncludeModule("compression"))
//	CCompress::Disable2048Spaces();
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : false;
CHTMLEditor::RequestAction($action);
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_after.php";
Ejemplo n.º 12
0
    public static function getFieldInputControl($documentType, $fieldType, $fieldName, $fieldValue, $allowSelection = false, $publicMode = false)
    {
        global $USER_FIELD_MANAGER, $APPLICATION;
        $storageId = self::getStorageIdByType($documentType);
        if (!$storageId) {
            throw new CBPArgumentNullException('documentType');
        }
        if (!$publicMode) {
            $APPLICATION->showAjaxHead();
        }
        static $documentFieldTypes = array();
        if (!array_key_exists($documentType, $documentFieldTypes)) {
            $documentFieldTypes[$documentType] = self::getDocumentFieldTypes($documentType);
        }
        $fieldType["BaseType"] = "string";
        $fieldType["Complex"] = false;
        if (array_key_exists($fieldType["Type"], $documentFieldTypes[$documentType])) {
            $fieldType["BaseType"] = $documentFieldTypes[$documentType][$fieldType["Type"]]["BaseType"];
            $fieldType["Complex"] = $documentFieldTypes[$documentType][$fieldType["Type"]]["Complex"];
        }
        if (!is_array($fieldValue) || is_array($fieldValue) && CBPHelper::isAssociativeArray($fieldValue)) {
            $fieldValue = array($fieldValue);
        }
        $customMethodName = "";
        $customMethodNameMulty = "";
        if (strpos($fieldType["Type"], ":") !== false) {
            $ar = \CIBlockProperty::getUserType(substr($fieldType["Type"], 2));
            if (array_key_exists("GetPublicEditHTML", $ar)) {
                $customMethodName = $ar["GetPublicEditHTML"];
            }
            if (array_key_exists("GetPublicEditHTMLMulty", $ar)) {
                $customMethodNameMulty = $ar["GetPublicEditHTMLMulty"];
            }
        }
        ob_start();
        if ($fieldType['Type'] == 'select') {
            $fieldValueTmp = $fieldValue;
            ?>
			<select id="id_<?php 
            echo htmlspecialcharsbx($fieldName["Field"]);
            ?>
" style="width:280px" name="<?php 
            echo htmlspecialcharsbx($fieldName["Field"]) . ($fieldType["Multiple"] ? "[]" : "");
            ?>
"<?php 
            echo $fieldType["Multiple"] ? ' size="5" multiple' : '';
            ?>
>
				<?php 
            if (!$fieldType['Required']) {
                echo '<option value="">[' . Loc::getMessage('DISK_FILED_NOT_SET') . ']</option>';
            }
            foreach ($fieldType['Options'] as $k => $v) {
                $ind = array_search($k, $fieldValueTmp);
                echo '<option value="' . htmlspecialcharsbx($k) . '"' . ($ind !== false ? ' selected' : '') . '>' . htmlspecialcharsbx($v) . '</option>';
                if ($ind !== false) {
                    unset($fieldValueTmp[$ind]);
                }
            }
            ?>
			</select>
			<?php 
            if ($allowSelection) {
                ?>
				<br /><input type="text" id="id_<?php 
                echo htmlspecialcharsbx($fieldName['Field']);
                ?>
_text" name="<?php 
                echo htmlspecialcharsbx($fieldName['Field']);
                ?>
_text" value="<?php 
                if (count($fieldValueTmp) > 0) {
                    $a = array_values($fieldValueTmp);
                    echo htmlspecialcharsbx($a[0]);
                }
                ?>
">
				<input type="button" value="..." onclick="BPAShowSelector('id_<?php 
                echo htmlspecialcharsbx($fieldName['Field']);
                ?>
_text', 'select');">
				<?php 
            }
        } elseif ($fieldType['Type'] == 'user' || $fieldType['Type'] == static::getPrefixForCustomType() . 'employee') {
            $fieldValue = CBPHelper::usersArrayToString($fieldValue, null, self::generateDocumentComplexType($storageId));
            ?>
			<input type="text" size="40" id="id_<?php 
            echo htmlspecialcharsbx($fieldName['Field']);
            ?>
" name="<?php 
            echo htmlspecialcharsbx($fieldName['Field']);
            ?>
" value="<?php 
            echo htmlspecialcharsbx($fieldValue);
            ?>
">
			<input type="button" value="..." onclick="BPAShowSelector('id_<?php 
            echo htmlspecialcharsbx($fieldName['Field']);
            ?>
', 'user');"><?php 
        } elseif (strpos($fieldType["Type"], ":") !== false && $fieldType["Multiple"] && (is_array($customMethodNameMulty) && count($customMethodNameMulty) > 0 || !is_array($customMethodNameMulty) && strlen($customMethodNameMulty) > 0)) {
            if (!is_array($fieldValue)) {
                $fieldValue = array();
            }
            if ($allowSelection) {
                $fieldValueTmp1 = array();
                $fieldValueTmp2 = array();
                foreach ($fieldValue as $v) {
                    $vTrim = trim($v);
                    if (preg_match("#^\\{=[a-z0-9_]+:[a-z0-9_]+\\}\$#i", $vTrim) || substr($vTrim, 0, 1) == "=") {
                        $fieldValueTmp1[] = $vTrim;
                    } else {
                        $fieldValueTmp2[] = $v;
                    }
                }
            } else {
                $fieldValueTmp1 = array();
                $fieldValueTmp2 = $fieldValue;
            }
            if ($fieldType["Type"] == "E:EList") {
                static $fl = true;
                if ($fl) {
                    $GLOBALS["APPLICATION"]->addHeadScript('/bitrix/js/iblock/iblock_edit.js');
                }
                $fl = false;
            }
            $fieldValueTmp21 = array();
            foreach ($fieldValueTmp2 as $k => $fld) {
                if ($fld === null || $fld === "") {
                    continue;
                }
                if (is_array($fld) && isset($fld["VALUE"])) {
                    $fieldValueTmp21[$k] = $fld;
                } else {
                    $fieldValueTmp21[$k] = array("VALUE" => $fld);
                }
            }
            $fieldValueTmp2 = $fieldValueTmp21;
            echo call_user_func_array($customMethodNameMulty, array(array("LINK_IBLOCK_ID" => $fieldType["Options"]), $fieldValueTmp2, array("FORM_NAME" => $fieldName["Form"], "VALUE" => htmlspecialcharsbx($fieldName["Field"])), true));
            if ($allowSelection) {
                ?>
				<br /><input type="text" id="id_<?php 
                echo htmlspecialcharsbx($fieldName["Field"]);
                ?>
_text" name="<?php 
                echo htmlspecialcharsbx($fieldName["Field"]);
                ?>
_text" value="<?php 
                if (count($fieldValueTmp1) > 0) {
                    $a = array_values($fieldValueTmp1);
                    echo htmlspecialcharsbx($a[0]);
                }
                ?>
">
				<input type="button" value="..." onclick="BPAShowSelector('id_<?php 
                echo htmlspecialcharsbx($fieldName["Field"]);
                ?>
_text', 'user');">
			<?php 
            }
        } else {
            if (!array_key_exists('CBPVirtualDocumentCloneRowPrinted_' . $documentType, $GLOBALS) && $fieldType['Multiple']) {
                $GLOBALS['CBPVirtualDocumentCloneRowPrinted_' . $documentType] = 1;
                ?>
				<script language="JavaScript">
				function CBPVirtualDocumentCloneRow(tableId)
				{
					var tbl = document.getElementById(tableId);
					var cnt = tbl.rows.length;
					var oRow = tbl.insertRow(cnt);
					var oCell = oRow.insertCell(0);
					var sHTML = tbl.rows[cnt - 1].cells[0].innerHTML;
					var p = 0;
					while (true)
					{
						var s = sHTML.indexOf('[n', p);
						if (s < 0)
							break;
						var e = sHTML.indexOf(']', s);
						if (e < 0)
							break;
						var n = parseInt(sHTML.substr(s + 2, e - s));
						sHTML = sHTML.substr(0, s) + '[n' + (++n) + ']' + sHTML.substr(e + 1);
						p = s + 1;
					}
					var p = 0;
					while (true)
					{
						var s = sHTML.indexOf('__n', p);
						if (s < 0)
							break;
						var e = sHTML.indexOf('_', s + 2);
						if (e < 0)
							break;
						var n = parseInt(sHTML.substr(s + 3, e - s));
						sHTML = sHTML.substr(0, s) + '__n' + (++n) + '_' + sHTML.substr(e + 1);
						p = e + 1;
					}
					oCell.innerHTML = sHTML;
					var patt = new RegExp('<' + 'script' + '>[^\000]*?<' + '\/' + 'script' + '>', 'ig');
					var code = sHTML.match(patt);
					if (code)
					{
						for (var i = 0; i < code.length; i++)
						{
							if (code[i] != '')
							{
								var s = code[i].substring(8, code[i].length - 9);
								BX.evalGlobal(s);
							}
						}
					}
				}
				function CBPVirtualDocumentCloneRowHtml(tableId)
				{
					CBPVirtualDocumentCloneRow(tableId);
					var htmlEditor = BX.findChildrenByClassName(BX(tableId), 'bx-html-editor');
					for(var k in htmlEditor)
					{
						var editorId = htmlEditor[k].getAttribute('id');
						var frameArray = BX.findChildrenByClassName(BX(editorId), 'bx-editor-iframe');
						if(frameArray.length > 1)
						{
							for(var i = 0; i < frameArray.length - 1; i++)
							{
								frameArray[i].parentNode.removeChild(frameArray[i]);
							}
						}

					}
				}
				function createAdditionalHtmlEditor(tableId)
				{
					var tbl = document.getElementById(tableId);
					var cnt = tbl.rows.length-1;
					var name = tableId.replace(/(?:CBPVirtualDocument_)(.*)(?:_Table)/, '$1')
					var idEditor = 'id_'+name+'__n'+cnt+'_';
					var inputNameEditor = name+'[n'+cnt+']';
					window.BXHtmlEditor.Show(
					{
						'id':idEditor,
						'inputName':inputNameEditor,
						'content':'',
						'width':'100%',
						'height':'200',
						'allowPhp':false,
						'limitPhpAccess':false,
						'templates':[],
						'templateId':'',
						'templateParams':[],
						'componentFilter':'',
						'snippets':[],
						'placeholder':'Text here...',
						'actionUrl':'/bitrix/tools/html_editor_action.php',
						'cssIframePath':'/bitrix/js/fileman/html_editor/iframe-style.css?1412693817',
						'bodyClass':'',
						'bodyId':'',
						'spellcheck_path':'/bitrix/js/fileman/html_editor/html-spell.js?v=1412693817',
						'usePspell':'N',
						'useCustomSpell':'Y',
						'bbCode':true,
						'askBeforeUnloadPage':true,
						'settingsKey':'user_settings_1',
						'showComponents':true,
						'showSnippets':true,
						'view':'wysiwyg',
						'splitVertical':false,
						'splitRatio':'1',
						'taskbarShown':false,
						'taskbarWidth':'250',
						'lastSpecialchars':false,
						'cleanEmptySpans':true,
						'lazyLoad':false,
						'showTaskbars':false,
						'showNodeNavi':false,
						'controlsMap':[
							{'id':'Bold','compact':true,'sort':'80'},
							{'id':'Italic','compact':true,'sort':'90'},
							{'id':'Underline','compact':true,'sort':'100'},
							{'id':'Strikeout','compact':true,'sort':'110'},
							{'id':'RemoveFormat','compact':true,'sort':'120'},
							{'id':'Color','compact':true,'sort':'130'},
							{'id':'FontSelector','compact':false,'sort':'135'},
							{'id':'FontSize','compact':false,'sort':'140'},
							{'separator':true,'compact':false,'sort':'145'},
							{'id':'OrderedList','compact':true,'sort':'150'},
							{'id':'UnorderedList','compact':true,'sort':'160'},
							{'id':'AlignList','compact':false,'sort':'190'},
							{'separator':true,'compact':false,'sort':'200'},
							{'id':'InsertLink','compact':true,'sort':'210','wrap':'bx-b-link-'+idEditor},
							{'id':'InsertImage','compact':false,'sort':'220'},
							{'id':'InsertVideo','compact':true,'sort':'230','wrap':'bx-b-video-'+idEditor},
							{'id':'InsertTable','compact':false,'sort':'250'},
							{'id':'Code','compact':true,'sort':'260'},
							{'id':'Quote','compact':true,'sort':'270','wrap':'bx-b-quote-'+idEditor},
							{'id':'Smile','compact':false,'sort':'280'},
							{'separator':true,'compact':false,'sort':'290'},
							{'id':'Fullscreen','compact':false,'sort':'310'},
							{'id':'BbCode','compact':true,'sort':'340'},
							{'id':'More','compact':true,'sort':'400'}],
						'autoResize':true,
						'autoResizeOffset':'40',
						'minBodyWidth':'350',
						'normalBodyWidth':'555'
					});
					var htmlEditor = BX.findChildrenByClassName(BX(tableId), 'bx-html-editor');
					for(var k in htmlEditor)
					{
						var editorId = htmlEditor[k].getAttribute('id');
						var frameArray = BX.findChildrenByClassName(BX(editorId), 'bx-editor-iframe');
						if(frameArray.length > 1)
						{
							for(var i = 0; i < frameArray.length - 1; i++)
							{
								frameArray[i].parentNode.removeChild(frameArray[i]);
							}
						}

					}
				}
				</script>
				<?php 
            }
            if ($fieldType['Multiple']) {
                echo '<table width="100%" border="0" cellpadding="2" cellspacing="2" id="CBPVirtualDocument_' . htmlspecialcharsbx($fieldName["Field"]) . '_Table">';
            }
            $fieldValueTmp = $fieldValue;
            $ind = -1;
            foreach ($fieldValue as $key => $value) {
                $ind++;
                $fieldNameId = 'id_' . htmlspecialcharsbx($fieldName['Field']) . '__n' . $ind . '_';
                $fieldNameName = htmlspecialcharsbx($fieldName['Field']) . ($fieldType['Multiple'] ? '[n' . $ind . ']' : '');
                if ($fieldType['Multiple']) {
                    echo '<tr><td>';
                }
                if (strpos($fieldType['Type'], static::getPrefixForCustomType()) === 0) {
                    $value1 = $value;
                    if ($allowSelection && (preg_match("#^\\{=[a-z0-9_]+:[a-z0-9_]+\\}\$#i", trim($value1)) || substr(trim($value1), 0, 1) == "=")) {
                        $value1 = null;
                    } else {
                        unset($fieldValueTmp[$key]);
                    }
                    $type = str_replace(static::getPrefixForCustomType(), '', $fieldType['Type']);
                    $_REQUEST[$fieldName['Field']] = $value1;
                    $userFieldType = $USER_FIELD_MANAGER->getUserType($type);
                    $userField = array('ENTITY_ID' => 'DISK_FILE_' . $storageId, 'FIELD_NAME' => $fieldName['Field'], 'USER_TYPE_ID' => $type, 'SORT' => 100, 'MULTIPLE' => $fieldType['Multiple'] ? 'Y' : 'N', 'MANDATORY' => $fieldType['Required'] ? 'Y' : 'N', 'EDIT_IN_LIST' => 'Y', 'EDIT_FORM_LABEL' => $userFieldType['DESCRIPTION'], 'VALUE' => $value1, 'USER_TYPE' => $userFieldType, 'SETTINGS' => array());
                    if ($fieldType['Type'] == static::getPrefixForCustomType() . 'iblock_element' || $fieldType['Type'] == static::getPrefixForCustomType() . 'iblock_section' || $fieldType['Type'] == static::getPrefixForCustomType() . 'boolean') {
                        $options = $fieldType['Options'];
                        if (is_string($options)) {
                            $userField['SETTINGS']['IBLOCK_ID'] = $options;
                        } elseif (is_array($options)) {
                            $userField['SETTINGS'] = $options;
                        }
                    }
                    $APPLICATION->includeComponent('bitrix:system.field.edit', $type, array('arUserField' => $userField, 'bVarsFromForm' => true, 'form_name' => $fieldName['Form'], 'FILE_MAX_HEIGHT' => 400, 'FILE_MAX_WIDTH' => 400, 'FILE_SHOW_POPUP' => true), false, array('HIDE_ICONS' => 'Y'));
                } elseif (is_array($customMethodName) && count($customMethodName) > 0 || !is_array($customMethodName) && strlen($customMethodName) > 0) {
                    if ($fieldType['Type'] == static::getPrefixForCustomType() . 'HTML') {
                        if (Loader::includeModule("fileman")) {
                            $editor = new \CHTMLEditor();
                            $res = array_merge(array('height' => 200, 'minBodyWidth' => 350, 'normalBodyWidth' => 555, 'bAllowPhp' => false, 'limitPhpAccess' => false, 'showTaskbars' => false, 'showNodeNavi' => false, 'askBeforeUnloadPage' => true, 'bbCode' => true, 'siteId' => SITE_ID, 'autoResize' => true, 'autoResizeOffset' => 40, 'saveOnBlur' => true, 'controlsMap' => array(array('id' => 'Bold', 'compact' => true, 'sort' => 80), array('id' => 'Italic', 'compact' => true, 'sort' => 90), array('id' => 'Underline', 'compact' => true, 'sort' => 100), array('id' => 'Strikeout', 'compact' => true, 'sort' => 110), array('id' => 'RemoveFormat', 'compact' => true, 'sort' => 120), array('id' => 'Color', 'compact' => true, 'sort' => 130), array('id' => 'FontSelector', 'compact' => false, 'sort' => 135), array('id' => 'FontSize', 'compact' => false, 'sort' => 140), array('separator' => true, 'compact' => false, 'sort' => 145), array('id' => 'OrderedList', 'compact' => true, 'sort' => 150), array('id' => 'UnorderedList', 'compact' => true, 'sort' => 160), array('id' => 'AlignList', 'compact' => false, 'sort' => 190), array('separator' => true, 'compact' => false, 'sort' => 200), array('id' => 'InsertLink', 'compact' => true, 'sort' => 210, 'wrap' => 'bx-b-link-' . $fieldNameId), array('id' => 'InsertImage', 'compact' => false, 'sort' => 220), array('id' => 'InsertVideo', 'compact' => true, 'sort' => 230, 'wrap' => 'bx-b-video-' . $fieldNameId), array('id' => 'InsertTable', 'compact' => false, 'sort' => 250), array('id' => 'Code', 'compact' => true, 'sort' => 260), array('id' => 'Quote', 'compact' => true, 'sort' => 270, 'wrap' => 'bx-b-quote-' . $fieldNameId), array('id' => 'Smile', 'compact' => false, 'sort' => 280), array('separator' => true, 'compact' => false, 'sort' => 290), array('id' => 'Fullscreen', 'compact' => false, 'sort' => 310), array('id' => 'BbCode', 'compact' => true, 'sort' => 340), array('id' => 'More', 'compact' => true, 'sort' => 400))), array('name' => $fieldNameName, 'inputName' => $fieldNameName, 'id' => $fieldNameId, 'width' => '100%', 'content' => htmlspecialcharsBack($value)));
                            $editor->show($res);
                        } else {
                            ?>
<textarea rows="5" cols="40" id="<?php 
                            echo $fieldNameId;
                            ?>
" name="<?php 
                            echo $fieldNameName;
                            ?>
"><?php 
                            echo htmlspecialcharsbx($value);
                            ?>
</textarea><?php 
                        }
                    } else {
                        $value1 = $value;
                        if ($allowSelection && (preg_match("#^\\{=[a-z0-9_]+:[a-z0-9_]+\\}\$#i", trim($value1)) || substr(trim($value1), 0, 1) == "=")) {
                            $value1 = null;
                        } else {
                            unset($fieldValueTmp[$key]);
                        }
                        echo call_user_func_array($customMethodName, array(array("LINK_IBLOCK_ID" => $fieldType["Options"]), array("VALUE" => $value1), array("FORM_NAME" => $fieldName["Form"], "VALUE" => $fieldNameName), true));
                    }
                } else {
                    switch ($fieldType['Type']) {
                        case 'int':
                            unset($fieldValueTmp[$key]);
                            ?>
<input type='text' size='10' id='<?php 
                            echo $fieldNameId;
                            ?>
' name='<?php 
                            echo $fieldNameName;
                            ?>
' value='<?php 
                            echo htmlspecialcharsbx($value);
                            ?>
'><?php 
                            break;
                        case 'file':
                            if ($publicMode) {
                                //unset($fieldValueTmp[$key]);
                                ?>
<input type="file" id="<?php 
                                echo $fieldNameId;
                                ?>
" name="<?php 
                                echo $fieldNameName;
                                ?>
"><?php 
                            }
                            break;
                        case 'bool':
                            if (in_array($value, array('Y', 'N'))) {
                                unset($fieldValueTmp[$key]);
                            }
                            ?>
							<select id='<?php 
                            echo $fieldNameId;
                            ?>
' name='<?php 
                            echo $fieldNameName;
                            ?>
'>
								<?php 
                            if (!$fieldType['Required']) {
                                echo '<option value="">[' . Loc::getMessage("DISK_FILED_NOT_SET") . ']</option>';
                            }
                            ?>
								<option value="Y"<?php 
                            echo in_array("Y", $fieldValue) ? ' selected' : '';
                            ?>
><?php 
                            echo Loc::getMessage("DISK_YES");
                            ?>
</option>
								<option value="N"<?php 
                            echo in_array("N", $fieldValue) ? ' selected' : '';
                            ?>
><?php 
                            echo Loc::getMessage("DISK_NO");
                            ?>
</option>
							</select>
							<?php 
                            break;
                        case "date":
                        case "datetime":
                            $v = "";
                            if (!preg_match("#^\\{=[a-z0-9_]+:[a-z0-9_]+\\}\$#i", trim($value)) && substr(trim($value), 0, 1) != "=") {
                                $v = $value;
                                unset($fieldValueTmp[$key]);
                            }
                            $APPLICATION->includeComponent('bitrix:main.calendar', '', array('SHOW_INPUT' => 'Y', 'FORM_NAME' => $fieldName['Form'], 'INPUT_NAME' => $fieldNameName, 'INPUT_VALUE' => $v, 'SHOW_TIME' => 'Y'), false, array('HIDE_ICONS' => 'Y'));
                            break;
                        case 'text':
                            unset($fieldValueTmp[$key]);
                            ?>
<textarea rows="5" cols="40" id="<?php 
                            echo $fieldNameId;
                            ?>
" name="<?php 
                            echo $fieldNameName;
                            ?>
"><?php 
                            echo htmlspecialcharsbx($value);
                            ?>
</textarea><?php 
                            break;
                        default:
                            unset($fieldValueTmp[$key]);
                            ?>
<input type="text" size="40" id="<?php 
                            echo $fieldNameId;
                            ?>
" name="<?php 
                            echo $fieldNameName;
                            ?>
" value="<?php 
                            echo htmlspecialcharsbx($value);
                            ?>
"><?php 
                    }
                }
                if ($allowSelection) {
                    if (!in_array($fieldType["Type"], array("file", "bool", "date", "datetime", static::getPrefixForCustomType() . "HTML")) && strpos($fieldType['Type'], static::getPrefixForCustomType()) !== 0) {
                        ?>
<input type="button" value="..." onclick="BPAShowSelector('<?php 
                        echo $fieldNameId;
                        ?>
', '<?php 
                        echo $fieldType["BaseType"];
                        ?>
');"><?php 
                    }
                }
                if ($fieldType['Multiple']) {
                    echo '</td></tr>';
                }
            }
            if ($fieldType['Multiple']) {
                echo '</table>';
            }
            if ($fieldType["Multiple"] && $fieldType['Type'] != static::getPrefixForCustomType() . 'HTML' && ($fieldType["Type"] != "file" || $publicMode)) {
                echo '<input type="button" value="' . Loc::getMessage("DISK_ADD") . '" onclick="CBPVirtualDocumentCloneRow(\'CBPVirtualDocument_' . $fieldName["Field"] . '_Table\');"/><br />';
            } elseif ($fieldType["Multiple"] && $fieldType['Type'] == static::getPrefixForCustomType() . 'HTML') {
                $functionOnclick = 'CBPVirtualDocumentCloneRowHtml(\'CBPVirtualDocument_' . $fieldName["Field"] . '_Table\');';
                if (!$publicMode) {
                    $functionOnclick = 'CBPVirtualDocumentCloneRow(\'CBPVirtualDocument_' . $fieldName["Field"] . '_Table\');createAdditionalHtmlEditor(\'CBPVirtualDocument_' . $fieldName["Field"] . '_Table\');';
                }
                echo '<input type="button" value="' . Loc::getMessage("DISK_ADD") . '" onclick="' . $functionOnclick . '"/><br />';
            }
            if ($allowSelection) {
                if (in_array($fieldType['Type'], array('file', 'bool', "date", "datetime")) || strpos($fieldType['Type'], static::getPrefixForCustomType()) === 0) {
                    ?>
					<input type="text" id="id_<?php 
                    echo htmlspecialcharsbx($fieldName["Field"]);
                    ?>
_text" name="<?php 
                    echo htmlspecialcharsbx($fieldName["Field"]);
                    ?>
_text" value="<?php 
                    if (count($fieldValueTmp) > 0) {
                        $a = array_values($fieldValueTmp);
                        echo htmlspecialcharsbx($a[0]);
                    }
                    ?>
">
					<input type="button" value="..." onclick="BPAShowSelector('id_<?php 
                    echo htmlspecialcharsbx($fieldName["Field"]);
                    ?>
_text', '<?php 
                    echo htmlspecialcharsbx($fieldType["BaseType"]);
                    ?>
');">
					<?php 
                }
            }
        }
        $s = ob_get_contents();
        ob_end_clean();
        return $s;
    }
Ejemplo n.º 13
0
 public static function getHtmlEditor($id, $fieldName, $content = '')
 {
     $id = htmlspecialcharsbx($id);
     $fieldName = htmlspecialcharsbx($fieldName);
     $result = '<textarea rows="5" cols="40" id="' . $id . '" name="' . $fieldName . '">' . htmlspecialcharsbx((string) $content) . '</textarea>';
     if (CModule::includeModule("fileman")) {
         $editor = new \CHTMLEditor();
         $res = array('useFileDialogs' => false, 'height' => 200, 'minBodyWidth' => 350, 'normalBodyWidth' => 555, 'bAllowPhp' => false, 'limitPhpAccess' => false, 'showTaskbars' => false, 'showNodeNavi' => false, 'askBeforeUnloadPage' => true, 'bbCode' => false, 'siteId' => SITE_ID, 'autoResize' => true, 'autoResizeOffset' => 40, 'saveOnBlur' => true, 'controlsMap' => array(array('id' => 'Bold', 'compact' => true, 'sort' => 80), array('id' => 'Italic', 'compact' => true, 'sort' => 90), array('id' => 'Underline', 'compact' => true, 'sort' => 100), array('id' => 'Strikeout', 'compact' => true, 'sort' => 110), array('id' => 'RemoveFormat', 'compact' => true, 'sort' => 120), array('id' => 'Color', 'compact' => true, 'sort' => 130), array('id' => 'FontSelector', 'compact' => false, 'sort' => 135), array('id' => 'FontSize', 'compact' => false, 'sort' => 140), array('separator' => true, 'compact' => false, 'sort' => 145), array('id' => 'OrderedList', 'compact' => true, 'sort' => 150), array('id' => 'UnorderedList', 'compact' => true, 'sort' => 160), array('id' => 'AlignList', 'compact' => false, 'sort' => 190), array('separator' => true, 'compact' => false, 'sort' => 200), array('id' => 'InsertLink', 'compact' => true, 'sort' => 210, 'wrap' => 'bx-b-link-' . $id), array('id' => 'InsertImage', 'compact' => false, 'sort' => 220), array('id' => 'InsertVideo', 'compact' => true, 'sort' => 230, 'wrap' => 'bx-b-video-' . $id), array('id' => 'InsertTable', 'compact' => false, 'sort' => 250), array('id' => 'Code', 'compact' => true, 'sort' => 260), array('id' => 'Quote', 'compact' => true, 'sort' => 270, 'wrap' => 'bx-b-quote-' . $id), array('id' => 'Smile', 'compact' => false, 'sort' => 280), array('separator' => true, 'compact' => false, 'sort' => 290), array('id' => 'Fullscreen', 'compact' => false, 'sort' => 310), array('id' => 'BbCode', 'compact' => true, 'sort' => 340), array('id' => 'More', 'compact' => true, 'sort' => 400)), 'name' => $fieldName . '[TEXT]', 'inputName' => $fieldName . '[TEXT]', 'id' => $id, 'width' => '100%', 'content' => htmlspecialcharsback($content));
         ob_start();
         echo '<input type="hidden" name="' . $fieldName . '[TYPE]" value="html">';
         $editor->show($res);
         $result = ob_get_contents();
         ob_end_clean();
     }
     return $result;
 }
Ejemplo n.º 14
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
if (!CModule::IncludeModule("fileman")) {
    return;
}
$Editor = new CHTMLEditor();
$Editor->Show(array_merge(array("height" => 200), is_array($arParams["LHE"]) ? $arParams["LHE"] : array(), array('name' => $arParams["TEXT"]["NAME"], 'id' => $arParams["LHE"]["id"], 'siteId' => 's1', 'width' => '100%', 'content' => htmlspecialcharsBack($arParams["TEXT"]["VALUE"]), 'bAllowPhp' => false, 'limitPhpAccess' => false, 'showTaskbars' => false, 'showNodeNavi' => false, 'askBeforeUnloadPage' => true, 'arSmiles' => $arParams["SMILES"]["VALUE"], 'bbCode' => true, 'autoResize' => true, 'autoResizeOffset' => 40, 'saveOnBlur' => true, 'iframeCss' => 'body{font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; font-size: 13px;}' . '.bx-spoiler {border:1px solid #C0C0C0;background-color:#fff4ca;padding: 4px 4px 4px 24px;color:#373737;border-radius:2px;min-height:1em;margin: 0;}', 'minBodyWidth' => 350, 'normalBodyWidth' => 555, 'controlsMap' => array(array('id' => 'Bold', 'compact' => true, 'sort' => 80), array('id' => 'Italic', 'compact' => true, 'sort' => 90), array('id' => 'Underline', 'compact' => true, 'sort' => 100), array('id' => 'Strikeout', 'compact' => true, 'sort' => 110), array('id' => 'RemoveFormat', 'compact' => true, 'sort' => 120), array('id' => 'Color', 'compact' => true, 'sort' => 130), array('id' => 'FontSelector', 'compact' => false, 'sort' => 135), array('id' => 'FontSize', 'compact' => false, 'sort' => 140), array('separator' => true, 'compact' => false, 'sort' => 145), array('id' => 'OrderedList', 'compact' => true, 'sort' => 150), array('id' => 'UnorderedList', 'compact' => true, 'sort' => 160), array('id' => 'AlignList', 'compact' => false, 'sort' => 190), array('separator' => true, 'compact' => false, 'sort' => 200), array('id' => 'InsertLink', 'compact' => true, 'sort' => 210, 'wrap' => 'bx-b-link-' . $arParams["FORM_ID"]), array('id' => 'InsertImage', 'compact' => false, 'sort' => 220), array('id' => 'InsertVideo', 'compact' => true, 'sort' => 230, 'wrap' => 'bx-b-video-' . $arParams["FORM_ID"]), array('id' => 'InsertTable', 'compact' => false, 'sort' => 250), array('id' => 'Code', 'compact' => true, 'sort' => 260), array('id' => 'Quote', 'compact' => true, 'sort' => 270, 'wrap' => 'bx-b-quote-' . $arParams["FORM_ID"]), array('id' => 'Smile', 'compact' => false, 'sort' => 280), array('separator' => true, 'compact' => false, 'sort' => 290), array('id' => 'Fullscreen', 'compact' => false, 'sort' => 310), array('id' => 'BbCode', 'compact' => true, 'sort' => 340), array('id' => 'More', 'compact' => true, 'sort' => 400)))));