Преглед изворни кода

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

Alex Trofimov пре 12 година
родитељ
комит
8facdf12e8

+ 0 - 3
inc/classes/BxDolTemplate.php

@@ -948,9 +948,6 @@ class BxDolTemplate extends BxDol implements iBxDolSingleton {
                 $oInformer = BxDolInformer::getInstance($this);
                 $sRet = $oInformer ? $oInformer->display() : '';
                 break;
-            case 'switch_skin_block':
-                $sRet = getParam("enable_template") ? templates_select_txt() : '';
-                break;
             case 'dol_images':
                 $sRet = $this->_processJsImages();
                 break;

+ 0 - 13
inc/js/jquery.dolPopup.js

@@ -201,19 +201,6 @@
 
         return this.each(function() {
             var e = $(this);
-            /*
-             * TODO: Remove commented if modified version is working properly. Old version was commented because it doesn't work 
-             * for different identical popups with different content which are applied to Window, because the first call sets 
-             * attribute "bx-popup-id" with its ID to Window and then everytime the first popup is displayed without loading 
-             * the other popups even if another ID and URL were passed via Options.
-             * 
-            if ('undefined' == typeof(e.attr('bx-popup-id'))) {
-                id = ('undefined' == typeof(options.id) ? parseInt(2147483647 * Math.random()) : options.id);
-                e.attr('bx-popup-id', id);
-            } else {
-                id = e.attr('bx-popup-id');
-            }
-            */
 
             // get id
             var sPopupId = '';

+ 0 - 18
inc/utils.inc.php

@@ -384,24 +384,6 @@ function get_templates_array($bEnabledOnly = true, $bShortInfo = true) {
 		return $oDb->getAllWithKey("SELECT * FROM `sys_modules` WHERE 1 AND `type`='" . BX_DOL_MODULE_TYPE_TEMPLATE . "'" . $sWhereAddon, "uri"); 
 }
 
-/*
- * The Function Show a Line with Templates Names
- */
-function templates_select_txt() {
-    $templ_choices = get_templates_array();
-    $current_template = ( strlen( $_GET['skin'] ) ) ? $_GET['skin'] : $_COOKIE['skin'];
-
-    foreach ($templ_choices as $tmpl_key => $tmpl_value) {
-        if ($current_template == $tmpl_key) {
-            $ReturnResult .= $tmpl_value . ' | ';
-        } else {
-            $sGetTransfer = bx_encode_url_params($_GET, array('skin'));
-            $ReturnResult .= '<a href="' . bx_html_attribute($_SERVER['PHP_SELF']) . '?' . $sGetTransfer . 'skin=' . $tmpl_key . '">' . $tmpl_value . '</a> | ';
-        }
-    }
-    return $ReturnResult;
-}
-
 function extFileExists( $sFileSrc ) {
     return (file_exists( $sFileSrc ) && is_file( $sFileSrc )) ? true : false;
 }

+ 11 - 6
install/sql/system.sql

@@ -257,10 +257,9 @@ SET @iCategoryId = LAST_INSERT_ID();
 
 INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `extra`, `check`, `check_error`, `order`) VALUES
 (@iCategoryId, 'template', '_adm_stg_cpt_option_template', '', 'select', 'a:3:{s:6:"module";s:6:"system";s:6:"method";s:13:"get_templates";s:5:"class";s:21:"TemplTemplateServices";}', 'Template', '_adm_stg_err_option_template', 1),
-(@iCategoryId, 'enable_template', '_adm_stg_cpt_option_enable_template', 'on', 'checkbox', '', '', '', 2),
 
-(@iCategoryId, 'sys_template_page_width_min', '_adm_stg_cpt_option_sys_template_page_width_min', '774', 'digit', '', '', '', 3),
-(@iCategoryId, 'sys_template_page_width_max', '_adm_stg_cpt_option_sys_template_page_width_max', '1600', 'digit', '', '', '', 4);
+(@iCategoryId, 'sys_template_page_width_min', '_adm_stg_cpt_option_sys_template_page_width_min', '774', 'digit', '', '', '', 2),
+(@iCategoryId, 'sys_template_page_width_max', '_adm_stg_cpt_option_sys_template_page_width_max', '1600', 'digit', '', '', '', 3);
 
 
 --
@@ -2563,7 +2562,9 @@ INSERT INTO `sys_objects_menu` (`object`, `title`, `set_name`, `module`, `templa
 ('sys_cmts_item_actions', '_sys_menu_title_cmts_item_actions', 'sys_cmts_item_actions', 'system', 10, 0, 1, 'BxTemplCmtsMenu', ''),
 ('sys_account_popup', '_sys_menu_title_account_popup', '', 'system', 12, 0, 1, 'BxTemplMenuAccountPopup', ''),
 ('sys_account_notifications', '_sys_menu_title_account_notifications', 'sys_account_notifications', 'system', 13, 0, 1, 'BxTemplMenuAccountNotifications', ''),
-('sys_profile_stats', '_sys_menu_title_profile_stats', 'sys_profile_stats', 'system', 6, 0, 1, 'BxTemplMenuProfileStats', '');
+('sys_profile_stats', '_sys_menu_title_profile_stats', 'sys_profile_stats', 'system', 6, 0, 1, 'BxTemplMenuProfileStats', ''),
+('sys_switch_language', '_sys_menu_title_switch_language', 'sys_switch_language', 'system', 6, 0, 1, 'BxTemplMenuSwitchLanguage', ''),
+('sys_switch_template', '_sys_menu_title_switch_template', 'sys_switch_template', 'system', 6, 0, 1, 'BxTemplMenuSwitchTemplate', '');
 
 CREATE TABLE IF NOT EXISTS `sys_menu_sets` (
   `set_name` varchar(64) NOT NULL,
@@ -2587,7 +2588,9 @@ INSERT INTO `sys_menu_sets` (`set_name`, `module`, `title`, `deletable`) VALUES
 ('sys_profiles_create', 'system', '_sys_menu_set_title_profile_create_links', 0),
 ('sys_profile_stats', 'system', '_sys_menu_set_title_profile_stats', 0),
 ('sys_cmts_item_manage', 'system', '_sys_menu_set_title_cmts_item_manage', 0),
-('sys_cmts_item_actions', 'system', '_sys_menu_set_title_cmts_item_actions', 0);
+('sys_cmts_item_actions', 'system', '_sys_menu_set_title_cmts_item_actions', 0),
+('sys_switch_language', 'system', '_sys_menu_set_title_switch_language', 0),
+('sys_switch_template', 'system', '_sys_menu_set_title_switch_template', 0);
 
 CREATE TABLE IF NOT EXISTS `sys_menu_items` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
@@ -2616,7 +2619,9 @@ INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `tit
 
 -- footer menu
 INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `order`) VALUES
-('sys_footer', 'system', 'about', '_sys_menu_item_title_system_about', '_sys_menu_item_title_about', 'page.php?i=about', '', '', '', '', 2147483647, 1, 1, 1);
+('sys_footer', 'system', 'about', '_sys_menu_item_title_system_about', '_sys_menu_item_title_about', 'page.php?i=about', '', '', '', '', 2147483647, 1, 1, 1),
+('sys_footer', 'system', 'switch_language', '_sys_menu_item_title_system_switch_language', '_sys_menu_item_title_switch_language', 'javascript:void(0);', 'bx_menu_popup(''sys_switch_language'', window);', '', '', '', 2147483647, 1, 1, 2),
+('sys_footer', 'system', 'switch_template', '_sys_menu_item_title_system_switch_template', '_sys_menu_item_title_switch_template', 'javascript:void(0);', 'bx_menu_popup(''sys_switch_template'', window);', '', '', '', 2147483647, 1, 1, 3);
 
 -- site toolbar menu
 INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `order`) VALUES

+ 10 - 1
modules/boonex/english/data/langs/system.xml

@@ -1089,7 +1089,8 @@
 	<string name="_adm_stg_cpt_option_currency_sign"><![CDATA[Currency sign (for display purposes only)]]></string>
 	<string name="_adm_stg_err_option_currency_sign"><![CDATA[Cannot be empty.]]></string>
 	<string name="_adm_stg_cpt_option_enable_gd"><![CDATA[Use GD library for image processing]]></string>
-	<string name="_adm_stg_cpt_option_enable_template"><![CDATA[Show Template Switcher]]></string>
+	<string name="_adm_stg_cpt_option_expire_notification_days"><![CDATA[Number of days before membership expiration to notify members ( -1 = after expiration )]]></string>
+	<string name="_adm_stg_cpt_option_expire_notify_once"><![CDATA[Notify members about membership expiration only once (every day otherwise)]]></string>
 	<string name="_adm_stg_cpt_option_lang_default"><![CDATA[Default Language]]></string>
 	<string name="_adm_stg_cpt_option_permalinks_modules"><![CDATA[Enable friendly permalinks for Modules]]></string>
 	<string name="_adm_stg_cpt_option_permalinks_pages"><![CDATA[Enable friendly permalinks for Pages]]></string>
@@ -1665,6 +1666,8 @@ If it is not enabled then please consider implement this optimization, since it
 	<string name="_sys_layout_topbottom_area_2_columns"><![CDATA[Top&bottom areas with 2 columns in the middle]]></string>
 	<string name="_sys_loading"><![CDATA[Loading...]]></string>
 	<string name="_sys_menu_item_title_about"><![CDATA[About]]></string>
+	<string name="_sys_menu_item_title_switch_language"><![CDATA[Language]]></string>
+	<string name="_sys_menu_item_title_switch_template"><![CDATA[Design]]></string>
 	<string name="_sys_menu_item_title_account_menu"><![CDATA[{member_display_name}]]></string>
 	<string name="_sys_menu_item_title_account_profile_context"><![CDATA[Profiles]]></string>
 	<string name="_sys_menu_item_title_account_settings"><![CDATA[Settings]]></string>
@@ -1683,6 +1686,8 @@ If it is not enabled then please consider implement this optimization, since it
 	<string name="_sys_menu_item_title_more"><![CDATA[More]]></string>
 	<string name="_sys_menu_item_title_profile"><![CDATA[Profile]]></string>
 	<string name="_sys_menu_item_title_system_about"><![CDATA[About]]></string>
+	<string name="_sys_menu_item_title_system_switch_language"><![CDATA[Language]]></string>
+	<string name="_sys_menu_item_title_system_switch_template"><![CDATA[Template]]></string>
 	<string name="_sys_menu_item_title_system_account_menu"><![CDATA[Account]]></string>
 	<string name="_sys_menu_item_title_system_account_profile_context"><![CDATA[Profiles]]></string>
 	<string name="_sys_menu_item_title_system_account_settings"><![CDATA[Settings]]></string>
@@ -1710,6 +1715,8 @@ If it is not enabled then please consider implement this optimization, since it
 	<string name="_sys_menu_set_title_add_profile"><![CDATA[Add Profile]]></string>
 	<string name="_sys_menu_set_title_cmts_item_actions"><![CDATA[Comment Actions]]></string>
 	<string name="_sys_menu_set_title_cmts_item_manage"><![CDATA[Manage Comment]]></string>
+	<string name="_sys_menu_set_title_switch_language"><![CDATA[Switch Language]]></string>
+	<string name="_sys_menu_set_title_switch_template"><![CDATA[Switch Template]]></string>
 	<string name="_sys_menu_set_title_footer"><![CDATA[Footer]]></string>
 	<string name="_sys_menu_set_title_profile_create_links"><![CDATA[Create Profile Links]]></string>
 	<string name="_sys_menu_set_title_profile_stats"><![CDATA[Profile Stats]]></string>
@@ -1746,6 +1753,8 @@ If it is not enabled then please consider implement this optimization, since it
 	<string name="_sys_menu_title_submenu"><![CDATA[Site Submenu]]></string>
 	<string name="_sys_menu_title_toolbar_member"><![CDATA[Member Toolbar]]></string>
 	<string name="_sys_menu_title_toolbar_site"><![CDATA[Site Toolbar]]></string>
+	<string name="_sys_menu_title_switch_language"><![CDATA[Switch Language]]></string>
+	<string name="_sys_menu_title_switch_template"><![CDATA[Switch Template]]></string>
 	<string name="_sys_mobile_friends"><![CDATA[Friends]]></string>
 	<string name="_sys_mobile_info"><![CDATA[Info]]></string>
 	<string name="_sys_mobile_mail"><![CDATA[Messages]]></string>

+ 9 - 2
modules/boonex/russian/data/langs/system.xml

@@ -1527,7 +1527,6 @@ Please click "Continue" below to navigate to the home page of the site.]]></stri
 	<string name="_adm_stg_cpt_category_templates"><![CDATA[Templates]]></string>
 	<string name="_adm_stg_cpt_option_template"><![CDATA[Default Template]]></string>
 	<string name="_adm_stg_err_option_template"><![CDATA[Template cannot be empty and must have a valid name.]]></string>
-	<string name="_adm_stg_cpt_option_enable_template"><![CDATA[Show Template Switcher]]></string>
 	<string name="_adm_stg_cpt_option_sys_template_page_width_min"><![CDATA[Min page width(in pixels)]]></string>
 	<string name="_adm_stg_cpt_option_sys_template_page_width_max"><![CDATA[Max page width(in pixels)]]></string>
 
@@ -3176,9 +3175,13 @@ More info about URI DNSBL: <br />
     <string name="_sys_menu_title_account"><![CDATA[Account Menu]]></string>
     <string name="_sys_menu_title_account_settings"><![CDATA[Account Settings Menu]]></string>
     <string name="_sys_menu_title_add_content"><![CDATA[Add Content Menu]]></string>
+    <string name="_sys_menu_title_switch_language"><![CDATA[Switch Language]]></string>
+	<string name="_sys_menu_title_switch_template"><![CDATA[Switch Template]]></string>
 
     <string name="_sys_menu_item_title_system_home"><![CDATA[Home]]></string>
     <string name="_sys_menu_item_title_system_about"><![CDATA[About]]></string>
+    <string name="_sys_menu_item_title_system_switch_language"><![CDATA[Language]]></string>
+	<string name="_sys_menu_item_title_system_switch_template"><![CDATA[Template]]></string>
     <string name="_sys_menu_item_title_system_search"><![CDATA[Search]]></string>
     <string name="_sys_menu_item_title_system_add_content"><![CDATA[Add Content]]></string>
     <string name="_sys_menu_item_title_system_notifications"><![CDATA[Notifications]]></string>
@@ -3199,7 +3202,9 @@ More info about URI DNSBL: <br />
     <string name="_sys_menu_item_title_system_account_settings_delete"><![CDATA[Delete Account]]></string>
 
     <string name="_sys_menu_item_title_home"><![CDATA[Home]]></string>
-    <string name="_sys_menu_item_title_about"><![CDATA[About]]></string>    
+    <string name="_sys_menu_item_title_about"><![CDATA[About]]></string>
+    <string name="_sys_menu_item_title_switch_language"><![CDATA[Language]]></string>
+	<string name="_sys_menu_item_title_switch_template"><![CDATA[Design]]></string>
     <string name="_sys_menu_item_title_account"><![CDATA[Account]]></string>
     <string name="_sys_menu_item_title_create_profile"><![CDATA[Create Profile]]></string>
     <string name="_sys_menu_item_title_logout"><![CDATA[Log Out]]></string>
@@ -3215,6 +3220,8 @@ More info about URI DNSBL: <br />
     <string name="_sys_menu_set_title_account"><![CDATA[Account]]></string>
     <string name="_sys_menu_set_title_add_content"><![CDATA[Add Content]]></string>
     <string name="_sys_menu_set_title_account_settings"><![CDATA[Account Settings]]></string>
+    <string name="_sys_menu_set_title_switch_language"><![CDATA[Switch Language]]></string>
+	<string name="_sys_menu_set_title_switch_template"><![CDATA[Switch Template]]></string>
 
 	<string name="_sys_menu_template_title_main"><![CDATA[Site Navigation]]></string>
 	<string name="_sys_menu_template_title_footer"><![CDATA[Footer Links]]></string>

+ 22 - 0
modules/boonex/uni/data/template/system/scripts/BxTemplMenuSwitchLanguage.php

@@ -0,0 +1,22 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    DolphinCore Dolphin Core
+ * @{
+ */
+
+bx_import('BxBaseMenuSwitchLanguage');
+
+/**
+ * @see BxDolMenu
+ */
+class BxTemplMenuSwitchLanguage extends BxBaseMenuSwitchLanguage {
+
+    public function __construct ($aObject, $oTemplate = false) {
+        parent::__construct ($aObject, $oTemplate);
+    }
+}
+
+/** @} */

+ 22 - 0
modules/boonex/uni/data/template/system/scripts/BxTemplMenuSwitchTemplate.php

@@ -0,0 +1,22 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    DolphinCore Dolphin Core
+ * @{
+ */
+
+bx_import('BxBaseMenuSwitchTemplate');
+
+/**
+ * @see BxDolMenu
+ */
+class BxTemplMenuSwitchTemplate extends BxBaseMenuSwitchTemplate {
+
+    public function __construct ($aObject, $oTemplate = false) {
+        parent::__construct ($aObject, $oTemplate);
+    }
+}
+
+/** @} */

+ 0 - 39
template/scripts/BxBaseFunctions.php

@@ -162,45 +162,6 @@ class BxBaseFunctions extends BxDol implements iBxDolSingleton
             'member_id' => $iMemberId,
         ));
     }
-    
-    /**
-     * TODO: remake for new system
-     *
-     * Function will generate list of installed languages list;
-     *
-     * @return : Html presentation data;
-     */
-    function getLangSwitcher() 
-    {
-        bx_import('BxDolLanguagesQuery');
-        $aLangs = BxDolLanguagesQuery::getInstance()->getLanguages();
-        if(count($aLangs) < 2)
-            return '';
-
-        $sOutputCode = '';
-        foreach( $aLangs as $sName => $sLang ) {
-            $sFlag = $this->_oTemplate->getIconUrl('sys_fl_' . $sName . '.gif');
-            $aTemplateKeys = array (
-                'bx_if:item_img' => array (
-                    'condition' =>  ( $sFlag ),
-                    'content'   => array (
-                        'item_img_src'      => $sFlag,
-                        'item_img_alt'      => $sName,
-                        'item_img_width'    => 18,
-                        'item_img_height'   => 12,
-                    ),
-                ),
-                'item_link'    => BX_DOL_URL_ROOT . 'index.php?lang=' . $sName,
-                'item_onclick' => null,
-                'item_title'   => $sLang,
-                'extra_info'   => null,
-            );
-
-            $sOutputCode .= $this->_oTemplate->parseHtmlByName( 'member_menu_sub_item.html', $aTemplateKeys );
-        }
-    
-        return $sOutputCode;
-    }
 
 	/**
      * functions for limiting maximal string length 

+ 64 - 0
template/scripts/BxBaseMenuSwitchLanguage.php

@@ -0,0 +1,64 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    DolphinCore Dolphin Core
+ * @{
+ */
+
+bx_import('BxTemplMenu');
+
+/**
+ * Site main menu representation.
+ */
+class BxBaseMenuSwitchLanguage extends BxTemplMenu 
+{
+    public function __construct ($aObject, $oTemplate) 
+    {
+        parent::__construct ($aObject, $oTemplate);
+    }
+
+    public function getMenuItems () {
+		$this->loadData();
+
+    	return parent::getMenuItems();
+    }
+
+	protected function loadData() 
+    {
+    	bx_import('BxDolLanguages');
+        $sLanguage = BxDolLanguages::getInstance()->getCurrentLangName();
+
+        $this->setSelected('', $sLanguage);
+
+        $aPage = explode('?', $_SERVER['HTTP_REFERER']);
+
+        $aPageParams = array();
+        if(!empty($aPage[1]))
+			parse_str($aPage[1], $aPageParams);
+
+        bx_import('BxDolLanguagesQuery');
+        $aLanguages = BxDolLanguagesQuery::getInstance()->getLanguages();
+
+        $aItems = array();
+        foreach( $aLanguages as $sName => $sLang ) {
+        	$aPageParams['lang'] = $sName;
+
+        	$aItems[] = array(
+        		'id' => $sName, 
+        		'name' => $sName,
+        		'class' => '', 
+        		'title' => $sLang, 
+        		'target' => '_self',
+        		'icon' => 'sys_fl_' . $sName . '.gif',
+        		'link' => bx_html_attribute(bx_append_url_params($aPage[0], $aPageParams)),
+        		'onclick' => ''
+        	);
+        }
+
+        $this->_aObject['menu_items'] = $aItems;
+    }
+}
+
+/** @} */

+ 60 - 0
template/scripts/BxBaseMenuSwitchTemplate.php

@@ -0,0 +1,60 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    DolphinCore Dolphin Core
+ * @{
+ */
+
+bx_import('BxTemplMenu');
+
+/**
+ * Site main menu representation.
+ */
+class BxBaseMenuSwitchTemplate extends BxTemplMenu 
+{
+    public function __construct ($aObject, $oTemplate) 
+    {
+        parent::__construct ($aObject, $oTemplate);
+    }
+
+    public function getMenuItems () {
+		$this->loadData();
+
+    	return parent::getMenuItems();
+    }
+
+	protected function loadData() 
+    {
+        $this->setSelected('', $this->_oTemplate->getCode());
+
+        $aPage = explode('?', $_SERVER['HTTP_REFERER']);
+
+        $aPageParams = array();
+        if(!empty($aPage[1]))
+			parse_str($aPage[1], $aPageParams);
+
+        $aTemplates = get_templates_array(true, true);
+
+        $aItems = array();
+        foreach( $aTemplates as $sName => $sTemplate ) {
+        	$aPageParams['skin'] = $sName;
+        	
+        	$aItems[] = array(
+        		'id' => $sName, 
+        		'name' => $sName,
+        		'class' => '', 
+        		'title' => $sTemplate, 
+        		'target' => '_self',
+        		'icon' => '',
+        		'link' => bx_html_attribute(bx_append_url_params($aPage[0], $aPageParams)),
+        		'onclick' => ''
+        	);
+        }
+
+        $this->_aObject['menu_items'] = $aItems;
+    }
+}
+
+/** @} */