Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make editor design customisable according to the wall it is associate…
…d with
- Loading branch information
Showing
14 changed files
with
128 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
/* vim: set syn=php: */ | ||
|
||
require_once(dirname(__FILE__) . "/../../../wall/lib/parapara.inc"); | ||
require_once('designs.inc'); | ||
// require_once("UriUtils.inc"); | ||
// require_once('walls.inc'); | ||
|
||
function getWall() { | ||
$uri = $_SERVER['REQUEST_URI']; | ||
if (strlen($uri) < 2) | ||
return null; | ||
return substr($uri, 1); // Skip initial / | ||
} | ||
|
||
function getStylesheet() { | ||
global $config; | ||
|
||
// Get wall name | ||
$wall = getWall(); | ||
if (!$wall) | ||
return; | ||
|
||
// Get design name | ||
$design = null; | ||
try { | ||
$design = getDesignForWallPath($wall); | ||
} catch (KeyedException $e) { | ||
error_log(print_r($e, true)); | ||
} | ||
if (!$design || !isset($design['name']) || strlen($design['name']) == 0) | ||
return null; | ||
|
||
// Get stylesheet | ||
$stylesheet = getEditorStyleSheetForDesign($design['name']); | ||
if (!$stylesheet) | ||
return null; | ||
|
||
// Construct URL to stylesheet | ||
$server_path = $config['editor']['upload_server']; | ||
// Make sure server path ends with a / | ||
if (substr($server_path, -1) !== "/") | ||
$server_path .= "/"; | ||
// XXX Rename upload_server to wall_server | ||
return $server_path . $stylesheet; | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
Options -Indexes | ||
<ifModule mod_rewrite.c> | ||
RewriteEngine On | ||
RewriteBase / | ||
RewriteRule ^index.html$ index.html.php [L] | ||
RewriteCond %{REQUEST_FILENAME} !-f | ||
RewriteCond %{REQUEST_FILENAME} !-d | ||
RewriteCond %{REQUEST_URI} !index | ||
RewriteBase / | ||
RewriteRule ^[^/]+$ index.html [L] | ||
RewriteRule ^[^/]+$ index.html.php [L] | ||
</ifModule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
/* vim: set syn=php: */ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
require_once("parapara.inc"); | ||
require_once("db.inc"); | ||
|
||
// Get the design for a wall given a path | ||
// Currently returns an associative array with only the design name ('name') | ||
function getDesignForWallPath($path) { | ||
$conn =& getDbConnection(); | ||
$res =& $conn->queryRow( | ||
'SELECT name FROM designs' | ||
. ' INNER JOIN walls ON designs.designId = walls.designId' | ||
. ' WHERE walls.urlPath = ' . $conn->quote(rawurlencode($path), 'text') | ||
. ' LIMIT 1', | ||
null, | ||
MDB2_FETCHMODE_ASSOC); | ||
|
||
if (PEAR::isError($res)) { | ||
error_log($res->getMessage() . ', ' . $res->getDebugInfo()); | ||
throw new KeyedException('db-error'); | ||
} | ||
return $res ? $res : null; | ||
} | ||
|
||
function getEditorStyleSheetForDesign($designName) { | ||
// Sanitize designName | ||
$designName = basename($designName); | ||
|
||
// Work out where the stylesheet *should* be | ||
$styleSheetPath = "wall/templates/$designName/editor/editor.css"; | ||
$baseDir = dirname(__FILE__) . '/../public/'; | ||
$fsPath = $baseDir . $styleSheetPath; | ||
|
||
// Check if it exists | ||
return file_exists($fsPath) ? $styleSheetPath : null; | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
div.canvas-background { | ||
background-color: black; | ||
background: url('jimen.png') left bottom repeat-x, | ||
url('space-bg.jpg') black; | ||
background-size: auto 9%, cover; | ||
} |
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
div.canvas-background { | ||
background-color: white; | ||
background: url('tree.png') right -50px bottom no-repeat, | ||
url('mountains.jpg') left 10% top repeat-x, | ||
white; | ||
background-size: auto 70%, auto 60%; | ||
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.