Project

General

Profile

« Previous | Next » 

Revision 698

Added by thorn over 16 years ago

allow external links in menulink-module

View differences:

modify.php
25 25

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

  
29
// check if module language file exists for the language set by the user (e.g. DE, EN)
30
if(!file_exists(WB_PATH .'/modules/menu_link/languages/'.LANGUAGE .'.php')) {
31
	// no module language file exists for the language set by the user, include default module language file EN.php
32
	require_once(WB_PATH .'/modules/menu_link/languages/EN.php');
33
} else {
34
	// a module language file exists for the language defined by the user, load it
35
	require_once(WB_PATH .'/modules/menu_link/languages/'.LANGUAGE .'.php');
36
}
28 37

  
29 38
// get target page_id
30 39
$table = TABLE_PREFIX.'mod_menu_link';
31 40
$sql_result = $database->query("SELECT * FROM $table WHERE section_id = '$section_id'");
32 41
$sql_row = $sql_result->fetchRow();
33
$target_page_id = $sql_row['target_page_id'];
42
$target_page_id = $sql_row['target_page_id'];
43
$extern = $sql_row['extern'];
34 44
$anchor = $sql_row['anchor'];
35 45
$sel = ' selected';
36 46

  
......
84 94
// script for target-select-box
85 95
?>
86 96
<script type="text/javascript">
87
	function populate()
88
	{
97
	function populate() {
89 98
		o=document.getElementById('page_link');
90
		d=document.getElementById('page_target');
99
		d=document.getElementById('page_target');
100
		e=document.getElementById('extern');
91 101
		if(!d){return;}			
92 102
		var mitems=new Array();
93 103
		mitems['0']=[' ','0'];
104
		mitems['-1']=[' ','0'];
94 105
		<?php
95 106
		foreach($links AS $pid=>$link) {
96 107
			$str="mitems['$pid']=[";
......
116 127
		{
117 128
			d.options[j].text=cur[i];
118 129
			d.options[j++].value=cur[i+1];
119
		}
120
	}
130
		}
131
		
132
		if(o.value=='-1') {
133
			e.disabled = false;
134
		} else {
135
			e.disabled = true;
136
		}
137
	}
121 138
</script>
122 139

  
123
<form action="<?php echo WB_URL ?>/modules/menu_link/save.php" method="post">
140
<form name="menulink" action="<?php echo WB_URL ?>/modules/menu_link/save.php" method="post">
124 141
<input type="hidden" name="page_id" value="<?php echo $page_id ?>" />
125 142
<input type="hidden" name="section_id" value="<?php echo $section_id ?>" />
126 143
<table cellpadding="0" cellspacing="0" border="0" width="100%">
......
130 147
	</td>
131 148
	<td>
132 149
		<select name="page_link" id="page_link" onchange="populate()" style="width:250px;" />
133
			<option value="0"<?php echo $target_page_id=='0'?$sel:''?>><?php echo $TEXT['PLEASE_SELECT']; ?></option>
150
			<option value="0"<?php echo $target_page_id=='0'?$sel:''?>><?php echo $TEXT['PLEASE_SELECT']; ?></option>
151
			<option value="-1"<?php echo $target_page_id=='-1'?$sel:''?>><?php echo $MOD_MENU_LINK['EXTERNAL_LINK']; ?></option>
134 152
			<?php foreach($links AS $pid=>$link) {
135 153
				echo "<option value=\"$pid\" ".($target_page_id==$pid?$sel:'').">$link</option>";
136 154
			} ?>
137
		</select>
155
		</select>
156
		&nbsp;
157
		<input type="text" name="extern" id="extern" value="<?php echo $extern; ?>" style="width:250px;" <?php if($target_page_id!='-1') echo 'disabled="disabled"'; ?> />
138 158
	</td>
139 159
</tr>
140 160
<tr>

Also available in: Unified diff