make it possible to replace the current CSS file by a preset stylesheet
authorJeremy Laine <jeremy.laine@m4x.org>
Thu, 20 Jul 2006 23:00:12 +0000 (23:00 +0000)
committerJeremy Laine <jeremy.laine@m4x.org>
Thu, 20 Jul 2006 23:00:12 +0000 (23:00 +0000)
ChangeLog
include/admin/edit.php
templates/admin-edit.tpl

index e52cd64..a3ae443 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 Diogenes 0.9.20pre1
  * added - add RSS feeds describing changes to barrels
+ * added - offer preset style sheets for barrels
  * fixed - fix a warning when a barrel's menu is empty
 
 Diogenes 0.9.19
index a099107..eab2e67 100644 (file)
@@ -27,6 +27,14 @@ $myfile = $bbarrel->spool->spoolPath($dir,$file);
 $action = isset($_REQUEST["action"]) ? $_REQUEST["action"] : "";
 switch($action)
 {
+case "set_stylesheet":
+  if (isset($_REQUEST['preset_style_sheet'])) {
+    $sheet = $_REQUEST['preset_style_sheet'];
+    $page->info(__("Copying style sheet") . " $sheet.css");
+    $rcs->commit($dir,$file,file_get_contents("{$globals->root}/styles/$sheet.css"), "replaced by $sheet.css");
+  }
+  break;
 case "update":
   // update the current file with form contents
   if (isset($_REQUEST['file_content'])) {
@@ -49,6 +57,14 @@ $page->assign('msg_log',__("log message"));
 $page->assign('file_content',htmlspecialchars(file_get_contents($myfile), ENT_NOQUOTES));
 $page->assign('submit',__("Submit"));
 
+// menu for stylesheet replacement
+if ($file == $globals->cssfile) {
+   $page->assign('style_sheets', $globals->style_sheets);
+   $page->assign('preset_style_sheet', $globals->barrel_style_sheet);
+   $page->assign('msg_set_stylesheet', __("replace current style sheet by a preset one"));
+   $page->assign('msg_replace',__("Replace"));
+}
+
 // top toolbar
 $page->toolbar(__("Page"), $bpage->make_toolbar());
 $page->toolbar(__("File"), $bfile->make_toolbar(true));
index f4a2305..89985b2 100644 (file)
@@ -1,3 +1,21 @@
+{if $msg_set_stylesheet}
+<form name="form_stylesheet" method="post" action="{$post}">
+<input type="hidden" name="action" value="set_stylesheet" />
+<input type="hidden" name="file" value="{$file}" />
+<input type="hidden" name="dir" value="{$dir}" />
+<table class="light">
+<tr>
+  <td>{$msg_set_stylesheet}</td>
+  <td>{html_options name='preset_style_sheet' selected=$preset_style_sheet options=$style_sheets}</td>
+  <td><input type="submit" value="{$msg_replace}"/></td>
+</tr>
+</table>
+</form>
+
+<br/>
+
+{/if}
+
 <form name="modif" method="post" action="{$post}">
 <input type="hidden" name="action" value="update" />
 <input type="hidden" name="file" value="{$file}" />