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

+ 9 - 4
modules/base/general/classes/BxBaseModGeneralFormsEntryHelper.php

@@ -293,19 +293,24 @@ class BxBaseModGeneralFormsEntryHelper extends BxDolProfileForms
     }
 
     public function onDataAddAfter ($iAccountId, $iContentId)
+    {
+        $this->_processMetas($iAccountId, $iContentId);
+
+        return '';
+    }
+
+    protected function _processMetas($iAccountId, $iContentId)
     {
         $CNF = &$this->_oModule->_oConfig->CNF;
 
         if (!empty($CNF['OBJECT_METATAGS'])) {
             list ($oProfile, $aContentInfo) = $this->_getProfileAndContentData($iContentId);
             $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']);
-            if ($oMetatags->keywordsIsEnabled())
+            if ($oMetatags->keywordsIsEnabled() && $aContentInfo)
                 $oMetatags->keywordsAddAuto($aContentInfo[$CNF['FIELD_ID']], $aContentInfo, $CNF, $CNF['OBJECT_FORM_ENTRY_DISPLAY_ADD']);
-            if ($oMetatags->locationsIsEnabled())
+            if ($oMetatags->locationsIsEnabled() && $aContentInfo)
                 $oMetatags->locationsAddFromForm($aContentInfo[$CNF['FIELD_ID']], $CNF['FIELD_LOCATION_PREFIX']);
         }
-
-        return '';
     }
 }
 

+ 13 - 0
modules/base/general/classes/BxBaseModGeneralModule.php

@@ -158,6 +158,19 @@ class BxBaseModGeneralModule extends BxDolModule
     {
         return $this->_serviceTemplateFunc ('entryInfo', $iContentId);
     }
+
+    /**
+     * Entry location info
+     */
+    public function serviceEntityLocation ($iContentId = 0)
+    {
+        if (!$iContentId)
+            $iContentId = bx_process_input(bx_get('id'), BX_DATA_INT);
+        if (!$iContentId)
+            return false;
+
+        return $this->_oTemplate->entryLocation ($iContentId);
+    }
     
     /**
      * Delete content entry

+ 4 - 0
modules/base/profile/classes/BxBaseModProfileFormsEntryHelper.php

@@ -103,6 +103,7 @@ class BxBaseModProfileFormsEntryHelper extends BxBaseModGeneralFormsEntryHelper
 
     public function onDataAddAfter ($iAccountId, $iContentId)
     {
+        // parent method isn't processing metas, so we are processing it below
         if ($s = parent::onDataAddAfter($iAccountId, $iContentId))
             return $s;
 
@@ -122,6 +123,9 @@ class BxBaseModProfileFormsEntryHelper extends BxBaseModGeneralFormsEntryHelper
             (isAdmin() ? MEMBERSHIP_ID_ADMINISTRATOR : getParam($CNF['PARAM_DEFAULT_ACL_LEVEL']));
         BxDolAcl::getInstance()->setMembership($iProfileId, $iAclLevel, 0, true);
 
+        // process metas
+        $this->_processMetas($iAccountId, $iContentId);
+        
         // process uploaded files
         $oForm = $this->getObjectFormAdd();
         $oForm->processFiles($CNF['FIELD_PICTURE'], $iContentId, true);

+ 0 - 13
modules/base/text/classes/BxBaseModTextModule.php

@@ -109,19 +109,6 @@ class BxBaseModTextModule extends BxBaseModGeneralModule
         return $this->_oTemplate->entryAllActions('', $this->serviceEntitySocialSharing($iContentId));
     }
 
-    /**
-     * Entry location info
-     */
-    public function serviceEntityLocation ($iContentId = 0)
-    {
-        if (!$iContentId)
-            $iContentId = bx_process_input(bx_get('id'), BX_DATA_INT);
-        if (!$iContentId)
-            return false;
-
-        return $this->_oTemplate->entryLocation ($iContentId);
-    }
-
     /**
      * Entry comments
      */

+ 1 - 0
modules/boonex/events/classes/BxEventsConfig.php

@@ -49,6 +49,7 @@ class BxEventsConfig extends BxBaseModProfileConfig
             'FIELD_COVER' => 'cover',
             'FIELD_ALLOW_VIEW_TO' => 'allow_view_to',
             'FIELDS_QUICK_SEARCH' => array('event_name'),
+            'FIELD_LOCATION_PREFIX' => 'location',
             'FIELDS_WITH_KEYWORDS' => 'auto', // can be 'auto', array of fields or comma separated string of field names, works only when OBJECT_METATAGS is specified
 
             // page URIs

+ 1 - 17
modules/boonex/events/classes/BxEventsFormsEntryHelper.php

@@ -10,7 +10,7 @@
  */
 
 /**
- * Group profile forms functions
+ * Event forms functions
  */
 class BxEventsFormsEntryHelper extends BxBaseModGroupsFormsEntryHelper
 {
@@ -18,22 +18,6 @@ class BxEventsFormsEntryHelper extends BxBaseModGroupsFormsEntryHelper
     {
         parent::__construct($oModule);
     }
-
-    public function onDataAddAfter ($iAccountId, $iContentId)
-    {
-        if ($s = parent::onDataAddAfter($iAccountId, $iContentId))
-            return $s;
-
-        return '';
-    }
-
-    public function onDataDeleteAfter ($iContentId, $aContentInfo, $oProfile)
-    {
-        if ($s = parent::onDataDeleteAfter($iAccountId, $iContentId))
-            return $s;
-
-        return '';
-    }
 }
 
 /** @} */

+ 1 - 0
modules/boonex/events/install/langs/en.xml

@@ -125,6 +125,7 @@
     <string name="_bx_events_page_block_title_categories"><![CDATA[Event categories]]></string>
     <string name="_bx_events_page_block_title_calendar"><![CDATA[Events calendar]]></string>
     <string name="_bx_events_page_block_title_profile_calendar"><![CDATA[Calendar]]></string>
+    <string name="_bx_events_page_block_title_entry_location"><![CDATA[Location]]></string>
 
     <string name="_bx_events_menu_title_submenu"><![CDATA[Events Submenu]]></string>
     <string name="_bx_events_menu_set_title_submenu"><![CDATA[Events Submenu]]></string>

+ 5 - 3
modules/boonex/events/install/sql/enable.sql

@@ -35,7 +35,8 @@ INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `t
 ('bx_events_view_profile', 2, 'bx_events', '', '_bx_events_page_block_title_profile_info', 11, '', 2147483647, 'service', 'a:2:{s:6:\"module\";s:9:\"bx_events\";s:6:\"method\";s:11:\"entity_info\";}', 0, 0, 1, 0),
 ('bx_events_view_profile', 1, 'bx_events', '', '_bx_events_page_block_title_entry_social_sharing', 13, '', 2147483647, 'service', 'a:2:{s:6:\"module\";s:9:\"bx_events\";s:6:\"method\";s:21:\"entity_social_sharing\";}', 0, 0, 1, 0),
 ('bx_events_view_profile', 3, 'bx_events', '', '_bx_events_page_block_title_profile_calendar', 11, '', 2147483647, 'service', 'a:3:{s:6:\"module\";s:9:\"bx_events\";s:6:\"method\";s:8:\"calendar\";s:6:\"params\";a:2:{i:0;a:1:{s:5:\"event\";s:12:\"{content_id}\";}i:1;s:21:\"calendar_compact.html\";}}', 0, 0, 1, 0),
-('bx_events_view_profile', 4, 'bx_events', '', '_bx_events_page_block_title_fans', 11, '', 2147483647, 'service', 'a:2:{s:6:\"module\";s:9:\"bx_events\";s:6:\"method\";s:4:\"fans\";}', 0, 0, 1, 1);
+('bx_events_view_profile', 4, 'bx_events', '', '_bx_events_page_block_title_fans', 11, '', 2147483647, 'service', 'a:2:{s:6:\"module\";s:9:\"bx_events\";s:6:\"method\";s:4:\"fans\";}', 0, 0, 1, 1),
+('bx_events_view_profile', 2, 'bx_events', '', '_bx_events_page_block_title_entry_location', 11, '', 2147483647, 'service', 'a:4:{s:6:\"module\";s:6:\"system\";s:6:\"method\";s:13:\"locations_map\";s:6:\"params\";a:2:{i:0;s:9:\"bx_events\";i:1;s:12:\"{content_id}\";}s:5:\"class\";s:20:\"TemplServiceMetatags\";}', 0, 0, 1, 1);
 
 -- PAGE: view closed profile 
 
@@ -78,7 +79,8 @@ INSERT INTO `sys_objects_page`(`object`, `uri`, `title_system`, `title`, `module
 INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `hidden_on`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES 
 ('bx_events_profile_info', 1, 'bx_events', '', '_bx_events_page_block_title_profile_description', 13, '', 2147483647, 'service', 'a:2:{s:6:\"module\";s:9:\"bx_events\";s:6:\"method\";s:17:\"entity_text_block\";}', 0, 0, 1, 0),
 ('bx_events_profile_info', 2, 'bx_events', '_bx_events_page_block_title_system_profile_info', '_bx_events_page_block_title_profile_info_link', 11, '', 2147483647, 'service', 'a:2:{s:6:\"module\";s:9:\"bx_events\";s:6:\"method\";s:16:\"entity_info_full\";}', 0, 0, 1, 0),
-('bx_events_profile_info', 3, 'bx_events', '', '_bx_events_page_block_title_profile_calendar', 11, '', 2147483647, 'service', 'a:3:{s:6:\"module\";s:9:\"bx_events\";s:6:\"method\";s:8:\"calendar\";s:6:\"params\";a:2:{i:0;a:1:{s:5:\"event\";s:12:\"{content_id}\";}i:1;s:21:\"calendar_compact.html\";}}', 0, 0, 1, 0);
+('bx_events_profile_info', 3, 'bx_events', '', '_bx_events_page_block_title_profile_calendar', 11, '', 2147483647, 'service', 'a:3:{s:6:\"module\";s:9:\"bx_events\";s:6:\"method\";s:8:\"calendar\";s:6:\"params\";a:2:{i:0;a:1:{s:5:\"event\";s:12:\"{content_id}\";}i:1;s:21:\"calendar_compact.html\";}}', 0, 0, 1, 0),
+('bx_events_profile_info', 2, 'bx_events', '', '_bx_events_page_block_title_entry_location', 11, '', 2147483647, 'service', 'a:4:{s:6:\"module\";s:6:\"system\";s:6:\"method\";s:13:\"locations_map\";s:6:\"params\";a:2:{i:0;s:9:\"bx_events\";i:1;s:12:\"{content_id}\";}s:5:\"class\";s:20:\"TemplServiceMetatags\";}', 0, 0, 1, 1);
 
 -- PAGE: event fans
 
@@ -322,7 +324,7 @@ INSERT INTO `sys_objects_report` (`name`, `table_main`, `table_track`, `is_on`,
 
 -- METATAGS
 INSERT INTO `sys_objects_metatags` (`object`, `table_keywords`, `table_locations`, `table_mentions`, `override_class_name`, `override_class_file`) VALUES
-('bx_events', 'bx_events_meta_keywords', '', '', '', '');
+('bx_events', 'bx_events_meta_keywords', 'bx_events_meta_locations', '', '', '');
 
 -- CATEGORY
 INSERT INTO `sys_objects_category` (`object`, `search_object`, `form_object`, `list_name`, `table`, `field`, `join`, `where`, `override_class_name`, `override_class_file`) VALUES

+ 65 - 39
modules/boonex/events/install/sql/install.sql

@@ -125,6 +125,20 @@ CREATE TABLE `bx_events_meta_keywords` (
   KEY `keyword` (`keyword`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 
+CREATE TABLE `bx_events_meta_locations` (
+  `object_id` int(10) unsigned NOT NULL,
+  `lat` double NOT NULL,
+  `lng` double NOT NULL,
+  `country` varchar(2) NOT NULL,
+  `state` varchar(255) NOT NULL,
+  `city` varchar(255) NOT NULL,
+  `zip` varchar(255) NOT NULL,
+  `street` varchar(255) NOT NULL,
+  `street_number` varchar(255) NOT NULL,
+  PRIMARY KEY (`object_id`),
+  KEY `country_state_city` (`country`,`state`(8),`city`(8))
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
 -- TABLE: fans
 CREATE TABLE IF NOT EXISTS `bx_events_fans` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
@@ -196,24 +210,26 @@ INSERT INTO `sys_form_inputs`(`object`, `module`, `name`, `value`, `values`, `ch
 ('bx_event', 'bx_events', 'picture', 'a:1:{i:0;s:22:\"bx_events_picture_crop\";}', 'a:1:{s:22:\"bx_events_picture_crop\";s:24:\"_sys_uploader_crop_title\";}', 0, 'files', '_bx_events_form_profile_input_sys_picture', '_bx_events_form_profile_input_picture', '', 0, 0, 0, '', '', '', '', '', '_bx_events_form_profile_input_picture_err', '', '', 1, 0),
 ('bx_event', 'bx_events', 'reoccurring', '', '', 0, 'custom', '_bx_events_form_profile_input_sys_reoccurring', '_bx_events_form_profile_input_reoccurring', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 1),
 ('bx_event', 'bx_events', 'time', '', '', 0, 'custom', '_bx_events_form_profile_input_sys_time', '_bx_events_form_profile_input_time', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
-('bx_event', 'bx_events', 'timezone', 'UTC', '', 0, 'select', '_bx_events_form_profile_input_sys_timezone', '_bx_events_form_profile_input_timezone', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 1, 0);
+('bx_event', 'bx_events', 'timezone', 'UTC', '', 0, 'select', '_bx_events_form_profile_input_sys_timezone', '_bx_events_form_profile_input_timezone', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 1, 0),
+('bx_event', 'bx_events', 'location', '', '', 0, 'location', '_sys_form_input_sys_location', '_sys_form_input_location', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0);
 
 INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES 
-('bx_event_add', 'time', 2147483647, 0, 0),
-('bx_event_add', 'delete_confirm', 2147483647, 0, 1),
-('bx_event_add', 'cover', 2147483647, 0, 2),
-('bx_event_add', 'initial_members', 2147483647, 1, 3),
-('bx_event_add', 'picture', 2147483647, 1, 4),
-('bx_event_add', 'event_name', 2147483647, 1, 5),
-('bx_event_add', 'event_cat', 2147483647, 1, 6),
-('bx_event_add', 'event_desc', 2147483647, 1, 7),
-('bx_event_add', 'date_start', 2147483647, 1, 8),
-('bx_event_add', 'date_end', 2147483647, 1, 9),
-('bx_event_add', 'timezone', 2147483647, 1, 10),
-('bx_event_add', 'reoccurring', 2147483647, 1, 11),
-('bx_event_add', 'join_confirmation', 2147483647, 1, 12),
-('bx_event_add', 'allow_view_to', 2147483647, 1, 13),
-('bx_event_add', 'do_submit', 2147483647, 1, 14),
+('bx_event_add', 'time', 2147483647, 0, 1),
+('bx_event_add', 'delete_confirm', 2147483647, 0, 2),
+('bx_event_add', 'cover', 2147483647, 0, 3),
+('bx_event_add', 'initial_members', 2147483647, 1, 4),
+('bx_event_add', 'picture', 2147483647, 1, 5),
+('bx_event_add', 'event_name', 2147483647, 1, 6),
+('bx_event_add', 'event_cat', 2147483647, 1, 7),
+('bx_event_add', 'event_desc', 2147483647, 1, 8),
+('bx_event_add', 'location', 2147483647, 1, 9),
+('bx_event_add', 'date_start', 2147483647, 1, 10),
+('bx_event_add', 'date_end', 2147483647, 1, 11),
+('bx_event_add', 'timezone', 2147483647, 1, 12),
+('bx_event_add', 'reoccurring', 2147483647, 1, 13),
+('bx_event_add', 'join_confirmation', 2147483647, 1, 14),
+('bx_event_add', 'allow_view_to', 2147483647, 1, 15),
+('bx_event_add', 'do_submit', 2147483647, 1, 16),
 
 ('bx_event_delete', 'cover', 2147483647, 0, 0),
 ('bx_event_delete', 'picture', 2147483647, 0, 0),
@@ -222,29 +238,39 @@ INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for
 ('bx_event_delete', 'event_name', 2147483647, 0, 2),
 ('bx_event_delete', 'event_cat', 2147483647, 0, 3),
 
-('bx_event_edit', 'initial_members', 2147483647, 0, 1),
-('bx_event_edit', 'delete_confirm', 2147483647, 0, 2),
-('bx_event_edit', 'cover', 2147483647, 0, 3),
-('bx_event_edit', 'picture', 2147483647, 1, 4),
-('bx_event_edit', 'event_name', 2147483647, 1, 5),
-('bx_event_edit', 'event_cat', 2147483647, 1, 6),
-('bx_event_edit', 'event_desc', 2147483647, 1, 7),
-('bx_event_edit', 'date_start', 2147483647, 1, 8),
-('bx_event_edit', 'date_end', 2147483647, 1, 9),
-('bx_event_edit', 'timezone', 2147483647, 1, 10),
-('bx_event_edit', 'reoccurring', 2147483647, 1, 11),
-('bx_event_edit', 'join_confirmation', 2147483647, 1, 12),
-('bx_event_edit', 'allow_view_to', 2147483647, 1, 13),
-('bx_event_edit', 'do_submit', 2147483647, 1, 14),
-
-('bx_event_edit_cover', 'event_desc', 2147483647, 0, 0),
-('bx_event_edit_cover', 'join_confirmation', 2147483647, 0, 0),
-('bx_event_edit_cover', 'delete_confirm', 2147483647, 0, 1),
-('bx_event_edit_cover', 'event_name', 2147483647, 0, 2),
-('bx_event_edit_cover', 'picture', 2147483647, 0, 3),
-('bx_event_edit_cover', 'event_cat', 2147483647, 0, 5),
-('bx_event_edit_cover', 'cover', 2147483647, 1, 7),
-('bx_event_edit_cover', 'do_submit', 2147483647, 1, 8),
+('bx_event_edit', 'time', 2147483647, 0, 1),
+('bx_event_edit', 'initial_members', 2147483647, 0, 2),
+('bx_event_edit', 'delete_confirm', 2147483647, 0, 3),
+('bx_event_edit', 'cover', 2147483647, 0, 4),
+('bx_event_edit', 'picture', 2147483647, 1, 5),
+('bx_event_edit', 'event_name', 2147483647, 1, 6),
+('bx_event_edit', 'event_cat', 2147483647, 1, 7),
+('bx_event_edit', 'event_desc', 2147483647, 1, 8),
+('bx_event_edit', 'location', 2147483647, 1, 9),
+('bx_event_edit', 'date_start', 2147483647, 1, 10),
+('bx_event_edit', 'date_end', 2147483647, 1, 11),
+('bx_event_edit', 'timezone', 2147483647, 1, 12),
+('bx_event_edit', 'reoccurring', 2147483647, 1, 13),
+('bx_event_edit', 'join_confirmation', 2147483647, 1, 14),
+('bx_event_edit', 'allow_view_to', 2147483647, 1, 15),
+('bx_event_edit', 'do_submit', 2147483647, 1, 16),
+
+('bx_event_edit_cover', 'allow_view_to', 2147483647, 0, 1),
+('bx_event_edit_cover', 'time', 2147483647, 0, 2),
+('bx_event_edit_cover', 'reoccurring', 2147483647, 0, 3),
+('bx_event_edit_cover', 'join_confirmation', 2147483647, 0, 4),
+('bx_event_edit_cover', 'initial_members', 2147483647, 0, 5),
+('bx_event_edit_cover', 'timezone', 2147483647, 0, 6),
+('bx_event_edit_cover', 'event_desc', 2147483647, 0, 7),
+('bx_event_edit_cover', 'date_start', 2147483647, 0, 8),
+('bx_event_edit_cover', 'date_end', 2147483647, 0, 9),
+('bx_event_edit_cover', 'delete_confirm', 2147483647, 0, 10),
+('bx_event_edit_cover', 'event_name', 2147483647, 0, 11),
+('bx_event_edit_cover', 'location', 2147483647, 0, 12),
+('bx_event_edit_cover', 'picture', 2147483647, 0, 13),
+('bx_event_edit_cover', 'event_cat', 2147483647, 0, 14),
+('bx_event_edit_cover', 'cover', 2147483647, 1, 15),
+('bx_event_edit_cover', 'do_submit', 2147483647, 1, 16),
 
 ('bx_event_view', 'allow_view_to', 2147483647, 0, 1),
 ('bx_event_view', 'reoccurring', 2147483647, 0, 2),

+ 1 - 0
modules/boonex/russian/data/langs/bx_events/ru.xml

@@ -123,6 +123,7 @@
     <string name="_bx_events_page_block_title_categories"><![CDATA[Категории событий]]></string>
     <string name="_bx_events_page_block_title_calendar"><![CDATA[Календарь событий]]></string>
     <string name="_bx_events_page_block_title_profile_calendar"><![CDATA[Календарь]]></string>
+    <string name="_bx_events_page_block_title_entry_location"><![CDATA[Местоположение]]></string>
 
     <string name="_bx_events_menu_title_submenu"><![CDATA[Под-меню событий]]></string>
     <string name="_bx_events_menu_set_title_submenu"><![CDATA[Под-меню событий]]></string>