Modified post page for assignment files.
authorSteven Schronk <[email protected]>
Fri, 25 May 2012 17:11:35 +0000 (25 12:11 -0500)
committerbob <bob@dev.(none)>
Thu, 31 May 2012 02:48:16 +0000 (30 21:48 -0500)
comment.php
detail_old.php [deleted file]
detail_root.php
header.php
upload.php

index cce1c22..cb020dd 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 include_once("auth.php");
-include_once("header.php");
+//include_once("header.php");
 
 if (!$_GET["comment"]) { die("No Comment Sent");     }
 if (!$_GET["sched"])   { die("No Schedule ID Sent"); }
@@ -53,15 +53,15 @@ mail("[email protected]", "Comment About Assignment", "", $header);
 
 */
 
-echo "<br>".$header."<br>";
+//echo "<br>".$header."<br>";
 
-echo "Data Posted Sucessfully<br><br>";
+//echo "Data Posted Sucessfully<br><br>";
 
-echo 'Click <a href=detail_root.php?sched='.$_GET["sched"].'>Here</a> To Return to Assignment Details';
+//echo 'Click <a href=detail_root.php?sched='.$_GET["sched"].'>Here</a> To Return to Assignment Details';
 
-//echo '<html><meta http-equiv="refresh" content="0; detail.php?sched='.$_GET["sched"].'" /></html>';
+//echo '<html><meta http-equiv="refresh" content="5;detail_root.php?sched='.$_GET["sched"].'" /></html>';
+echo '<html><meta http-equiv="refresh" content="0;url=detail_root.php?sched='.$_GET["sched"].'" /></html>';
 
 }
 
-
 ?>
diff --git a/detail_old.php b/detail_old.php
deleted file mode 100644 (file)
index 225e450..0000000
+++ /dev/null
@@ -1,183 +0,0 @@
-<?php
-
-include_once("auth.php");
-
-include_once("time.php");
-
-if (!$_GET["sched"]) { die("No Assignment Requested"); }
-
-$_GET["sched"] = mysql_real_escape_string($_GET["sched"]);
-
-/* get assignment details */
-$html = "";
-
-$sql = "select chapter, section_id, title, class_id, schedule.assign_type, ava_date, due_date, sched_id, NOW()-due_date as status, type_name from schedule, types where (schedule.assign_type = types.assign_type) and sched_id=".$_GET["sched"]." order by due_date desc, ava_date desc";
-
-$result = mysql_query($sql);
-
-//echo $sql;
-
-if (!$result) { die("SQL ERROR"); }
-
-while($row = mysql_fetch_row($result))
-{
-       $html .= '<tr>';
-
-       if($row[8] > 0) { $html .= "<td><img src=gfx/bullet_delete.png></td>"; } else { $html .= "<td><img src=gfx/bullet_add.png></td>"; }
-
-       $html .= '<td><a href="detail.php?sched='.$row[7].'">'.$row[2].'</a></td><td>'.$row[9].'</td><td>'.$row[0].'</td>';
-       $html .= '<td>'.$row[1].'</td><td>'.$row[5].'</td><td>'.$row[6].'</td><td>'.absHumanTiming($row[6]).'</td>';
-       $html .= '</tr>';
-}
-
-/* determine if assignment is still open */
-
-$sql = 'select count(*) from schedule where ava_date < NOW() and due_date > NOW() and sched_id ='.$_GET["sched"];
-
-$result = mysql_query($sql);
-
-$row = mysql_fetch_row($result);
-
-if($row[0] == 1) { $submission = ''; } else { $submission = 'disabled=true'; }
-
-
-/* get class this assignment ID from for breadcrumbs */
-$sql = 'select schedule.class_id, class.class_name from schedule, class where (schedule.class_id = class.class_id) and schedule.sched_id = '.$_GET["sched"];
-
-//echo $sql;
-
-$result = mysql_query($sql);
-
-if (!$result) { die("SQL ERROR"); }
-
-$row = mysql_fetch_array($result);
-
-$breadcrumb = '<a href=assignment.php?class='.$row['class_id'].'>'.$row['class_name'].'</a>&nbsp;';
-
-/* get latest versions of each file for this assignment ---------------------------------------------------------------------*/
-
-
-// first get list of file_ids that are distinct names and the latest versions
-
-$sql = 'select distinct file_name, max(file_id) from files where user_id='.$user_id.' and sched_id='.$_GET["sched"].' group by file_name order by file_name';
-
-//echo $sql;
-
-$result = mysql_query($sql);
-
-if (!$result) { die("SQL ERROR: File List"); }
-
-$i = 0;
-
-while($row = mysql_fetch_row($result))
-{
-       // get file contents for each file
-       $sql = 'select file_id, time_post, file_name, file_size, time_post, file_1 from files where file_id ='.$row[1];
-
-       //echo $sql;
-
-       $result2 = mysql_query($sql);
-       if (!$result2) { die("SQL ERROR: File Details"); }
-       while($row2 = mysql_fetch_array($result2))
-       {
-               //echo $sql;
-               $code = $row2['file_1'];
-               
-               /* escape open and close symbols <> */
-               $code = str_replace("<", "&lt;", $code);
-               $code = str_replace(">", "&gt;", $code);
-
-               /* add line numbers to code */
-               $lines = explode("\n", $code);
-
-               $i = 1; $code = "";
-               foreach($lines AS $line)
-               {
-                       $code .= "\n".$i."|";
-                       $code .= $line;
-                       $i++;
-               }
-
-               $files .= '<div class="file">
-                       <div class="file_head"><img src="gfx/page_white_gear.png">
-                               <span class="fname">'.$row2['file_name'].'</span>
-                               <span class="fsize">'.$row2['file_size'].'B</span>
-                               <span class="fdate">'.absHumanTiming($row2['time_post']).'</span>
-                               <span class="fdate">'.$row2['time_post'].'</span>
-                               <span class="fraw"><button>Raw</button></span>
-                       </div>
-                       <div class="highlight">
-                               <pre class="sh_cpp">
-'.$code.'
-
-                               </pre>
-                       </div>
-               </div><br>';
-       }
-}
-
-/* get comments for this assignment */
-$sql = 'select comment_id, stdusers.name, sub_id, fac_id, facusers.name as facname, txt, timeposted, comments.role from users stdusers,comments LEFT JOIN users facusers on (facusers.user_id = comments.fac_id) where (stdusers.user_id = comments.user_id) and comments.user_id='.$user_id.' and sub_id='.$_GET["sched"].' order by timeposted';
-
-//echo $sql;
-
-$result = mysql_query($sql);
-
-if (!$result) { die("SQL ERROR"); }
-
-while($row = mysql_fetch_array($result))
-{
-       $comm .= '<div class="comment"><div class="com_head">';
-       
-       if($row['facname']) { $comm .= '<img src="gfx/user_suit.png">'; } else { $comm .= '<img src="gfx/user_green.png">'; }
-       
-       if(!$row['facname']) { 
-               $comm .= '<span class="com_name">'.$row['name'].'</span>';
-       } else {
-               $comm .= '<span class="com_name">'.$row['facname'].'</span>';
-       }
-
-       $comm .= '<span class="com_date_human">'.absHumanTiming($row['timeposted']).'</span></div>';
-
-       $comm .= '<span class="com_date">'.$row['timeposted'].'</span></div>
-       <div class="com_body"><pre>
-'.$row['txt'].'
-       </pre></div>
-</div><br><br>';
-
-}
-
-?>
-
-<h3><?php echo $breadcrumb; ?> -> Assignment Details</h3>
-
-<table class="gridtable">
-       <tr>
-               <th>Status</th><th>Title</th><th>Type</th><th>Chapter</th><th>Section</th><th>Avalable Date</th><th>Due Date</th><th>Human Time</th>
-       </tr>
-
-       <?php echo $html; ?>
-</table>
-<br>
-
-<form action='upload.php?sched=<?php echo $_GET["sched"]; ?>' method="post" enctype="multipart/form-data">
-<input type="file" name="file" size="40" <?php echo $submission; ?>><br><br>
-<input type="submit" name="submit" value="Submit" <?php echo $submission; ?> />
-</form>
-
-<br>
-
-<?php echo $files; ?>
-
-<br><br>
-
-<?php echo $comm; ?>
-
-<form action='comment.php' method="get">
-<textarea name="comment" id="comment" cols="85" rows="6"></textarea><br><br>
-<input name="sched" type="hidden" value='<?php echo $_GET["sched"]; ?>'>
-<input type="submit" value="Add Comment" />
-</form>
-
-
-
index 44f60f7..c22b14e 100644 (file)
@@ -4,8 +4,6 @@ include_once("auth.php");
 include_once("header.php");
 include_once("time.php");
 
-//if($role != 0) { die("Account \"".$user_name."\" Is Not Authorized To View This Page.<br><br>This Event Will Be Logged And Reported."); }
-
 // prevents students from seeing other's work
 if($role != 0) { $_GET["user"] = $user_id; }
 
@@ -299,9 +297,7 @@ if($row[0] == 1) {
 
 if($role == 0) {
 
-// list of all students alphabetically in this class
-// select enrollment.user_id, name  from schedule, enrollment, users where (schedule.class_id = enrollment.class_id) and (enrollment.user_id = users.user_id) and sched_id =1 order by name, email, user_id;
-
+       // list of all students alphabetically in this class
        $sql = 'select enrollment.user_id, name  from schedule, enrollment, users where (schedule.class_id = enrollment.class_id) and (enrollment.user_id = users.user_id) and sched_id = '.$_GET["sched"].' and name < "'.$student_user_name.'" order by name desc, email desc, user_id desc limit 1';
 
        $result = mysql_query($sql);
index 0f5eac2..15ee8dc 100644 (file)
@@ -9,8 +9,7 @@ if($user_id != '') {
                                <li><a href="index.php">Classes</a></li>
                                <li><a href="manage.php">Manage Accounts</a></li>
                                <li><a href="workflow.php">Workflows</a></li>
-                               <li><a href="#" onClick="logout();">Logout</a></li>
-                               <li><a href="#">'.$_COOKIE["username"].'</a></li>
+                               <li><a href="#" onClick="logout();">'.$_COOKIE["username"].'</a></li>
                        </ul></div>';
 
        } else {
@@ -19,8 +18,7 @@ if($user_id != '') {
                        <ul>
                                <li><a href="index.php">Classes</a></li>
                                <li><a href="manage.php">Manage Account</a></li>
-                               <li><a href="#" onClick="logout();">Logout</a></li>
-                               <li><a href="#">'.$_COOKIE["username"].'</a></li>
+                               <li><a href="#" onClick="logout();">'.$_COOKIE["username"].'</a></li>
                        </ul></div>';
 
        }
index c9b1257..298bba3 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 include_once("auth.php");
-include_once("header.php");
+//include_once("header.php");
 
 if (!$_GET["sched"]) { die("No Assignment Sent"); }
 
@@ -80,11 +80,11 @@ mail($user_email, "File Received", "", $header);
 /* move to classes page */
 
 
-echo "Data Posted Sucessfully<br><br>";
-
-echo 'Click <a href=detail_root.php?sched='.$_GET["sched"].'>Here</a> To Return to Assignment Details';
+//echo "Data Posted Sucessfully<br><br>";
 
+//echo 'Click <a href=detail_root.php?sched='.$_GET["sched"].'>Here</a> To Return to Assignment Details';
 
+echo '<html><meta http-equiv="refresh" content="0;url=detail_root.php?sched='.$_GET["sched"].'" /></html>';
 //echo '<html><meta http-equiv="refresh" content="0; detail.php?sched='.$_GET["sched"].'" />Data Posted Sucessfully</html>';
 
 ?>