Changes in directory structures. Notes are now aware of their authors.

master
Justyna Ilczuk 2013-02-08 18:03:00 +01:00
parent 2bbb7c02c9
commit 37831517bc
298 changed files with 128 additions and 87 deletions

View File

@ -19,7 +19,7 @@ def convert_datestring_to_date(datestring):
day = datestring[0:2]
else:
day = "0" + datestring[0:1]
months = {"stycznia" : "01", "lutego" : "02", "marca" : "03", "kwietnia" : "04", "maja" : "05", "czerwca" : "06",
months = {"stycznia" : "01", "lutego" : "02", "luty" : "02", "marca" : "03", "kwietnia" : "04", "maja" : "05", "czerwca" : "06",
"lipca" : "07", "sierpnia" : "08", "wrzesnia" : "09", "padziernik": "10", "padziernika" : "10", "listopada" : "11", "grudnia" : "12"}
month = ""
for m in months.keys():

BIN
note.pyc

Binary file not shown.

View File

@ -4,7 +4,8 @@ import sqlite3
DATABASE = 'notes.db'
def add_all_notes_in_dir(path):
def add_all_notes_in_dir(path, author):
print "[+] adding notes from directory: " + path
subjects = os.listdir(path)
if "bootstrap" in subjects:
subjects.remove("bootstrap")
@ -13,24 +14,26 @@ def add_all_notes_in_dir(path):
if ".directory" in subjects:
subjects.remove(".directory")
print "all subjects: " + str(subjects)
author_string = path.split("/")[-1]
print "[info] author string is " + author_string
for subject in subjects:
for date in os.listdir(path+"/" + subject):
notes = []
for note in os.listdir(path+"/" + subject +"/" + date ):
notes.append({"tags": "none", "name": note})
print subject + " " + date + note
add_note(subject, date, notes)
add_note(subject, date, notes, author, author_string)
def add_note(subject, datestring, notes):
def add_note(subject, datestring, notes, author, author_string):
connection_db = connect_db()
db = connection_db.cursor()
db.execute('insert into notes (subject, datestring ) values (?, ?)', [subject, datestring])
db.execute('insert into notes (subject, datestring, author, author_string ) values (?, ?, ?, ?)', [subject, datestring, author, author_string])
note_id = db.lastrowid
for note in notes:
db.execute('insert into pages (note_id, name, tags ) values (?, ?, ?)', [note_id, note["name"], note["tags"]])
connection_db.commit()
print "note added"
print "[+] note added"
def connect_db():
return sqlite3.connect(DATABASE)
@ -38,7 +41,7 @@ def connect_db():
def init_db():
db = connect_db()
print "initialize database..."
print "[+] initialize database..."
f = open("schema.sql", "r")
db.cursor().executescript(f.read())
db.commit()
@ -46,8 +49,9 @@ def init_db():
def main():
init_db()
path = raw_input("Path: ")
author = raw_input("Author: ")
try:
add_all_notes_in_dir(path)
add_all_notes_in_dir(path, author)
except OSError:
pass

BIN
notes.db

Binary file not shown.

View File

@ -83,7 +83,7 @@ def home(subject= "mechanika", datestring= "14grudnia2012"):
@app.route('/subject/<subject>')
def show_subject(subject):
dates = [date["datestring"] for date in get_possible_dates(subject)]
dates = prepare_other_dates(subject)
all_dates = prepare_all_dates()
all_subjects = [sub["subject"] for sub in get_all_subjects()]
return render_template('subject.html', subject=subject, dates=dates, all_dates=all_dates, all_subjects=all_subjects)
@ -121,9 +121,9 @@ def add_note(subject, datestring, notes):
g.db.execute('insert into pages (note_id, name, tags ) values (?, ?, ?)', [note_id, note["name"], note["tags"]])
g._db.commit()
def create_thumb(subject, datestring, name, tags):
src = subject + "/" + datestring + "/" + name
href = src
def create_thumb(subject, datestring, name, tags, author_string):
src = "notes/" + author_string + "/mini/" + subject + "/" + datestring + "/" + name
href = "notes/" + author_string + "/" + subject + "/" + datestring + "/" + name
thumb = Thumb(src, href, tags)
return thumb
@ -131,9 +131,9 @@ def get_thumbs(subject, datestring=""):
if(datestring==""):
query_result = query_db("select pages.* from pages left join notes on notes.id = pages.note_id where notes.subject = ?", [subject,])
else:
query_result = query_db("select pages.* from pages left join notes on notes.id = pages.note_id \
query_result = query_db("select pages.*, notes.author_string from pages left join notes on notes.id = pages.note_id \
where notes.subject = ? and datestring = ?", [subject, datestring])
return [create_thumb(subject, datestring, t["name"], t["tags"]) for t in query_result ]
return [create_thumb(subject, datestring, t["name"], t["tags"], t["author_string"]) for t in query_result ]
def get_possible_dates(subject):
dates = query_db("select distinct datestring from notes where subject = ? ", [subject])
@ -141,9 +141,9 @@ def get_possible_dates(subject):
def get_notes_for_day(datestring):
"""return pages which where written that day (daystring) with other info"""
query_result = query_db("select pages.*,notes.subject from pages left join notes on notes.id = pages.note_id \
query_result = query_db("select pages.*,notes.subject,notes.author_string, notes.author from pages left join notes on notes.id = pages.note_id \
where datestring = ?", [datestring])
return [{"subject": t["subject"], "datestring": datestring, "name": t["name"]}for t in query_result ]
return [{"subject": t["subject"], "author_string":t["author_string"], "author":t["author"], "datestring": datestring, "name": t["name"]}for t in query_result ]
def get_all_dates():
"""return all dates from database"""

View File

@ -8,6 +8,8 @@ tags string not null
create table if not exists notes (
id integer primary key autoincrement,
subject string not null,
author string not null,
author_string string not null,
datestring string not null
);

View File

@ -656,8 +656,9 @@ h4 small {
}
.page-header {
padding-bottom: 12px;
margin: 26px 0 39px;
border-bottom: 1px solid #eeeeee;
margin: 26px 0 29px;
border-bottom: 2px solid #ccaaaa;
border-top: 2px solid #ccaaaa;
}
ul,
ol {
@ -2541,13 +2542,13 @@ table th[class*="span"],
padding: 19px;
margin-bottom: 20px;
background-color: #fff0f5;
border: 3px solid #b22222;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
-moz-box-shadow: 8px 6px 20px #000000;
-webkit-box-shadow: 8px 6px 20px #000000;
box-shadow: 8px 6px 26px #000000;
}
.well blockquote {
border-color: #ddd;
@ -5077,13 +5078,15 @@ a.badge:hover {
margin-bottom: 0;
}
.hero-unit {
padding: 60px;
padding: 30px;
margin-bottom: 30px;
font-size: 18px;
font-weight: 200;
border-bottom: 2px solid #ccaaaa;
border-top: 2px solid #ccaaaa;
line-height: 39px;
color: inherit;
background-color: #eeeeee;
background-color: #ededed;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;

View File

@ -0,0 +1,14 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>attero's portfolio</title>
<meta name="description" content="portfolio, projects, experience">
<meta name="author" content="attero">
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<h1>portfolio</h1>
<script src="js/scripts.js"></script>
</body>
</html>

4
static/jquery.js vendored Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 701 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 897 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 590 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 560 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 722 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 602 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 584 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 619 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 560 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 746 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 567 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 635 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 552 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 613 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 604 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 567 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 742 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 703 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 689 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 566 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 788 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 795 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 798 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 703 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 614 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 592 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 838 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 869 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 788 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 826 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 655 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 599 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 590 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 578 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 757 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 789 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 787 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 710 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 454 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 667 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 650 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 668 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 616 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 792 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 736 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 749 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 644 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 644 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 601 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 740 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 778 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 732 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 703 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 689 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 714 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 692 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 697 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 663 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 538 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 KiB

Some files were not shown because too many files have changed in this diff Show More