AntonLV 12 лет назад
Родитель
Сommit
8c0dffe121

+ 4 - 0
modules/boonex/timeline/classes/BxTimelineConfig.php

@@ -41,6 +41,10 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
         parent::__construct($aModule);
 
         $this->CNF = array (
+	        // database fields
+        	'FIELD_ID' => 'id',
+        	'FIELD_LOCATION_PREFIX' => 'location',
+
         	// objects
             'OBJECT_COMMENTS' => $this->_sName,
         

+ 7 - 1
modules/boonex/timeline/classes/BxTimelineModule.php

@@ -482,7 +482,7 @@ class BxTimelineModule extends BxBaseModNotificationsModule
         $iUserId = $this->getUserId();
 
         bx_import('BxDolForm');
-        $oForm = BxDolForm::getObjectInstance('mod_tml_post', 'mod_tml_post_add');
+        $oForm = BxDolForm::getObjectInstance('mod_tml_post', 'mod_tml_post_add', $this->_oTemplate);
         $oForm->aFormAttrs['action'] = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'post/';
         $oForm->aInputs['owner_id']['value'] = $this->_iOwnerId;
 
@@ -548,6 +548,7 @@ class BxTimelineModule extends BxBaseModNotificationsModule
             	bx_import('BxDolMetatags');
             	$oMetatags = BxDolMetatags::getObjectInstance($this->_oConfig->getObject('metatags'));
  				$oMetatags->keywordsAdd($iId, $aContent['text']);
+ 				$oMetatags->locationsAddFromForm($iId, $this->_oConfig->CNF['FIELD_LOCATION_PREFIX']);
 
                 if(!empty($aLinkIds) && is_array($aLinkIds))
                     foreach($aLinkIds as $iLinkId)
@@ -771,6 +772,11 @@ class BxTimelineModule extends BxBaseModNotificationsModule
 				$this->_oDb->deleteEvent(array('id' => (int)$aShareEvent['id']));
 		}
 
+		//--- Delete associated meta.
+		bx_import('BxDolMetatags');
+        $oMetatags = BxDolMetatags::getObjectInstance($this->_oConfig->getObject('metatags'));
+        $oMetatags->onDeleteContent($aEvent['id']);
+
         //--- Event -> Delete for Alerts Engine ---//
         bx_import('BxDolAlerts');
         $oAlert = new BxDolAlerts($this->_oConfig->getObject('alert'), 'delete', $aEvent['id'], $this->getUserId());

+ 11 - 0
modules/boonex/timeline/classes/BxTimelineTemplate.php

@@ -455,6 +455,10 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
 
         $bBrowseItem = isset($aBrowseParams['type']) && $aBrowseParams['type'] == BX_TIMELINE_TYPE_ITEM;
 
+        bx_import('BxDolMetatags');
+        $oMetatags = BxDolMetatags::getObjectInstance($this->_oConfig->getObject('metatags'));
+ 		$sLocation = $oMetatags->locationsString($aEvent['id']);
+ 
         $aTmplVars = array (
             'style_prefix' => $sStylePrefix,
             'js_object' => $sJsObject,
@@ -487,6 +491,13 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
             'item_view_url' => $this->_oConfig->getItemViewUrl($aEvent),
             'item_date' => bx_time_js($aEvent['date']),
             'content' => is_string($aEvent['content']) ? $aEvent['content'] : $this->_getContent($sType, $aEvent, $aBrowseParams),
+            'bx_if:show_location' => array(
+            	'condition' => !empty($sLocation),
+            	'content' => array(
+            		'style_prefix' > $sStylePrefix,
+            		'location' => $sLocation
+            	)
+            ),
             'bx_if:show_menu_item_actions' => array(
                 'condition' => !empty($aTmplVarsMenuItemActions),
                 'content' => $aTmplVarsMenuItemActions

+ 1 - 1
modules/boonex/timeline/install/sql/enable.sql

@@ -154,7 +154,7 @@ INSERT INTO `sys_objects_search` (`ObjectName`, `Title`, `ClassName`, `ClassPath
 
 -- METATAGS
 INSERT INTO `sys_objects_metatags` (`object`, `table_keywords`, `table_locations`, `table_mentions`, `override_class_name`, `override_class_file`) VALUES
-('bx_timeline', 'bx_timeline_meta_keywords', '', '', '', '');
+('bx_timeline', 'bx_timeline_meta_keywords', 'bx_timeline_meta_locations', '', '', '');
 
 
 -- MODULES' CONNECTIONS

+ 18 - 4
modules/boonex/timeline/install/sql/install.sql

@@ -164,6 +164,18 @@ CREATE TABLE `bx_timeline_meta_keywords` (
   KEY `keyword` (`keyword`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
 
+CREATE TABLE `bx_timeline_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,
+  PRIMARY KEY (`object_id`),
+  KEY `country_state_city` (`country`,`state`(8),`city`(8))
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
 -- STORAGES, TRANSCODERS, UPLOADERS
 INSERT INTO `sys_objects_uploader` (`object`, `active`, `override_class_name`, `override_class_file`) VALUES
 ('bx_timeline_simple', 1, 'BxTimelineUploaderSimple', 'modules/boonex/timeline/classes/BxTimelineUploaderSimple.php');
@@ -184,7 +196,7 @@ INSERT INTO `sys_transcoder_filters` (`transcoder_object`, `filter`, `filter_par
 
 -- Forms -> Post
 INSERT INTO `sys_objects_form` (`object`, `module`, `title`, `action`, `form_attrs`, `submit_name`, `table`, `key`, `uri`, `uri_title`, `params`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES
-('mod_tml_post', @sName, '_bx_timeline_form_post', '', '', 'do_submit', 'bx_timeline_events', 'id', '', '', '', 0, 1, '', '');
+('mod_tml_post', @sName, '_bx_timeline_form_post', '', '', 'do_submit', 'bx_timeline_events', 'id', '', '', '', 0, 1, 'BxTimelineForm', 'modules/boonex/timeline/classes/BxTimelineForm.php');
 
 INSERT INTO `sys_form_displays` (`display_name`, `module`, `object`, `title`, `view_mode`) VALUES
 ('mod_tml_post_add', @sName, 'mod_tml_post', '_bx_timeline_form_post_display_add', 0);
@@ -194,6 +206,7 @@ INSERT INTO `sys_form_inputs` (`object`, `module`, `name`, `value`, `values`, `c
 ('mod_tml_post', @sName, 'action', '', '', 0, 'hidden', '_bx_timeline_form_post_input_sys_action', '', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
 ('mod_tml_post', @sName, 'owner_id', '0', '', 0, 'hidden', '_bx_timeline_form_post_input_sys_owner_id', '', '', 0, 0, 0, '', '', '', '', '', '', 'Int', '', 0, 0),
 ('mod_tml_post', @sName, 'text', '', '', 0, 'textarea', '_bx_timeline_form_post_input_sys_text', '_bx_timeline_form_post_input_text', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
+('mod_tml_post', @sName, 'location', '', '', 0, 'custom', '_sys_form_input_sys_location', '_sys_form_input_location', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
 ('mod_tml_post', @sName, 'link', '', '', 0, 'custom', '_bx_timeline_form_post_input_sys_link', '', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
 ('mod_tml_post', @sName, 'photo', '', '', 0, 'files', '_bx_timeline_form_post_input_sys_photo', '_bx_timeline_form_post_input_photo', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 0, 0),
 ('mod_tml_post', @sName, 'do_submit', '_bx_timeline_form_post_input_do_submit', '', 0, 'submit', '_bx_timeline_form_post_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0);
@@ -203,9 +216,10 @@ INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_fo
 ('mod_tml_post_add', 'action', 2147483647, 1, 2),
 ('mod_tml_post_add', 'owner_id', 2147483647, 1, 3),
 ('mod_tml_post_add', 'text', 2147483647, 1, 4),
-('mod_tml_post_add', 'link', 2147483647, 1, 5),
-('mod_tml_post_add', 'photo', 2147483647, 1, 6),
-('mod_tml_post_add', 'do_submit', 2147483647, 1, 7);
+('mod_tml_post_add', 'location', 2147483647, 1, 5),
+('mod_tml_post_add', 'link', 2147483647, 1, 6),
+('mod_tml_post_add', 'photo', 2147483647, 1, 7),
+('mod_tml_post_add', 'do_submit', 2147483647, 1, 8);
 
 -- Forms -> Attach link
 INSERT INTO `sys_objects_form` (`object`, `module`, `title`, `action`, `form_attrs`, `submit_name`, `table`, `key`, `uri`, `uri_title`, `params`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES

+ 1 - 0
modules/boonex/timeline/install/sql/uninstall.sql

@@ -17,6 +17,7 @@ DROP TABLE IF EXISTS `bx_timeline_votes`;
 DROP TABLE IF EXISTS `bx_timeline_votes_track`;
 
 DROP TABLE IF EXISTS `bx_timeline_meta_keywords`;
+DROP TABLE IF EXISTS `bx_timeline_meta_locations`;
 
 
 -- STORAGES, TRANSCODERS, UPLOADERS

+ 5 - 0
modules/boonex/timeline/template/item.html

@@ -24,6 +24,11 @@
 				</div>
 			</div>
 			__content__
+			<bx_if:show_location>
+				<div class="__style_prefix__-location bx-def-margin-top bx-clearfix">
+					__location__
+				</div>
+			</bx_if:show_location>
 			<div class="__style_prefix__-activity bx-clearfix">
 				<bx_if:show_menu_item_actions>
 					<div class="__style_prefix__-item-actions bx-def-margin-left-auto bx-def-margin-top">