diff --git a/note.py b/note.py index 2029f93..3ffd53a 100644 --- a/note.py +++ b/note.py @@ -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(): diff --git a/note.pyc b/note.pyc index f0c6012..3611013 100644 Binary files a/note.pyc and b/note.pyc differ diff --git a/notemanager.py b/notemanager.py index e205939..38f112c 100644 --- a/notemanager.py +++ b/notemanager.py @@ -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 diff --git a/notes.db b/notes.db index 333f6e1..af7e099 100644 Binary files a/notes.db and b/notes.db differ diff --git a/notes.py b/notes.py index 23fc292..bbd63be 100644 --- a/notes.py +++ b/notes.py @@ -83,7 +83,7 @@ def home(subject= "mechanika", datestring= "14grudnia2012"): @app.route('/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""" diff --git a/schema.sql b/schema.sql index 59dcc7f..e1e5f04 100644 --- a/schema.sql +++ b/schema.sql @@ -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 ); diff --git a/static/bootstrap/css/bootstrap.css b/static/bootstrap/css/bootstrap.css index 4e69803..5c48ac4 100644 --- a/static/bootstrap/css/bootstrap.css +++ b/static/bootstrap/css/bootstrap.css @@ -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; diff --git a/static/bootstrap/css/index.html b/static/bootstrap/css/index.html new file mode 100644 index 0000000..7595631 --- /dev/null +++ b/static/bootstrap/css/index.html @@ -0,0 +1,14 @@ + + + + + attero's portfolio + + + + + +

portfolio

+ + + \ No newline at end of file diff --git a/static/jquery.js b/static/jquery.js new file mode 100644 index 0000000..50d1b22 --- /dev/null +++ b/static/jquery.js @@ -0,0 +1,4 @@ +/*! jQuery v1.9.0 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license */(function(e,t){"use strict";function n(e){var t=e.length,n=st.type(e);return st.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}function r(e){var t=Tt[e]={};return st.each(e.match(lt)||[],function(e,n){t[n]=!0}),t}function i(e,n,r,i){if(st.acceptData(e)){var o,a,s=st.expando,u="string"==typeof n,l=e.nodeType,c=l?st.cache:e,f=l?e[s]:e[s]&&s;if(f&&c[f]&&(i||c[f].data)||!u||r!==t)return f||(l?e[s]=f=K.pop()||st.guid++:f=s),c[f]||(c[f]={},l||(c[f].toJSON=st.noop)),("object"==typeof n||"function"==typeof n)&&(i?c[f]=st.extend(c[f],n):c[f].data=st.extend(c[f].data,n)),o=c[f],i||(o.data||(o.data={}),o=o.data),r!==t&&(o[st.camelCase(n)]=r),u?(a=o[n],null==a&&(a=o[st.camelCase(n)])):a=o,a}}function o(e,t,n){if(st.acceptData(e)){var r,i,o,a=e.nodeType,u=a?st.cache:e,l=a?e[st.expando]:st.expando;if(u[l]){if(t&&(r=n?u[l]:u[l].data)){st.isArray(t)?t=t.concat(st.map(t,st.camelCase)):t in r?t=[t]:(t=st.camelCase(t),t=t in r?[t]:t.split(" "));for(i=0,o=t.length;o>i;i++)delete r[t[i]];if(!(n?s:st.isEmptyObject)(r))return}(n||(delete u[l].data,s(u[l])))&&(a?st.cleanData([e],!0):st.support.deleteExpando||u!=u.window?delete u[l]:u[l]=null)}}}function a(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(Nt,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:wt.test(r)?st.parseJSON(r):r}catch(o){}st.data(e,n,r)}else r=t}return r}function s(e){var t;for(t in e)if(("data"!==t||!st.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function u(){return!0}function l(){return!1}function c(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}function f(e,t,n){if(t=t||0,st.isFunction(t))return st.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return st.grep(e,function(e){return e===t===n});if("string"==typeof t){var r=st.grep(e,function(e){return 1===e.nodeType});if(Wt.test(t))return st.filter(t,r,!n);t=st.filter(t,r)}return st.grep(e,function(e){return st.inArray(e,t)>=0===n})}function p(e){var t=zt.split("|"),n=e.createDocumentFragment();if(n.createElement)for(;t.length;)n.createElement(t.pop());return n}function d(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function h(e){var t=e.getAttributeNode("type");return e.type=(t&&t.specified)+"/"+e.type,e}function g(e){var t=nn.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function m(e,t){for(var n,r=0;null!=(n=e[r]);r++)st._data(n,"globalEval",!t||st._data(t[r],"globalEval"))}function y(e,t){if(1===t.nodeType&&st.hasData(e)){var n,r,i,o=st._data(e),a=st._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)st.event.add(t,n,s[n][r])}a.data&&(a.data=st.extend({},a.data))}}function v(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!st.support.noCloneEvent&&t[st.expando]){r=st._data(t);for(i in r.events)st.removeEvent(t,i,r.handle);t.removeAttribute(st.expando)}"script"===n&&t.text!==e.text?(h(t).text=e.text,g(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),st.support.html5Clone&&e.innerHTML&&!st.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Zt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}function b(e,n){var r,i,o=0,a=e.getElementsByTagName!==t?e.getElementsByTagName(n||"*"):e.querySelectorAll!==t?e.querySelectorAll(n||"*"):t;if(!a)for(a=[],r=e.childNodes||e;null!=(i=r[o]);o++)!n||st.nodeName(i,n)?a.push(i):st.merge(a,b(i,n));return n===t||n&&st.nodeName(e,n)?st.merge([e],a):a}function x(e){Zt.test(e.type)&&(e.defaultChecked=e.checked)}function T(e,t){if(t in e)return t;for(var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=Nn.length;i--;)if(t=Nn[i]+n,t in e)return t;return r}function w(e,t){return e=t||e,"none"===st.css(e,"display")||!st.contains(e.ownerDocument,e)}function N(e,t){for(var n,r=[],i=0,o=e.length;o>i;i++)n=e[i],n.style&&(r[i]=st._data(n,"olddisplay"),t?(r[i]||"none"!==n.style.display||(n.style.display=""),""===n.style.display&&w(n)&&(r[i]=st._data(n,"olddisplay",S(n.nodeName)))):r[i]||w(n)||st._data(n,"olddisplay",st.css(n,"display")));for(i=0;o>i;i++)n=e[i],n.style&&(t&&"none"!==n.style.display&&""!==n.style.display||(n.style.display=t?r[i]||"":"none"));return e}function C(e,t,n){var r=mn.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function k(e,t,n,r,i){for(var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;4>o;o+=2)"margin"===n&&(a+=st.css(e,n+wn[o],!0,i)),r?("content"===n&&(a-=st.css(e,"padding"+wn[o],!0,i)),"margin"!==n&&(a-=st.css(e,"border"+wn[o]+"Width",!0,i))):(a+=st.css(e,"padding"+wn[o],!0,i),"padding"!==n&&(a+=st.css(e,"border"+wn[o]+"Width",!0,i)));return a}function E(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=ln(e),a=st.support.boxSizing&&"border-box"===st.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=un(e,t,o),(0>i||null==i)&&(i=e.style[t]),yn.test(i))return i;r=a&&(st.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+k(e,t,n||(a?"border":"content"),r,o)+"px"}function S(e){var t=V,n=bn[e];return n||(n=A(e,t),"none"!==n&&n||(cn=(cn||st("