Sfoglia il codice sorgente

Add tab sort option for top or bottom

causefx 7 anni fa
parent
commit
3d0c5dcf8f

+ 2 - 1
api/config/default.php

@@ -176,5 +176,6 @@ return array(
 	'authDebug' => false,
 	'customJava' => '',
 	'customThemeJava' => '',
-	'minimalLoginScreen' => false
+	'minimalLoginScreen' => false,
+	'unsortedTabs' => 'top'
 );

+ 2 - 1
api/functions/api-functions.php

@@ -983,7 +983,8 @@ function loadTabs()
 				'driver' => 'sqlite3',
 				'database' => $GLOBALS['dbLocation'] . $GLOBALS['dbName'],
 			]);
-			$tabs = $connect->fetchAll('SELECT * FROM tabs WHERE `group_id` >= ? AND `enabled` = 1 ORDER BY `order` DESC', $GLOBALS['organizrUser']['groupID']);
+			$sort = ($GLOBALS['unsortedTabs'] == 'top') ? 'DESC' : 'ASC';
+			$tabs = $connect->fetchAll('SELECT * FROM tabs WHERE `group_id` >= ? AND `enabled` = 1 ORDER BY `order` ' . $sort, $GLOBALS['organizrUser']['groupID']);
 			$categories = $connect->fetchAll('SELECT * FROM categories ORDER BY `order` ASC');
 			$all['tabs'] = $tabs;
 			foreach ($tabs as $k => $v) {

+ 1 - 0
api/functions/normal-functions.php

@@ -34,6 +34,7 @@ function parseDomain($value, $force = false)
 	$Port = strpos($Domain, ':');
 	if ($Port !== false) {
 		$Domain = substr($Domain, 0, $Port);
+		$value = $Domain;
 	}
 	$check = substr_count($Domain, '.');
 	if ($check >= 3) {

+ 18 - 1
api/functions/organizr-functions.php

@@ -68,7 +68,8 @@ function organizrSpecialSettings()
 			'installedThemes' => $GLOBALS['installedThemes'],
 			'return' => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : false,
 			'authDebug' => $GLOBALS['authDebug'],
-			'minimalLoginScreen' => $GLOBALS['minimalLoginScreen']
+			'minimalLoginScreen' => $GLOBALS['minimalLoginScreen'],
+			'unsortedTabs' => $GLOBALS['unsortedTabs']
 		)
 	);
 }
@@ -801,6 +802,22 @@ function getCustomizeAppearance()
 					'name' => 'alternateHomepageHeaders',
 					'label' => 'Alternate Homepage Titles',
 					'value' => $GLOBALS['alternateHomepageHeaders']
+				),
+				array(
+					'type' => 'select',
+					'name' => 'unsortedTabs',
+					'label' => 'Unsorted Tab Placement',
+					'value' => $GLOBALS['unsortedTabs'],
+					'options' => array(
+						array(
+							'name' => 'Top',
+							'value' => 'top'
+						),
+						array(
+							'name' => 'Bottom',
+							'value' => 'bottom'
+						)
+					)
 				)
 			),
 			'Colors & Themes' => array(

+ 1 - 0
api/functions/sso-functions.php

@@ -40,6 +40,7 @@ function getOmbiToken($username, $password)
 		$response = Requests::post($url, $headers, json_encode($data), $options);
 		if ($response->success) {
 			$token = json_decode($response->body, true)['access_token'];
+			writeLog('success', 'Ombi Token Function - Grabbed token.', $username);
 		}
 		return ($token) ? $token : false;
 	} catch (Requests_Exception $e) {

+ 5 - 1
js/functions.js

@@ -1744,7 +1744,11 @@ function tabProcess(arrayItems) {
 				}
 				menuList = buildMenuList(v.name,v.url,v.type,v.image,v.ping_url);
 				if(v.category_id === 0){
-					$(menuList).prependTo($('#side-menu'));
+                    if(activeInfo.settings.misc.unsortedTabs === 'top'){
+                        $(menuList).prependTo($('#side-menu'));
+                    }else if(activeInfo.settings.misc.unsortedTabs === 'bottom') {
+                        $(menuList).appendTo($('#side-menu'));
+                    }
 				}else{
 					$(menuList).prependTo($('.category-'+v.category_id));
 				}