Example #1
0
	function ShowTabButtons()
	{
		/** @global CMain $APPLICATION */
		global $APPLICATION;

		$s = '';
		if (!$this->bPublicMode)
		{
			if ($this->bShowSettings)
			{
				$link = DeleteParam(array("mode"));
				$link = $APPLICATION->GetCurPage()."?mode=settings".($link <> ""? "&".$link:"");

				$aAdditionalMenu = array();

				$aAdditionalMenu[] = array(
					"TEXT"=>GetMessage("admin_lib_menu_settings"),
					"TITLE"=>GetMessage("admin_lib_context_sett_title"),
					"ONCLICK"=>$this->name.".ShowSettings('".htmlspecialcharsex(CUtil::JSEscape($link))."')",
					"GLOBAL_ICON"=>"adm-menu-setting"
				);

				if($this->bCustomFields)
				{
					if(is_array($_SESSION["ADMIN_CUSTOM_FIELDS"]) && array_key_exists($this->name, $_SESSION["ADMIN_CUSTOM_FIELDS"]))
					{
						$aAdditionalMenu[] = array(
							"TEXT" => GetMessage("admin_lib_sett_sett_enable_text"),
							"TITLE" => GetMessage("admin_lib_sett_sett_enable"),
							"ONCLICK" => $this->name.'.EnableSettings();',
							"ICON" => 'custom-fields-on',
						);
					}
					else
					{
						$aAdditionalMenu[] = array(
							"TEXT" => GetMessage("admin_lib_sett_sett_disable_text"),
							"TITLE" => GetMessage("admin_lib_sett_sett_disable"),
							"ONCLICK" => $this->name.'.DisableSettings();',
							"ICON" => 'custom-fields-off'
						);

					}
				}

				if (count($aAdditionalMenu) > 1)
				{
					$sMenuUrl = "BX.adminShowMenu(this, ".htmlspecialcharsbx(CAdminPopup::PhpToJavaScript($aAdditionalMenu)).", {active_class: 'bx-settings-btn-active'});";
					$bCustomFieldsOff = is_array($_SESSION["ADMIN_CUSTOM_FIELDS"]) && array_key_exists($this->name, $_SESSION["ADMIN_CUSTOM_FIELDS"]);

					$s .= '<span id="'.$this->name.'_settings_btn" class="adm-detail-settings adm-detail-settings-arrow'.($bCustomFieldsOff ? '' : ' adm-detail-settings-active').'" onclick="'.$sMenuUrl.'"></span>';
				}
				else
				{
					$s .= '<a class="adm-detail-settings" href="javascript:void(0)" onclick="'.$aAdditionalMenu[0]['ONCLICK'].'"></a>';

				}
			}
		}

		return $s.parent::ShowTabButtons();
	}
Example #2
0
			$i = 0;
			foreach($aRecent as $recent)
			{
				$i++;
				if($i > $nLinks)
					break;

				$aItem = array(
					"TEXT"=>htmlspecialcharsbx($recent["text"]),
					"TITLE"=>($aUserOpt['start_menu_title'] <> 'N'? htmlspecialcharsbx($recent["title"]):''),
					"GLOBAL_ICON"=>htmlspecialcharsbx($recent["icon"]),
					"LINK"=>$recent["url"],
				);

				$aItem["ONCLICK"] = 'BX.admin.startMenuRecent('.CUtil::PhpToJsObject($aItem).')';

				$aPopup[] = $aItem;
			}
		}
	}

	if(empty($aPopup))
		$aPopup[] = array("TEXT"=>GetMessage("get_start_menu_no_data"));

	//generate JavaScript array for popup menu
	echo CAdminPopup::PhpToJavaScript($aPopup);

} //$_REQUEST["mode"]

require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_admin_js.php");
?>
Example #3
0
    public function Display()
    {
        $sDefAction = $sDefTitle = "";
        if (!$this->bEditMode) {
            if (!empty($this->link)) {
                if (true == $this->boolBX) {
                    $sDefAction = $this->pList->getRowAction($this->link);
                } else {
                    $sDefAction = "BX.adminPanel.Redirect([], '" . CUtil::JSEscape($this->link) . "', event);";
                }
                $sDefTitle = $this->title;
            } else {
                foreach ($this->aActions as $action) {
                    if ($action["DEFAULT"] == true) {
                        if (true == $this->boolBX) {
                            $sDefAction = $this->pList->getRowAction(CUtil::addslashes($action["ACTION"]));
                        } else {
                            $sDefAction = $action["ACTION"] ? htmlspecialcharsbx($action["ACTION"]) : "BX.adminPanel.Redirect([], '" . CUtil::JSEscape($action["LINK"]) . "', event)";
                        }
                        $sDefTitle = !empty($action["TITLE"]) ? $action["TITLE"] : $action["TEXT"];
                        break;
                    }
                }
            }
        }
        $sMenuItems = '';
        if (!empty($this->aActions)) {
            $sMenuItems = htmlspecialcharsbx(CAdminPopup::PhpToJavaScript($this->aActions));
        }
        ?>
<tr class="adm-list-table-row<?php 
        echo isset($this->aFeatures["footer"]) && $this->aFeatures["footer"] == true ? ' footer' : '';
        echo $this->bEditMode ? ' adm-table-row-active' : '';
        ?>
"<?php 
        echo $sMenuItems != "" ? ' oncontextmenu="return ' . $sMenuItems . ';"' : '';
        echo $sDefAction != "" ? ' ondblclick="' . $sDefAction . '"' . (!empty($sDefTitle) ? ' title="' . GetMessage("admin_lib_list_double_click") . ' ' . $sDefTitle . '"' : '') : '';
        ?>
>
<?php 
        if (count($this->pList->arActions) > 0 || $this->pList->bCanBeEdited) {
            $check_id = RandString(5);
            ?>
	<td class="adm-list-table-cell adm-list-table-checkbox adm-list-table-checkbox-hover<?php 
            echo $this->bReadOnly ? ' adm-list-table-checkbox-disabled' : '';
            ?>
"><input type="checkbox" class="adm-checkbox adm-designed-checkbox" name="SUB_ID[]" id="<?php 
            echo $this->table_id . "_" . $this->id . "_" . $check_id;
            ?>
" value="<?php 
            echo $this->id;
            ?>
" autocomplete="off" title="<?php 
            echo GetMessage("admin_lib_list_check");
            ?>
"<?php 
            echo $this->bReadOnly ? ' disabled="disabled"' : '';
            echo $this->bEditMode ? ' checked="checked" disabled="disabled"' : '';
            ?>
 /><label class="adm-designed-checkbox-label adm-checkbox" for="<?php 
            echo $this->table_id . "_" . $this->id . "_" . $check_id;
            ?>
"></label></td>
<?php 
        }
        if ($this->pList->bShowActions) {
            if (!empty($this->aActions)) {
                ?>
	<td class="adm-list-table-cell adm-list-table-popup-block" onclick="BX.adminSubList.ShowMenu(this.firstChild, this.parentNode.oncontextmenu(), this.parentNode);"><div class="adm-list-table-popup" title="<?php 
                echo GetMessage("admin_lib_list_actions_title");
                ?>
"></div></td>
<?php 
            } else {
                ?>
	<td class="adm-list-table-cell"></td>
<?php 
            }
        }
        end($this->pList->aVisibleHeaders);
        $last_id = key($this->pList->aVisibleHeaders);
        reset($this->pList->aVisibleHeaders);
        $bVarsFromForm = $this->bEditMode && is_array($this->pList->arUpdateErrorIDs) && in_array($this->id, $this->pList->arUpdateErrorIDs);
        foreach ($this->aHeaders as $id => $header_props) {
            if (!in_array($id, $this->pList->arVisibleColumns)) {
                continue;
            }
            $field = $this->aFields[$id];
            if ($this->bEditMode && isset($field["edit"])) {
                if ($bVarsFromForm && $_REQUEST["FIELDS"]) {
                    $val = $_REQUEST["FIELDS"][$this->id][$id];
                } else {
                    $val = $this->arRes[$id];
                }
                $val_old = $this->arRes[$id];
                echo '<td class="adm-list-table-cell', isset($header_props['align']) && $header_props['align'] ? ' align-' . $header_props['align'] : '', isset($header_props['valign']) && $header_props['valign'] ? ' valign-' . $header_props['valign'] : '', $id === $last_id ? ' adm-list-table-cell-last' : '', '">';
                if (is_array($val_old)) {
                    foreach ($val_old as $k => $v) {
                        echo '<input type="hidden" name="FIELDS_OLD[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . '][' . htmlspecialcharsbx($k) . ']" value="' . htmlspecialcharsbx($v) . '">';
                    }
                } else {
                    echo '<input type="hidden" name="FIELDS_OLD[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']" value="' . htmlspecialcharsbx($val_old) . '">';
                }
                switch ($field["edit"]["type"]) {
                    case "checkbox":
                        echo '<input type="hidden" name="FIELDS[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']" value="N">';
                        echo '<input type="checkbox" name="FIELDS[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']" value="Y"' . ($val == 'Y' ? ' checked' : '') . '>';
                        break;
                    case "select":
                        echo '<select name="FIELDS[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']"' . $this->__AttrGen($field["edit"]["attributes"]) . '>';
                        foreach ($field["edit"]["values"] as $k => $v) {
                            echo '<option value="' . htmlspecialcharsbx($k) . '" ' . ($k == $val ? ' selected' : '') . '>' . htmlspecialcharsex($v) . '</option>';
                        }
                        echo '</select>';
                        break;
                    case "input":
                        if (!$field["edit"]["attributes"]["size"]) {
                            $field["edit"]["attributes"]["size"] = "10";
                        }
                        echo '<input type="text" ' . $this->__AttrGen($field["edit"]["attributes"]) . ' name="FIELDS[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']" value="' . htmlspecialcharsbx($val) . '">';
                        break;
                    case "calendar":
                        if (!$field["edit"]["attributes"]["size"]) {
                            $field["edit"]["attributes"]["size"] = "10";
                        }
                        echo '<span style="white-space:nowrap;"><input type="text" ' . $this->__AttrGen($field["edit"]["attributes"]) . ' name="FIELDS[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']" value="' . htmlspecialcharsbx($val) . '">';
                        echo CAdminCalendar::Calendar('FIELDS[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']') . '</span>';
                        break;
                    case "file":
                        echo CFileInput::Show('FIELDS[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']', $val, $field["edit"]["showInfo"], $field["edit"]["inputs"]);
                        break;
                    default:
                        echo $field["edit"]['value'];
                }
                echo '</td>';
            } else {
                if (!is_array($this->arRes[$id])) {
                    $val = trim($this->arRes[$id]);
                } else {
                    $val = $this->arRes[$id];
                }
                if (isset($field["view"])) {
                    switch ($field["view"]["type"]) {
                        case "checkbox":
                            if ($val == 'Y') {
                                $val = htmlspecialcharsex(GetMessage("admin_lib_list_yes"));
                            } else {
                                $val = htmlspecialcharsex(GetMessage("admin_lib_list_no"));
                            }
                            break;
                        case "select":
                            if ($field["edit"]["values"][$val]) {
                                $val = htmlspecialcharsex($field["edit"]["values"][$val]);
                            }
                            break;
                        case "file":
                            if ($val > 0) {
                                $val = CFileInput::Show('NO_FIELDS[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']', $val, $field["view"]["showInfo"], $field["view"]["inputs"]);
                            } else {
                                $val = '';
                            }
                            break;
                        case "html":
                            $val = $field["view"]['value'];
                            break;
                        default:
                            $val = htmlspecialcharsex($val);
                            break;
                    }
                } else {
                    $val = htmlspecialcharsex($val);
                }
                echo '<td class="adm-list-table-cell', isset($header_props['align']) && $header_props['align'] ? ' align-' . $header_props['align'] : '', isset($header_props['valign']) && $header_props['valign'] ? ' valign-' . $header_props['valign'] : '', $id === $last_id ? ' adm-list-table-cell-last' : '', '">';
                echo (string) $val != "" ? $val : '&nbsp;';
                if (isset($field["edit"]) && $field["edit"]["type"] == "calendar") {
                    CAdminCalendar::ShowScript();
                }
                echo '</td>';
            }
        }
        echo '</tr>';
    }
function __showPopup($element_id, $items)
{
    echo "<script type=\"text/javascript\">\n\t\t\ttop.BX.ready(function(){\n\t\t\t\ttop.BX.bind(top.BX('" . $element_id . "'), 'click', function() {\n\t\t\t\t\ttop.BX.adminShowMenu(this, " . CAdminPopup::PhpToJavaScript($items) . ");\n\t\t\t\t});\n\t\t\t});\n\t\t</script>";
}
Example #5
0
    function Display()
    {
        $sDefAction = $sDefTitle = "";
        if (!$this->bEditMode) {
            if (!empty($this->link)) {
                if (true == $this->boolBX) {
                    $sDefAction = "(new BX.CAdminDialog({\n\t\t\t\t\t\t'content_url': '" . $this->link . (!(defined('BX_PUBLIC_MODE') && BX_PUBLIC_MODE == 1) ? '&bxsku=Y' : '') . "&bxpublic=Y&" . bitrix_sessid_get() . "',\n\t\t\t\t\t\t'content_post': 'from_module=iblock',\n\t\t\t\t\t\t'draggable': true,\n\t\t\t\t\t\t'resizable': true,\n\t\t\t\t\t\t'buttons': [BX.CAdminDialog.btnSave, BX.CAdminDialog.btnCancel]\n\t\t\t\t\t})).Show();";
                } else {
                    $sDefAction = "BX.adminPanel.Redirect([], '" . CUtil::JSEscape($this->link) . "', event);";
                }
                $sDefTitle = $this->title;
            } else {
                foreach ($this->aActions as $action) {
                    if ($action["DEFAULT"] == true) {
                        if (true == $this->boolBX) {
                            $sDefAction = "(new BX.CAdminDialog({\n\t\t\t\t\t\t'content_url': '" . CUtil::addslashes($action["ACTION"]) . "',\n\t\t\t\t\t\t'content_post': '" . (!(defined('BX_PUBLIC_MODE') && BX_PUBLIC_MODE == 1) ? '&bxsku=Y' : '') . "&bxpublic=Y&from_module=iblock&" . bitrix_sessid_get() . "',\n\t\t\t\t\t\t'draggable': true,\n\t\t\t\t\t\t'resizable': true,\n\t\t\t\t\t\t'buttons': [BX.CAdminDialog.btnSave, BX.CAdminDialog.btnCancel]\n\t\t\t\t\t})).Show();";
                        } else {
                            $sDefAction = $action["ACTION"] ? htmlspecialcharsbx($action["ACTION"]) : "BX.adminPanel.Redirect([], '" . CUtil::JSEscape($action["LINK"]) . "', event)";
                        }
                        $sDefTitle = !empty($action["TITLE"]) ? $action["TITLE"] : $action["TEXT"];
                        break;
                    }
                }
            }
        }
        $sMenuItems = "";
        if (!empty($this->aActions)) {
            $sMenuItems = htmlspecialcharsbx(CAdminPopup::PhpToJavaScript($this->aActions));
        }
        $aUserOpt = CUserOptions::GetOption("global", "settings");
        ?>
<tr class="adm-list-table-row<?php 
        echo isset($this->aFeatures["footer"]) && $this->aFeatures["footer"] == true ? ' footer' : '';
        echo $this->bEditMode ? ' adm-table-row-active' : '';
        ?>
"<?php 
        echo $sMenuItems != "" && $aUserOpt["context_menu"] != "N" ? ' oncontextmenu="return ' . $sMenuItems . ';"' : '';
        echo $sDefAction != "" ? ' ondblclick="' . $sDefAction . '"' . (!empty($sDefTitle) ? ' title="' . GetMessage("admin_lib_list_double_click") . ' ' . $sDefTitle . '"' : '') : '';
        ?>
>
<?php 
        if (count($this->pList->arActions) > 0 || $this->pList->bCanBeEdited) {
            $check_id = RandString(5);
            ?>
	<td class="adm-list-table-cell adm-list-table-checkbox adm-list-table-checkbox-hover<?php 
            echo $this->bReadOnly ? ' adm-list-table-checkbox-disabled' : '';
            ?>
"><input type="checkbox" class="adm-checkbox adm-designed-checkbox" name="SUB_ID[]" id="<?php 
            echo $this->table_id . "_" . $this->id . "_" . $check_id;
            ?>
" value="<?php 
            echo $this->id;
            ?>
" autocomplete="off" title="<?php 
            echo GetMessage("admin_lib_list_check");
            ?>
"<?php 
            echo $this->bReadOnly ? ' disabled="disabled"' : '';
            echo $this->bEditMode ? ' checked="checked" disabled="disabled"' : '';
            ?>
 /><label class="adm-designed-checkbox-label adm-checkbox" for="<?php 
            echo $this->table_id . "_" . $this->id . "_" . $check_id;
            ?>
"></label></td>
<?php 
        }
        if ($this->pList->bShowActions) {
            if (!empty($this->aActions)) {
                ?>
	<td class="adm-list-table-cell adm-list-table-popup-block" onclick="BX.adminSubList.ShowMenu(this.firstChild, this.parentNode.oncontextmenu(), this.parentNode);"><div class="adm-list-table-popup" title="<?php 
                echo GetMessage("admin_lib_list_actions_title");
                ?>
"></div></td>
<?php 
            } else {
                ?>
	<td class="adm-list-table-cell"></td>
<?php 
            }
        }
        $bVarsFromForm = $this->bEditMode && is_array($this->pList->arUpdateErrorIDs) && in_array($this->id, $this->pList->arUpdateErrorIDs);
        foreach ($this->aHeaders as $id => $header_props) {
            if (!in_array($id, $this->pList->arVisibleColumns)) {
                continue;
            }
            $field = $this->aFields[$id];
            if ($this->bEditMode && isset($field["edit"])) {
                if ($bVarsFromForm && $_REQUEST["FIELDS"]) {
                    $val = $_REQUEST["FIELDS"][$this->id][$id];
                } else {
                    $val = $this->arRes[$id];
                }
                $val_old = $this->arRes[$id];
                echo '<td class="adm-list-table-cell' . ($header_props['align'] ? ' align-' . $header_props['align'] : '') . ' ' . ($header_props['valign'] ? ' valign-' . $header_props['valign'] : '') . '">';
                if (is_array($val_old)) {
                    foreach ($val_old as $k => $v) {
                        echo '<input type="hidden" name="FIELDS_OLD[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . '][' . htmlspecialcharsbx($k) . ']" value="' . htmlspecialcharsbx($v) . '">';
                    }
                } else {
                    echo '<input type="hidden" name="FIELDS_OLD[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']" value="' . htmlspecialcharsbx($val_old) . '">';
                }
                switch ($field["edit"]["type"]) {
                    case "checkbox":
                        echo '<input type="hidden" name="FIELDS[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']" value="N">';
                        echo '<input type="checkbox" name="FIELDS[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']" value="Y"' . ($val == 'Y' ? ' checked' : '') . '>';
                        break;
                    case "select":
                        echo '<select name="FIELDS[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']"' . $this->__AttrGen($field["edit"]["attributes"]) . '>';
                        foreach ($field["edit"]["values"] as $k => $v) {
                            echo '<option value="' . htmlspecialcharsbx($k) . '" ' . ($k == $val ? ' selected' : '') . '>' . htmlspecialcharsex($v) . '</option>';
                        }
                        echo '</select>';
                        break;
                    case "input":
                        if (!$field["edit"]["attributes"]["size"]) {
                            $field["edit"]["attributes"]["size"] = "10";
                        }
                        echo '<input type="text" ' . $this->__AttrGen($field["edit"]["attributes"]) . ' name="FIELDS[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']" value="' . htmlspecialcharsbx($val) . '">';
                        break;
                    case "calendar":
                        if (!$field["edit"]["attributes"]["size"]) {
                            $field["edit"]["attributes"]["size"] = "10";
                        }
                        echo '<span style="white-space:nowrap;"><input type="text" ' . $this->__AttrGen($field["edit"]["attributes"]) . ' name="FIELDS[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']" value="' . htmlspecialcharsbx($val) . '">';
                        echo CAdminCalendar::Calendar('FIELDS[' . htmlspecialcharsbx($this->id) . '][' . htmlspecialcharsbx($id) . ']') . '</span>';
                        break;
                    default:
                        echo $field["edit"]['value'];
                }
                echo '</td>';
            } else {
                if (!is_array($this->arRes[$id])) {
                    $val = trim($this->arRes[$id]);
                } else {
                    $val = $this->arRes[$id];
                }
                switch ($field["view"]["type"]) {
                    case "checkbox":
                        if ($val == 'Y') {
                            $val = GetMessage("admin_lib_list_yes");
                        } else {
                            $val = GetMessage("admin_lib_list_no");
                        }
                        break;
                    case "select":
                        if ($field["edit"]["values"][$val]) {
                            $val = $field["edit"]["values"][$val];
                        }
                        break;
                }
                if ($field["view"]['type'] == 'html') {
                    $val = $field["view"]['value'];
                } else {
                    $val = htmlspecialcharsex($val);
                }
                echo '<td class="adm-list-table-cell' . ($header_props['align'] ? ' align-' . $header_props['align'] : '') . ' ' . ($header_props['valign'] ? ' valign-' . $header_props['valign'] : '') . '">';
                echo (string) $val != "" ? $val : '&nbsp;';
                if ($field["edit"]["type"] == "calendar") {
                    echo CAdminCalendar::ShowScript();
                }
                echo '</td>';
            }
        }
        echo '</tr>';
    }