Просмотр исходного кода

Merge branch 'master' of github.com:boonex/dolphin

Alex Trofimov 10 лет назад
Родитель
Сommit
67b87769f8

+ 6 - 6
modules/boonex/acl/classes/BxAclGridAdministration.php

@@ -23,7 +23,7 @@ class BxAclGridAdministration extends BxTemplGrid
     	$this->MODULE = 'bx_acl';
     	$this->_oModule = BxDolModule::getInstance($this->MODULE);
 
-        parent::__construct ($aOptions, $this->_oModule->_oTemplate);
+        parent::__construct ($aOptions, $oTemplate);
 
         $iLevel = (int)bx_get('level');
         if($iLevel > 0) {
@@ -75,10 +75,10 @@ class BxAclGridAdministration extends BxTemplGrid
 
             echoJson($aRes);
             return;
-        } 
+        }
 
 		bx_import('BxTemplStudioFunctions');
-		$sContent = BxTemplStudioFunctions::getInstance()->popupBox($this->_oModule->_oConfig->getHtmlIds('popup_price'), _t('_bx_acl_popup_title_price_add'), $this->_oTemplate->parseHtmlByName('popup_price.html', array(
+		$sContent = BxTemplStudioFunctions::getInstance()->popupBox($this->_oModule->_oConfig->getHtmlIds('popup_price'), _t('_bx_acl_popup_title_price_add'), $this->_oModule->_oTemplate->parseHtmlByName('popup_price.html', array(
 			'form_id' => $oForm->aFormAttrs['id'],
 			'form' => $oForm->getCode(true),
 			'object' => $this->_sObject,
@@ -128,7 +128,7 @@ class BxAclGridAdministration extends BxTemplGrid
         }
 
 		bx_import('BxTemplStudioFunctions');
-		$sContent = BxTemplStudioFunctions::getInstance()->popupBox($this->_oModule->_oConfig->getHtmlIds('popup_price'), _t('_bx_acl_popup_title_price_edit'), $this->_oTemplate->parseHtmlByName('popup_price.html', array(
+		$sContent = BxTemplStudioFunctions::getInstance()->popupBox($this->_oModule->_oConfig->getHtmlIds('popup_price'), _t('_bx_acl_popup_title_price_edit'), $this->_oModule->_oTemplate->parseHtmlByName('popup_price.html', array(
 			'form_id' => $oForm->aFormAttrs['id'],
 			'form' => $oForm->getCode(true),
 			'object' => $this->_sObject,
@@ -164,8 +164,8 @@ class BxAclGridAdministration extends BxTemplGrid
     protected function _addJsCss()
     {
         parent::_addJsCss();
-        $this->_oTemplate->addJs(array('jquery.form.min.js', 'administration.js'));
-        $this->_oTemplate->addCss(array('administration.css'));
+        $this->_oModule->_oTemplate->addStudioJs(array('jquery.form.min.js', 'administration.js'));
+        $this->_oModule->_oTemplate->addStudioCss(array('administration.css'));
 
         $oForm = new BxTemplFormView(array());
         $oForm->addCssJs();

+ 0 - 20
modules/boonex/acl/classes/BxAclModule.php

@@ -33,26 +33,6 @@ class BxAclModule extends BxDolModule
     /**
      * SERVICE METHODS
      */
-	public function serviceGetBlockAdministration()
-	{
-		$sContent = '';
-
-		$sGrid = $this->_oConfig->getGridObject('administration');
-		$oGrid = BxDolGrid::getObjectInstance($sGrid);
-        if(!$oGrid)
-            return $sContent;
-
-		if($this->_oConfig->getOwner() == 0)
-			$sContent .= $this->_oTemplate->displayEmptyOwner();
-
-		$sContent .= $this->_oTemplate->getJsCode('administration', array('sObjNameGrid' => $sGrid));
-		$sContent .= $oGrid->getCode();
-
-		return array(
-            'content' => $sContent 
-        );
-	}
-
 	public function serviceGetBlockView()
 	{
 		$sGrid = $this->_oConfig->getGridObject('view');

+ 18 - 9
modules/boonex/acl/classes/BxAclStudioPage.php

@@ -20,20 +20,29 @@ class BxAclStudioPage extends BxTemplStudioModule
     	$this->_oModule = BxDolModule::getInstance($this->MODULE);
 
         parent::__construct($sModule, $sPage);
-
-        $this->aMenuItems = array(
-            array('name' => 'settings', 'icon' => 'cogs', 'title' => '_adm_lmi_cpt_settings'),
-            array('name' => 'manage', 'icon' => 'edit', 'title' => '_bx_acl_menu_item_title_administration', 'link' => BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink($this->_oModule->_oConfig->CNF['URL_ADMINISTRATION'])),
-        );
     }
 
     protected function getSettings()
     {
-    	$sContent = parent::getSettings();
-    	if($this->_oModule->_oConfig->getOwner() == 0)
-			$sContent = $this->_oModule->_oTemplate->displayEmptyOwner() . $sContent;
+	    if (!isAdmin()) {
+            $this->_oTemplate->displayAccessDenied();
+            return;
+        }
+
+    	$sContent = '';
+
+		$sGrid = $this->_oModule->_oConfig->getGridObject('administration');
+		$oGrid = BxDolGrid::getObjectInstance($sGrid, BxDolStudioTemplate::getInstance());
+        if(!$oGrid)
+            return $sContent;
+
+		if($this->_oModule->_oConfig->getOwner() == 0)
+			$sContent .= $this->_oModule->_oTemplate->displayEmptyOwner();
+
+		$sContent .= $this->_oModule->_oTemplate->getJsCode('administration', array('sObjNameGrid' => $sGrid));
+		$sContent .= $oGrid->getCode();
 
-    	return $sContent;
+		return $sContent;
     }
 }
 

+ 1 - 7
modules/boonex/acl/install/langs/en.xml

@@ -4,16 +4,11 @@
 	<string name="_bx_acl"><![CDATA[ACL]]></string>
 
 	<!-- Pages -->
-	<string name="_bx_acl_page_title_sys_administration"><![CDATA[Manage Prices]]></string>
-	<string name="_bx_acl_page_title_administration"><![CDATA[Manage Prices]]></string>
-	<string name="_bx_acl_page_block_title_system_administration"><![CDATA[Manage Prices]]></string>
-	<string name="_bx_acl_page_block_title_administration"><![CDATA[Manage Prices]]></string>
-
 	<string name="_bx_acl_page_title_sys_view"><![CDATA[Membership]]></string>
 	<string name="_bx_acl_page_title_view"><![CDATA[Membership]]></string>
 	<string name="_bx_acl_page_block_title_system_view"><![CDATA[Membership]]></string>
 	<string name="_bx_acl_page_block_title_view"><![CDATA[Membership]]></string>
-	
+
 
 	<!-- Forms -->
 	<string name="_bx_acl_form_price"><![CDATA[Price]]></string>
@@ -62,7 +57,6 @@
 
 
 	<!-- Menus -->
-	<string name="_bx_acl_menu_item_title_administration"><![CDATA[Manage]]></string>
 	<string name="_bx_acl_menu_item_title_system_acl_view"><![CDATA[Membership]]></string>
 	<string name="_bx_acl_menu_item_title_acl_view"><![CDATA[Membership]]></string>
 

+ 5 - 5
modules/boonex/acl/install/sql/disable.sql

@@ -13,11 +13,11 @@ DELETE FROM `sys_menu_items` WHERE `module` = @sName;
 
 
 -- SETTINGS
-SET @iTypeId = (SELECT `ID` FROM `sys_options_types` WHERE `name` = @sName LIMIT 1);
-SET @iCategId = (SELECT `ID` FROM `sys_options_categories` WHERE `type_id` = @iTypeId LIMIT 1);
-DELETE FROM `sys_options` WHERE `category_id` = @iCategId;
-DELETE FROM `sys_options_categories` WHERE `type_id` = @iTypeId;
-DELETE FROM `sys_options_types` WHERE `id` = @iTypeId;
+-- SET @iTypeId = (SELECT `ID` FROM `sys_options_types` WHERE `name` = @sName LIMIT 1);
+-- SET @iCategId = (SELECT `ID` FROM `sys_options_categories` WHERE `type_id` = @iTypeId LIMIT 1);
+-- DELETE FROM `sys_options` WHERE `category_id` = @iCategId;
+-- DELETE FROM `sys_options_categories` WHERE `type_id` = @iTypeId;
+-- DELETE FROM `sys_options_types` WHERE `id` = @iTypeId;
 
 
 -- ALERTS

+ 9 - 16
modules/boonex/acl/install/sql/enable.sql

@@ -1,13 +1,6 @@
 SET @sName = 'bx_acl';
 
 
--- PAGE: module administration
-INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `uri`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 
-('bx_acl_administration', '_bx_acl_page_title_sys_administration', '_bx_acl_page_title_administration', @sName, 5, 192, 1, 'acl-administration', 'page.php?i=acl-administration', '', '', '', 0, 1, 0, '', '');
-
-INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES 
-('bx_acl_administration', 1, @sName, '_bx_acl_page_block_title_system_administration', '_bx_acl_page_block_title_administration', 11, 192, 'service', 'a:2:{s:6:\"module\";s:6:\"bx_acl\";s:6:\"method\";s:24:\"get_block_administration\";}', 0, 1, 0);
-
 -- PAGE: view levels
 INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `uri`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 
 ('bx_acl_view', '_bx_acl_page_title_sys_view', '_bx_acl_page_title_view', @sName, 5, 2147483647, 1, 'acl-view', 'page.php?i=acl-view', '', '', '', 0, 1, 0, '', '');
@@ -23,17 +16,17 @@ INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `tit
 
 
 -- SETTINGS
-SET @iTypeOrder = (SELECT MAX(`order`) FROM `sys_options_types` WHERE `group` = 'modules');
-INSERT INTO `sys_options_types`(`group`, `name`, `caption`, `icon`, `order`) VALUES 
-('modules', @sName, '_bx_acl', 'bx_acl@modules/boonex/acl/|std-mi.png', IF(ISNULL(@iTypeOrder), 1, @iTypeOrder + 1));
-SET @iTypeId = LAST_INSERT_ID();
+-- SET @iTypeOrder = (SELECT MAX(`order`) FROM `sys_options_types` WHERE `group` = 'modules');
+-- INSERT INTO `sys_options_types`(`group`, `name`, `caption`, `icon`, `order`) VALUES 
+-- ('modules', @sName, '_bx_acl', 'bx_acl@modules/boonex/acl/|std-mi.png', IF(ISNULL(@iTypeOrder), 1, @iTypeOrder + 1));
+-- SET @iTypeId = LAST_INSERT_ID();
 
-INSERT INTO `sys_options_categories` (`type_id`, `name`, `caption`, `order`)
-VALUES (@iTypeId, @sName, '_bx_acl', 1);
-SET @iCategId = LAST_INSERT_ID();
+-- INSERT INTO `sys_options_categories` (`type_id`, `name`, `caption`, `order`)
+-- VALUES (@iTypeId, @sName, '_bx_acl', 1);
+-- SET @iCategId = LAST_INSERT_ID();
 
---INSERT INTO `sys_options` (`name`, `value`, `category_id`, `caption`, `type`, `check`, `check_error`, `extra`, `order`) VALUES
---('bx_acl_remove_expired_for', '30', @iCategId, '_bx_acl_option_remove_expired_for', 'digit', '', '', '', 3);
+-- INSERT INTO `sys_options` (`name`, `value`, `category_id`, `caption`, `type`, `check`, `check_error`, `extra`, `order`) VALUES
+-- ('bx_acl_remove_expired_for', '30', @iCategId, '_bx_acl_option_remove_expired_for', 'digit', '', '', '', 3);
 
 
 -- ALERTS

+ 0 - 6
modules/boonex/russian/data/langs/bx_acl/ru.xml

@@ -4,11 +4,6 @@
 	<string name="_bx_acl"><![CDATA[ACL]]></string>
 
 	<!-- Pages -->
-	<string name="_bx_acl_page_title_sys_administration"><![CDATA[Управление ценами]]></string>
-	<string name="_bx_acl_page_title_administration"><![CDATA[Управление ценами]]></string>
-	<string name="_bx_acl_page_block_title_system_administration"><![CDATA[Управление ценами]]></string>
-	<string name="_bx_acl_page_block_title_administration"><![CDATA[Управление ценами]]></string>
-
 	<string name="_bx_acl_page_title_sys_view"><![CDATA[Членство]]></string>
 	<string name="_bx_acl_page_title_view"><![CDATA[Членство]]></string>
 	<string name="_bx_acl_page_block_title_system_view"><![CDATA[Членство]]></string>
@@ -62,7 +57,6 @@
 
 
 	<!-- Menus -->
-	<string name="_bx_acl_menu_item_title_administration"><![CDATA[Управление]]></string>
 	<string name="_bx_acl_menu_item_title_system_acl_view"><![CDATA[Членство]]></string>
 	<string name="_bx_acl_menu_item_title_acl_view"><![CDATA[Членство]]></string>
 

+ 3 - 4
studio/classes/BxDolStudioFormsQuery.php

@@ -551,13 +551,12 @@ class BxDolStudioFormsQuery extends BxDolDb
 
     function deleteValues($aParams)
     {
+    	$aBindings = array();
         $sWhereClause = $sLimitClause = "";
 
         switch($aParams['type']) {
             case 'by_key':
-            	$aMethod['params'][1] = array(
-                	'key' => $aParams['value']
-                );
+            	$aBindings['key'] = $aParams['value'];
 
                 $sWhereClause = " AND `tv`.`Key`=:key ";
                 break;
@@ -567,7 +566,7 @@ class BxDolStudioFormsQuery extends BxDolDb
         }
 
         $sSql = "DELETE FROM `tv` USING `sys_form_pre_values` AS `tv` WHERE 1 " . $sWhereClause . " " . $sLimitClause;
-        return $this->query($sSql) !== false;
+        return $this->query($sSql, $aBindings) !== false;
     }
 
     function getValuesOrderMax($sKey)