Selaa lähdekoodia

#782 Persons: 'gender' and 'birthday' fields

Alex Trofimov 9 vuotta sitten
vanhempi
sitoutus
6ad64de2bc

+ 2 - 2
inc/js/jquery.webForms.js

@@ -205,9 +205,9 @@
                 var m;
 
                 if ($(this).attr('min') && (m = $(this).attr('min').match(/^(\d{4})/)))
-                    sYearMin = m[1];
+                    iYearMin = m[1];
                 if ($(this).attr('max') && (m = $(this).attr('max').match(/^(\d{4})/)))
-                    sYearMax = m[1];
+                    iYearMax = m[1];
 
                 var onBeforeShow = function(oInput, oInstance) {
                 	$(oInstance.dpDiv).addClass('bx-form-datepicker-modal');

+ 3 - 2
install/sql/system.sql

@@ -3117,8 +3117,9 @@ INSERT INTO `sys_form_pre_values`(`Key`, `Value`, `Order`, `LKey`, `LKey2`) VALU
 ('Country', 'ZW', 246, '__Zimbabwe', '');
 
 INSERT INTO `sys_form_pre_values`(`Key`, `Value`, `Order`, `LKey`, `LKey2`) VALUES
-('Sex', '1', 0, '_Male', '_LookinMale'),
-('Sex', '2', 1, '_Female', '_LookinFemale');
+('Sex', '', 1, '_sys_not_specified', ''),
+('Sex', '1', 2, '_Male', '_LookinMale'),
+('Sex', '2', 3, '_Female', '_LookinFemale');
 
 INSERT INTO `sys_form_pre_values`(`Key`, `Value`, `Order`, `LKey`, `LKey2`) VALUES 
 ('Language', '1', 1, '__English', ''),

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

@@ -2165,6 +2165,7 @@ If it is not enabled then please consider implement this optimization, since it
     <string name="_sys_next"><![CDATA[Next]]></string>
     <string name="_sys_notification_account"><![CDATA[<h3>Accounts created in the last 24 hours:</h3><ul>{0}</ul>]]></string>
 	<string name="_sys_notification_account_link"><![CDATA[<li><a href="{0}">{1}</a> ({2})</li>]]></string>
+    <string name="_sys_not_specified"><![CDATA[Not Specified]]></string>
     <string name="_sys_on"><![CDATA[on]]></string>
     <string name="_sys_off"><![CDATA[off]]></string>
 	<string name="_sys_page_block_title_about"><![CDATA[About]]></string>

+ 4 - 0
modules/boonex/persons/classes/BxPersonsFormEntry.php

@@ -18,6 +18,10 @@ class BxPersonsFormEntry extends BxBaseModProfileFormEntry
     {
         $this->MODULE = 'bx_persons';
         parent::__construct($aInfo, $oTemplate);
+
+        if (isset($this->aInputs['birthday']))
+            $this->aInputs['birthday']['attrs']['max'] = date('Y');
+        
     }
 }
 

+ 4 - 0
modules/boonex/persons/install/langs/en.xml

@@ -43,6 +43,10 @@
 	<string name="_bx_persons_form_profile_input_delete_confirm"><![CDATA[I am sure I want to delete this profile]]></string>
 	<string name="_bx_persons_form_profile_input_delete_confirm_info"><![CDATA[This action can not be undone.]]></string>
 	<string name="_bx_persons_form_profile_input_delete_confirm_error"><![CDATA[Please check this checkbox if you really want to delete your profile.]]></string>
+    <string name="_bx_persons_form_profile_input_sys_birthday"><![CDATA[Birthday]]></string>
+    <string name="_bx_persons_form_profile_input_birthday"><![CDATA[Birthday]]></string>
+    <string name="_bx_persons_form_profile_input_sys_gender"><![CDATA[Gender]]></string>
+    <string name="_bx_persons_form_profile_input_gender"><![CDATA[Gender]]></string>
 
 	<string name="_bx_persons_acl_action_create_profile"><![CDATA[Create Person's Profile]]></string>
 	<string name="_bx_persons_acl_action_delete_profile"><![CDATA[Delete Person's Profile]]></string>

+ 25 - 19
modules/boonex/persons/install/sql/install.sql

@@ -174,16 +174,20 @@ INSERT INTO `sys_form_inputs`(`object`, `module`, `name`, `value`, `values`, `ch
 ('bx_person', 'bx_persons', 'fullname', '', '', 0, 'text', '_bx_persons_form_profile_input_sys_fullname', '_bx_persons_form_profile_input_fullname', '', 1, 0, 0, '', '', '', 'Avail', '', '_bx_persons_form_profile_input_fullname_err', 'Xss', '', 1, 0),
 ('bx_person', 'bx_persons', 'cover', 'a:1:{i:0;s:21:"bx_persons_cover_crop";}', 'a:1:{s:21:"bx_persons_cover_crop";s:24:"_sys_uploader_crop_title";}', 0, 'files', '_bx_persons_form_profile_input_sys_cover', '_bx_persons_form_profile_input_cover', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
 ('bx_person', 'bx_persons', 'picture', 'a:1:{i:0;s:23:"bx_persons_picture_crop";}', 'a:1:{s:23:"bx_persons_picture_crop";s:24:"_sys_uploader_crop_title";}', 0, 'files', '_bx_persons_form_profile_input_sys_picture', '_bx_persons_form_profile_input_picture', '', 0, 0, 0, '', '', '', '', '', '_bx_persons_form_profile_input_picture_err', '', '', 1, 0),
-('bx_person', 'bx_persons', 'location', '', '', 0, 'location', '_sys_form_input_sys_location', '_sys_form_input_location', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0);
+('bx_person', 'bx_persons', 'location', '', '', 0, 'location', '_sys_form_input_sys_location', '_sys_form_input_location', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
+('bx_person', 'bx_persons', 'birthday', 0, '', 0, 'datepicker', '_bx_persons_form_profile_input_sys_birthday', '_bx_persons_form_profile_input_birthday', '', 0, 0, 0, 0, '', '', '', '', '', '', 'Date', '', 1, 0),
+('bx_person', 'bx_persons', 'gender', '', '#!Sex', 0, 'select', '_bx_persons_form_profile_input_sys_gender', '_bx_persons_form_profile_input_gender', '', 0, 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 1, 0);
 
 
 INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES 
 ('bx_person_add', 'picture', 2147483647, 1, 1),
-('bx_person_add', 'fullname', 2147483647, 1, 2),
-('bx_person_add', 'description', 2147483647, 1, 3),
-('bx_person_add', 'location', 2147483647, 1, 4),
-('bx_person_add', 'allow_view_to', 2147483647, 1, 5),
-('bx_person_add', 'do_submit', 2147483647, 1, 6),
+('bx_person_add', 'gender', 2147483647, 1, 2),
+('bx_person_add', 'birthday', 2147483647, 1, 3),
+('bx_person_add', 'fullname', 2147483647, 1, 4),
+('bx_person_add', 'description', 2147483647, 1, 5),
+('bx_person_add', 'location', 2147483647, 1, 6),
+('bx_person_add', 'allow_view_to', 2147483647, 1, 7),
+('bx_person_add', 'do_submit', 2147483647, 1, 8),
 
 ('bx_person_delete', 'cover', 2147483647, 0, 0),
 ('bx_person_delete', 'picture', 2147483647, 0, 0),
@@ -192,11 +196,13 @@ INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for
 ('bx_person_delete', 'fullname', 2147483647, 0, 2),
 
 ('bx_person_edit', 'picture', 2147483647, 1, 1),
-('bx_person_edit', 'fullname', 2147483647, 1, 2),
-('bx_person_edit', 'description', 2147483647, 1, 3),
-('bx_person_edit', 'location', 2147483647, 1, 4),
-('bx_person_edit', 'allow_view_to', 2147483647, 1, 5),
-('bx_person_edit', 'do_submit', 2147483647, 1, 6),
+('bx_person_edit', 'gender', 2147483647, 1, 2),
+('bx_person_edit', 'birthday', 2147483647, 1, 3),
+('bx_person_edit', 'fullname', 2147483647, 1, 4),
+('bx_person_edit', 'description', 2147483647, 1, 5),
+('bx_person_edit', 'location', 2147483647, 1, 6),
+('bx_person_edit', 'allow_view_to', 2147483647, 1, 7),
+('bx_person_edit', 'do_submit', 2147483647, 1, 8),
 
 ('bx_person_edit_cover', 'delete_confirm', 2147483647, 0, 1),
 ('bx_person_edit_cover', 'fullname', 2147483647, 0, 2),
@@ -204,15 +210,15 @@ INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for
 ('bx_person_edit_cover', 'cover', 2147483647, 1, 7),
 ('bx_person_edit_cover', 'do_submit', 2147483647, 1, 8),
 
-('bx_person_view', 'delete_confirm', 2147483647, 0, 3),
-('bx_person_view', 'picture', 2147483647, 0, 4),
-('bx_person_view', 'cover', 2147483647, 0, 5),
-('bx_person_view', 'do_submit', 2147483647, 0, 6),
-('bx_person_view', 'fullname', 2147483647, 1, 7),
-('bx_person_view', 'description', 2147483647, 0, 8),
+('bx_person_view', 'gender', 2147483647, 1, 1),
+('bx_person_view', 'birthday', 2147483647, 1, 2),
+('bx_person_view', 'fullname', 2147483647, 1, 3),
+('bx_person_view', 'description', 2147483647, 0, 4),
 
-('bx_person_view_full', 'fullname', 2147483647, 1, 1),
-('bx_person_view_full', 'description', 2147483647, 1, 2);
+('bx_person_view_full', 'gender', 2147483647, 1, 1),
+('bx_person_view_full', 'birthday', 2147483647, 1, 2),
+('bx_person_view_full', 'fullname', 2147483647, 1, 3),
+('bx_person_view_full', 'description', 2147483647, 1, 4);
 
 -- CONTENT INFO
 INSERT INTO `sys_objects_content_info` (`name`, `title`, `alert_unit`, `alert_action_add`, `alert_action_update`, `alert_action_delete`, `class_name`, `class_file`) VALUES

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

@@ -42,7 +42,11 @@
 	<string name="_bx_persons_form_profile_input_sys_delete_confirm"><![CDATA[Удалить подтверждение]]></string>
 	<string name="_bx_persons_form_profile_input_delete_confirm"><![CDATA[Я уверен, что хочу удалить этот профиль]]></string>
 	<string name="_bx_persons_form_profile_input_delete_confirm_info"><![CDATA[Это действие не может быть отменено.]]></string>
-	<string name="_bx_persons_form_profile_input_delete_confirm_error"><![CDATA[Пожалуйста, отметьте этот флажок, если действительно хотите удалить свой профиль.]]></string>
+    <string name="_bx_persons_form_profile_input_delete_confirm_error"><![CDATA[Пожалуйста, отметьте этот флажок, если действительно хотите удалить свой профиль.]]></string>
+    <string name="_bx_persons_form_profile_input_sys_birthday"><![CDATA[День рождения]]></string>
+    <string name="_bx_persons_form_profile_input_birthday"><![CDATA[День рождения]]></string>
+    <string name="_bx_persons_form_profile_input_sys_gender"><![CDATA[Пол]]></string>
+    <string name="_bx_persons_form_profile_input_gender"><![CDATA[Пол]]></string>
 
 	<string name="_bx_persons_acl_action_create_profile"><![CDATA[Создать персональный профиль]]></string>
 	<string name="_bx_persons_acl_action_delete_profile"><![CDATA[Удалить персональный профиль]]></string>

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

@@ -2162,7 +2162,8 @@
     <string name="_sys_name"><![CDATA[Имя]]></string>
     <string name="_sys_next"><![CDATA[Ещё]]></string>
     <string name="_sys_notification_account"><![CDATA[<h3>Аккаунты, созданные за последние 24 часа:</h3><ul>{0}</ul>]]></string>
-	<string name="_sys_notification_account_link"><![CDATA[<li><a href="{0}">{1}</a> ({2})</li>]]></string>
+    <string name="_sys_notification_account_link"><![CDATA[<li><a href="{0}">{1}</a> ({2})</li>]]></string>
+    <string name="_sys_not_specified"><![CDATA[Не указано]]></string>
     <string name="_sys_on"><![CDATA[вкл.]]></string>
     <string name="_sys_off"><![CDATA[выкл.]]></string>
 	<string name="_sys_page_block_title_about"><![CDATA[Об...]]></string>