fix the bug that once the a content is deleted from the lesson via "delete content...
authorCindy Li <cli@ocad.ca>
Mon, 23 Aug 2010 19:33:35 +0000 (19:33 -0000)
committerCindy Li <cli@ocad.ca>
Mon, 23 Aug 2010 19:33:35 +0000 (19:33 -0000)
docs/home/classes/ContentManager.class.php
docs/home/classes/ContentUtility.class.php
docs/home/editor/delete_content.php

index f98e828..ca9a9b1 100644 (file)
@@ -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);
index 7e7f24c..da3f986 100644 (file)
@@ -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,\r
                          'icon' => $_base_href . 'images/add_sibling_page.gif');\r
                        \r
-                       if ($content_row['content_type'] == CONTENT_TYPE_CONTENT) {\r
+                       if ($content_row['content_type'] == CONTENT_TYPE_CONTENT || $content_row['content_type'] == CONTENT_TYPE_WEBLINK) {\r
                                $tool_shortcuts[] = array(\r
                                  'title' => _AT('delete_this_page'),   \r
                                  'url' => $_base_href . 'home/editor/delete_content.php?_cid='.$content_row['content_id'],\r
index fbeb899..170db2d 100644 (file)
@@ -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;