Browse Source

Added hide registration switch - #864
Edited numbers input fields
Added alert if user didnt save settings

causefx 8 years ago
parent
commit
89831d5035

+ 2 - 1
api/config/default.php

@@ -143,5 +143,6 @@ return array(
 	'mediaSearch' => false,
 	'mediaSearchType' => '',
 	'mediaSearchAuth' => '1',
-	'registrationPassword' => ''
+	'registrationPassword' => '',
+	'hideRegistration' => false
 );

+ 6 - 8
api/functions/homepage-functions.php

@@ -520,8 +520,7 @@ function getHomepageList()
 						'options' => $groups
 					),
 					array(
-						'type' => 'text',
-						'attr' => 'onkeypress="return isNumberKey(event)"',
+						'type' => 'number',
 						'name' => 'homepageRecentLimit',
 						'label' => 'Item Limit',
 						'value' => $GLOBALS['homepageRecentLimit'],
@@ -689,8 +688,7 @@ function getHomepageList()
 						'options' => $groups
 					),
 					array(
-						'type' => 'text',
-						'attr' => 'onkeypress="return isNumberKey(event)"',
+						'type' => 'number',
 						'name' => 'homepageRecentLimit',
 						'label' => 'Item Limit',
 						'value' => $GLOBALS['homepageRecentLimit'],
@@ -1119,14 +1117,14 @@ function getHomepageList()
 				),
 				'Misc Options' => array(
 					array(
-						'type' => 'input',
+						'type' => 'number',
 						'name' => 'calendarStart',
 						'label' => '# of Days Before',
 						'value' => $GLOBALS['calendarStart'],
 						'placeholder' => ''
 					),
 					array(
-						'type' => 'input',
+						'type' => 'number',
 						'name' => 'calendarEnd',
 						'label' => '# of Days After',
 						'value' => $GLOBALS['calendarEnd'],
@@ -1228,14 +1226,14 @@ function getHomepageList()
 				),
 				'Misc Options' => array(
 					array(
-						'type' => 'input',
+						'type' => 'number',
 						'name' => 'calendarStart',
 						'label' => '# of Days Before',
 						'value' => $GLOBALS['calendarStart'],
 						'placeholder' => ''
 					),
 					array(
-						'type' => 'input',
+						'type' => 'number',
 						'name' => 'calendarEnd',
 						'label' => '# of Days After',
 						'value' => $GLOBALS['calendarEnd'],

+ 13 - 0
api/functions/organizr-functions.php

@@ -414,6 +414,12 @@ function getSettingsMain()
 				'label' => 'Registration Password',
 				'value' => $GLOBALS['registrationPassword'],
 			),
+			array(
+				'type' => 'switch',
+				'name' => 'hideRegistration',
+				'label' => 'Hide Registration',
+				'value' => $GLOBALS['hideRegistration']
+			)
 		)
 	);
 }
@@ -885,6 +891,13 @@ function logoOrText()
 	}
 }
 
+function showLogin()
+{
+	if ($GLOBALS['hideRegistration'] == false) {
+		return '<p><span lang="en">Don\'t have an account?</span><a href="#" class="text-primary m-l-5 to-register"><b lang="en">Sign Up</b></a></p>';
+	}
+}
+
 function getImages()
 {
 	$dirname = dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'tabs' . DIRECTORY_SEPARATOR;

+ 2 - 3
api/pages/login.php

@@ -1,5 +1,4 @@
 <?php
-
 $pageLogin = '
 <script>
 </script>
@@ -7,7 +6,7 @@ $pageLogin = '
   <div class="login-box login-sidebar animated slideInRight">
     <div class="white-box">
       <form class="form-horizontal form-material" id="loginform" onsubmit="return false;">
-        <a href="javascript:void(0)" class="text-center db visible-xs" id="login-logo">'.logoOrText().'</a>
+        <a href="javascript:void(0)" class="text-center db visible-xs" id="login-logo">' . logoOrText() . '</a>
 
         <div class="form-group m-t-40">
           <div class="col-xs-12">
@@ -35,7 +34,7 @@ $pageLogin = '
 
         <div class="form-group m-b-0">
           <div class="col-sm-12 text-center">
-            <p><span lang="en">Don\'t have an account?</span><a href="#" class="text-primary m-l-5 to-register"><b lang="en">Sign Up</b></a></p>
+            ' . showLogin() . '
           </div>
         </div>
       </form>

+ 8 - 1
js/custom.js

@@ -209,7 +209,14 @@ function pageLoad(){
                     this.st.focus = '#name';
                 }
                 this.st.mainClass = this.st.el.attr('data-effect');
-            }
+            },
+            beforeClose: function() {
+                // Callback available since v0.9.0
+                if(!$.magnificPopup.instance.currItem.inlineElement.find('.rubberBand').hasClass('hidden')){
+                    var magIndex = $.magnificPopup.instance.currItem.index;
+                    message('You forgot to save','<a class="mouse" onclick="$(\'.popup-with-form\').magnificPopup(\'open\','+magIndex+')">Would you like to go back?</a>','bottom-right','#FFF','warning','5000');
+                }
+            },
         }
     });
     // Inline popups