PageRenderTime 52ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/frog/app/views/setting/index.php

https://github.com/Doap/FrogCMS
PHP | 202 lines | 161 code | 10 blank | 31 comment | 37 complexity | 680e79653343921855811d9f17b33e77 MD5 | raw file
  1. <?php
  2. /**
  3. * Frog CMS - Content Management Simplified. <http://www.madebyfrog.com>
  4. * Copyright (C) 2008 Philippe Archambault <philippe.archambault@gmail.com>
  5. *
  6. * This file is part of Frog CMS.
  7. *
  8. * Frog CMS is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * Frog CMS is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with Frog CMS. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. * Frog CMS has made an exception to the GNU General Public License for plugins.
  22. * See exception.txt for details and the full text.
  23. */
  24. /**
  25. * @package frog
  26. * @subpackage views
  27. *
  28. * @author Philippe Archambault <philippe.archambault@gmail.com>
  29. * @version 0.1
  30. * @license http://www.gnu.org/licenses/gpl.html GPL License
  31. * @copyright Philippe Archambault, 2008
  32. */
  33. ?>
  34. <h1><?php echo __('Administration'); ?></h1>
  35. <div class="form-area">
  36. <div id="tab-control-admin" class="tab_control">
  37. <div id="tabs-admin" class="tabs">
  38. <div id="tab-admin-toolbar" class="tab_toolbar">&nbsp;</div>
  39. </div>
  40. <div id="admin-pages" class="pages">
  41. <div id="plugin-page" class="page">
  42. <table id="plugins" class="index" cellpadding="0" cellspacing="0" border="0">
  43. <thead>
  44. <tr>
  45. <th class="plugin"><?php echo __('Plugin'); ?></th>
  46. <th class="pluginSettings"><?php echo __('Settings'); ?></th>
  47. <th class="website"><?php echo __('Website'); ?></th>
  48. <th class="version"><?php echo __('Version'); ?></th>
  49. <th class="latest"><?php echo __('Latest'); ?></th>
  50. <th class="enabled"><?php echo __('Enabled'); ?></th>
  51. </tr>
  52. </thead>
  53. <tbody>
  54. <?php $loaded_plugins = Plugin::$plugins; ?>
  55. <?php $loaded_filters = Filter::$filters; ?>
  56. <?php foreach(Plugin::findAll() as $plugin): ?>
  57. <?php $disabled = (isset($plugin->require_frog_version) and $plugin->require_frog_version > FROG_VERSION); ?>
  58. <tr<?php if ($disabled) echo ' class="disabled"'; ?>>
  59. <td class="plugin">
  60. <h4>
  61. <?php
  62. if (isset($loaded_plugins[$plugin->id]) && Plugin::hasDocumentationPage($plugin->id) )
  63. echo '<a href="'.get_url('plugin/'.$plugin->id.'/documentation').'">'.$plugin->title.'</a>';
  64. else
  65. echo $plugin->title;
  66. ?>
  67. <span class="from"><?php if (isset($plugin->author)) echo ' '.__('by').' '.$plugin->author; ?></span>
  68. </h4>
  69. <p><?php echo $plugin->description; ?> <?php if ($disabled) echo '<span class="notes">'.__('This plugin CANNOT be enabled! It requires Frog version :v.', array(':v' => $plugin->require_frog_version)).'</span>'; ?></p>
  70. </td>
  71. <td class="pluginSettings">
  72. <?php
  73. if (isset($loaded_plugins[$plugin->id]) && Plugin::hasSettingsPage($plugin->id) )
  74. echo '<a href="'.get_url('plugin/'.$plugin->id.'/settings').'">'.__('Settings').'</a>';
  75. else
  76. echo __('n/a');
  77. ?>
  78. </td>
  79. <td class="website"><a href="<?php echo $plugin->website; ?>" target="_blank"><?php echo __('Website') ?></a></td>
  80. <td class="version"><?php echo $plugin->version; ?></td>
  81. <td class="latest"><?php echo Plugin::checkLatest($plugin); ?></td>
  82. <td class="enabled"><input type="checkbox" name="enabled_<?php echo $plugin->id; ?>" value="<?php echo $plugin->id; ?>"<?php if (isset($loaded_plugins[$plugin->id])) echo ' checked="checked"'; if ($disabled) echo ' disabled="disabled"'; ?> onclick="new Ajax.Request('<?php echo get_url('setting'); ?>'+(this.checked ? '/activate_plugin/':'/deactivate_plugin/')+this.value, {method: 'get'});" /></td>
  83. </tr>
  84. <?php endforeach; ?>
  85. </tbody>
  86. </table>
  87. <script type="text/javascript">
  88. new RuledTable('plugins');
  89. </script>
  90. </div>
  91. <div id="setting-page" class="page">
  92. <form action="<?php echo get_url('setting'); ?>" method="post">
  93. <table class="fieldset" cellpadding="0" cellspacing="0" border="0">
  94. <tr>
  95. <td class="label"><label for="setting_admin_title"><?php echo __('Admin Site title'); ?></label></td>
  96. <td class="field"><input class="textbox" id="setting_admin_title" maxlength="255" name="setting[admin_title]" size="255" type="text" value="<?php echo htmlentities(Setting::get('admin_title'), ENT_COMPAT, 'UTF-8'); ?>" /></td>
  97. <td class="help"><?php echo __('By using <strong>&lt;img src="img_path" /&gt;</strong> you can set your company logo instead of a title.'); ?></td>
  98. </tr>
  99. <tr>
  100. <td class="label"><label for="setting_language"><?php echo __('Language'); ?></label></td>
  101. <td class="field">
  102. <select class="select" id="setting_language" name="setting[language]">
  103. <?php $current_language = Setting::get('language'); ?>
  104. <?php foreach (Setting::getLanguages() as $code => $label): ?>
  105. <option value="<?php echo $code; ?>"<?php if ($code == $current_language) echo ' selected="selected"'; ?>><?php echo __($label); ?></option>
  106. <?php endforeach; ?>
  107. </select>
  108. </td>
  109. <td class="help"><?php echo __('This will set your language for the backend.'); ?><br /><?php echo __('Help us <a href=":url">translate Frog</a>!', array(':url' => get_url('translate'))); ?></td>
  110. </tr>
  111. <tr>
  112. <td class="label"><label for="setting_theme"><?php echo __('Administration Theme'); ?></label></td>
  113. <td class="field">
  114. <select class="select" id="setting_language" name="setting[theme]" onchange="$('css_theme').href = 'themes/' + this[this.selectedIndex].value + '/styles.css';">
  115. <?php $current_theme = Setting::get('theme'); ?>
  116. <?php foreach (Setting::getThemes() as $code => $label): ?>
  117. <option value="<?php echo $code; ?>"<?php if ($code == $current_theme) echo ' selected="selected"'; ?>><?php echo __($label); ?></option>
  118. <?php endforeach; ?>
  119. </select>
  120. </td>
  121. <td class="help"><?php echo __('This will change your Administration theme.'); ?></td>
  122. </tr>
  123. <tr>
  124. <td class="label"><label for="setting_default_tab"><?php echo __('Default tab'); ?></label></td>
  125. <td class="field">
  126. <select class="select" id="setting_default_tab" name="setting[default_tab]">
  127. <?php $current_default_tab = Setting::get('default_tab');?>
  128. <option value="page"<?php if ($current_default_tab == 'page') echo ' selected="selected"'; ?>><?php echo __('Pages'); ?></option>
  129. <option value="snippet"<?php if ($current_default_tab == 'snippet') echo ' selected="selected"'; ?>><?php echo __('Snippets'); ?></option>
  130. <option value="layout"<?php if ($current_default_tab == 'layout') echo ' selected="selected"'; ?>><?php echo __('Layouts'); ?></option>
  131. <option value="user"<?php if ($current_default_tab == 'user') echo ' selected="selected"'; ?>><?php echo __('Users'); ?></option>
  132. <option value="setting"<?php if ($current_default_tab == 'setting') echo ' selected="selected"'; ?>><?php echo __('Administration'); ?></option>
  133. <?php foreach(Plugin::$controllers as $key=>$controller): ?>
  134. <?php if ($controller->show_tab === true) { ?>
  135. <option value="plugin/<?php echo $key; ?>"<?php if ('plugin/'.$key == $current_default_tab) echo ' selected="selected"'; ?>><?php echo $controller->label; ?></option>
  136. <?php } ?>
  137. <?php endforeach; ?>
  138. </select>
  139. </td>
  140. <td class="help"><?php echo __('This allows you to specify which tab (controller) you will see by default after login.'); ?></td>
  141. </tr>
  142. <tr>
  143. <td colspan="3"><h3><?php echo __('Page options'); ?></h3></td>
  144. </tr>
  145. <tr>
  146. <td class="label"><label for="setting_allow_html_title"><?php echo __('Allow HTML in Title'); ?></label></td>
  147. <td class="field">
  148. <input type="checkbox" name="setting[allow_html_title]" <?php if (Setting::get('allow_html_title') == 'on') echo ' checked="checked"'; ?> />
  149. </td>
  150. <td class="help"><?php echo __('Determines whether or not HTML code is allowed in a page\'s title.'); ?></td>
  151. </tr>
  152. <tr>
  153. <td class="label"><label for="setting_default_status_id-draft"><?php echo __('Default Status'); ?></label></td>
  154. <td class="field">
  155. <input class="radio" id="setting_default_status_id-draft" name="setting[default_status_id]" size="10" type="radio" value="<?php echo Page::STATUS_DRAFT; ?>"<?php if (Setting::get('default_status_id') == Page::STATUS_DRAFT) echo ' checked="checked"'; ?> /><label for="setting_default_status_id-draft"> <?php echo __('Draft'); ?> </label> &nbsp;
  156. <input class="radio" id="setting_default_status_id-published" name="setting[default_status_id]" size="10" type="radio" value="<?php echo Page::STATUS_PUBLISHED; ?>"<?php if (Setting::get('default_status_id') == Page::STATUS_PUBLISHED) echo ' checked="checked"'; ?> /><label for="setting_default_status_id-published"> <?php echo __('Published'); ?> </label>
  157. </td>
  158. <td class="help">&nbsp;</td>
  159. </tr>
  160. <tr>
  161. <td class="label"><label for="setting_default_filter_id"><?php echo __('Default Filter'); ?></label></td>
  162. <td class="field">
  163. <select class="select" id="setting_default_filter_id" name="setting[default_filter_id]">
  164. <?php $current_default_filter_id = Setting::get('default_filter_id'); ?>
  165. <option value=""<?php if ($current_default_filter_id == '') echo ' selected="selected"'; ?>>&#8212; <?php echo __('none'); ?> &#8212;</option>
  166. <?php foreach (Filter::findAll() as $filter_id): ?>
  167. <?php if (isset($loaded_filters[$filter_id])): ?>
  168. <option value="<?php echo $filter_id; ?>"<?php if ($filter_id == $current_default_filter_id) echo ' selected="selected"'; ?>><?php echo Inflector::humanize($filter_id); ?></option>
  169. <?php endif; ?>
  170. <?php endforeach; ?>
  171. </select>
  172. </td>
  173. <td class="help"><?php echo __('Only for filter in pages, NOT in snippets'); ?></td>
  174. </tr>
  175. </table>
  176. <p class="buttons">
  177. <input class="button" name="commit" type="submit" accesskey="s" value="<?php echo __('Save'); ?>" />
  178. </p>
  179. </form>
  180. <script type="text/javascript">
  181. Field.activate('user_name');
  182. </script>
  183. </div>
  184. </div>
  185. </div>
  186. </div>
  187. <script type="text/javascript">
  188. var tabControlMeta = new TabControl('tab-control-admin');
  189. tabControlMeta.addTab('tab-plugin', '<?php echo __('Plugins'); ?>', 'plugin-page');
  190. tabControlMeta.addTab('tab-setting', '<?php echo __('Settings'); ?>', 'setting-page');
  191. tabControlMeta.select(tabControlMeta.firstTab());
  192. </script>