remove empty lines
authorec2-user <ec2-user@fcdev4.finalsclub.org>
Mon, 14 Nov 2011 23:07:51 +0000 (23:07 +0000)
committerec2-user <ec2-user@fcdev4.finalsclub.org>
Mon, 14 Nov 2011 23:07:51 +0000 (23:07 +0000)
app.js
public/index.html
public/javascripts/main.js

diff --git a/app.js b/app.js
index 2799c583dffecf8ebfb870ff52631e41485036b3..cb332c384d760c4c6b0f54a073b27e27dbb4ccad 100644 (file)
--- a/app.js
+++ b/app.js
@@ -1632,9 +1632,10 @@ app.get( '/archive/course/:id', checkAjax, loadUser, loadOldCourse, function( re
 })
 
 app.get( '/archive/note/:id', checkAjax, loadUser, function( req, res ) {
+  console.log( "id="+req.params.id)
   ArchivedNote.findById(req.params.id, function(err, note) {
     if ( err ) {
-      sendJson(res,  {status: 'error', message: 'This is not a valid id for a note'} );
+      sendJson(res,  {status: 'error', message: 'This is not a valid id for a note', err:err } );
     } else {
       ArchivedCourse.findOne({id: note.course_id}, function(err, course) {
         if ( err ) {
index d99afa2c6bddf9aa1df888995fef3ae9a39a3708..17d90287d19926647d70aca78d43d49918c0837c 100644 (file)
@@ -1,23 +1,19 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html>
        <!-- 
-
                 Currently tested with:
-
                                                Mac             Windows
                                         ______________________
                        Chrome  |       15              -
                        Safari  |       5               -
                        FF              |       8               8
                        IE              |       N/A             9
-
        -->
 
        <head>
                <title>FinalsClub.org</title>
 
                <!-- XXX Some SEO here would be nice -->
-
                <link rel='stylesheet' href='/stylesheets/fc2.css'>
 
                <script type='text/javascript' src='/javascripts/jquery.min.js'></script>
@@ -31,9 +27,7 @@
                <meta name="icon" href="">
 
        </head>
-
        <body>
-
                <div class="masthead">
                        <div class="logbar">
                                <div class="loginstatus">&nbsp;</div>
 
                <div id="topofcontent"></div>
 
-
-
                <div class="content">
-
                        <style>
                                /* The is here is because it's related less to "styling" and more to UI "behavior" */
                                .page { display: none; }
                        </style>
-
-
-
-
                        <div class=page id=pg_home>
                                <div class="contenthome">
                                        <div class="tagline">
                                                <iframe src="http://player.vimeo.com/video/30647271?title=0&amp;byline=0&amp;portrait=0" width="350" height="250" frameborder="0" webkitallowfullscreen="webkitAllowFullScreen" allowfullscreen="allowFullScreen"></iframe>
                                        </div>
                                </div>
-                               
                        </div>
 
-
-
                        <div class=page id=pg_schools>
                                <h1>Universities</h1>
                                <div class="proto school" id=PROTO_school onclick="goPage('/school/___id__')">
                                </div>
                        </div>
 
-
-
                        <div class=page id=pg_courses>
                                <h1>Courses for <span id=school_name></span></h1>
                                <div class="proto course" id=PROTO_course>
                                </div>
                        </div>
 
-
-
                        <div class=page id=pg_lectures>
                                <div class="proto lectures_head" id=PROTO_lectures_head>
                                        <h1>Lectures for Course __number__ : __name__</h1>
                                </div>
                        </div>
 
-
-
                        <div class=page id=pg_notes>
                                <h1>Notepads </h1>
                                <div class="proto note" id=PROTO_note>
                                </div>
                        </div>
 
-
-
                        <div class=page id=pg_archive_subjects>
                                <h1>Archived Subjects</h1>
                                <p>
                                                <a href="javascript:goPage('/archive/subject/__id__')">__name__</a>
                                        </li>
                                </ul>
-
                        </div>
 
-
-
                        <div class=page id=pg_archive_courses>
                                <h1>Archived Courses</h1>
                                <ul>
                                                <a href="javascript:goPage('/archive/course/__id__')">__name__</a>
                                        </li>
                                </ul>
-
                        </div>
 
-
-
                        <div class=page id=pg_archive_notes>
                                <h1>Archived Notes</h1>
                                <ul>
                                </ul>
                        </div>
 
-
-
                        <div class=page id=pg_archive_note_display>
                                <div id=PROTO_archive_note_display>
                                        <h1>__topic__</h1>
                                        <div>__text__</div>
+<pre>__err__</pre>
                                </div>
                        </div>
 
-
-
                        <div class=page id=pg_register>
                                <h1>Create an Account</h1>
                                <form id="credentials" action="/register" method="POST">
                                </form>
                        </div>
 
-
-
                        <div class=page id=pg_login>
                                <h1>Login</h1>
                                <form id="credentials" action="/login" method="POST">
                                </form>
                        </div>
 
-
                        <div class=page id=pg_conduct>
                                <div class="conduct">
                                        <h1>Code of Conduct</h1>
                                </div>
                        </div>
 
-
-
-
                        <div class=page id=pg_press>
                                <h1>FinalsClub in the Press</h1>
                                <div class="press">
                                        </p>
                                </div>
                        </div>
-
-
-
-
                        <div class=page id=pg_notfound>
                                <h1>Page Not Found</h1>
                                Sorry, there is no content for this page.
                        </div>
-
-
-
-
                </div>
 
-
-
-
                <div class="footer">
                        <table>
                                <tr>
                        </p>
                </div>
 
-
-
-
        </body>
 </html>
index eacaea17e9f75e11837f5900a934cd000b74fb3b..f95562a4bae6515ce3683c1fde617b2b9c8886ff 100644 (file)
-
 /*
-
 This is the core logic for the main page.
 It implements most page transitions by showing and hiding DIV elements
 in the page with javascript+jquery
-
 */
 
-
 /* Convert a JSON string to an object, or null if unparseable */
 function j2o(json) { try { return JSON.parse(json); } catch(e) { return null; } }
 
 /* Convert an object to a JSON string (just easier to type than "JSON.stringify" */
 function o2j(obj) { return JSON.stringify(obj); }
 
-
-
 function showHome(matches, cb) {
        cb("home");
 }
 
-
-
 // go to the page that lists the schools
 function showSchools(matches, cb) {
-
        ProtoDiv.reset("PROTO_school");
-
        $.get("/schools", { cache: false }, function(response) {
-
                var schools = []
                if(typeof response == 'object') {
                        schools = response.schools
                }
-
                ProtoDiv.replicate("PROTO_school", schools);
-
                cb("schools");
-
        });
-
 }
 
-
-
 // go to the page that lists the courses for a specific school
 function showCourses(matches, cb) {
-
        var schoolId = matches[1]
-
        ProtoDiv.reset("PROTO_course");
-
        $.get("/school/"+schoolId, { cache: false }, function(response) {
-
                var courses = []
                if(typeof response == 'object') {
                        var school = response.school
                        $("#school_name").html(school.name);
                        courses = school.courses
                }
-
                ProtoDiv.replicate("PROTO_course", courses);
-
                cb("courses")
-
        });
 }
 
-
-
-
 // go to the page that lists the lectures for a specific course
 function showLectures(matches, cb) {
-
        var courseId = matches[1]
-
        ProtoDiv.reset("PROTO_lecture");
-       
        $.get("/course/"+courseId, { cache: false }, function(response) {
-
                ProtoDiv.reset("PROTO_lectures_head")
                ProtoDiv.reset("PROTO_lectures_instructor")
                ProtoDiv.reset("PROTO_lecture")
-
                if(typeof response == 'object') {
-
                        var course = response.course
                        if(course)
                                ProtoDiv.replicate("PROTO_lectures_head", [course])
-
                        var instructor = response.instructor
                        if(instructor)
                                ProtoDiv.replicate("PROTO_lectures_instructor", [instructor])
-
                        var lectures = response.lectures
                        if(lectures)
                                ProtoDiv.replicate("PROTO_lecture", lectures);
-
                }
-
                cb("lectures")
        });
 }
 
-
-
 // go to the page that lists the note taking sessions for a specific lecture
 function showNotes(matches, cb) {
-
        var lectureId = matches[1]
-
        ProtoDiv.reset("PROTO_note");
-       
        $.get("/lecture/"+lectureId, { cache: false }, function(response) {
-
                if(typeof response == 'object') {
-
                        var course = response.course
                        //if(course)
                        //      ProtoDiv.replicate("PROTO_lectures_head", [course])
-
                        var instructor = response.instructor
                        //if(instructor)
                        //      ProtoDiv.replicate("PROTO_lectures_instructor", [instructor])
-
                        var lecture = response.lecture
                        //if(lecture)
                        //      ProtoDiv.replicate("PROTO_lecture", lectures);
-
                        var notes = response.notes
                        if(notes)
                                ProtoDiv.replicate("PROTO_note", notes);
-
                }
-
                cb("notes")
        });
 }
 
-
-
-
-
 // go to the page that lists the archived subject names
 function showArchiveSubjects(matches, cb) {
-
        ProtoDiv.reset("PROTO_archive_subject")
-
        $.get("/archive", { cache: false }, function(response) {
-
                var subjects = response.subjects
-
                ProtoDiv.replicate("PROTO_archive_subject", subjects)
-
        })
-
        cb("archive_subjects")
 }
 
-
-
 function showArchiveCourses(matches, cb) {
-
        var subjectId = parseInt(matches[1])
-
        ProtoDiv.reset("PROTO_archive_course")
-
        $.get("/archive/subject/"+subjectId, { cache: false }, function(response) {
-
                var courses = response.courses
-
                ProtoDiv.replicate("PROTO_archive_course", courses)
-
        })
-
        cb("archive_courses")
 }
 
-
-
 function showArchiveNotes(matches, cb) {
-
        var courseId = parseInt(matches[1])
-
        ProtoDiv.reset("PROTO_archive_note")
-
        $.get("/archive/course/"+courseId, { cache: false }, function(response) {
-
                var notes = response.notes
                $.each(notes, function(i, note) {
                        if(!note.topic)
                                note.topic = note.text.substr(0, 15)+" ..."
                })
-
                ProtoDiv.replicate("PROTO_archive_note", notes)
-
        })
-
        cb("archive_notes")
 }
 
 
 
 function showArchiveNote(matches, cb) {
-
-       var noteId = parseInt(matches[1])
-
+       var noteId = matches[1]
        ProtoDiv.reset("PROTO_archive_note_display")
-
        $.get("/archive/note/"+noteId, { cache: false }, function(response) {
-
                var note = response.note
-note = { text: "Hi <i>Mom!</i>", topic: "21st Century Greetings" }
+//note = { text: "Hi <i>Mom!</i>", topic: "21st Century Greetings" }
+//             note.text = note.text || ""
                if(!note.topic)
                        note.topic = note.text.substr(0, 15)+" ..."
-
+//             if(note.err) {
+//                     note.topic = note.message
+//                     note.err = note.err.stack
+//             }
+//
                ProtoDiv.replicate("PROTO_archive_note_display", note)
-
        })
-
        cb("archive_note_display")
 }
 
-
-
 // go to the account registration page
 function showRegister(matches, cb) {
        // xxx clear fields?
@@ -231,28 +151,20 @@ function showRegister(matches, cb) {
        cb("register");
 }
 
-
 function showLogin(matches, cb) {
        cb("login");
 }
 
-
-
-
 // go to the press articles page
 function showPress(matches, cb) {
        cb("press");
 }
 
-
 // go to the "code of conduct" page
 function showConduct(matches, cb) {
        cb("conduct");
 }
 
-
-
-
 var pageVectors = [
        { regex: /^\/(index.html)?$/, func: showHome },
        { regex: /^\/schools/, func: showSchools },
@@ -262,36 +174,28 @@ var pageVectors = [
        { regex: /^\/archive\/?$/, func: showArchiveSubjects },
        { regex: /^\/archive\/subject\/([0-9]+)/, func: showArchiveCourses },
        { regex: /^\/archive\/course\/([0-9]+)/, func: showArchiveNotes },
-       { regex: /^\/archive\/note\/([0-9]+)/, func: showArchiveNote },
+       { regex: /^\/archive\/note\/([a-f0-9]{24})/, func: showArchiveNote },
        { regex: /^\/login/, func: showLogin },
        { regex: /^\/register/, func: showRegister },
        { regex: /^\/press/, func: showPress },
        { regex: /^\/conduct/, func: showConduct },
 ];
 
-
 /* Do and show the appropriate thing, based on the pages current URL */
 function showPage(y) {
-
        var path = document.location.pathname
-
        $(".page").hide(); //(100);             // hide all pseudo pages
-
        for(var i = 0; i < pageVectors.length; i++) {
                var vector = pageVectors[i]
                var matches = path.match(vector.regex)
                if(matches) {
                        vector.func(matches, function(pageId) {
-
                                $("#pg_"+pageId).fadeIn(100);
-
                                window.scroll(0, y)
-
                        })
                        break
                }
        }
-
        if(i == pageVectors.length) {
                $("#pg_notfound").fadeIn(100);
                window.scroll(0, 0)
@@ -300,12 +204,8 @@ function showPage(y) {
        /*$('html, body').animate({
                scrollTop: $("#topofcontent").offset().top
        }, 100);*/
-
 }
 
-
-
-
 /* Simulates a page load.
        'path' is something like "/schools", etc.
        A page fetch doesn't really happen.
@@ -323,7 +223,6 @@ function goPage(path) {
        }
 }
 
-
 /* Simulates a "back" browser navigation.  */
 var popped = false;
 function goBack(event) {
@@ -331,30 +230,17 @@ function goBack(event) {
        showPage( topQueue.pop() );
 }
 
-
-
 $(document).ready(function() {
-
        // This code executes after the page has been fully loaded
-
        $(".proto").css("display", "none");             // make all the prototypes invisible
-
        //$("body").get(0).onunload = function() { }    // fires when leaving the page proper
-
        ProtoDiv.each = function(e) { $(e).show() }
-
        window.onpopstate = goBack
-       setTimeout(function() {
+       /*setTimeout(function() {
                if(!popped)
                        showPage(0)
-       }, 2000);
-
+       }, 2000);*/
        // xxx older FF browsers don't fire a page load/reload - deal with it somehow.
        // showPage( 0 );               // needed for some older browsers, redundant for chrome
-
 })
 
-
-
-
-