Esempio n. 1
0
# @modified 2020/11/26 00:57:06
"""短消息处理,比如任务、备忘、临时文件等等"""
import time
import re
import math
import web
import xutils
import xtables
import xauth
import xconfig
import xmanager
import xtemplate
from xutils import BaseRule, Storage, cacheutil, dbutil, textutil, functions, u, SearchResult
from xtemplate import T

MSG_DAO = xutils.DAO("message")
DEFAULT_TAG = "log"
TAG_TEXT_DICT = dict(done="完成", cron="定期", task="任务", log="记事", key="话题")


def success():
    return dict(success=True, code="success")


def failure(message, code="fail"):
    return dict(success=False, code=code, message=message)


def build_search_html(content):
    fmt = u'<a href="/message?category=message&key=%s">%s</a>'
    return fmt % (xutils.encode_uri_component(content),
Esempio n. 2
0
import xtemplate
import xtables
import xauth
import xuserconfig
import xconfig
import xmanager
import os
from xutils import Storage
from xutils import cacheutil, dateutil, fsutil
from xutils.dateutil import Timer
from xtemplate import T
from .constant import CREATE_BTN_TEXT_DICT

VIEW_TPL = "note/page/view.html"
TYPES_NAME = "笔记索引"
NOTE_DAO = xutils.DAO("note")
MSG_DAO = xutils.DAO("message")
PLUGIN = xutils.Module("plugin")

SEARCH_DOC_DICT = dict(search_action="/note/timeline",
                       search_placeholder=u"搜索笔记")


class NoteCategory:
    def __init__(self, code, name):
        self.name = "%s-%s" % (code, name)
        self.url = "/note/group?category=" + code
        self.icon = ""
        self.priority = 0
        self.is_deleted = 0
        self.size = 0
Esempio n. 3
0
File: view.py Progetto: 552301/xnote
import web
import xauth
import xutils
import xconfig
import xtables
import xtemplate
import xmanager
import os
from web import HTTPError
from xconfig import Storage
from xutils import History
from xutils import dbutil
from xutils import fsutil

PAGE_SIZE = xconfig.PAGE_SIZE
NOTE_DAO = xutils.DAO("note")

@xmanager.listen("note.view", is_async=True)
def visit_by_id(ctx):
    id = ctx.id
    xutils.call("note.visit", id)

def render_note_list(notes, file):
    return xtemplate.render("note/note_list_left.html", 
        notes = notes, 
        files = notes,
        file  = file,
        show_search = False)

def handle_left_dir(kw, user_name, file, op):
    is_iframe = xutils.get_argument("is_iframe")
Esempio n. 4
0
"""时光轴视图"""
import re
import xauth
import xutils
import xtables
import xtemplate
import time
import xconfig
import xuserconfig
import web
from xutils import Storage, dateutil, textutil
from xtemplate import T
from .constant import *

NOTE_DAO = xutils.DAO("note")
MSG_DAO  = xutils.DAO("message")
USER_DAO = xutils.DAO("user")


class PathLink:

    def __init__(self, name, url):
        self.name = name
        self.url  = url

def get_parent_link(user_name, type, priority = 0):
    if priority < 0:
        return PathLink(T("Archived_Project"), "/note/archived")
    if type == "default" or type == "root_notes":
        return PathLink(u"项目", xuserconfig.get_project_path(user_name))