Browse Source

Minor fixes and improvements

AntonLV 13 years ago
parent
commit
334ddfddb8

+ 1 - 1
inc/classes/BxDolRequest.php

@@ -113,7 +113,7 @@ class BxDolRequest extends BxDol {
         $aModule = $mixedModule;
         $aModule = $mixedModule;
         if(is_string($mixedModule)) {
         if(is_string($mixedModule)) {
             bx_import('BxDolModuleQuery');
             bx_import('BxDolModuleQuery');
-            $aModule = BxDolModuleQuery::getInstance()->getModuleByUri($mixedModule);
+            $aModule = BxDolModuleQuery::getInstance()->getModuleByName($mixedModule);
         }
         }
 
 
         if (!$aModule)
         if (!$aModule)

+ 8 - 0
inc/classes/BxDolSession.php

@@ -127,6 +127,14 @@ class BxDolSession extends BxDol {
         return isset($this->aData[$sKey]) ? $this->aData[$sKey] : false;
         return isset($this->aData[$sKey]) ? $this->aData[$sKey] : false;
     }
     }
 
 
+	function getUnsetValue($sKey) {
+        $mixedValue = $this->getValue($sKey);
+        if($mixedValue !== false)
+        	$this->unsetValue($sKey);
+
+        return $mixedValue;
+    }
+
     private function save() {
     private function save() {
         if($this->iUserId == 0)
         if($this->iUserId == 0)
             $this->iUserId = getLoggedId();
             $this->iUserId = getLoggedId();

+ 3 - 1
inc/js/jquery.webForms.js

@@ -271,12 +271,14 @@
                 var eBtnCross = eWrapper.find('.bx-form-input-btn-cross');
                 var eBtnCross = eWrapper.find('.bx-form-input-btn-cross');
 
 
                 eInput.on('focus', function () {
                 eInput.on('focus', function () {
+                	var iTop = ($(this).outerHeight() - eBtnCross.height())/2; 
+
                     eBtnCross.show().position({
                     eBtnCross.show().position({
                             of: $(this),
                             of: $(this),
                             my: 'right top',
                             my: 'right top',
                             at: 'right top',
                             at: 'right top',
                             collision: 'none none',
                             collision: 'none none',
-                            offset: '-8 11'
+                            offset: '-8 ' + iTop
                     });
                     });
                 });
                 });
 
 

+ 1 - 1
inc/profiles.inc.php

@@ -207,7 +207,7 @@ function bx_login($iId, $bRememberMe = false) {
 
 
 function bx_logout($bNotify = true) {
 function bx_logout($bNotify = true) {
     if ($bNotify && isMember())
     if ($bNotify && isMember())
-        bx_alert('profile', 'logout', (int)$_COOKIE['memberID']);
+        bx_alert('account', 'logout', (int)$_COOKIE['memberID']);
 
 
     $aUrl = parse_url(BX_DOL_URL_ROOT);
     $aUrl = parse_url(BX_DOL_URL_ROOT);
     $sPath = isset($aUrl['path']) && !empty($aUrl['path']) ? $aUrl['path'] : '/';
     $sPath = isset($aUrl['path']) && !empty($aUrl['path']) ? $aUrl['path'] : '/';

+ 4 - 6
inc/utils.inc.php

@@ -644,13 +644,13 @@ function _format_when ($iSec) {
     if ($iSec>0) {
     if ($iSec>0) {
         if ($iSec < 3600) {
         if ($iSec < 3600) {
             $i = round($iSec/60);
             $i = round($iSec/60);
-            $s .= (0 == $i || 1 == $i) ? _t('_x_minute_ago', '1') : _t('_x_minute_ago', $i, 's');
+            $s .= (0 == $i || 1 == $i) ? _t('_x_minute_ago', '1', '') : _t('_x_minute_ago', $i, 's');
         } else if ($iSec < 86400) {
         } else if ($iSec < 86400) {
             $i = round($iSec/60/60);
             $i = round($iSec/60/60);
-            $s .= (0 == $i || 1 == $i) ? _t('_x_hour_ago', '1') : _t('_x_hour_ago', $i, 's');
+            $s .= (0 == $i || 1 == $i) ? _t('_x_hour_ago', '1', '') : _t('_x_hour_ago', $i, 's');
         } else {
         } else {
             $i = round($iSec/60/60/24);
             $i = round($iSec/60/60/24);
-            $s .= (0 == $i || 1 == $i) ? _t('_x_day_ago', '1') : _t('_x_day_ago', $i, 's');
+            $s .= (0 == $i || 1 == $i) ? _t('_x_day_ago', '1', '') : _t('_x_day_ago', $i, 's');
         }
         }
     } else {
     } else {
         if ($iSec > -3600) {
         if ($iSec > -3600) {
@@ -1364,8 +1364,7 @@ function bx_convert_array2attrs ($a, $sClasses = false, $sStyles = false) {
     }
     }
 
 
     foreach ($a as $sKey => $sValue) {
     foreach ($a as $sKey => $sValue) {
-
-        if (empty($sValue) || is_null($sValue)) // pass NULL values
+        if(is_null($sValue)) // pass NULL values
             continue;
             continue;
 
 
         $sValueC = bx_html_attribute($sValue, BX_ESCAPE_STR_QUOTE);
         $sValueC = bx_html_attribute($sValue, BX_ESCAPE_STR_QUOTE);
@@ -1373,7 +1372,6 @@ function bx_convert_array2attrs ($a, $sClasses = false, $sStyles = false) {
         $sRet .= " $sKey=\"$sValueC\"";
         $sRet .= " $sKey=\"$sValueC\"";
     }
     }
 
 
-
     return $sRet;
     return $sRet;
 }
 }
 
 

+ 2 - 2
member.php

@@ -17,8 +17,8 @@ if (isset($_POST['ID'])) { // login form is submitted
 
 
     bx_import ('BxDolForm');
     bx_import ('BxDolForm');
     $oForm = BxDolForm::getObjectInstance('sys_login', 'sys_login');
     $oForm = BxDolForm::getObjectInstance('sys_login', 'sys_login');
-    
-    bx_alert('profile', 'before_login', 0, 0, array('form' => $oForm));
+
+    bx_alert('account', 'before_login', 0, 0, array('form' => $oForm));
 
 
     $oForm->initChecker();
     $oForm->initChecker();
     $oForm->setRole(bx_get('role'));    
     $oForm->setRole(bx_get('role'));    

+ 1 - 1
modules/boonex/notes/install/config.php

@@ -24,7 +24,7 @@ $aConfig = array(
     'update_url' => 'http://www.boonex.com/products/{uri}',
     'update_url' => 'http://www.boonex.com/products/{uri}',
 
 
     'compatible_with' => array(
     'compatible_with' => array(
-        '7.0.6'
+        '8.0.x'
     ),
     ),
 
 
     /**
     /**

+ 158 - 158
studio/classes/BxDolStudioBuilderPage.php

@@ -1,159 +1,159 @@
-<?php
-/**
- * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
- * CC-BY License - http://creativecommons.org/licenses/by/3.0/
- *
- * @defgroup    DolphinStudio Dolphin Studio
- * @{
- */
-defined('BX_DOL') or die('hack attempt');
-
-bx_import('BxTemplStudioPage');
-bx_import('BxDolStudioBuilderPageQuery');
-
-define('BX_DOL_STUDIO_BP_SKELETONS', 'skeletons');
-
-define('BX_DOL_STUDIO_BP_TYPE_DEFAULT', BX_DOL_STUDIO_MODULE_SYSTEM);
-
-define('BX_DOL_STUDIO_BP_BLOCK_RAW', 'raw');
-define('BX_DOL_STUDIO_BP_BLOCK_HTML', 'html');
-define('BX_DOL_STUDIO_BP_BLOCK_RSS', 'rss');
-define('BX_DOL_STUDIO_BP_BLOCK_IMAGE', 'image');
-define('BX_DOL_STUDIO_BP_BLOCK_LANG', 'lang');
-define('BX_DOL_STUDIO_BP_BLOCK_MENU', 'menu');
-define('BX_DOL_STUDIO_BP_BLOCK_SERVICE', 'service');
-
-class BxDolStudioBuilderPage extends BxTemplStudioPage {
-    protected $sType;
-    protected $sPage;
-    protected $sPageBaseUrl;
-    protected $aPageRebuild;
-
-    function __construct($sType = '', $sPage = '') {
-        parent::BxTemplStudioPage('builder_pages');
-
-        $this->oDb = new BxDolStudioBuilderPageQuery();
-
-        $this->sType = BX_DOL_STUDIO_BP_TYPE_DEFAULT;
-        if(is_string($sType) && !empty($sType))
-            $this->sType = $sType;
-
-        $this->sPage = '';
-        $this->sPageBaseUrl = 'page.php?i=';
-        $this->aPageRebuild = array();
-        if(is_string($sPage) && !empty($sPage)) {
-            $this->sPage = $sPage;
-
-            $this->aPageRebuild = array();
-            $this->oDb->getPages(array('type' => 'by_object_full', 'value' => $this->sPage), $this->aPageRebuild, false);
-            if(empty($this->aPageRebuild) || !is_array($this->aPageRebuild)) {
-                $this->sPage = '';
-                $this->aPageRebuild = array();
-            }
-        }
-    }
-
-    function init() {
-        //--- Check actions ---//
-        if(($sAction = bx_get('bp_action')) !== false) {
-	        $sAction = bx_process_input($sAction);
-
-            $aResult = array('code' => 1, 'message' => _t('_adm_bp_err_cannot_process_action'));
-	        switch($sAction) {
-	            case 'reorder':
-	                if(empty($this->aPageRebuild) || !is_array($this->aPageRebuild))
-	                    break;
-
-                    $bResult = false;
-                    for($i = 1; $i <= $this->aPageRebuild['layout_cells_number']; $i++) {
-                        $aItems = bx_get('bp_items_' . $i);
-                        $iItems = count($aItems);
-
-                        for($j = 0; $j < $iItems; $j++)
-                            $bResult |= $this->oDb->updateBlock((int)$aItems[$j], array(
-                            	'cell_id' => $i,
-                                'order' => $j
-                            ));
-                    }
-	                $aResult = $bResult ? array('code' => 0, 'message' => _t('_adm_bp_scs_save')) : array('code' => 1, 'message' => _t('_adm_bp_err_nothing_changed'));
-	                break;
-
-                default:
-                    $sMethod = 'action' . $this->getClassName($sAction);
-                    if(method_exists($this, $sMethod))
-                        $aResult = $this->$sMethod();
-	        }
-
-	        $oJson = new Services_JSON();		        
-            echo $oJson->encode($aResult);
-            exit;
-        }
-    }
-
-    protected function onSaveBlock(&$oForm, &$aBlock) {
-        $iDesignboxId = (int)str_replace($this->sSelectKeyPrefix, '', $oForm->getCleanValue('designbox_id'));
-        BxDolForm::setSubmittedValue('designbox_id', $iDesignboxId, $oForm->aFormAttrs['method']);
-
-        $iVisibleFor = BxDolStudioUtils::getVisibilityValue($oForm->getCleanValue('visible_for'), $oForm->getCleanValue('visible_for_levels'));
-        BxDolForm::setSubmittedValue('visible_for_levels', $iVisibleFor, $oForm->aFormAttrs['method']);
-        unset($oForm->aInputs['visible_for']);
-
-        //--- Process Lang fields
-        if($aBlock['type'] == BX_DOL_STUDIO_BP_BLOCK_LANG && isset($oForm->aInputs['content'])) {
-            bx_import('BxDolStudioLanguagesUtils');
-            $oLanguage = BxDolStudioLanguagesUtils::getInstance();
-        
-            $sContentKey = '';
-            $sContentValue = $oForm->getCleanValue('content');
-            if($aBlock['content'] == '') {
-                $sContentKey = '_sys_bpb_content_' . $aBlock['id'];
-                $oLanguage->addLanguageString($sContentKey, $sContentValue);
-            }
-            else {
-                $sContentKey = $aBlock['content'];
-                $oLanguage->updateLanguageString($sContentKey, $sContentValue);
-            }
-            BxDolForm::setSubmittedValue('content', $sContentKey, $oForm->aFormAttrs['method']);
-        }
-
-        //--- Process Image fields
-        if($aBlock['type'] == BX_DOL_STUDIO_BP_BLOCK_IMAGE && isset($oForm->aInputs['image_file'], $oForm->aInputs['image_align'])) {
-            $iImageId = 0;
-            if($aBlock['content'] != '')
-                list($iImageId) = explode($this->sParamsDivider, $aBlock['content']);
-
-            $iImageId = $oForm->processImageUploaderSave('image_file', $iImageId);
-            if(is_string($iImageId) && !is_numeric($iImageId))
-                return array('msg' => $iImageId);
-
-            $sImageAlign = $oForm->getCleanValue('image_align');
-
-            unset($oForm->aInputs['image_file'], $oForm->aInputs['image_align']);
-            BxDolForm::setSubmittedValue('content', implode($this->sParamsDivider, array($iImageId, $sImageAlign)), $oForm->aFormAttrs['method']);
-        }
-
-        //--- Process RSS fields
-        if($aBlock['type'] == BX_DOL_STUDIO_BP_BLOCK_RSS && isset($oForm->aInputs['rss_url'], $oForm->aInputs['rss_length'])) {
-            $aRss = array(
-                trim($oForm->getCleanValue('rss_url')),
-                $oForm->getCleanValue('rss_length')
-            );
-
-            unset($oForm->aInputs['rss_url'], $oForm->aInputs['rss_length']);
-            BxDolForm::setSubmittedValue('content', implode($this->sParamsDivider, $aRss), $oForm->aFormAttrs['method']);
-        }
-    }
-    
-    protected function addInArray($aInput, $sKey, $aValues) {
-        bx_import('BxDolStudioUtils');
-        return BxDolStudioUtils::addInArray($aInput, $sKey, $aValues);
-    }
-
-    protected function getModuleIcon($sName) {
-        if(in_array($sName, array(BX_DOL_STUDIO_MODULE_CUSTOM, BX_DOL_STUDIO_BP_SKELETONS))) 
-            return BxDolStudioTemplate::getInstance()->getIconUrl('mi-bp-' . $sName . '.png');
-
-        return BxDolStudioUtils::getModuleIcon($sName);
-    }
-}
+<?php
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    DolphinStudio Dolphin Studio
+ * @{
+ */
+defined('BX_DOL') or die('hack attempt');
+
+bx_import('BxTemplStudioPage');
+bx_import('BxDolStudioBuilderPageQuery');
+
+define('BX_DOL_STUDIO_BP_SKELETONS', 'skeletons');
+
+define('BX_DOL_STUDIO_BP_TYPE_DEFAULT', BX_DOL_STUDIO_MODULE_SYSTEM);
+
+define('BX_DOL_STUDIO_BP_BLOCK_RAW', 'raw');
+define('BX_DOL_STUDIO_BP_BLOCK_HTML', 'html');
+define('BX_DOL_STUDIO_BP_BLOCK_RSS', 'rss');
+define('BX_DOL_STUDIO_BP_BLOCK_IMAGE', 'image');
+define('BX_DOL_STUDIO_BP_BLOCK_LANG', 'lang');
+define('BX_DOL_STUDIO_BP_BLOCK_MENU', 'menu');
+define('BX_DOL_STUDIO_BP_BLOCK_SERVICE', 'service');
+
+class BxDolStudioBuilderPage extends BxTemplStudioPage {
+    protected $sType;
+    protected $sPage;
+    protected $sPageBaseUrl;
+    protected $aPageRebuild;
+
+    function __construct($sType = '', $sPage = '') {
+        parent::BxTemplStudioPage('builder_pages');
+
+        $this->oDb = new BxDolStudioBuilderPageQuery();
+
+        $this->sType = BX_DOL_STUDIO_BP_TYPE_DEFAULT;
+        if(is_string($sType) && !empty($sType))
+            $this->sType = $sType;
+
+        $this->sPage = '';
+        $this->sPageBaseUrl = 'page.php?i=';
+        $this->aPageRebuild = array();
+        if(is_string($sPage) && !empty($sPage)) {
+            $this->sPage = $sPage;
+
+            $this->aPageRebuild = array();
+            $this->oDb->getPages(array('type' => 'by_object_full', 'value' => $this->sPage), $this->aPageRebuild, false);
+            if(empty($this->aPageRebuild) || !is_array($this->aPageRebuild)) {
+                $this->sPage = '';
+                $this->aPageRebuild = array();
+            }
+        }
+    }
+
+    function init() {
+        //--- Check actions ---//
+        if(($sAction = bx_get('bp_action')) !== false) {
+	        $sAction = bx_process_input($sAction);
+
+            $aResult = array('code' => 1, 'message' => _t('_adm_bp_err_cannot_process_action'));
+	        switch($sAction) {
+	            case 'reorder':
+	                if(empty($this->aPageRebuild) || !is_array($this->aPageRebuild))
+	                    break;
+
+                    $bResult = false;
+                    for($i = 1; $i <= $this->aPageRebuild['layout_cells_number']; $i++) {
+                        $aItems = bx_get('bp_items_' . $i);
+                        $iItems = count($aItems);
+
+                        for($j = 0; $j < $iItems; $j++)
+                            $bResult |= $this->oDb->updateBlock((int)$aItems[$j], array(
+                            	'cell_id' => $i,
+                                'order' => $j
+                            ));
+                    }
+	                $aResult = $bResult ? array('code' => 0, 'message' => _t('_adm_bp_scs_save')) : array('code' => 1, 'message' => _t('_adm_bp_err_nothing_changed'));
+	                break;
+
+                default:
+                    $sMethod = 'action' . $this->getClassName($sAction);
+                    if(method_exists($this, $sMethod))
+                        $aResult = $this->$sMethod();
+	        }
+
+	        $oJson = new Services_JSON();		        
+            echo $oJson->encode($aResult);
+            exit;
+        }
+    }
+
+    protected function onSaveBlock(&$oForm, &$aBlock) {
+        $iDesignboxId = (int)str_replace($this->sSelectKeyPrefix, '', $oForm->getCleanValue('designbox_id'));
+        BxDolForm::setSubmittedValue('designbox_id', $iDesignboxId, $oForm->aFormAttrs['method']);
+
+        $iVisibleFor = BxDolStudioUtils::getVisibilityValue($oForm->getCleanValue('visible_for'), $oForm->getCleanValue('visible_for_levels'));
+        BxDolForm::setSubmittedValue('visible_for_levels', $iVisibleFor, $oForm->aFormAttrs['method']);
+        unset($oForm->aInputs['visible_for']);
+
+        //--- Process Lang fields
+        if($aBlock['type'] == BX_DOL_STUDIO_BP_BLOCK_LANG && isset($oForm->aInputs['content'])) {
+            bx_import('BxDolStudioLanguagesUtils');
+            $oLanguage = BxDolStudioLanguagesUtils::getInstance();
+        
+            $sContentKey = '';
+            $sContentValue = $oForm->getCleanValue('content');
+            if($aBlock['content'] == '') {
+                $sContentKey = '_sys_bpb_content_' . $aBlock['id'];
+                $oLanguage->addLanguageString($sContentKey, $sContentValue);
+            }
+            else {
+                $sContentKey = $aBlock['content'];
+                $oLanguage->updateLanguageString($sContentKey, $sContentValue);
+            }
+            BxDolForm::setSubmittedValue('content', $sContentKey, $oForm->aFormAttrs['method']);
+        }
+
+        //--- Process Image fields
+        if($aBlock['type'] == BX_DOL_STUDIO_BP_BLOCK_IMAGE && isset($oForm->aInputs['image_file'], $oForm->aInputs['image_align'])) {
+            $iImageId = 0;
+            if($aBlock['content'] != '')
+                list($iImageId) = explode($this->sParamsDivider, $aBlock['content']);
+
+            $iImageId = $oForm->processImageUploaderSave('image_file', $iImageId);
+            if(is_string($iImageId) && !is_numeric($iImageId))
+                return array('msg' => $iImageId);
+
+            $sImageAlign = $oForm->getCleanValue('image_align');
+
+            unset($oForm->aInputs['image_file'], $oForm->aInputs['image_align']);
+            BxDolForm::setSubmittedValue('content', implode($this->sParamsDivider, array($iImageId, $sImageAlign)), $oForm->aFormAttrs['method']);
+        }
+
+        //--- Process RSS fields
+        if($aBlock['type'] == BX_DOL_STUDIO_BP_BLOCK_RSS && isset($oForm->aInputs['rss_url'], $oForm->aInputs['rss_length'])) {
+            $aRss = array(
+                trim($oForm->getCleanValue('rss_url')),
+                $oForm->getCleanValue('rss_length')
+            );
+
+            unset($oForm->aInputs['rss_url'], $oForm->aInputs['rss_length']);
+            BxDolForm::setSubmittedValue('content', implode($this->sParamsDivider, $aRss), $oForm->aFormAttrs['method']);
+        }
+    }
+    
+    protected function addInArray($aInput, $sKey, $aValues) {
+        bx_import('BxDolStudioUtils');
+        return BxDolStudioUtils::addInArray($aInput, $sKey, $aValues);
+    }
+
+    protected function getModuleIcon($sName) {
+        if(in_array($sName, array(BX_DOL_STUDIO_MODULE_SYSTEM, BX_DOL_STUDIO_MODULE_CUSTOM, BX_DOL_STUDIO_BP_SKELETONS))) 
+            return BxDolStudioTemplate::getInstance()->getIconUrl('mi-bp-' . $sName . '.png');
+
+        return BxDolStudioUtils::getModuleIcon($sName);
+    }
+}
 /** @} */
 /** @} */

BIN
studio/template/images/icons/mi-bp-system.png


+ 1 - 0
template/bx_a.html

@@ -0,0 +1 @@
+<a href="__href__" title="__title__" <bx_repeat:attrs>__key__="__value__"</bx_repeat:attrs>>__content__</a>

+ 6 - 1
template/scripts/BxBasePage.php

@@ -108,7 +108,12 @@ class BxBasePage extends BxDolPage {
 
 
             if (is_array($mixedContent)) {
             if (is_array($mixedContent)) {
                 if (isset($mixedContent['content']))
                 if (isset($mixedContent['content']))
-                    $sContentWithBox = DesignBoxContent($sTitle, $mixedContent['content'], $aBlock['designbox_id'], isset($mixedContent['menu']) ? isset($mixedContent['menu']) : false);
+                    $sContentWithBox = DesignBoxContent(
+                    	isset($mixedContent['title']) ? $mixedContent['title'] : $sTitle, 
+                    	$mixedContent['content'], 
+                    	isset($mixedContent['designbox_id']) ? $mixedContent['designbox_id'] : $aBlock['designbox_id'], 
+                    	isset($mixedContent['menu']) ? $mixedContent['menu'] : false
+                    );
             } elseif (is_string($mixedContent)) {
             } elseif (is_string($mixedContent)) {
                 $sContentWithBox = DesignBoxContent($sTitle, $mixedContent, $aBlock['designbox_id']);
                 $sContentWithBox = DesignBoxContent($sTitle, $mixedContent, $aBlock['designbox_id']);
             } else {
             } else {