Brendan Howell avatar Brendan Howell committed 7633b27

changes for corpus, removed prompts

Comments (0)

Files changed (8)

Binary file modified.

         page = Template(file=template)
         
         sqlsession = self.SqlSession()
-        page.sessions = sqlsession.query(Corpus).all()
-        page.old_sessions = []
+        page.corpora = sqlsession.query(Corpus).all()
+        page.old_corpora = []
         
         return unicode(page)
         
         corp = sqlsession.query(Corpus).filter(Corpus.id==cid).first()
         rnd = corp.current_round_index
         round = sqlsession.query(Round).filter(
-            and_(Round.session==corp, Round.round_index==rnd)).first()
-        prompt = None
-        if sess.current_round_index < 2:
+            and_(Round.corpus==corp, Round.round_index==rnd)).first()
+        if corp.current_round_index < 2:
             lasttext = "no text written yet"
         else:
             lastround = sqlsession.query(Round).filter(
                 and_(Round.session==sess, Round.round_index==(
                 sess.current_round_index-1))).first()
+
+            #TODO: change this to query antecedent
             lastchunk = sqlsession.query(Chunk).filter(
                 and_(Chunk.round==lastround, Chunk.selected==True)).first()
-            if lastround:
-                lasttext = lastround.text_out
-            else:
-                lasttext = None
             
-        try:
-            prompt = sqlsession.query(Prompt).filter(
-                and_(Prompt.round==round, Prompt.selected==True)).first()
-        except NoResultFound:
-            prompt = None
-        
         page = Template(file=template)
         page.corpus = corp
         page.lastchunk = lasttext
-        page.prompt = prompt
+        #TODO: find next chunk based on descendent
+        page.nextchunk = None
         
         return unicode(page)
 

src/templates/corpus.tmpl

+#include "templates/header.tmpl"    
+    <h3>corpus: $corpus.name</h3>
+    <h3>round $corpus.current_round_index</h3>
+    <h3>antecedent chunk:</h3>
+    <p style="font-style:italic;">$lastchunk</p>
+    <h3>write:</h3>
+    <form action="addchunk" method="POST">
+        <textarea name="text" style="width:100%">
+        </textarea>
+        <input type="hidden" name="cid" value="$corpus.id" />
+        <input type="submit" value="Submit" />
+    </form>
+    #if $nextchunk
+    <h3>decendent chunk:</h3>
+    <p style="font-style:italic;">$nextchunk</p>
+    #end if
+#include "templates/footer.tmpl"

src/templates/header.tmpl

     <link rel="stylesheet" src="/static/styles.css" type="text/css" />
 	<script type="text/javascript" src="/static/jquery-1.2.6.js"></script>
 	<script type="text/javascript" src="/static/jquery.timers.js"></script>
+        <script type="text/javascript" src="/static/tinymce/tiny_mce.js"></script>
+	<script type="text/javascript">
+	tinyMCE.init({
+		// General options
+		mode : "textareas",
+		theme : "simple",
+
+		theme_advanced_toolbar_location : "top",
+		theme_advanced_toolbar_align : "left",
+	});
+	</script>
 	</head>
 	<body>
 	  <div id="container" style="margin-left: auto; margin-right:auto; width: 700px;">

src/templates/index.tmpl

 #include "templates/header.tmpl"    
     <img src="/static/maggot.png" alt="maggot" />
-    #if len($sessions):
+    #if len($corpora):
     <h3>Current Corpora:</h3>
     <ul>
-      #for $session in $sessions:
-        <li><a href="/session?sid=$session.id">$session.name</a></li>
+      #for $corpus in $corpora:
+        <li><a href="/corpus?cid=$corpus.id">$corpus.name</a></li>
       #end for
     </ul>
     #end if
-    #if len($old_sessions):
+    #if len($old_corpora):
     <h3>Digested Corpora:</h3>
 	<ul>
-      #for $session in $old_sessions:
-        <li><a href="/session?sid=$session.id">$session.name</a></li>
+      #for $corpus in $old_corpora:
+        <li><a href="/corpus?cid=$corpus.id">$corpus.name</a></li>
       #end for
     </ul>
     #end if

src/templates/newsession.tmpl

 #include "templates/header.tmpl"    
 	<h2>equisite_code</h2>
-    <h3>create new session</h3>
-    <form action="addnewsession" method="POST">
+    <h3>create new corpus</h3>
+    <form action="addnewcorpus" method="POST">
     name: <input type="text" name="name" /><br />
     <input type="hidden" name="creator" value="$creator" /><br />
     rounds: <input type="text" name="total_rounds" value="10" /><sup>*</sup>

src/templates/session.tmpl

-<html>
-<head>
-  <title>exquisite_code</title>
-  <link rel="stylesheet" src="/static/styles.css" type="text/css" />
-  <script type="text/javascript" src="/static/tinymce/tiny_mce.js"></script>
-<script type="text/javascript">
-tinyMCE.init({
-	// General options
-	mode : "textareas",
-	theme : "simple",
-
-	theme_advanced_toolbar_location : "top",
-	theme_advanced_toolbar_align : "left",
-});
-</script>
-</head>
-<body>
-  <div id="container" style="margin-left: auto; margin-right:auto; width: 700px;">
-    <h2>exquisite_code</h2>
-    <h3>session: $session.name round $session.current_round_index</h3>
-    <h3>last chunk:</h3>
-    <p style="font-style:italic;">$lastchunk</p>
-    #if $prompt and $role=="writer"
-    <h3>prompt:</h3>
-    <p style="font-style: italic;">$prompt.text</p>
-    <h3>enter possible text:</h3>
-    <form action="addchunk" method="POST">
-        <textarea name="text" style="width:100%">
-        </textarea>
-        <input type="hidden" name="sid" value="$session.id" />
-        <input type="submit" value="Submit" />
-    </form>
-    #elif $role=="writer"
-    <h3>enter possible next prompt:</h3>
-    <form action="addprompt" method="POST">
-        <textarea name="text" style="width:100%">
-        </textarea>
-        <input type="hidden" name="sid" value="$session.id" />
-        <input type="submit" value="Submit" />
-    </form>
-    #end if
-    #if $role == "proctor" and $prompt
-    <h3>Proctor</h3>
-    <p>make sure all writers have submitted before clicking:</p>
-    <form action="advanceround" method="POST">
-    <h3>algorithm</h3>
-    <input type="radio" name="algorithm" value="roundrobin" checked /> roundrobin<br />
-    <input type="radio" name="algorithm" value="markov" /> markov<br />
-    <input type="radio" name="algorithm" value="burroughs" /> burroughs<br />
-    <input type="radio" name="algorithm" value="twocolumnrobin" /> 2-column-robin<br />    
-    <input type="radio" name="algorithm" value="dave" /> dave<br />    
-    <input type="radio" name="algorithm" value="xtext" /> xtext<br />    
-    <input type="radio" name="algorithm" value="txtr" /> txtr<br />    
-    <input type="hidden" name="sid" value="$session.id" /><br />
-    <input type="submit" value="Advance Round" />
-    </form>
-    #elif $role == "proctor"
-    <h3>Proctor</h3>
-    <p>make sure all writers have submitted before clicking:</p>
-    <form action="advanceprompt" method="POST">
-    <input type="hidden" name="sid" value="$session.id" /><br />
-    <input type="submit" value="Process Prompts" />
-    </form>
-    #end if
-  </div>
-</body>
-</html>

src/templates/wait.tmpl

 #include "templates/header.tmpl"    
-	<h2>exquisite_code</h2>
-    <h3>please wait...</h3>
-    <p><a href="/session?sid=$sid">click here</a> when the proctor says it's ok
+    <h3>please wait for the round to advance...</h3>
+    <p><a href="/corpus?cid=$cid">click here</a> when the proctor says it's ok
 #include "templates/footer.tmpl"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.