Compare commits

...

5 Commits

Author SHA1 Message Date
Knah Tsaeb 0f473eedfc Fix unit test 2016-12-08 11:02:38 +01:00
Knah Tsaeb a197ef5e02 Restore custum tpl dir 2016-12-08 10:03:46 +01:00
Knah Tsaeb 81b9c01366 Rename Default to default 2016-12-08 09:46:34 +01:00
Knah Tsaeb 057fb6839c Reset doc file 2016-12-08 09:38:42 +01:00
Knah Tsaeb d33763a409 #502 Change templates set through administration UI 2016-12-07 11:58:25 +01:00
37 changed files with 59 additions and 23 deletions

View File

@ -150,6 +150,7 @@ class ApplicationUtils
'inc',
'plugins',
$conf->get('resource.raintpl_tpl'),
$conf->get('resource.raintpl_tpl').'/'.$conf->get('resource.theme'),
) as $path) {
if (! is_readable(realpath($path))) {
$errors[] = '"'.$path.'" directory is not readable';

View File

@ -79,7 +79,7 @@ class PageBuilder
$this->tpl->assign('hide_timestamps', $this->conf->get('privacy.hide_timestamps', false));
$this->tpl->assign('token', getToken($this->conf));
// To be removed with a proper theme configuration.
$this->tpl->assign('conf', $this->conf);
$this->tpl->assign('conf', $this->conf->get('resource.theme', 'default'));
}
/**

View File

@ -227,3 +227,13 @@ function autoLocale($headerLocale)
}
setlocale(LC_ALL, $attempts);
}
function getAllTheme()
{
$allTheme = glob('tpl/*', GLOB_ONLYDIR);
foreach ($allTheme as $value) {
$themes[] = str_replace('tpl/', '', $value);
}
return $themes;
}

View File

@ -297,6 +297,7 @@ class ConfigManager
$this->setEmpty('resource.log', 'data/log.txt');
$this->setEmpty('resource.update_check', 'data/lastupdatecheck.txt');
$this->setEmpty('resource.raintpl_tpl', 'tpl/');
$this->setEmpty('resource.theme', 'default');
$this->setEmpty('resource.raintpl_tmp', 'tmp/');
$this->setEmpty('resource.thumbnails_cache', 'cache');
$this->setEmpty('resource.page_cache', 'pagecache');

View File

@ -41,6 +41,7 @@ class ConfigPhp implements ConfigIO
'resource.log' => 'config.LOG_FILE',
'resource.update_check' => 'config.UPDATECHECK_FILENAME',
'resource.raintpl_tpl' => 'config.RAINTPL_TPL',
'resource.theme' => 'config.theme',
'resource.raintpl_tmp' => 'config.RAINTPL_TMP',
'resource.thumbnails_cache' => 'config.CACHEDIR',
'resource.page_cache' => 'config.PAGECACHE',

View File

@ -208,4 +208,3 @@ It might be useful if your IP adress often changes.
The playvideos plugin may require that you adapt your server's
[Content Security Policy](https://github.com/shaarli/Shaarli/blob/master/plugins/playvideos/README.md#troubleshooting) [](.html)
configuration to work properly.[(.html)]((.html).html)

View File

@ -122,7 +122,8 @@ if (isset($_COOKIE['shaarli']) && !is_session_id_valid($_COOKIE['shaarli'])) {
$conf = new ConfigManager();
$conf->setEmpty('general.timezone', date_default_timezone_get());
$conf->setEmpty('general.title', 'Shared links on '. escape(index_url($_SERVER)));
RainTPL::$tpl_dir = $conf->get('resource.raintpl_tpl'); // template directory
$conf->setEmpty('resource.theme', 'default');
RainTPL::$tpl_dir = $conf->get('resource.raintpl_tpl').'/'.$conf->get('resource.theme').'/'; // template directory
RainTPL::$cache_dir = $conf->get('resource.raintpl_tmp'); // cache directory
$pluginManager = new PluginManager($conf);
@ -1148,6 +1149,7 @@ function renderPage($conf, $pluginManager)
$conf->set('general.timezone', $tz);
$conf->set('general.title', escape($_POST['title']));
$conf->set('general.header_link', escape($_POST['titleLink']));
$conf->set('resource.theme', escape($_POST['theme']));
$conf->set('redirector.url', escape($_POST['redirector']));
$conf->set('security.session_protection_disabled', !empty($_POST['disablesessionprotection']));
$conf->set('privacy.default_private_links', !empty($_POST['privateLinkByDefault']));
@ -1173,6 +1175,8 @@ function renderPage($conf, $pluginManager)
else // Show the configuration form.
{
$PAGE->assign('title', $conf->get('general.title'));
$PAGE->assign('theme', $conf->get('resource.theme'));
$PAGE->assign('theme_avaible', getAllTheme());
$PAGE->assign('redirector', $conf->get('redirector.url'));
list($timezone_form, $timezone_js) = generateTimeZoneForm($conf->get('general.timezone'));
$PAGE->assign('timezone_form', $timezone_form);

View File

@ -289,6 +289,7 @@ class ApplicationUtilsTest extends PHPUnit_Framework_TestCase
$conf->set('resource.page_cache', 'pagecache');
$conf->set('resource.raintpl_tmp', 'tmp');
$conf->set('resource.raintpl_tpl', 'tpl');
$conf->set('resource.theme', 'default');
$conf->set('resource.update_check', 'data/lastupdatecheck.txt');
$this->assertEquals(
@ -312,10 +313,12 @@ class ApplicationUtilsTest extends PHPUnit_Framework_TestCase
$conf->set('resource.page_cache', 'null/pagecache');
$conf->set('resource.raintpl_tmp', 'null/tmp');
$conf->set('resource.raintpl_tpl', 'null/tpl');
$conf->set('resource.raintpl_theme', 'null/tpl/default');
$conf->set('resource.update_check', 'null/data/lastupdatecheck.txt');
$this->assertEquals(
array(
'"null/tpl" directory is not readable',
'"null/tpl/default" directory is not readable',
'"null/cache" directory is not readable',
'"null/cache" directory is not writable',
'"null/data" directory is not readable',

View File

@ -19,6 +19,23 @@
<td><input type="text" name="titleLink" id="titleLink" size="50" value="{$titleLink}"><br/><label
for="titleLink">(default value is: ?)</label></td>
</tr>
<tr>
<td><b>Theme:</b></td>
<td>
<select name="theme" id="theme">
{loop="$theme_avaible"}
{if="$value===$theme"}
<option selected value="{$value}">{$value|ucfirst}</option>
{else}
<option value="{$value}">{$value|ucfirst}</option>
{/if}
{/loop}
</select>
<label for="theme">(default value is: Default)</label>
</td>
</tr>
<tr>
<td><b>Timezone:</b></td>
<td>{$timezone_form}</td>

View File

@ -28,9 +28,9 @@
</div>
<div class="dailyTitle">
<img src="../images/floral_left.png" width="51" height="50" class="nomobile" alt="floral_left">
<img src="../../images/floral_left.png" width="51" height="50" class="nomobile" alt="floral_left">
The Daily Shaarli
<img src="../images/floral_right.png" width="51" height="50" class="nomobile" alt="floral_right">
<img src="../../images/floral_right.png" width="51" height="50" class="nomobile" alt="floral_right">
</div>
<div class="dailyDate">
@ -50,7 +50,7 @@
<div class="dailyEntry">
<div class="dailyEntryPermalink">
<a href="?{$link.linkdate|smallHash}">
<img src="../images/squiggle2.png" width="25" height="26" title="permalink" alt="permalink">
<img src="../../images/squiggle2.png" width="25" height="26" title="permalink" alt="permalink">
</a>
</div>
{if="!$hide_timestamps || isLoggedIn()"}
@ -94,7 +94,7 @@
{$value}
{/loop}
</div>
<div id="closing"><img src="../images/squiggle_closing.png" width="66" height="61" alt="-"></div>
<div id="closing"><img src="../../images/squiggle_closing.png" width="66" height="61" alt="-"></div>
</div>
{include="page.footer"}
</body>

View File

@ -6,9 +6,9 @@
<link rel="alternate" type="application/rss+xml" href="{$feedurl}?do=rss{$searchcrits}#" title="RSS Feed" />
<link rel="alternate" type="application/atom+xml" href="{$feedurl}?do=atom{$searchcrits}#" title="ATOM Feed" />
<link href="images/favicon.ico#" rel="shortcut icon" type="image/x-icon" />
<link type="text/css" rel="stylesheet" href="../inc/reset.css" />
<link type="text/css" rel="stylesheet" href="../inc/shaarli.css" />
{if="is_file('inc/user.css')"}<link type="text/css" rel="stylesheet" href="../inc/user.css" />{/if}
<link type="text/css" rel="stylesheet" href="reset.css" />
<link type="text/css" rel="stylesheet" href="shaarli.css" />
{if="is_file('inc/user.css')"}<link type="text/css" rel="stylesheet" href="../../inc/user.css" />{/if}
{loop="$plugins_includes.css_files"}
<link type="text/css" rel="stylesheet" href="{$value}#"/>
{/loop}

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="../inc/awesomplete.css" />
<link type="text/css" rel="stylesheet" href="../../inc/awesomplete.css" />
{include="includes"}
</head>
<body>

View File

@ -103,7 +103,7 @@ strong {
}
#pageheader #logo {
background-image: url('../images/logo.png');
background-image: url('../../images/logo.png');
background-repeat: no-repeat;
float: left;
margin: 0 10px 0 10px;
@ -423,7 +423,7 @@ strong {
}
#linklist li.private {
background: url('../images/private.png') no-repeat 4px center;
background: url('../../../images/private.png') no-repeat 4px center;
padding-left: 30px;
}
@ -455,7 +455,7 @@ strong {
}
.linkdate a {
background-image: url('../images/calendar.png');
background-image: url('../../images/calendar.png');
padding: 2px 0 3px 20px;
background-repeat: no-repeat;
text-decoration: none;
@ -506,7 +506,7 @@ strong {
height: 20px;
border-radius: 3px;
cursor: pointer;
background-image: url('../images/tag_blue.png');
background-image: url('../../images/tag_blue.png');
background-repeat: no-repeat;
background-position: 3px center;
background-color: #ffffff;
@ -752,7 +752,7 @@ div.daily {
/* Background paper texture by BashCorpo:
http://www.bashcorpo.dk/textures.php
http://bashcorpo.deviantart.com/art/Grungy-paper-texture-v-5-22966998 */
background-image: url("../images/Paper_texture_v5_by_bashcorpo_w1000.jpg");
background-image: url("../../images/Paper_texture_v5_by_bashcorpo_w1000.jpg");
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
@ -846,7 +846,7 @@ div.dailyEntryThumbnail {
width: 100%;
text-align: center;
background-color: rgb(128, 128, 128);
background: url(../images/50pc_transparent.png);
background: url(../../images/50pc_transparent.png);
padding: 4px 0px 2px 0px;
}