Bladeren bron

More cleanup, don't need cortado, etc. anymore either

Also WIP on adding config model so I can tart building my settings
page
Andy Baugh 7 jaren geleden
bovenliggende
commit
8fd04b1f87

+ 10 - 7
index.php

@@ -19,6 +19,7 @@
         die();
     }
 
+    $docroot  = realpath( __DIR__ );
     $nav      = ( !empty($_GET['nav'] ) )      ? $_GET['nav']  : '';
     $post     = ( !empty($_GET['post'] ) )     ? $_GET['post'] : '';
 
@@ -38,15 +39,17 @@
   </div>
   <div id="kontainer">
    <div id="leftbar" class="kontained">
-    <?php include $config['leftbar']; ?>
+    <?php include "$themedir/leftbar.inc"; ?>
    </div>
    <div id="kontent" class="kontained">
    <?php
-    //XXX fileshare, etc. shouldn't be a config value. Home should refer to a template.
+    // Home should refer to a template.
+    $home = ( array_key_exists( 'home', $config ) && !empty($config['home']) ? $config['home'] : "$docroot/sys/blogroll.inc" );
     $destinations = [
-        $config['home'], $config['fileshare'], $config['microblog'], $config['blog'], $config['postloader'],
-        $config['codeloader'], $config['audioloader'], $config['videoloader'], $config['imgloader'],
-        $config['docloader']
+        $config['home'], "$docroot/sys/fileshare/showfiles.inc", "$docroot/sys/microblog.inc",
+        "$docroot/sys/blogroll.inc", "$docroot/sys/fileshare/showpost.inc", "$docroot/sys/fileshare/showcode.inc",
+        "$docroot/sys/fileshare/showaudio.inc", "$docroot/sys/fileshare/showvideo.inc", "$docroot/sys/fileshare/showimg.inc",
+        "$docroot/sys/fileshare/showdoc.inc",
     ];
     if ( empty($nav) ) $nav = 0;
     if ( $nav === 1 || $nav > 4 ) {
@@ -59,13 +62,13 @@
    </div>
    <div id="rightbar" class="kontained">
     <?php
-     include $config['rightbar'];
+     include "$themedir/rightbar.inc";
     ?>
    </div>
   </div>
    <div id="footbar">
     <?php
-     include $config['footbar'];
+     include "$themedir/footbar.inc";
     ?>
    </div>
  </body>

+ 23 - 0
lib/tCMS/Config.inc

@@ -8,6 +8,25 @@
             'users' => [],
             'main'  => [],
         ];
+        private $conf_model = [
+            'users' => [
+                'name'        => [ 'display' => true, 'masks' => 'parent', 'label' => 'Username', 'placeholder' => 'AzureDiamond', 'form_field' => 'input', 'field_type' => 'text' ],
+                'password'    => [ 'display' => true, 'masks' => 'auth_hash', 'label' => 'Password', 'placeholder' => 'hunter2', 'form_field' => 'input', 'field_type' => 'password' ],
+                'display_name' => [ 'display' => true, 'label' => 'Display Name', 'placeholder' => "Your Name", 'default' => 'Anonymous', 'form_field' => 'input', 'field_type' => 'text' ],
+                'avatar'       => [
+                    'display'      => true,
+                    'label'        => 'User Avatar',
+                    'default'      => "R0lGODlhGAAYAMIAAAAAAIYGBp2dndHR0QAAAAAAAAAAAAAAACH+EUNyZWF0ZWQgd2l0aCBHSU1QACH5BAEKAAQALAAAAAAYABgAAANySBQc+jDGMOpwMj96OdYShYmg9okAAazsWqIDIMz0nGaiJbercIeXls1H+00utWTRhOS1Gp+JjLibcSpRyFTp8YR2TpGPBBETz4DAjlzeKmnsCNi5isuTboFdSy2y9g95XBcldDxZJYmKIIiLG4SOOBEJADs=",
+                    'form_field'   => 'input',
+                    'field_type'   => 'file',
+                    'field_accept' => "image/*",
+                ],
+             ],
+            'main'  => [
+                'theme' => [ 'display' => true, 'label' => 'tCMS Theme', 'default' => 'default', 'form_field' => 'select', 'select_opts' => [ 'default' ] ],
+                'home'  => [ 'display' => true, 'label' => 'Default Home', 'default' => 'blog', 'form_field' => 'select', 'select_opts' => [ 'blog', 'microblog', 'fileshare' ] ],
+            ],
+        ];
 
         // Get the configuration.
         public function get( $type='main' ) {
@@ -43,5 +62,9 @@
             $this->homedir = ( $user_info['dir'] ? $user_info['dir'] : '/var/www/' );
             return $this->homedir;
         }
+
+        public function get_config_model($type='main') {
+            return $this->conf_model[$type];
+        }
     }
 ?>

+ 0 - 1
sys/fileshare/include/audio-player-noswfobject.js

@@ -1 +0,0 @@
-var AudioPlayer=function(){var H=[];var D;var F="";var A={};var E=-1;var G="9";function B(I){if(document.all&&!window[I]){for(var J=0;J<document.forms.length;J++){if(document.forms[J][I]){return document.forms[J][I];break}}}return document.all?window[I]:document[I]}function C(I,J,K){B(I).addListener(J,K)}return{setup:function(J,I){F=J;A=I;if(swfobject.hasFlashPlayerVersion(G)){swfobject.switchOffAutoHideShow();swfobject.createCSS("p.audioplayer_container span","visibility:hidden;height:24px;overflow:hidden;padding:0;border:none;")}},getPlayer:function(I){return B(I)},addListener:function(I,J,K){C(I,J,K)},embed:function(I,K){var N={};var L;var J={};var O={};var M={};for(L in A){N[L]=A[L]}for(L in K){N[L]=K[L]}if(N.transparentpagebg=="yes"){J.bgcolor="#FFFFFF";J.wmode="transparent"}else{if(N.pagebg){J.bgcolor="#"+N.pagebg}J.wmode="opaque"}J.menu="false";for(L in N){if(L=="pagebg"||L=="width"||L=="transparentpagebg"){continue}O[L]=N[L]}M.name=I;M.style="outline: none";O.playerID=I;swfobject.embedSWF(F,I,N.width.toString(),"24",G,false,O,J,M);H.push(I)},syncVolumes:function(I,K){E=K;for(var J=0;J<H.length;J++){if(H[J]!=I){B(H[J]).setVolume(E)}}},activate:function(I,J){if(D&&D!=I){B(D).close()}D=I},load:function(K,I,L,J){B(K).load(I,L,J)},close:function(I){B(I).close();if(I==D){D=null}},open:function(I,J){if(J==undefined){J=1}B(I).open(J==undefined?0:J-1)},getVolume:function(I){return E}}}();

+ 0 - 129
sys/fileshare/include/audio-player-uncompressed.js

@@ -1,129 +0,0 @@
-var AudioPlayer = function () {
-	var instances = [];
-	var activePlayerID;
-	var playerURL = "";
-	var defaultOptions = {};
-	var currentVolume = -1;
-	var requiredFlashVersion = "9";
-	
-	function getPlayer(playerID) {
-		if (document.all && !window[playerID]) {
-			for (var i = 0; i < document.forms.length; i++) {
-				if (document.forms[i][playerID]) {
-					return document.forms[i][playerID];
-					break;
-				}
-			}
-		}
-		return document.all ? window[playerID] : document[playerID];
-	}
-	
-	function addListener (playerID, type, func) {
-		getPlayer(playerID).addListener(type, func);
-	}
-	
-	return {
-		setup: function (url, options) {
-			playerURL = url;
-			defaultOptions = options;
-			if (swfobject.hasFlashPlayerVersion(requiredFlashVersion)) {
-				swfobject.switchOffAutoHideShow();
-				swfobject.createCSS("p.audioplayer_container span", "visibility:hidden;height:24px;overflow:hidden;padding:0;border:none;");
-			}
-		},
-
-		getPlayer: function (playerID) {
-			return getPlayer(playerID);
-		},
-		
-		addListener: function (playerID, type, func) {
-			addListener(playerID, type, func);
-		},
-		
-		embed: function (elementID, options) {
-			var instanceOptions = {};
-			var key;
-			
-			var flashParams = {};
-			var flashVars = {};
-			var flashAttributes = {};
-	
-			// Merge default options and instance options
-			for (key in defaultOptions) {
-				instanceOptions[key] = defaultOptions[key];
-			}
-			for (key in options) {
-				instanceOptions[key] = options[key];
-			}
-			
-			if (instanceOptions.transparentpagebg == "yes") {
-				flashParams.bgcolor = "#FFFFFF";
-				flashParams.wmode = "transparent";
-			} else {
-				if (instanceOptions.pagebg) {
-					flashParams.bgcolor = "#" + instanceOptions.pagebg;
-				}
-				flashParams.wmode = "opaque";
-			}
-			
-			flashParams.menu = "false";
-			
-			for (key in instanceOptions) {
-				if (key == "pagebg" || key == "width" || key == "transparentpagebg") {
-					continue;
-				}
-				flashVars[key] = instanceOptions[key];
-			}
-			
-			flashAttributes.name = elementID;
-			flashAttributes.style = "outline: none";
-			
-			flashVars.playerID = elementID;
-			
-			swfobject.embedSWF(playerURL, elementID, instanceOptions.width.toString(), "24", requiredFlashVersion, false, flashVars, flashParams, flashAttributes);
-			
-			instances.push(elementID);
-		},
-		
-		syncVolumes: function (playerID, volume) {	
-			currentVolume = volume;
-			for (var i = 0; i < instances.length; i++) {
-				if (instances[i] != playerID) {
-					getPlayer(instances[i]).setVolume(currentVolume);
-				}
-			}
-		},
-		
-		activate: function (playerID, info) {
-			if (activePlayerID && activePlayerID != playerID) {
-				getPlayer(activePlayerID).close();
-			}
-
-			activePlayerID = playerID;
-		},
-		
-		load: function (playerID, soundFile, titles, artists) {
-			getPlayer(playerID).load(soundFile, titles, artists);
-		},
-		
-		close: function (playerID) {
-			getPlayer(playerID).close();
-			if (playerID == activePlayerID) {
-				activePlayerID = null;
-			}
-		},
-		
-		open: function (playerID, index) {
-			if (index == undefined) {
-				index = 1;
-			}
-			getPlayer(playerID).open(index == undefined ? 0 : index-1);
-		},
-		
-		getVolume: function (playerID) {
-			return currentVolume;
-		}
-		
-	}
-	
-}();

File diff suppressed because it is too large
+ 0 - 3
sys/fileshare/include/audio-player.js


+ 1 - 1
sys/fileshare/include/blacklist.json

@@ -1 +1 @@
-[ "img", "sys", "special", "microblog", "css" ]
+[ "sys", "microblog", "themed" ]

BIN
sys/fileshare/include/cortado.jar


+ 0 - 19
sys/fileshare/include/license.txt

@@ -1,19 +0,0 @@
-Copyright (c) 2010 Martin Laine
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.

BIN
sys/fileshare/include/player.swf


+ 15 - 15
templates/default/admin/settings.inc

@@ -1,24 +1,24 @@
 <p class="title">
- tCMS General Settings - Edit these Locally (for now).
+ General settings:
 </p>
 <hr />
+INSERT FORM HERE
+<hr />
+
 <p class="title">
- Configuration Variables
+ User management:
 </p>
-For now, every big config variable is set in /sys/admin/config/main.json. Refer to it if you know what you are doing.<br /><br />
-Soon I will have a users.json defining what users are there (or alias http auth users).
+<hr />
+INSERT USER TABLE W/USER DROPDOWN FORM HERE
+<hr />
+
 <p class="title">
-Themes: Coming soon.
+ Theme cloner:
 </p>
-<!--<form id="themeForm" method="post" name="themeForm">
-<select name="selectedTheme">
-  <?php
-    
-
-    //echo '<option></option>';
-  ?>
- </select>
-</form>-->
+<hr />
 <p>
-  Want to write your own theme (or modify one since I haven't finished the theme selector here)? Please see the <a href="https://tcms.troglodyne.net/index.php?nav=5&post=fileshare/manual/Chapter 03-Customization.post" title="GET UR MIND RITE">styling guide</a>.
+  Want to write your own theme?
+  Clone a theme here then see the <a href="https://tcms.troglodyne.net/index.php?nav=5&post=fileshare/manual/Chapter 03-Customization.post" title="GET UR MIND RITE">styling guide</a>
+  for information on how tCMS' templates, image sets and CSS work in the theming system.
 </p>
+INSERT FORM HERE

BIN
themed/default/img/avatar/humm.gif


Some files were not shown because too many files changed in this diff