Exemplo n.º 1
0
 def all(self):
     _, _, notebook = notes.load_journal()
     body = "<form method=\"GET\" action=\"undo\"><input type=\"text\" name=\"key\"><button type=\"submit\">UNDO</button></form><hr>"
     body += "<table><tr><th>timestamp</th><th><Entry></th></tr>"
     global BASEHTML, DLINE
     title = 'All Journal Entries'
     journal, _, _ = notes.load_journal()
     for i in reversed(sorted(journal.keys())):
         body = body + FLINE.format(DATETIME=journal[i].title,
                                    ENTRY=journal[i].entry)
     body = body + "</table>"
     return BASEHTML.format(
         journal=notebook.notebooks[notebook.current_notebook],
         TITLE=title,
         BODY=body,
         dayfilter=TimeStamp().daypart())
Exemplo n.º 2
0
 def done(self, filter='', entry=''):
     cherrypy.response.headers[
         'Cache-Control'] = 'no-cache, no-store, must-revalidate'
     c = 0
     body = "<div class=\"container\"><div class=\"col-sm-7\">"
     body += "<form name=\"dome\" id=\"dome\" method=\"GET\" action='add'>"
     body += "<textarea rows=\"5\" cols=\"49\" name=\"entry\"></textarea>"
     body += "<input type=\"hidden\" name=\"interval\" id=\"interval\"/>"
     body += "<button type=\"button\" onclick=\"domeaction();\">Enter</button>"
     #body += """<button type="submit"></button>"""
     body += "</form></div><div class=\"col-sm-5\"><h3>{VERSIONNUM}</h3><h4>{PWD}</h4></div></div>"
     body = body + "<table><tr><th>timestamp</th><th>Entry</th></tr>"
     global BASEHTML, DLINE
     if filter is None or filter == '':
         dayfilter = TimeStamp().daypart()
     else:
         dayfilter = TimeStamp(filter).daypart()
     title = 'Done entries'
     journal, todo_dict, notebook = notes.load_journal(filter=dayfilter)
     for i in reversed(sorted(journal.keys())):
         #if filter == '' or filter in i:
         if i in todo_dict.keys():
             if todo_dict[i] == True:
                 pass
             else:
                 c = c + 1
                 body = body + DLINE.format(COUNT=c,
                                            DATETIME=journal[i].title,
                                            ENTRY=journal[i].entry.replace(
                                                '""', '"').replace(
                                                    "''", "'"))
         else:
             c = c + 1
             body = body + DLINE.format(COUNT=c,
                                        DATETIME=journal[i].title,
                                        ENTRY=journal[i].entry.replace(
                                            '""', '"').replace("''", "'"))
     body = body + "</table>"
     #print(body)
     VN = config.version()
     CD = os.getcwd()
     print(VN)
     print(CD)
     body = body.format(VERSIONNUM=VN, PWD=CD)
     return BASEHTML.format(TITLE=title,
                            BODY=body,
                            dayfilter=TimeStamp().daypart())
Exemplo n.º 3
0
    def edit(self, key):
        if key == '':
            return self.done()
        journal, _, notebooks = notes.load_journal()
        event = journal[key].entry.replace('""', '"').replace("''", "'")

        global BASEHTML
        title = "Editing {}".format(key)
        body = """
            <form method="GET" action="editkey">
            <textarea rows="5" cols="49" name="entry">{}</textarea>
            <input type="hidden" name="key" value="{}">
            <button type="submit">Save</button>
            </form>
        """
        form = body.format(event, key)
        return BASEHTML.format(
            journal=notebooks.notebooks[notebooks.current_notebook],
            TITLE=title,
            BODY=form,
            dayfilter='')
Exemplo n.º 4
0
    def todo(self):
        body = ""
        body = body + "<form method=\"GET\" action='add'>"
        body = body + "<textarea rows=\"5\" cols=\"49\" name=\"entry\"></textarea>"
        body += "<input type=\"checkbox\" name=\"todo\"/>"
        body += "<button type=\"submit\">Enter</button>"
        body += "</form>"

        body += "<table><tr><th>timestamp</th><th><Entry></th></tr>"
        global BASEHTML, DLINE
        title = 'To do entries'
        journal, todo_dict, notebook = notes.load_journal()
        if todo_dict:
            for i in reversed(sorted(todo_dict.keys())):
                if todo_dict[i] == True and i in journal:
                    body = body + ELINE.format(DATETIME=journal[i].title,
                                               ENTRY=journal[i].entry)
        body = body + "</table>"
        return BASEHTML.format(
            journal=notebook.notebooks[notebook.current_notebook],
            TITLE=title,
            BODY=body,
            dayfilter=TimeStamp().daypart())
Exemplo n.º 5
0
 def addnotebook(self, newname):
     _, _, notebooks = notes.load_journal()
     notebooks.add(newname, newname + ".tds")
     return self.index()