diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2011-05-25 19:43:36 +0200 | 
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2011-05-25 19:43:36 +0200 | 
| commit | 5ba53394fcda4ae9cfa9af52b37fb67517deeb5a (patch) | |
| tree | 4416be7903a2b339382e9f933284f50797edc239 | |
| parent | 63b0a4b8cb38a8a7c41410900b9dfcc84e6a33a9 (diff) | |
| download | semanticscuttle-5ba53394fcda4ae9cfa9af52b37fb67517deeb5a.tar.gz semanticscuttle-5ba53394fcda4ae9cfa9af52b37fb67517deeb5a.tar.bz2  | |
implement request #1989987: theme support. merge themes branch with --squash
| -rw-r--r-- | build.xml | 13 | ||||
| -rw-r--r-- | data/config.default.php | 9 | ||||
| -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-- | data/templates/testdummy/top.inc.php | 66 | ||||
| -rw-r--r-- | doc/ChangeLog | 3 | ||||
| -rw-r--r-- | doc/themes.rst | 48 | ||||
| -rw-r--r-- | src/SemanticScuttle/Model/Template.php | 3 | ||||
| -rw-r--r-- | src/SemanticScuttle/Model/Theme.php | 97 | ||||
| -rw-r--r-- | src/SemanticScuttle/Service/Template.php | 29 | ||||
| -rw-r--r-- | src/SemanticScuttle/header.php | 3 | ||||
| -rw-r--r-- | www/jsScuttle.php | 5 | ||||
| -rw-r--r-- | www/themes/default/icon.png (renamed from www/icon.png) | bin | 771 -> 771 bytes | |||
| -rw-r--r-- | www/themes/default/images/b_edit.png (renamed from www/images/b_edit.png) | bin | 451 -> 451 bytes | |||
| -rw-r--r-- | www/themes/default/images/bg_admin.png (renamed from www/images/bg_admin.png) | bin | 1212 -> 1212 bytes | |||
| -rw-r--r-- | www/themes/default/images/bg_bar.png (renamed from www/images/bg_bar.png) | bin | 873 -> 873 bytes | |||
| -rw-r--r-- | www/themes/default/images/bg_header.png (renamed from www/images/bg_header.png) | bin | 684 -> 684 bytes | |||
| -rw-r--r-- | www/themes/default/images/bg_sidebar.png (renamed from www/images/bg_sidebar.png) | bin | 726 -> 726 bytes | |||
| -rw-r--r-- | www/themes/default/images/loading.gif (renamed from www/images/loading.gif) | bin | 1582 -> 1582 bytes | |||
| -rw-r--r-- | www/themes/default/images/logo.png (renamed from www/images/logo.png) | bin | 2973 -> 2973 bytes | |||
| -rw-r--r-- | www/themes/default/images/logo_24.gif (renamed from www/images/logo_24.gif) | bin | 1530 -> 1530 bytes | |||
| -rw-r--r-- | www/themes/default/images/rss.gif (renamed from www/images/rss.gif) | bin | 401 -> 401 bytes | |||
| -rw-r--r-- | www/themes/default/images/thumbs_up.orig.png (renamed from www/images/thumbs_up.orig.png) | bin | 19257 -> 19257 bytes | |||
| -rw-r--r-- | www/themes/default/images/vote-against-voted.png (renamed from www/images/vote-against-voted.png) | bin | 419 -> 419 bytes | |||
| -rw-r--r-- | www/themes/default/images/vote-against.png (renamed from www/images/vote-against.png) | bin | 495 -> 495 bytes | |||
| -rw-r--r-- | www/themes/default/images/vote-for-voted.png (renamed from www/images/vote-for-voted.png) | bin | 415 -> 415 bytes | |||
| -rw-r--r-- | www/themes/default/images/vote-for.png (renamed from www/images/vote-for.png) | bin | 625 -> 625 bytes | |||
| -rw-r--r-- | www/themes/default/scuttle.css (renamed from www/scuttle.css) | 0 | ||||
| -rw-r--r-- | www/themes/testdummy/images/logo.png | bin | 0 -> 2890 bytes | |||
| -rw-r--r-- | www/themes/testdummy/scuttle.css | 12 | 
78 files changed, 298 insertions, 19 deletions
@@ -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/data/templates/testdummy/top.inc.php b/data/templates/testdummy/top.inc.php new file mode 100644 index 0000000..7b0874c --- /dev/null +++ b/data/templates/testdummy/top.inc.php @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> + <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 $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)) { +	$size = count($rsschannels); +	for ($i = 0; $i < $size; $i++) { +		echo '  <link rel="alternate" type="application/rss+xml" title="' +            . htmlspecialchars($rsschannels[$i][0]) . '"' +            . ' href="'. $rsschannels[$i][1] .'" />'; +	} +} +?> + +<?php if (isset($loadjs)) :?> +<?php if (DEBUG_MODE) : ?> +  <script type="text/javascript" src="<?php echo ROOT_JS ?>jquery-1.4.2.js"></script> +  <script type="text/javascript" src="<?php echo ROOT_JS ?>jquery.jstree.js"></script> +<?php else: ?> +  <script type="text/javascript" src="<?php echo ROOT_JS ?>jquery-1.4.2.min.js"></script> +  <script type="text/javascript" src="<?php echo ROOT_JS ?>jquery.jstree.min.js"></script> +<?php endif ?> +  <script type="text/javascript" src="<?php echo ROOT ?>jsScuttle.php"></script> +<?php endif ?> + + </head> + <body> + +<?php +$headerstyle = ''; +if(isset($_GET['popup'])) { +	$headerstyle = ' class="popup"'; +} +?> + +<div id="header" <?php echo $headerstyle; ?>> +<h1><a href="<?php echo ROOT ?>">.</a></h1> +<?php +if(!isset($_GET['popup'])) { +	$this->includeTemplate('toolbar.inc'); +} +?></div> + +<?php +if (isset($subtitle)) { +	echo '<h2>'. $subtitle ."</h2>\n"; +} +if(DEBUG_MODE) { +	echo '<p class="error">'. T_('Admins, your installation is in "Debug Mode" ($debugMode = true). To go in "Normal Mode" and hide debugging messages, change $debugMode to false into config.php.') ."</p>\n"; +} +if (isset($error) && $error!='') { +	echo '<p class="error">'. $error ."</p>\n"; +} +if (isset($msg) && $msg!='') { +	echo '<p class="success">'. $msg ."</p>\n"; +} +if (isset($tipMsg) && $tipMsg!='') { +	echo '<p class="tipMsg">'. $tipMsg ."</p>\n"; +} +?> diff --git a/doc/ChangeLog b/doc/ChangeLog index 8fa208c..ade19af 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,6 +1,9 @@  ChangeLog for SemantiScuttle  ============================ +- Implement request #1989987: Theming support + +  0.98.0 - 2011-XX-XX  -------------------  - Switch to jQuery and drop dojo diff --git a/doc/themes.rst b/doc/themes.rst new file mode 100644 index 0000000..6f34a36 --- /dev/null +++ b/doc/themes.rst @@ -0,0 +1,48 @@ +====================== +SemanticScuttle Themes +====================== +SemanticScuttle may be changed visually by supplying custom "themes" (skins) +that modify the visual appearance. + + +Changing the current theme +========================== +In ``data/config.php``, set your theme like this: :: + +    $theme = 'darkmood'; + +The available themes are the folders in ``www/themes/``. +By default, SemanticScuttle ships only one usable theme ("default") and one +to demonstrate how to create your own theme ("testdummy"). + + +Creating your own theme +======================= +Have a look at the "testdummy" theme in ``www/themes/testdummy/``. + +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 + +Several template files in SemanticScuttle include image files. If they do not +exist in your theme, the default ones are used automatically. +Note that this is not true for images that are specified in the CSS files. + + +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 Binary files differindex be864a7..be864a7 100644 --- a/www/icon.png +++ b/www/themes/default/icon.png diff --git a/www/images/b_edit.png b/www/themes/default/images/b_edit.png Binary files differindex 05711a0..05711a0 100644 --- a/www/images/b_edit.png +++ b/www/themes/default/images/b_edit.png diff --git a/www/images/bg_admin.png b/www/themes/default/images/bg_admin.png Binary files differindex c707779..c707779 100644 --- a/www/images/bg_admin.png +++ b/www/themes/default/images/bg_admin.png diff --git a/www/images/bg_bar.png b/www/themes/default/images/bg_bar.png Binary files differindex 7152ba1..7152ba1 100644 --- a/www/images/bg_bar.png +++ b/www/themes/default/images/bg_bar.png diff --git a/www/images/bg_header.png b/www/themes/default/images/bg_header.png Binary files differindex 6fa4161..6fa4161 100644 --- a/www/images/bg_header.png +++ b/www/themes/default/images/bg_header.png diff --git a/www/images/bg_sidebar.png b/www/themes/default/images/bg_sidebar.png Binary files differindex 0edb153..0edb153 100644 --- a/www/images/bg_sidebar.png +++ b/www/themes/default/images/bg_sidebar.png diff --git a/www/images/loading.gif b/www/themes/default/images/loading.gif Binary files differindex 859126e..859126e 100644 --- a/www/images/loading.gif +++ b/www/themes/default/images/loading.gif diff --git a/www/images/logo.png b/www/themes/default/images/logo.png Binary files differindex 4afe565..4afe565 100644 --- a/www/images/logo.png +++ b/www/themes/default/images/logo.png diff --git a/www/images/logo_24.gif b/www/themes/default/images/logo_24.gif Binary files differindex d5af64d..d5af64d 100644 --- a/www/images/logo_24.gif +++ b/www/themes/default/images/logo_24.gif diff --git a/www/images/rss.gif b/www/themes/default/images/rss.gif Binary files differindex 094ba10..094ba10 100644 --- a/www/images/rss.gif +++ b/www/themes/default/images/rss.gif diff --git a/www/images/thumbs_up.orig.png b/www/themes/default/images/thumbs_up.orig.png Binary files differindex 1a89d0e..1a89d0e 100644 --- a/www/images/thumbs_up.orig.png +++ b/www/themes/default/images/thumbs_up.orig.png diff --git a/www/images/vote-against-voted.png b/www/themes/default/images/vote-against-voted.png Binary files differindex 740dfc8..740dfc8 100644 --- a/www/images/vote-against-voted.png +++ b/www/themes/default/images/vote-against-voted.png diff --git a/www/images/vote-against.png b/www/themes/default/images/vote-against.png Binary files differindex f15ea4d..f15ea4d 100644 --- a/www/images/vote-against.png +++ b/www/themes/default/images/vote-against.png diff --git a/www/images/vote-for-voted.png b/www/themes/default/images/vote-for-voted.png Binary files differindex 5abd43e..5abd43e 100644 --- a/www/images/vote-for-voted.png +++ b/www/themes/default/images/vote-for-voted.png diff --git a/www/images/vote-for.png b/www/themes/default/images/vote-for.png Binary files differindex 5973ae9..5973ae9 100644 --- a/www/images/vote-for.png +++ b/www/themes/default/images/vote-for.png 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 diff --git a/www/themes/testdummy/images/logo.png b/www/themes/testdummy/images/logo.png Binary files differnew file mode 100644 index 0000000..4a8f8ba --- /dev/null +++ b/www/themes/testdummy/images/logo.png diff --git a/www/themes/testdummy/scuttle.css b/www/themes/testdummy/scuttle.css new file mode 100644 index 0000000..c62cd19 --- /dev/null +++ b/www/themes/testdummy/scuttle.css @@ -0,0 +1,12 @@ +@import url(../default/scuttle.css); + +body { +    background-color: #FEA; +} + +html > body h1 { +    background: url('images/logo.png') no-repeat 10px; +} +div#header { +    background: #FEA; +}  | 
