Commits

Dan Boitnott  committed 03a0400

Script is displayed on web interface

  • Participants
  • Parent commits 075389b

Comments (0)

Files changed (5)

File src/resources/static/global.css

+* {
+    margin: 0;
+    padding: 0;
+}
+
+body * {
+    margin: 0;
+    padding: 0;
+}
+
+body {
+    padding: 10px;
+}
+
+.TaskBox {
+    border: 1px solid black;
+    padding: 5px;
+    margin: 5px;
+}
+
+.CommentTask {
+    background-color: #b8b8b8;
+}
+
+.CommandTask {
+    background-color: rgba(255, 255, 0, 0.52);
+}

File src/resources/templates/index.mustache

 {{>stdhead}}
 
-<h1>PRISE - {{request.server_name}}</h1>
+<h1>PRISE:{{request.server_name}}:{{dirname}}</h1>
+
+{{#tasks}}
+    <div class="TaskBox {{class}}">
+        <pre>{{lines}}</pre>
+    </div>
+{{/tasks}}
 
 {{>stdfoot}}

File src/resources/templates/stdhead.mustache

 <html>
 <head>
     <title>PRISE - {{request.server_name}}</title>
+    <link rel="stylesheet" type="text/css" href="static/global.css"/>
 </head>
 <body>

File src/scripts.py

 
 class CommandTask(ScriptTask):
     def getLines(self):
-        return [ self.content ]
+        return [ '$ ' + self.content ]
 
     def do(self):
         state.runCommand(self.content)
             return
 
         with fp:
-            type = mimetypes.guess_type(filename)
+            type = mimetypes.guess_type(filename)[0]
 
             # Send headers
             self.send_response(200)
         tasks = []
         for task in state.script:
             tasks.append({
+                "class"         : task.__class__.__name__,
                 "isCommentTask" : type(task) is scripts.CommentTask,
                 "isCommandTask" : type(task) is scripts.CommandTask,
-                "content"       : task.content
+                "content"       : task.content,
+                "lines"         : "\n".join(task.getLines())
             })
 
-        self.sendTemplate("index", tasks=tasks)
+        self.sendTemplate("index", tasks=tasks, dirname=os.path.basename(os.getcwd()))
 
 class Server(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer):
     def __init__(self):