A new 2.x backend for serendipity_event_includeentry

- Fix version variables, fix messages
- Fix sidebar link
- Add proper backend headings
- Better markup for block selection
- Fix height for textareas

References s9y/Serendipity#426
This commit is contained in:
Matthias Mees 2016-10-23 17:51:35 +02:00
parent c815b2f9d7
commit cbf30ef342
2 changed files with 36 additions and 43 deletions

View file

@ -146,7 +146,7 @@
<div class="clearfix form_area<?php if ($cdesc != '') { ?> has_info<?php } ?>">
<label for="nuggets<?php echo $elcount; ?>"><?php echo $cname; if ($cdesc != '' && !$backend_wysiwyg) { ?> <button class="toggle_info button_link" type="button" data-href="#nuggets<?php echo $elcount; ?>_info"><span class="icon-info-circled"></span><span class="visuallyhidden"> <?php echo MORE; ?></span></button><?php } ?></label>
<?php if ($cdesc != '') { ?><span id="nuggets<?php echo $elcount; ?>_info" class="field_info additional_info"><?php echo $cdesc; ?></span><?php } ?>
<textarea id="nuggets<?php echo $elcount; ?>" class="direction_<?php echo $lang_direction; ?>" name="serendipity[plugin][<?php echo $config_item; ?>]" rows="{$text_rows}"><?php echo $hvalue; ?></textarea>
<textarea id="nuggets<?php echo $elcount; ?>" class="direction_<?php echo $lang_direction; ?>" name="serendipity[plugin][<?php echo $config_item; ?>]" rows="10"><?php echo $hvalue; ?></textarea>
</div>
<?php
@ -178,7 +178,7 @@
if (isset($serendipity['wysiwyg']) && $serendipity['wysiwyg'] && count($htmlnugget) > 0) {
$ev = array('nuggets' => $htmlnugget, 'skip_nuggets' => false);
serendipity_plugin_api::hook_event('backend_wysiwyg_nuggets', $ev);
if ($ev['skip_nuggets'] === false) {
?>
<script type="text/javascript">
@ -197,4 +197,4 @@
<input class="input_button state_submit" type="submit" value="<?php echo SAVE; ?>" name="serendipity[SAVECONF]">
</div>
</div>
</div>

View file

@ -399,7 +399,7 @@ class serendipity_event_includeentry extends serendipity_event
if ($serendipity['version'][0] < 2) {
echo '<div class="serendipityAdminMsgError"><img style="width: 22px; height: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_error.png') . '" alt="" />ERROR: ' . $result . '</div>'."\n";
} else {
echo '<div class="msg_error"><span class="icon-attention-circled"></span> ERROR: ' . $result . '</div>'."\n";
echo '<span class="msg_error"><span class="icon-attention-circled"></span> ERROR: ' . $result . '</span>'."\n";
}
}
$serendipity["POST"]["staticblock"] = serendipity_db_insert_id("staticblocks", 'id');
@ -409,7 +409,7 @@ class serendipity_event_includeentry extends serendipity_event
if ($serendipity['version'][0] < 2) {
echo '<div class="serendipityAdminMsgError"><img style="width: 22px; height: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_error.png') . '" alt="" />ERROR: ' . $result . '</div>'."\n";
} else {
echo '<div class="msg_error"><span class="icon-attention-circled"></span> ERROR: ' . $result . '</div>'."\n";
echo '<span class="msg_error"><span class="icon-attention-circled"></span> ERROR: ' . $result . '</span>'."\n";
}
}
}
@ -445,10 +445,8 @@ class serendipity_event_includeentry extends serendipity_event
if ($form === null) {
$form = '
<form action="serendipity_admin.php" method="post">
<div>
<input type="hidden" name="serendipity[adminModule]" value="event_display"'.$solidus.'>
<input type="hidden" name="serendipity[adminAction]" value="staticblocks"'.$solidus.'>
</div>'."\n";
<input type="hidden" name="serendipity[adminModule]" value="event_display"'.$solidus.'>
<input type="hidden" name="serendipity[adminAction]" value="staticblocks"'.$solidus.'>'."\n";
}
if ($type == 'form') {
@ -456,24 +454,23 @@ class serendipity_event_includeentry extends serendipity_event
}
$html = $form . '
<div>
<input type="hidden" name="serendipity[type]" value="' . $type . '"'.$solidus.'>
<select id="staticblock_' . $type . '" name="serendipity[staticblock]">
<option value="__new">' . NEW_ENTRY . '</option>
<option value="__new">-----------------</option>';
<input type="hidden" name="serendipity[type]" value="' . $type . '"'.$solidus.'>
<select id="staticblock_' . $type . '" name="serendipity[staticblock]">
<option value="__new">' . NEW_ENTRY . '</option>
<option value="__new">-----------------</option>';
$html .= $this->getPages($serendipity['POST']['staticblock'], $type);
$html .= '
</select><br'.$solidus.'>
<input class="serendipityPrettyButton input_button state_submit" type="submit" name="serendipity[staticSubmit]" value="' . GO . '" /> <input class="serendipityPrettyButton input_button state_cancel" type="submit" name="serendipity[staticDelete]" value="' . DELETE . '"'.$solidus.'>';
</select>
<input type="submit" name="serendipity[staticSubmit]" value="' . GO . '">
<input class="state_cancel" type="submit" name="serendipity[staticDelete]" value="' . DELETE . '">';
if ($type == 'template') {
$html .= '<br'.$solidus.'><a onclick="this.href = this.href + document.getElementById(\'staticblock_template\').options[document.getElementById(\'staticblock_template\').selectedIndex].value" href="serendipity_admin.php?serendipity[adminModule]=entries&amp;serendipity[adminAction]=new&amp;serendipity[staticblock]=" style="margin-top: 5px; display: block" class="serendipityPrettyButton">' . STATICBLOCK_USE . '</a>';
$html .= ' <a onclick="this.href = this.href + document.getElementById(\'staticblock_template\').options[document.getElementById(\'staticblock_template\').selectedIndex].value" href="serendipity_admin.php?serendipity[adminModule]=entries&amp;serendipity[adminAction]=new&amp;serendipity[staticblock]=" class="button_link">' . STATICBLOCK_USE . '</a>';
}
$html .= '
</div>
</form>'."\n";
</form>'."\n";
return $html;
}
@ -533,6 +530,8 @@ class serendipity_event_includeentry extends serendipity_event
$this->fetchStaticBlock($serendipity['POST']['staticblock']);
}
echo '<h2>' . PLUGIN_EVENT_INCLUDEENTRY_BLOCKS . '</h2>';
if ($serendipity['POST']['staticSave'] == "true" && !empty($serendipity['POST']['SAVECONF'])) {
$serendipity['POST']['staticSubmit'] = true;
$bag = new serendipity_property_bag;
@ -548,35 +547,31 @@ class serendipity_event_includeentry extends serendipity_event
}
}
if ($serendipity['versioon'][0] < 2) {
if ($serendipity['version'][0] < 2) {
echo '<div class="serendipityAdminMsgSuccess"><img style="width: 22px; height: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_success.png') . '" alt="" />'. DONE . ': '. sprintf(SETTINGS_SAVED_AT, serendipity_strftime('%H:%M:%S')). '</div>'."\n";
} else {
echo '<div class="msg_success"><span class="icon-ok-circled"></span> '. DONE . ': '. sprintf(SETTINGS_SAVED_AT, serendipity_strftime('%H:%M:%S')). '</div>'."\n";
echo '<span class="msg_success"><span class="icon-ok-circled"></span> '. DONE . ': '. sprintf(SETTINGS_SAVED_AT, serendipity_strftime('%H:%M:%S')). '</span>'."\n";
}
$this->updateStaticBlock();
}
if (!empty($serendipity['POST']['staticDelete']) && $serendipity['POST']['staticblock'] != '__new') {
serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}staticblocks WHERE id = " . (int)$serendipity['POST']['staticblock']);
if ($serendipity['versioon'][0] < 2) {
if ($serendipity['version'][0] < 2) {
echo '<div class="serendipityAdminMsgSuccess"><img style="width: 22px; height: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_success.png') . '" alt="" />'. DONE .': '. sprintf(RIP_ENTRY, $this->staticblock['title']) . '</div>'."\n";
} else {
echo '<div class="msg_success"><span class="icon-ok-circled"></span> '. DONE .': '. sprintf(RIP_ENTRY, $this->staticblock['title']) . '</div>'."\n";
echo '<span class="msg_success"><span class="icon-ok-circled"></span> '. DONE .': '. sprintf(RIP_ENTRY, $this->staticblock['title']) . '</span>'."\n";
}
}
echo '<table align="center">
<tr>
<th>' . STATICBLOCK_SELECT_TEMPLATES . '</th>
<th rowspan="2">&nbsp;&nbsp;&nbsp;&nbsp; - ' . WORD_OR . ' - &nbsp;&nbsp;&nbsp;&nbsp;</th>
<th>' . STATICBLOCK_SELECT_BLOCKS . '</th>
</tr>
echo '<div class="form_select">
<label for="staticblock_template">' . STATICBLOCK_SELECT_TEMPLATES . '</label>' . $this->showBlockForm('template') .
'</div>
<tr>
<td style="text-align: center; vertical-align: top">' . $this->showBlockForm('template') . '</td>
<td style="text-align: center; vertical-align: top">' . $this->showBlockForm('block') . '</td>
</tr>
</table>'."\n\n";
<div class="form_select">
<label for="staticblock_block">' . STATICBLOCK_SELECT_BLOCKS . '</label>' .
$this->showBlockForm('block') .
'</div>' . "\n";
$solidus = ($serendipity['version'][0] < 2) ? ' /' : '';
@ -584,19 +579,17 @@ class serendipity_event_includeentry extends serendipity_event
echo $this->showBlockForm('form');
if ($serendipity['POST']['staticSubmit']) {
echo '<h2>';
echo '<h3>';
if ($serendipity['POST']['type'] == 'template') {
echo STATICBLOCK_EDIT_TEMPLATES;
} else {
echo STATICBLOCK_EDIT_BLOCKS;
}
echo '</h2>'."\n\n";
echo '</h3>'."\n\n";
echo '<div>'."\n";
echo ' <input type="hidden" name="serendipity[staticSave]" value="true"'.$solidus.'>'."\n";
echo ' <input type="hidden" name="serendipity[staticblock]" value="' . $serendipity['POST']['staticblock'] . '"'.$solidus.'>'."\n";
echo ' <input type="hidden" name="serendipity[type]" value="' . $serendipity['POST']['type'] . '"'.$solidus.'>'."\n";
echo '</div>'."\n\n";
echo '<input type="hidden" name="serendipity[staticSave]" value="true"'.$solidus.'>'."\n";
echo '<input type="hidden" name="serendipity[staticblock]" value="' . $serendipity['POST']['staticblock'] . '"'.$solidus.'>'."\n";
echo '<input type="hidden" name="serendipity[type]" value="' . $serendipity['POST']['type'] . '"'.$solidus.'>'."\n";
$this->showForm($serendipity['POST']['type']);
}
@ -730,7 +723,7 @@ class serendipity_event_includeentry extends serendipity_event
case 'backend_sidebar_entries':
$this->check();
echo '<li class="serendipitySideBarMenuLink serendipitySideBarMenuEntryLinks"><a href="?serendipity[adminModule]=event_display&amp;serendipity[adminAction]=staticblocks">' . PLUGIN_EVENT_INCLUDEENTRY_BLOCKS . '</a></li>';
echo '<li><a href="?serendipity[adminModule]=event_display&amp;serendipity[adminAction]=staticblocks">' . PLUGIN_EVENT_INCLUDEENTRY_BLOCKS . '</a></li>';
return true;
break;
@ -798,4 +791,4 @@ class serendipity_event_includeentry extends serendipity_event
}
}
/* vim: set sts=4 ts=4 expandtab : */
/* vim: set sts=4 ts=4 expandtab : */