Permalink
Browse files

entries.inc improvements

  • Loading branch information...
1 parent 7e41ce6 commit 83ccfc55db834118cf5e5eb469d8fc18f8a82b09 @ophian ophian committed Feb 20, 2012
Showing with 74 additions and 48 deletions.
  1. +46 −33 include/admin/entries.inc.php
  2. +28 −15 include/admin/tpl/entries.inc.tpl
@@ -96,28 +96,27 @@ function serendipity_drawList() {
$filter_sql
);
- $users = serendipity_fetchUsers('', 'hidden', true);
+ $users = serendipity_fetchUsers('', 'hidden', true);
$categories = serendipity_fetchCategories();
$categories = serendipity_walkRecursive($categories, 'categoryid', 'parentid', VIEWMODE_THREADED);
- // set smarty flag $config_booleanize = true; in backend only? how?
- #$data[''] = '';
- $serendipity['smarty']->assign( array(
- 'drawList' => true,
- 'entries' => $entries,
- 'sort_order' => $sort_order,
- 'per_page' => $per_page,
+ // ToDo: set smarty flag $config_booleanize = true; in backend only? how? or does it not matter?
+ $serendipity['smarty']->assign( array(
+ 'drawList' => true,
+ 'entries' => $entries,
+ 'sort_order' => $sort_order,
+ 'per_page' => $per_page,
'urltoken' => serendipity_setFormToken('url'),
'formtoken' => serendipity_setFormToken(),
- 'users' => $users,
- 'categories' => $categories,
- 'offSet' => $offSet,
- 'use_iframe' => $serendipity['use_iframe']
- )
- );
+ 'users' => $users,
+ 'categories' => $categories,
+ 'offSet' => $offSet,
+ 'use_iframe' => $serendipity['use_iframe']
+ )
+ );
if (is_array($entries)) {
- $data['is_entries'] = true;
+ $data['is_entries'] = true;
$data['count'] = count($entries);
$qString = '?serendipity[adminModule]=entries&serendipity[adminAction]=editSelect';
@@ -178,20 +177,22 @@ function serendipity_drawList() {
$serendipity['smarty']->assign(
array( 'urltoken' => serendipity_setFormToken('url'),
'formtoken' => serendipity_setFormToken(),
- 'serverOffsetHours' => serendipity_serverOffsetHour(),
- 'showFutureEntries' => $serendipity['showFutureEntries']
+ 'serverOffsetHours' => serendipity_serverOffsetHour(),
+ 'showFutureEntries' => $serendipity['showFutureEntries']
));
} // entries end
} // End function serendipity_drawList()
if (!empty($serendipity['GET']['editSubmit'])) {
- $serendipity['GET']['adminAction'] = 'edit';
+ $serendipity['GET']['adminAction'] = 'edit'; // does this change smarty.get vars?
}
$preview_only = false;
+// very sticky smartification to origin, could be done better, I assume!
+
switch($serendipity['GET']['adminAction']) {
case 'preview':
$entry = serendipity_fetchEntry('id', $serendipity['GET']['id'], 1, 1);
@@ -230,7 +231,9 @@ function serendipity_drawList() {
$entry['timestamp'] = strtotime($serendipity['POST']['new_timestamp']);
if ($entry['timestamp'] == -1) {
- echo DATE_INVALID . '<br />';
+ $data['switched_output'] = true;
+ $data['dateval'] = false;
+ #echo DATE_INVALID . '<br />';
// The date given by the user is not convertable. Reset the timestamp.
$entry['timestamp'] = $serendipity['POST']['timestamp'];
}
@@ -243,15 +246,16 @@ function serendipity_drawList() {
// Save the entry, or just display a preview
$use_legacy = true;
- $data['use_legacy'] = $use_legacy;
+ $data['use_legacy'] = $use_legacy;
serendipity_plugin_api::hook_event('backend_entry_iframe', $use_legacy);
if ($use_legacy) {
+ $data['switched_output'] = true;
if ($serendipity['POST']['preview'] != 'true') {
/* We don't need an iframe to save a draft */
if ( $serendipity['POST']['isdraft'] == 'true' ) {
$data['is_draft'] = true;
- #echo '<div class="serendipityAdminMsgSuccess"><img style="height: 22px; width: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_success.png') . '" alt="" />' . IFRAME_SAVE_DRAFT . '</div><br />';
+ #echo '<div class="serendipityAdminMsgSuccess"><img style="height: 22px; width: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_success.png') . '" alt="" />' . IFRAME_SAVE_DRAFT . '</div><br />';
serendipity_updertEntry($entry);
} else {
if ($serendipity['use_iframe']) {
@@ -352,8 +356,10 @@ function serendipity_drawList() {
$entry = serendipity_fetchEntry('id', $serendipity['GET']['id'], 1, 1);
serendipity_deleteEntry((int)$serendipity['GET']['id']);
- $data['is_doDelete'] = true;
- $data['rip_entry'] = printf(RIP_ENTRY, $entry['id'] . ' - ' . htmlspecialchars($entry['title']));
+ $data['switched_output'] = true;
+ $data['is_doDelete'] = true;
+ // for smartification printf had to turn into sprintf!!
+ $data['del_entry'] = sprintf(RIP_ENTRY, $entry['id'] . ' - ' . htmlspecialchars($entry['title']));
#echo '<br />';
$cont_draw = true;
@@ -364,14 +370,16 @@ function serendipity_drawList() {
}
$parts = explode(',', $serendipity['GET']['id']);
- $data['rip_entry'] = array();
+ $data['switched_output'] = true;
+ $data['del_entry'] = array();
foreach($parts AS $id) {
$id = (int)$id;
if ($id > 0) {
$entry = serendipity_fetchEntry('id', $id, 1, 1);
serendipity_deleteEntry((int)$id);
- $data['is_doMultiDelete'] = true;
- $data['rip_entry'][] = printf(RIP_ENTRY, $entry['id'] . ' - ' . htmlspecialchars($entry['title']));
+ $data['is_doMultiDelete'] = true;
+ // for smartification printf had to turn into sprintf!!
+ $data['del_entry'][] = sprintf(RIP_ENTRY, $entry['id'] . ' - ' . htmlspecialchars($entry['title']));
#echo '<br />';
}
}
@@ -388,9 +396,11 @@ function serendipity_drawList() {
$newLoc = '?' . serendipity_setFormToken('url') . '&amp;serendipity[action]=admin&amp;serendipity[adminModule]=entries&amp;serendipity[adminAction]=doDelete&amp;serendipity[id]=' . (int)$serendipity['GET']['id'];
$entry = serendipity_fetchEntry('id', $serendipity['GET']['id'], 1, 1);
- $data['is_delete'] = true;
- $data['newLoc'] = $newLoc;
- #printf(DELETE_SURE, $entry['id'] . ' - ' . htmlspecialchars($entry['title']));
+ $data['switched_output'] = true;
+ $data['is_delete'] = true;
+ $data['newLoc'] = $newLoc;
+ // for smartification printf had to turn into sprintf!!
+ $data['rip_entry'] = sprintf(DELETE_SURE, $entry['id'] . ' - ' . htmlspecialchars($entry['title']));
break;
case 'multidelete':
@@ -399,24 +409,26 @@ function serendipity_drawList() {
}
$ids = '';
- $data['delete_entry'] = array();
+ $data['rip_entry'] = array();
foreach($serendipity['POST']['multiDelete'] AS $idx => $id) {
$ids .= (int)$id . ',';
$entry = serendipity_fetchEntry('id', $id, 1, 1);
$data['is_multidelete'] = true;
- $data['delete_entry'][] = printf(DELETE_SURE, $entry['id'] . ' - ' . htmlspecialchars($entry['title']));
+ // for smartification printf had to turn into sprintf!!
+ $data['rip_entry'][] = sprintf(DELETE_SURE, $entry['id'] . ' - ' . htmlspecialchars($entry['title']));
#echo '<br />';
}
$newLoc = '?' . serendipity_setFormToken('url') . '&amp;serendipity[action]=admin&amp;serendipity[adminModule]=entries&amp;serendipity[adminAction]=doMultiDelete&amp;serendipity[id]=' . $ids;
- $data['newLoc'] = $newLoc;
+ $data['switched_output'] = true;
+ $data['newLoc'] = $newLoc;
break;
case 'edit':
$entry = serendipity_fetchEntry('id', $serendipity['GET']['id'], 1, 1);
default:
include_once S9Y_INCLUDE_PATH . 'include/functions_entries_admin.inc.php';
-
+ // edit entry mode
serendipity_printEntryForm(
'?',
array(
@@ -439,6 +451,7 @@ function serendipity_drawList() {
'formtoken' => serendipity_setFormToken()
));
+
$serendipity['smarty']->assign($data);
$tfile = dirname(__FILE__) . "/tpl/entries.inc.tpl";
@@ -1,7 +1,7 @@
-<div class="serendipity_admin_list">
-
{if $drawList}
+<div class="serendipity_admin_list">
+
<form action="?" method="get">
<input type="hidden" name="serendipity[action]" value="admin" />
<input type="hidden" name="serendipity[adminModule]" value="entries" />
@@ -212,8 +212,14 @@
</table>
</div>
+</div><!-- // div.serendipity_admin_list end -->
+
{else}
- {* We've got nothing *}
+ {if !$switched_output}
+
+<div class="serendipity_admin_list">
+
+ {* We've got nothing *}
<table class="serendipity_admin_list" cellpadding="0" width="100%">
<tr>
@@ -224,12 +230,19 @@
</tr>
</table>
-{/if}{* $drawList end *}
</div><!-- // div.serendipity_admin_list end -->
+ {/if}
+{/if}{* $drawList end *}
+
+{if $switched_output}
+{if ($marty.get.adminAction && $dateval)}
+ {$CONST.DATE_INVALID}
+ <br />
+{/if}
{if ($marty.get.adminAction && $use_legacy)}
- {if $is_Draft}
+ {if $is_draft}
<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.IFRAME_SAVE_DRAFT}</div><br />
{/if}
{if $is_iframe}
@@ -239,19 +252,18 @@
<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.IFRAME_PREVIEW}</div><br />
{/if}
{/if}
-{if ($marty.get.adminAction && $is_doDelete)}
- {foreach $rip_entry AS $rip}
- {$rip}
+{if ($is_doDelete || $is_doMultiDelete )}
+ {foreach $del_entry AS $delent}
+ {$delent}
<br />
- {/foreach}
+ {/foreach}
{/if}
-{if ($marty.get.adminAction && $is_doMultiDelete)}
- {foreach $delete_entry AS $erase}
- {$erase}
+{if ( $is_delete || $is_multidelete )}
+ {* delent and ripent look like $CONST.DELETE_SURE|sprintf:"$del_entry_id - $del_entry_title" *}
+ {foreach $rip_entry AS $ripent}
+ {$ripent}
<br />
- {/foreach}
-{/if}
-{if ($marty.get.adminAction && ( $is_delete || $is_multidelete ))}
+ {/foreach}
<br />
<br />
<div>
@@ -260,3 +272,4 @@
<a href="{$newLoc}" class="serendipityPrettyButton input_button">{$CONST.DUMP_IT}</a>
</div>
{/if}
+{/if}

0 comments on commit 83ccfc5

Please sign in to comment.