From c9911e2216e49097b9f4f5af44d8fcbb10362708 Mon Sep 17 00:00:00 2001 From: Cindy Li Date: Mon, 23 Aug 2010 19:33:35 +0000 Subject: [PATCH] fix the bug that once the a content is deleted from the lesson via "delete content" icon, the page is still viewing the deleted content which caused the error. --- docs/home/classes/ContentManager.class.php | 8 ++++++++ docs/home/classes/ContentUtility.class.php | 2 +- docs/home/editor/delete_content.php | 3 --- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/home/classes/ContentManager.class.php b/docs/home/classes/ContentManager.class.php index f98e828..ca9a9b1 100644 --- a/docs/home/classes/ContentManager.class.php +++ b/docs/home/classes/ContentManager.class.php @@ -370,6 +370,14 @@ class ContentManager $sql = "UPDATE ".TABLE_PREFIX."content SET ordering=ordering-1 WHERE ordering>=$ordering AND content_parent_id=$content_parent_id AND course_id=$_course_id"; $this->contentDAO->execute($sql); + // unset last-visited content id + require_once(TR_INCLUDE_PATH.'classes/DAO/UserCoursesDAO.class.php'); + $userCoursesDAO = new UserCoursesDAO(); + $userCoursesDAO->UpdateLastCid($_SESSION['user_id'], $_course_id, 0); + + unset($_SESSION['s_cid']); + unset($_SESSION['from_cid']); + /* delete this content page */ // $sql = "DELETE FROM ".TABLE_PREFIX."content WHERE content_id=$content_id AND course_id=$_SESSION[course_id]"; // $result = mysql_query($sql, $this->db); diff --git a/docs/home/classes/ContentUtility.class.php b/docs/home/classes/ContentUtility.class.php index 7e7f24c..da3f986 100644 --- a/docs/home/classes/ContentUtility.class.php +++ b/docs/home/classes/ContentUtility.class.php @@ -618,7 +618,7 @@ class ContentUtility { 'home/editor/edit_content.php?pid='.$contentManager->_menu_info[$content_row['content_id']]['content_parent_id'].SEP.'_course_id='.$_course_id, 'icon' => $_base_href . 'images/add_sibling_page.gif'); - if ($content_row['content_type'] == CONTENT_TYPE_CONTENT) { + if ($content_row['content_type'] == CONTENT_TYPE_CONTENT || $content_row['content_type'] == CONTENT_TYPE_WEBLINK) { $tool_shortcuts[] = array( 'title' => _AT('delete_this_page'), 'url' => $_base_href . 'home/editor/delete_content.php?_cid='.$content_row['content_id'], diff --git a/docs/home/editor/delete_content.php b/docs/home/editor/delete_content.php index fbeb899..170db2d 100644 --- a/docs/home/editor/delete_content.php +++ b/docs/home/editor/delete_content.php @@ -25,9 +25,6 @@ if (isset($_POST['submit_yes'])) { $result = $contentManager->deleteContent($cid); - unset($_SESSION['s_cid']); - unset($_SESSION['from_cid']); - $msg->addFeedback('CONTENT_DELETED'); header('Location: '.TR_BASE_HREF.'home/course/index.php?_course_id='.$_course_id); exit; -- 2.17.1