Alex Trofimov před 12 roky
rodič
revize
fd88cebde3

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

@@ -1798,6 +1798,7 @@ If it is not enabled then please consider implement this optimization, since it
 	<string name="_sys_ps_group_title_me_only"><![CDATA[Me only]]></string>
 	<string name="_sys_ps_group_title_members"><![CDATA[Members]]></string>
 	<string name="_sys_ps_group_title_public"><![CDATA[Public]]></string>
+    <string name="_sys_read_more"><![CDATA[Continue reading "{0}"]]></string>
 	<string name="_sys_request_module_not_found_cpt"><![CDATA[Module was not found]]></string>
 	<string name="_sys_request_module_not_found_cnt"><![CDATA[Module({0}) was not found]]></string>
 	<string name="_sys_request_page_not_found_cpt"><![CDATA[Page was not found]]></string>

+ 18 - 4
modules/boonex/notes/classes/BxNotesConfig.php

@@ -11,8 +11,8 @@
 
 bx_import('BxDolModuleConfig');
 
-class BxNotesConfig extends BxDolModuleConfig {
-
+class BxNotesConfig extends BxDolModuleConfig 
+{
     public $CNF = array (
         'FIELD_ID' => 'id',
         'FIELD_AUTHOR' => 'author',
@@ -27,12 +27,26 @@ class BxNotesConfig extends BxDolModuleConfig {
         'FIELD_PHOTO' => 'pictures',
         'FIELD_THUMB' => 'thumb',
 
+        'URI_VIEW_ENTRY' => 'view-note',
+        'URI_HOME' => 'notes-home',
+
+        'PARAM_CHARS_SUMMARY' => 'bx_notes_summary_chars',
+        'PARAM_CHARS_SUMMARY_PLAIN' => 'bx_notes_plain_summary_chars',
+
         'OBJECT_STORAGE' => 'bx_notes_photos',
         'OBJECT_IMAGES_TRANSCODER_PREVIEW' => 'bx_notes_preview',
         'OBJECT_VIEWS' => 'bx_notes',
         'OBJECT_VOTES' => 'bx_notes',
         'OBJECT_COMMENTS' => 'bx_notes',
         'OBJECT_PRIVACY_VIEW' => 'bx_notes_allow_view_to',
+        'OBJECT_FORM_ENTRY' => 'bx_notes',
+        'OBJECT_FORM_ENTRY_DISPLAY_VIEW' => 'bx_notes_note_view',
+        'OBJECT_FORM_ENTRY_DISPLAY_ADD' => 'bx_notes_note_add',
+        'OBJECT_FORM_ENTRY_DISPLAY_EDIT' => 'bx_notes_note_edit',
+        'OBJECT_FORM_ENTRY_DISPLAY_DELETE' => 'bx_notes_note_delete',
+        'OBJECT_MENU_SUBMENU' => 'bx_notes_submenu',
+        'OBJECT_MENU_SUBMENU_VIEW_ENTRY' => 'bx_notes_view_submenu',
+        'OBJECT_MENU_SUBMENU_VIEW_ENTRY_MAIN_SELECTION' => 'notes-home',
 
         'MENU_ITEM_TO_METHOD' => array (
             'bx_notes_my' => array (
@@ -68,10 +82,10 @@ class BxNotesConfig extends BxDolModuleConfig {
     /**
      * Constructor
      */
-    function __construct($aModule) {
+    function __construct($aModule) 
+    {
         parent::__construct($aModule);
     }
-
 }
 
 /** @} */ 

+ 51 - 44
modules/boonex/notes/classes/BxNotesFormsEntryHelper.php

@@ -16,11 +16,12 @@ bx_import('BxDolForm');
 /**
  * Note forms functions
  */
-class BxNotesFormsEntryHelper extends BxDolProfileForms {
-
+class BxNotesFormsEntryHelper extends BxDolProfileForms 
+{
     protected $_oModule;
 
-    public function __construct($oModule) {
+    public function __construct($oModule) 
+    {
         parent::__construct();
         $this->_oModule = $oModule;
     }
@@ -28,14 +29,16 @@ class BxNotesFormsEntryHelper extends BxDolProfileForms {
     /**
      * @return add data html
      */
-    public function addDataForm () {
+    public function addDataForm () 
+    {
+        $CNF = &$this->_oModule->_oConfig->CNF;
 
         // check access
         if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $this->_oModule->isAllowedAdd()))
             return MsgBox($sMsg);
 
         // check and display form
-        $oForm = BxDolForm::getObjectInstance('bx_notes', 'bx_notes_note_add'); 
+        $oForm = BxDolForm::getObjectInstance($CNF['OBJECT_FORM_ENTRY'], $CNF['OBJECT_FORM_ENTRY_DISPLAY_ADD']);
         if (!$oForm)
             return MsgBox(_t('_sys_txt_error_occured'));
 
@@ -51,44 +54,42 @@ class BxNotesFormsEntryHelper extends BxDolProfileForms {
             if (!$oForm->isValid())
                 return $oForm->getCode();
             else
-                return MsgBox(_t('_bx_notes_txt_error_note_creation'));
+                return MsgBox(_t('_bx_notes_txt_error_entry_creation'));
         }
 
-/* TODO: status
-        // approve note if auto-approval is enabled and profile status is 'pending'
-        $sStatus = $oProfile->getStatus();
-        $isAutoApprove = getParam('bx_notes_autoapproval') ? true : false;
-        if ($sStatus == BX_PROFILE_STATUS_PENDING && $isAutoApprove)
-            $oProfile->approve(BX_PROFILE_ACTION_AUTO);
-*/
         // perform action 
         $this->_oModule->isAllowedAdd(true);
 
         // alert
-        //TODO: Pass a valid Note's privacy view group.
+        //TODO: Pass a valid entry privacy view group.
         bx_import('BxDolPrivacy');
         bx_alert($this->_oModule->getName(), 'added', $iContentId, false, array('privacy_view' => BX_DOL_PG_ALL));
 
         // redirect 
-        $this->_redirectAndExit('page.php?i=view-note&id=' . $iContentId);
+        $this->_redirectAndExit('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $iContentId);
     }
 
     /**
      * @return edit data html
      */
-    public function editDataForm ($iContentId, $sDisplay = 'bx_notes_note_edit') {
+    public function editDataForm ($iContentId, $sDisplay = false) 
+    {
+        $CNF = &$this->_oModule->_oConfig->CNF;
+
+        if (false === $sDisplay) 
+            $sDisplay = $CNF['OBJECT_FORM_ENTRY_DISPLAY_EDIT'];
 
         // get content data and profile info
         list ($oProfile, $aContentInfo) = $this->_getProfileAndContentData($iContentId);
         if (!$aContentInfo)
-            return MsgBox(_t('_bx_notes_txt_error_note_is_not_defined')); 
+            return MsgBox(_t('_bx_notes_txt_error_entry_is_not_defined')); 
 
         // check access
         if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $this->_oModule->isAllowedEdit($aContentInfo)))
             return MsgBox($sMsg);
         
         // check and display form 
-        $oForm = BxDolForm::getObjectInstance('bx_notes', $sDisplay); 
+        $oForm = BxDolForm::getObjectInstance($CNF['OBJECT_FORM_ENTRY'], $sDisplay); 
         if (!$oForm)
             return MsgBox(_t('_sys_txt_error_occured'));
 
@@ -99,51 +100,51 @@ class BxNotesFormsEntryHelper extends BxDolProfileForms {
 
         // update data in the DB
         $aTrackTextFieldsChanges = null;
-/* TODO: status
-        $isAutoApprove = getParam('bx_notes_autoapproval') ? true : false;
-        if (!$isAutoApprove && $oProfile->isActive()))
-            $aTrackTextFieldsChanges = array ();
-*/
         if (!$oForm->update ($aContentInfo['id'], array(), $aTrackTextFieldsChanges)) {
             if (!$oForm->isValid())
                 return $oForm->getCode();
             else
-                return MsgBox(_t('_bx_notes_txt_error_note_update')); 
+                return MsgBox(_t('_bx_notes_txt_error_entry_update')); 
         }
 
         // change profile to 'pending' only if profile is 'active'
-        if (/*!$isAutoApprove &&*/ $oProfile->isActive() && !empty($aTrackTextFieldsChanges['changed_fields']))
+        if ($oProfile->isActive() && !empty($aTrackTextFieldsChanges['changed_fields']))
             $oProfile->disapprove(BX_PROFILE_ACTION_AUTO);
 
         // perform action
         $this->_oModule->isAllowedEdit($aContentInfo, true);
 
         // create an alert
-        //TODO: Pass a valid Note's privacy view group.
+        //TODO: Pass a valid entry privacy view group.
         bx_import('BxDolPrivacy');
         bx_alert($this->_oModule->getName(), 'edited', $aContentInfo['id'], false, array('privacy_view' => BX_DOL_PG_MEMBERS)); 
 
         // redirect 
-        $this->_redirectAndExit('page.php?i=view-note&id=' . $aContentInfo['id']);
+        $this->_redirectAndExit('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $aContentInfo['id']);
     }
 
 
     /**
      * @return delete data html
      */
-    public function deleteDataForm ($iContentId, $sDisplay = 'bx_notes_note_delete') {
+    public function deleteDataForm ($iContentId, $sDisplay = false) 
+    {
+        $CNF = &$this->_oModule->_oConfig->CNF;
+
+        if (false === $sDisplay) 
+            $sDisplay = $CNF['OBJECT_FORM_ENTRY_DISPLAY_DELETE'];
 
         // get content data and profile info
         list ($oProfile, $aContentInfo) = $this->_getProfileAndContentData($iContentId);
         if (!$aContentInfo)
-            return MsgBox(_t('_bx_notes_txt_error_note_is_not_defined')); 
+            return MsgBox(_t('_bx_notes_txt_error_entry_is_not_defined')); 
 
         // check access
         if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $this->_oModule->isAllowedDelete($aContentInfo)))
             return MsgBox($sMsg);
         
         // check and display form 
-        $oForm = BxDolForm::getObjectInstance('bx_notes', $sDisplay); 
+        $oForm = BxDolForm::getObjectInstance($CNF['OBJECT_FORM_ENTRY'], $sDisplay);
         if (!$oForm)
             return MsgBox(_t('_sys_txt_error_occured'));
 
@@ -156,7 +157,7 @@ class BxNotesFormsEntryHelper extends BxDolProfileForms {
             if (!$oForm->isValid())
                 return $oForm->getCode();
             else
-                return MsgBox(_t('_bx_notes_txt_error_note_delete'));
+                return MsgBox(_t('_bx_notes_txt_error_entry_delete'));
         }
 
         // perform action
@@ -166,26 +167,28 @@ class BxNotesFormsEntryHelper extends BxDolProfileForms {
         bx_alert($this->_oModule->getName(), 'deleted', $aContentInfo['id']);
 
         // redirect 
-        $this->_redirectAndExit('page.php?i=notes-home');
+        $this->_redirectAndExit('page.php?i=' . $CNF['URI_HOME']);
     }
 
 
     /**
      * @return view data html
      */
-    public function viewDataForm ($iContentId) {
+    public function viewDataForm ($iContentId) 
+    {
+        $CNF = &$this->_oModule->_oConfig->CNF;
 
         // get content data and profile info
         list ($oProfile, $aContentInfo) = $this->_getProfileAndContentData($iContentId);
         if (!$aContentInfo)
-            return MsgBox(_t('_bx_notes_txt_error_note_is_not_defined')); 
+            return MsgBox(_t('_bx_notes_txt_error_entry_is_not_defined')); 
 
         // check access
         if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $this->_oModule->isAllowedView($aContentInfo)))
             return MsgBox($sMsg);
         
         // get form 
-        $oForm = BxDolForm::getObjectInstance('bx_notes', 'bx_notes_note_view'); 
+        $oForm = BxDolForm::getObjectInstance($CNF['OBJECT_FORM_ENTRY'], $CNF['OBJECT_FORM_ENTRY_DISPLAY_VIEW']); 
         if (!$oForm)
             return MsgBox(_t('_sys_txt_error_occured'));
 
@@ -200,29 +203,31 @@ class BxNotesFormsEntryHelper extends BxDolProfileForms {
     /**
      * @return main content text 
      */
-    public function viewDataText ($iContentId) {
+    public function viewDataText ($iContentId) 
+    {
+        $CNF = &$this->_oModule->_oConfig->CNF;
 
         // get content data and profile info
         list ($oProfile, $aContentInfo) = $this->_getProfileAndContentData($iContentId);
         if (!$aContentInfo)
-            return MsgBox(_t('_bx_notes_txt_error_note_is_not_defined')); 
+            return MsgBox(_t('_bx_notes_txt_error_entry_is_not_defined')); 
 
         // check access
         if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $this->_oModule->isAllowedView($aContentInfo)))
             return MsgBox($sMsg);
 
-        return $aContentInfo[BxNotesConfig::$FIELD_TEXT];
+        return $aContentInfo[$CNF['FIELD_TEXT']];
     }
 
     /**
      * @return main content text 
      */
-    public function viewDataEntry ($iContentId) {
-
+    public function viewDataEntry ($iContentId) 
+    {
         // get content data and profile info
         list ($oProfile, $aContentInfo) = $this->_getProfileAndContentData($iContentId);
         if (!$aContentInfo)
-            return MsgBox(_t('_bx_notes_txt_error_note_is_not_defined')); 
+            return MsgBox(_t('_bx_notes_txt_error_entry_is_not_defined')); 
 
         // check access
         if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $this->_oModule->isAllowedView($aContentInfo)))
@@ -235,8 +240,10 @@ class BxNotesFormsEntryHelper extends BxDolProfileForms {
     /**
      * @return array of profile object, profile info and content info
      */
-    protected function _getProfileAndContentData ($iContentId) {
-    
+    protected function _getProfileAndContentData ($iContentId) 
+    {
+        $CNF = &$this->_oModule->_oConfig->CNF;
+
         $aContentInfo = array();
         $oProfile = false;
         
@@ -244,7 +251,7 @@ class BxNotesFormsEntryHelper extends BxDolProfileForms {
         if (!$aContentInfo)
             return array (false, false, false);
 
-        $oProfile = BxDolProfile::getInstance($aContentInfo['author']);
+        $oProfile = BxDolProfile::getInstance($aContentInfo[$CNF['FIELD_AUTHOR']]);
         if (!$oProfile) {
             bx_import('BxDolProfileUndefined');
             $oProfile = BxDolProfileUndefined::getInstance();

+ 1 - 1
modules/boonex/notes/classes/BxNotesMenuView.php

@@ -13,7 +13,7 @@ bx_import('BxTemplMenu');
 bx_import('Menu', 'bx_notes');
 
 /**
- * 'View Entry' menu.
+ * View entry menu
  */
 class BxNotesMenuView extends BxNotesMenu
 {

+ 13 - 16
modules/boonex/notes/classes/BxNotesPageAuthor.php

@@ -14,14 +14,15 @@ bx_import('BxDolMenu');
 bx_import('BxDolProfile');
 
 /**
- * Profile's notes page.
+ * Profile's entries page.
  */
-class BxNotesPageAuthor extends BxTemplPage {
-
+class BxNotesPageAuthor extends BxTemplPage 
+{
     protected $_aProfileInfo;
     protected $_oProfile;
 
-    public function __construct($aObject, $oTemplate = false) {
+    public function __construct($aObject, $oTemplate = false) 
+    {
         parent::__construct($aObject, $oTemplate);
 
         // get profile info
@@ -34,20 +35,16 @@ class BxNotesPageAuthor extends BxTemplPage {
         if (!$this->_aProfileInfo || !$this->_oProfile)
             return;
 
-        // select view profile submenu 
+        // select view profile submenu
         $oMenuSubmenu = BxDolMenu::getObjectInstance('sys_site_submenu');
-        $oMenuSubmenu->setObjectSubmenu('bx_persons_view_submenu', array (
-            'title' => $this->_oProfile->getDisplayName(),
-            'link' => $this->_oProfile->getUrl(),
-            'icon' => $this->_oProfile->getIcon(),
-        ));
-/*
-        // set actions menu
-        if (bx_get_logged_profile_id() == $iProfileId) {
-            $oMenuAction = BxDolMenu::getObjectInstance('sys_site_action');
-            $oMenuAction->setActionsMenu('bx_notes_my');
+        if ($oMenuSubmenu) {
+            $oMenuSubmenu->setObjectSubmenu('bx_persons_view_submenu', array (
+                'title' => $this->_oProfile->getDisplayName(),
+                'link' => $this->_oProfile->getUrl(),
+                'icon' => $this->_oProfile->getIcon(),
+            ));
         }
-*/
+
         // add replaceable markers
         $this->addMarkers($this->_aProfileInfo); // every profile field can be used as marker
         $this->addMarkers(array('profile_id' => $this->_oProfile->id())); // profile id field is also suported

+ 12 - 6
modules/boonex/notes/classes/BxNotesPageBrowse.php

@@ -9,20 +9,26 @@
  * @{
  */
 
+bx_import('BxDolModule');
 bx_import('BxTemplPage');
 
 /**
- * Browse notes pages.
+ * Browse entries pages.
  */
-class BxNotesPageBrowse extends BxTemplPage {    
-    
-    public function __construct($aObject, $oTemplate = false) {
+class BxNotesPageBrowse extends BxTemplPage 
+{   
+    protected static $MODULE = 'bx_notes';
+ 
+    public function __construct($aObject, $oTemplate = false) 
+    {
         parent::__construct($aObject, $oTemplate);
 
-        // select notes submenu
+        $oModule = BxDolModule::getInstance(self::$MODULE);
+
+        // select module submenu
         bx_import('BxDolMenu');
         $oMenuSumbemu = BxDolMenu::getObjectInstance('sys_site_submenu');
-        $oMenuSumbemu->setObjectSubmenu('bx_notes_submenu');
+        $oMenuSumbemu->setObjectSubmenu($oModule->_oConfig->CNF['OBJECT_MENU_SUBMENU']);
     }
 
 }

+ 70 - 0
modules/boonex/notes/classes/BxNotesPageEntry.php

@@ -0,0 +1,70 @@
+<?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    Notes Notes
+ * @ingroup     DolphinModules
+ *
+ * @{
+ */
+
+bx_import('BxTemplPage');
+bx_import('BxDolModule');
+bx_import('BxDolMenu');
+
+/**
+ * Entry create/edit pages
+ */
+class BxNotesPageEntry extends BxTemplPage 
+{    
+    protected static $MODULE = 'bx_notes';
+
+    protected $_oModule;
+    protected $_aContentInfo = false;
+
+    public function __construct($aObject, $oTemplate = false) 
+    {
+        parent::__construct($aObject, $oTemplate);
+
+        $this->_oModule = BxDolModule::getInstance(self::$MODULE);
+        $CNF = &$this->_oModule->_oConfig->CNF;
+
+        // select view entry submenu
+        $oMenuSumbemu = BxDolMenu::getObjectInstance('sys_site_submenu');
+        $oMenuSumbemu->setObjectSubmenu($CNF['OBJECT_MENU_SUBMENU_VIEW_ENTRY'], $CNF['OBJECT_MENU_SUBMENU_VIEW_ENTRY_MAIN_SELECTION']);
+
+        $iContentId = bx_process_input(bx_get('id'), BX_DATA_INT);
+        if ($iContentId)
+            $this->_aContentInfo = $this->_oModule->_oDb->getContentInfoById($iContentId);
+
+        if ($this->_aContentInfo)
+            $this->addMarkers($this->_aContentInfo); // every field can be used as marker
+
+		bx_import('BxDolView');
+		BxDolView::getObjectInstance($CNF['OBJECT_VIEWS'], $iContentId)->doView();
+    }
+
+    public function getCode () 
+    {
+        if (!$this->_aContentInfo) { // if entry is not found - display standard "404 page not found" page
+            $this->_oTemplate->displayPageNotFound();
+            exit;
+        }
+
+        if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $this->_oModule->isAllowedView($this->_aContentInfo))) {
+			$this->_oTemplate->displayAccessDenied($sMsg);
+            exit;
+        }
+        $this->_oModule->isAllowedView($this->_aContentInfo, true);
+
+        return parent::getCode ();
+    }
+
+    protected function _getPageCacheParams () 
+    {
+        return $this->_aContentInfo[$this->_oModule->_oConfig->CNF['FIELD_ID']]; // cache is different for every entry
+    }
+}
+
+/** @} */

+ 0 - 83
modules/boonex/notes/classes/BxNotesPageNote.php

@@ -1,83 +0,0 @@
-<?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    Notes Notes
- * @ingroup     DolphinModules
- *
- * @{
- */
-
-bx_import('BxTemplPage');
-bx_import('BxDolModule');
-bx_import('BxDolMenu');
-
-/**
- * Note create/edit pages.
- */
-class BxNotesPageNote extends BxTemplPage {    
-    
-    protected $_oModule;
-    protected $_aContentInfo = false;
-
-    protected $_aMapStatus2LangKey = array (
-        BX_PROFILE_STATUS_PENDING => '_bx_notes_txt_status_pending',
-    );
-
-    public function __construct($aObject, $oTemplate = false) {
-        parent::__construct($aObject, $oTemplate);
-
-        $this->_oModule = BxDolModule::getInstance('bx_notes');
-        
-        // select view note submenu
-        $oMenuSumbemu = BxDolMenu::getObjectInstance('sys_site_submenu');
-        $oMenuSumbemu->setObjectSubmenu('bx_notes_view_submenu', 'notes-home');
-
-        $iContentId = bx_process_input(bx_get('id'), BX_DATA_INT);
-        if ($iContentId)
-            $this->_aContentInfo = $this->_oModule->_oDb->getContentInfoById($iContentId);
-
-        if ($this->_aContentInfo)
-            $this->addMarkers($this->_aContentInfo); // every field can be used as marker
-    
-/* TODO: status
-        // display message if profile isn't active
-        if ($this->_aContentInfo && bx_get_logged_profile_id() == $this->_aContentInfo['author']) { 
-            $sStatus = $this->_aContentInfo['status'];
-            if (isset($this->_aMapStatus2LangKey[$sStatus])) {
-                bx_import('BxDolInformer');
-                $oInformer = BxDolInformer::getInstance($this->_oTemplate);
-                if ($oInformer)
-                    $oInformer->add('bx-notes-status-not-active', _t($this->_aMapStatus2LangKey[$sStatus]), BX_INFORMER_ALERT);
-            }
-        }        
-*/
-
-		bx_import('BxDolView');
-		BxDolView::getObjectInstance(BxNotesConfig::$OBJECT_VIEWS, $iContentId)->doView();
-    }
-
-    public function getCode () {
-
-        if (!$this->_aContentInfo) { // if note is not found - display standard "404 page not found" page
-            $this->_oTemplate->displayPageNotFound();
-            exit;
-        }
-
-        if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $this->_oModule->isAllowedView($this->_aContentInfo))) {
-			$this->_oTemplate->displayAccessDenied($sMsg);
-            exit;
-        }
-        $this->_oModule->isAllowedView($this->_aContentInfo, true);
-
-        return parent::getCode ();
-    }
-
-    protected function _getPageCacheParams () {
-        return $this->_aContentInfo[BxNotesConfig::$FIELD_ID]; // cache is different for every note
-    }
-
-}
-
-/** @} */

+ 40 - 25
modules/boonex/notes/classes/BxNotesTemplate.php

@@ -14,19 +14,25 @@ bx_import('BxDolModuleTemplate');
 /*
  * Notes module representation.
  */
-class BxNotesTemplate extends BxDolModuleTemplate {
+class BxNotesTemplate extends BxDolModuleTemplate 
+{
+    protected static $MODULE = 'bx_notes';
 
     /**
      * Constructor
      */
-    function __construct(&$oConfig, &$oDb) {
-        parent::__construct($oConfig, $oDb);        
+    function __construct(&$oConfig, &$oDb) 
+    {
+        parent::__construct($oConfig, $oDb);
+
         $this->addCss ('main.css');
     }
 
-    function unit ($aData, $isCheckPrivateContent = true, $sTemplateName = 'unit.html') {
+    function unit ($aData, $isCheckPrivateContent = true, $sTemplateName = 'unit.html') 
+    {
+        $oModule = BxDolModule::getInstance(self::$MODULE);
+        $CNF = &$oModule->_oConfig->CNF;
 
-        $oModule = BxDolModule::getInstance('bx_notes');
         if ($isCheckPrivateContent && CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $oModule->isAllowedView($aData))) {
             $aVars = array (
                 'summary' => $sMsg,
@@ -36,51 +42,51 @@ class BxNotesTemplate extends BxDolModuleTemplate {
 
         // get thumb url
         $sPhotoThumb = '';
-        if ($aData[BxNotesConfig::$FIELD_THUMB]) {
+        if ($aData[$CNF['FIELD_THUMB']]) {
             bx_import('BxDolImageTranscoder');
-            $oImagesTranscoder = BxDolImageTranscoder::getObjectInstance(BxNotesConfig::$OBJECT_IMAGES_TRANSCODER_PREVIEW);
+            $oImagesTranscoder = BxDolImageTranscoder::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW']);
             if ($oImagesTranscoder)
-                $sPhotoThumb = $oImagesTranscoder->getImageUrl($aData[BxNotesConfig::$FIELD_THUMB]);
+                $sPhotoThumb = $oImagesTranscoder->getImageUrl($aData[$CNF['FIELD_THUMB']]);
         }
 
-        // get note url
+        // get entry url
         bx_import('BxDolPermalinks');
-        $sUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=view-note&id=' . $aData['id']);
+        $sUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $aData[$CNF['FIELD_ID']]);
 
         bx_import('BxDolProfile');
-        $oProfile = BxDolProfile::getInstance($aData['author']);
+        $oProfile = BxDolProfile::getInstance($aData[$CNF['FIELD_AUTHOR']]);
         if (!$oProfile) {
             bx_import('BxDolProfileUndefined');
             $oProfile = BxDolProfileUndefined::getInstance();
         }
 
-        $sSummary = $aData['summary'];
+        $sSummary = $aData[$CNF['FIELD_SUMMARY']];
         if (!$sSummary) {
-			$iLimitChars = (int)getParam('bx_notes_summary_chars');
-			$sSummary = trim(strip_tags($aData['text']));
+			$iLimitChars = (int)getParam($CNF['PARAM_CHARS_SUMMARY']);
+			$sSummary = trim(strip_tags($aData[$CNF['FIELD_TEXT']]));
             $sLinkMore = '';
             if (mb_strlen($sSummary) > $iLimitChars) {
                 $sSummary = mb_substr($sSummary, 0, $iLimitChars);
-                $sLinkMore = ' <a title="' . bx_html_attribute(_t('_bx_notes_txt_read_more', $aData['title'])) . '" href="' . $sUrl . '"><i class="sys-icon ellipsis-horizontal"></i></a>';
+                $sLinkMore = ' <a title="' . bx_html_attribute(_t('_sys_read_more', $aData[$CNF['FIELD_TITLE']])) . '" href="' . $sUrl . '"><i class="sys-icon ellipsis-horizontal"></i></a>';
             }
             $sSummary = htmlspecialchars_adv($sSummary) . $sLinkMore;
         }
 
-        $sSummaryPlain = BxTemplFunctions::getInstance()->getStringWithLimitedLength(strip_tags($sSummary), 280);
+        $sSummaryPlain = BxTemplFunctions::getInstance()->getStringWithLimitedLength(strip_tags($sSummary), (int)getParam($CNF['PARAM_CHARS_SUMMARY_PLAIN']));
 
         // generate html
         $aVars = array (
-            'id' => $aData['id'],            
+            'id' => $aData[$CNF['FIELD_ID']],
             'content_url' => $sUrl,
-            'title' => bx_process_output($aData['title']),
+            'title' => bx_process_output($aData[$CNF['FIELD_TITLE']]),
             'summary' => $sSummary,
             'author' => $oProfile->getDisplayName(),
             'author_url' => $oProfile->getUrl(),
-            'entry_posting_date' => bx_time_js($aData['added'], BX_FORMAT_DATE),
+            'entry_posting_date' => bx_time_js($aData[$CNF['FIELD_ADDED']], BX_FORMAT_DATE),
             'bx_if:thumb' => array (
                 'condition' => $sPhotoThumb,
                 'content' => array (
-                    'title' => bx_process_output($aData['title']),
+                    'title' => bx_process_output($aData[$CNF['FIELD_TITLE']]),
                     'summary_attr' => bx_html_attribute($sSummaryPlain),
                     'content_url' => $sUrl,
                     'thumb_url' => $sPhotoThumb ? $sPhotoThumb : '',                    
@@ -98,22 +104,31 @@ class BxNotesTemplate extends BxDolModuleTemplate {
         return $this->parseHtmlByName($sTemplateName, $aVars);
     }
 
-    function entryText ($aData, $sTemplateName = 'entry-text.html') {
+    function entryText ($aData, $sTemplateName = 'entry-text.html') 
+    {
+        $oModule = BxDolModule::getInstance(self::$MODULE);
+        $CNF = &$oModule->_oConfig->CNF;
+
         $aVars = $aData;
-        $aVars['entry_title'] = $aData[BxNotesConfig::$FIELD_TITLE];
-        $aVars['entry_text'] = $aData[BxNotesConfig::$FIELD_TEXT];
+        $aVars['entry_title'] = $aData[$CNF['FIELD_TITLE']];
+        $aVars['entry_text'] = $aData[$CNF['FIELD_TEXT']];
 
         return $this->parseHtmlByName($sTemplateName, $aVars);
     }
 
-    function entryAuthor ($aData, $oProfile, $sTemplateName = 'author.html') {
+    function entryAuthor ($aData, $oProfile, $sTemplateName = 'author.html') 
+    {
         if (!$oProfile)
             return '';
+
+        $oModule = BxDolModule::getInstance(self::$MODULE);
+        $CNF = &$oModule->_oConfig->CNF;
+
         $aVars = array (
             'author_url' => $oProfile->getUrl(),
             'author_thumb_url' => $oProfile->getThumb(),
             'author_title' => $oProfile->getDisplayName(),
-            'entry_posting_date' =>  bx_time_js($aData['added'], BX_FORMAT_DATE),
+            'entry_posting_date' =>  bx_time_js($aData[$CNF['FIELD_ADDED']], BX_FORMAT_DATE),
         );
         return $this->parseHtmlByName($sTemplateName, $aVars);
     }

+ 5 - 7
modules/boonex/notes/install/langs/en.xml

@@ -3,8 +3,8 @@
 
 	<string name="_bx_notes"><![CDATA[Notes]]></string>
 
-	<string name="_bx_notes_option_autoapproval"><![CDATA[Activate notes after creation automatically]]></string>
 	<string name="_bx_notes_option_summary_chars"><![CDATA[Number of characters in auto-cropped note summary]]></string>
+	<string name="_bx_notes_option_plain_summary_chars"><![CDATA[Number of characters in plain note description when note hasn't thumb]]></string>
 	<string name="_bx_notes_option_per_page_browse"><![CDATA[Number of items per page]]></string>
 	<string name="_bx_notes_option_rss_num"><![CDATA[Number of items in RSS feed]]></string>
 
@@ -104,12 +104,10 @@
     <string name="_bx_notes_menu_title_notes_my"><![CDATA[My Notes Action Menu]]></string>
     <string name="_bx_notes_menu_set_title_notes_my"><![CDATA[My Notes Menu]]></string>
 
-	<string name="_bx_notes_txt_error_note_creation"><![CDATA[Note creation failed]]></string>
-	<string name="_bx_notes_txt_error_note_update"><![CDATA[Note update failed]]></string>
-	<string name="_bx_notes_txt_error_note_delete"><![CDATA[Note delete failed]]></string>
-	<string name="_bx_notes_txt_error_note_is_not_defined"><![CDATA[Note isn't defined]]></string>
-    <string name="_bx_notes_txt_status_pending"><![CDATA[This note is pending approval, please wait until it is activated.]]></string>
-    <string name="_bx_notes_txt_read_more"><![CDATA[Continue reading "{0}"]]></string>
+	<string name="_bx_notes_txt_error_entry_creation"><![CDATA[Note creation failed]]></string>
+	<string name="_bx_notes_txt_error_entry_update"><![CDATA[Note update failed]]></string>
+	<string name="_bx_notes_txt_error_entry_delete"><![CDATA[Note delete failed]]></string>
+	<string name="_bx_notes_txt_error_entry_is_not_defined"><![CDATA[Note isn't defined]]></string>    
     <string name="_bx_notes_txt_sample_single"><![CDATA[note]]></string>
 
 </resources>

+ 6 - 6
modules/boonex/notes/install/sql/enable.sql

@@ -11,8 +11,8 @@ VALUES (@iTypeId, 'bx_notes', '_bx_notes', 1);
 SET @iCategId = LAST_INSERT_ID();
 
 INSERT INTO `sys_options` (`name`, `value`, `category_id`, `caption`, `type`, `check`, `check_error`, `extra`, `order`) VALUES
-('bx_notes_autoapproval', 'on', @iCategId, '_bx_notes_option_autoapproval', 'checkbox', '', '', '', 1),
-('bx_notes_summary_chars', '700', @iCategId, '_bx_notes_option_summary_chars', 'digit', '', '', '', 2),
+('bx_notes_summary_chars', '700', @iCategId, '_bx_notes_option_summary_chars', 'digit', '', '', '', 1),
+('bx_notes_plain_summary_chars', '280', @iCategId, '_bx_notes_option_plain_summary_chars', 'digit', '', '', '', 2),
 ('bx_notes_per_page_browse', '12', @iCategId, '_bx_notes_option_per_page_browse', 'digit', '', '', '', 10),
 ('bx_notes_rss_num', '10', @iCategId, '_bx_notes_option_rss_num', 'digit', '', '', '', 20);
 
@@ -47,7 +47,7 @@ INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title`, `designb
 -- Dumping data for 'bx_notes_edit_note' page
 --
 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_notes_edit_note', '_bx_notes_page_title_sys_edit_note', '_bx_notes_page_title_edit_note', 'bx_notes', 5, 2147483647, 1, 'edit-note', '', '', '', '', 0, 1, 0, 'BxNotesPageNote', 'modules/boonex/notes/classes/BxNotesPageNote.php');
+('bx_notes_edit_note', '_bx_notes_page_title_sys_edit_note', '_bx_notes_page_title_edit_note', 'bx_notes', 5, 2147483647, 1, 'edit-note', '', '', '', '', 0, 1, 0, 'BxNotesPageEntry', 'modules/boonex/notes/classes/BxNotesPageEntry.php');
 
 INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES
 ('bx_notes_edit_note', 1, 'bx_notes', '_bx_notes_page_block_title_edit_note', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:8:"bx_notes";s:6:"method";s:11:"entity_edit";}', 0, 0, 0);
@@ -56,7 +56,7 @@ INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title`, `designb
 -- Dumping data for 'bx_notes_delete_note' page
 --
 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_notes_delete_note', '_bx_notes_page_title_sys_delete_note', '_bx_notes_page_title_delete_note', 'bx_notes', 5, 2147483647, 1, 'delete-note', '', '', '', '', 0, 1, 0, 'BxNotesPageNote', 'modules/boonex/notes/classes/BxNotesPageNote.php');
+('bx_notes_delete_note', '_bx_notes_page_title_sys_delete_note', '_bx_notes_page_title_delete_note', 'bx_notes', 5, 2147483647, 1, 'delete-note', '', '', '', '', 0, 1, 0, 'BxNotesPageEntry', 'modules/boonex/notes/classes/BxNotesPageEntry.php');
 
 INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES
 ('bx_notes_delete_note', 1, 'bx_notes', '_bx_notes_page_block_title_delete_note', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:8:"bx_notes";s:6:"method";s:13:"entity_delete";}', 0, 0, 0);
@@ -65,7 +65,7 @@ INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title`, `designb
 -- Dumping data for 'bx_notes_view_note' page
 --
 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_notes_view_note', '_bx_notes_page_title_sys_view_note', '_bx_notes_page_title_view_note', 'bx_notes', 11, 2147483647, 1, 'view-note', '', '', '', '', 0, 1, 0, 'BxNotesPageNote', 'modules/boonex/notes/classes/BxNotesPageNote.php');
+('bx_notes_view_note', '_bx_notes_page_title_sys_view_note', '_bx_notes_page_title_view_note', 'bx_notes', 11, 2147483647, 1, 'view-note', '', '', '', '', 0, 1, 0, 'BxNotesPageEntry', 'modules/boonex/notes/classes/BxNotesPageEntry.php');
 
 INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES 
 ('bx_notes_view_note', 2, 'bx_notes', '_bx_notes_page_block_title_note_author', 0, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_notes\";s:6:\"method\";s:13:\"entity_author\";}', 0, 0, 0),
@@ -78,7 +78,7 @@ INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbo
 -- Dumping data for 'bx_notes_view_note_comments' page
 -- 
 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_notes_view_note_comments', '_bx_notes_page_title_sys_view_note_comments', '_bx_notes_page_title_view_note_comments', 'bx_notes', 5, 2147483647, 1, 'view-note-comments', '', '', '', '', 0, 1, 0, 'BxNotesPageNote', 'modules/boonex/notes/classes/BxNotesPageNote.php');
+('bx_notes_view_note_comments', '_bx_notes_page_title_sys_view_note_comments', '_bx_notes_page_title_view_note_comments', 'bx_notes', 5, 2147483647, 1, 'view-note-comments', '', '', '', '', 0, 1, 0, 'BxNotesPageEntry', 'modules/boonex/notes/classes/BxNotesPageEntry.php');
 
 INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES 
 ('bx_notes_view_note_comments', 1, 'bx_notes', '_bx_notes_page_block_title_note_comments', 13, 2147483647, 'service', 'a:2:{s:6:\"module\";s:8:\"bx_notes\";s:6:\"method\";s:15:\"entity_comments\";}', 0, 0, 1);