Ejemplo n.º 1
0
    /**
     * @return string
     */
    public function getScripts()
    {
        if (!static::$jsInited) {
            \Bitrix\Main\Page\Asset::getInstance()->addJs("/bitrix/js/sale/admin/order_basket.js");
            static::$jsInited = true;
        }
        $data = static::prepareData();
        $totalPrices = OrderEdit::getTotalPrices($this->order, $this, false);
        $langPhrases = array("SALE_ORDER_BASKET_TURN", "SALE_ORDER_BASKET_EXPAND", "SALE_ORDER_BASKET_UP_RATIO", "SALE_ORDER_BASKET_PROD_EDIT", "SALE_ORDER_BASKET_DOWN_RATIO", "SALE_ORDER_BASKET_PROD_COUNT", "SALE_ORDER_BASKET_NO_PICTURE", "SALE_ORDER_BASKET_PROD_CREATE", "SALE_ORDER_BASKET_ROW_SETTINGS", "SALE_ORDER_BASKET_PROD_MENU_EDIT", "SALE_ORDER_BASKET_PROD_MENU_DELETE", "SALE_ORDER_BASKET_BASE_CATALOG_PRICE", "SALE_ORDER_BASKET_PROD_EDIT_ITEM_SAVE", "SALE_ORDER_BASKET_KG", "SALE_ORDER_BASKET_COUPON", "SALE_ORDER_BASKET_COUPON_STATUS", "SALE_ORDER_BASKET_COUPON_APPLY", "SALE_ORDER_BASKET_COUPON_DELETE", "SALE_ORDER_BASKET_POSITION_EXISTS");
        $result = '<script type="text/javascript">';
        foreach ($langPhrases as $phrase) {
            $result .= ' BX.message({' . $phrase . ': "' . \CUtil::jsEscape(Loc::getMessage($phrase)) . '"});';
        }
        if ($this->mode == self::EDIT_MODE) {
            $result .= '
				BX.ready(function(){
					' . $this->jsObjName . '= new BX.Sale.Admin.OrderBasketEdit({
						tableId: "' . $this->idPrefix . 'sale_order_edit_product_table",
						idPrefix: "' . $this->idPrefix . '",
						productsOrder: ' . \CUtil::phpToJSObject($data["ITEMS_ORDER"]) . ',
						products: ' . \CUtil::phpToJSObject($data["ITEMS"]) . ',
						visibleColumns: ' . \CUtil::phpToJSObject($this->visibleColumns) . ',
						objName: "' . $this->jsObjName . '",
						createProductBasement: ' . ($this->createProductBasement ? 'true' : 'false') . ',
						columnsCount: ' . count($this->visibleColumns) . ',
						createBasketBottom: true,
						iblocksSkuParams: ' . \CUtil::phpToJSObject($data["IBLOCKS_SKU_PARAMS"]) . ',
						productsOffersSkuParams: ' . \CUtil::phpToJSObject($data["PRODUCTS_OFFERS_SKU"]) . ',
						isShowXmlId: ' . ($this->isShowXmlId ? 'true' : 'false') . ',
						discounts: ' . \CUtil::phpToJSObject(OrderEdit::getOrderedDiscounts($this->order, false)) . ',
						mode: "edit",
						unRemovableFields: ["PRICE", "QUANTITY"],
						' . $this->getTotalBlockFieldsJs($totalPrices, $data) . '
					});

					BX.Sale.Admin.OrderEditPage.registerFieldsUpdaters( ' . $this->jsObjName . '.getFieldsUpdaters() );
					BX.Sale.Admin.OrderBasketCoupons.statusCouponApplyed = ' . DiscountCouponsManager::STATUS_APPLYED . ';
					BX.Sale.Admin.OrderBasketCoupons.mode = BX.Sale.Admin.OrderBasketCoupons.MODES_LIST.' . ($this->order->getId() > 0 ? 'EDIT' : 'CREATE') . ';
					BX.Sale.Admin.OrderBasketCoupons.setCoupons(' . \CUtil::phpToJSObject(OrderEdit::getCouponList($this->order, false)) . ');
				});';
            $result .= $this->settingsDialog->getScripts();
        } else {
            $result .= '
				BX.ready(function(){
					' . $this->jsObjName . '= new BX.Sale.Admin.OrderBasket({
						tableId: "' . $this->idPrefix . 'sale_order_view_product_table",
						idPrefix: "' . $this->idPrefix . '",
						productsOrder: ' . \CUtil::phpToJSObject($data["ITEMS_ORDER"]) . ',
						products: ' . \CUtil::phpToJSObject($data["ITEMS"]) . ',
						visibleColumns: ' . \CUtil::phpToJSObject($this->visibleColumns) . ',
						objName: "' . $this->jsObjName . '",
						createProductBasement: ' . ($this->createProductBasement ? 'true' : 'false') . ',
						iblocksSkuParams: ' . \CUtil::phpToJSObject($data["IBLOCKS_SKU_PARAMS"]) . ',
						columnsCount: ' . count($this->visibleColumns) . ',
						isShowXmlId: ' . ($this->isShowXmlId ? 'true' : 'false') . ',
						discounts: ' . \CUtil::phpToJSObject(OrderEdit::getOrderedDiscounts($this->order, false)) . ',
						createBasketBottom: true,
						mode: "view",
						' . $this->getTotalBlockFieldsJs($totalPrices, $data) . '
					});

					BX.Sale.Admin.OrderEditPage.registerFieldsUpdaters( ' . $this->jsObjName . '.getFieldsUpdaters() );
					BX.Sale.Admin.OrderBasketCoupons.mode = BX.Sale.Admin.OrderBasketCoupons.MODES_LIST.VIEW;
					BX.Sale.Admin.OrderBasketCoupons.setCoupons(' . \CUtil::phpToJSObject(OrderEdit::getCouponList($this->order, false)) . ');
				});';
            $result .= $this->settingsDialog->getScripts();
        }
        $result .= '</script>';
        return $result;
    }
Ejemplo n.º 2
0
 protected function processActionOpenDialog()
 {
     $selectedService = '';
     $fakeMove = $this->request->getQuery('wish') === 'fakemove';
     $enabledMultiSelect = $this->request->getQuery('multiselect') !== 'N';
     if ($this->request->getQuery('cloudImport')) {
         $list = $this->listCloudStorages();
         $types = array('cloud' => array('id' => 'cloud', 'order' => 4));
         $selectedService = $this->request->getQuery('service');
     } else {
         $list = $this->listStorages();
         if (!$list) {
             $this->sendJsonErrorResponse();
         }
         $types = array('recently_used' => array('id' => 'recently_used', 'order' => 1, 'searchable' => false), 'user' => array('id' => 'user', 'order' => 2, 'searchable' => false), 'common' => array('id' => 'common', 'name' => Loc::getMessage('DISK_UF_CONTROLLER_SHARED_DOCUMENTS'), 'order' => 3, 'searchable' => false), 'group' => array('id' => 'group', 'name' => Loc::getMessage('DISK_UF_CONTROLLER_MY_GROUPS'), 'order' => 4, 'searchable' => false));
         if ($fakeMove) {
             unset($types['recently_used']);
         }
     }
     $dialogName = $this->request->getQuery('dialogName');
     if (strlen($dialogName) <= 0) {
         $dialogName = 'DiskFileDialog';
     }
     $dialogTitle = Loc::getMessage($fakeMove ? 'DISK_UF_CONTROLLER_SAVE_DOCUMENT_TITLE' : 'DISK_UF_CONTROLLER_SELECT_DOCUMENT_TITLE');
     if (!$fakeMove && !$enabledMultiSelect) {
         $dialogTitle = Loc::getMessage('DISK_UF_CONTROLLER_SELECT_ONE_DOCUMENT_TITLE');
     }
     $js = "\n\t\t\t<script>\n\t\t\t\tBX.DiskFileDialog.init({\n\t\t\t\t\t'currentTabId': '" . \CUtil::jSEscape($selectedService) . "',\n\t\t\t\t\t'name' : '" . \CUtil::jSEscape($dialogName) . "',\n\n\t\t\t\t\t'bindPopup' : { 'node' : null, 'offsetTop' : 0, 'offsetLeft': 0},\n\n\t\t\t\t\t'localize' : {\n\t\t\t\t\t\t'title' : '" . \CUtil::jSEscape($dialogTitle) . "',\n\t\t\t\t\t\t'saveButton' : '" . \CUtil::jSEscape(Loc::getMessage($fakeMove ? 'DISK_UF_CONTROLLER_SELECT_FOLDER' : 'DISK_UF_CONTROLLER_SELECT_DOCUMENT')) . "',\n\t\t\t\t\t\t'cancelButton' : '" . \CUtil::jSEscape(Loc::getMessage('DISK_UF_CONTROLLER_CANCEL')) . "'\n\t\t\t\t\t},\n\n\t\t\t\t\t'callback' : {\n\t\t\t\t\t\t'saveButton' : function(tab, path, selected) {},\n\t\t\t\t\t\t'cancelButton' : function(tab, path, selected) {}\n\t\t\t\t\t},\n\n\t\t\t\t\t'type' : " . \CUtil::phpToJSObject($types) . ",\n\t\t\t\t\t'typeItems' : " . \CUtil::phpToJSObject($list) . ",\n\t\t\t\t\t'items' : {},\n\n\t\t\t\t\t'itemsDisabled' : {},\n\t\t\t\t\t'itemsSelected' : {},\n\t\t\t\t\t'itemsSelectEnabled' : " . ($fakeMove ? '{folder: true}' : "{'onlyFiles' : true}") . ", // all, onlyFiles, folder, archive, image, file, video, txt, word, excel, ppt\n\t\t\t\t\t'itemsSelectMulti' : " . ($fakeMove || !$enabledMultiSelect ? 'false' : 'true') . ",\n\n\t\t\t\t\t'gridColumn' : {\n\t\t\t\t\t\t'name' : {'id' : 'name', 'name' : '" . \CUtil::jSEscape(Loc::getMessage('DISK_UF_CONTROLLER_TITLE_NAME')) . "', 'sort' : 'name', 'style': 'width: 310px', 'order': 1},\n\t\t\t\t\t\t'size' : {'id' : 'size', 'name' : '" . \CUtil::jSEscape(Loc::getMessage('DISK_UF_CONTROLLER_FILE_SIZE')) . "', 'sort' : 'sizeInt', 'style': 'width: 79px', 'order': 2},\n\t\t\t\t\t\t'modifyBy' : {'id' : 'modifyBy', 'name' : '" . \CUtil::jSEscape(Loc::getMessage('DISK_UF_CONTROLLER_TITLE_MODIFIED_BY')) . "', 'sort' : 'modifyBy', 'style': 'width: 122px', 'order': 3},\n\t\t\t\t\t\t'modifyDate' : {'id' : 'modifyDate', 'name' : '" . \CUtil::jSEscape(Loc::getMessage('DISK_UF_CONTROLLER_TITLE_TIMESTAMP')) . "', 'sort' : 'modifyDateInt', 'style': 'width: 90px', 'order': 4}\n\t\t\t\t\t},\n\t\t\t\t\t'gridOrder' : {'column': 'modifyDateInt', 'order':'desc'}\n\t\t\t\t});\n\t\t\t</script>\n\t\t\t\t";
     $this->sendResponse($js);
 }
Ejemplo n.º 3
0
        ?>
'];<?php 
        ?>
services['<?php 
        echo $service['id'];
        ?>
'] = ['<?php 
        echo $service['server'];
        ?>
'];<?php 
        ?>
domainUsers['<?php 
        echo $service['id'];
        ?>
'] = <?php 
        echo CUtil::phpToJSObject($service['users']);
        ?>
;<?php 
    }
}
?>

	var mb = {
		'dialog': (function() {
			var dlg = new BX.CDialog({
				'content': '',
				'title': '',
				'width': 420,
				'resizable': false
			});
			dlg.PARTS.CONTENT_DATA.style.height = 'auto';
Ejemplo n.º 4
0
<script type="text/javascript">

	var initialSite = '<?php 
echo CUtil::jsEscape($abtest['SITE_ID']);
?>
';
	var siteDirs = <?php 
echo CUtil::phpToJSObject(array_map(function ($site) {
    return $site['DIR'];
}, $arSites));
?>
;

	var estDays = <?php 
echo CUtil::phpToJSObject($arEstDays);
?>
;

	var fileDialogTarget = null;

	var fileDialogCallback = function(filename, path)
	{
		fileDialogTarget.value = (path+'/'+filename).replace(/\/+/, '/');
		fileDialogTarget.style.color = '';
		ABTestList.Item.handle(fileDialogTarget, true);

		fileDialogTarget = null;
	}

	var ABTestParams = {