forked from forceworkbench/forceworkbench
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathselect.php
More file actions
68 lines (57 loc) · 2.07 KB
/
Copy pathselect.php
File metadata and controls
68 lines (57 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
require_once 'session.php';
require_once 'shared.php';
if (isset($_POST['actionJump']) && $_POST['actionJump'] != basename($_SERVER['PHP_SELF'])) {
header("Location: $_POST[actionJump]");
exit;
}
include_once 'header.php';
if (isset($_POST['select'])) {
displayError("Choose an object and an action to which to jump.");
}
?>
<form method='POST' action=''>
<p class='instructions'>Select an action to perform:</p>
<p>
<label for="actionJump"><strong>Jump to: </strong></label>
<select name='actionJump' id='actionJump' style='width: 20em;' onChange='toggleObjectSelectDisabled();'>
<option value='select.php'></option>
<?php
foreach ($GLOBALS["MENUS"] as $menu => $pages) {
foreach ($pages as $href => $page) {
if ($page->onMenuSelect) print "<option value='" . $href . "'>" . $page->title . "</option>";
}
}
?>
</select>
</p>
<p>
<label for="default_object"><strong>Object: </strong></label>
<?php printObjectSelection(WorkbenchContext::get()->getDefaultObject(), 'default_object'); ?>
</p>
<input type='submit' name='select' value='Select'/>
</form>
<script type="text/javascript">
function toggleObjectSelectDisabled() {
var usesObject = new Array();
<?php
foreach ($GLOBALS["MENUS"] as $menu => $pages) {
foreach ($pages as $href => $page) {
if ($page->onMenuSelect === 'usesObject') {
print "usesObject['$href'] = '$href';\n";
}
}
}
?>
var actionJumpVal = document.getElementById('actionJump').value;
if (usesObject[actionJumpVal] != undefined) {
document.getElementById('default_object').disabled = false;
} else {
document.getElementById('default_object').disabled = true;
}
}
</script>
<?php
addFooterScript("<script type='text/javascript'>toggleObjectSelectDisabled();</script>");
include_once 'footer.php';
?>