Project

General

Profile

« Previous | Next » 

Revision 1222

Added by Dietmar almost 15 years ago

change page_title to menu_title in dropdown list
validate code

View differences:

branches/2.8.x/CHANGELOG
11 11
! = Update/Change
12 12

  
13 13
------------------------------------- 2.8.1 -------------------------------------
14
28-Dec-2009 Dietmar Woellbrink (Luisehahne)
15
!	change page_title to menu_title in dropdown list
16
!	validate code
14 17
23-Dec-2009 Dietmar Woellbrink (Luisehahne)
15 18
!	check if revision $id will be updated
16 19
21-Dec-2009 Moritz Stapelfeldt
branches/2.8.x/wb/modules/menu_link/save.php
1
<?php
2

  
3
// $Id$
4

  
5
/*
6

  
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2009, Ryan Djurovich
9

  
10
 Website Baker is free software; you can redistribute it and/or modify
11
 it under the terms of the GNU General Public License as published by
12
 the Free Software Foundation; either version 2 of the License, or
13
 (at your option) any later version.
14

  
15
 Website Baker is distributed in the hope that it will be useful,
16
 but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 GNU General Public License for more details.
19

  
20
 You should have received a copy of the GNU General Public License
21
 along with Website Baker; if not, write to the Free Software
22
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23

  
24
*/
25

  
26
require_once('../../config.php');
27

  
28
// Include WB admin wrapper script
29
$update_when_modified = true; // Tells script to update when this page was last updated
30
require(WB_PATH.'/modules/admin.php');
31

  
32
// Update id, anchor and target
33
if(isset($_POST['page_link'])) {
34
	$foreign_page_id = $admin->add_slashes($_POST['page_link']);
35
	$page_target = $admin->add_slashes($_POST['page_target']);
36
	$url_target = $admin->add_slashes($_POST['target']);
37
	$r_type = $admin->add_slashes($_POST['r_type']);
38
	if(isset($_POST['extern']))
39
		$extern = $admin->add_slashes($_POST['extern']);
40
	else
41
		$extern='';
42

  
43
	$table_pages = TABLE_PREFIX.'pages';
44
	$table_mod = TABLE_PREFIX.'mod_menu_link';
45
	$database->query("UPDATE `$table_pages` SET `target` = '$url_target' WHERE `page_id` = '$page_id'");
46
	$database->query("UPDATE `$table_mod` SET `target_page_id` = '$foreign_page_id', `anchor` = '$page_target', `extern` = '$extern', `redirect_type` = '$r_type' WHERE `page_id` = '$page_id'");
47
}
48

  
49
// Check if there is a database error, otherwise say successful
50
if($database->is_error()) {
51
	$admin->print_error($database->get_error(), $js_back);
52
} else {
53
	$admin->print_success($MESSAGE['PAGES']['SAVED'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
54
}
55

  
56
// Print admin footer
57
$admin->print_footer();
58

  
1
<?php
2
/***************************************************************************
3
* SVN Version information:
4
*
5
* $Id$
6
*
7
*****************************************************************************
8
*
9
*                          WebsiteBaker
10
*
11
* WebsiteBaker Project <http://www.websitebaker2.org/>
12
* Copyright (C) 2009, Website Baker Org. e.V.
13
*         http://start.websitebaker2.org/impressum-datenschutz.php
14
* Copyright (C) 2004-2009, Ryan Djurovich
15
*
16
*                        About WebsiteBaker
17
*
18
* Website Baker is a PHP-based Content Management System (CMS)
19
* designed with one goal in mind: to enable its users to produce websites
20
* with ease.
21
*
22
*****************************************************************************
23
*
24
*****************************************************************************
25
*                        LICENSE INFORMATION
26
*
27
* WebsiteBaker is free software; you can redistribute it and/or
28
* modify it under the terms of the GNU General Public License
29
* as published by the Free Software Foundation; either version 2
30
* of the License, or (at your option) any later version.
31
*
32
* WebsiteBaker is distributed in the hope that it will be useful,
33
* but WITHOUT ANY WARRANTY; without even the implied warranty of
34
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
35
* See the GNU General Public License for more details.
36
*
37
* You should have received a copy of the GNU General Public License
38
* along with this program; if not, write to the Free Software
39
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
40
****************************************************************************
41
*
42
*****************************************************************************
43
*                   WebsiteBaker Extra Information
44
*
45
*
46
*
47
*
48
*****************************************************************************/
49

  
50
/**
51
 *
52
 * @category     modules
53
 * @package      menu_link
54
 * @author       Ryan Djurovich
55
 * @copyright    2004-2009, Ryan Djurovich
56
 * @copyright    2009, Website Baker Org. e.V.
57
 * @version      $Id$
58
 * @platform     WebsiteBaker 2.8.x
59
 * @requirements >= PHP 4.3.4
60
 * @license      http://www.gnu.org/licenses/gpl.html
61
 *
62
 *
63
 */
64

  
65
require_once('../../config.php');
66

  
67
// Include WB admin wrapper script
68
$update_when_modified = true; // Tells script to update when this page was last updated
69
require(WB_PATH.'/modules/admin.php');
70

  
71
// Update id, anchor and target
72
if(isset($_POST['menu_link'])) {
73
	$foreign_page_id = $admin->add_slashes($_POST['menu_link']);
74
	$page_target = $admin->add_slashes($_POST['page_target']);
75
	$url_target = $admin->add_slashes($_POST['target']);
76
	$r_type = $admin->add_slashes($_POST['r_type']);
77
	if(isset($_POST['extern']))
78
		$extern = $admin->add_slashes($_POST['extern']);
79
	else
80
		$extern='';
81

  
82
	$table_pages = TABLE_PREFIX.'pages';
83
	$table_mod = TABLE_PREFIX.'mod_menu_link';
84
	$database->query("UPDATE `$table_pages` SET `target` = '$url_target' WHERE `page_id` = '$page_id'");
85
	$database->query("UPDATE `$table_mod` SET `target_page_id` = '$foreign_page_id', `anchor` = '$page_target', `extern` = '$extern', `redirect_type` = '$r_type' WHERE `page_id` = '$page_id'");
86
}
87

  
88
// Check if there is a database error, otherwise say successful
89
if($database->is_error()) {
90
	$admin->print_error($database->get_error(), $js_back);
91
} else {
92
	$admin->print_success($MESSAGE['PAGES']['SAVED'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
93
}
94

  
95
// Print admin footer
96
$admin->print_footer();
97

  
59 98
?>
branches/2.8.x/wb/modules/menu_link/index.php
1
<?php
2

  
3
// $Id$
4

  
5
/*
6

  
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2009, Ryan Djurovich
9

  
10
 Website Baker is free software; you can redistribute it and/or modify
11
 it under the terms of the GNU General Public License as published by
12
 the Free Software Foundation; either version 2 of the License, or
13
 (at your option) any later version.
14

  
15
 Website Baker is distributed in the hope that it will be useful,
16
 but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 GNU General Public License for more details.
19

  
20
 You should have received a copy of the GNU General Public License
21
 along with Website Baker; if not, write to the Free Software
22
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23

  
24
*/
25

  
26
header('Location: ../index.php');
27

  
1
<?php
2
/***************************************************************************
3
* SVN Version information:
4
*
5
* $Id$
6
*
7
*****************************************************************************
8
*                          WebsiteBaker
9
*
10
* WebsiteBaker Project <http://www.websitebaker2.org/>
11
* Copyright (C) 2009, Website Baker Org. e.V.
12
*         http://start.websitebaker2.org/impressum-datenschutz.php
13
* Copyright (C) 2004-2009, Ryan Djurovich
14
*
15
*                        About WebsiteBaker
16
*
17
* Website Baker is a PHP-based Content Management System (CMS)
18
* designed with one goal in mind: to enable its users to produce websites
19
* with ease.
20
*
21
*****************************************************************************
22
*
23
*****************************************************************************
24
*                        LICENSE INFORMATION
25
*
26
* WebsiteBaker is free software; you can redistribute it and/or
27
* modify it under the terms of the GNU General Public License
28
* as published by the Free Software Foundation; either version 2
29
* of the License, or (at your option) any later version.
30
*
31
* WebsiteBaker is distributed in the hope that it will be useful,
32
* but WITHOUT ANY WARRANTY; without even the implied warranty of
33
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
34
* See the GNU General Public License for more details.
35
*
36
* You should have received a copy of the GNU General Public License
37
* along with this program; if not, write to the Free Software
38
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
39
****************************************************************************
40
*
41
*****************************************************************************
42
*                   WebsiteBaker Extra Information
43
*
44
*
45
*
46
*
47
*****************************************************************************/
48
/**
49
 *
50
 * @category     modules
51
 * @package      menu_link
52
 * @author       Ryan Djurovich
53
 * @copyright    2004-2009, Ryan Djurovich
54
 * @copyright    2009, Website Baker Org. e.V.
55
 * @version      $Id$
56
 * @platform     WebsiteBaker 2.8.x
57
 * @requirements >= PHP 4.3.4
58
 * @license      http://www.gnu.org/licenses/gpl.html
59
 *
60
 *
61
 */
62

  
63
header('Location: ../index.php');
64

  
28 65
?>
branches/2.8.x/wb/modules/menu_link/modify.php
1 1
<?php
2
/***************************************************************************
3
* SVN Version information:
4
*
5
* $Id$
6
*
7
*****************************************************************************
8
*                          WebsiteBaker
9
*
10
* WebsiteBaker Project <http://www.websitebaker2.org/>
11
* Copyright (C) 2009, Website Baker Org. e.V.
12
*         http://start.websitebaker2.org/impressum-datenschutz.php
13
* Copyright (C) 2004-2009, Ryan Djurovich
14
*
15
*                        About WebsiteBaker
16
*
17
* Website Baker is a PHP-based Content Management System (CMS)
18
* designed with one goal in mind: to enable its users to produce websites
19
* with ease.
20
*
21
*****************************************************************************
22
*
23
*****************************************************************************
24
*                        LICENSE INFORMATION
25
*
26
* WebsiteBaker is free software; you can redistribute it and/or
27
* modify it under the terms of the GNU General Public License
28
* as published by the Free Software Foundation; either version 2
29
* of the License, or (at your option) any later version.
30
*
31
* WebsiteBaker is distributed in the hope that it will be useful,
32
* but WITHOUT ANY WARRANTY; without even the implied warranty of
33
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
34
* See the GNU General Public License for more details.
35
*
36
* You should have received a copy of the GNU General Public License
37
* along with this program; if not, write to the Free Software
38
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
39
****************************************************************************
40
*
41
*****************************************************************************
42
*                   WebsiteBaker Extra Information
43
*
44
*
45
*
46
*
47
*****************************************************************************/
2 48

  
3
// $Id$
49
/**
50
 *
51
 * @category     modules
52
 * @package      menu_link
53
 * @author       Ryan Djurovich
54
 * @copyright    2004-2009, Ryan Djurovich
55
 * @copyright    2009, Website Baker Org. e.V.
56
 * @version      $Id$
57
 * @platform     WebsiteBaker 2.8.x
58
 * @requirements >= PHP 4.3.4
59
 * @license      http://www.gnu.org/licenses/gpl.html
60
 *
61
 *
62
 */
4 63

  
5
/*
6

  
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2009, Ryan Djurovich
9

  
10
 Website Baker is free software; you can redistribute it and/or modify
11
 it under the terms of the GNU General Public License as published by
12
 the Free Software Foundation; either version 2 of the License, or
13
 (at your option) any later version.
14

  
15
 Website Baker is distributed in the hope that it will be useful,
16
 but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 GNU General Public License for more details.
19

  
20
 You should have received a copy of the GNU General Public License
21
 along with Website Baker; if not, write to the Free Software
22
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23

  
24
*/
25

  
26 64
// Must include code to stop this file being accessed directly
27 65
if(defined('WB_PATH') == false) { exit("Cannot access this file directly"); }
28 66

  
......
43 81
$r_type = $sql_row['redirect_type'];
44 82
$extern = $sql_row['extern'];
45 83
$anchor = $sql_row['anchor'];
46
$sel = ' selected';
84
$sel = ' selected="selected"';
47 85

  
48 86
// Get list of all visible pages and build a page-tree
49 87

  
......
73 111
global $menulink_titles;
74 112
$menulink_titles = array();
75 113
$table_p = TABLE_PREFIX."pages";
76
if($query_page = $database->query("SELECT `page_id`,`page_title` FROM `$table_p`")) {
114
if($query_page = $database->query("SELECT `page_id`,`menu_title` FROM `$table_p`")) {
77 115
	while($page = $query_page->fetchRow())
78
		$menulink_titles[$page['page_id']] = $page['page_title'];
116
		$menulink_titles[$page['page_id']] = $page['menu_title'];
79 117
}
80 118
// now get the tree
81 119
$links = array();
......
116 154

  
117 155
// script for target-select-box
118 156
?>
119
<script type="text/javascript">
157
<script language="JavaScript" type="text/javascript">
158
/*<![CDATA[*/
120 159
	function populate() {
121
		o=document.getElementById('page_link');
160
		o=document.getElementById('menu_link');
122 161
		d=document.getElementById('page_target');
123 162
		e=document.getElementById('extern');
124
		if(!d){return;}			
163
		if(!d){return;}
125 164
		var mitems=new Array();
126 165
		mitems['0']=[' ','0'];
127 166
		mitems['-1']=[' ','0'];
......
151 190
			d.options[j].text=cur[i];
152 191
			d.options[j++].value=cur[i+1];
153 192
		}
154
		
193

  
155 194
		if(o.value=='-1') {
156 195
			e.disabled = false;
157 196
		} else {
158 197
			e.disabled = true;
159 198
		}
160 199
	}
200

  
201
/*]]>*/
161 202
</script>
162

  
163 203
<form name="menulink" action="<?php echo WB_URL ?>/modules/menu_link/save.php" method="post">
164 204
<input type="hidden" name="page_id" value="<?php echo $page_id ?>" />
165 205
<input type="hidden" name="section_id" value="<?php echo $section_id ?>" />
......
169 209
		<?php echo $TEXT['LINK'].':' ?>
170 210
	</td>
171 211
	<td>
172
		<select name="page_link" id="page_link" onchange="populate()" style="width:250px;" />
212
		<select name="menu_link" id="menu_link" onchange="populate()" style="width:250px;" >
173 213
			<option value="0"<?php echo $target_page_id=='0'?$sel:''?>><?php echo $TEXT['PLEASE_SELECT']; ?></option>
174 214
			<option value="-1"<?php echo $target_page_id=='-1'?$sel:''?>><?php echo $MOD_MENU_LINK['EXTERNAL_LINK']; ?></option>
175 215
			<?php foreach($links AS $pid=>$link) {
176 216
				if ($pid == $page_id)  // Display current page with selection disabled
177
					echo "<option value=\"$pid\" disabled=\"disabled\">$link *</option>";
217
					echo "<option value=\"$pid\" disabled=\"disabled\">$link *</option>\n";
178 218
				else
179
					echo "<option value=\"$pid\" ".($target_page_id==$pid?$sel:'').">$link</option>";
219
					echo "<option value=\"$pid\" ".($target_page_id==$pid?$sel:'').">$link</option>\n";
180 220
			} ?>
181 221
		</select>
182 222
		&nbsp;
......
188 228
		<?php echo $TEXT['ANCHOR'].':' ?>
189 229
	</td>
190 230
	<td>
191
		<select name="page_target" id="page_target" onfocus="populate()" style="width:250px;" />
192
			<option value="<?php echo $anchor ?>" selected><?php echo $anchor=='0'?' ':'#'.$anchor ?></option>
231
		<select name="page_target" id="page_target" onfocus="populate()" style="width:250px;" >
232
			<option value="<?php echo $anchor ?>" selected="selected"><?php echo $anchor=='0'?' ':'#'.$anchor ?></option>
193 233
		</select>
194 234
	</td>
195 235
</tr>
......
198 238
		<?php echo $TEXT['TARGET'].':' ?>
199 239
	</td>
200 240
	<td>
201
		<select name="target" style="width:250px;" />
241
		<select name="target" style="width:250px;" >
202 242
			<option value="_blank"<?php if($target=='_blank') echo ' selected="selected"'; ?>><?php echo $TEXT['NEW_WINDOW'] ?></option>
203 243
			<option value="_self"<?php if($target=='_self') echo ' selected="selected"'; ?>><?php echo $TEXT['SAME_WINDOW'] ?></option>
204 244
			<option value="_top"<?php if($target=='_top') echo ' selected="selected"'; ?>><?php echo $TEXT['TOP_FRAME'] ?></option>
......
210 250
		<?php echo $MOD_MENU_LINK['R_TYPE'].':' ?>
211 251
	</td>
212 252
	<td>
213
		<select name="r_type" style="width:250px;" />
253
		<select name="r_type" style="width:250px;" >
214 254
			<option value="301"<?php if($r_type=='301') echo ' selected="selected"'; ?>>301</option>
215 255
			<option value="302"<?php if($r_type=='302') echo ' selected="selected"'; ?>>302</option>
216 256
		</select>
......
226 266
		<input type="submit" value="<?php echo $TEXT['SAVE'] ?>" style="width: 100px; margin-top: 5px;" />
227 267
	</td>
228 268
	<td align="right">
229
		</form>
230 269
		<input type="button" value="<?php echo $TEXT['CANCEL'] ?>" onclick="javascript: window.location = 'index.php';" style="width: 100px; margin-top: 5px;" />
231 270
	</td>
232 271
</tr>
233 272
</table>
234 273

  
235 274
</form>
236

  

Also available in: Unified diff