Beispiel #1
0
 function GetBucketList($arFilter = array())
 {
     if (CModule::IncludeModule('clouds')) {
         $arBucket = array();
         $rsData = CCloudStorageBucket::GetList(array("SORT" => "DESC", "ID" => "ASC"));
         while ($f = $rsData->Fetch()) {
             if ($f['ACTIVE'] != 'Y' || $f['READ_ONLY'] == 'Y' && $arFilter['READ_ONLY'] == 'N') {
                 continue;
             }
             // sql filter currently is not supported TODO: remove in future
             $arBucket[] = $f;
         }
         return count($arBucket) ? $arBucket : false;
     }
     return false;
 }
</option>
				<option value="all"><?php 
echo GetMessage("IBLOCK_CML2_FILTER_ALL");
?>
</option>
				<option value="none"><?php 
echo GetMessage("IBLOCK_CML2_FILTER_NONE");
?>
</option>
			</select>
		</td>
	</tr>
	<?php 
$bHaveClouds = false;
if (CModule::IncludeModule("clouds")) {
    $rsData = CCloudStorageBucket::GetList(array("SORT" => "DESC", "ID" => "ASC"));
    if ($rsData->Fetch()) {
        $bHaveClouds = true;
    }
}
if ($bHaveClouds) {
    ?>
	<tr>
		<td><label for="CK_DOWNLOAD_CLOUD_FILES"><?php 
    echo GetMessage("IBLOCK_CML2_DOWNLOAD_CLOUD_FILES");
    ?>
:</label></td>
		<td>
			<input name="DOWNLOAD_CLOUD_FILES" type="hidden" value="N">
			<input name="DOWNLOAD_CLOUD_FILES" id="CK_DOWNLOAD_CLOUD_FILES" type="checkbox" value="Y" checked="checked">
		</td>
Beispiel #3
0
 public static function OnAdminListDisplay(&$obList)
 {
     global $USER;
     if ($obList->table_id !== "tbl_fileman_admin") {
         return;
     }
     if (!is_object($USER) || !$USER->CanDoOperation("clouds_upload")) {
         return;
     }
     static $clouds = null;
     if (!isset($clouds)) {
         $clouds = array();
         $rsClouds = CCloudStorageBucket::GetList(array("SORT" => "DESC", "ID" => "ASC"));
         while ($arStorage = $rsClouds->Fetch()) {
             if ($arStorage["READ_ONLY"] == "N" && $arStorage["ACTIVE"] == "Y") {
                 $clouds[$arStorage["ID"]] = $arStorage["BUCKET"];
             }
         }
     }
     if (empty($clouds)) {
         return;
     }
     foreach ($obList->aRows as $obRow) {
         if ($obRow->arRes["TYPE"] === "F") {
             $ID = "F" . $obRow->arRes["NAME"];
             $file = $obRow->arRes["NAME"];
             $path = substr($obRow->arRes["ABS_PATH"], 0, -strlen($file));
             $arSubMenu = array();
             foreach ($clouds as $id => $bucket) {
                 $arSubMenu[] = array("TEXT" => $bucket, "ACTION" => $s = "if(confirm('" . GetMessage("CLO_STORAGE_UPLOAD_CONF") . "')) jsUtils.Redirect([], '" . CUtil::AddSlashes("/bitrix/admin/clouds_file_list.php?lang=" . LANGUAGE_ID . "&bucket=" . urlencode($id) . "&path=" . urlencode($path) . "&ID=" . urlencode($ID) . "&action=upload&" . bitrix_sessid_get()) . "');");
             }
             $obRow->aActions[] = array("TEXT" => GetMessage("CLO_STORAGE_UPLOAD_MENU"), "MENU" => $arSubMenu);
         }
     }
 }
        if ($ob->Delete()) {
            LocalRedirect("/bitrix/admin/clouds_storage_list.php?lang=" . LANGUAGE_ID);
        } else {
            $bVarsFromForm = true;
        }
    }
}
if ($bVarsFromForm) {
    $arRes = array("ACTIVE" => (string) $_REQUEST["ACTIVE"], "SORT" => "500", "READ_ONLY" => (string) $_REQUEST["READ_ONLY"], "SERVICE_ID" => (string) $_REQUEST["SERVICE_ID"], "BUCKET" => (string) $_REQUEST["BUCKET"], "LOCATION" => (string) $_REQUEST["LOCATION"], "CNAME" => (string) $_REQUEST["CNAME"], "SETTINGS" => "");
    if (isset($_REQUEST["SETTINGS"]) && is_array($_REQUEST["SETTINGS"])) {
        $arRes["SETTINGS"] = $_REQUEST["SETTINGS"];
    }
} else {
    $arRes = null;
    if ($ID > 0) {
        $rs = CCloudStorageBucket::GetList(array("ID" => "ASC"), array("=ID" => $ID));
        $arRes = $rs->Fetch();
    }
    if (!is_array($arRes)) {
        $ID = 0;
        $arRes = array("ACTIVE" => "Y", "SORT" => "500", "READ_ONLY" => "N", "SERVICE_ID" => "", "BUCKET" => "upload-" . md5(uniqid("", true)), "LOCATION" => "", "CNAME" => "", "SETTINGS" => "");
    }
}
$APPLICATION->SetTitle($ID > 0 ? GetMessage("CLO_STORAGE_EDIT_EDIT_TITLE") : GetMessage("CLO_STORAGE_EDIT_ADD_TITLE"));
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
$aMenu = array(array("TEXT" => GetMessage("CLO_STORAGE_EDIT_MENU_LIST"), "TITLE" => GetMessage("CLO_STORAGE_EDIT_MENU_LIST_TITLE"), "LINK" => "clouds_storage_list.php?lang=" . LANGUAGE_ID, "ICON" => "btn_list"));
$context = new CAdminContextMenu($aMenu);
$context->Show();
if (is_object($message)) {
    echo $message->Show();
}