4 * http://opencaps.atrc.utoronto.ca
\r
6 * Copyright 2009 Heidi Hazelton
\r
7 * Adaptive Technology Resource Centre, University of Toronto
\r
9 * Licensed under the Educational Community License (ECL), Version 2.0.
\r
10 * You may not use this file except in compliance with this License.
\r
11 * http://www.opensource.org/licenses/ecl2.php
\r
15 define('INCLUDE_PATH', 'include/');
\r
16 require(INCLUDE_PATH.'vitals.inc.php');
\r
18 unset($_SESSION['pid']);
\r
20 if (DISABLE_LOCAL && isset($systems[0]['url'])) {
\r
21 header("Location:start_remote.php?r=0");
\r
23 } else if (DISABLE_LOCAL) {
\r
24 $_SESSION['errors'][] = "Your administrator has disabled local captioning and no remote systems have been configured.";
\r
25 include(INCLUDE_PATH.'basic_header.inc.php');
\r
26 include(INCLUDE_PATH.'footer.inc.php');
\r
30 if (isset($_POST['submit_login'])) {
\r
31 $this_user->login($_POST['login'], $_POST['password']);
\r
35 if (isset($_GET['submit']) && $_GET['submit'] && empty($_POST)) {
\r
36 $_SESSION['errors'][] = "Can't create project. If you uploaded a file, it may be too large.";
\r
39 } else if (isset($_POST['submit_new']) && ($_FILES["media_file"]["error"] == UPLOAD_ERR_INI_SIZE || $_FILES["media_file"]["error"] == UPLOAD_ERR_FORM_SIZE)) {
\r
40 $_SESSION['errors'][] = "Can't create project. If you uploaded a file, it may be too large.";
\r
42 } else if (isset($_POST['submit_new'])) {
\r
43 $this_proj = new project();
\r
46 if (isset($_POST['media_url']) && !empty($_POST['media_url']) && $_POST['media_url']!="http://") {
\r
47 $this_ext = explode(".", $_POST['media_url']);
\r
48 $this_ext = end($this_ext);
\r
50 if (!file_get_contents($_POST['media_url']) || !in_array($this_ext, $supported_ext) ) {
\r
51 $_SESSION['errors'][] = "Invalid URL. Make sure the URL is correct and that the media file is a supported format.";
\r
53 $this_proj->createNew($addslashes($_POST['projname']), $_POST['media_url'], $_FILES['caption_file']);
\r
58 else if (!empty($_FILES['media_file'])) {
\r
59 $this_ext = explode(".", $_FILES['media_file']['name']);
\r
60 $this_ext = end($this_ext);
\r
62 if (!in_array($this_ext, $supported_ext) ) {
\r
63 $_SESSION['errors'][] = "Incorrect upload format.";
\r
65 $pid = $this_proj->createNew($addslashes($_POST['projname']), $_FILES['media_file'], $_FILES['caption_file']);
\r
69 if (empty($_SESSION['errors']))
\r
70 header("Location:editor.php");
\r
73 if (intval(ini_get('upload_max_filesize')) < MAX_FILE_SIZE/1048576)
\r
74 $max = intval(ini_get('upload_max_filesize'));
\r
76 $max = MAX_FILE_SIZE/1048576;
\r
78 include(INCLUDE_PATH.'basic_header.inc.php');
\r
80 unset($_SESSION['rid']);
\r
82 if ($_SESSION['mid'] == "99999")
\r
83 unset($_SESSION['mid']);
\r
87 <script language="JavaScript" src="js/start.js" type="text/javascript"></script>
\r
89 <h1 style="margin-top:10px;"><img src="images/logo.png" alt="OpenCaps - a free, online caption editor" title="OpenCaps - a free, online caption editor" style="margin-top:7px;" /></h1>
\r
90 <p>Start Captioning!</p>
\r
92 <div id="start-tabs"></div>
\r
93 <div id="start-container">
\r
94 <?php if (!$_SESSION['mid'] || !isset($_SESSION['valid_user']) || !$_SESSION['valid_user']) { ?>
\r
97 <p>To start a new captioning project or to return to an ongoing project, please login below. If you are new here, quickly <a href="register.php">register</a> with us!</p>
\r
99 <form action="start.php" method="post" id="form" >
\r
100 <dl class="col-list" style="width:33%; margin-left:auto; margin-right:auto;">
\r
101 <dt><label for="login">Login:</label></dt>
\r
102 <dd><input name="login" type="text" id="login" value="" /></dd>
\r
103 <dt><label for="pswd">Password:</label></dt>
\r
104 <dd><input name="password" type="password" id="pswd" value="" /></dd>
\r
106 <div style="text-align:right">
\r
107 <input type="submit" name="submit_login" value="Submit" class="button" style="width:5em; margin-right:10px;" />
\r
112 <h2 style="font-weight:bold">New Project</h2>
\r
113 <p>Begin adding captions to a new video.</p>
\r
115 <img src="images/asterisk_yellow.png" alt="asterisk" /> <a href="#" onclick="javascript:startNew();" style="margin-top:30px;">Start New Project</a>
\r
116 <form action="start.php?submit=1" method="post" id="form_new" enctype="multipart/form-data" onsubmit="javascript: return validateNewForm();">
\r
117 <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo MAX_FILE_SIZE; ?>" />
\r
119 <div id="start-entry">
\r
121 <em>Project Name</em><br /> <input type='text' name='projname' style="width:200px;" value="<?php echo $this_proj->name; ?>" /><br /><br />
\r
123 <em>Video File</em><br />
\r
124 URL: <input type="text" name="media_url" value="<?php echo isset($_POST['media_url']) ? $_POST['media_url'] : 'http://'; ?>" style="width:200px;" /><br />
\r
125 <strong>or</strong><br />
\r
126 Upload: <input type='file' name='media_file' style="width:250px;" /><br /><br />
\r
127 <span style="font-size:smaller;">Max upload size: <?php echo $max; ?>Mb.<br />
\r
128 Supported formats: <?php echo implode(', ', $supported_ext); ?>.</span><br /><br />
\r
130 <em>Caption file (optional)</em><br />
\r
131 <input type="file" name="caption_file" style="width:200px;" /><br />
\r
132 <span style="font-size:smaller;">Supported formats: QTtext, DFXP, SubRip, OpenCaps-JSON.</span>
\r
134 <div style='text-align:right;'><input type='submit' class='button' style='width:6em;margin-top:5px;' name='submit_new' value='Submit' /></div>
\r
137 <br style="clear:both" />
\r
140 <h2 style="font-weight:bold">Open Existing Project</h2>
\r
141 <p>Continue working on a project.</p>
\r
142 <img src="images/asterisk_yellow.png" alt="asterisk" /> <a href="#" onclick="javascript:startOpen();" style="margin-top:30px;">Open Project</a>
\r
144 <form action="javascript:processOpen();" method="post" id="form_open" enctype="multipart/form-data" onsubmit="javascript: return validateOpenForm();">
\r
145 <div id="open-entry">
\r
146 <div id="projects"></div>
\r
151 <br style="clear:both" />
\r