Project

General

Profile

« Previous | Next » 

Revision 1831

Added by Dietmar almost 12 years ago

  1. fixed dragdrop for pages overview

View differences:

branches/2.8.x/CHANGELOG
13 13

  
14 14

  
15 15

  
16
05 Dez-2012 Build 1831 Dietmar Woellbrink (Luisehahne)
17
# fixed dragdrop for pages overview
16 18
22 Nov-2012 Build 1830 Dietmar Woellbrink (Luisehahne)
17 19
# deactivate caching in backend to fix display faults
18 20
22 Nov-2012 Build 1829 Dietmar Woellbrink (Luisehahne)
branches/2.8.x/wb/admin/pages/index.php
65 65
    $sql .= (PAGE_TRASH != 'inline') ?  'AND `visibility` != \'deleted\' ' : ' ';
66 66
    $sql .= 'ORDER BY `position` ASC';
67 67
	$get_pages = $database->query($sql);
68
	// Work out how many pages there are for this parent
69
	$num_pages = $get_pages->numRows();
68 70

  
69 71
	// Insert values into main page list
70 72
	if($get_pages->numRows() > 0)
71 73
	{
72 74
		while($page = $get_pages->fetchRow())
73 75
		{
76

  
77
			$row   = $row ? 0 : 1;
74 78
			// Get user perms
75 79
			$admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
76 80
			$admin_users = explode(',', str_replace('_', '', $page['admin_users']));
......
129 133
			} else {
130 134
				$display_plus = false;
131 135
			}
132
			// Work out how many pages there are for this parent
133
			$num_pages = $get_pages->numRows();
134 136

  
135

  
136
			$row   = $row ? 0 : 1;
137

  
138
/*
139
// look and set vars  for first run
140
			$iOldLevel = !isset($iOldLevel) ? $page['level'] : $iOldLevel;
141
			$iOldLevel = $iOldLevel < $page['level'] ? $iOldLevel : $page['level'];
142
// look for new sub
143
			if(!isset($aRowLevel[$page['level']]))
144
			{
145
				$row = !$row ? 0 : $aRowLevel[$iOldLevel];
146
				$aRowLevel[$page['level']] = $row ? $row : 0;
147
				$iOldLevel = $page['level'];
148
// look level before
149
			} elseif($iLevel!=$iOldLevel) {
150
				$aRowLevel[$page['level']] = $aRowLevel[$iOldLevel] ? $aRowLevel[$iOldLevel] : $row ;
151
				$iOldLevel = $page['level'];
152
// normal change
153
			} else {
154
				$aRowLevel[$page['level']] = $aRowLevel[$iLevel] ? $aRowLevel[$iLevel] : $row ;
155
				$iLevel = $page['level'];
156
			}
157
// set and save level
158
			$aRowLevel[$page['level']] = $aRowLevel[$page['level']] ? 0 : 1;
159
// final set $row
160
			$row = $aRowLevel[$page['level']];
161
*/
162 137
			 ?>
163 138
			<li class="p<?php echo $page['parent'];  ?>">
164
			<table summary="<?php echo $TEXT['EXPAND'].'/'.$TEXT['COLLAPSE'];  ?>" class="pages_view" cellpadding="0" cellspacing="0">
139
			<table class="pages_view">
140
            <tbody>
165 141
			<tr class="row_<?php echo $row  ?>">
166 142
				<td valign="middle" width="20" style="padding-left: <?php echo $page['level']==0 ? 0 : ($page['level']*25)-pow($page['level'],2);  ?>px;">
167 143
					<?php
......
321 297
				<?php
322 298
				// end [IC] jeggers 2009/10/14: Add action to add a page as a child
323 299
				 ?>
300
				<td class="list_page_id center">
301
					<?php echo $page['language'];  ?>
302
				</td>
324 303
			</tr>
304
            </tbody>
325 305
			</table>
326 306
			<?php
327 307
			if ( $page['parent'] == 0)
......
343 323
if($admin->get_permission('pages_view') == true) {
344 324
	 ?>
345 325
	<div class="jsadmin hide"></div>
346
	<table summary="<?php echo $HEADING['MODIFY_DELETE_PAGE'];  ?>" cellpadding="0" cellspacing="0" width="100%">
326
	<table>
327
    <tbody>
347 328
	<tr>
348 329
		<td>
349 330
			<h2 class="left"><?php echo $HEADING['MODIFY_DELETE_PAGE'];  ?></h2>
350 331
		</td>
351 332
		<td align="right"></td>
352 333
	</tr>
334
    </tbody>
353 335
	</table>
354 336
	<div class="pages_list">
355
	<table summary="<?php echo $HEADING['MODIFY_DELETE_PAGE'];  ?>" cellpadding="0" cellspacing="0">
337
	<table>
338
    <tbody>
356 339
	<tr class="pages_list_header">
357 340
		<td class="header_list_menu_title">
358 341
			<?php echo $TEXT['VISIBILITY'] .' / ' .$TEXT['MENU_TITLE'];  ?>:
......
366 349
		<td class="header_list_actions">
367 350
			<?php echo $TEXT['ACTIONS'];  ?>:
368 351
		</td>
352
		<td class="list_page_id">
353
		
354
		</td>
369 355
	</tr>
356
    </tbody>
370 357
	</table>
371 358
	<?php
372 359
	// Work-out if we should check for existing page_code
branches/2.8.x/wb/admin/interface/version.php
51 51

  
52 52
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
53 53
if(!defined('VERSION')) define('VERSION', '2.8.3');
54
if(!defined('REVISION')) define('REVISION', '1830');
54
if(!defined('REVISION')) define('REVISION', '1831');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/templates/wb_theme/css/screen.css
7 7
.td { clear :both; font-size :1.0em; margin :0 auto; text-align :center; width :100%; }
8 8
div.main .table { background :url(../images/bgtitle.png) #ffffff repeat-x; margin :0 auto; overflow :auto; width :100%; }
9 9
.wrapper { position :relative; display :block; overflow :auto; width :inherit; }
10
.content { padding :10px; text-align :left; overflow :hidden; }
10
.content { padding :15px; text-align :left; overflow :hidden; }
11 11
img { border :none; }
12 12
.input_small { width :20px; }
13 13
.input_narrow { width :100px; }
branches/2.8.x/wb/modules/jsadmin/jsadmin_backend_include.php
3 3
 *
4 4
 * @category        modules
5 5
 * @package         JsAdmin
6
 * @author          WebsiteBaker Project, modified by Swen Uth for Website Baker 2.7
7
 * @copyright       2009-2011, Website Baker Org. e.V.
6
 * @package         JsAdmin
7
 * @author          Ryan Djurovich (2004-2009), WebsiteBaker Project
8
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
8 9
 * @link			http://www.websitebaker2.org/
9 10
 * @license         http://www.gnu.org/licenses/gpl.html
10 11
 * @platform        WebsiteBaker 2.8.x
......
15 16
 *
16 17
*/
17 18

  
19
/* -------------------------------------------------------- */
20
// Must include code to stop this file being accessed directly
21
if(!defined('WB_URL')) {
22
	require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
23
	throw new IllegalFileException();
24
}
25
/* -------------------------------------------------------- */
18 26

  
19
// Must include code to stop this file being access directly
20
if(defined('WB_PATH') == false) { die("Cannot access this file directly"); }
21

  
22 27
// obtain the admin folder (e.g. /admin)
23 28
$admin_folder = str_replace(WB_PATH, '', ADMIN_PATH);
24 29

  
......
26 31
$YUI_PATH = WB_URL.'/include/yui';
27 32
$script = $_SERVER['SCRIPT_NAME'];
28 33

  
29
if(strstr($script, $admin_folder."/pages/index.php"))
34
if(strstr($script, $admin_folder."/pages/index.php")) 
30 35
	$page_type = 'pages';
31 36
elseif(strstr($script, $admin_folder."/pages/sections.php"))
32 37
	$page_type = 'sections';
......
44 49

  
45 50
	// Default scripts
46 51
	$js_buttonCell = 5;
52
	$js_pagesCell = 7;
47 53
	$js_scripts = Array();
48 54
	$js_scripts[] = 'jsadmin.js';
49 55

  
......
53 59
  		}
54 60
		if(get_setting('mod_jsadmin_ajax_order_pages', '1')) {
55 61
			$js_scripts[] = 'dragdrop.js';
56
			$js_buttonCell= 7; // This ist the Cell where the Button "Up" is , by Swen Uth
62
			$js_buttonCell= $js_pagesCell; // This ist the Cell where the Button "Up" is , by Swen Uth
57 63
		}
58 64
	} elseif($page_type == 'pages') {
59 65
		if(!get_setting('mod_jsadmin_persist_order', '1')) {   //Maybe Bug settings to negativ for persist , by Swen Uth
......
61 67
  		}
62 68
		if(get_setting('mod_jsadmin_ajax_order_pages', '1')) {
63 69
			$js_scripts[] = 'dragdrop.js';
64
			$js_buttonCell= 7; // This ist the Cell where the Button "Up" is , by Swen Uth
70
			$js_buttonCell= $js_pagesCell; // This ist the Cell where the Button "Up" is , by Swen Uth
65 71
		}
66 72
	} elseif($page_type == 'sections') {
67 73
		if(get_setting('mod_jsadmin_ajax_order_sections', '1')) {
......
75 81
	} else {
76 82
		$admin->print_error('PageTtype '.$TEXT['ERROR'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
77 83
	}
84

  
78 85
?>
79 86
<script  type="text/javascript">
80 87
<!--
......
110 117
	    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
111 118
	}
112 119

  
113
} else {
114
/*
115
print '<pre><strong>function '.__FUNCTION__.'();</strong> line: '.__LINE__.' -> ';
116
print_r( $page_type.'/'.$buttonCell ); print '</pre>'; // die();
117
*/
118
}
120
} 
branches/2.8.x/wb/modules/jsadmin/move_to.php
4 4
 * @category        modules
5 5
 * @package         JsAdmin
6 6
 * @author          WebsiteBaker Project, modified by Swen Uth for Website Baker 2.7
7
 * @copyright       (C) 2006, Stepan Riha
8
 * @copyright       2009-2011, Website Baker Org. e.V.
7
 * @copyright       (C) 2006, Stepan Riha,2009-2012, WebsiteBaker Org. e.V. 
9 8
 * @link			http://www.websitebaker2.org/
10 9
 * @license         http://www.gnu.org/licenses/gpl.html
11 10
 * @platform        WebsiteBaker 2.8.x
......
14 13
 * @filesource		$HeadURL$
15 14
 * @lastmodified    $Date$
16 15
 *
17
*/
16
 */
18 17

  
19
require('../../config.php');
18
// Include config file
19
if(!defined('WB_URL'))
20
{
21
    $config_file = realpath('../../config.php');
22
    if(file_exists($config_file) && !defined('WB_URL'))
23
    {
24
    	require($config_file);
25
    }
26
}
20 27

  
28
if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
29
$admin = new  admin('##skip##');
21 30
if(isset($_GET['page_id']) AND is_numeric($_GET['page_id']) AND is_numeric(@$_GET['position'])) {
22 31
	$position = (int)$_GET['position'];
32
	$bModified = true;
33
    $bDebug = false;
34
//  Include WB admin wrapper script
35
//	$update_when_modified = true;
36
//  Tells script to update when this page was last updated
37
//	require(WB_PATH.'/modules/admin.php');
23 38

  
24
	// Include WB admin wrapper script
25
	$update_when_modified = true;
26
	// Tells script to update when this page was last updated
27
	require(WB_PATH.'/modules/admin.php');
39
    if( isset($_GET['file_id']) || (isset($_GET['group_id'])) ) {
40
    	if(isset($_GET['group_id']) && is_numeric($_GET['group_id'])) {
41
    		$id = (int)$_GET['group_id'];
42
    		$id_field = 'group_id';
43
    		$table = TABLE_PREFIX.'mod_download_gallery_groups';
44
    		$common_field = 'section_id';
45
    	} else {
46
    		$id = (int)$_GET['file_id'];
47
    		$id_field = 'file_id';
48
    		$table = TABLE_PREFIX.'mod_download_gallery_files';
49
    		$common_field = 'group_id';
50
    	}
51
    } elseif( isset($_GET['page_id']) || (isset($_GET['section_id'])) ) {
52
    	// Get common fields
53
    	if(isset($_GET['section_id']) && is_numeric($_GET['section_id'])) {
54
    		$page_id = (int)$_GET['page_id'];
55
    		$id = (int)$_GET['section_id'];
56
    		$id_field = 'section_id';
57
    		$common_field = 'page_id';
58
    		$table = TABLE_PREFIX.'sections';
59
    	} else {
60
    		$id = (int)$_GET['page_id'];
61
    		$id_field = 'page_id';
62
    		$common_field = 'parent';
63
    		$table = TABLE_PREFIX.'pages';
64
    	}
65
    }
28 66

  
29
if( isset($_GET['file_id']) || (isset($_GET['group_id'])) ) {
30
	if(isset($_GET['group_id']) && is_numeric($_GET['group_id'])) {
31
		$id = (int)$_GET['group_id'];
32
		$id_field = 'group_id';
33
		$table = TABLE_PREFIX.'mod_download_gallery_groups';
34
		$common_field = 'section_id';
35
	} else {
36
		$id = (int)$_GET['file_id'];
37
		$id_field = 'file_id';
38
		$table = TABLE_PREFIX.'mod_download_gallery_files';
39
		$common_field = 'group_id';
40
	}
41
} elseif( isset($_GET['page_id']) || (isset($_GET['section_id'])) ) {
42
	// Get common fields
43
	if(isset($_GET['section_id']) && is_numeric($_GET['section_id'])) {
44
		$page_id = (int)$_GET['page_id'];
45
		$id = (int)$_GET['section_id'];
46
		$id_field = 'section_id';
47
		$common_field = 'page_id';
48
		$table = TABLE_PREFIX.'sections';
49
	} else {
50
		$id = (int)$_GET['page_id'];
51
		$id_field = 'page_id';
52
		$common_field = 'parent';
53
		$table = TABLE_PREFIX.'pages';
54
	}
55
}
67
    $iPageId = intval($_GET['page_id']);
68
	// Get current index
69
    $sql = 'SELECT `'.$common_field.'`,`position`,`page_id` FROM `'.$table.'` WHERE `'.$id_field.'` ='.(int)$id; //.' AND page_id='.$iPageId;
70
    if($oRes=$database->query($sql)) {
71
        if($aPage = $oRes->fetchRow(MYSQL_ASSOC)){
72
    		$common_id = intval($aPage[$common_field]);
73
    		$old_position = intval($aPage['position']);
74
    		$iPageId = intval($aPage['page_id']);
75
        }
76
    }
56 77

  
78
/* 
57 79
	// Get current index
58 80
	$sql = <<<EOT
59
SELECT $common_field, position FROM $table WHERE $id_field = $id
81
SELECT `$common_field`, `position` FROM `$table` WHERE `$id_field` = $id
60 82
EOT;
61 83
	echo "$sql<br>";
62 84
	$rs = $database->query($sql);
......
67 89
	echo "$old_position<br>";
68 90
	if($old_position == $position)
69 91
		return;
70
	
92
*/
93
// all echos with <pre> coded for looking in firebug console
94
$sSqlModify =  ($bModified == true) ? ',`modified_when` = '.time().',`modified_by` = '.$admin->get_user_id().' ' : '';
95
if($old_position != $position) {
96
	echo $output = ($bDebug == false) ? "\n" : "<pre>$sql</pre>\n";
71 97
	// Build query to update affected rows
72 98
	if($old_position < $position)
73 99
		$sql = <<<EOT
74
UPDATE $table SET position = position - 1
75
	WHERE position > $old_position AND position <= $position
76
		AND $common_field = $common_id
100
UPDATE `$table` SET `position` = `position` - 1
101
	WHERE `position` > $old_position AND `position` <= $position
102
		AND `$common_field` = $common_id
77 103
EOT;
78 104
	else
79 105
		$sql = <<<EOT
80
UPDATE $table SET position = position + 1
81
	WHERE position >= $position AND position < $old_position
82
		AND $common_field = $common_id
106
UPDATE `$table` SET `position` = `position` + 1
107
	WHERE `position` >= $position AND `position` < $old_position
108
		AND `$common_field` = $common_id
83 109
EOT;
84
	echo "<pre>$sql</pre>";
110
	echo $output = ($bDebug == false) ? "\n" : "<pre>$sql</pre>\n";
85 111
	$database->query($sql);
86

  
87 112
	// Build query to update specified row
88 113
	$sql = <<<EOT
89
UPDATE $table SET position = $position
90
	WHERE $id_field = $id
114
UPDATE `$table` SET `position` = $position$sSqlModify
115
	WHERE `$id_field` = $id
91 116
EOT;
92
	echo "<pre>$sql</pre>";
117
	echo $output = ($bDebug == false) ? "\n" : "<pre>$sql</pre>\n";
93 118
	$database->query($sql);
119
}
94 120
} else {
95 121
	die("Missing parameters");
96 122
	header("Location: index.php");
branches/2.8.x/wb/modules/jsadmin/tool.php
3 3
 *
4 4
 * @category        modules
5 5
 * @package         JsAdmin
6
 * @author          WebsiteBaker Project, modified by Swen Uth for Website Baker 2.7
7
 * @copyright       2009-2011, Website Baker Org. e.V.
6
 * @author          Ryan Djurovich (2004-2009), WebsiteBaker Project
7
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
8 8
 * @link			http://www.websitebaker2.org/
9 9
 * @license         http://www.gnu.org/licenses/gpl.html
10 10
 * @platform        WebsiteBaker 2.8.x
......
15 15
 *
16 16
*/
17 17

  
18
// prevent this file from being accessed directly
19 18
/* -------------------------------------------------------- */
20
if(defined('WB_PATH') == false)
21
{
22
	// Stop this file being access directly
23
	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>');
19
// Must include code to stop this file being accessed directly
20
if(!defined('WB_URL')) {
21
	require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
22
	throw new IllegalFileException();
24 23
}
25 24
/* -------------------------------------------------------- */
26 25

  
......
63 62
		$admin->print_error($database->get_error(), $js_back);
64 63
	} else {
65 64

  
66
		$admin->print_success($MESSAGE['PAGES']['SAVED'], ADMIN_URL.'/admintools/tool.php?tool=jsadmin');
65
		$admin->print_success($MESSAGE['PAGES_SAVED'], ADMIN_URL.'/admintools/tool.php?tool=jsadmin');
67 66
	}
68 67

  
69 68
} else {
......
101 100
<div  id="jsadmin_form"></div>
102 101
   <form name="store_settings" style="margin-top: 1em; display: true;" action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
103 102
	<?php echo $admin->getFTAN(); ?>
104
   <table class="jsadmin_drag_area" summary="" cellpadding="4" cellspacing="0" border="0">
103
   <table class="jsadmin_drag_area">
104
<tbody>
105 105
   <tr>
106 106
	     <td colspan="2"><?php echo $MOD_JSADMIN['TXT_HEADING_B']; ?>:</td>
107 107
   </tr>
108 108
   <tr>
109
	     <td width="20"><input type="checkbox" name="persist_order" id="persist_order" value="true" <?php echo $persist_order; ?>/></td>
109
	     <td style="width: 20px;"><input type="checkbox" name="persist_order" id="persist_order" value="true" <?php echo $persist_order; ?>/></td>
110 110
	     <td><label for="persist_order"><?php echo $MOD_JSADMIN['TXT_PERSIST_ORDER_B']; ?></label></td>
111 111
   </tr>
112 112
   <tr>
113
	     <td width="20"><input type="checkbox" name="ajax_order_pages" id="ajax_order_pages" value="true" <?php echo $ajax_order_pages; ?>/></td>
113
	     <td  style="width: 20px;"><input type="checkbox" name="ajax_order_pages" id="ajax_order_pages" value="true" <?php echo $ajax_order_pages; ?>/></td>
114 114
	     <td><label for="ajax_order_pages"><?php echo $MOD_JSADMIN['TXT_AJAX_ORDER_PAGES_B']; ?></label></td>
115 115
   </tr>
116 116
   <tr>
117
	     <td width="20"><input type="checkbox" name="ajax_order_sections" id="ajax_order_sections" value="true" <?php echo $ajax_order_sections; ?>/></td>
117
	     <td style="width: 20px;"><input type="checkbox" name="ajax_order_sections" id="ajax_order_sections" value="true" <?php echo $ajax_order_sections; ?>/></td>
118 118
	     <td><label for="ajax_order_sections"><?php echo $MOD_JSADMIN['TXT_AJAX_ORDER_SECTIONS_B']; ?></label></td>
119 119
   </tr>
120 120
   <tr>
121
	     <td>&nbsp;</td>
121
	     <td style="width: 20px;">&nbsp;</td>
122 122
	     <td>
123 123
		   <input type="submit" name="save_settings" value="<?php echo $TEXT['SAVE']; ?>" />
124 124
	    </td>
125 125
   </tr>
126
</tbody>
126 127
   </table>
127 128
   </form>
128 129
 <?php
branches/2.8.x/wb/modules/jsadmin/backend.css
2 2
.pages_list li {
3 3
	margin-bottom: -2px;
4 4
}
5

  
6
body.jsadmin_busy td.content {
7
	background: url(images/busy.gif) 4px 4px no-repeat;
5
table.jsadmin_drag_area {
6
    table-layout: auto;
8 7
}
8
table.jsadmin_drag_area tr {
9
    line-height: 2em;
10
}
9 11

  
10
body.jsadmin_success td.content {
11
	background: url(images/success.gif) 4px 4px no-repeat;
12
body.jsadmin_busy td.content,
13
body.jsadmin_busy div.td div.content {
14
	background: url(images/busy.gif) 14px 8px no-repeat;
12 15
}
13 16

  
14
body.jsadmin_failure td.content {
15
	background: url(images/failure.gif) 4px 4px no-repeat;
17
body.jsadmin_success td.content,
18
body.jsadmin_success div.td div.content {
19
	background: url(images/success.gif) 14px 8px no-repeat;
16 20
}
21
body.jsadmin_failure td.content,
22
body.jsadmin_failure div.td div.content {
23
	background: url(images/failure.gif) 14px 8px no-repeat;
24
}
17 25

  
18 26
.jsadmin_drag {
19 27
	cursor: move;

Also available in: Unified diff