From 8ad26def303c7dc0db1049b8c72f21c17133ab33 Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Mon, 21 May 2012 21:21:00 +0200 Subject: Sidebar blocks of Article editor can be expanded/collapsed. --- .../src/systemtemplates/content_write.html | 57 ++++++++++++---------- .../templates/src/systemtemplates/master.html | 2 + 2 files changed, 34 insertions(+), 25 deletions(-) (limited to 'ratatoeskr/templates/src') diff --git a/ratatoeskr/templates/src/systemtemplates/content_write.html b/ratatoeskr/templates/src/systemtemplates/content_write.html index 3d63c61..08d6ec1 100644 --- a/ratatoeskr/templates/src/systemtemplates/content_write.html +++ b/ratatoeskr/templates/src/systemtemplates/content_write.html @@ -26,33 +26,40 @@
-

- -

:

-

- : - -

-

:

-

:
(YYYY-MM-DD HH:MM:SS)

-

- : - ?{$article_status|$article_status|1} - -

-

:

+
+

+
+

:

+

+ : + +

+

:

+

:
(YYYY-MM-DD HH:MM:SS)

+

+ : + ?{$article_status|$article_status|1} + +

+

:

+
+
-

$plugin[label]

- +
+

$plugin[label]

+
+ +
+
diff --git a/ratatoeskr/templates/src/systemtemplates/master.html b/ratatoeskr/templates/src/systemtemplates/master.html index ddf6d08..406bab6 100755 --- a/ratatoeskr/templates/src/systemtemplates/master.html +++ b/ratatoeskr/templates/src/systemtemplates/master.html @@ -25,6 +25,8 @@ <ste:get_translation for="section_$section" />::<ste:escape>$pagetitle</ste:escape> - Ratatöskr + + layout.css $cssfile -- cgit v1.2.3-70-g09d2 From 9ee26e1077a52fcbdab5929186e7d118f834d269 Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Sat, 26 May 2012 12:16:33 +0200 Subject: ste:default_delete_yesno introduces This tag makes it a bit easier to write backend templates. It automatically generates the typical dropdown + button combo for mass-deleting entries. --- ratatoeskr/templates/src/systemtemplates/image_list.html | 6 +----- ratatoeskr/templates/src/systemtemplates/master.html | 7 +++++++ ratatoeskr/templates/src/systemtemplates/repos.html | 6 +----- ratatoeskr/templates/src/systemtemplates/sections.html | 5 +---- ratatoeskr/templates/src/systemtemplates/settings.html | 2 +- ratatoeskr/templates/src/systemtemplates/styles.html | 6 +----- ratatoeskr/templates/src/systemtemplates/templates.html | 6 +----- ratatoeskr/templates/src/systemtemplates/users.html | 4 ++-- 8 files changed, 15 insertions(+), 27 deletions(-) (limited to 'ratatoeskr/templates/src') diff --git a/ratatoeskr/templates/src/systemtemplates/image_list.html b/ratatoeskr/templates/src/systemtemplates/image_list.html index 7b40ddc..fe600aa 100644 --- a/ratatoeskr/templates/src/systemtemplates/image_list.html +++ b/ratatoeskr/templates/src/systemtemplates/image_list.html @@ -47,11 +47,7 @@
- - +
diff --git a/ratatoeskr/templates/src/systemtemplates/master.html b/ratatoeskr/templates/src/systemtemplates/master.html index 406bab6..bce92b1 100755 --- a/ratatoeskr/templates/src/systemtemplates/master.html +++ b/ratatoeskr/templates/src/systemtemplates/master.html @@ -19,6 +19,13 @@ + + + + diff --git a/ratatoeskr/templates/src/systemtemplates/repos.html b/ratatoeskr/templates/src/systemtemplates/repos.html index f724ece..31de6a5 100644 --- a/ratatoeskr/templates/src/systemtemplates/repos.html +++ b/ratatoeskr/templates/src/systemtemplates/repos.html @@ -45,11 +45,7 @@
- - + |
diff --git a/ratatoeskr/templates/src/systemtemplates/sections.html b/ratatoeskr/templates/src/systemtemplates/sections.html index b67563d..7ac3241 100644 --- a/ratatoeskr/templates/src/systemtemplates/sections.html +++ b/ratatoeskr/templates/src/systemtemplates/sections.html @@ -56,10 +56,7 @@
-   + | | diff --git a/ratatoeskr/templates/src/systemtemplates/settings.html b/ratatoeskr/templates/src/systemtemplates/settings.html index b7fee48..31021fe 100644 --- a/ratatoeskr/templates/src/systemtemplates/settings.html +++ b/ratatoeskr/templates/src/systemtemplates/settings.html @@ -38,7 +38,7 @@
-   + | | diff --git a/ratatoeskr/templates/src/systemtemplates/styles.html b/ratatoeskr/templates/src/systemtemplates/styles.html index 71464fb..30c4277 100644 --- a/ratatoeskr/templates/src/systemtemplates/styles.html +++ b/ratatoeskr/templates/src/systemtemplates/styles.html @@ -27,11 +27,7 @@
- - +

diff --git a/ratatoeskr/templates/src/systemtemplates/templates.html b/ratatoeskr/templates/src/systemtemplates/templates.html index eca33cf..1a33e31 100644 --- a/ratatoeskr/templates/src/systemtemplates/templates.html +++ b/ratatoeskr/templates/src/systemtemplates/templates.html @@ -27,11 +27,7 @@
- - +
diff --git a/ratatoeskr/templates/src/systemtemplates/users.html b/ratatoeskr/templates/src/systemtemplates/users.html index d9542a2..255759a 100644 --- a/ratatoeskr/templates/src/systemtemplates/users.html +++ b/ratatoeskr/templates/src/systemtemplates/users.html @@ -39,7 +39,7 @@
- +
@@ -72,7 +72,7 @@
- +
-- cgit v1.2.3-70-g09d2 From 84d920ef69d88e16956f49d81f6a1ba0e1129c2d Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Sat, 26 May 2012 12:55:35 +0200 Subject: Better(?) tag editor. * Look&Feel of the Tag editor now matches better with the rest of the backend. * Deleted templates, functions and translations that are not longer needed. --- ratatoeskr/backend.php | 232 +++++++++------------ .../templates/src/systemtemplates/areyousure.html | 11 - .../src/systemtemplates/tags_overview.html | 45 ++-- ratatoeskr/translations/de.php | 13 +- ratatoeskr/translations/en.php | 13 +- 5 files changed, 134 insertions(+), 180 deletions(-) delete mode 100644 ratatoeskr/templates/src/systemtemplates/areyousure.html (limited to 'ratatoeskr/templates/src') diff --git a/ratatoeskr/backend.php b/ratatoeskr/backend.php index a1ab570..3670137 100644 --- a/ratatoeskr/backend.php +++ b/ratatoeskr/backend.php @@ -39,25 +39,6 @@ function maketags($tagnames, $lang) return $rv; } -/* Generates Yes/No form / checks it. */ -function askyesno($ste, $callback, $question, $yes=NULL, $no=NULL, $moredetails="") -{ - if(isset($_POST["yes"])) - return True; - if(isset($_POST["no"])) - return False; - - $ste->vars["callback"] = $callback; - $ste->vars["question"] = $question; - if($yes !== NULL) - $ste->vars["yestext"] = $yes; - if($no !== NULL) - $ste->vars["notext"] = $no; - if($moredetails !== NULL) - $ste->vars["moredetails"] = $moredetails; - return $ste->exectemplate("/systemtemplates/areyousure.html"); -} - $backend_subactions = NULL; function build_backend_subactions() @@ -421,149 +402,136 @@ $backend_subactions = url_action_subactions(array( "tags" => function(&$data, $url_now, &$url_next) { global $translation, $languages, $ste, $rel_path_to_root; - $ste->vars["section"] = "content"; - $ste->vars["submenu"] = "tags"; - list($tagname, $tagaction) = $url_next; $url_next = array(); - if(isset($tagname)) + $ste->vars["section"] = "content"; + $ste->vars["submenu"] = "tags"; + $ste->vars["pagetitle"] = $translation["tags_overview"]; + + if(isset($_POST["delete"]) and ($_POST["really_delete"] == "yes")) { - try + foreach($_POST["tag_multiselect"] as $tagid) { - $tag = Tag::by_name($tagname); + try + { + $tag = Tag::by_id($tagid); + $tag->delete(); + } + catch(DoesNotExistError $e) + { + continue; + } } - catch(DoesNotExistError $e) + + $ste->vars["success"] = $translation["tags_successfully_deleted"]; + } + + if(isset($_POST["save_changes"])) + { + $newlang = (!empty($_POST["new_language"])) ? $_POST["new_language"] : NULL; + $newtag = NULL; + + if(!empty($_POST["newtagname"])) { - throw new NotFoundError(); + if((strpos(@$_POST["new_tag_name"], ",") !== False) or (strpos(@$_POST["new_tag_name"], " ") !== False)) + $ste->vars["error"] = $translation["invalid_tag_name"]; + else + $newtag = $_POST["newtagname"]; } - if(isset($tagaction)) + if(($newlang !== NULL) and (!isset($languages[$newlang]))) + $newlang = NULL; + if($newtag !== NULL) { - switch($tagaction) + try { - case "delete": - $ste->vars["pagetitle"] = str_replace("[[TAGNAME]]", $tag->name, $translation["delete_tag_pagetitle"]); - $yesnoresp = askyesno($ste, "$rel_path_to_root/backend/content/tags/{$tag->name}/delete", $translation["delete_comment_question"]); - if(is_string($yesnoresp)) - { - echo $yesnoresp; - return; - } - - if($yesnoresp) - { - $tag->delete(); - echo $ste->exectemplate("/systemtemplates/tag_deleted.html"); - } - else - goto backend_content_tags_overview; /* Hopefully no dinosaur will attack me: http://xkcd.com/292/ :-) */ - break; - case "addtranslation": - $ste->vars["pagetitle"] = $translation["tag_add_lang"]; - $ste->vars["tagname"] = $tag->name; - if(isset($_POST["addtranslation"])) - { - $errors = array(); - if(!isset($languages[@$_POST["language"]])) - $errors[] = $translation["language_unknown"]; - if(empty($_POST["translation"])) - $errors[] = $translation["no_translation_text_given"]; - if(empty($errors)) - { - $tag->title[$_POST["language"]] = new Translation($_POST["translation"], ""); - $tag->save(); - $ste->vars["success"] = $translation["tag_translation_added"]; - goto backend_content_tags_overview; - } - else - $ste->vars["errors"] = $errors; - } - echo $ste->exectemplate("/systemtemplates/tag_addtranslation.html"); - break; + $newtag = Tag::create($newtag); + } + catch(AlreadyExistsError $e) + { + $newtag = NULL; } } - } - else - { - backend_content_tags_overview: - if(isset($_POST["create_new_tag"])) + $translations = array(); + foreach($_POST as $k => $v) { - if((strpos(@$_POST["new_tag_name"], ",") !== False) or (strpos(@$_POST["new_tag_name"], " ") !== False) or (strlen(@$_POST["new_tag_name"]) == 0)) - $ste->vars["error"] = $translation["invalid_tag_name"]; - else + if(preg_match('/tagtrans_(NEW|[a-z]{2})_(.*)/', $k, $matches) == 1) { - try - { - $tag = Tag::create($_POST["new_tag_name"]); - $tag->title[$data["user"]->language] = new Translation($_POST["new_tag_name"], ""); - $tag->save(); - $ste->vars["success"] = $translation["tag_created_successfully"]; - } - catch(AlreadyExistsError $e) - { - $ste->vars["error"] = $translation["tag_name_already_in_use"]; - } + $lang = ($matches[1] == "NEW") ? $newlang : $matches[1]; + $tag = $matches[2]; + if($lang === NULL) + continue; + $translations[$tag][$lang] = $v; } } - if(isset($_POST["edit_translations"])) + foreach($translations as $tag => $langmap) { - $tagbuffer = array(); - foreach($_POST as $k => $v) + if($tag == "NEW") + { + if($newtag === NULL) + continue; + $tag = $newtag; + } + else { - if(preg_match("/^tagtrans_(.*?)_(.*)$/", $k, $matches)) + try { - if(!isset($languages[$matches[1]])) - continue; - - if(!isset($tagbuffer[$matches[2]])) - { - try - { - $tagbuffer[$matches[2]] = Tag::by_name($matches[2]); - } - catch(DoesNotExistError $e) - { - continue; - } - } - - if(empty($v) and isset($tagbuffer[$matches[2]]->title[$matches[1]])) - unset($tagbuffer[$matches[2]]->title[$matches[1]]); - elseif(empty($v)) - continue; - else - $tagbuffer[$matches[2]]->title[$matches[1]] = new Translation($v, ""); + $tag = Tag::by_id($tag); + } + catch(DoesNotExistError $e) + { + continue; } } - foreach($tagbuffer as $tag) - $tag->save(); + foreach($langmap as $l => $text) + { + if(empty($text)) + unset($tag->title[$l]); + else + $tag->title[$l] = new Translation($text, ""); + } - $ste->vars["success"] = $translation["tag_titles_edited_successfully"]; + $tag->save(); } - $ste->vars["pagetitle"] = $translation["tags_overview"]; - - $alltags = Tag::all(); - usort($alltags, function($a, $b) { return strcmp($a->name, $b->name); }); - $ste->vars["all_tag_langs"] = array(); - $ste->vars["alltags"] = array(); - foreach($alltags as $tag) - { - $tag_pre = array("name" => $tag->name, "translations" => array()); - foreach($tag->title as $langcode => $translation_obj) - { - $tag_pre["translations"][$langcode] = $translation_obj->text; - if(!isset($ste->vars["all_tag_langs"][$langcode])) - $ste->vars["all_tag_langs"][$langcode] = $languages[$langcode]["language"]; - } - $ste->vars["alltags"][] = $tag_pre; + $ste->vars["success"] = $translation["tags_successfully_edited"]; + } + + $ste->vars["alltags"] = array(); + $taglangs = array(); + + $alltags = Tag::all(); + foreach($alltags as $tag) + { + $transls = array(); + foreach($tag->title as $l => $t) + { + if(!in_array($l, $taglangs)) + $taglangs[] = $l; + $transls[$l] = $t->text; } - echo $ste->exectemplate("/systemtemplates/tags_overview.html"); + + $ste->vars["alltags"][] = array( + "id" => $tag->get_id(), + "name" => $tag->name, + "translations" => $transls + ); } + + $unused_langs = array_diff(array_keys($languages), $taglangs); + + $ste->vars["all_tag_langs"] = array(); + foreach($taglangs as $l) + $ste->vars["all_tag_langs"][$l] = $languages[$l]["language"]; + $ste->vars["unused_languages"] = array(); + foreach($unused_langs as $l) + $ste->vars["unused_languages"][$l] = $languages[$l]["language"]; + + echo $ste->exectemplate("/systemtemplates/tags_overview.html"); }, "articles" => function(&$data, $url_now, &$url_next) { diff --git a/ratatoeskr/templates/src/systemtemplates/areyousure.html b/ratatoeskr/templates/src/systemtemplates/areyousure.html deleted file mode 100644 index 0d40585..0000000 --- a/ratatoeskr/templates/src/systemtemplates/areyousure.html +++ /dev/null @@ -1,11 +0,0 @@ - - -
-

$question

- ?{$moredetails|

$moredetails

|} -
- - -
-
-
diff --git a/ratatoeskr/templates/src/systemtemplates/tags_overview.html b/ratatoeskr/templates/src/systemtemplates/tags_overview.html index 1f5b8d5..e82fd61 100644 --- a/ratatoeskr/templates/src/systemtemplates/tags_overview.html +++ b/ratatoeskr/templates/src/systemtemplates/tags_overview.html @@ -7,41 +7,52 @@ + - - + - - + + + + + + + + + +
  ($langcode) $langname + +
$tagdata[name] - <ste:get_translation for='delete' /> - $tagdata[name] - + - <ste:get_translation for='tag_add_lang' /> +
  + + + +
-
+
+ | +
- -
-

-
-

:

-

-
-
diff --git a/ratatoeskr/translations/de.php b/ratatoeskr/translations/de.php index 66c68d8..ae909b1 100644 --- a/ratatoeskr/translations/de.php +++ b/ratatoeskr/translations/de.php @@ -61,25 +61,18 @@ $translation = array( "allow_comments" => "Kommentare erlauben?", "article_name_already_in_use" => "Artikelname bereits vergeben.", "article_save_success" => "Artikel erfolgreich abgespeichert.", - "delete_tag_pagetitle" => "\"[[TAGNAME]]\" löschen", - "delete_comment_question" => "Möchtest du diesen Tag löschen?", - "tag_deleted" => "Tag gelöscht.", - "back_to_tags" => "Zurück zu Inhalt::Tags", - "create_new_tag" => "Neuen Tag erstellen", + "tags_successfully_deleted" => "Tags erfolgreich gelöscht.", "new_tag_name" => "Name", + "tags_successfully_edited" => "Tags erfolgreich bearbeitet." "tags_overview" => "Tag Übersicht", "tag_name" => "Tag Name", "yes" => "Ja", "no" => "Nein", "tag_add_lang" => "Übersetzung hinzufügen", + "save_changes" => "Änderungen speichern", "language_unknown" => "Unbekannte Sprache", - "no_translation_text_given" => "Kein Übersetzungstext angegeben.", "translation_added_successfully" => "Übersetzung erfolgreich hinzufügefügt.", - "tag_translation_added" => "Übersetzung hinzugefügt.", "invalid_tag_name" => "Ungülter Tagname. Ein Tagname darf keine Kommas (,) oder Leerzeichen ( ) enthalten und darf nicht leer sein.", - "tag_name_already_in_use" => "Tagname bereits vergeben.", - "tag_created_successfully" => "Tag erfolgreich erstellt.", - "tag_titles_edited_successfully" => "Tagtitel erfolgreich geändert.", "available_languages" => "Verfügbare Sprachen", "tags" => "Tags", "section" => "Sektion", diff --git a/ratatoeskr/translations/en.php b/ratatoeskr/translations/en.php index 27374c6..86e17a2 100644 --- a/ratatoeskr/translations/en.php +++ b/ratatoeskr/translations/en.php @@ -61,25 +61,18 @@ $translation = array( "allow_comments" => "Allow comments?", "article_name_already_in_use" => "Article name is already in use.", "article_save_success" => "Article successfully saved.", - "delete_tag_pagetitle" => "Delete \"[[TAGNAME]]\"", - "delete_comment_question" => "Do you want to delete this tag?", - "tag_deleted" => "Tag was deleted.", - "back_to_tags" => "Go back to Content::Tags", - "create_new_tag" => "Create a new Tag", + "tags_successfully_deleted" => "Tags successfully deleted.", "new_tag_name" => "Name", + "tags_successfully_edited" => "Successfully edited tags.", "tags_overview" => "Tag Overview", "tag_name" => "Tag name", "yes" => "Yes", "no" => "No", "tag_add_lang" => "Add translation", + "save_changes" => "Save changes", "language_unknown" => "Unknown language", - "no_translation_text_given" => "No translation text given.", "translation_added_successfully" => "Translation added successfully.", - "tag_translation_added" => "Translation added.", "invalid_tag_name" => "Invalid tag name. A tag name can not contain commas (,) or spaces ( ) and must not be empty.", - "tag_name_already_in_use" => "Tag name already in use.", - "tag_created_successfully" => "Tag created successfully.", - "tag_titles_edited_successfully" => "Tag titles changed successfully.", "available_languages" => "Available languages", "tags" => "Tags", "section" => "Section", -- cgit v1.2.3-70-g09d2