Ver Fonte

#255 Albums: info block

Alex Trofimov há 10 anos atrás
pai
commit
db483174eb

+ 12 - 0
modules/base/general/classes/BxBaseModGeneralFormEntry.php

@@ -27,6 +27,18 @@ class BxBaseModGeneralFormEntry extends BxTemplFormView
         parent::__construct($aInfo, $oTemplate);
 
         $this->_oModule = BxDolModule::getInstance($this->MODULE);
+
+        $CNF = &$this->_oModule->_oConfig->CNF;
+        
+        if (isset($CNF['FIELD_ADDED']) && isset($this->aInputs[$CNF['FIELD_ADDED']])) {
+            $this->aInputs[$CNF['FIELD_ADDED']]['date_filter'] = BX_DATA_INT;
+            $this->aInputs[$CNF['FIELD_ADDED']]['date_format'] = BX_FORMAT_DATE;
+        }
+
+        if (isset($CNF['FIELD_CHANGED']) && isset($this->aInputs[$CNF['FIELD_CHANGED']])) {
+            $this->aInputs[$CNF['FIELD_CHANGED']]['date_filter'] = BX_DATA_INT;
+            $this->aInputs[$CNF['FIELD_CHANGED']]['date_format'] = BX_FORMAT_DATE;
+        }        
     }
 
     public function insert ($aValsToAdd = array(), $isIgnore = false)

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

@@ -124,6 +124,11 @@ class BxBaseModGeneralModule extends BxDolModule
         return $this->_serviceEntityForm ('viewDataForm', $iContentId);
     }
 
+	public function serviceEntityInfoExtended ($iContentId = 0)
+    {
+        return $this->_serviceTemplateFunc ('entryInfo', $iContentId);
+    }
+    
     /**
      * Delete content entry
      * @param $iContentId content id 

+ 24 - 0
modules/base/general/classes/BxBaseModGeneralTemplate.php

@@ -67,6 +67,30 @@ class BxBaseModGeneralTemplate extends BxDolModuleTemplate
         );
         return $this->parseHtmlByName('entry-location.html', $aVars);
     }
+
+	public function entryInfo($aData, $aValues = array())
+    {
+    	$CNF = $this->_oConfig->CNF;
+        $aValuesDefault = array();
+
+        if (isset($aData[$CNF['FIELD_ADDED']]))
+            $aValuesDefault[] = array(
+                'title' => _t('_sys_txt_field_created'),
+                'value' => bx_time_js($aData[$CNF['FIELD_ADDED']]),
+            );
+
+        if (isset($aData[$CNF['FIELD_CHANGED']]))
+            $aValuesDefault[] = array(
+                'title' => _t('_sys_txt_field_updated'),
+                'value' => bx_time_js($aData[$CNF['FIELD_CHANGED']]),
+            );
+
+        $aValues = array_merge($aValuesDefault, $aValues);
+
+    	return $this->parseHtmlByName('entry-info.html', array(
+    		'bx_repeat:info' => $aValues,
+    	));
+    }
 }
 
 /** @} */

+ 6 - 0
modules/base/general/template/css/main.css

@@ -1,4 +1,10 @@
 
+/* view entry */
+
+.bx-base-general-entity-info > p:first-child {
+    margin-top:0;
+}
+
 /* unit */
 
 .bx-def-unit-live-search {

+ 5 - 0
modules/base/general/template/entry-info.html

@@ -0,0 +1,5 @@
+<div class="bx-base-general-entity-info">
+    <bx_repeat:info>
+    	<p><span class="bx-def-font-grayed">__title__</span> __value__</p>
+    </bx_repeat:info>
+</div>

+ 1 - 1
modules/base/text/classes/BxBaseModTextTemplate.php

@@ -86,7 +86,7 @@ class BxBaseModTextTemplate extends BxBaseModGeneralTemplate
 
     function getAuthorDesc ($aData)
     {
-        return bx_time_js($aData[$this->getModule()->_oConfig->CNF['FIELD_ADDED']], BX_FORMAT_DATE);
+        return '';
     }
 
     function getAuthorAddon ($aData, $oProfile)

+ 1 - 0
modules/base/text/template/entry-info.html

@@ -0,0 +1 @@
+<bx_include_base:../modules/base/general/template/entry-info.html />

+ 0 - 5
modules/boonex/albums/classes/BxAlbumsModule.php

@@ -23,11 +23,6 @@ class BxAlbumsModule extends BxBaseModTextModule
         parent::__construct($aModule);
     }
 
-	public function serviceEntityInfoExtended ($iContentId = 0)
-    {
-        return $this->_serviceTemplateFunc ('entryInfo', $iContentId);
-    }
-
     public function serviceEntityAddFiles ($iContentId = 0)
     {
         return $this->_serviceEntityForm ('editDataForm', $iContentId, 'bx_albums_entry_add_images');

+ 0 - 14
modules/boonex/albums/classes/BxAlbumsTemplate.php

@@ -293,20 +293,6 @@ class BxAlbumsTemplate extends BxBaseModTextTemplate
         return $a;
     }
 
-	public function entryInfo($aData)
-    {
-    	$CNF = $this->_oConfig->CNF;
-
-    	$sLocation = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS'])->locationsString($aData[$CNF['FIELD_ID']]);
-
-    	return $this->parseHtmlByName('entry-info.html', array(
-    		'cameras' => '?',
-    		'location' => $sLocation,
-    		'released' => bx_time_js($aData['added']),
-	    	'updated' => bx_time_js($aData['changed']),
-    	));
-    }
-
     function entryAttachments ($aData)
     {
         $oModule = BxDolModule::getInstance($this->MODULE);

+ 6 - 6
modules/boonex/albums/install/langs/en.xml

@@ -32,8 +32,12 @@
 	<string name="_bx_albums_form_entry_input_pictures"><![CDATA[Pictures]]></string>
     <string name="_bx_albums_form_entry_input_sys_allow_view_to"><![CDATA[Visibility]]></string>
     <string name="_bx_albums_form_entry_input_allow_view_to"><![CDATA[Visibility]]></string>
-	<string name="_bx_albums_form_entry_file_title"><![CDATA[Caption]]></string>
-
+    <string name="_bx_albums_form_entry_file_title"><![CDATA[Caption]]></string>
+	<string name="_bx_albums_form_entry_input_sys_date_added"><![CDATA[Created]]></string>
+	<string name="_bx_albums_form_entry_input_date_added"><![CDATA[Created]]></string>
+	<string name="_bx_albums_form_entry_input_sys_date_changed"><![CDATA[Updated]]></string>
+    <string name="_bx_albums_form_entry_input_date_changed"><![CDATA[Updated]]></string>
+    
 	<string name="_bx_albums_acl_action_create_entry"><![CDATA[Create Album]]></string>
 	<string name="_bx_albums_acl_action_delete_entry"><![CDATA[Delete Album]]></string>
 	<string name="_bx_albums_acl_action_view_entry"><![CDATA[View Album]]></string>
@@ -168,10 +172,6 @@
     <string name="_bx_albums_txt_sample_single"><![CDATA[album]]></string>
     <string name="_bx_albums_txt_sample_comment_single"><![CDATA[album's comment]]></string>
     <string name="_bx_albums_txt_sample_vote_single"><![CDATA[album's vote]]></string>
-    <string name="_bx_albums_txt_cameras"><![CDATA[Cameras:]]></string>
-    <string name="_bx_albums_txt_location"><![CDATA[Location:]]></string>
-    <string name="_bx_albums_txt_released"><![CDATA[Released:]]></string>
-    <string name="_bx_albums_txt_updated"><![CDATA[Updated:]]></string>
     <string name="_bx_albums_txt_media_single"><![CDATA[image]]></string>
     <string name="_bx_albums_txt_media_comment_single"><![CDATA[image's comment]]></string>
 	<string name="_bx_albums_txt_media_title_alt"><![CDATA[{0}'s media]]></string>

+ 9 - 3
modules/boonex/albums/install/sql/install.sql

@@ -268,7 +268,11 @@ INSERT INTO `sys_form_inputs`(`object`, `module`, `name`, `value`, `values`, `ch
 ('bx_albums', 'bx_albums', 'text', '', '', 0, 'textarea', '_bx_albums_form_entry_input_sys_text', '_bx_albums_form_entry_input_text', '', 0, 0, 2, '', '', '', '', '', '', 'XssHtml', '', 1, 0),
 ('bx_albums', 'bx_albums', 'pictures', 'a:1:{i:0;s:15:"bx_albums_html5";}', 'a:2:{s:16:"bx_albums_simple";s:26:"_sys_uploader_simple_title";s:15:"bx_albums_html5";s:25:"_sys_uploader_html5_title";}', 0, 'files', '_bx_albums_form_entry_input_sys_pictures', '_bx_albums_form_entry_input_pictures', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
 ('bx_albums', 'bx_albums', 'allow_view_to', '', '', 0, 'custom', '_bx_albums_form_entry_input_sys_allow_view_to', '_bx_albums_form_entry_input_allow_view_to', '', 1, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
-('bx_albums', 'bx_albums', 'location', '', '', 0, 'custom', '_sys_form_input_sys_location', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0);
+('bx_albums', 'bx_albums', 'location', '', '', 0, 'custom', '_sys_form_input_sys_location', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
+
+('bx_albums', 'bx_albums', 'added', '', '', 0, 'datetime', '_bx_albums_form_entry_input_sys_date_added', '_bx_albums_form_entry_input_date_added', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
+('bx_albums', 'bx_albums', 'changed', '', '', 0, 'datetime', '_bx_albums_form_entry_input_sys_date_changed', '_bx_albums_form_entry_input_date_changed', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0);
+
 
 INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
 ('bx_albums_entry_add', 'delete_confirm', 2147483647, 0, 1),
@@ -298,9 +302,11 @@ INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_fo
 ('bx_albums_entry_view', 'delete_confirm', 2147483647, 0, 0),
 ('bx_albums_entry_view', 'allow_view_to', 2147483647, 0, 0),
 ('bx_albums_entry_view', 'do_submit', 2147483647, 0, 0),
-('bx_albums_entry_view', 'text', 2147483647, 1, 0),
-('bx_albums_entry_view', 'title', 2147483647, 1, 0),
+('bx_albums_entry_view', 'text', 2147483647, 0, 0),
+('bx_albums_entry_view', 'title', 2147483647, 0, 0),
 ('bx_albums_entry_view', 'pictures', 2147483647, 0, 0),
+('bx_albums_entry_view', 'added', 2147483647, 1, 1),
+('bx_albums_entry_view', 'changed', 2147483647, 1, 2),
 
 ('bx_albums_entry_delete', 'delete_confirm', 2147483647, 1, 1),
 ('bx_albums_entry_delete', 'do_submit', 2147483647, 1, 2),

+ 0 - 6
modules/boonex/albums/template/entry-info.html

@@ -1,6 +0,0 @@
-<div class="bx-albums-entity-info">
-	<p><span class="bx-def-font-grayed"><bx_text:_bx_albums_txt_cameras /></span> __cameras__</p>
-	<p><span class="bx-def-font-grayed"><bx_text:_bx_albums_txt_location /></span> __location__</p>
-    <p><span class="bx-def-font-grayed"><bx_text:_bx_albums_txt_released /></span> __released__</p>
-    <p><span class="bx-def-font-grayed"><bx_text:_bx_albums_txt_updated /></span> __updated__</p>
-</div>

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

@@ -2144,7 +2144,7 @@ If it is not enabled then please consider implement this optimization, since it
 	<string name="_sys_txt_account_profile_system"><![CDATA[You have no profiles created, so you can't perform any actions on the site, please <a href="{0}">create  profile</a>.]]></string>
 	<string name="_sys_txt_captcha_not_available"><![CDATA[CAPTCHA not available]]></string>
     <string name="_sys_txt_change_image"><![CDATA[Change Picture]]></string>
-	<string name="_sys_txt_cmt_loading"><![CDATA[Loading...]]></string>
+    <string name="_sys_txt_cmt_loading"><![CDATA[Loading...]]></string>
 	<string name="_sys_txt_confirm_email_already_confirmed"><![CDATA[Your email address is already confirmed.]]></string>
 	<string name="_sys_txt_confirm_email_desc"><![CDATA[Please enter confirmation code which was sent to your email address, or just click confirmation link in the same email message.]]></string>
 	<string name="_sys_txt_confirm_email_error_occured"><![CDATA[Error occurred, please try to login to your account and resend verification email.]]></string>
@@ -2160,19 +2160,19 @@ If it is not enabled then please consider implement this optimization, since it
 	<string name="_sys_txt_error_account_delete"><![CDATA[Account delete failed]]></string>
 	<string name="_sys_txt_error_account_is_not_defined"><![CDATA[Account is not defined]]></string>
 	<string name="_sys_txt_error_account_update"><![CDATA[Account update failed]]></string>
-
 	<string name="_sys_txt_error_entry_creation"><![CDATA[Entry creation error]]></string>
 	<string name="_sys_txt_error_entry_delete"><![CDATA[Entry delete failed]]></string>
 	<string name="_sys_txt_error_entry_is_not_defined"><![CDATA[Requested resource doesn't exist]]></string>
 	<string name="_sys_txt_error_entry_update"><![CDATA[Entry update failed]]></string>
-	<string name="_sys_txt_error_occured"><![CDATA[Error Occurred]]></string>
-
+    <string name="_sys_txt_error_occured"><![CDATA[Error Occurred]]></string>
+    <string name="_sys_txt_field_created"><![CDATA[Created:]]></string>
+    <string name="_sys_txt_field_updated"><![CDATA[Updated:]]></string>
 	<string name="_sys_txt_forgot_pasword"><![CDATA[Forgot password?]]></string>
 	<string name="_sys_txt_forgot_pasword_check_email"><![CDATA[Email was sent, please follow instructions in the email message.]]></string>
 	<string name="_sys_txt_forgot_pasword_desc"><![CDATA[Enter your account email address to get a password-reset link.]]></string>
 	<string name="_sys_txt_forgot_pasword_email_send_failed"><![CDATA[Email send failed, please try again later.]]></string>
-	<string name="_sys_txt_forgot_pasword_error_occured"><![CDATA[Error occurred, please report error to the site administrator.]]></string>
-
+    <string name="_sys_txt_forgot_pasword_error_occured"><![CDATA[Error occurred, please report error to the site administrator.]]></string>
+    
     <string name="_sys_txt_form_entry_input_picture_delete"><![CDATA[Delete]]></string>
     <string name="_sys_txt_form_entry_input_picture_insert"><![CDATA[Insert to Post]]></string>
 	<string name="_sys_txt_form_entry_input_picture_pic_url"><![CDATA[Attachment URL:]]></string>
@@ -2203,7 +2203,7 @@ If it is not enabled then please consider implement this optimization, since it
 	<string name="_sys_txt_unsubscribe_email_settings_update_success"><![CDATA[Your email preferences has been successfully updated.]]></string>
 	<string name="_sys_txt_unsubscribe_error_occured"><![CDATA[Error occurred, please login to your account and update email references there or contact site administrator to unsubscribe you manually.]]></string>
 	<string name="_sys_txt_unsubscribe_info"><![CDATA[Update email preferences for <b>{0}</b>]]></string>
-	<string name="_sys_txt_unsubscribe_wrong_link"><![CDATA[Unsubscribe link is wrong.]]></string>
+    <string name="_sys_txt_unsubscribe_wrong_link"><![CDATA[Unsubscribe link is wrong.]]></string>
 	<string name="_sys_upgrade_conclusion"><![CDATA[<h3>Important info:</h3><p>{0}</p>]]></string>
 	<string name="_sys_upgrade_db_and_files_versions_different"><![CDATA[Database and files versions are different, probably previous patch wasn't applied correctly.]]></string>
 	<string name="_sys_upgrade_files_checksum_failed"><![CDATA[Can't apply upgrade because the following files were modified: {0}]]></string>

+ 5 - 5
modules/boonex/russian/data/langs/bx_albums/ru.xml

@@ -32,7 +32,11 @@
 	<string name="_bx_albums_form_entry_input_pictures"><![CDATA[Картинки]]></string>
     <string name="_bx_albums_form_entry_input_sys_allow_view_to"><![CDATA[Видимость]]></string>
     <string name="_bx_albums_form_entry_input_allow_view_to"><![CDATA[Видимость]]></string>
-	<string name="_bx_albums_form_entry_file_title"><![CDATA[Заголовок]]></string>
+    <string name="_bx_albums_form_entry_file_title"><![CDATA[Заголовок]]></string>
+	<string name="_bx_albums_form_entry_input_sys_date_added"><![CDATA[Создано]]></string>
+	<string name="_bx_albums_form_entry_input_date_added"><![CDATA[Создано]]></string>
+	<string name="_bx_albums_form_entry_input_sys_date_changed"><![CDATA[Обновлено]]></string>
+	<string name="_bx_albums_form_entry_input_date_changed"><![CDATA[Обновлено]]></string>
 
 	<string name="_bx_albums_acl_action_create_entry"><![CDATA[Создать альбом]]></string>
 	<string name="_bx_albums_acl_action_delete_entry"><![CDATA[Удалить альбом]]></string>
@@ -168,10 +172,6 @@
     <string name="_bx_albums_txt_sample_single"><![CDATA[альбом]]></string>
     <string name="_bx_albums_txt_sample_comment_single"><![CDATA[комментарий к альбому]]></string>
     <string name="_bx_albums_txt_sample_vote_single"><![CDATA[голос за альбом]]></string>
-    <string name="_bx_albums_txt_cameras"><![CDATA[Камера:]]></string>
-    <string name="_bx_albums_txt_location"><![CDATA[Место:]]></string>
-    <string name="_bx_albums_txt_released"><![CDATA[Дата выпуска:]]></string>
-    <string name="_bx_albums_txt_updated"><![CDATA[Дата обновления:]]></string>
     <string name="_bx_albums_txt_media_single"><![CDATA[изображение]]></string>
     <string name="_bx_albums_txt_media_comment_single"><![CDATA[комментарий к изображению]]></string>
 	<string name="_bx_albums_txt_media_title_alt"><![CDATA[медиа-файлы автора {0}]]></string>

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

@@ -2145,7 +2145,7 @@
 	<string name="_sys_txt_account_profile_system"><![CDATA[У Вас нет созданных профилей, поэтому Вы не можете пользоваться сайтом, пожалуйста, <a href="{0}">создайте профиль</a>.]]></string>
 	<string name="_sys_txt_captcha_not_available"><![CDATA[CAPTCHA недоступна]]></string>
     <string name="_sys_txt_change_image"><![CDATA[Изменить Картинку]]></string>
-	<string name="_sys_txt_cmt_loading"><![CDATA[Загрузка...]]></string>
+    <string name="_sys_txt_cmt_loading"><![CDATA[Загрузка...]]></string>
 	<string name="_sys_txt_confirm_email_already_confirmed"><![CDATA[Ваш имейл уже подтверждён.]]></string>
 	<string name="_sys_txt_confirm_email_desc"><![CDATA[Пожалуйста, введите код подтверждения, который был послан на Ваш эл. адрес, или просто перейдите по ссылке в присланном сообщении.]]></string>
 	<string name="_sys_txt_confirm_email_error_occured"><![CDATA[Произошла ошибка, пожалуйста, войдите в свой аккаунт и снова запросите письмо верификации.]]></string>
@@ -2167,7 +2167,6 @@
 	<string name="_sys_txt_error_entry_is_not_defined"><![CDATA[Запрашиваемый ресурс не существует]]></string>
 	<string name="_sys_txt_error_entry_update"><![CDATA[Ошибка обновления Ввода]]></string>
 	<string name="_sys_txt_error_occured"><![CDATA[Произошла Ошибка]]></string>
-
 	<string name="_sys_txt_forgot_pasword"><![CDATA[Забыли пароль?]]></string>
 	<string name="_sys_txt_forgot_pasword_check_email"><![CDATA[Имейл отослан, подалуйста, следуйте инструкциям в нём.]]></string>
 	<string name="_sys_txt_forgot_pasword_desc"><![CDATA[Введите эл. адрес своего аккаунта, чтобы запросить ссылку на изменение пароля.]]></string>
@@ -2204,7 +2203,7 @@
 	<string name="_sys_txt_unsubscribe_email_settings_update_success"><![CDATA[Ваши имейл-установки были удачно обновлены.]]></string>
 	<string name="_sys_txt_unsubscribe_error_occured"><![CDATA[Произошла ошибка, Пожалуйста, зайдите в свой аккаунт и обновите имейл-установки там или свяжитесь с администратором сайта, чтобы он Вас отписал вручную.]]></string>
 	<string name="_sys_txt_unsubscribe_info"><![CDATA[Обновить имейл-установки для <b>{0}</b>]]></string>
-	<string name="_sys_txt_unsubscribe_wrong_link"><![CDATA[Ссылка отписки неправильная.]]></string>
+    <string name="_sys_txt_unsubscribe_wrong_link"><![CDATA[Ссылка отписки неправильная.]]></string>
 	<string name="_sys_upgrade_conclusion"><![CDATA[<h3>Важная информация:</h3><p>{0}</p>]]></string>
 	<string name="_sys_upgrade_db_and_files_versions_different"><![CDATA[База Данных и версии файлов отличаются, возможно, предыдущий патч не был правильно применён.]]></string>
 	<string name="_sys_upgrade_files_checksum_failed"><![CDATA[Невозможно применить обновление, так как следующие файлы были изменены: {0}]]></string>

+ 4 - 4
template/scripts/BxBaseFormView.php

@@ -310,13 +310,13 @@ EOS;
             break;
 
             case 'datepicker':
-                $iTime = bx_process_input ($aInput['value'], BX_DATA_DATE_TS, false, false);
-                $sValue = bx_time_js ($iTime, BX_FORMAT_DATE);
+                $iTime = bx_process_input ($aInput['value'], isset($aInput['date_filter']) ? $aInput['date_filter'] : BX_DATA_DATE_TS, false, false);
+                $sValue = bx_time_js ($iTime, isset($aInput['date_format']) ? $aInput['date_format'] : BX_FORMAT_DATE);
             break;
             case 'date_time':
             case 'datetime':
-                $iTime = bx_process_input ($aInput['value'], BX_DATA_DATETIME_TS, false, false);
-                $sValue = bx_time_js ($iTime, BX_FORMAT_DATE_TIME);
+                $iTime = bx_process_input ($aInput['value'], isset($aInput['date_filter']) ? $aInput['date_filter'] : BX_DATA_DATETIME_TS, false, false);
+                $sValue = bx_time_js ($iTime, isset($aInput['date_format']) ? $aInput['date_format'] : BX_FORMAT_DATE_TIME);
             break;
 
             case 'checkbox_set':