Ver código fonte

Core update (sidebar remix)

markseu 10 anos atrás
pai
commit
56f3fb024f

+ 1 - 1
README.md

@@ -1,4 +1,4 @@
-Yellow 0.5.8
+Yellow 0.5.9
 ============
 [![Yellow](https://raw.githubusercontent.com/wiki/datenstrom/yellow/images/yellow.jpg)](http://datenstrom.se/yellow)
 

+ 1 - 1
system/core/core-webinterface.css

@@ -1,4 +1,4 @@
-/* Yellow web interface 0.5.8 */
+/* Yellow web interface 0.5.9 */
 
 .yellow-bar { position:relative; overflow:hidden; line-height:2em; margin-bottom:10px; }
 .yellow-bar-left { display:block; float:left; }

+ 3 - 3
system/core/core-webinterface.js

@@ -4,7 +4,7 @@
 // Yellow main API
 var yellow =
 {
-	version: "0.5.8",
+	version: "0.5.9",
 	action: function(text) { yellow.webinterface.action(text); },
 	onClick: function(e) { yellow.webinterface.hidePanesOnClick(yellow.toolbox.getEventElement(e)); },
 	onKeydown: function(e) { yellow.webinterface.hidePanesOnKeydown(yellow.toolbox.getEventKeycode(e)); },
@@ -74,7 +74,7 @@ yellow.webinterface =
 	{
 		if(yellow.debug) console.log("yellow.webinterface.createBar id:"+id);
 		var elementBar = document.createElement("div");
-		elementBar.className = "yellow-bar yellow";
+		elementBar.className = "yellow-bar";
 		elementBar.setAttribute("id", id);
 		if(normal)
 		{
@@ -85,7 +85,7 @@ yellow.webinterface =
 				"</div>"+
 				"<div class=\"yellow-bar-right\">"+
 				"<a href=\"#\" onclick=\"yellow.action('new'); return false;\" id=\"yellow-pane-new-link\">"+this.getText("New")+"</a>"+
-				"<a href=\"#\" onclick=\"yellow.action('user'); return false;\" id=\"yellow-pane-user-link\">"+yellow.config.userName+" &#9662;</a>"+
+				"<a href=\"#\" onclick=\"yellow.action('user'); return false;\" id=\"yellow-pane-user-link\">"+yellow.config.userName+"</a>"+
 				"</div>";
 		}
 		yellow.toolbox.insertBefore(elementBar, elementReference);

+ 16 - 1
system/core/core-webinterface.php

@@ -5,7 +5,7 @@
 // Web interface core plugin
 class YellowWebinterface
 {
-	const Version = "0.5.8";
+	const Version = "0.5.9";
 	var $yellow;				//access to API
 	var $active;				//web interface is active? (boolean)
 	var $userLoginFailed;		//web interface login failed? (boolean)
@@ -624,6 +624,21 @@ class YellowWebinterfaceUsers
 		return $this->isExisting($email) && $this->yellow->toolbox->verifyHash($this->users[$email]["hash"], "sha256", $session);
 	}
 	
+	// Retun user login information
+	function getUserInfo($email, $password, $name, $language, $home)
+	{
+		$algorithm = $this->yellow->config->get("webinterfaceUserHashAlgorithm");
+		$cost = $this->yellow->config->get("webinterfaceUserHashCost");
+		$hash = $this->yellow->toolbox->createHash($password, $algorithm, $cost);
+		$email = strreplaceu(',', '-', $email);
+		$hash = strreplaceu(',', '-', $hash);
+		$name = strreplaceu(',', '-', empty($name) ? $this->yellow->config->get("sitename") : $name);
+		$language = strreplaceu(',', '-', empty($language) ? $this->yellow->config->get("language") : $language);
+		$home = strreplaceu(',', '-', empty($home) ? "/" : $home);
+		$user = "$email,$hash,$name,$language,$home\n";
+		return $user;
+	}
+	
 	// Return user name
 	function getName($email = "")
 	{

+ 2 - 2
system/core/core.php

@@ -5,7 +5,7 @@
 // Yellow main class
 class Yellow
 {
-	const Version = "0.5.8";
+	const Version = "0.5.9";
 	var $page;				//current page
 	var $pages;				//pages from file system
 	var $files;				//files from file system
@@ -479,10 +479,10 @@ class YellowPage
 			
 			$titleHeader = ($this->location == $this->yellow->pages->getHomeLocation($this->location)) ?
 				$this->get("sitename") : $this->get("title")." - ".$this->get("sitename");
-			if($this->get("titleContent") == "-") $this->set("titleContent", "");
 			if(!$this->isExisting("titleContent")) $this->set("titleContent", $this->get("title"));
 			if(!$this->isExisting("titleHeader")) $this->set("titleHeader", $titleHeader);
 			if(!$this->isExisting("titleNavigation")) $this->set("titleNavigation", $this->get("title"));
+			if($this->get("titleContent") == "-") $this->set("titleContent", "");
 			$this->set("pageRead", $this->yellow->lookup->normaliseUrl(
 				$this->yellow->config->get("serverScheme"),
 				$this->yellow->config->get("serverName"),

+ 18 - 9
system/themes/flatsite.css

@@ -1,4 +1,4 @@
-/* Flatsite theme 0.1.7 */
+/* Flatsite theme 0.2.1 */
 /* Designer: Mark Mayberg */
 
 @import url(https://fonts.googleapis.com/css?family=Open+Sans:300,400,700);
@@ -22,12 +22,10 @@ a, img { border:none; text-decoration:none; }
 .sitename { display:block; float:left; }
 .sitename h1 { margin:0; }
 .sitename h1 a { color:#111; text-decoration:none; }
-.navigation { display:block; float:right; }
-.navigation { margin-top:0.9em; margin-bottom:0.9em; line-height:2em; }
-.navigation a { padding:0 0.3em; display:inline-block; }
-.navigation ul { margin:0 -0.3em; padding:0; list-style:none; }
-.navigation li { display:inline; }
-.content { clear:both; }
+.with-sidebar .main { margin-right:13em; }
+.with-sidebar .sidebar { float:right; width:12em; margin-top:4.3em; overflow:hidden; }
+.with-sidebar .sidebar .navigationside ul { margin:0; padding:0; list-style:none; }
+.content h1:first-child, .content>*:first-child { margin-top:0; }
 .content h1 a:hover { text-decoration:none; }
 .content img { max-width:100%; height:auto; }
 .content form { margin:1em 0; }
@@ -43,14 +41,23 @@ a, img { border:none; text-decoration:none; }
 .content .imagelist { margin:0; padding:0; list-style:none; }
 .content .themes { margin:0; padding:0; list-style:none; width:100%; }
 .content .themes li { padding-bottom:1em; text-align:center; white-space:nowrap; display:inline-block; width:24%; }
-.pagination { margin:1em 0; }
-.footer { margin-top:2em; }
+.content .pagination { margin:1em 0; }
+.footer { margin-top:2em; clear:both; }
 .footer a { color:#07d; }
 .footer a:hover { color:#07d; text-decoration:underline; }
 .left { float:left; margin:0 1em 0 0; }
 .center { display:block; margin:0 auto; }
 .right { float:right; margin:0 0 0 1em; }
 
+/* Navigation */
+
+.navigation { display:block; float:right; }
+.navigation { margin-top:0.9em; margin-bottom:0.9em; line-height:2em; }
+.navigation a { padding:0 0.3em; display:inline-block; }
+.navigation ul { margin:0 -0.3em; padding:0; list-style:none; }
+.navigation li { display:inline; }
+.navigation-banner { clear:both; }
+
 /* Forms and buttons */
 
 .form-control {
@@ -94,6 +101,8 @@ a, img { border:none; text-decoration:none; }
 	.sitename h1, h1, h2 { font-size:1.2em; }
 	.sitename h1, .header, .navigation, .footer, .page { margin:0; padding:0; }
 	.sitename, .navigation { float:none; }
+	.with-sidebar .main { margin-right:0em; }
+	.with-sidebar .sidebar { display:none; }
 }
 @media print {
 	body, h1, h2, h3, h4, h5, h6 { background-color:white; color:black; }

+ 1 - 1
system/themes/snippets/content.php → system/themes/snippets/content-main.php

@@ -1,4 +1,4 @@
-<div class="content">
+<div class="content main">
 <h1><?php echo $yellow->page->getHtml("titleContent") ?></h1>
 <?php echo $yellow->page->getContent() ?>
 </div>

+ 20 - 0
system/themes/snippets/content-sidebar.php

@@ -0,0 +1,20 @@
+<?php if($yellow->page->isExisting("sidebar")): ?>
+<div class="content sidebar">
+<?php $location = $yellow->lookup->getDirectoryLocation($yellow->page->location).$yellow->page->get("sidebar"); ?>
+<?php if($page = $yellow->pages->find($location)): ?>
+<?php $yellow->page->setLastModified($page->getModified()) ?>
+<?php echo $page->getContent() ?>
+<?php else: ?>
+<?php $page = $yellow->page->getParentTop(false) ?>
+<?php $pages = $page ? $page->getChildren(): $yellow->pages->clean() ?>
+<?php $yellow->page->setLastModified($pages->getModified()) ?>
+<div class="navigationside">
+<ul>
+<?php foreach($pages as $page): ?>
+<li><a<?php echo $page->isActive() ? " class=\"active\"" : "" ?> href="<?php echo $page->getLocation() ?>"><?php echo $page->getHtml("titleNavigation") ?></a></li>
+<?php endforeach ?>
+</ul>
+</div>
+<?php endif ?>
+</div>
+<?php endif ?>

+ 9 - 1
system/themes/snippets/header.php

@@ -14,4 +14,12 @@
 <?php echo $yellow->page->getExtra("header") ?>
 </head>
 <body>
-<div class="page">
+<?php $yellow->page->set("pageClass", "page") ?>
+<?php $yellow->page->set("pageClass", $yellow->page->get("pageClass")." ".$yellow->page->get("template")) ?>
+<?php if($yellow->page->isExisting("sidebar")) $yellow->page->set("pageClass", $yellow->page->get("pageClass")." with-sidebar") ?>
+<div class="<?php echo $yellow->page->getHtml("pageClass") ?>">
+<div class="header">
+<div class="sitename"><h1><a href="<?php echo $yellow->page->base."/" ?>"><i class="sitename-logo"></i><?php echo $yellow->page->getHtml("sitename") ?></a></h1></div>
+<div class="sitename-banner"></div>
+<?php $yellow->snippet("navigation") ?>
+</div>

+ 1 - 0
system/themes/snippets/navigation.php

@@ -7,3 +7,4 @@
 <?php endforeach ?>
 </ul>
 </div>
+<div class="navigation-banner"></div>

+ 0 - 2
system/themes/snippets/sitename.php

@@ -1,2 +0,0 @@
-<div class="sitename"><h1><a href="<?php echo $yellow->page->base."/" ?>"><i class="sitename-logo"></i><?php echo $yellow->page->getHtml("sitename") ?></a></h1></div>
-<div class="sitename-banner"></div>

+ 2 - 3
system/themes/templates/default.html

@@ -1,5 +1,4 @@
 <?php $yellow->snippet("header") ?>
-<?php $yellow->snippet("sitename") ?>
-<?php $yellow->snippet("navigation") ?>
-<?php $yellow->snippet("content") ?>
+<?php $yellow->snippet("content-sidebar") ?>
+<?php $yellow->snippet("content-main") ?>
 <?php $yellow->snippet("footer") ?>