# HG changeset patch # User Dan # Date 1195014794 18000 # Node ID 6d9655e02026f1a3934804235dd59834d83d8db8 # Parent 850e1b1209a9fcf6ac1967eecb6f970c1e7c397b Removed all dragger debugging info and started on the form for forum/category deletion diff -r 850e1b1209a9 -r 6d9655e02026 decir/admincp/admin_forums.php --- a/decir/admincp/admin_forums.php Tue Nov 13 22:30:19 2007 -0500 +++ b/decir/admincp/admin_forums.php Tue Nov 13 23:33:14 2007 -0500 @@ -116,6 +116,95 @@ $form->category_list = $cats; echo $form->html(); break; + case 'delete': + case 'delete_finish': + if ( !isset($parms['fid']) || ( isset($parms['fid']) && !is_int($parms['fid']) ) ) + { + echo '
Invalid forum ID passed to editor.
'; + break; + } + + // $fid is safe (validated as an integer). + $fid =& $parms['fid']; + $q = $db->sql_query('SELECT forum_id, forum_name, forum_type FROM ' . table_prefix . 'decir_forums WHERE forum_id = ' . $fid . ';'); + if ( !$q ) + $db->_die('Decir admin_forums.php selecting forum data for deletion'); + + $row = $db->fetchrow(); + $db->free_result(); + + if ( $row['forum_type'] == FORUM_FORUM ) + { + // Provide the option of moving the posts in this forum to another forum + $q = $db->sql_query('SELECT forum_id, forum_name FROM ' . table_prefix . "decir_forums WHERE forum_id != {$row['forum_id']} AND forum_type = " . FORUM_FORUM . ';'); + if ( !$q ) + $db->_die('Decir admin_forums.php selecting list of possible forums to move topics to'); + $opt_move = ''; + if ( $db->numrows() > 0 ) + { + $opt_move .= '


+

"; + } + } + else if ( $row['forum_type'] == FORUM_CATEGORY ) + { + // Provide the option of moving the posts in this forum to another forum + $q = $db->sql_query('SELECT forum_id, forum_name FROM ' . table_prefix . "decir_forums WHERE forum_id != {$row['forum_id']} AND forum_type = " . FORUM_CATEGORY . ';'); + if ( !$q ) + $db->_die('Decir admin_forums.php selecting list of possible categories to move forums to'); + $opt_move = ''; + if ( $db->numrows() > 0 ) + { + $opt_move .= '


+

"; + } + } + else + { + break; + } + + $forcat = ( $row['forum_type'] == FORUM_FORUM ) ? 'forum' : 'category'; + echo '
+ + + + + + + + + + +
Deleting ' . $forcat . '
+
+

You are about to obliterate the '. $forcat .' "' . htmlspecialchars($row['forum_name']) . '".
+ You can either preserve its contents or delete them. Beware that if you are deleting a
+ ' . $forcat . ' with a large number of posts in it, this process may take some time.

+
+
+

+ ' . $opt_move . ' +
+
+ + +
+
'; + + $show_main_menu = false; + + break; case 'edit': case 'edit_finish': @@ -328,7 +417,7 @@ echo ' '; $order = /* implode(',', $order_cats) . ';' . */ implode(',', $order_forums); - echo ''; + echo ''; echo ""; } } diff -r 850e1b1209a9 -r 6d9655e02026 decir/js/admin/reorder.js --- a/decir/js/admin/reorder.js Tue Nov 13 22:30:19 2007 -0500 +++ b/decir/js/admin/reorder.js Tue Nov 13 23:33:14 2007 -0500 @@ -17,12 +17,7 @@ if ( $dynano(this).hasClass('decir_forum') ) { reorder_state.type = 'forum'; - } - else if ( $dynano(this).hasClass('decir_category') ) - { - alert(this.parentNode.DecirForumID); - document.getElementById('forum_cat_' + this.parentNode.DecirForumID).lastChild.lastChild.style.borderBottom = '5px solid #000000'; - reorder_state.type = 'category'; + this.style.borderBottom = '5px solid #000000'; } document.onmousemove = decir_admin_dragforum_onmouse;