4 * http://opencaps.atrc.utoronto.ca
6 * Copyright 2009 Heidi Hazelton
7 * Adaptive Technology Resource Centre, University of Toronto
9 * Licensed under the Educational Community License (ECL), Version 2.0.
10 * You may not use this file except in compliance with this License.
11 * http://www.opensource.org/licenses/ecl2.php
17 * This file receives a request from the js and processes it using existing classes.
18 * It's the AJAX-request manager. Should it be a class too?
20 * everything here should call object functions. no real code here.
24 define('INCLUDE_PATH', '');
25 require(INCLUDE_PATH.'vitals.inc.php');
27 /* get a project loaded into the system: start new, open existing, load chosen */
28 if ($_GET['task'] == "print_projs") {
29 if (isset($_GET['page']))
30 $this_proj->printUserProjects($_GET['page']);
32 $this_proj->printUserProjects(1);
34 } else if ($_GET['task'] == "print_projs_remote") {
35 if (isset($_GET['page']))
36 $this_system->printProjects($_GET['page']);
38 $this_system->printProjects();
39 } else if ($_GET['task'] == "open_proj") {
40 $this_proj->open($_GET['pid']);
42 } else if ($_GET['task'] == "open_proj_remote") {
43 $this_proj->openRemote($_GET['pid']);
45 } else if ($_GET['task'] == "proj_delete") {
46 $this_proj->delete($_GET['pid']);
51 * load json file into a project
53 if ($_GET['task'] == 'get_json') {
54 $json_path = '../projects/'.$this_proj->id.'/';
55 echo $stripslashes(@file_get_contents($json_path.'opencaps.json'));
58 * save project into json file
60 } else if ($_POST['task'] == 'save_json') {
61 $this_proj->saveJson($_POST['json'], $_POST['pid']);
64 * preview - create smil & qttext files based on layout
66 } else if ($_GET['task'] == "preview") {
67 $this_proj->preview($_GET['layout']);
70 } else if ($_GET['task'] == "export") {
71 $exfile = $this_proj->exportCaption($_GET['format']);
75 } else if ($_GET['task'] == "get_tabs") {
77 if (isset($systems)) {
80 echo '<li id="home"><a href="start.php">Home</a></li>';
83 echo'<li id="remote-'.ACTIVE_SYSTEM.'"><a href="start_remote.php?r='.ACTIVE_SYSTEM.'">'.$systems[ACTIVE_SYSTEM]['name'].'</a></li>';
85 /* foreach ($systems as $key=>$remote) {
86 echo'<li id="remote-'.$key.'"><a href="start_remote.php?r='.$key.'">'.$remote['name'].'</a></li>';