Page MenuHomeDevCentral

No OneTemporary

diff --git a/workspaces/src/apps/documents/DocumentsApplication.php b/workspaces/src/apps/documents/DocumentsApplication.php
index acf5c31..8682302 100644
--- a/workspaces/src/apps/documents/DocumentsApplication.php
+++ b/workspaces/src/apps/documents/DocumentsApplication.php
@@ -1,110 +1,114 @@
<?php
/**
* _, __, _, _ __, _ _, _, _
* / \ |_) (_ | | \ | /_\ |\ |
* \ / |_) , ) | |_/ | | | | \|
* ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
*
* Documents application class
*
* @package ObsidianWorkspaces
* @subpackage HelloWorld
* @author Sébastien Santoro aka Dereckson <dereckson@espace-win.org>
* @license http://www.opensource.org/licenses/bsd-license.php BSD
* @filesource
*/
/**
* Documents application class
*/
class DocumentsApplication extends Application {
/**
* @var string the application name
*/
public static $name = "Documents";
/**
* Gets path to a document file
*/
private function getFilePath ($file) {
global $Config;
return $Config['Content']['Workspaces']
. DIRECTORY_SEPARATOR
. $this->context->workspace->code
. DIRECTORY_SEPARATOR
. $this->context->configuration->path
. DIRECTORY_SEPARATOR
. $file;
}
/**
* Gets documents list
*
* @return array The documents list
*/
public function getDocumentsList () {
$dir = $this->getFilePath('');
$files = scandir($dir);
$documents = [];
foreach ($files as $file) {
if (get_extension($file) == 'json') {
$documents[] = get_filename($file);
}
}
return $documents;
}
/**
* Gets document
*
* @param string $docId the document identifier
* @return stdClass the document JSON representation
*/
public function getDocument ($docId) {
$file = $this->getFilePath($docId . '.json');
$data = file_get_contents($file);
return json_decode($data);
}
public static function getDocumentType ($type) {
$key = 'DocumentType' . ucfirst(strtolower($type));
return Language::get($key);
}
/**
* Handles controller request
*/
public function handleRequest () {
//Reference to URL fragments and Smarty engine
$url = $this->context->url;
$smarty = $this->context->templateEngine;
//Gets resources for HTML output
if (count($url) == 1) {
//Prints the list of the documents
$documents = $this->getDocumentsList();
$smarty->assign('documents', $documents);
+ $smarty->assign(
+ "docs_url",
+ get_url($this->context->workspace->code, "docs")
+ );
$template = 'documents_list.tpl';
} else {
//Prints a document
$docId = $url[1];
$document = $this->getDocument($docId);
$smarty->assign('documentId', $docId);
$smarty->assign('documentType', self::getDocumentType($document->type));
$smarty->assign('document', $document);
$template = 'documents_view.tpl';
}
//Serves header
$smarty->assign('PAGE_TITLE', "Documents");
HeaderController::run($this->context);
//Serves body
$smarty->display('apps/documents/' . $template);
//Serves footer
FooterController::run($this->context);
}
}
diff --git a/workspaces/src/content/help/credits.html b/workspaces/src/content/help/credits.html
index 888327f..eed3e4c 100644
--- a/workspaces/src/content/help/credits.html
+++ b/workspaces/src/content/help/credits.html
@@ -1,65 +1,65 @@
<ol class="breadcrumb">
- <li><a href="{get_url('help')}">Help</a></li>
+ <li><a href="{$help_url}">Help</a></li>
<li>About Obsidian Workspaces</li>
<li class="active">Credits</li>
</ol>
<h1>Credits</h1>
<h2>Code</h2>
<h3>PHP engine and libraries</h3>
<dl class="definition">
<dt>Obsidian Workspaces</dt>
<dd>Copyright © 2012-2014 <a href="https://www.dereckson.be/">Sébastien Santoro aka Dereckson</a></dd>
<dd>Licensed under BSD license</dd>
<dd>Powered by <a href="https://devcentral.nasqueron.org/u/kerualdhome">Keruald</a>, open source modular libraries.</dd>
</dl>
<h3>JavaScript</h3>
<dl class="definition">
<dt>SyntaxHighlighter</dt>
<dd>Copyright © <a href="https://github.com/alexgorbatchev">Alex Gorbatchev</a><br>
SyntaxHighlighter is licenced under <a href="https://www.gnu.org/licenses/lgpl-3.0.en.html">LGPL 3</a></dd>
</dl>
<h2>Content</h2>
<h3>Obsidian Workspaces content</h3>
<dl class="definition">
<dt>Help content</dt>
<dd>The Obsidian Workspaces documentation is licensed under <a href="https://creativecommons.org/licenses/by/4.0/" rel="license">Creative Commons BY 4.0 license</a>.</dd>
</dl>
<h3>User-generated content</h3>
<dl class="definition">
<dt>Data</dt>
<dd>All works uploaded to the site by users keeps its original copyright status, under their responsibility.</dd>
</dl>
<h2>Design</h2>
<h3>Web UI</h3>
<dl class="definition">
<dt>Main design</dt>
<dd>Copyright © 2013 Iron Summit Media Strategies<br>
Licensed under <a href="https://www.apache.org/licenses/LICENSE-2.0.html">Apache License 2.0 </a></dd>
</dl>
<h3>Icons</h3>
<dl class="definition">
<dt>Arrow obsidian</dt>
<dd>This image is a work of a United States Department of Energy (or predecessor organization) employee, taken or made during the course of an employee's official duties. As a work of the U.S. federal government, the image is in the public domain.
<br>&nbsp;<br>Thank you to Julien Torres for the cutout operation.</dd>
</dl>
<h3>Photography</h3>
<dl class="definition">
<dt><a href="https://commons.wikimedia.org/wiki/File:Gray_Glacier_-_Torres_del_Paine,_Chile.jpg">Gray Glacier - Torres del Paine, Chile</a></dt>
<dd>Photography by <a href="https://www.flickr.com/photos/travelingotter/">TravelingOtter</a>, licensed under <a href="http://creativecommons.org/licenses/by/2.0/" rel="license">Creative Commons BY 2.0 license</a>.</dd>
<dt><a href="https://commons.wikimedia.org/wiki/File:Keelan_McNulty_Mount_McKinle_climbing.jpg">Majestic McKinley</a></dt>
<dd class="description">Capt. Keelan McNulty surveys the majesty of the Alaskan mountain range during his climb of Mount McKinley. 2008-07-15.</dd>
<dd>Photography by 1st Lt. Graham Ward, U.S. Army, in the public domain.</dd>
<dt><a href="https://commons.wikimedia.org/wiki/File:Rock_Mesa_obsidian_flow_in_Oregon_in_2011_%289%29.JPG">Rock Mesa obsidian flow in Oregon in 2011</a></dt>
<dd class="description">Obsidian lava flow Rock Mesa in Three Sisters Area, protected area Three Sisters Wilderness, Oregon, USA. 3 September 2011, 01:04:12</dd>
<dd>Photography by <a href="https://commons.wikimedia.org/wiki/User:Chmee2">Petr Brož</a>, under <a href="https://creativecommons.org/licenses/by-sa/3.0/" rel="license">Creative Commons BY-SA 3.0 license</a>.</dd>
</dl>
diff --git a/workspaces/src/controllers/header.php b/workspaces/src/controllers/header.php
index 1946aa0..9d1640c 100755
--- a/workspaces/src/controllers/header.php
+++ b/workspaces/src/controllers/header.php
@@ -1,65 +1,69 @@
<?php
/**
* _, __, _, _ __, _ _, _, _
* / \ |_) (_ | | \ | /_\ |\ |
* \ / |_) , ) | |_/ | | | | \|
* ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
*
* Controller for header (called on every regular page)
*
* @package ObsidianWorkspaces
* @subpackage Controllers
* @author Sébastien Santoro aka Dereckson <dereckson@espace-win.org>
* @license http://www.opensource.org/licenses/bsd-license.php BSD
* @filesource
*
*/
/**
* Header controller
*/
class HeaderController extends Controller {
/**
* Handles controller request
*/
public function handleRequest () {
//Gets header resources
$workspaces = $this->context->user->get_workspaces();
//HTML output
$smarty = $this->context->templateEngine;
$smarty->assign('current_username', $this->context->user->name);
$smarty->assign('workspaces', $workspaces);
$smarty->assign('workspaces_count', count($workspaces));
- if ($this->context->workspace !== null) {
+ if ($this->context->workspace === null) {
+ $smarty->assign('root_url', get_url());
+ } else {
$workspace = $this->context->workspace;
+ $workspace_url = get_url($workspace->code);
$smarty->assign('current_workspace', $workspace);
+ $smarty->assign('current_workspace_url', $workspace_url);
//Gets custom header
if ($workspace->configuration->header != '') {
$customHeader = file_get_contents($workspace->configuration->header);
$smarty->assign('custom_workspace_header', $customHeader);
}
//Gets navigation
$nav = [];
$binds = $workspace->configuration->getControllersBinds();
foreach ($binds as $applicationConfig) {
if ($applicationConfig->nav !== null) {
$nav[] = [
'link' => $applicationConfig->nav->__toString(),
'url' => $applicationConfig->bind,
'icon' => $applicationConfig->icon
];
}
}
$smarty->assign('current_workspace_nav', $nav);
}
$smarty->display('header.tpl');
define('HEADER_PRINTED', true);
}
}
diff --git a/workspaces/src/controllers/help.php b/workspaces/src/controllers/help.php
index c9fdeb7..79792dd 100755
--- a/workspaces/src/controllers/help.php
+++ b/workspaces/src/controllers/help.php
@@ -1,42 +1,43 @@
<?php
/**
* _, __, _, _ __, _ _, _, _
* / \ |_) (_ | | \ | /_\ |\ |
* \ / |_) , ) | |_/ | | | | \|
* ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
*
* Controller
*
* @package ObsidianWorkspaces
* @subpackage Controllers
* @author Sébastien Santoro aka Dereckson <dereckson@espace-win.org>
* @license http://www.opensource.org/licenses/bsd-license.php BSD
* @filesource
*
*/
//
// HTML output
//
$file = $Config['Content']['Help'] . DIRECTORY_SEPARATOR;
$file .= (count($context->url) > 1) ? $context->url[1] : 'index';
$file .= '.html';
if (!file_exists($file)) {
ErrorPageController::show($context, 404);
exit;
}
//Header
$context->templateEngine->assign('PAGE_TITLE', Language::get('Help'));
+$context->templateEngine->assign('help_url', get_url("help"));
$context->templateEngine->assign('controller_custom_nav', 'nav_help.tpl');
HeaderController::run($context);
//Help page
$context->templateEngine->assign('help_file', $file);
$context->templateEngine->display('help.tpl');
//Footer
FooterController::run($context);
diff --git a/workspaces/src/skins/bluegray/apps/documents/documents_list.tpl b/workspaces/src/skins/bluegray/apps/documents/documents_list.tpl
index d2c142a..d66dca4 100644
--- a/workspaces/src/skins/bluegray/apps/documents/documents_list.tpl
+++ b/workspaces/src/skins/bluegray/apps/documents/documents_list.tpl
@@ -1,12 +1,12 @@
<div class="row">
<h1 class="page-header">Documents</h1>
{if $documents}
<ul id="documents">
-{foreach $documents item=document}
- <li class="document"><a href="{get_url($current_workspace->code, 'docs', $document)}">{$document}</a></li>
+{foreach from=$documents item=document}
+ <li class="document"><a href="{$docs_url}/{$document}">{$document}</a></li>
{/foreach}
</ul>
{else}
<p>No document currently available.</p>
{/if}
</div>
diff --git a/workspaces/src/skins/bluegray/errors/404.tpl b/workspaces/src/skins/bluegray/errors/404.tpl
index 395e3bd..7da9c6c 100644
--- a/workspaces/src/skins/bluegray/errors/404.tpl
+++ b/workspaces/src/skins/bluegray/errors/404.tpl
@@ -1,22 +1,22 @@
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Obsidian Workspaces :: 404 not found</title>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/foundation/5.0.3/css/foundation.min.css" />
<link rel="stylesheet" href="{#StaticContentURL#}/css/errorpage.css" />
<link href="{#StaticContentURL#}/favicon.ico" rel="shorcut icon" type="image/x-icon">
<link href="{#StaticContentURL#}/favicon.png" rel="icon" type="image/png" />
<script src="//cdnjs.cloudflare.com/ajax/libs/foundation/5.0.3/js/modernizr.js"></script>
</head>
<body>
<div class="contentpanel">
<h1>This page can’t be found.</h1>
<h2>We’re looking if your page could be found on the top of an Alaska mountain.</h2>
<p>Meanwhile, try to <a href="#" onClick="window.history.back();">go back to the
- previous page</a> or to <a href="{get_url()}">return to the
+ previous page</a> or to <a href="{$URL_HOME}">return to the
homepage</a>.</p>
</div>
</body>
</html>
diff --git a/workspaces/src/skins/bluegray/header.tpl b/workspaces/src/skins/bluegray/header.tpl
index 0c3b703..06e636b 100644
--- a/workspaces/src/skins/bluegray/header.tpl
+++ b/workspaces/src/skins/bluegray/header.tpl
@@ -1,87 +1,87 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{#SiteTitle#}{if $PAGE_TITLE} :: {$PAGE_TITLE}{/if}</title>
<link href="{#StaticContentURL#}/css/bootstrap.css" rel="stylesheet">
<link href="{#StaticContentURL#}/css/font-awesome.min.css" rel="stylesheet">
<link href="{#StaticContentURL#}/css/bluegray.css" rel="stylesheet">
<link href="{#StaticContentURL#}/favicon.ico" rel="shorcut icon" type="image/x-icon">
<link href="{#StaticContentURL#}/favicon.png" rel="icon" type="image/png" />
</head>
<body>
<a href="#content" class="sr-only">{#SkipNavigation#}</a>
{if isset($custom_workspace_header)}
<!-- Workspace header-->
{$custom_workspace_header}
{/if}
<div id="wrapper">
<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".sidebar-collapse">
<span class="sr-only">{#ToggleNavigation#}</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
{if isset($current_workspace)}
- <a class="navbar-brand" href="{get_url($current_workspace->code)}">{$current_workspace->name}</a>
+ <a class="navbar-brand" href="{$current_workspace_url}">{$current_workspace->name}</a>
{else}
- <a class="navbar-brand" href="{get_url()}">{#SiteTitle#}</a>
+ <a class="navbar-brand" href="{$root_url}">{#SiteTitle#}</a>
{/if}
</div>
<ul class="nav navbar-top-links navbar-right">
{if $workspaces_count > 1}
<!-- Workspaces -->
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-book fa-fw"></i> <i class="fa fa-caret-down"></i>
</a>
<ul class="dropdown-menu dropdown-messages">
{foreach from=$workspaces item=workspace}
<li>
<a href="/{$workspace->code}">
<div>
<strong class="workspace-name">{$workspace->name}</strong>
<span class="pull-right text-muted">
<em class="workspace-counter">{counter}</em>
</span>
</div>
<div class="workspace-description">{$workspace->description}</div>
</a>
</li>
<li class="divider"></li>
{/foreach}
<li>
<a class="text-center" href="#">
<strong>{#WorkspacesManagement#}</strong>
<i class="fa fa-angle-right"></i>
</a>
</li>
</ul>
</li>
{/if}
<!-- Other right navigation actions -->
<li>
{if isset($current_workspace)}
- <a href="{get_url($current_workspace->code)}?action=user.logout">
+ <a href="{$current_workspace_url}?action=user.logout">
{else}
- <a href="{get_url()}?action=user.logout">
+ <a href="{$root_url}?action=user.logout">
{/if}
<i class="fa fa-sign-out fa-fw"></i> {#Logout#}
</a>
</li>
</ul>
</nav>
{if isset($controller_custom_nav) }
{include file=$controller_custom_nav}
{else}
{include file='nav_main.tpl'}
{/if}
<div id="content">
\ No newline at end of file
diff --git a/workspaces/src/skins/bluegray/nav_help.tpl b/workspaces/src/skins/bluegray/nav_help.tpl
index 59b43ca..bb3c01b 100644
--- a/workspaces/src/skins/bluegray/nav_help.tpl
+++ b/workspaces/src/skins/bluegray/nav_help.tpl
@@ -1,35 +1,35 @@
<nav class="navbar-default navbar-static-side" role="navigation">
<div class="sidebar-collapse">
<ul class="nav" id="side-menu">
<li class="sidebar-search">
<div class="input-group custom-search-form">
<input type="text" class="form-control" placeholder="{#Search#}">
<span class="input-group-btn">
<button class="btn btn-default" type="button">
<i class="fa fa-search"></i>
</button>
</span>
</div>
</li>
{if isset($current_workspace)}
- <li><a href="{get_url($current_workspace->code)}"><i class="fa fa-dashboard fa-fw"></i> {#Home#}</a></li>
+ <li><a href="{$current_workspace_url}"><i class="fa fa-dashboard fa-fw"></i> {#Home#}</a></li>
{else}
- <li><a href="{get_url()}"><i class="fa fa-dashboard fa-fw"></i> {#Home#}</a></li>
+ <li><a href="{$root_url}"><i class="fa fa-dashboard fa-fw"></i> {#Home#}</a></li>
{/if}
<li>
<a href="#"><i class="fa fa-question fa-fw"></i> Support & services<span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
- <li><a href="{get_url('help', 'new-workspace')}">Create a new workspace</a></li>
- <li><a href="{get_url('help', 'support')}">Technical support</a></li>
+ <li><a href="{$help_url}/new-workspace">Create a new workspace</a></li>
+ <li><a href="{$help_url}/support">Technical support</a></li>
</ul>
</li>
<li>
<a href="#"><i class="fa fa-info fa-fw"></i> About Obsidian Workspaces<span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
- <li><a href="{get_url('help', 'about')}">About</a></li>
- <li><a href="{get_url('help', 'credits')}">Credits</a></li>
+ <li><a href="{$help_url}/about">About</a></li>
+ <li><a href="{$help_url}/credits">Credits</a></li>
</ul>
</li>
</ul>
</div>
</nav>
diff --git a/workspaces/src/skins/bluegray/nav_main.tpl b/workspaces/src/skins/bluegray/nav_main.tpl
index 3e1020c..cfc982e 100644
--- a/workspaces/src/skins/bluegray/nav_main.tpl
+++ b/workspaces/src/skins/bluegray/nav_main.tpl
@@ -1,26 +1,26 @@
<nav class="navbar-default navbar-static-side" role="navigation">
<div class="sidebar-collapse">
<ul class="nav" id="side-menu">
<li class="sidebar-search">
<div class="input-group custom-search-form">
<input type="text" class="form-control" placeholder="{#Search#}">
<span class="input-group-btn">
<button class="btn btn-default" type="button">
<i class="fa fa-search"></i>
</button>
</span>
</div>
</li>
{if isset($current_workspace)}
- <li><a href="{get_url($current_workspace->code)}"><i class="fa fa-dashboard fa-fw"></i> {#Home#}</a></li>
+ <li><a href="{$current_workspace_url}"><i class="fa fa-dashboard fa-fw"></i> {#Home#}</a></li>
{foreach from=$current_workspace_nav item=nav}
- <li><a href="{get_url($current_workspace->code, $nav.url)}"><i class="fa {if $nav.icon}fa-{$nav.icon}{else}fa-circle-o{/if} fa-fw"></i> {$nav.link}</a></li>
+ <li><a href="{$current_workspace_url}/{$nav.url}"><i class="fa {if $nav.icon}fa-{$nav.icon}{else}fa-circle-o{/if} fa-fw"></i> {$nav.link}</a></li>
{/foreach}
- <li><a href="{get_url($current_workspace->code, 'help')}"><i class="fa fa-question fa-fw"></i> {#Help#}</a></li>
+ <li><a href="{$current_workspace_url}/help"><i class="fa fa-question fa-fw"></i> {#Help#}</a></li>
{else}
- <li><a href="{get_url()}"><i class="fa fa-dashboard fa-fw"></i> {#Home#}</a></li>
- <li><a href="{get_url('help')}"><i class="fa fa-question fa-fw"></i> {#Help#}</a></li>
+ <li><a href="{$root_url}"><i class="fa fa-dashboard fa-fw"></i> {#Home#}</a></li>
+ <li><a href="{$root_url}/help"><i class="fa fa-question fa-fw"></i> {#Help#}</a></li>
{/if}
</ul>
</div>
</nav>

File Metadata

Mime Type
text/x-diff
Expires
Sun, May 3, 04:57 (1 d, 10 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3677641
Default Alt Text
(22 KB)

Event Timeline