Update of /cvsroot/php-blog/serendipity/include/admin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30356/include/admin
Modified Files:
entries.inc.php
Log Message:
Since I'm gone for the weekend, here's something for you to play with.
Tom basically agreed to it, and I get it working well on my setup.
However this is EXPERIMENTAL. You have been warned.
If it breaks seriously, I won't be offended if anyone reverts the commit - but I don't think it's unstable, though. :-)
Index: entries.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/admin/entries.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- entries.inc.php 20 Nov 2004 17:16:00 -0000 1.4
+++ entries.inc.php 26 Nov 2004 14:40:14 -0000 1.5
@@ -297,43 +297,39 @@
if (is_string($res)) {
echo '<div class="serendipity_msg_error">' . QUICKSAVE . ': <b>' . $res . '</b></div><br />';
} else {
- // serendipity_updertEntry sets this global variable to store the entry id. Couldn't pass this
- // by reference or as return value because it affects too many places inside our API and dependant
- // function calls.
- if (!empty($serendipity['lastSavedEntry'])) {
- $entry['id'] = $serendipity['lastSavedEntry'];
- }
echo '<div class="serendipity_msg_notice">' . QUICKSAVE . ': ' . ENTRY_SAVED . '</div><br />';
}
}
// Save the entry, or just display a preview
if ($serendipity['POST']['preview'] != 'true') {
- $res = serendipity_updertEntry($entry);
- if (is_string($res)) {
- serendipity_printEntryForm(
- '?',
- array(
- 'serendipity[action]' => 'admin',
- 'serendipity[adminModule]' => 'entries',
- 'serendipity[adminAction]' => 'save'
- ),
- $entry,
- ERROR . ': <b>' . $res . '</b>');
+ if ($serendipity['use_iframe']) {
+ serendipity_iframe_create('save', $entry);
} else {
- echo '<div class="serendipity_msg_notice">' . ENTRY_SAVED . '</div>';
+ serendipity_iframe($entry, 'save');
}
} else {
// Only display the preview
$serendipity['hidefooter'] = true;
- if (!is_numeric($entry['timestamp'])) $entry['timestamp'] = time();
- if (!isset($entry['trackbacks']) || !$entry['trackbacks']) $entry['trackbacks'] = 0;
- if (!isset($entry['comments']) || !$entry['comments']) $entry['comments'] = 0;
- if (!isset($entry['username']) || !$entry['username']) $entry['username'] = $serendipity['serendipityUser'];
+ if (!is_numeric($entry['timestamp'])) {
+ $entry['timestamp'] = time();
+ }
+
+ if (!isset($entry['trackbacks']) || !$entry['trackbacks']) {
+ $entry['trackbacks'] = 0;
+ }
+
+ if (!isset($entry['comments']) || !$entry['comments']) {
+ $entry['comments'] = 0;
+ }
+
+ if (!isset($entry['username']) || !$entry['username']) {
+ $entry['username'] = $serendipity['serendipityUser'];
+ }
$categories = (array)$entry['categories'];
$entry['categories'] = array();
- foreach ( $categories as $catid ) {
+ foreach ($categories as $catid) {
$entry['categories'][] = serendipity_fetchCategoryInfo($catid);
}
@@ -343,27 +339,32 @@
$serendipity['GET']['id'] = 1;
}
- $serendipity['smarty_raw_mode'] = true; // Force output of Smarty stuff in the backend
- serendipity_smarty_init();
- $serendipity['smarty']->assign('is_preview', true);
+ if ($serendipity['use_iframe']) {
+ serendipity_iframe_create('preview', $entry);
+ } else {
+ serendipity_iframe($entry, 'preview');
+ }
+ }
- echo '<strong>' . PREVIEW . '</strong>';
- echo '<div style="border:1px solid #000000; padding: 15px;">';
- serendipity_printEntries(array($entry), ($entry['extended'] != '' ? 1 : 0), true);
- echo '</div>';
+ // serendipity_updertEntry sets this global variable to store the entry id. Couldn't pass this
+ // by reference or as return value because it affects too many places inside our API and dependant
+ // function calls.
+ if (!empty($serendipity['lastSavedEntry'])) {
+ $entry['id'] = $serendipity['lastSavedEntry'];
+ }
- serendipity_printEntryForm(
- '?',
- array(
- 'serendipity[action]' => 'admin',
- 'serendipity[adminModule]' => 'entries',
- 'serendipity[adminAction]' => 'save',
- 'serendipity[timestamp]' => $entry['timestamp']
- ),
+ serendipity_printEntryForm(
+ '?',
+ array(
+ 'serendipity[action]' => 'admin',
+ 'serendipity[adminModule]' => 'entries',
+ 'serendipity[adminAction]' => 'save',
+ 'serendipity[timestamp]' => $entry['timestamp']
+ ),
+
+ $entry
+ );
- $entry
- );
- }
break;
case 'editSelect':
|