1
|
<?php
|
2
|
|
3
|
// $Id: modify.php 543 2008-01-16 12:56:27Z thorn $
|
4
|
|
5
|
/*
|
6
|
|
7
|
Website Baker Project <http://www.websitebaker.org/>
|
8
|
Copyright (C) 2004-2008, 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
|
// Must include code to stop this file being access directly
|
27
|
if(defined('WB_PATH') == false) { exit("Cannot access this file directly"); }
|
28
|
|
29
|
// get target page_id
|
30
|
$table = TABLE_PREFIX.'mod_menu_link';
|
31
|
$sql_result = $database->query("SELECT * FROM $table WHERE section_id = '$section_id'");
|
32
|
$sql_row = $sql_result->fetchRow();
|
33
|
$target_page_id = $sql_row['target_page_id'];
|
34
|
|
35
|
// Get list of all visible page-links, except menu_links and actual page
|
36
|
$table_p = TABLE_PREFIX."pages";
|
37
|
$table_s = TABLE_PREFIX."sections";
|
38
|
$query_page = $database->query("SELECT DISTINCT p.* FROM $table_p AS p, $table_s AS s WHERE p.page_id=s.page_id AND s.module != 'menu_link' AND p.page_id != '$page_id' AND parent = '0' ORDER BY position");
|
39
|
if($query_page->numRows() > 0) {
|
40
|
while($page = $query_page->fetchRow()) {
|
41
|
if($admin->page_is_visible($page)) {
|
42
|
$links[$page['page_id']]='/'.$page['menu_title'];
|
43
|
$query_subpage = $database->query("SELECT DISTINCT p.* FROM $table_p AS p, $table_s AS s WHERE p.page_id=s.page_id AND s.module != 'menu_link' AND p.page_id != '$page_id' AND root_parent = '{$page['page_id']}' ORDER BY level");
|
44
|
if($query_subpage->numRows() > 0) {
|
45
|
while($sub = $query_subpage->fetchRow()) {
|
46
|
if($admin->page_is_visible($sub)) {
|
47
|
$links[$sub['page_id']]=$links[$sub['parent']].'/'.$sub['menu_title'];
|
48
|
}
|
49
|
}
|
50
|
}
|
51
|
}
|
52
|
}
|
53
|
}
|
54
|
|
55
|
// get URL-target for actual page
|
56
|
$table = TABLE_PREFIX."pages";
|
57
|
$query_page = $database->query("SELECT target FROM $table WHERE page_id = '$page_id'");
|
58
|
$page = $query_page->fetchRow();
|
59
|
$target = $page['target'];
|
60
|
|
61
|
?>
|
62
|
<form action="<?php echo WB_URL ?>/modules/menu_link/save.php" method="post">
|
63
|
<input type="hidden" name="page_id" value="<?php echo $page_id ?>" />
|
64
|
<input type="hidden" name="section_id" value="<?php echo $section_id ?>" />
|
65
|
<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
66
|
<tr>
|
67
|
<td>
|
68
|
<?php echo $TEXT['LINK'].':' ?>
|
69
|
</td>
|
70
|
<td>
|
71
|
<select name="link" style="WIDTH: 100%;" value="<?php echo "" ?>" />
|
72
|
<?php
|
73
|
foreach($links as $id=>$l) { ?>
|
74
|
<option value="<?php echo $id ?>"<?php if($id==$target_page_id) echo ' selected'; ?>><?php echo $l ?></option>
|
75
|
<?php } ?>
|
76
|
</td>
|
77
|
</tr>
|
78
|
<tr>
|
79
|
<td>
|
80
|
<?php echo $TEXT['TARGET'].':' ?>
|
81
|
</td>
|
82
|
<td>
|
83
|
<select name="target" style="WIDTH: 100%;" value="<?php echo "" ?>" />
|
84
|
<option value="_blank"<?php if($target=='_blank') echo ' selected'; ?>><?php echo $TEXT['NEW_WINDOW'] ?></option>
|
85
|
<option value="_self"<?php if($target=='_self') echo ' selected'; ?>><?php echo $TEXT['SAME_WINDOW'] ?></option>
|
86
|
<option value="_top"<?php if($target=='_top') echo ' selected'; ?>><?php echo $TEXT['TOP_FRAME'] ?></option>
|
87
|
</select>
|
88
|
</td>
|
89
|
</tr>
|
90
|
</table>
|
91
|
|
92
|
<br />
|
93
|
|
94
|
<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
95
|
<tr>
|
96
|
<td align="left">
|
97
|
<input type="submit" value="<?php echo $TEXT['SAVE'] ?>" style="width: 100px; margin-top: 5px;" />
|
98
|
</td>
|
99
|
<td align="right">
|
100
|
</form>
|
101
|
<input type="button" value="<?php echo $TEXT['CANCEL'] ?>" onclick="javascript: window.location = 'index.php';" style="width: 100px; margin-top: 5px;" />
|
102
|
</td>
|
103
|
</tr>
|
104
|
</table>
|
105
|
|
106
|
</form>
|
107
|
|