Dotclear

source: admin/blog_theme.php @ 2291:a3e033a82cbf

Revision 2291:a3e033a82cbf, 6.3 KB checked in by Anne Kozlika <kozlika@…>, 12 years ago (diff)

Présentation plus mieux bien des index (plugins et thèmes)
CSS. Fonte de base Helvetica à tester sur les différentes plates-formes
Traductions : ajout de "Volet" devant les items du sélecteur d'ajout.

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ---------------------------------------
3#
4# This file is part of Dotclear 2.
5#
6# Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear
7# Licensed under the GPL version 2.0 license.
8# See LICENSE file or
9# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10#
11# -- END LICENSE BLOCK -----------------------------------------
12
13require dirname(__FILE__).'/../inc/admin/prepend.php';
14
15dcPage::check('admin');
16
17# -- "First time" settings setup --
18if ($core->blog->settings->system->store_theme_url === null) {
19     $core->blog->settings->system->put(
20          'store_theme_url', 'http://update.dotaddict.org/dc2/themes.xml', 'string', 'Themes XML feed location', true, true
21     );
22}
23
24# -- Loading themes --
25$core->themes = new dcThemes($core);
26$core->themes->loadModules($core->blog->themes_path, null);
27
28# -- Page helper --
29$list = new adminThemesList(
30     $core->themes, 
31     $core->blog->themes_path,
32     $core->blog->settings->system->store_theme_url
33);
34adminThemesList::$distributed_modules = explode(',', DC_DISTRIB_THEMES);
35
36# -- Theme screenshot --
37if (!empty($_GET['shot']) && $list->modules->moduleExists($_GET['shot'])) {
38
39     $f= path::real(empty($_GET['src']) ?
40          $core->blog->themes_path.'/'.$_GET['shot'].'/screenshot.jpg' :
41          $core->blog->themes_path.'/'.$_GET['shot'].'/'.path::clean($_GET['src'])
42     );
43
44     if (!file_exists($f)) {
45          $f = dirname(__FILE__).'/images/noscreenshot.png';
46     }
47
48     http::cache(array_merge(array($f), get_included_files()));
49
50     header('Content-Type: '.files::getMimeType($f));
51     header('Content-Length: '.filesize($f));
52     readfile($f);
53
54     exit;
55}
56
57# -- Display module configuration page --
58if ($list->setConfiguration($core->blog->settings->system->theme)) {
59
60     # Get content before page headers
61     include $list->includeConfiguration();
62
63     # Gather content
64     $list->getConfiguration();
65
66     # Display page
67     dcPage::open(__('Blog appearance'),
68          dcPage::jsPageTabs().
69          dcPage::jsColorPicker().
70
71          # --BEHAVIOR-- themesToolsHeaders
72          $core->callBehavior('themesToolsHeaders', $core, true),
73
74          dcPage::breadcrumb(
75               array(
76                    html::escapeHTML($core->blog->name) => '',
77                    __('Blog appearance') => $list->getURL('',false),
78                    '<span class="page-title">'.__('Theme configuration').'</span>' => ''
79               ))
80     );
81
82     # Display previously gathered content
83     $list->displayConfiguration();
84
85     dcPage::close();
86
87     # Stop reading code here
88     return;
89}
90
91# -- Execute actions --
92try {
93     $list->doActions('themes');
94}
95catch (Exception $e) {
96     $core->error->add($e->getMessage());
97}
98
99# -- Page header --
100dcPage::open(__('Themes management'),
101     dcPage::jsLoad('js/_blog_theme.js').
102     dcPage::jsPageTabs().
103     dcPage::jsColorPicker().
104
105     # --BEHAVIOR-- themesToolsHeaders
106     $core->callBehavior('themesToolsHeaders', $core, false),
107
108     dcPage::breadcrumb(
109          array(
110               html::escapeHTML($core->blog->name) => '',
111               '<span class="page-title">'.__('Blog appearance').'</span>' => ''
112          ))
113);
114
115# -- Display modules lists --
116if ($core->auth->isSuperAdmin() && $list->isWritablePath()) {
117
118     # Updated modules from repo
119     $modules = $list->store->get(true);
120     if (!empty($modules)) {
121          echo 
122          '<div class="multi-part" id="update" title="'.html::escapeHTML(__('Update themes')).'">'.
123          '<h3>'.html::escapeHTML(__('Update themes')).'</h3>'.
124          '<p>'.sprintf(
125               __('There is one theme to update available from repository.', 'There are %s themes to update available from repository.', count($modules)),
126               count($modules)
127          ).'</p>';
128
129          $list
130               ->setList('theme-update')
131               ->setTab('themes')
132               ->setModules($modules)
133               ->displayModules(
134                    /*cols */      array('sshot', 'name', 'desc', 'author', 'version', 'current_version', 'parent'),
135                    /* actions */  array('update', 'delete')
136               );
137
138          echo
139          '<p class="info vertical-separator">'.sprintf(
140               __("Visit %s repository, the resources center for Dotclear."),
141               '<a href="http://dotaddict.org/dc2/themes">Dotaddict</a>'
142               ).
143          '</p>'.
144
145          '</div>';
146     }
147}
148
149# Activated modules
150$modules = $list->modules->getModules();
151if (!empty($modules)) {
152
153     echo
154     '<div class="multi-part" id="themes" title="'.__('Installed themes').'">'.
155     '<h3>'.__('Installed themes').'</h3>'.
156     '<p>'.__('You can configure and manage installed themes from this list.').'</p>';
157
158     $list
159          ->setList('theme-activate')
160          ->setTab('themes')
161          ->setModules($modules)
162          ->displayModules(
163               /* cols */          array('sshot', 'distrib', 'name', 'config', 'desc', 'author', 'version', 'parent'),
164               /* actions */  array('select', 'behavior', 'deactivate', 'delete')
165          );
166
167     echo 
168     '</div>';
169}
170
171# Deactivated modules
172$modules = $list->modules->getDisabledModules();
173if (!empty($modules)) {
174
175     echo
176     '<div class="multi-part" id="deactivate" title="'.__('Deactivated themes').'">'.
177     '<h3>'.__('Deactivated themes').'</h3>'.
178     '<p>'.__('Deactivated themes are installed but not usable. You can activate them from here.').'</p>';
179
180     $list
181          ->setList('theme-deactivate')
182          ->setTab('themes')
183          ->setModules($modules)
184          ->displayModules(
185               /* cols */          array('name', 'distrib'),
186               /* actions */  array('activate', 'delete')
187          );
188
189     echo 
190     '</div>';
191}
192
193if ($core->auth->isSuperAdmin() && $list->isWritablePath()) {
194
195     # New modules from repo
196     $search = $list->getSearch();
197     $modules = $search ? $list->store->search($search) : $list->store->get();
198
199     if (!empty($search) || !empty($modules)) {
200          echo
201          '<div class="multi-part" id="new" title="'.__('Add themes').'">'.
202          '<h3>'.__('Add themes from repository').'</h3>';
203//        '<p>'.__('Search and install themes directly from repository.').'</p>';
204
205          $list
206               ->setList('theme-new')
207               ->setTab('new')
208               ->setModules($modules)
209               ->displaySearch()
210               ->displayIndex()
211               ->displayModules(
212                    /* cols */          array('expander', 'sshot', 'name', 'score', 'config', 'desc', 'author', 'version', 'parent', 'details', 'support'),
213                    /* actions */  array('install'),
214                    /* nav limit */     true
215               );
216
217          echo
218          '<p class="info vertical-separator">'.sprintf(
219               __("Visit %s repository, the resources center for Dotclear."),
220               '<a href="http://dotaddict.org/dc2/themes">Dotaddict</a>'
221               ).
222          '</p>'.
223
224          '</div>';
225     }
226
227     # Add a new plugin
228     echo
229     '<div class="multi-part" id="addtheme" title="'.__('Install or upgrade manually').'">'.
230     '<h3>'.__('Add themes from a package').'</h3>'.
231     '<p>'.__('You can install themes by uploading or downloading zip files.').'</p>';
232
233     $list->displayManualForm();
234
235     echo
236     '</div>';
237}
238
239# --BEHAVIOR-- themesToolsTabs
240$core->callBehavior('themesToolsTabs', $core);
241
242dcPage::close();
Note: See TracBrowser for help on using the repository browser.

Sites map