Permalink
Browse files

Made it possible to delete drafts

  • Loading branch information...
1 parent 8a210aa commit d7d0dcd3c2215ae3b569fcf8725b3bdfd4b5d93f @tijsverkoyen tijsverkoyen committed May 1, 2012
View
@@ -1,3 +1,10 @@
+3.3.7 (xxxx-xx-xx)
+--
+Bugfixes:
+
+* Pages: made it possible to delete drafts.
+
+
3.3.6 (2012-05-01)
--
Improvements:
@@ -34,14 +34,17 @@ public function execute()
// cannot have children
if(BackendPagesModel::getFirstChildId($this->id) !== false) $this->redirect(BackendModel::createURLForAction('edit') . '&error=non-existing');
+ $revisionId = $this->getParameter('revision_id', 'int');
+ if($revisionId == 0) $revisionId = null;
+
// get page (we need the title)
- $page = BackendPagesModel::get($this->id);
+ $page = BackendPagesModel::get($this->id, $revisionId);
// valid page?
if(!empty($page))
{
// delete the page
- $success = BackendPagesModel::delete($this->id);
+ $success = BackendPagesModel::delete($this->id, null, $revisionId);
// trigger event
BackendModel::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id));
@@ -460,7 +460,7 @@ public static function createHtml($type = 'page', $depth = 0, $parentId = 1, $ht
* @param string[optional] $language The language wherin the page will be deleted, if not provided we will use the working language.
* @return bool
*/
- public static function delete($id, $language = null)
+ public static function delete($id, $language = null, $revisionId = null)
{
// redefine
$id = (int) $id;
@@ -470,7 +470,7 @@ public static function delete($id, $language = null)
$db = BackendModel::getDB(true);
// get record
- $page = self::get($id, null, $language);
+ $page = self::get($id, $revisionId, $language);
// validate
if(empty($page)) return false;
@@ -399,7 +399,7 @@
<div class="fullwidthOptions">
{option:showPagesDelete}
- <a href="{$var|geturl:'delete'}&amp;id={$item.id}" data-message-id="confirmDelete" class="askConfirmation button linkButton icon iconDelete">
+ <a href="{$var|geturl:'delete'}&amp;id={$item.id}&revision_id={$item.revision_id}" data-message-id="confirmDelete" class="askConfirmation button linkButton icon iconDelete">
<span>{$lblDelete|ucfirst}</span>
</a>
<div id="confirmDelete" title="{$lblDelete|ucfirst}?" style="display: none;">

0 comments on commit d7d0dcd

Please sign in to comment.