[2.0] Restructuring the backend

Mark threads with "[2.0]" for discussions about features in the longer-term future, "[1.6]" is for short-term. This is not the place for general discussions or plugin or template requests. Only features that are approved to happen by the core team should be listed here for better structuring.
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: [2.0] Restructuring the backend

Post by yellowled »

Timbalu wrote:But I also like (the/Dons) Admin screen as of now - it is nearly clean and simple.
To make this very clear: This is not about Don's admin theme at all. Besides making it easier for users to find stuff, remember that this is also about making it easier to style the backend and to get rid of a lot clutter there. Also, user experience is almost always about the little things which in my opinion you don't really savor here.
Timbalu wrote:Why mix Plugin administration things (tags, staticpages, spamblock, and other event plugins, ....) into the nav to different places? I know about the coherencies, which told you to go this way. But this is not simple. Why not have them all in one Place like "Admire Addons", split into a core plugin and a 'user' plugin section, or equal.
Because a (new) user doesn't know what plugins are or could do in the first place. It's not a proper label for the functionality they provide. Picture these groups as collapsed menus where users only see the headlines in the initial state. Now picture a (new) user looking for the spamblock options -- "Feedback" seems way more precise than "Plugins", right?

YL
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: [2.0] Restructuring the backend

Post by yellowled »

Timbalu wrote:Normal Users dont really know core plugins are plugins at all.
The typical John Doe user also doesn't even know (or care!) about the difference between core and external plugins. At first, he doesn't even know what plugins are. That's why in my humble opinion, "Extend" is the proper label here. That's a term even people with almost no technical background will understand.

Edit: BTW, is there a way to get a list of all plugins which actually add a menu item? Maybe this makes much more sense if I mock it up with a "full" menu.

YL
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: [2.0] Restructuring the backend

Post by Timbalu »

yellowled wrote:
Timbalu wrote:Why mix Plugin administration things (tags, staticpages, spamblock, and other event plugins, ....) into the nav to different places? I know about the coherencies, which told you to go this way. But this is not simple. Why not have them all in one Place like "Admire Addons", split into a core plugin and a 'user' plugin section, or equal.
Because a (new) user doesn't know what plugins are or could do in the first place. It's not a proper label for the functionality they provide. Picture these groups as collapsed menus where users only see the headlines in the initial state. Now picture a (new) user looking for the spamblock options -- "Feedback" seems way more precise than "Plugins", right?
To be honest? No! "Feedback" is something like comments. If you know about "feedback" in your sense of meaning, you know about Plugins and what they can do to data.
But you know - being Germans - Names are "Schall & Rauch" :wink:
I didn't require 'Plugins' to be the name of the month. I just said that you are on the way to have more Navigation-Block-Names than now, which can be something worthfull in some cases. If you love Extends and everybody really knows what is meant, this is ok for me. I just remembered me learning a programmers hard way what extend meant. Before, it did say nothing to me.

Do we really need groups as collapsed menus, if we keep it simple? It sounds for me like just one more click into paradise.

About the splendid Serendipity Plugin system and people learning how to use them more and more....
one could say: "Name them Apps and even our younger ones will know what they are in these times!" :lol:
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: [2.0] Restructuring the backend

Post by yellowled »

Timbalu wrote:
yellowled wrote:Now picture a (new) user looking for the spamblock options -- "Feedback" seems way more precise than "Plugins", right?
To be honest? No! "Feedback" is something like comments.
Which is exactly what the spamblock plugin is related to -- feedback as a common denominator for comments and trackbacks. A plugin should be identified by the functionality it provides, not by the fact that it is a plugin, because the functionality is a much more "independent" term which people not familiar with S9y are much more likely to understand without any explanation. That is, by the way, actually what defines a good user interface -- being able to use it (more or less) intuitively.
Timbalu wrote:Do we really need groups as collapsed menus, if we keep it simple?
Who said anything about needing them? I used this as an example to illustrate why re-grouping the nav items might improve the user experience or make it easier to guide users through the interface. Again: I am not talking about any graphical aspects of the interface yet.

YL
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: [2.0] Restructuring the backend

Post by Timbalu »

yellowled wrote:Again: I am not talking about any graphical aspects of the interface yet.
Me too!
And if you would read my remarks more willingly, you wouldn't need to comment just broken text-strips, as you are doing quite often. If you don't want positive "feedback", I can behave like the spamblock plugin and give back NULL. :wink:
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: [2.0] Restructuring the backend

Post by yellowled »

Timbalu wrote:And if you would read my remarks more willingly, you wouldn't need to comment just broken text-strips, as you are doing quite often.
I beg your pardon? :? I quote the parts of your posts which I refer to. There is absolutely no need to quote every single word you posted. If everybody would do that, this forum would be unreadable. So if I do not quote every single word you posted it does not mean I didn't read them.

YL
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: [2.0] Restructuring the backend

Post by Timbalu »

I just caught this this morning, but wasn't sure if to put it in the frontend thread or in here...

https://github.com/paulirish/html5-boilerplate/
http://de.html5boilerplate.com/

It might help us hooking up, at least it looks quite interesting! :)
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: [2.0] Restructuring the backend

Post by yellowled »

Timbalu wrote:http://de.html5boilerplate.com/

It might help us hooking up, at least it looks quite interesting! :)
So you haven't looked at it, like, at all? :wink:

Well, I have. It's good, but it's really not much more than a kickstart template. It does have some nice stuff, so it's definitely worth a look for HTML5 newbies.

I actually have a derivative framework which I'd much rather use for S9y stuff.

YL
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: [2.0] Restructuring the backend

Post by Timbalu »

I was just listening to the new podcast, thank you all three, and may have been near the end hearing you say, that the new Front/Back/end layer could be beyond S9y 1.7 ....
yellowled wrote:So you haven't looked at it, like, at all? :wink:
It's good, ...., so it's definitely worth a look for HTML5 newbies.
Well actually I did flew over it, but for sure I didn't want to bite any HTML5 professional, linking it here! :wink:
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: [2.0] Restructuring the backend

Post by yellowled »

Timbalu wrote:I was just listening to the new podcast, thank you all three, and may have been near the end hearing you say, that the new Front/Back/end layer could be beyond S9y 1.7 ....
Okay, showing my hand here:

I have something for the frontend, which isn't much more than a layout framework. It needs a design and some theme options, but the templates are there as well as the general CSS framework. Definitely not enough to show it to anybody as of now.

As for the backend: Unfortunately, building the prototypes (i.e. editing saved HTML pages from the various sections in the backend) is very time-consuming. The S9y podcast encouraged a listener to offer his help, maybe that will speed things up a little.

YL
onli
Regular
Posts: 2822
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: [2.0] Restructuring the backend

Post by onli »

As a proof of concept, I modified the template-section of the backend to use smarty. I hope that this will help you modifiying the backend.

templates.inc.php:

Code: Select all

<?php # $Id$
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved.  See LICENSE file for licensing details

if (IN_serendipity !== true) {
    die ("Don't hack!");
}

if (!serendipity_checkPermission('adminTemplates')) {
    return;
}

class template_option {
    var $config = null;
    var $values = null;
    var $keys   = null;

    function introspect_config_item($item, &$bag) {
        foreach($this->config[$item] AS $key => $val) {
            $bag->add($key, $val);
        }
    }

    function get_config($item) {
        return $this->values[$item];
    }

    function set_config($item, $value) {
        global $serendipity;
        
        serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}options
                                    WHERE okey = 't_" . serendipity_db_escape_string($serendipity['template']) . "'
                                      AND name = '" . serendipity_db_escape_string($item) . "'");
                                                                                    
        if ($this->config[$item]['scope'] == 'global') {
            serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}options
                                   WHERE okey = 't_global'
                                     AND name = '" . serendipity_db_escape_string($item) . "'");
            serendipity_db_query("INSERT INTO {$serendipity['dbPrefix']}options (okey, name, value)
                                       VALUES ('t_global', '" . serendipity_db_escape_string($item) . "', '" . serendipity_db_escape_string($value) . "')");
        } else {
            serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}options
                                   WHERE okey = 't_" . serendipity_db_escape_string($serendipity['template']) . "'
                                     AND name = '" . serendipity_db_escape_string($item) . "'");
            serendipity_db_query("INSERT INTO {$serendipity['dbPrefix']}options (okey, name, value)
                                       VALUES ('t_" . serendipity_db_escape_string($serendipity['template']) . "', '" . serendipity_db_escape_string($item) . "', '" . serendipity_db_escape_string($value) . "')");
        }
        return true;
    }

    function import(&$config) {
        foreach($config AS $key => $item) {
            $this->config[$item['var']] = $item;
            $this->keys[$item['var']]   = $item['var'];
        }
    }
}

$data = array();

if ($serendipity['GET']['adminAction'] == 'install' ) {
    serendipity_plugin_api::hook_event('backend_templates_fetchtemplate', $serendipity);

    $themeInfo = serendipity_fetchTemplateInfo(htmlspecialchars($serendipity['GET']['theme']));

    serendipity_set_config_var('template', htmlspecialchars($serendipity['GET']['theme']));
    serendipity_set_config_var('template_engine', isset($themeInfo['engine']) ? $themeInfo['engine'] : 'default');

    $data["adminAction"] = "install";
    $data["install_template"] = sprintf(TEMPLATE_SET, htmlspecialchars($serendipity['GET']['theme']));
}
?>

<?php
if ( @file_exists($serendipity['serendipityPath'] . $serendipity['templatePath'] . $serendipity['template'] .'/layout.php') ) {
    $data["deprecated"] = true;
}

$data["cur_template"] = $serendipity['template'];

if (file_exists($serendipity['serendipityPath'] . $serendipity['templatePath'] . $serendipity['template'] . '/config.inc.php')) {
    serendipity_smarty_init();
    include_once $serendipity['serendipityPath'] . $serendipity['templatePath'] . $serendipity['template'] . '/config.inc.php';
}

if (is_array($template_config)) {
    serendipity_plugin_api::hook_event('backend_templates_configuration_top', $template_config);
    $data["has_config"] = true;

    if ($serendipity['POST']['adminAction'] == 'configure' &&  serendipity_checkFormToken()) {
        $storage = new template_option();
        $storage->import($template_config);
        foreach($serendipity['POST']['template'] AS $option => $value) {
            $storage->set_config($option, $value);
        }
        $data["adminAction"] = "configure";
        $data["save_time"] = sprintf(SETTINGS_SAVED_AT, serendipity_strftime('%H:%M:%S'));
    }

    $data["form_token"] = serendipity_setFormToken();

    include S9Y_INCLUDE_PATH . 'include/functions_plugins_admin.inc.php';

    $template_vars =& serendipity_loadThemeOptions($template_config);
    
    $template_options = new template_option();
    $template_options->import($template_config);
    $template_options->values =& $template_vars;

    ob_start();
    serendipity_plugin_config(
        $template_options,
        $template_vars,
        $serendipity['template'],
        $serendipity['template'],
        $template_options->keys,
        true,
        true,
        true,
        true,
        'template',
        $template_config_groups
    );
    $data["configuration"] = ob_get_contents();
    ob_end_clean();
    
    serendipity_plugin_api::hook_event('backend_templates_configuration_bottom', $template_config);
} else {
    serendipity_plugin_api::hook_event('backend_templates_configuration_none', $template_config);
}

    $i = 0;
    $stack = array();
    serendipity_plugin_api::hook_event('backend_templates_fetchlist', $stack);
    $themes = serendipity_fetchTemplates();
    $data['templates'] = array();
    $data['templates'][$theme] = array();
    foreach($themes AS $theme) {
        $stack[$theme] = serendipity_fetchTemplateInfo($theme);
    }
    ksort($stack);

    
    foreach ($stack as $theme => $info) {
        $data['templates'][$theme]['info'] = $info;
        /* Sorry, but we don't display engines */
        if ( strtolower($info['engine']) == 'yes' ) {
            continue;
        }

        if (file_exists($serendipity['serendipityPath'] . $serendipity['templatePath'] . $theme . '/preview_fullsize.jpg')) {
            $data['templates'][$theme]['fullsize_preview'] = $serendipity['baseURL'] . $serendipity['templatePath'] . $theme . '/preview_fullsize.jpg';
        } elseif (!empty($info['preview_fullsizeURL'])) {
            $data['templates'][$theme]['fullsize_preview'] = $info['preview_fullsizeURL'];
        }

        if (file_exists($serendipity['serendipityPath'] . $serendipity['templatePath'] . $theme . '/preview.png')) {
            $data['templates'][$theme]['preview'] = $serendipity['templatePath'] . $theme . '/preview.png';
        } elseif (!empty($info['previewURL'])) {
            $data['templates'][$theme]['preview'] = $info['previewURL'] ;
        }

        $unmetRequirements = array();
        if ( isset($info['require serendipity']) && version_compare($info['require serendipity'], serendipity_getCoreVersion($serendipity['version']), '>') ) {
            $unmetRequirements[] = 'Serendipity '. $info['require serendipity'];
            $data['templates'][$theme]['unmetRequirements'] = sprintf(UNMET_REQUIREMENTS, implode(', ', $unmetRequirements));
        }

        /* TODO: Smarty versioncheck */
    }
    
if (!is_object($serendipity['smarty'])) {
    serendipity_smarty_init();
}

$serendipity['smarty']->assign($data);

$tfile = serendipity_getTemplateFile("admin/templates.inc.tpl", 'serendipityPath');

$inclusion = $serendipity['smarty']->security_settings[INCLUDE_ANY];
$serendipity['smarty']->security_settings[INCLUDE_ANY] = true;
$content = $serendipity['smarty']->fetch('file:'. $tfile);
$serendipity['smarty']->security_settings[INCLUDE_ANY] = $inclusion;

echo $content;
templates.inc.tpl:

Code: Select all

{if $adminAction == "install"}
    <div class="serendipityAdminMsgSuccess">
        <img style="height: 22px; width: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="{serendipity_getFile file="admin/img/admin_msg_success.png"}" alt="" />
            {$install_template}
    </div>
{/if}

{if $deprecated}
    <div class="serendipityAdminMsgNote">
        <img style="width: 22px; height: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="{serendipity_getFile file="admin/img/admin_msg_note.png"}" alt="" />
        {$CONST.WARNING_TEMPLATE_DEPRECATED}
    </div>
{/if}

<h3> {$CONST.STYLE_OPTIONS} ({$cur_template})</h3>

{if $has_config}
    {if $adminAction == "configure"}
        <div class="serendipityAdminMsgSuccess">
            <img style="height: 22px; width: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="{serendipity_getFile file="admin/img/admin_msg_success.png"}" alt="" />
            {$CONST:DONE}: {$save_time}
        </div>
    {/if}

    <form method="post" action="serendipity_admin.php">
        <input type="hidden" name="serendipity[adminModule]" value="templates" />
        <input type="hidden" name="serendipity[adminAction]" value="configure" />
        {$form_token}
        {$configuration}
    </form><br />
{else}
    <p>{$CONST.STYLE_OPTIONS_NONE}</p>
{/if}
<br />
<h3>{$CONST.SELECT_TEMPLATE}</h3>

{foreach $templates as $template=>$info}
    {if $info.info.engine == "yes"}
        {continue}
    {/if}
    {if $template@iteration is even}
        <div class="serendipity_admin_list_item serendipity_admin_list_item_even">
    {else}
        <div class="serendipity_admin_list_item serendipity_admin_list_item_uneven">
    {/if}
    <table width="100%" id="serendipity_theme_{$template}">
        <tr>
            <td colspan="2"><span class="serendipityTemplateSelectName"><strong>{$info.info.name}</strong></span></td>
            <td valign="middle" align="center" width="70" rowspan="2">
    {if $template != $cur_template}
        {if ! $info.unmetRequirements}
            <a href="?serendipity[adminModule]=templates&serendipity[adminAction]=install&serendipity[theme]={$template}{$info.info.customURI}">
                <img src="{serendipity_getFile file="admin/img/install_now{$info.info.customIcon}.png"}" alt="{$CONST.SET_AS_TEMPLATE}" title="{$CONST.SET_AS_TEMPLATE}" border="0" />
            </a>
        {else}
            <span class="serendipityTemplateSelectUnmetRequirements" style="color: #cccccc">{$info.unmetRequirements}></span>
        {/if}
    {/if}
            </td>
        </tr>

        <tr>
            <td width="100" style="padding-left: 10px">
            {if $info.fullsize_preview}
                <a href="{$info.fullsize_preview}" target="_blank">
                    {if $info.preview}
                        <img src="{$info.preview}" width="100" style="border: 1px #000000 solid" />
                    {else}
                        &nbsp;
                    {/if}
                </a>
            {/if}

            </td>
            <td valign="top">
                <span class="serendipityTemplateSelectDetails">{$CONST.AUTHOR}: {$info.info.author}</span><br />
                <span class="serendipityTemplateSelectDetails">{$CONST.LAST_UPDATED}: {$info.info.date}</span><br />
                <span class="serendipityTemplateSelectDetails">{$CONST.CUSTOM_ADMIN_INTERFACE}: {$info.info.custom_admin_interface}</span><br />
            </td>
        </tr>
    </table>
    </div>
{/foreach}
As a result, you would only have to work with the templates.inc.tpl, which i am sure is much easier. I could modify some other pages as well. Shall changes like these be uploaded to github?
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: [2.0] Restructuring the backend

Post by Timbalu »

Did you take templates.inc as an example howto, Malte?

I erased the <?php ?> part, removed the beginning whitespaces and added a slight better file fetch method to your file (untested) - but have to state this (tpl) is working with Smarty3 only... :wink:

Code: Select all

<?php # $Id$
    # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
    # All rights reserved.  See LICENSE file for licensing details

    if (IN_serendipity !== true) {
        die ("Don't hack!");
    }

    if (!serendipity_checkPermission('adminTemplates')) {
        return;
    }

    class template_option {
        var $config = null;
        var $values = null;
        var $keys   = null;

        function introspect_config_item($item, &$bag) {
            foreach($this->config[$item] AS $key => $val) {
                $bag->add($key, $val);
            }
        }

        function get_config($item) {
            return $this->values[$item];
        }

        function set_config($item, $value) {
            global $serendipity;
           
            serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}options
                                        WHERE okey = 't_" . serendipity_db_escape_string($serendipity['template']) . "'
                                          AND name = '" . serendipity_db_escape_string($item) . "'");
                                                                                       
            if ($this->config[$item]['scope'] == 'global') {
                serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}options
                                       WHERE okey = 't_global'
                                         AND name = '" . serendipity_db_escape_string($item) . "'");
                serendipity_db_query("INSERT INTO {$serendipity['dbPrefix']}options (okey, name, value)
                                           VALUES ('t_global', '" . serendipity_db_escape_string($item) . "', '" . serendipity_db_escape_string($value) . "')");
            } else {
                serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}options
                                       WHERE okey = 't_" . serendipity_db_escape_string($serendipity['template']) . "'
                                         AND name = '" . serendipity_db_escape_string($item) . "'");
                serendipity_db_query("INSERT INTO {$serendipity['dbPrefix']}options (okey, name, value)
                                           VALUES ('t_" . serendipity_db_escape_string($serendipity['template']) . "', '" . serendipity_db_escape_string($item) . "', '" . serendipity_db_escape_string($value) . "')");
            }
            return true;
        }

        function import(&$config) {
            foreach($config AS $key => $item) {
                $this->config[$item['var']] = $item;
                $this->keys[$item['var']]   = $item['var'];
            }
        }
    }

    $data = array();

    if ($serendipity['GET']['adminAction'] == 'install' ) {
        serendipity_plugin_api::hook_event('backend_templates_fetchtemplate', $serendipity);

        $themeInfo = serendipity_fetchTemplateInfo(htmlspecialchars($serendipity['GET']['theme']));

        serendipity_set_config_var('template', htmlspecialchars($serendipity['GET']['theme']));
        serendipity_set_config_var('template_engine', isset($themeInfo['engine']) ? $themeInfo['engine'] : 'default');

        $data["adminAction"] = "install";
        $data["install_template"] = sprintf(TEMPLATE_SET, htmlspecialchars($serendipity['GET']['theme']));
    }

    if ( @file_exists($serendipity['serendipityPath'] . $serendipity['templatePath'] . $serendipity['template'] .'/layout.php') ) {
        $data["deprecated"] = true;
    }

    $data["cur_template"] = $serendipity['template'];

    if (file_exists($serendipity['serendipityPath'] . $serendipity['templatePath'] . $serendipity['template'] . '/config.inc.php')) {
        serendipity_smarty_init();
        include_once $serendipity['serendipityPath'] . $serendipity['templatePath'] . $serendipity['template'] . '/config.inc.php';
    }

    if (is_array($template_config)) {
        serendipity_plugin_api::hook_event('backend_templates_configuration_top', $template_config);
        $data["has_config"] = true;

        if ($serendipity['POST']['adminAction'] == 'configure' &&  serendipity_checkFormToken()) {
            $storage = new template_option();
            $storage->import($template_config);
            foreach($serendipity['POST']['template'] AS $option => $value) {
                $storage->set_config($option, $value);
            }
            $data["adminAction"] = "configure";
            $data["save_time"] = sprintf(SETTINGS_SAVED_AT, serendipity_strftime('%H:%M:%S'));
        }

        $data["form_token"] = serendipity_setFormToken();

        include S9Y_INCLUDE_PATH . 'include/functions_plugins_admin.inc.php';

        $template_vars =& serendipity_loadThemeOptions($template_config);
       
        $template_options = new template_option();
        $template_options->import($template_config);
        $template_options->values =& $template_vars;

        ob_start();
        serendipity_plugin_config(
            $template_options,
            $template_vars,
            $serendipity['template'],
            $serendipity['template'],
            $template_options->keys,
            true,
            true,
            true,
            true,
            'template',
            $template_config_groups
        );
        $data["configuration"] = ob_get_contents();
        ob_end_clean();
       
        serendipity_plugin_api::hook_event('backend_templates_configuration_bottom', $template_config);
    } else {
        serendipity_plugin_api::hook_event('backend_templates_configuration_none', $template_config);
    }

        $i = 0;
        $stack = array();
        serendipity_plugin_api::hook_event('backend_templates_fetchlist', $stack);
        $themes = serendipity_fetchTemplates();
        $data['templates'] = array();
        $data['templates'][$theme] = array();
        foreach($themes AS $theme) {
            $stack[$theme] = serendipity_fetchTemplateInfo($theme);
        }
        ksort($stack);

       
        foreach ($stack as $theme => $info) {
            $data['templates'][$theme]['info'] = $info;
            /* Sorry, but we don't display engines */
            if ( strtolower($info['engine']) == 'yes' ) {
                continue;
            }

            if (file_exists($serendipity['serendipityPath'] . $serendipity['templatePath'] . $theme . '/preview_fullsize.jpg')) {
                $data['templates'][$theme]['fullsize_preview'] = $serendipity['baseURL'] . $serendipity['templatePath'] . $theme . '/preview_fullsize.jpg';
            } elseif (!empty($info['preview_fullsizeURL'])) {
                $data['templates'][$theme]['fullsize_preview'] = $info['preview_fullsizeURL'];
            }

            if (file_exists($serendipity['serendipityPath'] . $serendipity['templatePath'] . $theme . '/preview.png')) {
                $data['templates'][$theme]['preview'] = $serendipity['templatePath'] . $theme . '/preview.png';
            } elseif (!empty($info['previewURL'])) {
                $data['templates'][$theme]['preview'] = $info['previewURL'] ;
            }

            $unmetRequirements = array();
            if ( isset($info['require serendipity']) && version_compare($info['require serendipity'], serendipity_getCoreVersion($serendipity['version']), '>') ) {
                $unmetRequirements[] = 'Serendipity '. $info['require serendipity'];
                $data['templates'][$theme]['unmetRequirements'] = sprintf(UNMET_REQUIREMENTS, implode(', ', $unmetRequirements));
            }

            /* TODO: Smarty versioncheck */
        }
       
    if (!is_object($serendipity['smarty'])) {
        serendipity_smarty_init();
    }

    $serendipity['smarty']->assign($data);

    $tfile = serendipity_getTemplateFile("admin/templates.inc.tpl", 'serendipityPath');

    // use serendipity's own function here! ;-)
    $content = $this->parseTemplate($tfile);
    echo $content;
I wouldn't mind having this and additional files in the trunc ...!
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: [2.0] Restructuring the backend

Post by yellowled »

onli wrote:As a proof of concept, I modified the template-section of the backend to use smarty. I hope that this will help you modifiying the backend.

As a result, you would only have to work with the templates.inc.tpl, which i am sure is much easier. I could modify some other pages as well. Shall changes like these be uploaded to github?
First of all, thank you. :)

Second, Garvin should have a look at this before you put any further work into this. I'm sure there were some concerns about backend perfomance, but I really can't say much more about this.

Third, if Garvin agrees to work this way (which I think would be marvellous, but, well, see above), it should probably go into a branch of the current master first. That way, we don't have to remove it from the master if we run into any kind of issues. However, I'm not sure about how to handle such a branch properly (yet). I also don't have much time available at the moment to dig into git documentation.

YL
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: [2.0] Restructuring the backend

Post by yellowled »

yellowled wrote:Second, Garvin should have a look at this before you put any further work into this. I'm sure there were some concerns about backend perfomance, but I really can't say much more about this.
Okay, so Garvin's a little swamped right now. Here's the gist:

It's not about performance concerns, but about maintainability. The concern is that if we smartify the backend, any change to a core component (i.e. WYSIWYG editor, which is kind of likely to happen – Xinha vs Aloha etc.) would require backend templates to be adapted as well, which is likely to result in admin themes breaking in new s9y versions.

tl;dr: We might run into a maintance hell, which is even more delicate with a small team.

A possible solution would be (this is where my understanding is fading, but I'll try to explain it anyway) to "lock" the backend templates – i.e., the backend would in fact be smartified, but admin themes would not be allowed to change those templates. That way, we could easily change the "basic" backend markup using Smarty, but the actual admin theme would only be CSS.

I hope this makes any sense – it does sound like a good solution, and it's definitely feasible for future admin templates.

YL
onli
Regular
Posts: 2822
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: [2.0] Restructuring the backend

Post by onli »

A possible solution would be (this is where my understanding is fading, but I'll try to explain it anyway) to "lock" the backend templates – i.e., the backend would in fact be smartified, but admin themes would not be allowed to change those templates. That way, we could easily change the "basic" backend markup using Smarty, but the actual admin theme would only be CSS.

I hope this makes any sense – it does sound like a good solution, and it's definitely feasible for future admin templates.
It does make sense. We would simply store the tpl not in the template, but in iclude/, and hardcode the path, therefore it could not be overriden by anything.
It is a possible way to go.

S9y always only had two or three admin-templates which i'm aware of (old default, bulletproof, codeschmiede, and well, maybe your proof-of-concept), and always only one of them has been maintained (more or less actively) by the team.

I think that this lockdown would be unnecessary if we simply decide to only mantain one admin-backend.

Like it always has been. If someone really decides to ship his own admin-tpl-files, it was his responsibility to maintain it. I simply dont see the nightmare-scenario having any likelihood.
It's not that big a difference, technically, we could surely go ahead and store the .tpls in include and change our minds later on.

If we go that way, shall we already put it in trunk?
Locked