From: Carsten K. <car...@us...> - 2002-01-08 00:12:29
|
Update of /cvsroot/phpwiki/phpwiki/lib In directory usw-pr-cvs1:/tmp/cvs-serv18422 Modified Files: savepage.php Log Message: Changed ConcurrentUpdates--it works ok, but not sure if I like this though. Please try it out, is it too confusing? Moved the Thank You... message into lib/Toolbar.php. I'm thinking these kind of static (non-clickable) messages should be moved out of lib/Toolbar.php into a page all their own. New template token ${THANK_YOU} for post-edit messages (for lack of a better name). The thank you or other messages can now easily be repositioned anywhere on the html template. Minor text reflowing. Index: savepage.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/savepage.php,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -r1.22 -r1.23 *** savepage.php 2002/01/07 21:09:11 1.22 --- savepage.php 2002/01/08 00:12:26 1.23 *************** *** 11,17 **** */ - // FIXME: some links so that it's easy to get back to someplace useful from these - // error pages. function ConcurrentUpdates($pagename) { /* xgettext only knows about c/c++ line-continuation strings --- 11,26 ---- */ + // Changed ConcurrentUpdates--it works ok, but not sure if I like this + // though. Please try it out, is it too confusing? + // + // Moved the Thank You... message into lib/Toolbar.php. I'm thinking + // these kind of static (non-clickable) messages should be moved out + // of lib/Toolbar.php into a page all their own. --Carsten + + + // FIXME: some links so that it's easy to get back to someplace useful + // from these error pages. + function ConcurrentUpdates($pagename) { /* xgettext only knows about c/c++ line-continuation strings *************** *** 20,23 **** --- 29,33 ---- */ $html = "<p>"; + $html .= "<h1>" .sprintf (_("Problem while updating %s"), $pagename) ."</h1>"; $html .= _("PhpWiki is unable to save your changes, because another user edited and saved the page while you were editing the page too. If saving proceeded now changes from the previous author would be lost."); $html .= "</p>\n<p>"; *************** *** 36,42 **** $html .= QElement('p', _("Sorry for the inconvenience.")); ! echo GeneratePage('MESSAGE', $html, ! sprintf (_("Problem while updating %s"), $pagename)); ! ExitWiki(); } --- 46,50 ---- $html .= QElement('p', _("Sorry for the inconvenience.")); ! return $html; } *************** *** 79,83 **** foreach (array('minor_edit', 'convert') as $key) $formvars[$key] = $request->getArg($key) ? 'checked' : ''; ! foreach (array('content', 'editversion', 'summary', 'pagename', 'version') as $key) @$formvars[$key] = htmlspecialchars($request->getArg($key)); --- 87,92 ---- foreach (array('minor_edit', 'convert') as $key) $formvars[$key] = $request->getArg($key) ? 'checked' : ''; ! foreach (array('content', 'editversion', 'summary', 'pagename', ! 'version') as $key) @$formvars[$key] = htmlspecialchars($request->getArg($key)); *************** *** 139,184 **** $content, $meta, ExtractWikiPageLinks($content)); if (!is_object($newrevision)) { // Save failed. ! ConcurrentUpdates($pagename); ! } ! ! // Clean out archived versions of this page. ! $cleaner = new ArchiveCleaner($GLOBALS['ExpireParams']); ! $cleaner->cleanPageRevisions($page); ! ! $warnings = $dbi->GenericWarnings(); ! global $SignatureImg; ! if (empty($warnings)) { ! if (empty($SignatureImg)){ ! // Do redirect to browse page if no signature has been defined. ! // In this case, the user will most likely not see the rest of ! // the HTML we generate (below). ! $request->redirect(WikiURL($pagename, false, 'absolute_url')); } } - $html = sprintf(_("Thank you for editing %s."), - LinkExistingWikiWord($pagename)); - $html .= "<br>\n"; - $html .= _("Your careful attention to detail is much appreciated."); - $html .= "\n"; - - if ($warnings) { - $html .= Element('p', QElement('strong',_("Warning!")) ." " - . htmlspecialchars($warnings) - . QElement('br') ."\n"); - } - - if (!empty($SignatureImg)) { - $html .= Element('p', - QElement('img', array('alt' => $SignatureImg, - 'src' => DataURL($SignatureImg)))); - } - - $html .= QElement('hr', array('noshade' => 'noshade')); - $html .= do_transform($newrevision->getContent()); - echo GeneratePage('BROWSE', $html, $pagename, $newrevision); } --- 148,186 ---- $content, $meta, ExtractWikiPageLinks($content)); + + // This should be refactored to avoid a global, for now it allows + // the actual messages to be moved away from this page. $thankyou is + // required in the GeneratePage() function. + global $thankyou; + if (!is_object($newrevision)) { // Save failed. ! $thankyou = ConcurrentUpdates($pagename); ! $thankyou .= "<hr noshade=\"noshade\" />"; ! $html = do_transform($current->getContent()); ! echo GeneratePage('BROWSE', $html, $pagename, $current); ! ! } else { ! ! // Clean out archived versions of this page. ! $cleaner = new ArchiveCleaner($GLOBALS['ExpireParams']); ! $cleaner->cleanPageRevisions($page); ! ! $warnings = $dbi->GenericWarnings(); ! global $SignatureImg; ! if (empty($warnings)) { ! if (empty($SignatureImg)){ ! // Do redirect to browse page if no signature has been defined. ! // In this case, the user will most likely not see the rest of ! // the HTML we generate (below). ! $request->redirect(WikiURL($pagename, false, 'absolute_url')); ! } } + $thankyou = toolbar_Info_ThankYou($pagename, $warnings); + $html = do_transform($newrevision->getContent()); + echo GeneratePage('BROWSE', $html, $pagename, $newrevision); } } |