From ca65ebd912ea2e30a8f9748095cd36d3819d03e3 Mon Sep 17 00:00:00 2001 From: Matthias Mees Date: Sun, 25 Sep 2016 17:42:57 +0200 Subject: [PATCH] A new 2.x backend for serendipity_event_staticpages - Simplify static pages nav - Update backend markup - Use standard s9y backend messages - Add responsive backend styles - Restructure staticpage simple template References s9y/Serendipity#149 --- .../default_staticpage_backend.tpl | 414 ++++++++---------- serendipity_event_staticpage/lang_en.inc.php | 7 +- .../serendipity_event_staticpage.php | 336 +++++++------- .../style_staticpage_backend.css | 235 +++++++--- 4 files changed, 524 insertions(+), 468 deletions(-) diff --git a/serendipity_event_staticpage/backend_templates/default_staticpage_backend.tpl b/serendipity_event_staticpage/backend_templates/default_staticpage_backend.tpl index aa95cbc4..e5d55562 100644 --- a/serendipity_event_staticpage/backend_templates/default_staticpage_backend.tpl +++ b/serendipity_event_staticpage/backend_templates/default_staticpage_backend.tpl @@ -1,243 +1,187 @@ -
+
+
+

{$CONST.STATICPAGE_SECTION_BASIC}

- - -
- -
- - -
- {$CONST.STATICPAGE_SECTION_BASIC} -
-
- {staticpage_input item="headline"} -
- -
-
- {staticpage_input item="articleformattitle"} -
- -
-
- {staticpage_input item="content"} -
- - {if $showmeta} -
- {$CONST.STATICPAGES_CUSTOM_META_SHOW} -

+/- {$CONST.TOGGLE_ALL}

-
- -
-
-
- {staticpage_input item="title_element"} -
- -
-
- {staticpage_input item="meta_description"} -
- -
-
- {staticpage_input item="meta_keywords"} -
-
- - {/if} -
- -
- {$CONST.STATICPAGE_SECTION_STRUCT} - {if !$is_wysiwyg} -
- {$CONST.STATICPAGES_CUSTOM_STRUCTURE_SHOW} -

+/- {$CONST.TOGGLE_ALL}

-
- {/if} - -
-
-
- {staticpage_input item="authorid"} -
- -
-
- {staticpage_input item="articletype"} -
- -
-
- {staticpage_input item="language"} -
- -
-
- {staticpage_input item="related_category_id"} -
- -
-
- {staticpage_input item="parent_id"} -
- -
-
- {staticpage_input item="show_childpages"} -
- -
-
- {staticpage_input item="shownavi"} -
- -
-
- {staticpage_input item="show_breadcrumb"} -
- -
-
- {staticpage_input item="pre_content"} -
- -
- {if !$is_wysiwyg}{/if} -
-
- -
- -
- {$CONST.STATICPAGE_SECTION_META} -
-
- {staticpage_input item="pagetitle"} -
- -
-
- {staticpage_input item="permalink"} -
- -
-
- {staticpage_input item="pass"} -
- -
- -
- {$CONST.STATICPAGE_SECTION_OPT} -
-
- {staticpage_input item="publishstatus"} -
- -
-
- {staticpage_input item="is_startpage"} -
- -
-
- {staticpage_input item="is_404_page"} -
- -
-
- {staticpage_input item="showonnavi"} -
- -
-
- {staticpage_input item="markup"} -
- -
-
- {staticpage_input item="articleformat"} -
- -
-
- {staticpage_input item="timestamp"} -
- -
- - {* EXAMPLE FOR CUSTOM STATICPAGE PROPERTIES - -
- Custom - -
-
- -
- -
-
- -
-
- END OF EXAMPLE FOR CUSTOM STATICPAGE PROPERTIES *} - -
- +
+ + {staticpage_input item="headline"}
-
-
+
+ + {staticpage_input item="articleformattitle"} +
+
+ + {staticpage_input item="content"} +
+ +
+ + {staticpage_input item="pre_content"} +
+
+ +
+ +
+ +
+
+

{$CONST.STATICPAGE_SECTION_STRUCT}

+ +
+ + {staticpage_input item="pagetitle"} +
+ +
+ + {staticpage_input item="permalink"} +
+ +
+ + {staticpage_input item="publishstatus"} +
+ +
+ + {staticpage_input item="articletype"} +
+ +
+ + {staticpage_input item="language"} +
+ +
+ + {staticpage_input item="related_category_id"} +
+
+
+ +
+
+

{$CONST.STATICPAGE_SECTION_ACCESS}

+ +
+ + {staticpage_input item="pass"} +
+ +
+ + {staticpage_input item="parent_id"} +
+ +
+ {staticpage_input item="show_childpages" what="name"|escape:js} + {staticpage_input item="show_childpages"} +
+ +
+ {staticpage_input item="shownavi" what="name"|escape:js} + {staticpage_input item="shownavi"} +
+ +
+ {staticpage_input item="showonnavi" what="name"|escape:js} + {staticpage_input item="showonnavi"} +
+ +
+ {staticpage_input item="show_breadcrumb" what="name"|escape:js} + {staticpage_input item="show_breadcrumb"} +
+
+
+ +
+
+

{$CONST.STATICPAGE_SECTION_META}

+ +
+ + {staticpage_input item="timestamp"} +
+ +
+ + {staticpage_input item="authorid"} +
+ +
+ + {staticpage_input item="title_element"} +
+ +
+ + {staticpage_input item="meta_description"} +
+ +
+ + {staticpage_input item="meta_keywords"} +
+
+
+ +
+
+

{$CONST.STATICPAGE_SECTION_OPT}

+ +
+ {staticpage_input item="is_startpage" what="name"|escape:js} + {staticpage_input item="is_startpage"} +
+ +
+ {staticpage_input item="is_404_page" what="name"|escape:js} + {staticpage_input item="is_404_page"} +
+ +
+ {staticpage_input item="markup" what="name"|escape:js} + {staticpage_input item="markup"} +
+ +
+ {staticpage_input item="articleformat" what="name"|escape:js} + {staticpage_input item="articleformat"} +
+
+
+ +{* EXAMPLE FOR CUSTOM STATICPAGE PROPERTIES + +
+
+

Custom

+ +
+ + +
+ +
+ + +
+
+
+ END OF EXAMPLE FOR CUSTOM STATICPAGE PROPERTIES *} +
{staticpage_input_finish} -
-
- +
+
- diff --git a/serendipity_event_staticpage/lang_en.inc.php b/serendipity_event_staticpage/lang_en.inc.php index 43887916..ff22187a 100644 --- a/serendipity_event_staticpage/lang_en.inc.php +++ b/serendipity_event_staticpage/lang_en.inc.php @@ -1,7 +1,7 @@ - * EN-Revision: Revision of lang_en.inc.php */ @@ -174,6 +174,7 @@ @define('STATICPAGE_SECTION_BASIC', 'Basic Content'); @define('STATICPAGE_SECTION_OPT', 'Options'); @define('STATICPAGE_SECTION_STRUCT', 'Structural'); +@define('STATICPAGE_SECTION_ACCESS', 'Access'); @define('PLUGIN_STATICPAGELIST_SMARTIFY', 'Smartify Sidebar list'); @define('PLUGIN_STATICPAGELIST_SMARTIFY_BLAHBLAH', 'Use smarty template file: "plugin_staticpage_sidebar.tpl" for sidebar output (allows to truncate length via smarty).'); @@ -183,4 +184,4 @@ @define('STATICPAGE_SHOW_BREADCRUMB_DEFAULT', 'Show breadcrumb'); @define('STATICPAGE_SHOW_BREADCRUMB', 'Show breadcrumb'); @define('STATICPAGE_SHOW_BREADCRUMB_DESC', 'Show breadcrumb navigation on this page.'); -?> \ No newline at end of file +?> diff --git a/serendipity_event_staticpage/serendipity_event_staticpage.php b/serendipity_event_staticpage/serendipity_event_staticpage.php index d0ba473c..0d08a7dc 100644 --- a/serendipity_event_staticpage/serendipity_event_staticpage.php +++ b/serendipity_event_staticpage/serendipity_event_staticpage.php @@ -1676,13 +1676,13 @@ class serendipity_event_staticpage extends serendipity_event if (!isset($this->pagetype['id'])) { $result = serendipity_db_insert('staticpages_types', $this->pagetype); if (is_string($result)) { - echo '
ERROR: ' . $result . '
'; + echo ' ERROR: ' . $result . ''; } $serendipity["POST"]["pagetype"] = serendipity_db_insert_id('staticpages_types', 'id'); } else { $result = serendipity_db_update('staticpages_types', array('id' => $this->pagetype['id']), $this->pagetype); if (is_string($result)) { - echo '
ERROR: ' . $result . '
'; + echo ' ERROR: ' . $result . ''; } } } @@ -1758,27 +1758,24 @@ class serendipity_event_staticpage extends serendipity_event } if ($serendipity['version'][0] < 2) { - echo ''."\n"; - echo ''; + echo '' . "\n"; + echo ''; } ?> - -
-
    -
  • >
  • -
  • >
  • -
  • >
  • -
  • >
  • +

    +
      +
    • +
    • +
    • +
    -
- ' . STATICPAGE_PAGEORDER_DESC . '

'; + echo '

' . STATICPAGE_PAGEORDER_DESC . '

'; switch($serendipity['GET']['moveto']) { case 'moveup': @@ -1793,32 +1790,34 @@ class serendipity_event_staticpage extends serendipity_event if(is_array($pages)) { $pages = serendipity_walkRecursive($pages); $sort_idx = 0; - echo ''."\n"; + echo ''."\n"; - echo ''."\n"; - echo ''."\n"; - echo ''."\n"; - echo ''."\n"; + echo ''."\n"; + echo ''."\n"; $sort_idx++; } - echo '
'; + $oddeven = ($sort_idx % 2 == 0) ? 'odd' : 'even'; + echo '
  • '."\n"; + echo ''; echo str_repeat(' ', $page['depth']).$page['pagetitle']; - echo '
  • '; + echo ''; + echo '
      '; + echo '
    • '; if($sort_idx == 0) { - echo ' '; + echo ' '; } else { - echo '' . UP . ''; + echo '' . UP . ''; } - echo '
    '; + echo ''."\n"; + echo '
  • '; if ($sort_idx == (count($pages)-1)) { - echo ' '; + echo ' '; } else { - echo ($page['moveup']!= '' ? ' ' : '') . ''. DOWN .''; + echo ($page['moveup']!= '' ? ' ' : '') . ''. DOWN .''; } - echo '
  • '."\n"; + echo ''."\n"; } @@ -1845,48 +1844,44 @@ class serendipity_event_staticpage extends serendipity_event $this->pagetype[$config_item] = serendipity_get_bool($serendipity['POST']['plugin'][$config_item]); } } - echo '
    '. DONE .': '. sprintf(SETTINGS_SAVED_AT, serendipity_strftime('%H:%M:%S')) .'
    '; + echo ''. DONE .': '. sprintf(SETTINGS_SAVED_AT, serendipity_strftime('%H:%M:%S')) .''; $this->updatePageType(); } if (!empty($serendipity['POST']['typeDelete']) && $serendipity['POST']['pagetype'] != '__new') { serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}staticpages_types WHERE id = " . (int)$serendipity['POST']['pagetype']); - echo '
    '. DONE .': '. sprintf(RIP_ENTRY, $this->pagetype['description']) . '
    '; + echo ''. DONE .': '. sprintf(RIP_ENTRY, $this->pagetype['description']) . ''; } echo '
    '; echo ''; echo ''; echo ''; - echo '
    '; - echo '' . PAGETYPES_SELECT . '

    '; + + echo '

    ' . PAGETYPES_SELECT . '

    '; + echo '
    '; echo ' -' . WORD_OR . '- '; - echo ''; - echo '
    '; - echo '
    '; - + echo '
    '; + echo '
    '; if ($serendipity['POST']['typeSubmit']) { echo ''; $this->showForm($this->config_types, $this->pagetype, 'introspect_item_type', 'get_type', 'typeSubmit'); } - echo ''; - echo '
    '; break; case 'pageadd': - echo '' . STATICPAGE_PAGEADD_DESC . '

    '; + echo '

    ' . STATICPAGE_PAGEADD_DESC . '

    '; $plugins = $this->selectPlugins(); $insplugins = $this->fetchPlugins(); @@ -1921,24 +1916,31 @@ class serendipity_event_staticpage extends serendipity_event } else { $c = ''; } - echo ''.$plugin['name'].'
    '; + echo '
    '; } - echo ''; + echo ''; echo ''; } - echo '' . STATICPAGE_PAGEADD_PLUGINS . '

    '; + + echo '

    ' . STATICPAGE_PAGEADD_PLUGINS . '

    '; + $this->pluginstatus(); - echo ''; - echo ''; - echo ''; - echo ''; + echo '
    '.EVENT_PLUGIN.''.STATICPAGE_STATUS.'
    '; + echo ''; + echo ''; + echo ''; + echo ''; echo ''; + echo ''; + $i = 0; foreach($this->pluginstats as $key => $value) { - echo ''; - echo ''; - echo ''; + $rows = ($i % 2 == 0) ? 'odd' : 'even'; + echo ''; + echo ''; + echo ''; echo ''; + $i++; } echo '
    ' . EVENT_PLUGIN . '' . STATICPAGE_STATUS . '
    '.$key.''.$value['status'].'
    ' .$key . '' . $value['status'] . '
    '; break; @@ -1967,9 +1969,9 @@ class serendipity_event_staticpage extends serendipity_event $result = $this->updateStaticPage(); if (is_string($result)) { - echo '
    ERROR: ' . $result . '
    '; + echo ' ERROR: ' . $result . ''; } else { - echo '
    '. DONE .': '. sprintf(SETTINGS_SAVED_AT, serendipity_strftime('%H:%M:%S')). '
    '; + echo '' . DONE . ': ' . sprintf(SETTINGS_SAVED_AT, serendipity_strftime('%H:%M:%S')). ''; } } @@ -1977,18 +1979,16 @@ class serendipity_event_staticpage extends serendipity_event if (!empty($serendipity['POST']['staticDelete']) && $serendipity['POST']['staticpage'] != '__new') { if (!$this->getChildPage($serendipity['POST']['staticpage'])) { serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}staticpages WHERE id = " . (int)$serendipity['POST']['staticpage']); - echo '
    '. DONE .': '. sprintf(RIP_ENTRY, $this->staticpage['pagetitle']) . '
    '; + echo '' . DONE . ': '. sprintf(RIP_ENTRY, $this->staticpage['pagetitle']) . ''; } else { - echo '
    '. IMPORT_NOTES . ': '. STATICPAGE_CANNOTDELETE_MSG . '
    '; + echo '' . IMPORT_NOTES . ': '. STATICPAGE_CANNOTDELETE_MSG . ''; } } echo '
    '; - echo '
    '; - echo ' '; - echo ' '; - echo ' '; - echo '
    '; + echo ''; + echo ''; + echo ''; if (empty($serendipity['POST']['backend_template'])) { if (!empty($serendipity['COOKIE']['backend_template'])) { @@ -1998,7 +1998,28 @@ class serendipity_event_staticpage extends serendipity_event serendipity_JSsetCookie('backend_template', $serendipity['POST']['backend_template']); } - echo '
    '; + echo '

    ' . STATICPAGE_SELECT . '

    '; + + echo '
    '; + echo '
    '; + echo '
    '; + echo '
    '; + echo '
    '; + + echo '
    '; echo ' '; echo '
    '; - echo '
    '; - echo '' . STATICPAGE_SELECT . '

    '; - echo ' -' . WORD_OR . '- '; - echo ' -' . WORD_OR . '- '; - if ($sbplav) { - echo '
    '; - echo 'info'; - echo '
    '; + echo ' '; + echo 'Staticpage Sidebar ' . STATICPAGE_PLUGIN_AVAILABLE; + echo ''; } echo '
    '; if (!empty($serendipity['POST']['staticPreview'])) { $link = $serendipity['baseURL'] . $serendipity['indexFile'] . '?serendipity[staticid]=' . $this->staticpage['id'] . '&serendipity[staticPreview]=1'; - echo ''; $serendipity['POST']['staticSubmit'] = true; - echo '

    ' . sprintf(PLUGIN_STATICPAGE_PREVIEW, '' . $this->staticpage['pagetitle'] . '') . '

    '; + echo ' ' . sprintf(PLUGIN_STATICPAGE_PREVIEW, '' . $this->staticpage['pagetitle'] . '') . ''; } - echo '
    '; - if ($serendipity['POST']['staticSubmit'] || isset($serendipity['GET']['staticid'])) { $serendipity['POST']['plugin']['custom'] = $this->staticpage['custom']; - echo ''; + echo ''; $this->showForm($this->config, $this->staticpage); - echo "
    \n"; echo ''; - + } else { + echo ''; + $this->listStaticPages(); } - else - { - echo "
    \n"; - echo ''; - $this->listStaticPages(); - } break; @@ -2178,14 +2174,14 @@ class serendipity_event_staticpage extends serendipity_event if (!$is_smarty) { ?> - +
      - +
    + -
    $select_desc) { if (!$is_smarty) { ?> -    - + + $select_desc) { if (!$is_smarty) { ?> -    + $select_desc) {
    - +
    @@ -2414,7 +2408,7 @@ foreach($select AS $select_value => $select_desc) { case 'hidden': if (!$is_smarty) {?> $select_desc) { if (!$is_smarty) { ?> - + -
      + - +
    - +
    @@ -2581,8 +2575,7 @@ foreach($select AS $select_value => $select_desc) { return true; } ?> -

    - +
    htmlnugget = array(); @@ -2627,7 +2620,7 @@ foreach($select AS $select_value => $select_desc) { if ($ev['skip_nuggets'] === false) { ?> -