changeset 29:28eb82047167

Ukończona strona klienta
author mild@mild-laptop
date Sun, 05 Jun 2011 23:09:18 +0200
parents d017e2ab3027
children 50708627f3c7
files frontend/doc/config.ini frontend/mfrontend/db.py frontend/mfrontend/templates/hello.html frontend/mfrontend/templates/joblist.csv frontend/mfrontend/templates/joblist.html frontend/mfrontend/templates/layout.html frontend/mfrontend/views/jobcontrol.py
diffstat 7 files changed, 110 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/frontend/doc/config.ini	Mon May 23 12:49:48 2011 +0200
+++ b/frontend/doc/config.ini	Sun Jun 05 23:09:18 2011 +0200
@@ -1,7 +1,7 @@
 [Basic]
 database = baza.sqlite
 debug = 0
-secret_key = hO9jaJ3thQ
+secret_key = xyeURm3nG7
 hashcrypto = sha512
-apikey = K63FRXtxkX
+apikey = bCVqxeFexh
 
--- a/frontend/mfrontend/db.py	Mon May 23 12:49:48 2011 +0200
+++ b/frontend/mfrontend/db.py	Sun Jun 05 23:09:18 2011 +0200
@@ -171,7 +171,7 @@
     for key in keys:
        if key in options:
            query_db("UPDATE jobs SET " + key + " = :value WHERE id = :id",
-                    {"value":options[key],"id":job_id})
+                    {"value":options["state"],"id":job_id})
     g.db.commit()
 
 def get_user_name(user_id):
--- a/frontend/mfrontend/templates/hello.html	Mon May 23 12:49:48 2011 +0200
+++ b/frontend/mfrontend/templates/hello.html	Sun Jun 05 23:09:18 2011 +0200
@@ -1,5 +1,17 @@
  {% extends "layout.html" %}
 {% block body %}
-<h2>WITAJ NA NASZEJ STRONIE</h2>
-<p>Tutaj znajduje sie jakiś tekst.</p>
+<h2>Projekt z przedmiotu Aplikacje Internetowe i Rozproszone</h2>
+<h3>Temat 5: Łamanie zaszyfrowanych zbiorów haseł przy pomocy komputera równoległego (klastra stacji roboczych)</h3>
+<p>
+<h4>Zespół</h4>
+<table align="center" width="30%"><tr><td align="left">
+<ul>
+<li>Knapik Kinga 171046 (lider)</li>
+<li>Dybizbański Miłosz 171091</li>
+<li>Gembalik Rafał 171068</li>
+<li>Gocał Małgorzata 171082</li>
+<li>Rudowicz Michał 171047</li>
+<li>Sidorkiewicz Łukasz 170991</li>
+</ul></td></tr></table>
+</p>
 {% endblock %} 
--- a/frontend/mfrontend/templates/joblist.csv	Mon May 23 12:49:48 2011 +0200
+++ b/frontend/mfrontend/templates/joblist.csv	Sun Jun 05 23:09:18 2011 +0200
@@ -2,6 +2,6 @@
 {% if job is sameas None %}
 0
 {% else %}
-1;{{job.method}};{{job.hash}};0123456789;{{job.last_checked}};{{job.min_pass_len}};{{job.max_pass_len}};{{job.id}};40{#pierwsze - zero, gdy nie ma zadania, jeden, gdy jest ostatnie - rozmiar podzadania#}
+1;{{job.method}};{{job.hash}};LISTA_ZNAKOW;{{job.last_checked}};{{job.min_pass_len}};{{job.max_pass_len}};{{job.id}};40{#pierwsze - zero, gdy nie ma zadania, jeden, gdy jest ostatnie - rozmiar podzadania#}
 {% endif %}
 {% endfor %}
--- a/frontend/mfrontend/templates/joblist.html	Mon May 23 12:49:48 2011 +0200
+++ b/frontend/mfrontend/templates/joblist.html	Sun Jun 05 23:09:18 2011 +0200
@@ -1,11 +1,15 @@
 {% extends "layout.html" %}
 {% block body %}
+<table border="0" cellpadding="0" cellspacing="0" class="tbt"><tr>
+	<td class="tbtl">&nbsp;</td>
+	<td class="tbtbot" nowrap="nowrap"><b>Lista zadań</b></td>
+	<td class="tbtr">&nbsp;</td>
+</tr></table>
 
-<div class="frame">
-<div class="ft"><div class="ftl"></div><div class="ftc">Lista zadań</div><div class="ftr"></div></div>
-<div class="fm">
-
-<table class="inner" width="100%">
+<table align="center" width="100%" border="0" cellspacing="1" cellpadding="4" class="forumline">
+    <tr>
+	<td class="row1">
+<table border="0" cellpadding="0" cellspacing="0" class="tbt" width="70%" align="center">
     <tr>
             <th class="colhead">id</th>
             <th class="colhead">Właściciel</th>
@@ -23,22 +27,71 @@
         <td>{{ job.username }}</td>
         <td>{{ job.hash }}</td>
         <td>{{ job.label }}</td>
-        <td>{{ job.method }}</td>
-        <td>{{ job.state_text }}</td>
-        <td>{% if job.percent is not sameas None %}
-                {{ job.percent }}%
+        <td>{% if job.method is sameas 0 %}
+                Brute-force
+            {% else %}
+		słownik
+            {% endif %}</td>
+        <td align="center">{{ job.state_text }}</td>
+        <td align="center">{% if job.percent is not sameas None %}
+		{% if job.percent == 100 %}
+		<span class="state100">{{job.percent}}</span>
+	        {% else %}
+		{% if job.percent >= 87 %}
+		<span class="state87">{{job.percent}}</span>
+	        {% else %}
+		{% if job.percent >= 75 %}
+		<span class="state75">{{job.percent}}</span>
+	        {% else %}
+		{% if job.percent >= 62 %}
+		<span class="state62">{{job.percent}}</span>
+	        {% else %}
+		{% if job.percent >= 50 %}
+		<span class="state50">{{job.percent}}</span>
+	        {% else %}
+		{% if job.percent >= 37 %}
+		<span class="state37">{{job.percent}}</span>
+	        {% else %}
+		{% if job.percent >= 25 %}
+		<span class="state25">{{job.percent}}</span>
+	        {% else %}
+		{% if job.percent >= 12 %}
+		<span class="state12">{{job.percent}}</span>
+	        {% else %}
+		<span class="state0">{{job.percent}}</span>
+            {% endif %}{% endif %}{% endif %}{% endif %}{% endif %}{% endif %}{% endif %}{% endif %}
+	
             {% else %}
                 brak danych
             {% endif %}
         </td>
-        <td>{{ job.result }}</td>
+        <td align="center">
+	    {% if job.result is not sameas None %}
+		{{job.result}}
+            {% else %}
+                brak danych
+            {% endif %}
+	</td>
     </tr>
     {% endfor %}
-</table>
-</div>
-<div class="fb"><div class="fbl"></div><div class="fbc"></div><div class="fbr"></div></div>
-</div>
-&nbsp;
-</div>
+</table></td></tr></table>
+<table border="0" cellpadding="0" cellspacing="0" class="tbl"><tr>
+	<td class="tbll">&nbsp;</td>
+	<td class="tblbot">&nbsp;</td>
+	<td class="tblr">&nbsp;</td>
+</tr></table>
+<script>
+function refresh()
+{
+	$.ajax({
+	url: "/jobs/ajax/",
+	success: function (html){
+		$("#result").html(html);
+
+	}
+	});
+}
+setTimeout(refresh,5000);
+</script>
 {% endblock %} 
 
--- a/frontend/mfrontend/templates/layout.html	Mon May 23 12:49:48 2011 +0200
+++ b/frontend/mfrontend/templates/layout.html	Sun Jun 05 23:09:18 2011 +0200
@@ -1,10 +1,10 @@
 <html>
 <head>
 <title>NASZA APLIKACJA!</title>
-<script type="text/javascript" src="/static/jquery.js"></script>
-<script type="text/javascript" src="/static/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
-<link rel="stylesheet" href="/static/fancybox/jquery.fancybox-1.3.4.css" type="text/css" media="screen" />
-<link rel="stylesheet" type="text/css" href="/static/style.css">
+<script type="text/javascript" src="http://localhost/static/jquery.js"></script>
+<script type="text/javascript" src="http://localhost/static/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
+<link rel="stylesheet" href="http://localhost/static/fancybox/jquery.fancybox-1.3.4.css" type="text/css" media="screen" />
+<link rel="stylesheet" type="text/css" href="http://localhost/static/style.css">
 </head><body>
 <div id="content">
 <div style="display:none">
@@ -12,13 +12,13 @@
   {% if error %}<p class=error><strong>Błąd:</strong> {{ error }}{% endif %}
   <form action="/jobs/add/" method=post>
     <dl>
-      <dt>Opis zadania:
+      <dt><b>Opis zadania:</b>
       <dd><input type=text name=label>
-      <dt>Hash:
+      <dt><b>Hash:</b>
       <dd><input type=text name=hash>
-      <dt>Metoda łamania hasha:
-      <dd><input type=radio name=method value=0>Metoda 0
-      <dd><input type=radio name=method value=1>Metoda 1
+      <dt><b>Metoda łamania hasha:</b>
+      <dd><input type=radio name=method value=0>Brute-force
+      <dd><input type=radio name=method value=1>Słownik
       <dd><input type=submit value=Dodaj>
     </dl>
   </form>
@@ -28,9 +28,9 @@
 	<div id="login">
   <form action="{{ url_for('frontend.login') }}" method=post>
     <dl>
-      <dt>Nazwa użytkownika:
+      <dt><b>Nazwa użytkownika:</b>
       <dd><input type=text name=username>
-      <dt>Hasło:
+      <dt><b>Hasło:</b>
       <dd><input type=password name=password>
       <dd><input type=submit value=Login>
     </dl>
@@ -41,16 +41,16 @@
 	<div id="register">
   <form action="{{ url_for('frontend.register') }}" method=post>
     <dl>
-      <dt>Nazwa użytkownika:
+      <dt><b>Nazwa użytkownika:</b>
       <dd><input type=text name=username>
-      <dt>Hasło:
+      <dt><b>Hasło:</b>
       <dd><input type=password name=password>
       <dd><input type=submit value=Rejestruj>
     </dl>
   </form>
 </div>
 </div>
-    <h1>Krakersik</h1>
+<table align="center"><tr><td><img src="http://localhost/static/pic/logo.gif" align="center"></td></tr></table>
   <div id="menu">
   {% if not session.logged_in %}
   <div class="button"><a id="loginlink" href="#login">Zaloguj się</a></div>
@@ -65,8 +65,10 @@
   {% for message in get_flashed_messages() %}
     <div class=flash>{{ message }}</div>
   {% endfor %}
+<table width="80%" align="center"><tr><td align="center" id="result">
   {% block body %}
 {% endblock %}
-<script type="text/javascript" src="/static/general.js"></script>
+</td></tr></table>
+<script type="text/javascript" src="http://localhost/static/general.js"></script>
 </div>
 </body></head>
--- a/frontend/mfrontend/views/jobcontrol.py	Mon May 23 12:49:48 2011 +0200
+++ b/frontend/mfrontend/views/jobcontrol.py	Sun Jun 05 23:09:18 2011 +0200
@@ -26,3 +26,9 @@
             flash(e)
     return render_template('newjob.html')
 
+@jobcontrol.route('/ajax/', methods=['GET', 'POST'])
+@decorators.login_required
+def jobs_ajax():
+    jobs = db.get_jobs(None, None, None)
+    return render_template('joblist_ajax.html', jobs=jobs)
+