Changeset 2215:0775c8672865 for admin/blog_theme.php
- Timestamp:
- 10/02/13 17:00:38 (12 years ago)
- Branch:
- dcRepo
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/blog_theme.php
r2196 r2215 15 15 dcPage::check('admin'); 16 16 17 # -------------------------------------------------- 18 # @todo Add settings to Dotclear update features 17 # -- "First time" settings setup -- 19 18 if ($core->blog->settings->system->repository_theme_url === null) { 20 19 $core->blog->settings->system->put( … … 22 21 ); 23 22 } 24 # --------------------------------------------------25 23 26 24 # -- Loading themes -- … … 28 26 $core->themes->loadModules($core->blog->themes_path, null); 29 27 30 # -- Repositoryhelper --31 $ repository = new dcRepository(28 # -- Page helper -- 29 $list = new adminThemesList( 32 30 $core->themes, 31 $core->blog->themes_path, 33 32 $core->blog->settings->system->repository_theme_url 34 33 ); 35 $repository->check(); 36 37 # -- Page helper -- 38 $list = new adminThemesList( 39 $core, 40 $core->blog->themes_path, 41 false 34 $list::$distributed_modules = array( 35 'blueSilence', 36 'blowupConfig', 37 'customCSS', 38 'default', 39 'ductile' 42 40 ); 43 41 44 42 # -- Theme screenshot -- 45 if (!empty($_GET['shot']) && $core->themes->moduleExists($_GET['shot'])) 46 { 47 if (empty($_GET['src'])) { 48 $f = $core->blog->themes_path.'/'.$_GET['shot'].'/screenshot.jpg'; 49 } else { 50 $f = $core->blog->themes_path.'/'.$_GET['shot'].'/'.path::clean($_GET['src']); 51 } 52 53 $f = path::real($f); 54 43 if (!empty($_GET['shot']) && $list->modules->moduleExists($_GET['shot'])) { 44 45 $f= path::real(empty($_GET['src']) ? 46 $core->blog->themes_path.'/'.$_GET['shot'].'/screenshot.jpg' : 47 $core->blog->themes_path.'/'.$_GET['shot'].'/'.path::clean($_GET['src']) 48 ); 49 55 50 if (!file_exists($f)) { 56 51 $f = dirname(__FILE__).'/images/noscreenshot.png'; 57 52 } 58 59 http::cache(array_merge(array($f), get_included_files()));60 53 54 http::cache(array_merge(array($f), get_included_files())); 55 61 56 header('Content-Type: '.files::getMimeType($f)); 62 57 header('Content-Length: '.filesize($f)); 63 58 readfile($f); 64 59 65 60 exit; 66 61 } 67 62 68 63 # -- Display module configuration page -- 69 if ($list->setConfigurationFile($core-> themes, $core->blog->settings->system->theme)) {64 if ($list->setConfigurationFile($core->blog->settings->system->theme)) { 70 65 71 66 # Get content before page headers … … 105 100 106 101 # -- Execute actions -- 107 if (!empty($_POST) && empty($_REQUEST['conf']) && $core->auth->isSuperAdmin() && $list->isPathWritable()) { 108 try { 109 $list->executeAction('themes', $core->themes, $repository); 110 } 111 catch (Exception $e) { 112 $core->error->add($e->getMessage()); 113 } 102 try { 103 $list->doActions('themes'); 104 } 105 catch (Exception $e) { 106 $core->error->add($e->getMessage()); 114 107 } 115 108 … … 139 132 140 133 # Updated modules from repo 141 $modules = $ repository->get(true);134 $modules = $list->repository->get(true); 142 135 if (!empty($modules)) { 143 136 echo … … 168 161 '<div class="multi-part" id="themes" title="'.__('Installed themes').'">'; 169 162 170 $modules = $ core->themes->getModules();163 $modules = $list->modules->getModules(); 171 164 if (!empty($modules)) { 172 165 … … 180 173 ->setPageTab('themes') 181 174 ->displayModulesList( 182 /* cols */ array('sshot', ' name', 'config', 'desc', 'author', 'version', 'parent'),175 /* cols */ array('sshot', 'distrib', 'name', 'config', 'desc', 'author', 'version', 'parent'), 183 176 /* actions */ array('select', 'deactivate', 'delete') 184 177 ); 185 178 } 186 179 187 $modules = $ core->themes->getDisabledModules();180 $modules = $list->modules->getDisabledModules(); 188 181 if (!empty($modules)) { 189 182 … … 209 202 # New modules from repo 210 203 $search = $list->getSearchQuery(); 211 $modules = $search ? $repository->search($search) : $repository->get(); 212 213 echo 214 '<div class="multi-part" id="new" title="'.__('Add themes from Dotaddict').'">'. 215 '<h3>'.__('Add themes from Dotaddict repository').'</h3>'; 216 217 $list 218 ->newList('theme-new') 219 ->setModules($modules) 220 ->setPageTab('new') 221 ->displaySearchForm() 222 ->displayNavMenu() 223 ->displayModulesList( 224 /* cols */ array('expander', 'sshot', 'name', 'config', 'desc', 'author', 'version', 'parent', 'distrib'), 225 /* actions */ array('install'), 226 /* nav limit */ true 227 ); 228 229 echo 230 '<p class="info vertical-separator">'.sprintf( 231 __("Visit %s repository, the resources center for Dotclear."), 232 '<a href="http://dotaddict.org/dc2/themes">Dotaddict</a>' 233 ). 234 '</p>'. 235 204 $modules = $search ? $list->repository->search($search) : $list->repository->get(); 205 206 if (!empty($search) || !empty($modules)) { 207 echo 208 '<div class="multi-part" id="new" title="'.__('Add themes from Dotaddict').'">'. 209 '<h3>'.__('Add themes from Dotaddict repository').'</h3>'; 210 211 $list 212 ->newList('theme-new') 213 ->setModules($modules) 214 ->setPageTab('new') 215 ->displaySearchForm() 216 ->displayNavMenu() 217 ->displayModulesList( 218 /* cols */ array('expander', 'sshot', 'name', 'config', 'desc', 'author', 'version', 'parent', 'details', 'support'), 219 /* actions */ array('install'), 220 /* nav limit */ true 221 ); 222 223 echo 224 '<p class="info vertical-separator">'.sprintf( 225 __("Visit %s repository, the resources center for Dotclear."), 226 '<a href="http://dotaddict.org/dc2/themes">Dotaddict</a>' 227 ). 228 '</p>'. 229 230 '</div>'; 231 } 232 233 # Add a new plugin 234 echo 235 '<div class="multi-part" id="addtheme" title="'.__('Install or upgrade manually').'">'. 236 '<p>'.__('You can install themes by uploading or downloading zip files.').'</p>'; 237 238 $list->displayManualForm(); 239 240 echo 236 241 '</div>'; 237 238 # Add a new plugin239 echo240 '<div class="multi-part" id="addtheme" title="'.__('Install or upgrade manually').'">';241 242 echo '<p>'.__('You can install themes by uploading or downloading zip files.').'</p>';243 244 $list->displayManualForm();245 246 echo247 '</div>';248 242 } 249 243 250 244 dcPage::close(); 251 ?>
Note: See TracChangeset
for help on using the changeset viewer.