smartified functions_plugins_admin.inc.php
This commit is contained in:
205
include/admin/tpl/out_stack_loop.tpl
Normal file
205
include/admin/tpl/out_stack_loop.tpl
Normal file
@@ -0,0 +1,205 @@
|
||||
{* serendipity_plugins_admin.inc.php::serendipity_plugin_config() - the OUT_STACK loop *}
|
||||
{if $ctype == 'seperator'}
|
||||
<tr>
|
||||
<td colspan="2"><hr noshade="noshade" size="1" /></td>
|
||||
</tr>
|
||||
{/if}
|
||||
{if $ctype == 'select'}
|
||||
<tr>
|
||||
<td style="border-bottom: 1px solid #000000; vertical-align: top"><strong>{$cname}</strong>
|
||||
{if $cdesc != ''}
|
||||
<br><span style="color: #5E7A94; font-size: 8pt;"> {$cdesc}</span>
|
||||
{/if}
|
||||
</td>
|
||||
<td style="border-bottom: 1px solid #000000; vertical-align: middle" width="250">
|
||||
<div>
|
||||
<select class="direction_{$lang_direction}" name="serendipity[{$postKey}][{$config_item}]{($is_multi_select) ? '[]' : ''}" {($is_multi_select) ? 'multiple="multiple"' : ''} {($is_multi_select && ($select_size > 0)) ? "size='{$select_size}'" : ''}>
|
||||
{foreach $select AS $select_value => $select_desc}
|
||||
{assign var="id" value="{$config_item|escape}_{$select_value|escape}"}
|
||||
<!-- case select assign id={$id} -->
|
||||
<option value="{$select_value}" {(in_array($select_value, $selected_options) || in_array($select_value, $pre_selected)) ? 'selected="selected"' : ''} title="{$select_desc|escape}">
|
||||
{$select_desc|escape}
|
||||
</option>
|
||||
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
{if $ctype == 'radio'}
|
||||
<tr>
|
||||
<td style="border-bottom: 1px solid #000000; vertical-align: top"><strong>{$cname}</strong>
|
||||
{if $cdesc != ''}
|
||||
<br /><span style="color: #5E7A94; font-size: 8pt;"> {$cdesc}</span>
|
||||
{/if}
|
||||
</td>
|
||||
<td style="border-bottom: 1px solid #000000; vertical-align: middle;" width="250">
|
||||
{foreach $radio_button AS $r}
|
||||
{if $r['counter'] == 1}
|
||||
<div class="clearfix">
|
||||
{/if}
|
||||
<input class="direction_{$lang_direction} input_radio" type="radio" id="serendipity_plugin_{$r['id']}" name="serendipity[{$postKey}][{$config_item}]" value="{$r['value']}" {(!empty($r['checked'])) ? 'checked="checked"' : ''} title="{$r['index']|escape}" />
|
||||
<label for="serendipity_plugin_{$r['id']}">{$r['index']}{* escape is already done *}</label>
|
||||
{if ($r['counter'] == $per_row)}
|
||||
{assign var="r" value="counter[0]"}
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
{if $ctype == 'string'}
|
||||
<tr>
|
||||
<td style="border-bottom: 1px solid #000000">
|
||||
<strong>{$cname}</strong>
|
||||
<br><span style="color: #5E7A94; font-size: 8pt;"> {$cdesc}</span>
|
||||
</td>
|
||||
<td style="border-bottom: 1px solid #000000" width="250">
|
||||
<div>
|
||||
<input class="direction_{$lang_direction} input_textbox" type="{$input_type}" name="serendipity[{$postKey}][{$config_item}]" value="{$hvalue}" size="30" />
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
{if (($ctype == 'html') || ($ctype == 'text'))}
|
||||
<tr>
|
||||
<td colspan="2"><strong>{$cname}</strong>
|
||||
<span style="color: #5E7A94; font-size: 8pt;"> {$cdesc}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div>
|
||||
<textarea class="direction_{$lang_direction}" style="width: 100%" id="nuggets{$elcount}" name="serendipity[{$postKey}][{$config_item}]" rows="{$text_rows}" cols="80">{$hvalue}</textarea>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
{if $ctype == 'content'}
|
||||
<tr>
|
||||
<td colspan="2">{$cbag_default}</td>
|
||||
</tr>
|
||||
{/if}
|
||||
{if $ctype == 'custom'}
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input type="hidden" id="config_{$postKey}_{$config_item}" name="serendipity[{$postKey}][{$config_item}]" value="{$hvalue}" size="30" />
|
||||
{$cbag_custom}
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
{if $ctype == 'hidden'}
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input class="direction_{$lang_direction}" type="hidden" name="serendipity[{$postKey}][{$config_item}]" value="{$cbag_value}" />
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
{if $ctype == 'media'}
|
||||
{if !$mediajs_output}
|
||||
<script type="text/javascript" language="JavaScript" src="serendipity_editor.js"></script>
|
||||
<script type="text/javascript" language="JavaScript" src="{serendipity_getFile file='admin/image_selector.js'}"></script>
|
||||
{/if}
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<strong>{$cname}</strong>
|
||||
<br /><span style="color: #5E7A94; font-size: 8pt;">{$cdesc}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="border-bottom: 1px solid #000000">
|
||||
<div id="{$config_item}_preview" style="background-image: url({$value}); width: {$preview_width}; height: {$preview_height}; background-repeat: no-repeat;"> </div>
|
||||
</td>
|
||||
<td style="border-bottom: 1px solid #000000">
|
||||
<input class="input_textbox" type="text" id="serendipity[{$postKey}][{$config_item}]" name="serendipity[{$postKey}][{$config_item}]" value="{$value}" onchange="change_preview('{$config_item}')"/>
|
||||
<br /><a href="#" onclick="choose_media('serendipity[{$postKey}][{$config_item}]')">{$CONST.MEDIA_LIBRARY}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
{if $ctype == 'sequence'}
|
||||
{if !$sequencejs_output}
|
||||
<script src="{serendipity_getFile file='dragdrop.js'}" type="text/javascript"></script>
|
||||
{/if}
|
||||
<tr>
|
||||
<td style="border-bottom: 1px solid #000000; vertical-align: top">
|
||||
<strong>{$cname}</strong>
|
||||
<br /><span style="color: #5E7A94; font-size: 8pt;">{$cdesc}</span>
|
||||
</td>
|
||||
<td style="border-bottom: 1px solid #000000; vertical-align: middle">
|
||||
<input type="hidden" name="serendipity[{$postKey}][{$config_item}]" id="{$config_item}_value" value="{$value}" />
|
||||
<noscript>
|
||||
<!-- Replace standard submit button when using up/down submits -->
|
||||
<input type="hidden" name="SAVECONF" value="Save" />
|
||||
</noscript>
|
||||
<ol id="{$config_item}" class="sequence_container pluginmanager_container">
|
||||
{foreach $order_id as $orid}
|
||||
<li id="{$orid['id']}" class="sequence_item pluginmanager_item_even">
|
||||
<div id="g{$orid['id']}" class="pluginmanager_grablet sequence_grablet"><a href="#"></a></div>
|
||||
{if $checkable}
|
||||
<input type="checkbox" onclick="sort_{$config_item}_Sequence();" name="serendipity[{$postKey}][activate][{$config_item}][{$orid['id']}]" {(in_array($orid['id'], $store_order)) ? ' checked="checked" ' : ''} value="true" id="activate_{$orid['id']}" />
|
||||
{/if}
|
||||
<span>{$items[{$orid['id']}]['display']}</span>
|
||||
{if isset($items[{$orid['id']}]['img'])}
|
||||
<img src="{$items[{$orid['id']}]['img']}" />
|
||||
{/if}
|
||||
<noscript><div>
|
||||
{if ($orid['sort_idx'] == 0)}
|
||||
|
||||
{else}
|
||||
<button id="{$postKey}_{$config_item}_{$orid['sort_idx']}_up" type="submit" name="serendipity[{$postKey}][override][{$config_item}]" value="{$orid['oneup']}">
|
||||
<img src="{serendipity_getFile file='admin/img/uparrow.png'}" alt="Move Up" />
|
||||
</button>
|
||||
{/if}
|
||||
{if ($orid['sort_idx'] == $last)}
|
||||
|
||||
{else}
|
||||
<button id="{$postKey}_{$config_item}_{$orid['sort_idx']}_down" type="submit" name="serendipity[{$postKey}][override][{$config_item}]" value="{$orid['onedown']}">
|
||||
<img src="{serendipity_getFile file='admin/img/downarrow.png'}" alt="Move Down" />
|
||||
</button>
|
||||
{/if}
|
||||
</div></noscript>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ol>
|
||||
{if (!is_array($items) || empty($order_id))}
|
||||
{$none}
|
||||
{/if}
|
||||
{*
|
||||
Smarty 3 has a new auto literal option which is enabled by default.
|
||||
When the { is followed by a space it's not interpreted as smarty delimiter but literal.
|
||||
*}
|
||||
<script type="text/javascript">
|
||||
function sort_{$config_item}_Sequence() {
|
||||
//var seq = DragDrop.serData('{$config_item}_group', null);
|
||||
var seq = DragDrop.serData(null, '+citem+');
|
||||
var start = seq.indexOf("(");
|
||||
var end = seq.indexOf(")");
|
||||
seq = seq.slice((start + 1), end);
|
||||
checkable_seq = seq.split(",");
|
||||
out_seq = '';
|
||||
for (i in checkable_seq) {
|
||||
if (document.getElementById('activate_' + checkable_seq[i]) && !document.getElementById('activate_' + checkable_seq[i]).checked) {
|
||||
continue;
|
||||
} else {
|
||||
if (out_seq != '') {
|
||||
out_seq += ',';
|
||||
}
|
||||
out_seq += checkable_seq[i];
|
||||
}
|
||||
}
|
||||
var order = document.getElementById("{$config_item}_value");
|
||||
order.value = out_seq;
|
||||
}
|
||||
|
||||
function init_{$config_item}_Sequence() {
|
||||
var lst = document.getElementById("{$config_item}");
|
||||
DragDrop.makeListContainer(lst, '{$config_item}_group');
|
||||
lst.onDragOut = function() {
|
||||
sort_{$config_item}_Sequence();
|
||||
};
|
||||
}
|
||||
addLoadEvent(init_{$config_item}_Sequence);
|
||||
</script>
|
||||
</td>
|
||||
{/if}
|
||||
89
include/admin/tpl/serendipity_plugin_config.fnc.tpl
Normal file
89
include/admin/tpl/serendipity_plugin_config.fnc.tpl
Normal file
@@ -0,0 +1,89 @@
|
||||
{* serendipity_plugins_admin.inc.php::serendipity_plugin_config() *}
|
||||
|
||||
<script type="text/javascript">
|
||||
var const_view = '{$CONST.VIEW_FULL}';
|
||||
var const_hide = '{$CONST.HIDE}';
|
||||
var img_plus = '{serendipity_getFile file="img/plus.png"}';
|
||||
var img_minus = '{serendipity_getFile file="img/minus.png"}';
|
||||
var jspath = '{$serendipityHTTPPath}include/admin/js/';
|
||||
</script>
|
||||
|
||||
{if $allow_admin_scripts}
|
||||
<script type="text/javascript" language="JavaScript" src="{serendipity_getFile file='admin/admin_scripts.js'}"></script>
|
||||
{/if}
|
||||
|
||||
{if $showSubmit_head}
|
||||
<div style="margin: 0px auto 0px 0px; text-align: right">
|
||||
<input type="submit" name="SAVECONF" value="{$CONST.SAVE}" class="serendipityPrettyButton input_button" />
|
||||
</div>
|
||||
{/if}
|
||||
{if $showTable}
|
||||
<table id="serendipity_plugin_config" border="0" cellspacing="0" cellpadding="3" width="100%">
|
||||
{/if}
|
||||
{if is_array($config_groups)}
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div align="right">
|
||||
<a style="border:0; text-decoration: none" href="#" onClick="showConfigAll({sizeof($config_groups)}); return false" title="{$CONST.TOGGLE_ALL}"><img src="{serendipity_getFile file="img/plus.png"}" id="optionall" alt="+/-" border="0" /> {$CONST.TOGGLE_ALL}</a></a><br />
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{foreach $config_groups AS $config_header => $config_groupkeys}
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<h2>
|
||||
<a style="border:0; text-decoration: none;" href="#" onClick='showConfig("el{$config_groupkeys@iteration}"); return false' title="{$CONST.TOGGLE_OPTION}"><img src="{serendipity_getFile file="img/plus.png"}" id="optionel{$config_groupkeys@iteration}" alt="+/-" border="0" />
|
||||
{$config_header}
|
||||
</a>
|
||||
</h2>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table class="plugin_optiongroup" id="el{$config_groupkeys@iteration}" border="0" cellspacing="0" cellpadding="3" width="100%">
|
||||
{foreach $config_groupkeys AS $config_groupkey}
|
||||
{$OUT_STACK[$config_groupkey]}
|
||||
{/foreach}
|
||||
</table>
|
||||
<script type="text/javascript" language="JavaScript">
|
||||
document.getElementById("el{$config_groupkeys@iteration}").style.display = "none";
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
<tr><td colspan="2" style="height: 100px" id="configuration_footer"> </td></tr>
|
||||
{/if} {* foreach config_groups end *}
|
||||
|
||||
{foreach $OUT_STACK as $out_stack_config_item}
|
||||
{$out_stack_config_item}
|
||||
{/foreach}
|
||||
|
||||
{if $showTable}
|
||||
</table>
|
||||
<br />
|
||||
{/if}
|
||||
{* $serendipity_printConfigJS *}{* outsourced to templates/default/admin/admin_scripts.js - see passed vars on top *}
|
||||
{if $showSubmit_foot}
|
||||
<div style="padding-left: 20px">
|
||||
<input type="submit" name="SAVECONF" value="{$CONST.SAVE}" class="serendipityPrettyButton input_button" />
|
||||
</div>
|
||||
{/if}
|
||||
{if $showExample}
|
||||
<div>
|
||||
{$plugin_example}
|
||||
</div>
|
||||
{/if}
|
||||
{if $spawnNuggets}
|
||||
{serendipity_hookPlugin hook="backend_wysiwyg_nuggets" eventData=$ev hookAll=true}
|
||||
{if ($ev['skip_nuggets'] === false)}
|
||||
<script type="text/javascript">
|
||||
function Spawnnugget() {
|
||||
/* blar */
|
||||
{foreach $htmlnugget AS $htmlnuggetid}
|
||||
Spawnnuggets('{$htmlnuggetid}');
|
||||
{/foreach}
|
||||
}
|
||||
</script>
|
||||
{/if}
|
||||
{/if}
|
||||
22
include/admin/tpl/show_ownership.fnc.tpl
Normal file
22
include/admin/tpl/show_ownership.fnc.tpl
Normal file
@@ -0,0 +1,22 @@
|
||||
{* functions_plugins_admin.inc.php::function ownership() *}
|
||||
|
||||
{if $show_ownership}
|
||||
{if $is_plugin_owner}
|
||||
<select name="serendipity[ownership][{$name}]">
|
||||
<option value="0">{$CONST.ALL_AUTHORS}</option>
|
||||
{/if}
|
||||
|
||||
{foreach $users AS $user}
|
||||
{if (!$is_plugin_owner && ($user['authorid'] == $authorid))}
|
||||
{assign var="realname" value="{$user['realname']|escape}"}
|
||||
{elseif $is_plugin_owner}
|
||||
<option value="{$user['authorid']}"{($user['authorid'] == $authorid) ? ' selected="selected"' : ''}>{$user['realname']|escape}</option>
|
||||
{/if}
|
||||
{/foreach}
|
||||
|
||||
{if $is_plugin_owner}
|
||||
</select>
|
||||
{else}
|
||||
{(empty($realname)) ? $CONST.ALL_AUTHORS : $realname}
|
||||
{/if}
|
||||
{/if}
|
||||
93
include/admin/tpl/show_plugins.fnc.tpl
Normal file
93
include/admin/tpl/show_plugins.fnc.tpl
Normal file
@@ -0,0 +1,93 @@
|
||||
{* functions_plugins_admin.inc.php::function_show_plugins() including output of functions_plugins_admin.inc.php::function ownership() *}
|
||||
|
||||
{if !$eyecandy}
|
||||
<form action="?serendipity[adminModule]=plugins" method="post">
|
||||
{elseif !$event_only}
|
||||
{*
|
||||
Smarty 3 has a new auto literal option which is enabled by default.
|
||||
When the { is followed by a space it's not interpreted as smarty delimiter but literal.
|
||||
*}
|
||||
<script type="text/javascript">
|
||||
function templatePluginMoverInit() {
|
||||
|
||||
{foreach $sidebars AS $sidebar}
|
||||
|
||||
{($is_first) ? 'var ' : ''} list = document.getElementById("{$sidebar}_col");
|
||||
DragDrop.makeListContainer(list, 'g1');
|
||||
list.onDragOver = function() { this.style["border"] = "1px solid #4d759b"; };
|
||||
list.onDragOut = function() { this.style["border"] = "none"; };
|
||||
{assign var="is_first" value=false}
|
||||
|
||||
{/foreach}
|
||||
|
||||
}
|
||||
addLoadEvent(templatePluginMoverInit);
|
||||
</script>
|
||||
|
||||
<form action="?serendipity[adminModule]=plugins" method="post" onsubmit="pluginMovergetSort(); return true">
|
||||
<input type="hidden" name="serendipity[pluginorder]" id="order" value="" />
|
||||
|
||||
{else}
|
||||
<script type="text/javascript">addLoadEvent(pluginMoverInitEvent);</script>
|
||||
<form action="?serendipity[adminModule]=plugins" method="post" onsubmit="pluginMovergetSortEvent(); return true">
|
||||
<input type="hidden" name="serendipity[pluginorder]" id="eventorder" value="" />
|
||||
{/if}
|
||||
|
||||
{$serendipity_setFormToken}
|
||||
|
||||
<table class="pluginmanager" border="0" cellpadding="5" cellspacing="3" width="100%">
|
||||
<tr>
|
||||
|
||||
{foreach $placement as $plugin_placement}
|
||||
<td class="pluginmanager_side pluginmanager_{($event_only) ? 'event' : 'sidebar'}">
|
||||
<div class="heading">{$plugin_placement['ptitle']}</div>
|
||||
<ol id="{$plugin_placement['pid']}_col" class="pluginmanager_container">
|
||||
|
||||
{foreach $plugin_placement['plugin_data'] as $plugin_data}
|
||||
|
||||
<li class="pluginmanager_item_{cycle values="even,uneven"}" id="{$plugin_data['css_key']}">
|
||||
<div id="g{$plugin_data['css_key']}" class="pluginmanager_grablet">
|
||||
<a href="#" id="grab{$plugin_data['css_key']}"></a>
|
||||
</div>
|
||||
{if $plugin_data['is_plugin_editable']}
|
||||
<input class="input_checkbox" type="checkbox" name="serendipity[plugin_to_remove][]" value="{$plugin_data['name']}" />
|
||||
{/if}
|
||||
|
||||
{if $plugin_data['can_configure']}
|
||||
<a class="pluginmanager_configure" href="?serendipity[adminModule]=plugins&serendipity[plugin_to_conf]={$plugin_data['key']}"><img src="{serendipity_getFile file='admin/img/configure.png'}" style="border: 0; vertical-align: bottom;" alt="[C]" /></a>
|
||||
{/if}
|
||||
|
||||
<span class="pluginmanager_title">
|
||||
{if $plugin_data['can_configure']}
|
||||
<a title="{$plugin_data['name']}" href="?serendipity[adminModule]=plugins&serendipity[plugin_to_conf]={$plugin_data['key']}">{$plugin_data['title']}</a>
|
||||
{else}
|
||||
{$plugin_data['title']}
|
||||
{/if}
|
||||
</span><br />
|
||||
<div class="pluginmanager_description" style="font-size: 8pt">{$plugin_data['desc']}</div>
|
||||
<div class="pluginmanager_ownership">
|
||||
{$plugin_data['ownership']}
|
||||
</div>
|
||||
{($eyecandy) ? '<noscript>' : ''}
|
||||
<div class="pluginmanager_place">{$plugin_data['place']}</div>
|
||||
<div class="pluginmanager_move">{$plugin_data['moveup']} {$plugin_data['movedown']}</div>
|
||||
{($eyecandy) ? '</noscript>' : ''}
|
||||
</li>
|
||||
|
||||
{/foreach}
|
||||
|
||||
</ol>
|
||||
</td>
|
||||
{/foreach}
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" align="right">{$CONST.PLUGIN_AVAILABLE_COUNT|sprintf:$total}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
<div>
|
||||
<input type="submit" name="REMOVE" title="{$CONST.DELETE}" value="{$CONST.REMOVE_TICKED_PLUGINS}" class="serendipityPrettyButton input_button" />
|
||||
<input type="submit" name="SAVE" title="{$CONST.SAVE_CHANGES_TO_LAYOUT}" value="{$CONST.SAVE}" class="serendipityPrettyButton input_button" />
|
||||
</div>
|
||||
</form>
|
||||
@@ -91,35 +91,18 @@ function show_plugins($event_only = false, $sidebars = null)
|
||||
}
|
||||
|
||||
$eyecandy = !isset($serendipity['eyecandy']) || serendipity_db_bool($serendipity['eyecandy']);
|
||||
$data['event_only'] = $event_only;
|
||||
$data['eyecandy'] = $eyecandy;
|
||||
if (!$eyecandy) {
|
||||
echo ' <form action="?serendipity[adminModule]=plugins" method="post">';
|
||||
$data['eyecandy'] = false;
|
||||
} elseif (!$event_only) {
|
||||
echo '<script type="text/javascript"> function templatePluginMoverInit() { ';
|
||||
$is_first = true;
|
||||
foreach($sidebars AS $sidebar) {
|
||||
?>
|
||||
<?php echo ($is_first ? 'var ' : ''); ?> list = document.getElementById("<?php echo $sidebar; ?>_col");
|
||||
DragDrop.makeListContainer(list, 'g1');
|
||||
list.onDragOver = function() { this.style["border"] = "1px solid #4d759b"; };
|
||||
list.onDragOut = function() { this.style["border"] = "none"; };
|
||||
<?php
|
||||
$is_first = false;
|
||||
}
|
||||
echo ' } addLoadEvent(templatePluginMoverInit);</script>';
|
||||
echo ' <form action="?serendipity[adminModule]=plugins" method="post" onsubmit="pluginMovergetSort(); return true">';
|
||||
echo ' <input type="hidden" name="serendipity[pluginorder]" id="order" value="" />';
|
||||
|
||||
} else {
|
||||
echo '<script type="text/javascript">addLoadEvent(pluginMoverInitEvent);</script>';
|
||||
echo ' <form action="?serendipity[adminModule]=plugins" method="post" onsubmit="pluginMovergetSortEvent(); return true">';
|
||||
echo ' <input type="hidden" name="serendipity[pluginorder]" id="eventorder" value="" />';
|
||||
$data['event_only'] = false;
|
||||
$data['is_first'] = $is_first = true;
|
||||
}
|
||||
|
||||
echo serendipity_setFormToken();
|
||||
?>
|
||||
<table class="pluginmanager" border="0" cellpadding="5" cellspacing="3" width="100%">
|
||||
<tr>
|
||||
<?php
|
||||
$data['serendipity_setFormToken'] = serendipity_setFormToken();
|
||||
|
||||
// what is this for???
|
||||
$errors = array();
|
||||
|
||||
/* Block display the plugins per placement location. */
|
||||
@@ -128,6 +111,8 @@ function show_plugins($event_only = false, $sidebars = null)
|
||||
} else {
|
||||
$plugin_placements = $sidebars;
|
||||
}
|
||||
$data['plugin_placements'] = $plugin_placements;
|
||||
//???$ownership = array();
|
||||
|
||||
$total = 0;
|
||||
foreach ($plugin_placements as $plugin_placement) {
|
||||
@@ -136,12 +121,9 @@ function show_plugins($event_only = false, $sidebars = null)
|
||||
} else {
|
||||
$is_invisible = false;
|
||||
}
|
||||
$ptitle = $opts[$plugin_placement];
|
||||
$pid = $plugin_placement;
|
||||
$data['placement'][$plugin_placement]['ptitle'] = $ptitle = $opts[$plugin_placement];
|
||||
$data['placement'][$plugin_placement]['pid'] = $pid = $plugin_placement;
|
||||
|
||||
echo '<td class="pluginmanager_side pluginmanager_' . ($event_only ? 'event' : 'sidebar') . '">';
|
||||
echo '<div class="heading">' . $ptitle . '</div>';
|
||||
echo '<ol id="' . $pid . '_col" class="pluginmanager_container">';
|
||||
if ($is_invisible) {
|
||||
$plugins = $invisible_plugins;
|
||||
} else {
|
||||
@@ -204,52 +186,35 @@ function show_plugins($event_only = false, $sidebars = null)
|
||||
} else {
|
||||
$movedown = ($moveup != '' ? ' ' : '') . '<a href="?' . serendipity_setFormToken('url') . '&serendipity[adminModule]=plugins&submit=move+down&serendipity[plugin_to_move]=' . $key . $event_only_uri . '" style="border: 0"><img src="' . serendipity_getTemplateFile('admin/img/downarrow.png') . '" height="16" width="16" alt="'. DOWN .'" border="0" /></a>';
|
||||
}
|
||||
?>
|
||||
<li class="pluginmanager_item_<?php echo ($sort_idx % 2 ? 'even' : 'uneven'); ?>" id="<?php echo $css_key; ?>">
|
||||
<div id="g<?php echo $css_key; ?>" class="pluginmanager_grablet">
|
||||
<a href="#" id="grab<?php echo $css_key; ?>"></a>
|
||||
</div>
|
||||
<?php if ($is_plugin_editable) { ?>
|
||||
<input class="input_checkbox" type="checkbox" name="serendipity[plugin_to_remove][]" value="<?php echo $plugin_data['name']; ?>" />
|
||||
<?php } ?>
|
||||
|
||||
<?php if ( $can_configure ) { ?>
|
||||
<a class="pluginmanager_configure" href="?serendipity[adminModule]=plugins&serendipity[plugin_to_conf]=<?php echo $key ?>"><img src="<?php echo serendipity_getTemplateFile('admin/img/configure.png') ?>" style="border: 0; vertical-align: bottom;" alt="[C]" /></a>
|
||||
<?php } ?>
|
||||
ob_start();
|
||||
ownership($plugin_data['authorid'], $plugin_data['name'], $is_plugin_owner);
|
||||
$ownership = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
<span class="pluginmanager_title">
|
||||
<?php if ( $can_configure ) { ?>
|
||||
<a title="<?php echo $plugin_data['name']; ?>" href="?serendipity[adminModule]=plugins&serendipity[plugin_to_conf]=<?php echo $key ?>"><?php echo $title; ?></a>
|
||||
<?php } else { ?>
|
||||
<?php echo $title; ?>
|
||||
<?php } ?></span><br />
|
||||
<div class="pluginmanager_description" style="font-size: 8pt"><?php echo $desc; ?></div>
|
||||
<div class="pluginmanager_ownership"><?php ownership($plugin_data['authorid'], $plugin_data['name'], $is_plugin_owner); ?></div>
|
||||
<?php echo ($eyecandy ? '<noscript>' : ''); ?>
|
||||
<div class="pluginmanager_place"><?php echo $place; ?></div>
|
||||
<div class="pluginmanager_move"><?php echo $moveup ?> <?php echo $movedown ?></div>
|
||||
<?php echo ($eyecandy ? '</noscript>' : ''); ?>
|
||||
</li>
|
||||
<?php
|
||||
$data['placement'][$plugin_placement]['plugin_data'][$total]['sort_idx'] = $sort_idx;
|
||||
$data['placement'][$plugin_placement]['plugin_data'][$total]['css_key'] = $css_key;
|
||||
$data['placement'][$plugin_placement]['plugin_data'][$total]['is_plugin_editable'] = $is_plugin_editable;
|
||||
$data['placement'][$plugin_placement]['plugin_data'][$total]['name'] = $plugin_data['name'];
|
||||
$data['placement'][$plugin_placement]['plugin_data'][$total]['can_configure'] = $can_configure;
|
||||
$data['placement'][$plugin_placement]['plugin_data'][$total]['key'] = $key;
|
||||
$data['placement'][$plugin_placement]['plugin_data'][$total]['title'] = $title;
|
||||
$data['placement'][$plugin_placement]['plugin_data'][$total]['desc'] = $desc;
|
||||
$data['placement'][$plugin_placement]['plugin_data'][$total]['ownership'] = $ownership;
|
||||
$data['placement'][$plugin_placement]['plugin_data'][$total]['place'] = $place;
|
||||
$data['placement'][$plugin_placement]['plugin_data'][$total]['moveup'] = $moveup;
|
||||
$data['placement'][$plugin_placement]['plugin_data'][$total]['movedown'] = $movedown;
|
||||
$sort_idx++;
|
||||
}
|
||||
|
||||
echo '</ol></td>';
|
||||
}
|
||||
|
||||
?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" align="right"><?php printf(PLUGIN_AVAILABLE_COUNT, $total); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
<div>
|
||||
<input type="submit" name="REMOVE" title="<?php echo DELETE; ?>" value="<?php echo REMOVE_TICKED_PLUGINS; ?>" class="serendipityPrettyButton input_button" />
|
||||
<input type="submit" name="SAVE" title="<?php echo SAVE_CHANGES_TO_LAYOUT; ?>" value="<?php echo SAVE; ?>" class="serendipityPrettyButton input_button" />
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
$data['total'] = $total;
|
||||
|
||||
$serendipity['smarty']->assign($data);
|
||||
$tfile = dirname(__FILE__) . "/admin/tpl/show_plugins.fnc.tpl";
|
||||
$serendipity['smarty']->display('file:'. $tfile);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -271,31 +236,16 @@ function ownership($authorid, $name, $is_plugin_owner = false) {
|
||||
if (empty($users)) {
|
||||
$users = serendipity_fetchUsers('', 'hidden');
|
||||
}
|
||||
$data['authorid'] = $authorid;
|
||||
$data['users'] = $users;
|
||||
$data['is_plugin_owner'] = $is_plugin_owner;
|
||||
$data['name'] = $name;
|
||||
$data['show_ownership'] = true;
|
||||
|
||||
if ($is_plugin_owner) {
|
||||
?>
|
||||
<select name="serendipity[ownership][<?php echo $name; ?>]">
|
||||
<option value="0"><?php echo ALL_AUTHORS; ?></option>
|
||||
<?php
|
||||
}
|
||||
$serendipity['smarty']->assign($data);
|
||||
$tfile = dirname(__FILE__) . "/admin/tpl/show_ownership.fnc.tpl";
|
||||
$serendipity['smarty']->display('file:'. $tfile);
|
||||
|
||||
foreach($users AS $user) {
|
||||
if (!$is_plugin_owner && $user['authorid'] == $authorid) {
|
||||
$realname = htmlspecialchars($user['realname']);
|
||||
} elseif ($is_plugin_owner) {
|
||||
?>
|
||||
<option value="<?php echo $user['authorid']; ?>"<?php echo ($user['authorid'] == $authorid ? ' selected="selected"' : ''); ?>><?php echo htmlspecialchars($user['realname']); ?></option>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if ($is_plugin_owner) {
|
||||
?>
|
||||
</select>
|
||||
<?php
|
||||
} else {
|
||||
echo (empty($realname) ? ALL_AUTHORS : $realname);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -365,38 +315,41 @@ function serendipity_plugin_config(&$plugin, &$bag, &$name, &$desc, &$config_nam
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($showSubmit && $postKey != 'plugin') {
|
||||
?>
|
||||
<div style="margin: 0px auto 0px 0px; text-align: right">
|
||||
<input type="submit" name="SAVECONF" value="<?php echo SAVE; ?>" class="serendipityPrettyButton input_button" />
|
||||
</div>
|
||||
<?php }
|
||||
if (!is_object($serendipity['smarty'])) {
|
||||
serendipity_smarty_init();
|
||||
}
|
||||
$tfile = dirname(__FILE__) . "/admin/tpl/out_stack_loop.tpl";
|
||||
|
||||
if ($showTable) {
|
||||
?>
|
||||
<table id="serendipity_plugin_config" border="0" cellspacing="0" cellpadding="3" width="100%">
|
||||
<?php
|
||||
$data = array();
|
||||
|
||||
if ($showSubmit && $postKey != 'plugin') {
|
||||
$data['showSubmit_head'] = true;
|
||||
}
|
||||
|
||||
if ($showTable) {
|
||||
$data['showTable'] = true;
|
||||
}
|
||||
|
||||
$elcount = 0;
|
||||
$htmlnugget = array();
|
||||
|
||||
|
||||
$out_stack = array();
|
||||
$data['config_names'] = $config_names;
|
||||
|
||||
foreach ($config_names as $config_item) {
|
||||
$elcount++;
|
||||
$cbag = new serendipity_property_bag;
|
||||
$plugin->introspect_config_item($config_item, $cbag);
|
||||
|
||||
$cname = htmlspecialchars($cbag->get('name'));
|
||||
$cdesc = htmlspecialchars($cbag->get('description'));
|
||||
$data['cname'] = $cname = htmlspecialchars($cbag->get('name'));
|
||||
$data['cdesc'] = $cdesc = htmlspecialchars($cbag->get('description'));
|
||||
$value = $plugin->get_config($config_item, 'unset');
|
||||
$lang_direction = htmlspecialchars($cbag->get('lang_direction'));
|
||||
|
||||
if (empty($lang_direction)) {
|
||||
$lang_direction = LANG_DIRECTION;
|
||||
}
|
||||
$data['lang_direction'] = $lang_direction;
|
||||
|
||||
/* Apparently no value was set for this config item */
|
||||
if ($value === 'unset') {
|
||||
@@ -426,23 +379,30 @@ function serendipity_plugin_config(&$plugin, &$bag, &$name, &$desc, &$config_nam
|
||||
$text_rows = null;
|
||||
$input_type = null;
|
||||
|
||||
$is_multi_select = false;
|
||||
$ctype = $cbag->get('type');
|
||||
|
||||
$data['is_multi_select'] = $is_multi_select = false;
|
||||
$data['ctype'] = $ctype = $cbag->get('type');
|
||||
|
||||
$data['elcount'] = $elcount;
|
||||
$data['hvalue'] = $hvalue;
|
||||
$data['postKey'] = $postKey;
|
||||
$data['config_item'] = $config_item;
|
||||
|
||||
ob_start();
|
||||
|
||||
switch ($ctype) {
|
||||
case 'seperator':
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="2"><hr noshade="noshade" size="1" /></td>
|
||||
</tr>
|
||||
<?php
|
||||
case 'seperator':
|
||||
$data['ctype'] = 'seperator';
|
||||
$serendipity['smarty']->assign($data);
|
||||
$serendipity['smarty']->display('file:'. $tfile);
|
||||
|
||||
break;
|
||||
|
||||
case 'multiselect':
|
||||
$is_multi_select = true;
|
||||
case 'multiselect':
|
||||
$data['ctype'] = 'multiselect';
|
||||
$data['is_multi_select'] = $is_multi_select = true;
|
||||
|
||||
case 'select':
|
||||
case 'select':
|
||||
$data['ctype'] = 'select';
|
||||
if (is_array($hvalue)) {
|
||||
$selected_options = $hvalue;
|
||||
} elseif ($is_multi_select) {
|
||||
@@ -451,51 +411,32 @@ function serendipity_plugin_config(&$plugin, &$bag, &$name, &$desc, &$config_nam
|
||||
$selected_options = array($hvalue => $hvalue);
|
||||
}
|
||||
|
||||
$pre_selected = (array)$cbag->get('select_preselected');
|
||||
$select_size = $cbag->get('select_size');
|
||||
$select = $cbag->get('select_values');
|
||||
?>
|
||||
<tr>
|
||||
<td style="border-bottom: 1px solid #000000; vertical-align: top"><strong><?php echo $cname; ?></strong>
|
||||
<?php
|
||||
if ($cdesc != '') {
|
||||
?>
|
||||
<br><span style="color: #5E7A94; font-size: 8pt;"> <?php echo $cdesc; ?></span>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<td style="border-bottom: 1px solid #000000; vertical-align: middle" width="250">
|
||||
<div>
|
||||
<select class="direction_<?php echo $lang_direction; ?>" name="serendipity[<?php echo $postKey; ?>][<?php echo $config_item; ?>]<?php echo ($is_multi_select ? '[]' : ''); ?>" <?php echo ($is_multi_select ? 'multiple="multiple"' : ''); ?> <?php echo ($is_multi_select && $select_size > 0 ? 'size="' . $select_size . '"' : ''); ?>>
|
||||
<?php
|
||||
foreach($select AS $select_value => $select_desc) {
|
||||
$id = htmlspecialchars($config_item . $select_value);
|
||||
?>
|
||||
<option value="<?php echo $select_value; ?>" <?php echo ( (in_array($select_value, $selected_options) || in_array($select_value, $pre_selected) ) ? 'selected="selected"' : ''); ?> title="<?php echo htmlspecialchars($select_desc); ?>">
|
||||
<?php echo htmlspecialchars($select_desc); ?>
|
||||
</option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$data['selected_options'] = $selected_options;
|
||||
$data['pre_selected'] = $pre_selected = (array)$cbag->get('select_preselected');
|
||||
$data['select_size'] = $select_size = $cbag->get('select_size');
|
||||
$data['select'] = $select = $cbag->get('select_values');
|
||||
|
||||
$serendipity['smarty']->assign($data);
|
||||
$serendipity['smarty']->display('file:'. $tfile);
|
||||
|
||||
break;
|
||||
|
||||
case 'tristate':
|
||||
case 'tristate':
|
||||
$data['ctype'] = 'tristate';
|
||||
$per_row = 3;
|
||||
$radio['value'][] = 'default';
|
||||
$radio['desc'][] = USE_DEFAULT;
|
||||
|
||||
case 'boolean':
|
||||
case 'boolean':
|
||||
$data['ctype'] = 'boolean';
|
||||
$radio['value'][] = 'true';
|
||||
$radio['desc'][] = YES;
|
||||
|
||||
$radio['value'][] = 'false';
|
||||
$radio['desc'][] = NO;
|
||||
|
||||
case 'radio':
|
||||
case 'radio':
|
||||
$data['ctype'] = 'radio';
|
||||
if (!count($radio) > 0) {
|
||||
$radio = $cbag->get('radio');
|
||||
}
|
||||
@@ -506,19 +447,8 @@ function serendipity_plugin_config(&$plugin, &$bag, &$name, &$desc, &$config_nam
|
||||
$per_row = 2;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td style="border-bottom: 1px solid #000000; vertical-align: top"><strong><?php echo $cname; ?></strong>
|
||||
<?php
|
||||
if ($cdesc != '') {
|
||||
?>
|
||||
<br /><span style="color: #5E7A94; font-size: 8pt;"> <?php echo $cdesc; ?></span>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td style="border-bottom: 1px solid #000000; vertical-align: middle;" width="250">
|
||||
<?php
|
||||
$data['per_row'] = $per_row;
|
||||
$data['radio_button'] = array();
|
||||
$counter = 0;
|
||||
foreach($radio['value'] AS $radio_index => $radio_value) {
|
||||
$id = htmlspecialchars($config_item . $radio_value);
|
||||
@@ -532,74 +462,41 @@ function serendipity_plugin_config(&$plugin, &$bag, &$name, &$desc, &$config_nam
|
||||
} elseif ($radio_value == $hvalue) {
|
||||
$checked = " checked";
|
||||
}
|
||||
|
||||
if ($counter == 1) {
|
||||
?>
|
||||
<div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<input class="direction_<?php echo $lang_direction; ?> input_radio" type="radio" id="serendipity_plugin_<?php echo $id; ?>" name="serendipity[<?php echo $postKey; ?>][<?php echo $config_item; ?>]" value="<?php echo $radio_value; ?>" <?php echo $checked ?> title="<?php echo htmlspecialchars($radio['desc'][$radio_index]); ?>" />
|
||||
<label for="serendipity_plugin_<?php echo $id; ?>"><?php echo htmlspecialchars($radio['desc'][$radio_index]); ?></label>
|
||||
<?php
|
||||
if ($counter == $per_row) {
|
||||
$counter = 0;
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
$data['radio_button'][$radio_index]['id'] = $id;
|
||||
$data['radio_button'][$radio_index]['checked'] = $checked;
|
||||
$data['radio_button'][$radio_index]['counter'] = $counter;
|
||||
$data['radio_button'][$radio_index]['value'] = $radio_value;
|
||||
$data['radio_button'][$radio_index]['index'] = htmlspecialchars($radio['desc'][$radio_index]);
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
$serendipity['smarty']->assign($data);
|
||||
$serendipity['smarty']->display('file:'. $tfile);
|
||||
|
||||
break;
|
||||
|
||||
case 'string':
|
||||
case 'string':
|
||||
$data['ctype'] = 'string';
|
||||
if (empty($input_type)) {
|
||||
$input_type = $cbag->get('input_type');
|
||||
if (empty($input_type)) {
|
||||
$input_type = "text";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td style="border-bottom: 1px solid #000000">
|
||||
<strong><?php echo $cname; ?></strong>
|
||||
<br><span style="color: #5E7A94; font-size: 8pt;"> <?php echo $cdesc; ?></span>
|
||||
</td>
|
||||
<td style="border-bottom: 1px solid #000000" width="250">
|
||||
<div>
|
||||
<input class="direction_<?php echo $lang_direction; ?> input_textbox" type="<?php echo $input_type; ?>" name="serendipity[<?php echo $postKey; ?>][<?php echo $config_item; ?>]" value="<?php echo $hvalue; ?>" size="30" />
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$data['input_type'] = $input_type;
|
||||
$serendipity['smarty']->assign($data);
|
||||
$serendipity['smarty']->display('file:'. $tfile);
|
||||
|
||||
break;
|
||||
|
||||
case 'html':
|
||||
case 'text':
|
||||
case 'html': $data['ctype'] = 'html';
|
||||
case 'text': $data['ctype'] = 'text';
|
||||
if (empty($text_rows)) {
|
||||
$text_rows = $cbag->get('rows');
|
||||
if (empty($text_rows)) {
|
||||
$text_rows = 20;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="2"><strong><?php echo $cname; ?></strong>
|
||||
<span style="color: #5E7A94; font-size: 8pt;"> <?php echo $cdesc; ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div>
|
||||
<textarea class="direction_<?php echo $lang_direction; ?>" style="width: 100%" id="nuggets<?php echo $elcount; ?>" name="serendipity[<?php echo $postKey; ?>][<?php echo $config_item; ?>]" rows="<?php echo $text_rows; ?>" cols="80"><?php echo $hvalue; ?></textarea>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$data['text_rows'] = $text_rows;
|
||||
if ($cbag->get('type') == 'html') {
|
||||
$htmlnugget[] = $elcount;
|
||||
if (!function_exists('serendipity_emit_htmlarea_code')) {
|
||||
@@ -607,48 +504,43 @@ function serendipity_plugin_config(&$plugin, &$bag, &$name, &$desc, &$config_nam
|
||||
}
|
||||
serendipity_emit_htmlarea_code('nuggets', 'nuggets', true);
|
||||
}
|
||||
$serendipity['smarty']->assign($data);
|
||||
$serendipity['smarty']->display('file:'. $tfile);
|
||||
|
||||
break;
|
||||
|
||||
case 'content':
|
||||
$data['ctype'] = 'content';
|
||||
$data['cbag_default'] = $cbag->get('default');
|
||||
$serendipity['smarty']->assign($data);
|
||||
$serendipity['smarty']->display('file:'. $tfile);
|
||||
|
||||
break;
|
||||
|
||||
case 'content':
|
||||
?><tr><td colspan="2"><?php echo $cbag->get('default'); ?></td></tr><?php
|
||||
case 'custom':
|
||||
$data['ctype'] = 'custom';
|
||||
$data['cbag_custom'] = $cbag->get('custom');
|
||||
$serendipity['smarty']->assign($data);
|
||||
$serendipity['smarty']->display('file:'. $tfile);
|
||||
|
||||
break;
|
||||
|
||||
case 'custom':
|
||||
?><tr><td colspan="2">
|
||||
<input type="hidden" id="config_<?php echo $postKey; ?>_<?php echo $config_item; ?>" name="serendipity[<?php echo $postKey; ?>][<?php echo $config_item; ?>]" value="<?php echo $hvalue; ?>" size="30" />
|
||||
<?php echo $cbag->get('custom'); ?>
|
||||
</td></tr><?php
|
||||
case 'hidden':
|
||||
$data['ctype'] = 'hidden';
|
||||
$data['cbag_value'] = $cbag->get('value');
|
||||
$serendipity['smarty']->assign($data);
|
||||
$serendipity['smarty']->display('file:'. $tfile);
|
||||
|
||||
break;
|
||||
|
||||
case 'hidden':
|
||||
?><tr><td colspan="2"><input class="direction_<?php echo $lang_direction; ?>" type="hidden" name="serendipity[<?php echo $postKey; ?>][<?php echo $config_item; ?>]" value="<?php echo $cbag->get('value'); ?>" /></td></tr><?php
|
||||
break;
|
||||
|
||||
case 'media':
|
||||
case 'media':
|
||||
$data['ctype'] = 'media';
|
||||
// Output the JavaScript, if we haven't already
|
||||
$mediajs_output = $serendipity['mediajs_output'];
|
||||
if (!$mediajs_output)
|
||||
{
|
||||
print <<<EOS
|
||||
<script type="text/javascript" language="JavaScript" src="serendipity_editor.js"></script>
|
||||
<script type="text/javascript">
|
||||
function change_preview(id)
|
||||
{
|
||||
var text_box = document.getElementById('serendipity[template][' + id + ']');
|
||||
var image_box = document.getElementById(id + '_preview');
|
||||
var filename = text_box.value;
|
||||
image_box.style.backgroundImage = 'url(' + filename + ')';
|
||||
image_box.style.backgroundRepeat = 'no-repeat';
|
||||
}
|
||||
function choose_media(id)
|
||||
{
|
||||
window.open('serendipity_admin_image_selector.php?serendipity[htmltarget]=' + id + '&serendipity[filename_only]=true', 'ImageSel', 'width=800,height=600,toolbar=no,scrollbars=1,scrollbars,resize=1,resizable=1');
|
||||
}
|
||||
</script>
|
||||
|
||||
EOS;
|
||||
$serendipity['mediajs_output'] = true;
|
||||
}
|
||||
$data['mediajs_output'] = $mediajs_output = $serendipity['mediajs_output'];
|
||||
if (!$mediajs_output)
|
||||
{
|
||||
$serendipity['mediajs_output'] = true;
|
||||
}
|
||||
// Print the HTML to display the popup media selector
|
||||
$preview_width = $cbag->get('preview_width');
|
||||
if (!$preview_width || $preview_width == "") {
|
||||
@@ -658,25 +550,16 @@ EOS;
|
||||
if (!$preview_height || $preview_height == "") {
|
||||
$preview_height = '100px';
|
||||
}
|
||||
$media_link_text = MEDIA_LIBRARY;
|
||||
print <<<EOS
|
||||
<tr><td colspan="2">
|
||||
<strong>$cname</strong>
|
||||
<br /><span style="color: #5E7A94; font-size: 8pt;">$cdesc</span>
|
||||
</td> </tr>
|
||||
<tr>
|
||||
<td style="border-bottom: 1px solid #000000">
|
||||
<div id="{$config_item}_preview" style="background-image: url($value); width:$preview_width; height: $preview_height; background-repeat: no-repeat;"> </div>
|
||||
</td>
|
||||
<td style="border-bottom: 1px solid #000000">
|
||||
<input class="input_textbox" type="text" id="serendipity[$postKey][$config_item]" name="serendipity[$postKey][$config_item]" value="$value" onchange="change_preview('$config_item')"/>
|
||||
<br /><a href="#" onclick="choose_media('serendipity[$postKey][$config_item]')">$media_link_text</a>
|
||||
</td>
|
||||
</tr>
|
||||
EOS;
|
||||
$data['preview_width'] = $preview_width;
|
||||
$data['preview_height'] = $preview_height;
|
||||
|
||||
$serendipity['smarty']->assign($data);
|
||||
$serendipity['smarty']->display('file:'. $tfile);
|
||||
|
||||
break;
|
||||
|
||||
case 'sequence':
|
||||
case 'sequence':
|
||||
$data['ctype'] = 'sequence';
|
||||
// For the drag-n-drop to work, the list must be included in
|
||||
// a container (probably an <ol>) that JavaScript can access
|
||||
// (easiest by ID), with <li> children that have unique IDs,
|
||||
@@ -684,12 +567,11 @@ EOS;
|
||||
// I can't get it to work unless there's a class of
|
||||
// pluginmanager_container on the ol, either.
|
||||
// The drag-n-drop returns the list of IDs in order.
|
||||
$sequencejs_output = $serendipity['sequencejs_output'];
|
||||
$data['sequencejs_output'] = $sequencejs_output = $serendipity['sequencejs_output'];
|
||||
if (!$sequencejs_output) {
|
||||
echo '<script src="' . serendipity_getTemplateFile('dragdrop.js') . '" type="text/javascript"></script>';
|
||||
$serendipity['sequencejs_output'] = true;
|
||||
}
|
||||
|
||||
|
||||
// I want this generic sequence widget to hide the ID, but
|
||||
// display a name or description with an optional picture.
|
||||
// (This would allow users to identify choices by thumbnail.)
|
||||
@@ -700,9 +582,10 @@ EOS;
|
||||
if (!$value) {
|
||||
$value = $eventData['default'];
|
||||
}
|
||||
$cname = $cbag->get('name');
|
||||
$cdesc = $cbag->get('description');
|
||||
$checkable = $cbag->get('checkable');
|
||||
$data['value'] = $value;
|
||||
$data['cname'] = $cname = $cbag->get('name');
|
||||
$data['cdesc'] = $cdesc = $cbag->get('description');
|
||||
$data['checkable'] = $checkable = $cbag->get('checkable');
|
||||
|
||||
/** Unordered array of values */
|
||||
$items = $cbag->get('values');
|
||||
@@ -710,10 +593,8 @@ EOS;
|
||||
/** Array specifying order to use values in $items */
|
||||
$order = null;
|
||||
if ($value) {
|
||||
$store_order = $order = explode(',', $value);
|
||||
$data['store_order'] = $store_order = $order = explode(',', $value);
|
||||
}
|
||||
$uparrow_img = serendipity_getTemplateFile('admin/img/uparrow.png');
|
||||
$downarrow_img = serendipity_getTemplateFile('admin/img/downarrow.png');
|
||||
|
||||
// $items is the list of things to sequence. It's not in
|
||||
// order, and reordering PHP arrays is problematic. So
|
||||
@@ -762,31 +643,9 @@ EOS;
|
||||
}
|
||||
|
||||
// Start the row, add one cell for the name and description
|
||||
print <<<EOS
|
||||
<tr>
|
||||
<td style="border-bottom: 1px solid #000000; vertical-align: top">
|
||||
<strong>$cname</strong>
|
||||
<br /><span style="color: #5E7A94; font-size: 8pt;">$cdesc</span>
|
||||
</td>
|
||||
|
||||
EOS;
|
||||
// Now add one cell for the list
|
||||
print <<<EOS
|
||||
<td style="border-bottom: 1px solid #000000; vertical-align: middle">
|
||||
|
||||
EOS;
|
||||
// Print the list
|
||||
print <<<EOS
|
||||
<input type="hidden" name="serendipity[$postKey][$config_item]" id="${config_item}_value" value="$value" />
|
||||
<noscript>
|
||||
<!-- Replace standard submit button when using up/down submits -->
|
||||
<input type="hidden" name="SAVECONF" value="Save" />
|
||||
</noscript>
|
||||
<ol id="$config_item" class="sequence_container pluginmanager_container">
|
||||
|
||||
EOS;
|
||||
$sort_idx == 0;
|
||||
$last = count($order) - 1;
|
||||
$data['items'] = $items;
|
||||
$sort_idx = 0;
|
||||
$data['last'] = $last = count($order) - 1;
|
||||
foreach ($order as $id) {
|
||||
// Create the variables required to print this item
|
||||
if ($sort_idx > 0) {
|
||||
@@ -794,114 +653,41 @@ EOS;
|
||||
$temp = $swapping[(int)$sort_idx];
|
||||
$swapping[(int)$sort_idx] = $swapping[(int)($sort_idx - 1)];
|
||||
$swapping[(int)($sort_idx - 1)] = $temp;
|
||||
$oneup = implode(',' , $swapping);
|
||||
$data['order_id'][$sort_idx]['oneup'] = $oneup = implode(',' , $swapping);
|
||||
}
|
||||
if ($sort_idx < $last) {
|
||||
$swapping = $order;
|
||||
$temp = $swapping[(int)$sort_idx];
|
||||
$swapping[(int)$sort_idx] = $swapping[(int)($sort_idx + 1)];
|
||||
$swapping[(int)($sort_idx + 1)] = $temp;
|
||||
$onedown = implode(',' , $swapping);
|
||||
$data['order_id'][$sort_idx]['onedown'] = $onedown = implode(',' , $swapping);
|
||||
}
|
||||
|
||||
|
||||
$data['order_id'][$sort_idx]['id'] = $id;
|
||||
$data['order_id'][$sort_idx]['sort_idx'] = $sort_idx;
|
||||
// Print the HTML
|
||||
//
|
||||
// Set the item and its ID
|
||||
print ' <li id="'.$id.'" class="sequence_item pluginmanager_item_even">' . "\n";
|
||||
// Make a handle with ID 'g$id'
|
||||
print ' <div id="g'.$id.'" class="pluginmanager_grablet sequence_grablet"><a href="#"></a></div>' . "\n";
|
||||
|
||||
if ($checkable) {
|
||||
print ' <input type="checkbox" onclick="sort_' . $config_item . '_Sequence();" name="serendipity[' . $postKey . ']' . '[activate][' . $config_item . '][' . $id . ']" ' . (in_array($id, $store_order) ? ' checked="checked" ' : '') . ' value="true" id="activate_' . $id . '" />' . "\n";
|
||||
}
|
||||
|
||||
// Add the item contents
|
||||
print ' <span>'.$items[$id]['display'].'</span>' . "\n";
|
||||
if (isset($items[$id]['img'])) {
|
||||
print ' <img src="'.$items[$id]['img'].'" />' . "\n";
|
||||
}
|
||||
// Luddite submit buttons (please, think of the scriptless!)
|
||||
print "<noscript><div>\n";
|
||||
if ($sort_idx == 0) {
|
||||
// Skip the move-up submit button
|
||||
print " \n";
|
||||
} else {
|
||||
print <<<EOS
|
||||
<button type="submit" name="serendipity[$postKey][override][$config_item]" value="$oneup">
|
||||
<img src="$uparrow_img" alt="Move Up">
|
||||
</button>
|
||||
|
||||
EOS;
|
||||
}
|
||||
if ($sort_idx == $last) {
|
||||
// Skip the move-down submit button
|
||||
print " \n";
|
||||
} else {
|
||||
print <<<EOS
|
||||
<button type="submit" name="serendipity[$postKey][override][$config_item]" value="$onedown">
|
||||
<img src="$downarrow_img" alt="Move Down">
|
||||
</button>
|
||||
|
||||
EOS;
|
||||
}
|
||||
print "</div></noscript>\n";
|
||||
// Close the item
|
||||
print ' </li>'."\n";
|
||||
// Next, please
|
||||
$sort_idx++;
|
||||
}
|
||||
} // foreach end
|
||||
|
||||
if (!is_array($items) or empty($order)) {
|
||||
// Print the empty message
|
||||
print(NONE);
|
||||
$data['none'] = sprint(NONE);
|
||||
}
|
||||
// Print the Javascript to drag-n-drop the list
|
||||
print <<<EOS
|
||||
<script type="text/javascript">
|
||||
function sort_${config_item}_Sequence() {
|
||||
//var seq = DragDrop.serData('${config_item}_group', null);
|
||||
var seq = DragDrop.serData(null, '${config_item}');
|
||||
var start = seq.indexOf("(");
|
||||
var end = seq.indexOf(")");
|
||||
seq = seq.slice((start + 1), end);
|
||||
checkable_seq = seq.split(",");
|
||||
out_seq = '';
|
||||
for (i in checkable_seq) {
|
||||
if (document.getElementById('activate_' + checkable_seq[i]) && !document.getElementById('activate_' + checkable_seq[i]).checked) {
|
||||
continue;
|
||||
} else {
|
||||
if (out_seq != '') {
|
||||
out_seq += ',';
|
||||
}
|
||||
|
||||
out_seq += checkable_seq[i];
|
||||
}
|
||||
}
|
||||
var order = document.getElementById("${config_item}_value");
|
||||
order.value = out_seq;
|
||||
}
|
||||
|
||||
function init_${config_item}_Sequence()
|
||||
{
|
||||
var lst = document.getElementById("${config_item}");
|
||||
DragDrop.makeListContainer(lst, '${config_item}_group');
|
||||
lst.onDragOut = function() {
|
||||
sort_${config_item}_Sequence();
|
||||
};
|
||||
}
|
||||
addLoadEvent(init_${config_item}_Sequence);
|
||||
</script>
|
||||
|
||||
EOS;
|
||||
// Finish the row
|
||||
print <<<EOS
|
||||
</td>
|
||||
$serendipity['smarty']->assign($data);
|
||||
$serendipity['smarty']->display('file:'. $tfile);
|
||||
|
||||
EOS;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
default:
|
||||
$data['ctype'] = 'default';
|
||||
// Unknown configuration key. Let the plugin handle it.
|
||||
$addData = func_get_args();
|
||||
$eventData = array(
|
||||
@@ -913,104 +699,47 @@ EOS;
|
||||
'postKey' => $postKey
|
||||
);
|
||||
serendipity_plugin_api::hook_event('backend_pluginconfig_' . $ctype, $eventData, $addData);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
$out_stack[$config_item] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
}
|
||||
|
||||
if (is_array($config_groups)) {
|
||||
$hid = 0;
|
||||
$folded = true;
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div align="right">
|
||||
<a style="border:0; text-decoration: none" href="#" onClick="showConfigAll(<?php echo sizeof($config_groups); ?>)" title="<?php echo TOGGLE_ALL; ?>"><img src="<?php echo serendipity_getTemplateFile('img/'. ($folded === true ? 'plus' : 'minus') .'.png') ?>" id="optionall" alt="+/-" border="0" /> <?php echo TOGGLE_ALL; ?></a></a><br />
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
foreach($config_groups AS $config_header => $config_groupkeys) {
|
||||
$hid++;
|
||||
echo '<tr>';
|
||||
echo '<td colspan="2">';
|
||||
|
||||
echo '<h2>';
|
||||
echo '<a style="border:0; text-decoration: none;" href="#" onClick="showConfig(\'el' . $hid . '\'); return false" title="' . TOGGLE_OPTION . '"><img src="' . serendipity_getTemplateFile('img/'. ($folded === true ? 'plus' : 'minus') .'.png') . '" id="optionel' . $hid . '" alt="+/-" border="0" /> ';
|
||||
echo $config_header;
|
||||
echo '</a>';
|
||||
echo '</h2>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td colspan="2">';
|
||||
echo '<table class="plugin_optiongroup" id="el' . $hid . '" border="0" cellspacing="0" cellpadding="3" width="100%">';
|
||||
|
||||
foreach($config_groupkeys AS $config_groupkey) {
|
||||
echo $out_stack[$config_groupkey];
|
||||
echo "\n";
|
||||
unset($out_stack[$config_groupkey]);
|
||||
}
|
||||
echo '</table>';
|
||||
|
||||
echo '<script type="text/javascript" language="JavaScript">';
|
||||
echo 'document.getElementById("el' . $hid . '").style.display = "none";' . "\n";
|
||||
echo '</script>';
|
||||
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
echo '<tr><td colspan="2" style="height: 100px" id="configuration_footer"> </td></tr>';
|
||||
}
|
||||
|
||||
echo implode("\n", $out_stack);
|
||||
|
||||
if ($showTable) {
|
||||
?>
|
||||
</table>
|
||||
<br />
|
||||
<?php
|
||||
}
|
||||
$data['config_groups'] = $config_groups;
|
||||
$data['OUT_STACK'] = $out_stack;
|
||||
|
||||
// is left here without use for archiv issues - now using external js file outsourced to templates/default/admin/admin_scripts.js
|
||||
// see passed vars in serendipity_plugin_config.fnc.tpl - can get erased, as not being used any more if keeping Smartification.
|
||||
ob_start();
|
||||
serendipity_printConfigJS();
|
||||
$config_js = ob_get_contents();
|
||||
$data['serendipity_printConfigJS'] = $config_js;
|
||||
ob_end_clean();
|
||||
|
||||
if ($showSubmit) {
|
||||
?>
|
||||
<div style="padding-left: 20px">
|
||||
<input type="submit" name="SAVECONF" value="<?php echo SAVE; ?>" class="serendipityPrettyButton input_button" />
|
||||
</div>
|
||||
<?php
|
||||
// this is new - allowing easier access to script handling like toogle
|
||||
$data['allow_admin_scripts'] = true;
|
||||
|
||||
if ($showSubmit) {
|
||||
$data['showSubmit_foot'] = true;
|
||||
}
|
||||
|
||||
if ($showExample && method_exists($plugin, 'example') ) {
|
||||
?>
|
||||
<div>
|
||||
<?php echo $plugin->example() ?>
|
||||
</div>
|
||||
<?php
|
||||
if ($showExample && method_exists($plugin, 'example') ) {
|
||||
$data['showExample'] = true;
|
||||
$data['plugin_example'] = $plugin->example();
|
||||
}
|
||||
|
||||
if ($spawnNuggets && isset($serendipity['wysiwyg']) && $serendipity['wysiwyg'] && count($htmlnugget) > 0) {
|
||||
if ($spawnNuggets && isset($serendipity['wysiwyg']) && $serendipity['wysiwyg'] && count($htmlnugget) > 0) {
|
||||
$data['spawnNuggets'] = true;
|
||||
$ev = array('nuggets' => $htmlnugget, 'skip_nuggets' => false);
|
||||
serendipity_plugin_api::hook_event('backend_wysiwyg_nuggets', $ev);
|
||||
$data['ev'] = $ev;
|
||||
}
|
||||
|
||||
if ($ev['skip_nuggets'] === false) {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function Spawnnugget() {
|
||||
/* blar */
|
||||
<?php foreach($htmlnugget AS $htmlnuggetid) { ?>
|
||||
Spawnnuggets('<?php echo $htmlnuggetid; ?>');
|
||||
<?php } ?>
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
$serendipity['smarty']->assign($data);
|
||||
$tfile = dirname(__FILE__) . "/admin/tpl/serendipity_plugin_config.fnc.tpl";
|
||||
$content = $serendipity['smarty']->fetch('file:'. $tfile);
|
||||
echo $content;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
55
templates/default/admin/admin_scripts.js
Normal file
55
templates/default/admin/admin_scripts.js
Normal file
@@ -0,0 +1,55 @@
|
||||
// usage: log('inside coolFunc', this, arguments);
|
||||
// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
|
||||
window.log = function f(){ log.history = log.history || []; log.history.push(arguments); if(this.console) { var args = arguments, newarr; try { args.callee = f.caller } catch(e) {}; newarr = [].slice.call(args); if (typeof console.log === 'object') log.apply.call(console.log, console, newarr); else console.log.apply(console, newarr);}};
|
||||
|
||||
// make it safe to use console.log always
|
||||
(function(a){function b(){}for(var c="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),d;!!(d=c.pop());){a[d]=a[d]||b;}})
|
||||
(function(){try{console.log();return window.console;}catch(a){return (window.console={});}}());
|
||||
|
||||
|
||||
// place any jQuery/helper plugins in here, instead of separate, slower script files.
|
||||
|
||||
// Serendipity backend functions - used in
|
||||
// - serendipity_plugins_admin.inc.php::serendipity_plugin_config() function
|
||||
// - templates/default/admin/default_staticpage_backend.tpl
|
||||
function showConfig(id) {
|
||||
if (document.getElementById) {
|
||||
dlm = document.getElementById(id);
|
||||
if (dlm.style.display == 'none') {
|
||||
document.getElementById('option' + id).src = img_minus;
|
||||
dlm.style.display = '';
|
||||
} else {
|
||||
document.getElementById('option' + id).src = img_plus;
|
||||
dlm.style.display = 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var state='';
|
||||
function showConfigAll(count) {
|
||||
if (document.getElementById) {
|
||||
for (i = 1; i <= count; i++) {
|
||||
document.getElementById('el' + i).style.display = state;
|
||||
document.getElementById('optionel' + i).src = (state == '' ? img_minus : img_plus);
|
||||
}
|
||||
|
||||
if (state == '') {
|
||||
document.getElementById('optionall').src = img_minus;
|
||||
state = 'none';
|
||||
} else {
|
||||
document.getElementById('optionall').src = img_plus;
|
||||
state = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function chkAll(frm, arr, mark) {
|
||||
for (i = 0; i <= frm.elements.length; i++) {
|
||||
try {
|
||||
if(frm.elements[i].name == arr) {
|
||||
frm.elements[i].checked = mark;
|
||||
}
|
||||
} catch (err) {}
|
||||
}
|
||||
}
|
||||
|
||||
12
templates/default/admin/image_selector.js
Normal file
12
templates/default/admin/image_selector.js
Normal file
@@ -0,0 +1,12 @@
|
||||
function change_preview(id)
|
||||
{
|
||||
var text_box = document.getElementById('serendipity[template][' + id + ']');
|
||||
var image_box = document.getElementById(id + '_preview');
|
||||
var filename = text_box.value;
|
||||
image_box.style.backgroundImage = 'url(' + filename + ')';
|
||||
image_box.style.backgroundRepeat = 'no-repeat';
|
||||
}
|
||||
function choose_media(id)
|
||||
{
|
||||
window.open('serendipity_admin_image_selector.php?serendipity[htmltarget]=' + id + '&serendipity[filename_only]=true', 'ImageSel', 'width=800,height=600,toolbar=no,scrollbars=1,scrollbars,resize=1,resizable=1');
|
||||
}
|
||||
Reference in New Issue
Block a user