Esempio n. 1
0
 public static function OnPanelCreate()
 {
     global $APPLICATION, $USER;
     $cur_page_param = $APPLICATION->GetCurPageParam();
     $cur_page = $APPLICATION->GetCurPage(true);
     $cur_dir = $APPLICATION->GetCurDir();
     // New page
     $flow_link_new = CWorkFlow::GetEditLink(array(SITE_ID, rtrim(GetDirPath($cur_page), "/") . "/untitled.php"), $status_id, $status_title, "standart.php", LANGUAGE_ID, $cur_page_param);
     $create_permission = $flow_link_new != '' && $USER->CanDoFileOperation('fm_edit_in_workflow', array(SITE_ID, $cur_dir));
     // Document history
     $flow_link_hist = "/bitrix/admin/workflow_history_list.php?lang=" . LANGUAGE_ID . "&find_filename=" . urlencode($cur_page) . "&find_filename_exact_match=Y&set_filter=Y";
     $history_permission = $USER->CanDoFileOperation('fm_edit_in_workflow', array(SITE_ID, $cur_page));
     // Current page
     $flow_link_edit = CWorkFlow::GetEditLink(array(SITE_ID, $cur_page), $status_id, $status_title, "", LANGUAGE_ID, $cur_page_param);
     $edit_permission = $flow_link_edit != '' && $history_permission;
     //Big button
     if ($edit_permission) {
         $public_edit = $APPLICATION->GetPopupLink(array("URL" => $flow_link_edit . "&bxpublic=Y&from_module=workflow", "PARAMS" => array("min_width" => 700, "min_height" => 400, 'height' => 700, 'width' => 400)));
         $APPLICATION->AddPanelButton(array("HREF" => "javascript:" . $public_edit, "TYPE" => "BIG", "ID" => "edit", "ICON" => "bx-panel-edit-page-icon", "ALT" => GetMessage("top_panel_edit_title"), "TEXT" => GetMessage("top_panel_edit_new"), "MAIN_SORT" => "200", "SORT" => 10, "MENU" => array(), "HK_ID" => "top_panel_edit_new", "RESORT_MENU" => true, "HINT" => array("TITLE" => GetMessage("top_panel_edit_new_tooltip_title"), "TEXT" => GetMessage("top_panel_edit_new_tooltip"))));
     }
     // New page
     if ($create_permission) {
         $APPLICATION->AddPanelButtonMenu("create", array("SEPARATOR" => true, "SORT" => 49));
         $APPLICATION->AddPanelButtonMenu("create", array("SRC" => "/bitrix/images/workflow/new_page.gif", "TEXT" => GetMessage("FLOW_PANEL_CREATE_WITH_WF"), "TITLE" => GetMessage("FLOW_PANEL_CREATE_ALT"), "ACTION" => "jsUtils.Redirect([], '" . CUtil::JSEscape($flow_link_new) . "')", "HK_ID" => "FLOW_PANEL_CREATE_WITH_WF", "SORT" => 50));
     }
     if ($edit_permission || $history_permission) {
         $APPLICATION->AddPanelButtonMenu("edit", array("SEPARATOR" => true, "SORT" => 79));
     }
     // Current page
     if ($edit_permission) {
         $APPLICATION->AddPanelButtonMenu("edit", array("SRC" => "/bitrix/images/workflow/edit_flow_public.gif", "TEXT" => GetMessage("FLOW_PANEL_EDIT_WITH_WF"), "TITLE" => intval($status_id) > 0 ? GetMessage("FLOW_CURRENT_STATUS") . " [{$status_id}] {$status_title}" : GetMessage("FLOW_PANEL_EDIT_ALT"), "ACTION" => "jsUtils.Redirect([], '" . CUtil::JSEscape($flow_link_edit) . "')", "HK_ID" => "FLOW_PANEL_EDIT_WITH_WF", "SORT" => 80));
     }
     // Document history
     if ($history_permission) {
         $flow_link_hist = "/bitrix/admin/workflow_history_list.php?lang=" . LANGUAGE_ID . "&find_filename=" . urlencode($cur_page) . "&find_filename_exact_match=Y&set_filter=Y";
         $APPLICATION->AddPanelButtonMenu("edit", array("SRC" => "/bitrix/images/workflow/history.gif", "TEXT" => GetMessage("FLOW_PANEL_HISTORY"), "TITLE" => GetMessage("FLOW_PANEL_HISTORY_ALT"), "ACTION" => "jsUtils.Redirect([], '" . CUtil::JSEscape($flow_link_hist) . "')", "HK_ID" => "FLOW_PANEL_HISTORY", "SORT" => 81));
     }
 }
Esempio n. 2
0
                 $defaultEdit = "";
             }
             if ($curFilePreType == "text") {
                 if ($USER->CanDoFileOperation('fm_edit_existent_file', $arPath)) {
                     if (!HasScriptExtension($f_NAME) || $USER->CanDoFileOperation('fm_lpa', $arPath) || $USER->CanDoOperation('edit_php')) {
                         $arActions[] = array("ICON" => "btn_fileman_html", "DEFAULT" => $defaultEdit == "html" ? True : False, "TEXT" => GetMessage("FILEMAN_ADMIN_EDIT_AS_HTML"), "ACTION" => $lAdmin->ActionRedirect("fileman_html_edit.php?path=" . $fpathUrl . "&site=" . $site . "&" . $addUrl . "&" . GetFilterParams("filter_") . ""));
                         $arActions[] = array("ICON" => "btn_fileman_text", "TEXT" => GetMessage("FILEMAN_ADMIN_EDIT_AS_TEXT"), "DEFAULT" => $defaultEdit == "text" ? True : False, "ACTION" => $lAdmin->ActionRedirect("fileman_file_edit.php?path=" . $fpathUrl . "&site=" . $site . "&" . $addUrl . "&" . GetFilterParams("filter_") . ""));
                     }
                     if ($USER->CanDoOperation('edit_php')) {
                         $arActions[] = array("ICON" => "btn_fileman_php", "TEXT" => GetMessage("FILEMAN_ADMIN_EDIT_AS_PHP"), "DEFAULT" => $defaultEdit == "php" ? True : False, "ACTION" => $lAdmin->ActionRedirect("fileman_file_edit.php?path=" . $fpathUrl . "&full_src=Y&site=" . $site . "&" . $addUrl . "&" . GetFilterParams("filter_") . ""));
                     }
                 }
                 if (CModule::IncludeModule("workflow") && $USER->CanDoFileOperation('fm_edit_in_workflow', $arPath)) {
                     $st = '';
                     $sid = '';
                     $WFlink = CWorkFlow::GetEditLink(array($site, $fpath), $sid, $st);
                     if (strlen($WFlink) > 0) {
                         $arActions[] = array("ICON" => "btn_fileman_galka", "DEFAULT" => $Elem["PERMISSION"] == "U" ? True : False, "TEXT" => GetMessage("FILEMAN_EDIT_IN_WORKFLOW"), "ACTION" => $lAdmin->ActionRedirect($WFlink));
                     }
                 }
             }
             if ($USER->CanDoFileOperation('fm_view_file', $arPath) && ($USER->CanDoOperation('edit_php') || $USER->CanDoFileOperation('fm_lpa', $arPath) || !(HasScriptExtension($f_NAME) || substr($Elem["NAME"], 0, 1) == "."))) {
                 $arActions[] = array("ICON" => "btn_fileman_view", "TEXT" => GetMessage("FILEMAN_ADMIN_VIEW"), "DEFAULT" => $curFilePreType != "text" && !$USER->IsAdmin() ? True : False, "ACTION" => $lAdmin->ActionRedirect("fileman_file_view.php?path=" . $fpathUrl . "&site=" . $site . "&" . $addUrl));
             }
             if ($USER->CanDoFileOperation('fm_download_file', $arPath) && !(HasScriptExtension($f_NAME) || substr($Elem["NAME"], 0, 1) == ".") || $USER->CanDoOperation('edit_php')) {
                 $arActions[] = array("ICON" => "btn_download", "TEXT" => GetMessage("FILEMAN_DOWNLOAD"), "ACTION" => $lAdmin->ActionRedirect("fileman_file_download.php?path=" . $fpathUrl . "&site=" . $site . "&" . $addUrl) . " setTimeout(function(){ CloseWaitWindow(); }, 3000);");
             }
         }
     }
 } else {
     if ($USER->CanDoFileOperation('fm_view_listing', $arPath)) {