From: <sy...@us...> - 2008-04-04 20:49:38
|
Revision: 12364 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=12364&view=rev Author: sylvieg Date: 2008-04-04 13:49:42 -0700 (Fri, 04 Apr 2008) Log Message: ----------- [FIX]approval: fix the creation of a new page that is stagged + no link to approved page if none + fix the history in the case of deleted staging at approval + approval step display the attachmnets to allow to delete them Modified Paths: -------------- branches/1.10/lib/wiki/wikilib.php branches/1.10/templates/attachments.tpl branches/1.10/templates/tiki-approve_staging_page.tpl branches/1.10/templates/tiki-editpage.tpl branches/1.10/templates/tiki-page_bar.tpl branches/1.10/templates/tiki-show_page.tpl branches/1.10/tiki-editpage.php Modified: branches/1.10/lib/wiki/wikilib.php =================================================================== --- branches/1.10/lib/wiki/wikilib.php 2008-04-04 20:45:04 UTC (rev 12363) +++ branches/1.10/lib/wiki/wikilib.php 2008-04-04 20:49:42 UTC (rev 12364) @@ -602,7 +602,8 @@ if ($tiki_p_admin == 'y' || $tiki_p_admin_wiki == 'y') return true; else { - if ($prefs['feature_wiki_userpage'] == 'y' and strcasecmp(substr($page, 0, strlen($prefs['feature_wiki_userpage_prefix'])), $prefs['feature_wiki_userpage_prefix']) == 0 and strcasecmp($page, $prefs['feature_wiki_userpage_prefix'].$user) != 0) + if ($prefs['feature_wiki_userpage'] == 'y' and strcasecmp(substr($page, 0, strlen($prefs['feature_wiki_userpage_prefix'])), $pr +efs['feature_wiki_userpage_prefix']) == 0 and strcasecmp($page, $prefs['feature_wiki_userpage_prefix'].$user) != 0) return false; if (!$this->user_has_perm_on_object($user,$page,'wiki page','tiki_p_edit')) return false; @@ -750,6 +751,14 @@ return 'tiki-index.php?page='.urlencode($page); } } + function move_attachments($old, $new) { + $query = 'update `tiki_wiki_attachments` set `page`=? where `page`=?'; + $this->query($query, array($new, $old)); + } + function duplicate_page($old, $new) { + $query = 'insert into `tiki_pages` (`pageName`,`hits`,`data`,`lastModif`,`comment`,`version`,`user`,`ip`,`description`,`creator`,`page_size`,`is_html`,`created`, `flag`,`points`,`votes`,`pageRank`,`lang`,`lockedby`) select ?,`hits`,`data`,`lastModif`,`comment`,`version`,`user`,`ip`,`description`,`creator`,`page_size`,`is_html`,`created`, `flag`,`points`,`votes`,`pageRank`,`lang`,`lockedby` from `tiki_pages` where `pageName`=?'; + $this->query($query, array($new, $old)); + } } Modified: branches/1.10/templates/attachments.tpl =================================================================== --- branches/1.10/templates/attachments.tpl 2008-04-04 20:45:04 UTC (rev 12363) +++ branches/1.10/templates/attachments.tpl 2008-04-04 20:49:42 UTC (rev 12364) @@ -45,10 +45,10 @@ {$atts[ix].filename|iconify} <a class="tablename" href="tiki-download_wiki_attachment.php?attId={$atts[ix].attId}&page={$page|escape:"url"}">{$atts[ix].filename}</a> </td><td class="{cycle advance=false}"> - <a title="{tr}View{/tr}" href="tiki-download_wiki_attachment.php?attId={$atts[ix].attId}">{icon _id='monitor' alt="{tr}View{/tr}"}</a> + <a title="{tr}View{/tr}" href="tiki-download_wiki_attachment.php?attId={$atts[ix].attId}" target="_blank">{icon _id='monitor' alt="{tr}View{/tr}"}</a> <a title="{tr}Download{/tr}" href="tiki-download_wiki_attachment.php?attId={$atts[ix].attId}&download=y">{icon _id='disk' alt="{tr}Download{/tr}"}</a> {if $tiki_p_wiki_admin_attachments eq 'y' or ($user and ($atts[ix].user eq $user))} - <a title="{tr}Delete{/tr}" class="link" href="tiki-index.php?page={$page|escape:"url"}&removeattach={$atts[ix].attId}&offset={$offset}&sort_mode={$sort_mode}">{icon _id='cross' alt='{tr}Remove{/tr}'}</a> + <a title="{tr}Delete{/tr}" class="link" href="tiki-index.php?page={$page|escape:"url"}&removeattach={$atts[ix].attId}&offset={$offset}{if !empty($sort_mode)}&sort_mode={$sort_mode}{/if}"{if !empty($target)} target="{$target}"{/if}>{icon _id='cross' alt='{tr}Remove{/tr}'}</a> {/if} </td> <td class="{cycle advance=false}"><small>{$atts[ix].comment}</small></td> @@ -62,7 +62,7 @@ {* It is allow to attach files or current user have admin rights *} -{if $tiki_p_wiki_attach_files eq 'y' or $tiki_p_wiki_admin_attachments eq 'y'} +{if ($tiki_p_wiki_attach_files eq 'y' or $tiki_p_wiki_admin_attachments eq 'y') and $attach_box ne 'n'} <form enctype="multipart/form-data" action="tiki-index.php?page={$page|escape:"url"}" method="post"> {if $page_ref_id}<input type="hidden" name="page_ref_id" value="{$page_ref_id}" />{/if} <table class="normal"> Modified: branches/1.10/templates/tiki-approve_staging_page.tpl =================================================================== --- branches/1.10/templates/tiki-approve_staging_page.tpl 2008-04-04 20:45:04 UTC (rev 12363) +++ branches/1.10/templates/tiki-approve_staging_page.tpl 2008-04-04 20:49:42 UTC (rev 12364) @@ -1,9 +1,32 @@ <h1>{tr}Approve page changes in staging{/tr}</a>: <a class="pagetitle" href="tiki-index.php?page={$page|escape:"url"}">{$page}</a></h1> +<div class="navbar"><a href="tiki-index.php?page={$page|escape:url}" class="linkbut" title="{tr}View{/tr}">{tr}View page{/tr}</a></div> + +<div class="box highlight">{tr}Page has been approved{/tr}</div> + +{if $staging_atts|count >= 1 || $atts|count >=1} +{if count($staging_atts) >= 1} + <h2>{tr}New attachments{/tr}</h2> + {include file="attachments.tpl" atts=$staging_atts target='_blank' attach_box="n"} +{/if} +{if count($atts) >= 1} + <h2>{tr}Old attachments{/tr}</h2> + {include file="attachments.tpl" atts=$atts target='_blank' attach_box="n"} +{/if} +{/if} + +<h2>{tr}History{/tr}</h2> {tr}Changes from the following versions under staging have been merged into the approved version{/tr} - +<br /> {cycle values="odd,even" print=false} <table> <tr> +<th class="heading">{tr}Date{/tr}</th> +<th class="heading">{tr}User{/tr}</th> +<th class="heading">{tr}IP{/tr}</th> +<th class="heading">{tr}Comment{/tr}</th> +<th class="heading">{tr}Version{/tr}</th> +<th class="heading">{tr}Action{/tr}</th> +</tr><tr> <td class="{cycle advance=false}">{$staging_info.lastModif|tiki_short_datetime}</td> {if $tiki_p_wiki_view_author ne 'n'}<td class="{cycle advance=false}">{$staging_info.user}</td>{/if} {if $prefs.feature_wiki_history_ip ne 'n'}<td class="{cycle advance=false}">{$staging_info.ip}</td>{/if} Modified: branches/1.10/templates/tiki-editpage.tpl =================================================================== --- branches/1.10/templates/tiki-editpage.tpl 2008-04-04 20:45:04 UTC (rev 12363) +++ branches/1.10/templates/tiki-editpage.tpl 2008-04-04 20:49:42 UTC (rev 12364) @@ -65,7 +65,11 @@ {if $beingStaged eq 'y'} <div class="tocnav"> -{tr}You are editing the staging copy of the approved version of this page. Changes will be merged in after approval.{/tr} +{if $approvedPageExists} + {tr}You are editing the staging copy of the approved version of this page. Changes will be merged in after approval.{/tr} +{else} + {tr}This is a new staging page that has not been approved before.{/tr} +{/if} {if $outOfSync eq 'y'} {tr}The current staging copy may contain changes that have yet to be approved.{/tr}{/if} {if $lastSyncVersion} <a class="link" href="tiki-pagehistory.php?page={$page|escape:'url'}&diff2={$lastSyncVersion}" target="_blank">{tr}View changes since last approval.{/tr}</a> @@ -386,7 +390,7 @@ <input type="hidden" name="page2" value="{$page}" /> <input name="userfile2" type="file" id="attach-upload" /> {tr}Comment{/tr}:<input type="text" name="attach_comment" maxlength="250" id="attach-comment" /> -<input type="submit" class="wikiaction" name="attach" value="{tr}attach{/tr}" onclick="javascript:insertImgFile('editwiki','userfile2','hasAlreadyInserted2','file', 'page2', 'attach_comment'); return true;" /> +<input type="submit" class="wikiaction" name="attach" value="{tr}attach{/tr}" onclick="javascript:needToConfirm=false;insertImgFile('editwiki','userfile2','hasAlreadyInserted2','file', 'page2', 'attach_comment'); return true;" /> </td></tr> {/if} {/if} Modified: branches/1.10/templates/tiki-page_bar.tpl =================================================================== --- branches/1.10/templates/tiki-page_bar.tpl 2008-04-04 20:45:04 UTC (rev 12363) +++ branches/1.10/templates/tiki-page_bar.tpl 2008-04-04 20:49:42 UTC (rev 12364) @@ -1,5 +1,4 @@ {* $Id$ *} - {strip} <hr/> @@ -78,7 +77,7 @@ {if $prefs.feature_wiki_export eq 'y' and $tiki_p_admin_wiki eq 'y'} <span class="button2"><a href="tiki-export_wiki_pages.php?page={$page|escape:"url"}" class="linkbut">{tr}Export{/tr}</a></span> {/if} -{if $prefs.feature_wiki_discuss eq 'y'} +{if $prefs.feature_wiki_discuss eq 'y' && $show_page eq 'y' && $beingStaged ne 'y'} <span class="button2"><a href="tiki-view_forum.php?forumId={$prefs.wiki_forum_id}&comments_postComment=post&comments_title={$page|escape:"url"}&comments_data={$wiki_discussion_string|escape:"url"}: {"[tiki-index.php?page="}{$page|escape:"url"}{"|"}{$page|escape:"url"}{"]"}&comment_topictype=n" class="linkbut">{tr}Discuss{/tr}</a></span> {/if} Modified: branches/1.10/templates/tiki-show_page.tpl =================================================================== --- branches/1.10/templates/tiki-show_page.tpl 2008-04-04 20:45:04 UTC (rev 12363) +++ branches/1.10/templates/tiki-show_page.tpl 2008-04-04 20:49:42 UTC (rev 12364) @@ -10,13 +10,17 @@ {if $beingStaged eq 'y'} <div class="tocnav"> -{tr}This is the staging copy of{/tr} <a class="link" href="tiki-index.php?page={$approvedPageName|escape:'url'}">{tr}the approved version of this page.{/tr}</a> +{if $approvedPageExists} + {tr}This is the staging copy of{/tr} <a class="link" href="tiki-index.php?page={$approvedPageName|escape:'url'}">{tr}the approved version of this page.{/tr}</a> +{else} + {tr}This is a new staging page that has not been approved before.{/tr} +{/if} {if $outOfSync eq 'y'} {if $canApproveStaging == 'y'} {if $lastSyncVersion}<a class="link" href="tiki-pagehistory.php?page={$page|escape:'url'}&diff2={$lastSyncVersion}">{tr}View changes since last approval.{/tr}</a> {else}{tr}Viewing of changes since last approval is possible only after first approval.{/tr}{/if} <a class="link" href="tiki-approve_staging_page.php?page={$page|escape:'url'}">{tr}Approve changes.{/tr}</a> - {else} + {elseif $approvedPageExists} {tr}Latest changes will be synchronized after approval.{/tr} {/if} {/if} Modified: branches/1.10/tiki-editpage.php =================================================================== --- branches/1.10/tiki-editpage.php 2008-04-04 20:45:04 UTC (rev 12363) +++ branches/1.10/tiki-editpage.php 2008-04-04 20:49:42 UTC (rev 12364) @@ -243,7 +243,7 @@ } } $tikilib->update_page($pagename, $part["body"], tra('page imported'), $author, $authorid, $description, null, $pageLang, false, $hash); - } else { + } else { $tikilib->create_page($pagename, $hits, $part["body"], $lastmodified, tra('created from import'), $author, $authorid, $description, $pageLang, false, $hash); } @@ -852,8 +852,16 @@ $edit = $imagegallib->capture_images($edit); // apply the optional page edit filters before data storage $edit = $tikilib->apply_postedit_handlers($edit); + $exist = $tikilib->page_exists($_REQUEST['page']); + if (!$exist && $prefs['feature_wikiapproval'] == 'y' && $prefs['wikiapproval_delete_staging'] == 'y' && substr($_REQUEST['page'], 0, strlen($prefs['wikiapproval_prefix'])) == $prefs['wikiapproval_prefix']) { //needs to create the first history = initial page for history + $approvedPageName = substr($_REQUEST['page'], strlen($prefs['wikiapproval_prefix'])); + if ($tikilib->page_exists($approvedPageName)) { + $wikilib->duplicate_page($approvedPageName, $_REQUEST['page']); + $exist = true; + } + } // If page exists - if(!$tikilib->page_exists($_REQUEST["page"])) { + if(!$exist) { // Extract links and update the page $links = $tikilib->get_links($_REQUEST["edit"]); /* @@ -1131,6 +1139,8 @@ $approvedPageName = substr($page, strlen($prefs['wikiapproval_prefix'])); $smarty->assign('beingStaged', 'y'); $smarty->assign('approvedPageName', $approvedPageName); + $approvedPageExists = $tikilib->page_exists($approvedPageName); + $smarty->assign('approvedPageExists', $approvedPageExists); } elseif ($prefs['wikiapproval_approved_category'] > 0 && in_array($prefs['wikiapproval_approved_category'], $cats)) { $stagingPageName = $prefs['wikiapproval_prefix'] . $page; if ($prefs['wikiapproval_block_editapproved'] == 'y') { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |