source: Dev/branches/jQueryUI/client/pages_old/selectObject.php @ 249

Last change on this file since 249 was 249, checked in by hendrikvanantwerpen, 13 years ago

This one's for Subversion, because it's so close...

First widget (stripped down sequencer).
Seperated client and server code in two direcotry trees.

File size: 4.0 KB
Line 
1<?php
2require 'classes/master.php'; //should be at top of every page
3
4if (!isset($_SESSION['userUid'])) {
5    redirect("index.php");
6}
7
8if (isset($_POST['objectType']) && isset($_POST['function'])) {
9    if (!empty($_POST['objectType']) && !empty($_POST['function'])) {
10        $objectType = $_POST['objectType'];
11        $function = $_POST['function'];
12    }
13    else
14        die("Empty!");
15} else
16    die("No input!");
17
18$objects = $objectType::get(array());
19?>
20<!DOCTYPE html>
21<html>
22    <head>
23        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
24        <title></title>
25        <?php new Stylesheet("visualeditors"); ?>
26        <script type="text/javascript" src="js/generalScripts.js"></script>
27        <script type="text/javascript">
28            function redirEditor(uid, type) {
29                // Function to select the object and post the uid to the relevant object editor
30                // Question = stand-alone questionEditor
31                // Survey = surveyEditor.php
32                // Session = sessionEditor.php
33                // Application = applicationEditor.php
34                // Dashboard = N/A, dashboards currently cannot be stored
35                var form = ce("form");
36                form.method = "POST";
37                var input = ce("input");
38                input.type = "hidden";
39                input.value = uid;
40                form.appendChild(input);
41               
42               
43                switch (type.toLowerCase()) {
44                    case "question":
45                        form.action = "questionEditor.php";
46                        input.name = "questionUid";
47                        break;
48                    case "survey":
49                        form.action = "surveyEditor.php";
50                        input.name = "objectUid";
51                        break;
52                    case "session":
53                        // SessionsEditor input structure is not consistent with the others. Should be changed in next version ASAP!
54                        break;
55                    case "application":
56                        form.action = "applicationEditor.php";
57                        input.name = "applicationUid";
58                        break;
59                    default:
60                        return false;
61                        break;
62                }
63               
64                form.submit();
65            }
66       
67            function redirInsert(uid, type) {
68                // Function to select the object and post the uid to the editor that it can be insert into.
69                // Question = Survey editor
70                // Application/Survey = Session Editor
71                // Session = N/A, should use redirEditor instead!
72                var form = ce("form");
73                form.method = "POST";
74                var input = ce("input");
75                input.type = "hidden";
76                input.value = uid;
77                form.appendChild(input);
78            }
79       
80       
81       
82        </script>
83    </head>
84    <body>
85        <div id="header">
86            <?php new Logo(); ?>
87        </div>
88
89        <div id="content">
90            <div id="wrapper">
91                <div id="objectSelector" class="largeFrame">
92                    <div class="largeTitle">Browse <?php echo $objectType; ?>s</div>
93                    <div class="content">
94                        <select size="15" id="objectSelectBox" style="width: 350px;">
95                            <?php
96                            foreach ($objects as $object) {
97                                echo "<option value='" . $object->uid . "'>" . $object->title . "</option>";
98                            }
99                            ?>
100                        </select>
101                    </div>
102                    <div class="controls">
103                        <input type="button" value="Edit" id="btnEdit" class="smallButton" onclick="<?php echo $function; ?>(ge('objectSelectBox').value, '<?php echo $objectType; ?>');" />
104                    </div>
105                </div>
106            </div>
107        </div>
108    </body>
109</html>
Note: See TracBrowser for help on using the repository browser.