RomanL %!s(int64=6) %!d(string=hai) anos
pai
achega
4e59345f45

+ 3 - 5
inc/classes/BxDolFavoriteQuery.php

@@ -73,15 +73,13 @@ class BxDolFavoriteQuery extends BxDolObjectQuery
                 break;
             
             case 'all':
-                $sMethod = 'getPairs';
-                $sQ = "SELECT `id`, `title` FROM `{$this->_sTableLists}` WHERE `author_id` = ? ORDER BY `date`";
+                $sMethod = 'getAll';
+                $sQ = "SELECT `id`, `title`, `allow_view_favorite_list_to` FROM `{$this->_sTableLists}` WHERE `author_id` = ? ORDER BY `date`";
                 if (isset($aParams['need_default']) && (bool)$aParams['need_default']){
-                    $sQ = "SELECT 0 `id`, '" . _t('_sys_txt_default_favorite_list') . "' `title` UNION (" . $sQ . ")";
+                    $sQ = "SELECT 0 `id`, '" . _t('_sys_txt_default_favorite_list') . "' `title`, 3 `allow_view_favorite_list_to` UNION (" . $sQ . ")";
                 }
                 
                 $aMethodParams[0] = $this->prepare($sQ, $aParams['author_id']);
-                $aMethodParams[1] = 'id';
-                $aMethodParams[2] = 'title';
                 break;
                 
             case 'active':

+ 11 - 0
inc/classes/BxDolPrivacy.php

@@ -205,6 +205,17 @@ class BxDolPrivacy extends BxDolFactory implements iBxDolFactoryObject
         return $oPrivacy->getJsScript($sJsCodeAdd, $bDynamicMode);
     }
     
+    public static function getIcon($iVisibility)
+    {
+        $aIcons =array(
+           BX_DOL_PG_MEONLY => 'lock',
+           BX_DOL_PG_ALL => 'globe',
+           BX_DOL_PG_FRIENDS => 'user-friends',
+           BX_DOL_PG_FRIENDS => 'user-friends'
+       );
+       return isset($aIcons[$iVisibility]) ? $aIcons[$iVisibility] : 'eye';
+    }
+    
             
     public function actionLoadGroupCustom()
     {

+ 16 - 16
inc/js/classes/BxDolFavorite.js

@@ -41,11 +41,11 @@ BxDolFavorite.prototype.favorite = function(oLink) {
     oData['action'] = 'Favorite';
 
     this._oParent = $(oLink);
-
     $.get(
     	this._sActionsUrl,
     	oData,
-    	function(oData) {
+    	function (oData) {
+
     	    $this.processJson(oData, this._oParent);
     	},
     	'json'
@@ -60,20 +60,20 @@ BxDolFavorite.prototype.showNewList = function () {
 
 BxDolFavorite.prototype.cmtDelete = function (obj, list_id) {
     var $this = this;
-    var oData = this._getDefaultParams();
-    oData['action'] = 'DeleteList';
-    oData['list_id'] = list_id;
-
-    this._oParent = $(oLink);
-
-    $.get(
-    	this._sActionsUrl,
-    	oData,
-    	function (oData) {
-    	    $this.processJson(oData, this._oParent);
-    	},
-    	'json'
-    );
+    bx_confirm('', function () {
+        var oData = $this._getDefaultParams();
+        oData['action'] = 'DeleteList';
+        oData['list_id'] = list_id;
+
+        $.get(
+            this._sActionsUrl,
+            oData,
+            function (oData) {
+                $this.processJson(oData, this._oParent);
+            },
+            'json'
+        );
+    });
 }
 
 BxDolFavorite.prototype.cmtEdit = function (obj, list_id) {

+ 23 - 71
modules/base/general/classes/BxBaseModGeneralModule.php

@@ -580,7 +580,7 @@ class BxBaseModGeneralModule extends BxDolModule
      */
      public function serviceFavoritesListActions(){
          $iListId = null;
-         if(!bx_get('list_id'))
+         if(bx_get('list_id') === false)
              return false;
          
          $iListId = (int) bx_get('list_id');
@@ -596,26 +596,32 @@ class BxBaseModGeneralModule extends BxDolModule
         
          $aList = $oFavorite->getQueryObject()->getList(array('type' => 'id', 'list_id' => $iListId));
          
-         if (!$oFavorite->isAllowedEditList($aList['author_id']))
-             return false;
-         
-         if (empty($aList) && $iListId > 0)
-             return false;
-         
-         $aMarkers = array(
-             'js_object' => $oFavorite->getJsObjectName(),
-             'list_id' => $iListId,
-         );
+         $sRv = '';
+         if ($oFavorite->isAllowedEditList($aList['author_id']) && !empty($aList)){  
+             $aMarkers = array(
+                 'js_object' => $oFavorite->getJsObjectName(),
+                 'list_id' => $iListId,
+             );
 
-         $oMenu = BxDolMenu::getObjectInstance('sys_favorite_list');
+             $oMenu = BxDolMenu::getObjectInstance('sys_favorite_list');
 
-         $oMenu->addMarkers($aMarkers);
-         $sMenu = $oMenu->getCode();
+             $oMenu->addMarkers($aMarkers);
+             $sMenu = $oMenu->getCode();
 
-         if(empty($sMenu))
-             return '';
+             $sRv .= $sMenu . $oFavorite->getJsScript();
+        }
+        
+         $aMarkers = array(
+            'id' => $iListId,
+            'module' => $this->_aModule['name'],
+            'url' => $this->_getFavoriteListUrl($iListId, $oProfile->id()),
+            'title' => $iListId > 0 ? $aList['title'] : _t('_sys_txt_default_favorite_list')
+        );
 
-         return $sMenu . $oFavorite->getJsScript();
+         $oMenu = BxDolMenu::getObjectInstance('sys_social_sharing');
+         $oMenu->addMarkers($aMarkers);
+         $sRv .= $sMenu = $oMenu->getCode();
+         return $sRv;
      }
      
      /**
@@ -659,60 +665,6 @@ class BxBaseModGeneralModule extends BxDolModule
         return $this->_oTemplate->getFavoritesListInfo($aList, $oProfile);
     }
     
-    /**
-    * @page service Service Calls
-    * @section bx_base_general Base General
-    * @subsection bx_base_general-menu Menu
-    * @subsubsection bx_base_general-favorites_list_social_sharing favorites_list_social_sharing
-    * 
-    * @code bx_srv('bx_posts', 'favorites_list_social_sharing', [...]); @endcode
-    * 
-    * Favorites list social sharing actions
-    * @param $aParams array with additional custom params 
-    *                 which may overwrite some default values
-    * 
-    * @see BxBaseModGeneralModule::serviceFavoritesListSocialSharing
-    */
-    /** 
-    * @ref bx_base_general-favorites_list_social_sharing "favorites_list_social_sharing"
-    */
-    public function serviceFavoritesListSocialSharing($aParams = array()){
-        $iListId = null;
-        if(bx_get('list_id') === false)
-            return false;
-        $iListId = (int) bx_get('list_id');
-         
-        $oProfile = null;
-        if(bx_get('profile_id') !== false)
-            $oProfile = BxDolProfile:: getInstance(bx_process_input(bx_get('profile_id'), BX_DATA_INT));
-        if(!$oProfile)
-            return false;
-
-         $CNF = &$this->_oConfig->CNF;
-         $oFavorite = BxDolFavorite::getObjectInstance($CNF['OBJECT_FAVORITES'], 0, true);
-         $aList = $oFavorite->getQueryObject()->getList(array('type' => 'id', 'list_id' => $iListId));
-         if (empty($aList) && $iListId > 0)
-             return false;
-         
-         $aMarkers = array(
-             'id' => $iListId,
-             'module' => $this->_aModule['name'],
-             'url' => $this->_getFavoriteListUrl($iListId, $oProfile->id()),
-             'title' => $iListId > 0 ? $aList['title'] : _t('_sys_txt_default_favorite_list')
-         );
-
-         $oMenu = BxDolMenu::getObjectInstance('sys_social_sharing');
-         $oMenu->addMarkers($aMarkers);
-         $sMenu = $oMenu->getCode();
-
-         if(empty($sMenu))
-             return '';
-
-         return $this->_oTemplate->parseHtmlByName('entry-share.html', array(
-             'menu' => $sMenu
-         ));
-     }
-    
     /**
      * Display entries posted into particular context
      * @return HTML string

+ 1 - 1
modules/base/general/template/favorite-lists.html

@@ -1,6 +1,6 @@
 <bx_repeat:items>
     <div class="bx-def-padding-bottom">
-        <h2 class="bx-base-text-unit-title"><a href="__content_url__">__title__</a></h2>
+        <h2><a href="__content_url__">__title__</a></h2>
         __content__
     </div>
 </bx_repeat:items>

+ 3 - 3
modules/boonex/english/data/langs/system/en.xml

@@ -2299,13 +2299,13 @@ If it is not enabled then please consider implement this optimization, since it
   <string name="_sys_form_favorite_input_caption_system_object_id"><![CDATA[Object ID]]></string>
   <string name="_sys_form_favorite_input_caption_system_action"><![CDATA[Action]]></string>
   <string name="_sys_form_favorite_input_caption_system_id"><![CDATA[System ID]]></string>
-  <string name="_sys_form_favorite_input_caption_system_list"><![CDATA[List]]></string>
-  <string name="_sys_form_favorite_input_caption_list"><![CDATA[List]]></string>
+  <string name="_sys_form_favorite_input_caption_system_list"><![CDATA[Add to list]]></string>
+  <string name="_sys_form_favorite_input_caption_list"><![CDATA[Add to list]]></string>
   <string name="_sys_form_favorite_input_caption_system_title"><![CDATA[Title]]></string>
   <string name="_sys_form_favorite_input_caption_title"><![CDATA[Title]]></string>
   <string name="_sys_form_favorite_input_caption_system_allow_view_to"><![CDATA[Visibility]]></string>
   <string name="_sys_form_favorite_input_caption_allow_view_to"><![CDATA[Visibility]]></string>
-  <string name="_sys_form_favorite_input_caption_submit"><![CDATA[Submit]]></string>
+  <string name="_sys_form_favorite_input_caption_submit"><![CDATA[Save]]></string>
   <string name="_sys_form_favorite_input_caption_system_submit"><![CDATA[Submit]]></string>
   <string name="_sys_form_favorite_input_caption_button_new_list"><![CDATA[<i class="sys-icon folder-plus"></i>]]></string>
   <string name="_sys_form_favorite_list_title_count"><![CDATA[Number of videos]]></string>

+ 1 - 0
modules/boonex/videos/classes/BxVideosPageListEntry.php

@@ -36,6 +36,7 @@ class BxVideosPageListEntry extends BxBaseModTextPageBrowse
         $this->addMarkers(array(
             'title' => $aList['title']
         ));
+        $this->_aObject['title'] = $aList['title'];
     }
     
     public function getCode ()

+ 2 - 2
modules/boonex/videos/install/langs/en.xml

@@ -121,8 +121,8 @@
     <string name="_bx_videos_page_block_title_popular_entries_view_full"><![CDATA[Popular Videos (Full View)]]></string>
     <string name="_bx_videos_page_block_title_top_entries"><![CDATA[Top Videos]]></string>
     <string name="_bx_videos_page_block_title_updated_entries"><![CDATA[Updated Videos]]></string>
-    <string name="_bx_videos_page_block_title_favorites_entries"><![CDATA[Faforite list {title}]]></string>
-    <string name="_bx_videos_page_block_title_favorites_entries_info"><![CDATA[Favorites List Info]]></string>
+    <string name="_bx_videos_page_block_title_favorites_entries"><![CDATA["{title}" List]]></string>
+    <string name="_bx_videos_page_block_title_favorites_entries_info"><![CDATA[Info]]></string>
     <string name="_bx_videos_page_block_title_favorites_entries_actions"><![CDATA[Favorites List Actions]]></string>
     <string name="_bx_videos_page_block_title_favorites_entries_social_sharing"><![CDATA[Favorites List Social Actions]]></string>
     <string name="_bx_videos_page_title_sys_view_entry_comments"><![CDATA[Video Comments]]></string>

+ 1 - 2
modules/boonex/videos/install/sql/enable.sql

@@ -105,8 +105,7 @@ INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `lay
 INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES 
 ('bx_videos_favorites', 2, 'bx_videos', '_bx_videos_page_block_title_favorites_entries', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:9:"bx_videos";s:6:"method";s:15:"browse_favorite";s:6:"params";a:2:{s:10:"profile_id";s:12:"{profile_id}";s:6:"params";a:3:{s:9:"unit_view";s:7:"gallery";s:13:"empty_message";b:0;s:13:"ajax_paginate";b:0;}}}', 0, 1, 1),
 ('bx_videos_favorites', 3, 'bx_videos', '_bx_videos_page_block_title_favorites_entries_info', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:9:"bx_videos";s:6:"method";s:19:"favorites_list_info";}', 0, 0, 0),
-('bx_videos_favorites', 3, 'bx_videos', '_bx_videos_page_block_title_favorites_entries_actions', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:9:"bx_videos";s:6:"method";s:22:"favorites_list_actions";}', 0, 0, 1),
-('bx_videos_favorites', 3, 'bx_videos', '_bx_videos_page_block_title_favorites_entries_social_sharing', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:9:"bx_videos";s:6:"method";s:29:"favorites_list_social_sharing";}', 0, 0, 2);
+('bx_videos_favorites', 3, 'bx_videos', '_bx_videos_page_block_title_favorites_entries_actions', 13, 2147483647, 'service', 'a:2:{s:6:"module";s:9:"bx_videos";s:6:"method";s:22:"favorites_list_actions";}', 0, 0, 1);
 
 
 -- PAGE: entries in context

+ 1 - 1
modules/boonex/videos/install/sql/install.sql

@@ -388,7 +388,7 @@ INSERT INTO `sys_objects_view` (`name`, `table_track`, `period`, `is_on`, `trigg
 ('bx_videos', 'bx_videos_views_track', '86400', '1', 'bx_videos_entries', 'id', 'author', 'views', '', '');
 
 
--- FAFORITES
+-- FAVORITES
 INSERT INTO `sys_objects_favorite` (`name`, `table_track`, `table_lists`, `is_on`, `is_undo`, `is_public`, `base_url`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
 ('bx_videos', 'bx_videos_favorites_track', 'bx_videos_favorites_lists', '1', '1', '1', 'page.php?i=view-video&id={object_id}', 'bx_videos_entries', 'id', 'author', 'favorites', '', '');
 

+ 4 - 0
template/css/favorite.css

@@ -68,6 +68,10 @@ div.bx-favorite div.bx-favorite-counter-holder {
 .bx-favorite-do-form .bx-form-input-checkbox_set label{
     white-space: pre;
 }
+.bx-menu-object-sys_favorite_list{
+    float:left;
+    margin-right:1rem !important;
+}
 
 /*--- Counter Styles ---*/
 .bx-favorite-counter-holder .bx-favorite-counter {

+ 1 - 0
template/privacy_icon.html

@@ -0,0 +1 @@
+ <i class="sys-icon __icon__"></i>

+ 9 - 1
template/scripts/BxBaseFavorite.php

@@ -225,8 +225,16 @@ class BxBaseFavorite extends BxDolFavorite
         $oForm->aInputs['object_id']['value'] = $iObjectId;
 
         $oForm->aInputs['action']['value'] = 'Favorite';
-        $oForm->aInputs['list']['values'] = $this->_oQuery->getList(array('type' => 'all', 'author_id' => $iAuthorId, 'need_default' => true));
+        
+        $aListsValues = array();
+        $aLists = $this->_oQuery->getList(array('type' => 'all', 'author_id' => $iAuthorId, 'need_default' => true));
+        foreach($aLists as $aList) {
+            $aListsValues[$aList['id']] = $aList['title'] . $this->_oTemplate->parseHtmlByName('privacy_icon.html', array('icon' => BxDolPrivacy::getIcon($aList['allow_view_favorite_list_to'])));
+        }
+        $oForm->aInputs['list']['values'] = $aListsValues;
         $oForm->aInputs['list']['value'] = $this->_oQuery->getList(array('type' => 'object_and_author', 'object_id' => $iObjectId, 'author_id' => $iAuthorId));
+        $oForm->aInputs['list']['label_as_html'] = true;
+        
         
         $oModule = BxDolModule::getInstance($this->_aSystem["name"]);
         $CNF = $oModule->_oConfig->CNF;    

+ 9 - 2
template/scripts/BxBaseFormView.php

@@ -1607,6 +1607,9 @@ BLAH;
                     'label'   => $sLabel,
                     'attrs'   => !empty($aInput['attrs']) && ('radio_set' == $aInput['type'] || 'checkbox_set' == $aInput['type']) ? $aInput['attrs'] : false,
                 );
+                
+                if (isset($aInput['label_as_html']))
+                    $aNewInput['label_as_html'] = $aInput['label_as_html'];
 
                 $sNewInput  = $this->genInput($aNewInput);
 
@@ -1746,8 +1749,12 @@ BLAH;
             return '';
 
         $sInputID = $this->getInputId($aInput);
-
-        return '<label for="' . $sInputID . '">' . bx_process_output($aInput['label']) . '</label>';
+        
+        $sLabel = bx_process_output($aInput['label']);
+        if (isset($aInput['label_as_html']) && $aInput['label_as_html'] == true)
+            $sLabel = $aInput['label'];
+        
+        return '<label for="' . $sInputID . '">' . $sLabel . '</label>';
     }
 
     function genPrivacyGroupChooser(&$aInput, $sPrivacyObject = '')