summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.xml13
-rw-r--r--data/config.default.php9
-rw-r--r--data/templates/default/about.tpl.php (renamed from data/templates/about.tpl.php)0
-rw-r--r--data/templates/default/admin.tpl.php (renamed from data/templates/admin.tpl.php)0
-rw-r--r--data/templates/default/bookmarkcommondescriptionedit.tpl.php (renamed from data/templates/bookmarkcommondescriptionedit.tpl.php)0
-rw-r--r--data/templates/default/bookmarklet.inc.php (renamed from data/templates/bookmarklet.inc.php)0
-rw-r--r--data/templates/default/bookmarks-thumbnail.inc.tpl.php (renamed from data/templates/bookmarks-thumbnail.inc.tpl.php)0
-rw-r--r--data/templates/default/bookmarks-vote-horizontal.inc.tpl.php (renamed from data/templates/bookmarks-vote-horizontal.inc.tpl.php)0
-rw-r--r--data/templates/default/bookmarks-vote.inc.tpl.php (renamed from data/templates/bookmarks-vote.inc.tpl.php)0
-rw-r--r--data/templates/default/bookmarks.tpl.php (renamed from data/templates/bookmarks.tpl.php)25
-rw-r--r--data/templates/default/bottom.inc.php (renamed from data/templates/bottom.inc.php)0
-rw-r--r--data/templates/default/dojo.inc.php (renamed from data/templates/dojo.inc.php)0
-rw-r--r--data/templates/default/dynamictags.inc.php (renamed from data/templates/dynamictags.inc.php)0
-rw-r--r--data/templates/default/editbookmark.tpl.php (renamed from data/templates/editbookmark.tpl.php)0
-rw-r--r--data/templates/default/editprofile-sslclientcerts.tpl.php (renamed from data/templates/editprofile-sslclientcerts.tpl.php)0
-rw-r--r--data/templates/default/editprofile.tpl.php (renamed from data/templates/editprofile.tpl.php)0
-rw-r--r--data/templates/default/error.404.tpl.php (renamed from data/templates/error.404.tpl.php)0
-rw-r--r--data/templates/default/error.500.tpl.php (renamed from data/templates/error.500.tpl.php)0
-rw-r--r--data/templates/default/importDelicious.tpl.php (renamed from data/templates/importDelicious.tpl.php)0
-rw-r--r--data/templates/default/importNetscape.tpl.php (renamed from data/templates/importNetscape.tpl.php)0
-rw-r--r--data/templates/default/importStructure.tpl.php (renamed from data/templates/importStructure.tpl.php)0
-rw-r--r--data/templates/default/login.tpl.php (renamed from data/templates/login.tpl.php)0
-rw-r--r--data/templates/default/password.tpl.php (renamed from data/templates/password.tpl.php)0
-rw-r--r--data/templates/default/profile.tpl.php (renamed from data/templates/profile.tpl.php)0
-rw-r--r--data/templates/default/register.tpl.php (renamed from data/templates/register.tpl.php)0
-rw-r--r--data/templates/default/rss.tpl.php (renamed from data/templates/rss.tpl.php)0
-rw-r--r--data/templates/default/search.menu.php (renamed from data/templates/search.menu.php)0
-rw-r--r--data/templates/default/sidebar.block.common.php (renamed from data/templates/sidebar.block.common.php)0
-rw-r--r--data/templates/default/sidebar.block.linked.php (renamed from data/templates/sidebar.block.linked.php)0
-rw-r--r--data/templates/default/sidebar.block.menu.php (renamed from data/templates/sidebar.block.menu.php)0
-rw-r--r--data/templates/default/sidebar.block.menu2.php (renamed from data/templates/sidebar.block.menu2.php)0
-rw-r--r--data/templates/default/sidebar.block.popular.php (renamed from data/templates/sidebar.block.popular.php)0
-rw-r--r--data/templates/default/sidebar.block.recent.php (renamed from data/templates/sidebar.block.recent.php)0
-rw-r--r--data/templates/default/sidebar.block.related.php (renamed from data/templates/sidebar.block.related.php)0
-rw-r--r--data/templates/default/sidebar.block.search.php (renamed from data/templates/sidebar.block.search.php)0
-rw-r--r--data/templates/default/sidebar.block.tagactions.php (renamed from data/templates/sidebar.block.tagactions.php)0
-rw-r--r--data/templates/default/sidebar.block.users.php (renamed from data/templates/sidebar.block.users.php)0
-rw-r--r--data/templates/default/sidebar.block.watchlist.php (renamed from data/templates/sidebar.block.watchlist.php)0
-rw-r--r--data/templates/default/sidebar.block.watchstatus.php (renamed from data/templates/sidebar.block.watchstatus.php)0
-rw-r--r--data/templates/default/sidebar.linkedtags.inc.php (renamed from data/templates/sidebar.linkedtags.inc.php)0
-rw-r--r--data/templates/default/sidebar.tpl.php (renamed from data/templates/sidebar.tpl.php)0
-rw-r--r--data/templates/default/tag2tagadd.tpl.php (renamed from data/templates/tag2tagadd.tpl.php)0
-rw-r--r--data/templates/default/tag2tagdelete.tpl.php (renamed from data/templates/tag2tagdelete.tpl.php)0
-rw-r--r--data/templates/default/tag2tagedit.tpl.php (renamed from data/templates/tag2tagedit.tpl.php)0
-rw-r--r--data/templates/default/tagcommondescriptionedit.tpl.php (renamed from data/templates/tagcommondescriptionedit.tpl.php)0
-rw-r--r--data/templates/default/tagdelete.tpl.php (renamed from data/templates/tagdelete.tpl.php)0
-rw-r--r--data/templates/default/tagedit.tpl.php (renamed from data/templates/tagedit.tpl.php)0
-rw-r--r--data/templates/default/tagrename.tpl.php (renamed from data/templates/tagrename.tpl.php)0
-rw-r--r--data/templates/default/tags.tpl.php (renamed from data/templates/tags.tpl.php)0
-rw-r--r--data/templates/default/toolbar.inc.php (renamed from data/templates/toolbar.inc.php)0
-rw-r--r--data/templates/default/top.inc.php (renamed from data/templates/top.inc.php)4
-rw-r--r--data/templates/default/users.tpl.php (renamed from data/templates/users.tpl.php)0
-rw-r--r--doc/themes.rst39
-rw-r--r--src/SemanticScuttle/Model/Template.php3
-rw-r--r--src/SemanticScuttle/Model/Theme.php97
-rw-r--r--src/SemanticScuttle/Service/Template.php29
-rw-r--r--src/SemanticScuttle/header.php3
-rw-r--r--www/jsScuttle.php5
-rw-r--r--www/themes/default/icon.png (renamed from www/icon.png)bin771 -> 771 bytes
-rw-r--r--www/themes/default/images/b_edit.png (renamed from www/images/b_edit.png)bin451 -> 451 bytes
-rw-r--r--www/themes/default/images/bg_admin.png (renamed from www/images/bg_admin.png)bin1212 -> 1212 bytes
-rw-r--r--www/themes/default/images/bg_bar.png (renamed from www/images/bg_bar.png)bin873 -> 873 bytes
-rw-r--r--www/themes/default/images/bg_header.png (renamed from www/images/bg_header.png)bin684 -> 684 bytes
-rw-r--r--www/themes/default/images/bg_sidebar.png (renamed from www/images/bg_sidebar.png)bin726 -> 726 bytes
-rw-r--r--www/themes/default/images/loading.gif (renamed from www/images/loading.gif)bin1582 -> 1582 bytes
-rw-r--r--www/themes/default/images/logo.png (renamed from www/images/logo.png)bin2973 -> 2973 bytes
-rw-r--r--www/themes/default/images/logo_24.gif (renamed from www/images/logo_24.gif)bin1530 -> 1530 bytes
-rw-r--r--www/themes/default/images/rss.gif (renamed from www/images/rss.gif)bin401 -> 401 bytes
-rw-r--r--www/themes/default/images/thumbs_up.orig.png (renamed from www/images/thumbs_up.orig.png)bin19257 -> 19257 bytes
-rw-r--r--www/themes/default/images/vote-against-voted.png (renamed from www/images/vote-against-voted.png)bin419 -> 419 bytes
-rw-r--r--www/themes/default/images/vote-against.png (renamed from www/images/vote-against.png)bin495 -> 495 bytes
-rw-r--r--www/themes/default/images/vote-for-voted.png (renamed from www/images/vote-for-voted.png)bin415 -> 415 bytes
-rw-r--r--www/themes/default/images/vote-for.png (renamed from www/images/vote-for.png)bin625 -> 625 bytes
-rw-r--r--www/themes/default/scuttle.css (renamed from www/scuttle.css)0
74 files changed, 208 insertions, 19 deletions
diff --git a/build.xml b/build.xml
index 9773a63..7b3896b 100644
--- a/build.xml
+++ b/build.xml
@@ -121,18 +121,19 @@
<replacement
path="src/SemanticScuttle/header.php"
- type="pear-config"
- from="@data_dir@" to="data_dir"
+ type="pear-config" from="@data_dir@" to="data_dir"
+ />
+ <replacement
+ path="src/SemanticScuttle/header.php"
+ type="pear-config" from="@www_dir@" to="www_dir"
/>
<replacement
path="www/www-header.php"
- type="pear-config"
- from="@data_dir@" to="data_dir"
+ type="pear-config" from="@data_dir@" to="data_dir"
/>
<replacement
path="tests/prepare.php"
- type="pear-config"
- from="@data_dir@" to="data_dir"
+ type="pear-config" from="@data_dir@" to="data_dir"
/>
<changelog version="0.97" date="2010-06-09" license="GPL">
diff --git a/data/config.default.php b/data/config.default.php
index 8c47e0b..c850521 100644
--- a/data/config.default.php
+++ b/data/config.default.php
@@ -63,6 +63,15 @@ $sidebarTopMessage = '';
*/
$sidebarBottomMessage = '';
+/**
+ * The HTML theme to use. With themes, you can give your semanticscuttle
+ * installation a new look.
+ *
+ * Themes are the folders in data/templates/
+ *
+ * @var string
+ */
+$theme = 'default';
/***************************************************
diff --git a/data/templates/about.tpl.php b/data/templates/default/about.tpl.php
index 7bff98d..7bff98d 100644
--- a/data/templates/about.tpl.php
+++ b/data/templates/default/about.tpl.php
diff --git a/data/templates/admin.tpl.php b/data/templates/default/admin.tpl.php
index 50680f6..50680f6 100644
--- a/data/templates/admin.tpl.php
+++ b/data/templates/default/admin.tpl.php
diff --git a/data/templates/bookmarkcommondescriptionedit.tpl.php b/data/templates/default/bookmarkcommondescriptionedit.tpl.php
index 807c58b..807c58b 100644
--- a/data/templates/bookmarkcommondescriptionedit.tpl.php
+++ b/data/templates/default/bookmarkcommondescriptionedit.tpl.php
diff --git a/data/templates/bookmarklet.inc.php b/data/templates/default/bookmarklet.inc.php
index 9867745..9867745 100644
--- a/data/templates/bookmarklet.inc.php
+++ b/data/templates/default/bookmarklet.inc.php
diff --git a/data/templates/bookmarks-thumbnail.inc.tpl.php b/data/templates/default/bookmarks-thumbnail.inc.tpl.php
index 200b8f7..200b8f7 100644
--- a/data/templates/bookmarks-thumbnail.inc.tpl.php
+++ b/data/templates/default/bookmarks-thumbnail.inc.tpl.php
diff --git a/data/templates/bookmarks-vote-horizontal.inc.tpl.php b/data/templates/default/bookmarks-vote-horizontal.inc.tpl.php
index c4a9f8e..c4a9f8e 100644
--- a/data/templates/bookmarks-vote-horizontal.inc.tpl.php
+++ b/data/templates/default/bookmarks-vote-horizontal.inc.tpl.php
diff --git a/data/templates/bookmarks-vote.inc.tpl.php b/data/templates/default/bookmarks-vote.inc.tpl.php
index 41572d5..41572d5 100644
--- a/data/templates/bookmarks-vote.inc.tpl.php
+++ b/data/templates/default/bookmarks-vote.inc.tpl.php
diff --git a/data/templates/bookmarks.tpl.php b/data/templates/default/bookmarks.tpl.php
index 55d6a0f..91d50bf 100644
--- a/data/templates/bookmarks.tpl.php
+++ b/data/templates/default/bookmarks.tpl.php
@@ -39,7 +39,9 @@ include('search.menu.php');
<?php if($GLOBALS['enableAdminColors']!=false && isset($userid) && $userservice->isAdmin($userid) && $pageName != PAGE_WATCHLIST) : ?>
<div style="width:70%;text-align:center;">
-<img src="<?php echo ROOT ?>images/logo_24.gif" width="12px"/> <?php echo T_('Bookmarks on this page are managed by an admin user.'); ?><img src="<?php echo ROOT ?>images/logo_24.gif" width="12px"/>
+ <img src="<?php $theme->resource('images/logo_24.gif'); ?>" width="12px"/>
+ <?php echo T_('Bookmarks on this page are managed by an admin user.'); ?>
+ <img src="<?php $theme->resource('images/logo_24.gif'); ?>" width="12px"/>
</div>
<?php endif?>
@@ -70,7 +72,7 @@ if ($userservice->isLoggedOn()) {
) {
echo ' <a href="'. createURL('tagcommondescriptionedit', $currenttag).'" title="'.T_('Edit the common description of this tag').'">';
echo !is_array($cDescription) || strlen($cDescription['cdDescription'])==0?T_('Edit the common description of this tag'):'';
- echo ' <img src="'.ROOT.'images/b_edit.png" /></a>';
+ echo ' <img src="' . $theme->resource('images/b_edit.png') . '" /></a>';
} else if (isset($hash)) {
echo ' (<a href="'.createURL('bookmarkcommondescriptionedit', $hash).'" title="'.T_('Edit the common description of this bookmark').'">';
echo T_('Edit the common description of this bookmark').'</a>)';
@@ -95,7 +97,7 @@ if($userservice->isLoggedOn()) {
if($currenttag!= '') {
echo ' <a href="'. createURL('tagedit', $currenttag).'" title="'.T_('Edit your personal description of this tag').'" >';
echo strlen($pDescription['tDescription'])==0?T_('Edit your personal description of this tag'):'';
- echo ' <img src="'.ROOT.'images/b_edit.png" /></a>';
+ echo ' <img src="' . $theme->resource('images/b_edit.png') . '" /></a>';
}
}
?></p>
@@ -219,9 +221,12 @@ if ($currenttag!= '') {
$brss = '';
$size = count($rsschannels);
for ($i = 0; $i < $size; $i++) {
- $brss = '<a style="background:#FFFFFF" href="'. htmlspecialchars($rsschannels[$i][1]) . '"'
+ $brss = '<a style="background:#FFFFFF"'
+ . ' href="'. htmlspecialchars($rsschannels[$i][1]) . '"'
. ' title="' . htmlspecialchars($rsschannels[$i][0]) . '">'
- . '<img src="' . ROOT . 'images/rss.gif" width="16" height="16" alt="' . htmlspecialchars($rsschannels[$i][0]) .'"/>'
+ . '<img src="' . $theme->resource('images/rss.gif') . '"'
+ . ' width="16" height="16"'
+ . ' alt="' . htmlspecialchars($rsschannels[$i][0]) .'"/>'
. '</a>';
}
@@ -361,9 +366,15 @@ if ($currenttag!= '') {
}
// Admin specific design
- if ($userservice->isAdmin($row['username']) && $GLOBALS['enableAdminColors']) {
+ if ($userservice->isAdmin($row['username'])
+ && $GLOBALS['enableAdminColors']
+ ) {
$adminBgClass = ' class="adminBackground"';
- $adminStar = ' <img src="'. ROOT .'images/logo_24.gif" width="12px" title="'. T_('This bookmark is certified by an admin user.') .'" />';
+ $adminStar = ' <img'
+ . ' src="' . $theme->resource('images/logo_24.gif') . '"'
+ . ' width="12px"'
+ . ' title="' . T_('This bookmark is certified by an admin user.') . '"'
+ . '/>';
} else {
$adminBgClass = '';
$adminStar = '';
diff --git a/data/templates/bottom.inc.php b/data/templates/default/bottom.inc.php
index 0c966a2..0c966a2 100644
--- a/data/templates/bottom.inc.php
+++ b/data/templates/default/bottom.inc.php
diff --git a/data/templates/dojo.inc.php b/data/templates/default/dojo.inc.php
index 366dcfe..366dcfe 100644
--- a/data/templates/dojo.inc.php
+++ b/data/templates/default/dojo.inc.php
diff --git a/data/templates/dynamictags.inc.php b/data/templates/default/dynamictags.inc.php
index 8cf07c1..8cf07c1 100644
--- a/data/templates/dynamictags.inc.php
+++ b/data/templates/default/dynamictags.inc.php
diff --git a/data/templates/editbookmark.tpl.php b/data/templates/default/editbookmark.tpl.php
index 8b71230..8b71230 100644
--- a/data/templates/editbookmark.tpl.php
+++ b/data/templates/default/editbookmark.tpl.php
diff --git a/data/templates/editprofile-sslclientcerts.tpl.php b/data/templates/default/editprofile-sslclientcerts.tpl.php
index 900c193..900c193 100644
--- a/data/templates/editprofile-sslclientcerts.tpl.php
+++ b/data/templates/default/editprofile-sslclientcerts.tpl.php
diff --git a/data/templates/editprofile.tpl.php b/data/templates/default/editprofile.tpl.php
index cc74f04..cc74f04 100644
--- a/data/templates/editprofile.tpl.php
+++ b/data/templates/default/editprofile.tpl.php
diff --git a/data/templates/error.404.tpl.php b/data/templates/default/error.404.tpl.php
index fe9401d..fe9401d 100644
--- a/data/templates/error.404.tpl.php
+++ b/data/templates/default/error.404.tpl.php
diff --git a/data/templates/error.500.tpl.php b/data/templates/default/error.500.tpl.php
index 1d7f7ae..1d7f7ae 100644
--- a/data/templates/error.500.tpl.php
+++ b/data/templates/default/error.500.tpl.php
diff --git a/data/templates/importDelicious.tpl.php b/data/templates/default/importDelicious.tpl.php
index bc4d892..bc4d892 100644
--- a/data/templates/importDelicious.tpl.php
+++ b/data/templates/default/importDelicious.tpl.php
diff --git a/data/templates/importNetscape.tpl.php b/data/templates/default/importNetscape.tpl.php
index 627a5af..627a5af 100644
--- a/data/templates/importNetscape.tpl.php
+++ b/data/templates/default/importNetscape.tpl.php
diff --git a/data/templates/importStructure.tpl.php b/data/templates/default/importStructure.tpl.php
index 9c54612..9c54612 100644
--- a/data/templates/importStructure.tpl.php
+++ b/data/templates/default/importStructure.tpl.php
diff --git a/data/templates/login.tpl.php b/data/templates/default/login.tpl.php
index e67808d..e67808d 100644
--- a/data/templates/login.tpl.php
+++ b/data/templates/default/login.tpl.php
diff --git a/data/templates/password.tpl.php b/data/templates/default/password.tpl.php
index 55dbed6..55dbed6 100644
--- a/data/templates/password.tpl.php
+++ b/data/templates/default/password.tpl.php
diff --git a/data/templates/profile.tpl.php b/data/templates/default/profile.tpl.php
index 1e2003a..1e2003a 100644
--- a/data/templates/profile.tpl.php
+++ b/data/templates/default/profile.tpl.php
diff --git a/data/templates/register.tpl.php b/data/templates/default/register.tpl.php
index 62cebad..62cebad 100644
--- a/data/templates/register.tpl.php
+++ b/data/templates/default/register.tpl.php
diff --git a/data/templates/rss.tpl.php b/data/templates/default/rss.tpl.php
index e6e66f7..e6e66f7 100644
--- a/data/templates/rss.tpl.php
+++ b/data/templates/default/rss.tpl.php
diff --git a/data/templates/search.menu.php b/data/templates/default/search.menu.php
index 5a8f027..5a8f027 100644
--- a/data/templates/search.menu.php
+++ b/data/templates/default/search.menu.php
diff --git a/data/templates/sidebar.block.common.php b/data/templates/default/sidebar.block.common.php
index 951ed80..951ed80 100644
--- a/data/templates/sidebar.block.common.php
+++ b/data/templates/default/sidebar.block.common.php
diff --git a/data/templates/sidebar.block.linked.php b/data/templates/default/sidebar.block.linked.php
index 9aa3cc0..9aa3cc0 100644
--- a/data/templates/sidebar.block.linked.php
+++ b/data/templates/default/sidebar.block.linked.php
diff --git a/data/templates/sidebar.block.menu.php b/data/templates/default/sidebar.block.menu.php
index 94a9fa2..94a9fa2 100644
--- a/data/templates/sidebar.block.menu.php
+++ b/data/templates/default/sidebar.block.menu.php
diff --git a/data/templates/sidebar.block.menu2.php b/data/templates/default/sidebar.block.menu2.php
index 1c177a5..1c177a5 100644
--- a/data/templates/sidebar.block.menu2.php
+++ b/data/templates/default/sidebar.block.menu2.php
diff --git a/data/templates/sidebar.block.popular.php b/data/templates/default/sidebar.block.popular.php
index 50756c0..50756c0 100644
--- a/data/templates/sidebar.block.popular.php
+++ b/data/templates/default/sidebar.block.popular.php
diff --git a/data/templates/sidebar.block.recent.php b/data/templates/default/sidebar.block.recent.php
index 1ffeb4d..1ffeb4d 100644
--- a/data/templates/sidebar.block.recent.php
+++ b/data/templates/default/sidebar.block.recent.php
diff --git a/data/templates/sidebar.block.related.php b/data/templates/default/sidebar.block.related.php
index 60ee486..60ee486 100644
--- a/data/templates/sidebar.block.related.php
+++ b/data/templates/default/sidebar.block.related.php
diff --git a/data/templates/sidebar.block.search.php b/data/templates/default/sidebar.block.search.php
index d3cd8a5..d3cd8a5 100644
--- a/data/templates/sidebar.block.search.php
+++ b/data/templates/default/sidebar.block.search.php
diff --git a/data/templates/sidebar.block.tagactions.php b/data/templates/default/sidebar.block.tagactions.php
index 3351866..3351866 100644
--- a/data/templates/sidebar.block.tagactions.php
+++ b/data/templates/default/sidebar.block.tagactions.php
diff --git a/data/templates/sidebar.block.users.php b/data/templates/default/sidebar.block.users.php
index 58fdfb7..58fdfb7 100644
--- a/data/templates/sidebar.block.users.php
+++ b/data/templates/default/sidebar.block.users.php
diff --git a/data/templates/sidebar.block.watchlist.php b/data/templates/default/sidebar.block.watchlist.php
index 3af9c5a..3af9c5a 100644
--- a/data/templates/sidebar.block.watchlist.php
+++ b/data/templates/default/sidebar.block.watchlist.php
diff --git a/data/templates/sidebar.block.watchstatus.php b/data/templates/default/sidebar.block.watchstatus.php
index 99574aa..99574aa 100644
--- a/data/templates/sidebar.block.watchstatus.php
+++ b/data/templates/default/sidebar.block.watchstatus.php
diff --git a/data/templates/sidebar.linkedtags.inc.php b/data/templates/default/sidebar.linkedtags.inc.php
index 020d0f0..020d0f0 100644
--- a/data/templates/sidebar.linkedtags.inc.php
+++ b/data/templates/default/sidebar.linkedtags.inc.php
diff --git a/data/templates/sidebar.tpl.php b/data/templates/default/sidebar.tpl.php
index e823af5..e823af5 100644
--- a/data/templates/sidebar.tpl.php
+++ b/data/templates/default/sidebar.tpl.php
diff --git a/data/templates/tag2tagadd.tpl.php b/data/templates/default/tag2tagadd.tpl.php
index 9482007..9482007 100644
--- a/data/templates/tag2tagadd.tpl.php
+++ b/data/templates/default/tag2tagadd.tpl.php
diff --git a/data/templates/tag2tagdelete.tpl.php b/data/templates/default/tag2tagdelete.tpl.php
index 8018374..8018374 100644
--- a/data/templates/tag2tagdelete.tpl.php
+++ b/data/templates/default/tag2tagdelete.tpl.php
diff --git a/data/templates/tag2tagedit.tpl.php b/data/templates/default/tag2tagedit.tpl.php
index 4745ad2..4745ad2 100644
--- a/data/templates/tag2tagedit.tpl.php
+++ b/data/templates/default/tag2tagedit.tpl.php
diff --git a/data/templates/tagcommondescriptionedit.tpl.php b/data/templates/default/tagcommondescriptionedit.tpl.php
index 207cfd2..207cfd2 100644
--- a/data/templates/tagcommondescriptionedit.tpl.php
+++ b/data/templates/default/tagcommondescriptionedit.tpl.php
diff --git a/data/templates/tagdelete.tpl.php b/data/templates/default/tagdelete.tpl.php
index e787ff5..e787ff5 100644
--- a/data/templates/tagdelete.tpl.php
+++ b/data/templates/default/tagdelete.tpl.php
diff --git a/data/templates/tagedit.tpl.php b/data/templates/default/tagedit.tpl.php
index 860c933..860c933 100644
--- a/data/templates/tagedit.tpl.php
+++ b/data/templates/default/tagedit.tpl.php
diff --git a/data/templates/tagrename.tpl.php b/data/templates/default/tagrename.tpl.php
index 894b964..894b964 100644
--- a/data/templates/tagrename.tpl.php
+++ b/data/templates/default/tagrename.tpl.php
diff --git a/data/templates/tags.tpl.php b/data/templates/default/tags.tpl.php
index d6259cc..d6259cc 100644
--- a/data/templates/tags.tpl.php
+++ b/data/templates/default/tags.tpl.php
diff --git a/data/templates/toolbar.inc.php b/data/templates/default/toolbar.inc.php
index fb6638d..fb6638d 100644
--- a/data/templates/toolbar.inc.php
+++ b/data/templates/default/toolbar.inc.php
diff --git a/data/templates/top.inc.php b/data/templates/default/top.inc.php
index bdd4b1a..9eed6ff 100644
--- a/data/templates/top.inc.php
+++ b/data/templates/default/top.inc.php
@@ -4,8 +4,8 @@
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
<title><?php echo filter($GLOBALS['sitename'] .(isset($pagetitle) ? ' ยป ' . $pagetitle : '')); ?></title>
- <link rel="icon" type="image/png" href="<?php echo ROOT ?>icon.png" />
- <link rel="stylesheet" type="text/css" href="<?php echo ROOT ?>scuttle.css" />
+ <link rel="icon" type="image/png" href="<?php echo $theme->resource('icon.png');?>" />
+ <link rel="stylesheet" type="text/css" href="<?php echo $theme->resource('scuttle.css');?>" />
<link rel="search" type="application/opensearchdescription+xml" href="<?php echo ROOT ?>api/opensearch.php" title="<?php echo htmlspecialchars($GLOBALS['sitename']) ?>"/>
<?php
if (isset($rsschannels)) {
diff --git a/data/templates/users.tpl.php b/data/templates/default/users.tpl.php
index fa92bef..fa92bef 100644
--- a/data/templates/users.tpl.php
+++ b/data/templates/default/users.tpl.php
diff --git a/doc/themes.rst b/doc/themes.rst
new file mode 100644
index 0000000..7c40ef2
--- /dev/null
+++ b/doc/themes.rst
@@ -0,0 +1,39 @@
+======================
+SemanticScuttle Themes
+======================
+SemanticScuttle may be changed visually by supplying custom "themes" that
+modify the visual appearance.
+
+
+Changing the current theme
+==========================
+In ``data/config.php``, set your theme like this: ::
+
+ $theme = 'darkmood';
+
+
+Creating your own theme
+=======================
+
+CSS and image files
+-------------------
+Since both file types need to be accessible via the web server directly,
+they are located in the ``www/`` folder: ::
+
+ www/themes/$themename/
+
+The main CSS file that automatically gets included is ::
+
+ www/themes/$themename/scuttle.css
+
+
+Template files
+--------------
+The templates of the default file are located in ::
+
+ data/templates/default/
+
+You may put your theme template files into ::
+
+ data/templates/$themename/
+
diff --git a/src/SemanticScuttle/Model/Template.php b/src/SemanticScuttle/Model/Template.php
index ff5fbbe..234e23f 100644
--- a/src/SemanticScuttle/Model/Template.php
+++ b/src/SemanticScuttle/Model/Template.php
@@ -76,6 +76,9 @@ class SemanticScuttle_Model_Template
* Sets variables and includes the template file,
* causing it to be rendered.
*
+ * Does not take care of themes and so.
+ * The include path must be set so the correct theme is used.
+ *
* @return void
*/
public function parse()
diff --git a/src/SemanticScuttle/Model/Theme.php b/src/SemanticScuttle/Model/Theme.php
new file mode 100644
index 0000000..65861b8
--- /dev/null
+++ b/src/SemanticScuttle/Model/Theme.php
@@ -0,0 +1,97 @@
+<?php
+/**
+ * SemanticScuttle - your social bookmark manager.
+ *
+ * PHP version 5.
+ *
+ * @category Bookmarking
+ * @package SemanticScuttle
+ * @author Christian Weiske <cweiske@cweiske.de>
+ * @license AGPL v3 or later http://www.gnu.org/licenses/agpl.html
+ * @link http://sourceforge.net/projects/semanticscuttle
+ */
+
+/**
+ * A theme, the visual representation of SemanticScuttle.
+ *
+ * @category Bookmarking
+ * @package SemanticScuttle
+ * @author Christian Weiske <cweiske@cweiske.de>
+ * @license AGPL v3 or later http://www.gnu.org/licenses/agpl.html
+ * @link http://sourceforge.net/projects/semanticscuttle
+ */
+class SemanticScuttle_Model_Theme
+{
+ /**
+ * Theme name. Also the path part of template and resource files
+ *
+ * @var string
+ */
+ protected $name = null;
+
+ /**
+ * Local path to the www themes directory.
+ * Needs to have a trailing slash.
+ *
+ * @var string
+ */
+ protected $wwwThemeDir = null;
+
+
+
+ /**
+ * Create a new theme instance.
+ *
+ * @param string $name Theme name "data/templates/(*)/"
+ */
+ public function __construct($name = 'default')
+ {
+ $this->name = $name;
+ $this->wwwThemeDir = $GLOBALS['wwwdir'] . '/themes/';
+ //TODO: implement theme hierarchies with parent fallback
+ }
+
+
+
+ /**
+ * Returns the URL path to a resource file (www/themes/$name/$file).
+ * Automatically falls back to the parent theme if the file does not exist
+ * in the theme.
+ *
+ * Must always be used when adding i.e. images to the output.
+ *
+ * @param string $file File name to find the path for, i.e. "scuttle.css".
+ *
+ * @return string Full path
+ */
+ public function resource($file)
+ {
+ $themeFile = $this->wwwThemeDir . $this->name . '/' . $file;
+ if (file_exists($themeFile)) {
+ return ROOT . 'themes/' . $this->name . '/' . $file;
+ }
+
+ $defaultFile = $this->wwwThemeDir . 'default/' . $file;
+ if (file_exists($defaultFile)) {
+ return ROOT . 'themes/default/' . $file;
+ }
+
+ //file does not exist. fall back to the theme file
+ // to guide the theme author a bit.
+ // TODO: logging. in admin mode, there should be a message
+ return ROOT . 'themes/' . $this->name . '/' . $file;
+ }
+
+
+
+ /**
+ * Returns the theme name.
+ *
+ * @return string Theme name
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+}
+?> \ No newline at end of file
diff --git a/src/SemanticScuttle/Service/Template.php b/src/SemanticScuttle/Service/Template.php
index efa8d28..b5d4cfa 100644
--- a/src/SemanticScuttle/Service/Template.php
+++ b/src/SemanticScuttle/Service/Template.php
@@ -14,6 +14,7 @@
*/
require_once 'SemanticScuttle/Model/Template.php';
+require_once 'SemanticScuttle/Model/Theme.php';
/**
* SemanticScuttle template service.
@@ -38,6 +39,14 @@ class SemanticScuttle_Service_Template extends SemanticScuttle_Service
*/
protected $basedir;
+ /**
+ * The template theme to use.
+ * Set in constructor based on $GLOBALS['theme']
+ *
+ * @var SemanticScuttle_Model_Theme
+ */
+ protected $theme;
+
/**
@@ -64,6 +73,8 @@ class SemanticScuttle_Service_Template extends SemanticScuttle_Service
protected function __construct()
{
$this->basedir = $GLOBALS['TEMPLATES_DIR'];
+ $this->theme = new SemanticScuttle_Model_Theme($GLOBALS['theme']);
+ //FIXME: verify the theme exists
}
@@ -74,19 +85,33 @@ class SemanticScuttle_Service_Template extends SemanticScuttle_Service
* @param string $template Template filename relative
* to template dir
* @param array $vars Array of template variables.
+ * The current theme object will be added
+ * automatically with name "theme".
*
* @return SemanticScuttle_Model_Template Template object
*/
- function loadTemplate($template, $vars = null)
+ public function loadTemplate($template, $vars = null)
{
if (substr($template, -4) != '.php') {
$template .= '.php';
}
+
+ $oldIncPath = get_include_path();
+ set_include_path(
+ $this->basedir . $this->theme->getName()
+ . PATH_SEPARATOR . $this->basedir . 'default'
+ //needed since services are instantiated in templates
+ . PATH_SEPARATOR . $oldIncPath
+ );
+
+ $vars['theme'] = $this->theme;
$tpl = new SemanticScuttle_Model_Template(
- $this->basedir .'/'. $template, $vars, $this
+ $template, $vars, $this
);
$tpl->parse();
+ set_include_path($oldIncPath);
+
return $tpl;
}
}
diff --git a/src/SemanticScuttle/header.php b/src/SemanticScuttle/header.php
index 098e5c3..6c0d4df 100644
--- a/src/SemanticScuttle/header.php
+++ b/src/SemanticScuttle/header.php
@@ -18,9 +18,12 @@
if ('@data_dir@' == '@' . 'data_dir@') {
//non pear-install
$datadir = dirname(__FILE__) . '/../../data/';
+ $wwwdir = dirname(__FILE__) . '/../../www/';
} else {
//pear installation; files are in include path
$datadir = '@data_dir@/SemanticScuttle/';
+ //FIXME: when you have multiple installations, the www_dir will be wrong
+ $wwwdir = '@www_dir@/SemanticScuttle/';
}
if (!file_exists($datadir . '/config.php')) {
diff --git a/www/jsScuttle.php b/www/jsScuttle.php
index c166755..5e5f31b 100644
--- a/www/jsScuttle.php
+++ b/www/jsScuttle.php
@@ -3,6 +3,7 @@ $GLOBALS['saveInLastUrl'] = false;
$httpContentType = 'text/javascript';
require_once 'www-header.php';
require_once 'SemanticScuttle/functions.php';
+$theme = new SemanticScuttle_Model_Theme($GLOBALS['theme']);
$player_root = ROOT .'includes/player/';
?>
@@ -62,7 +63,7 @@ function isAvailable(input, response){
username = username.trim();
var availability = document.getElementById("availability");
if (username != '') {
- usernameField.style.backgroundImage = 'url(<?php echo ROOT; ?>images/loading.gif)';
+ usernameField.style.backgroundImage = 'url(<?php echo $theme->resource('images/loading.gif'); ?>)';
if (response != '') {
usernameField.style.backgroundImage = 'none';
if (response == 'true') {
@@ -92,7 +93,7 @@ function useAddress(ele) {
function getTitle(input, response){
var title = document.getElementById('titleField');
if (title.value == '') {
- title.style.backgroundImage = 'url(<?php echo ROOT; ?>images/loading.gif)';
+ title.style.backgroundImage = 'url(<?php echo $theme->resource('images/loading.gif');?>)';
if (response != null) {
title.style.backgroundImage = 'none';
title.value = response;
diff --git a/www/icon.png b/www/themes/default/icon.png
index be864a7..be864a7 100644
--- a/www/icon.png
+++ b/www/themes/default/icon.png
Binary files differ
diff --git a/www/images/b_edit.png b/www/themes/default/images/b_edit.png
index 05711a0..05711a0 100644
--- a/www/images/b_edit.png
+++ b/www/themes/default/images/b_edit.png
Binary files differ
diff --git a/www/images/bg_admin.png b/www/themes/default/images/bg_admin.png
index c707779..c707779 100644
--- a/www/images/bg_admin.png
+++ b/www/themes/default/images/bg_admin.png
Binary files differ
diff --git a/www/images/bg_bar.png b/www/themes/default/images/bg_bar.png
index 7152ba1..7152ba1 100644
--- a/www/images/bg_bar.png
+++ b/www/themes/default/images/bg_bar.png
Binary files differ
diff --git a/www/images/bg_header.png b/www/themes/default/images/bg_header.png
index 6fa4161..6fa4161 100644
--- a/www/images/bg_header.png
+++ b/www/themes/default/images/bg_header.png
Binary files differ
diff --git a/www/images/bg_sidebar.png b/www/themes/default/images/bg_sidebar.png
index 0edb153..0edb153 100644
--- a/www/images/bg_sidebar.png
+++ b/www/themes/default/images/bg_sidebar.png
Binary files differ
diff --git a/www/images/loading.gif b/www/themes/default/images/loading.gif
index 859126e..859126e 100644
--- a/www/images/loading.gif
+++ b/www/themes/default/images/loading.gif
Binary files differ
diff --git a/www/images/logo.png b/www/themes/default/images/logo.png
index 4afe565..4afe565 100644
--- a/www/images/logo.png
+++ b/www/themes/default/images/logo.png
Binary files differ
diff --git a/www/images/logo_24.gif b/www/themes/default/images/logo_24.gif
index d5af64d..d5af64d 100644
--- a/www/images/logo_24.gif
+++ b/www/themes/default/images/logo_24.gif
Binary files differ
diff --git a/www/images/rss.gif b/www/themes/default/images/rss.gif
index 094ba10..094ba10 100644
--- a/www/images/rss.gif
+++ b/www/themes/default/images/rss.gif
Binary files differ
diff --git a/www/images/thumbs_up.orig.png b/www/themes/default/images/thumbs_up.orig.png
index 1a89d0e..1a89d0e 100644
--- a/www/images/thumbs_up.orig.png
+++ b/www/themes/default/images/thumbs_up.orig.png
Binary files differ
diff --git a/www/images/vote-against-voted.png b/www/themes/default/images/vote-against-voted.png
index 740dfc8..740dfc8 100644
--- a/www/images/vote-against-voted.png
+++ b/www/themes/default/images/vote-against-voted.png
Binary files differ
diff --git a/www/images/vote-against.png b/www/themes/default/images/vote-against.png
index f15ea4d..f15ea4d 100644
--- a/www/images/vote-against.png
+++ b/www/themes/default/images/vote-against.png
Binary files differ
diff --git a/www/images/vote-for-voted.png b/www/themes/default/images/vote-for-voted.png
index 5abd43e..5abd43e 100644
--- a/www/images/vote-for-voted.png
+++ b/www/themes/default/images/vote-for-voted.png
Binary files differ
diff --git a/www/images/vote-for.png b/www/themes/default/images/vote-for.png
index 5973ae9..5973ae9 100644
--- a/www/images/vote-for.png
+++ b/www/themes/default/images/vote-for.png
Binary files differ
diff --git a/www/scuttle.css b/www/themes/default/scuttle.css
index 9e87857..9e87857 100644
--- a/www/scuttle.css
+++ b/www/themes/default/scuttle.css