Răsfoiți Sursa

Added Custom HTML 1 and 2

causefx 8 ani în urmă
părinte
comite
e675f9438c

+ 8 - 1
api/config/default.php

@@ -61,6 +61,10 @@ return array(
     'qBittorrentHideCompleted' => false,
     'qBittorrentSortOrder' => 'eta',
     'qBittorrentReverseSorting' => false,
+    'homepagCustomHTMLoneEnabled' => false,
+    'homepagCustomHTMLoneAuth' => '1',
+    'homepagCustomHTMLtwoEnabled' => false,
+    'homepagCustomHTMLtwoAuth' => '1',
     'homepageDelugeEnabled' => false,
     'homepageDelugeAuth' => '1',
     'homepageSabnzbdEnabled' => false,
@@ -100,6 +104,7 @@ return array(
     'homepageOrdertransmission' => '15',
     'homepageOrderqBittorrent' => '16',
     'homepageOrderdeluge' => '17',
+	'homepageOrdercustomhtmlTwo' => '18',
     'homepageShowStreamNames' => false,
     'homepageShowStreamNamesAuth' => '1',
     'homepageStreamRefresh' => '60000',
@@ -120,5 +125,7 @@ return array(
     'calendarRefresh' => '60000',
     'calendarTimeFormat' => 'h(:mm)t',
     'calendarLimit' => '1000',
-	'customCss' => ''
+	'customCss' => '',
+    'customHTMLone' => '',
+    'customHTMLtwo' => ''
 );

+ 85 - 1
api/functions/homepage-functions.php

@@ -3,6 +3,7 @@
 function homepageOrder(){
 	$homepageOrder = array(
 		"homepageOrdercustomhtml" => $GLOBALS['homepageOrdercustomhtml'],
+		"homepageOrdercustomhtmlTwo" => $GLOBALS['homepageOrdercustomhtmlTwo'],
 		"homepageOrdernotice" => $GLOBALS['homepageOrdernotice'],
 		"homepageOrderplexsearch" => $GLOBALS['homepageOrderplexsearch'],
 		"homepageOrderspeedtest" => $GLOBALS['homepageOrderspeedtest'],
@@ -38,7 +39,14 @@ function buildHomepageItem($homepageItem){
 
 			break;
 		case 'homepageOrdercustomhtml':
-
+			if($GLOBALS['homepagCustomHTMLoneEnabled'] && qualifyRequest($GLOBALS['homepagCustomHTMLoneAuth']) ){
+				$item .= ($GLOBALS['customHTMLone'] !== '') ? $GLOBALS['customHTMLone'] : '';
+			}
+			break;
+		case 'homepageOrdercustomhtmlTwo':
+		if($GLOBALS['homepagCustomHTMLtwoEnabled'] && qualifyRequest($GLOBALS['homepagCustomHTMLtwoAuth']) ){
+			$item .= ($GLOBALS['customHTMLtwo'] !== '') ? $GLOBALS['customHTMLtwo'] : '';
+		}
 			break;
 		case 'homepageOrdernotice':
 
@@ -1250,6 +1258,82 @@ function getHomepageList(){
                     )
                 )
             )
+        ),
+		array(
+            'name' => 'CustomHTML-1',
+            'enabled' => false,
+            'image' => 'plugins/images/tabs/custom1.png',
+            'category' => 'Custom',
+            'settings' => array(
+                'Enable' => array(
+                    array(
+                        'type' => 'switch',
+                        'name' => 'homepagCustomHTMLoneEnabled',
+                        'label' => 'Enable',
+                        'value' => $GLOBALS['homepagCustomHTMLoneEnabled']
+                    ),
+                    array(
+                        'type' => 'select',
+                        'name' => 'homepagCustomHTMLoneAuth',
+                        'label' => 'Minimum Authentication',
+                        'value' => $GLOBALS['homepagCustomHTMLoneAuth'],
+                        'options' => $groups
+                    )
+                ),
+                'Code' => array(
+					array(
+	                    'type' => 'textbox',
+	                    'name' => 'customHTMLone',
+	                    'class' => 'hidden customHTMLoneTextarea',
+	                    'label' => '',
+	                    'value' => $GLOBALS['customHTMLone'],
+	                ),
+	                array(
+	        			'type' => 'html',
+	                    'override' => 12,
+	        			'label' => 'Custom HTML/JavaScript',
+	        			'html' => '<button type="button" class="hidden savecustomHTMLoneTextarea btn btn-info btn-circle pull-right m-r-5 m-l-10"><i class="fa fa-save"></i> </button><div id="customHTMLoneEditor" style="height:300px">'.htmlentities($GLOBALS['customHTMLone']).'</div>'
+	        		),
+                )
+            )
+        ),
+		array(
+            'name' => 'CustomHTML-2',
+            'enabled' => false,
+            'image' => 'plugins/images/tabs/custom2.png',
+            'category' => 'Custom',
+            'settings' => array(
+                'Enable' => array(
+                    array(
+                        'type' => 'switch',
+                        'name' => 'homepagCustomHTMLtwoEnabled',
+                        'label' => 'Enable',
+                        'value' => $GLOBALS['homepagCustomHTMLtwoEnabled']
+                    ),
+                    array(
+                        'type' => 'select',
+                        'name' => 'homepagCustomHTMLtwoAuth',
+                        'label' => 'Minimum Authentication',
+                        'value' => $GLOBALS['homepagCustomHTMLtwoAuth'],
+                        'options' => $groups
+                    )
+                ),
+                'Code' => array(
+					array(
+	                    'type' => 'textbox',
+	                    'name' => 'customHTMLtwo',
+	                    'class' => 'hidden customHTMLtwoTextarea',
+	                    'label' => '',
+	                    'value' => $GLOBALS['customHTMLtwo'],
+	                ),
+	                array(
+	        			'type' => 'html',
+	                    'override' => 12,
+	        			'label' => 'Custom HTML/JavaScript',
+	        			'html' => '<button type="button" class="hidden savecustomHTMLtwoTextarea btn btn-info btn-circle pull-right m-r-5 m-l-10"><i class="fa fa-save"></i> </button><div id="customHTMLtwoEditor" style="height:300px">'.htmlentities($GLOBALS['customHTMLtwo']).'</div>'
+	        		),
+                )
+            )
         )
     );
 }

+ 1 - 0
index.php

@@ -126,6 +126,7 @@
 	<script src="js/emulatetab.joelpurra.js"></script>
 	<script src="plugins/bower_components/ace/ace.js" type="text/javascript" charset="utf-8"></script>
 	<script src="plugins/bower_components/ace/mode-css.js" type="text/javascript" charset="utf-8"></script>
+	<script src="plugins/bower_components/ace/mode-html.js" type="text/javascript" charset="utf-8"></script>
 	<script src="plugins/bower_components/ace/theme-idle_fingers.js" type="text/javascript" charset="utf-8"></script>
 	<script src="plugins/bower_components/blockUI/jquery.blockUI.js"></script>
 	<script src="plugins/bower_components/datatables/jquery.dataTables.min.js"></script>

+ 6 - 0
js/custom.js

@@ -1007,6 +1007,12 @@ $(document).on("click", ".changeDefaultCategory", function () {
 $(document).on("click", ".saveCss", function () {
     $('.cssTextarea').val(cssEditor.getValue()).trigger('change');
 });
+$(document).on("click", ".savecustomHTMLoneTextarea", function () {
+    $('.customHTMLoneTextarea').val(customHTMLoneEditor.getValue()).trigger('change');
+});
+$(document).on("click", ".savecustomHTMLtwoTextarea", function () {
+    $('.customHTMLtwoTextarea').val(customHTMLtwoEditor.getValue()).trigger('change');
+});
 $(document).on('change asColorPicker::close', '#customize-appearance-form :input', function(e) {
     $(this).attr('data-changed', true);
     switch ($(this).attr('type')) {

+ 23 - 0
js/functions.js

@@ -703,6 +703,29 @@ function buildHomepage(){
 	organizrAPI('GET','api/?v1/settings/homepage/list').success(function(data) {
 		var response = JSON.parse(data);
 		$('#settings-homepage-list').html(buildHomepageItem(response.data));
+		customHTMLoneEditor = ace.edit("customHTMLoneEditor");
+		var HTMLMode = ace.require("ace/mode/html").Mode;
+		customHTMLoneEditor.session.setMode(new HTMLMode());
+		customHTMLoneEditor.setTheme("ace/theme/idle_fingers");
+		customHTMLoneEditor.setShowPrintMargin(false);
+		customHTMLoneEditor.session.on('change', function(delta) {
+			if($('.customHTMLoneTextarea').val() == customHTMLoneEditor.getValue()){
+				$('.savecustomHTMLoneTextarea').addClass('hidden');
+			}else{
+				$('.savecustomHTMLoneTextarea').removeClass('hidden');
+			}
+		});
+		customHTMLtwoEditor = ace.edit("customHTMLtwoEditor");
+		customHTMLtwoEditor.session.setMode(new HTMLMode());
+		customHTMLtwoEditor.setTheme("ace/theme/idle_fingers");
+		customHTMLtwoEditor.setShowPrintMargin(false);
+		customHTMLtwoEditor.session.on('change', function(delta) {
+			if($('.customHTMLtwoTextarea').val() == customHTMLtwoEditor.getValue()){
+				$('.savecustomHTMLtwoTextarea').addClass('hidden');
+			}else{
+				$('.savecustomHTMLtwoTextarea').removeClass('hidden');
+			}
+		});
 	}).fail(function(xhr) {
 		console.error("Organizr Function: API Connection Failed");
 	});

Fișier diff suprimat deoarece este prea mare
+ 0 - 0
plugins/bower_components/ace/mode-html.js


BIN
plugins/images/tabs/custom1.png


BIN
plugins/images/tabs/custom2.png


Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff