Index: branches/2.8.x/CHANGELOG
===================================================================
--- branches/2.8.x/CHANGELOG	(revision 1830)
+++ branches/2.8.x/CHANGELOG	(revision 1831)
@@ -13,6 +13,8 @@
 
 
 
+05 Dez-2012 Build 1831 Dietmar Woellbrink (Luisehahne)
+# fixed dragdrop for pages overview
 22 Nov-2012 Build 1830 Dietmar Woellbrink (Luisehahne)
 # deactivate caching in backend to fix display faults
 22 Nov-2012 Build 1829 Dietmar Woellbrink (Luisehahne)
Index: branches/2.8.x/wb/admin/pages/index.php
===================================================================
--- branches/2.8.x/wb/admin/pages/index.php	(revision 1830)
+++ branches/2.8.x/wb/admin/pages/index.php	(revision 1831)
@@ -65,6 +65,8 @@
     $sql .= (PAGE_TRASH != 'inline') ?  'AND `visibility` != \'deleted\' ' : ' ';
     $sql .= 'ORDER BY `position` ASC';
 	$get_pages = $database->query($sql);
+	// Work out how many pages there are for this parent
+	$num_pages = $get_pages->numRows();
 
 	// Insert values into main page list
 	if($get_pages->numRows() > 0)
@@ -71,6 +73,8 @@
 	{
 		while($page = $get_pages->fetchRow())
 		{
+
+			$row   = $row ? 0 : 1;
 			// Get user perms
 			$admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
 			$admin_users = explode(',', str_replace('_', '', $page['admin_users']));
@@ -129,39 +133,11 @@
 			} else {
 				$display_plus = false;
 			}
-			// Work out how many pages there are for this parent
-			$num_pages = $get_pages->numRows();
 
-
-			$row   = $row ? 0 : 1;
-
-/*
-// look and set vars  for first run
-			$iOldLevel = !isset($iOldLevel) ? $page['level'] : $iOldLevel;
-			$iOldLevel = $iOldLevel < $page['level'] ? $iOldLevel : $page['level'];
-// look for new sub
-			if(!isset($aRowLevel[$page['level']]))
-			{
-				$row = !$row ? 0 : $aRowLevel[$iOldLevel];
-				$aRowLevel[$page['level']] = $row ? $row : 0;
-				$iOldLevel = $page['level'];
-// look level before
-			} elseif($iLevel!=$iOldLevel) {
-				$aRowLevel[$page['level']] = $aRowLevel[$iOldLevel] ? $aRowLevel[$iOldLevel] : $row ;
-				$iOldLevel = $page['level'];
-// normal change
-			} else {
-				$aRowLevel[$page['level']] = $aRowLevel[$iLevel] ? $aRowLevel[$iLevel] : $row ;
-				$iLevel = $page['level'];
-			}
-// set and save level
-			$aRowLevel[$page['level']] = $aRowLevel[$page['level']] ? 0 : 1;
-// final set $row
-			$row = $aRowLevel[$page['level']];
-*/
 			 ?>
 			<li class="p<?php echo $page['parent'];  ?>">
-			<table summary="<?php echo $TEXT['EXPAND'].'/'.$TEXT['COLLAPSE'];  ?>" class="pages_view" cellpadding="0" cellspacing="0">
+			<table class="pages_view">
+            <tbody>
 			<tr class="row_<?php echo $row  ?>">
 				<td valign="middle" width="20" style="padding-left: <?php echo $page['level']==0 ? 0 : ($page['level']*25)-pow($page['level'],2);  ?>px;">
 					<?php
@@ -321,7 +297,11 @@
 				<?php
 				// end [IC] jeggers 2009/10/14: Add action to add a page as a child
 				 ?>
+				<td class="list_page_id center">
+					<?php echo $page['language'];  ?>
+				</td>
 			</tr>
+            </tbody>
 			</table>
 			<?php
 			if ( $page['parent'] == 0)
@@ -343,7 +323,8 @@
 if($admin->get_permission('pages_view') == true) {
 	 ?>
 	<div class="jsadmin hide"></div>
-	<table summary="<?php echo $HEADING['MODIFY_DELETE_PAGE'];  ?>" cellpadding="0" cellspacing="0" width="100%">
+	<table>
+    <tbody>
 	<tr>
 		<td>
 			<h2 class="left"><?php echo $HEADING['MODIFY_DELETE_PAGE'];  ?></h2>
@@ -350,9 +331,11 @@
 		</td>
 		<td align="right"></td>
 	</tr>
+    </tbody>
 	</table>
 	<div class="pages_list">
-	<table summary="<?php echo $HEADING['MODIFY_DELETE_PAGE'];  ?>" cellpadding="0" cellspacing="0">
+	<table>
+    <tbody>
 	<tr class="pages_list_header">
 		<td class="header_list_menu_title">
 			<?php echo $TEXT['VISIBILITY'] .' / ' .$TEXT['MENU_TITLE'];  ?>:
@@ -366,7 +349,11 @@
 		<td class="header_list_actions">
 			<?php echo $TEXT['ACTIONS'];  ?>:
 		</td>
+		<td class="list_page_id">
+		
+		</td>
 	</tr>
+    </tbody>
 	</table>
 	<?php
 	// Work-out if we should check for existing page_code
Index: branches/2.8.x/wb/admin/interface/version.php
===================================================================
--- branches/2.8.x/wb/admin/interface/version.php	(revision 1830)
+++ branches/2.8.x/wb/admin/interface/version.php	(revision 1831)
@@ -51,5 +51,5 @@
 
 // check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
 if(!defined('VERSION')) define('VERSION', '2.8.3');
-if(!defined('REVISION')) define('REVISION', '1830');
+if(!defined('REVISION')) define('REVISION', '1831');
 if(!defined('SP')) define('SP', '');
Index: branches/2.8.x/wb/templates/wb_theme/css/screen.css
===================================================================
--- branches/2.8.x/wb/templates/wb_theme/css/screen.css	(revision 1830)
+++ branches/2.8.x/wb/templates/wb_theme/css/screen.css	(revision 1831)
@@ -7,7 +7,7 @@
 .td { clear :both; font-size :1.0em; margin :0 auto; text-align :center; width :100%; }
 div.main .table { background :url(../images/bgtitle.png) #ffffff repeat-x; margin :0 auto; overflow :auto; width :100%; }
 .wrapper { position :relative; display :block; overflow :auto; width :inherit; }
-.content { padding :10px; text-align :left; overflow :hidden; }
+.content { padding :15px; text-align :left; overflow :hidden; }
 img { border :none; }
 .input_small { width :20px; }
 .input_narrow { width :100px; }
Index: branches/2.8.x/wb/modules/jsadmin/jsadmin_backend_include.php
===================================================================
--- branches/2.8.x/wb/modules/jsadmin/jsadmin_backend_include.php	(revision 1830)
+++ branches/2.8.x/wb/modules/jsadmin/jsadmin_backend_include.php	(revision 1831)
@@ -3,8 +3,9 @@
  *
  * @category        modules
  * @package         JsAdmin
- * @author          WebsiteBaker Project, modified by Swen Uth for Website Baker 2.7
- * @copyright       2009-2011, Website Baker Org. e.V.
+ * @package         JsAdmin
+ * @author          Ryan Djurovich (2004-2009), WebsiteBaker Project
+ * @copyright       2009-2012, WebsiteBaker Org. e.V.
  * @link			http://www.websitebaker2.org/
  * @license         http://www.gnu.org/licenses/gpl.html
  * @platform        WebsiteBaker 2.8.x
@@ -15,10 +16,14 @@
  *
 */
 
+/* -------------------------------------------------------- */
+// Must include code to stop this file being accessed directly
+if(!defined('WB_URL')) {
+	require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
+	throw new IllegalFileException();
+}
+/* -------------------------------------------------------- */
 
-// Must include code to stop this file being access directly
-if(defined('WB_PATH') == false) { die("Cannot access this file directly"); }
-
 // obtain the admin folder (e.g. /admin)
 $admin_folder = str_replace(WB_PATH, '', ADMIN_PATH);
 
@@ -26,7 +31,7 @@
 $YUI_PATH = WB_URL.'/include/yui';
 $script = $_SERVER['SCRIPT_NAME'];
 
-if(strstr($script, $admin_folder."/pages/index.php"))
+if(strstr($script, $admin_folder."/pages/index.php")) 
 	$page_type = 'pages';
 elseif(strstr($script, $admin_folder."/pages/sections.php"))
 	$page_type = 'sections';
@@ -44,6 +49,7 @@
 
 	// Default scripts
 	$js_buttonCell = 5;
+	$js_pagesCell = 7;
 	$js_scripts = Array();
 	$js_scripts[] = 'jsadmin.js';
 
@@ -53,7 +59,7 @@
   		}
 		if(get_setting('mod_jsadmin_ajax_order_pages', '1')) {
 			$js_scripts[] = 'dragdrop.js';
-			$js_buttonCell= 7; // This ist the Cell where the Button "Up" is , by Swen Uth
+			$js_buttonCell= $js_pagesCell; // This ist the Cell where the Button "Up" is , by Swen Uth
 		}
 	} elseif($page_type == 'pages') {
 		if(!get_setting('mod_jsadmin_persist_order', '1')) {   //Maybe Bug settings to negativ for persist , by Swen Uth
@@ -61,7 +67,7 @@
   		}
 		if(get_setting('mod_jsadmin_ajax_order_pages', '1')) {
 			$js_scripts[] = 'dragdrop.js';
-			$js_buttonCell= 7; // This ist the Cell where the Button "Up" is , by Swen Uth
+			$js_buttonCell= $js_pagesCell; // This ist the Cell where the Button "Up" is , by Swen Uth
 		}
 	} elseif($page_type == 'sections') {
 		if(get_setting('mod_jsadmin_ajax_order_sections', '1')) {
@@ -75,6 +81,7 @@
 	} else {
 		$admin->print_error('PageTtype '.$TEXT['ERROR'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
 	}
+
 ?>
 <script  type="text/javascript">
 <!--
@@ -110,9 +117,4 @@
 	    echo "<script type='text/javascript'>alert('YUI ERROR!! File not Found!! > \\n".$YUI_PUT_MISSING_Files." so look in the include folder or switch Javascript Admin off!');</script>\n"; //, by Swen Uth
 	}
 
-} else {
-/*
-print '<pre><strong>function '.__FUNCTION__.'();</strong> line: '.__LINE__.' -> ';
-print_r( $page_type.'/'.$buttonCell ); print '</pre>'; // die();
-*/
-}
+} 
Index: branches/2.8.x/wb/modules/jsadmin/move_to.php
===================================================================
--- branches/2.8.x/wb/modules/jsadmin/move_to.php	(revision 1830)
+++ branches/2.8.x/wb/modules/jsadmin/move_to.php	(revision 1831)
@@ -4,8 +4,7 @@
  * @category        modules
  * @package         JsAdmin
  * @author          WebsiteBaker Project, modified by Swen Uth for Website Baker 2.7
- * @copyright       (C) 2006, Stepan Riha
- * @copyright       2009-2011, Website Baker Org. e.V.
+ * @copyright       (C) 2006, Stepan Riha,2009-2012, WebsiteBaker Org. e.V. 
  * @link			http://www.websitebaker2.org/
  * @license         http://www.gnu.org/licenses/gpl.html
  * @platform        WebsiteBaker 2.8.x
@@ -14,49 +13,72 @@
  * @filesource		$HeadURL$
  * @lastmodified    $Date$
  *
-*/
+ */
 
-require('../../config.php');
+// Include config file
+if(!defined('WB_URL'))
+{
+    $config_file = realpath('../../config.php');
+    if(file_exists($config_file) && !defined('WB_URL'))
+    {
+    	require($config_file);
+    }
+}
 
+if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
+$admin = new  admin('##skip##');
 if(isset($_GET['page_id']) AND is_numeric($_GET['page_id']) AND is_numeric(@$_GET['position'])) {
 	$position = (int)$_GET['position'];
+	$bModified = true;
+    $bDebug = false;
+//  Include WB admin wrapper script
+//	$update_when_modified = true;
+//  Tells script to update when this page was last updated
+//	require(WB_PATH.'/modules/admin.php');
 
-	// Include WB admin wrapper script
-	$update_when_modified = true;
-	// Tells script to update when this page was last updated
-	require(WB_PATH.'/modules/admin.php');
+    if( isset($_GET['file_id']) || (isset($_GET['group_id'])) ) {
+    	if(isset($_GET['group_id']) && is_numeric($_GET['group_id'])) {
+    		$id = (int)$_GET['group_id'];
+    		$id_field = 'group_id';
+    		$table = TABLE_PREFIX.'mod_download_gallery_groups';
+    		$common_field = 'section_id';
+    	} else {
+    		$id = (int)$_GET['file_id'];
+    		$id_field = 'file_id';
+    		$table = TABLE_PREFIX.'mod_download_gallery_files';
+    		$common_field = 'group_id';
+    	}
+    } elseif( isset($_GET['page_id']) || (isset($_GET['section_id'])) ) {
+    	// Get common fields
+    	if(isset($_GET['section_id']) && is_numeric($_GET['section_id'])) {
+    		$page_id = (int)$_GET['page_id'];
+    		$id = (int)$_GET['section_id'];
+    		$id_field = 'section_id';
+    		$common_field = 'page_id';
+    		$table = TABLE_PREFIX.'sections';
+    	} else {
+    		$id = (int)$_GET['page_id'];
+    		$id_field = 'page_id';
+    		$common_field = 'parent';
+    		$table = TABLE_PREFIX.'pages';
+    	}
+    }
 
-if( isset($_GET['file_id']) || (isset($_GET['group_id'])) ) {
-	if(isset($_GET['group_id']) && is_numeric($_GET['group_id'])) {
-		$id = (int)$_GET['group_id'];
-		$id_field = 'group_id';
-		$table = TABLE_PREFIX.'mod_download_gallery_groups';
-		$common_field = 'section_id';
-	} else {
-		$id = (int)$_GET['file_id'];
-		$id_field = 'file_id';
-		$table = TABLE_PREFIX.'mod_download_gallery_files';
-		$common_field = 'group_id';
-	}
-} elseif( isset($_GET['page_id']) || (isset($_GET['section_id'])) ) {
-	// Get common fields
-	if(isset($_GET['section_id']) && is_numeric($_GET['section_id'])) {
-		$page_id = (int)$_GET['page_id'];
-		$id = (int)$_GET['section_id'];
-		$id_field = 'section_id';
-		$common_field = 'page_id';
-		$table = TABLE_PREFIX.'sections';
-	} else {
-		$id = (int)$_GET['page_id'];
-		$id_field = 'page_id';
-		$common_field = 'parent';
-		$table = TABLE_PREFIX.'pages';
-	}
-}
+    $iPageId = intval($_GET['page_id']);
+	// Get current index
+    $sql = 'SELECT `'.$common_field.'`,`position`,`page_id` FROM `'.$table.'` WHERE `'.$id_field.'` ='.(int)$id; //.' AND page_id='.$iPageId;
+    if($oRes=$database->query($sql)) {
+        if($aPage = $oRes->fetchRow(MYSQL_ASSOC)){
+    		$common_id = intval($aPage[$common_field]);
+    		$old_position = intval($aPage['position']);
+    		$iPageId = intval($aPage['page_id']);
+        }
+    }
 
+/* 
 	// Get current index
 	$sql = <<<EOT
-SELECT $common_field, position FROM $table WHERE $id_field = $id
+SELECT `$common_field`, `position` FROM `$table` WHERE `$id_field` = $id
 EOT;
 	echo "$sql<br>";
 	$rs = $database->query($sql);
@@ -67,30 +89,34 @@
 	echo "$old_position<br>";
 	if($old_position == $position)
 		return;
-	
+*/
+// all echos with <pre> coded for looking in firebug console
+$sSqlModify =  ($bModified == true) ? ',`modified_when` = '.time().',`modified_by` = '.$admin->get_user_id().' ' : '';
+if($old_position != $position) {
+	echo $output = ($bDebug == false) ? "\n" : "<pre>$sql</pre>\n";
 	// Build query to update affected rows
 	if($old_position < $position)
 		$sql = <<<EOT
-UPDATE $table SET position = position - 1
-	WHERE position > $old_position AND position <= $position
-		AND $common_field = $common_id
+UPDATE `$table` SET `position` = `position` - 1
+	WHERE `position` > $old_position AND `position` <= $position
+		AND `$common_field` = $common_id
 EOT;
 	else
 		$sql = <<<EOT
-UPDATE $table SET position = position + 1
-	WHERE position >= $position AND position < $old_position
-		AND $common_field = $common_id
+UPDATE `$table` SET `position` = `position` + 1
+	WHERE `position` >= $position AND `position` < $old_position
+		AND `$common_field` = $common_id
 EOT;
-	echo "<pre>$sql</pre>";
+	echo $output = ($bDebug == false) ? "\n" : "<pre>$sql</pre>\n";
 	$database->query($sql);
-
 	// Build query to update specified row
 	$sql = <<<EOT
-UPDATE $table SET position = $position
-	WHERE $id_field = $id
+UPDATE `$table` SET `position` = $position$sSqlModify
+	WHERE `$id_field` = $id
 EOT;
-	echo "<pre>$sql</pre>";
+	echo $output = ($bDebug == false) ? "\n" : "<pre>$sql</pre>\n";
 	$database->query($sql);
+}
 } else {
 	die("Missing parameters");
 	header("Location: index.php");
Index: branches/2.8.x/wb/modules/jsadmin/tool.php
===================================================================
--- branches/2.8.x/wb/modules/jsadmin/tool.php	(revision 1830)
+++ branches/2.8.x/wb/modules/jsadmin/tool.php	(revision 1831)
@@ -3,8 +3,8 @@
  *
  * @category        modules
  * @package         JsAdmin
- * @author          WebsiteBaker Project, modified by Swen Uth for Website Baker 2.7
- * @copyright       2009-2011, Website Baker Org. e.V.
+ * @author          Ryan Djurovich (2004-2009), WebsiteBaker Project
+ * @copyright       2009-2012, WebsiteBaker Org. e.V.
  * @link			http://www.websitebaker2.org/
  * @license         http://www.gnu.org/licenses/gpl.html
  * @platform        WebsiteBaker 2.8.x
@@ -15,12 +15,11 @@
  *
 */
 
-// prevent this file from being accessed directly
 /* -------------------------------------------------------- */
-if(defined('WB_PATH') == false)
-{
-	// Stop this file being access directly
-	die('<head><title>Access denied</title></head><body><h2 style="color:red;margin:3em auto;text-align:center;">Cannot access this file directly</h2></body></html>');
+// Must include code to stop this file being accessed directly
+if(!defined('WB_URL')) {
+	require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
+	throw new IllegalFileException();
 }
 /* -------------------------------------------------------- */
 
@@ -63,7 +62,7 @@
 		$admin->print_error($database->get_error(), $js_back);
 	} else {
 
-		$admin->print_success($MESSAGE['PAGES']['SAVED'], ADMIN_URL.'/admintools/tool.php?tool=jsadmin');
+		$admin->print_success($MESSAGE['PAGES_SAVED'], ADMIN_URL.'/admintools/tool.php?tool=jsadmin');
 	}
 
 } else {
@@ -101,28 +100,30 @@
 <div  id="jsadmin_form"></div>
    <form name="store_settings" style="margin-top: 1em; display: true;" action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
 	<?php echo $admin->getFTAN(); ?>
-   <table class="jsadmin_drag_area" summary="" cellpadding="4" cellspacing="0" border="0">
+   <table class="jsadmin_drag_area">
+<tbody>
    <tr>
 	     <td colspan="2"><?php echo $MOD_JSADMIN['TXT_HEADING_B']; ?>:</td>
    </tr>
    <tr>
-	     <td width="20"><input type="checkbox" name="persist_order" id="persist_order" value="true" <?php echo $persist_order; ?>/></td>
+	     <td style="width: 20px;"><input type="checkbox" name="persist_order" id="persist_order" value="true" <?php echo $persist_order; ?>/></td>
 	     <td><label for="persist_order"><?php echo $MOD_JSADMIN['TXT_PERSIST_ORDER_B']; ?></label></td>
    </tr>
    <tr>
-	     <td width="20"><input type="checkbox" name="ajax_order_pages" id="ajax_order_pages" value="true" <?php echo $ajax_order_pages; ?>/></td>
+	     <td  style="width: 20px;"><input type="checkbox" name="ajax_order_pages" id="ajax_order_pages" value="true" <?php echo $ajax_order_pages; ?>/></td>
 	     <td><label for="ajax_order_pages"><?php echo $MOD_JSADMIN['TXT_AJAX_ORDER_PAGES_B']; ?></label></td>
    </tr>
    <tr>
-	     <td width="20"><input type="checkbox" name="ajax_order_sections" id="ajax_order_sections" value="true" <?php echo $ajax_order_sections; ?>/></td>
+	     <td style="width: 20px;"><input type="checkbox" name="ajax_order_sections" id="ajax_order_sections" value="true" <?php echo $ajax_order_sections; ?>/></td>
 	     <td><label for="ajax_order_sections"><?php echo $MOD_JSADMIN['TXT_AJAX_ORDER_SECTIONS_B']; ?></label></td>
    </tr>
    <tr>
-	     <td>&nbsp;</td>
+	     <td style="width: 20px;">&nbsp;</td>
 	     <td>
 		   <input type="submit" name="save_settings" value="<?php echo $TEXT['SAVE']; ?>" />
 	    </td>
    </tr>
+</tbody>
    </table>
    </form>
  <?php
Index: branches/2.8.x/wb/modules/jsadmin/backend.css
===================================================================
--- branches/2.8.x/wb/modules/jsadmin/backend.css	(revision 1830)
+++ branches/2.8.x/wb/modules/jsadmin/backend.css	(revision 1831)
@@ -2,18 +2,26 @@
 .pages_list li {
 	margin-bottom: -2px;
 }
-
-body.jsadmin_busy td.content {
-	background: url(images/busy.gif) 4px 4px no-repeat;
+table.jsadmin_drag_area {
+    table-layout: auto;
 }
+table.jsadmin_drag_area tr {
+    line-height: 2em;
+}
 
-body.jsadmin_success td.content {
-	background: url(images/success.gif) 4px 4px no-repeat;
+body.jsadmin_busy td.content,
+body.jsadmin_busy div.td div.content {
+	background: url(images/busy.gif) 14px 8px no-repeat;
 }
 
-body.jsadmin_failure td.content {
-	background: url(images/failure.gif) 4px 4px no-repeat;
+body.jsadmin_success td.content,
+body.jsadmin_success div.td div.content {
+	background: url(images/success.gif) 14px 8px no-repeat;
 }
+body.jsadmin_failure td.content,
+body.jsadmin_failure div.td div.content {
+	background: url(images/failure.gif) 14px 8px no-repeat;
+}
 
 .jsadmin_drag {
 	cursor: move;
