(
this is a long post - this is a real test for the code and injection)
ok, check the following:
eocms/themes/_Admin/XaphireClean/theme-info.php
Code:
$theme_name = 'Xaphire Clean';
$theme_author = 'Paul Wratt';
$theme_site = 'http://paulwratt.110mb.com/eocms/xaphire/';
$theme_email = 'paul.wratt@gmail.com';
$theme_version = '1.00a';
$theme_preview = 'default_preview.jpg';
$theme_description = '..blah..blah..';
$theme_options = array(
'size' => array(128,64,32,16),
'style' => array('default','left','right','sub'),
'panels' => array('none','center_lower','from_settings'),
'sub_menu_size' => array(32,28,24,20,16,8),
'sub_menu_style' => array('top-left','left','bottom-left','top-right','right','bottom-right','top-center','bottom-center','right-click'),
'sub_menu_panels' => array('none','center_lower','from_settings')
);
eocms/panels/quick_search/index(-new).php
Code:
# for language and css includes
$panel['prefix'] = 'qs';
//$panel['use_lang'] = 'Search'; # <-- use existing action=Search language include
//$panel['use_lang_file'] = 'Search.php'; # <-- use existing Search.php language file
# title = $PANELS_LANG['qs_title']
# for $head, contains includes
$panel['include'] = <<<HTML
<script type="text/javascript">
// check function insertion, mat clash with "ready"
$(document).ready(function() {
$("#quick_search").validate({
rules: {
qs_search: {
required: function() {
return ($("#qs_search").val()!=$("#qs_hidden").val() && $("#qs_search").val().indexOf($("#qs_hidden").val())!=0 && $("#qs_search").val()!='');
}
}
});
$("#quick_search").focus(function(){
if($("#qs_hidden").val()==$("#qs_search").val());
$("#qs_search").val()='';
});
$("#quick_search").blur(function(){
if($("#qs_search").val()=='' || $("#qs_search").val().indexOf($("#qs_hidden").val())==0);
$("#qs_search").val()=$("#qs_hidden").val();
});
});
</script>
HTML;
# actual HTML of panel
$panel['body']['1_line'] = <<<HTML
<form id="quick_search" class="search-form qs-form" method="get" action="">
<table id="qs_area" class="search-area qs-area" border="0" cellpadding="0" cellspacing="0">
<tr id="qs_row" class="qs-row">
<td id="qs_input_area" class="qs-input-area"><input id="qs_hidden" type="hidden" value="" disabled><input id="qs_search" class="text search-text qs-text" type="text" name="search" value="{search_text}" /><input id=qs_submit class="button search-btn qs-btn" type="submit" value="{button_text}" /></td>
</tr>
</table>
</form>
HTML;
$panel['body']['2_lines'] = <<<HTML
<form id="quick_search" class="search-form qs-form" method="get" action="">
<table id="qs_area" class="search-area qs-area" border="0" cellpadding="0" cellspacing="0">
<tr id="qs_row" class="qs-row">
<td id="qs_input_area" class="qs-input-area"><input id="qs_hidden" type="hidden" value="" disabled><input id="qs_search" class="text search-text qs-text" type="text" name="search" value="{search_text}" /></td>
</tr>
<tr id="qs_row" class="qs-row">
<td id="qs_input_area" class="qs-input-area"><input id=qs_submit class="button search-btn qs-btn" type="submit" value="{button_text}" /></td>
</tr>
</table>
</form>
HTML;
# panel options
$panel['options'] = array(
'search_text' => array(
'qs_text_search',
'qs_text_look',
'qs_text_find',
'!choose'),
'button_text' => array(
'qs_btn_search_now',
'qs_btn_search',
'qs_btn_find',
'qs_btn_go',
'!choose')
);
eocms/panels/quick_admin/index(-new).php
Code:
# for language and css includes
$panel['prefix'] = 'qa';
# title = $PANELS_LANG['qa_title']
# for $head, contains includes
$panel['include'] = <<<HTML
<style type="text/css">
.sidebar {
padding-top: 5px;
}
.panel {
margin: 0 1em 1em 0;
}
.panel-header .ui-icon {
float: right;
}
.ui-sortable-placeholder {
border: 1px dotted black;
visibility: visible !important;
height: 50px !important;
}
.ui-sortable-placeholder * {
visibility: hidden;
}
</style>
<script type="text/javascript" src="panels/quick_admin/jquery.ui.js"></script>
<script type="text/javascript" src="panels/quick_admin/quickadmin.js"></script>
HTML;
# actual HTML of panel
$panel['body'] = <<<HTML
<div id="managepanels">{link}</div>
HTML;
# actual HTML of panel
$panel['item']['link'] = <<<HTML
<a style="cursor: pointer" onclick="{onclick}">{text}</a><br />
HTML;
# panel options
$panel['options'] = array(
'_defaults' => array(
'onclick' => 'panels();',
'text' => '{qa_move_panels}'),
'_requires' => array(
'item' => 'link',
'replace' => array('onclick','text')),
'add_links' => array('!choose-link'),
'delete_link' => array('!delete-link')
);
eocms/language/en/panel.php
Code:
#panel options
$PANEL_LANG["!choose"] = 'Choose...';
$PANEL_LANG["!custom"] = 'Custom...';
# quick_admin
$PANEL_LANG["qa_title"] = 'Quick Admin';
$PANEL_LANG["qa_add_link"] = 'Add Link';
$PANEL_LANG["qa_delete_link"] = 'Delete Link';
$PANEL_LANG["qa_move_panels"] = 'Move Panels';
# quick_search
$PANEL_LANG["qs_title"] = 'Quick Search';
$PANEL_LANG["qs_1_line"] = 'One Line';
$PANEL_LANG["qs_2_lines"] = 'Two Lines';
$PANEL_LANG["qs_search_text"] = 'Search Text';
$PANEL_LANG["qs_button_text"] = 'Button Text';
$PANEL_LANG["qs_text_search"] = 'search for..';
$PANEL_LANG["qs_text_look"] = 'look for..';
$PANEL_LANG["qs_text_look"] = 'find..';
$PANEL_LANG["qs_btn_search_now"] = 'Search Now';
$PANEL_LANG["qs_btn_search"] = 'Search';
$PANEL_LANG["qs_btn_find"] = 'Find';
$PANEL_LANG["qs_btn_go"] = 'Go';
I would actually change the theme-info variable names to arrays, so "theme['name']" instead of "theme_name". This is because from the code, the arrays can be added together and itterated easily, great for dropdown choosers, etc
notice the use of <<<HTML and {variable_replace} in the html sections
you'll notice "bang" commands (!choose). These are interpreted by eoCMS to produce JS and a text input in the corresponing options section. !choose-link and !delete-link do the same, but require 2 inputs (link name, and for quick_admin, onclick), because they are <a> specific
there would be other built-in functions also. These are just because the db already contains "key, value" tables, so its easy to store info.
The only thing I have not posted, is a "generate static" which would output an html include to the cache folder (instead of using a db qurey) for most panels with static settings (unlike say the user_info and users_online panels)
The above are missing some options, "panel['admin']=true;", but I was reluctant to add this as "admin" then ties it to a specific eoCMS variable name, and it would make more sense to just have "viewable by" on the panels page..
the same goes for "panel['allow_static']=true;"
the "better" part or using an array structure, is then the can be a "panel['options']['profile']" to allow certain user specific settings from the profile page (like the above Xaphire example, but cleaner, and better organised programatically speaking)
note these are "complex" examples, they are however designed for "simple" creation. not every theme/_admin/panel/plugin requires all info (sub arrays), but the same system can be used as an "engine" for ALL "plugable parts" of eoCMS
this is particularly of use to the theme itself. so the would be a "theme['engine']='simple';" or a "theme['engine']='complex';" (actually if there is no "theme['options']" or "panel['options']", etc, then it is truely "simple", and no need to set an option to say so)
so that would give use a "single page theme".
the truely "complex theme", would be constructed with the "external" functions as the theme function uses them right now. There would be a "default" set of them (the ones currently in "default"), however the HTML generated by the default function would be "generic" with "generic" ID/CLASS info too, to allow for complex CSS manipulation
there would also be a {variable_replace} text replacement function, and that would also allow for "eoCMS global variables" to be used (created), ie: {total_posts}, {latest_user}, {last_poster}, {last_topic}, {posts_per_hour}, {views_per_hour}
some of these may not be a good idea, the point is that they can be used by any mod/addon or by a site admin for including in panels, pages, articles, where ever you can "enter text content"
I have 2 replace functions in the installer, they do global replaces on a string, one can use an array of replacement variables names and values
I know its been a long in coming, but the above is why I was interested in what EVERYONES idea of an admin menu was, why I collected screenies, and why I feel so strongly about "changing" the old way of doing themes to the new way (and not allowing the old way still, one page, self contained functions, etc)
The idea I was driving at was to allow (extreme) flexibility that is still comfortable for both eoCMS DEV's and NON-DEVS, non-eoCMS noobs and experienced coders, to be able to produce themes, menus, admin functions, plugins, panels, anything really..
The other "bonus" of this approach, is that by deafult, eoCMS would NOT produce any output via ECHO or PRINT, everything could be manipulated before being include into "$body" (which is great for advanced themes), and it is also faster to process a page, even (especially) with obfuscate functions
so pick it to pieces, especially senario's where it may work against the eoCMS code itself..