コード例 #1
0
ファイル: statsaccess.py プロジェクト: agromsl/mediatum
def getPopupWindow(req, ids):
    v = {}
    v["id"] = ids
    if "update" in req.params:
        v["action"] = "doupdate"

    elif req.params.get("action") == "do":  # do action and refresh current month
        collection = tree.getNode(req.params.get("id"))
        collection.set("system.statsrun", "1")
        buildStat(collection, str(format_date(now(), "yyyy-mm")))
        req.writeTAL("web/edit/modules/statsaccess.html", {}, macro="edit_stats_result")
        collection.removeAttribute("system.statsrun")
        return

    else:
        v["action"] = "showform"
        v["statsrun"] = tree.getNode(ids).get("system.statsrun")
    req.writeTAL("web/edit/modules/statsaccess.html", v, macro="edit_stats_popup")
コード例 #2
0
ファイル: statsaccess.py プロジェクト: hibozzy/mediatum
def getPopupWindow(req, ids):
    v = {}
    v["id"] = ids
    if "update" in req.params:
        v["action"] = "doupdate"

    elif req.params.get(
            "action") == "do":  # do action and refresh current month
        collection = tree.getNode(req.params.get("id"))
        collection.set("system.statsrun", "1")
        buildStat(collection, str(format_date(now(), "yyyy-mm")))
        req.writeTAL("web/edit/modules/statsaccess.html", {},
                     macro="edit_stats_result")
        collection.removeAttribute("system.statsrun")
        return

    else:
        v["action"] = "showform"
        v["statsrun"] = tree.getNode(ids).get("system.statsrun")
    req.writeTAL("web/edit/modules/statsaccess.html",
                 v,
                 macro="edit_stats_popup")
コード例 #3
0
ファイル: stats.py プロジェクト: agromsl/mediatum
import sys
sys.path += ["../", "."]
import time

from core.init import basic_init
basic_init()

import core.tree as tree
from core.stats import buildStat
from core.db import database

"""
if parameter is given it will be used as period, format: %Y-%m
if not given, current month will be used as period
"""

db = database.getConnection()
args = sys.argv
period = time.strftime("%Y-%m")
fname = None

if len(args) == 2:  # period given
    period = args[1]

if len(args) == 3:  # period and filename given
    period = args[1]
    fname = args[2]

for id in db.runQuery("select id from node where type='collections' or type='collection'"):
    buildStat(tree.getNode(id[0]), period, fname)
コード例 #4
0
outpath = "%s%s.log" % (core.config.get("logging.save", os.path.dirname(LOG_FILENAME) + '/'), period)

if os.path.exists(outpath) and force == 0:
    print "file for period", period, "existing", outpath
    sys.exit()

for i in range(1, 21):
    path.append(LOG_FILENAME + "." + str(i))

d = []
for filename in path:
    fin = open(filename)
    for line in fin:
        if line.startswith(period):
            d.append(line)
    fin.close()

d.sort()
fout = open(outpath, "w")
for line in d:
    fout.write(line)
fout.close()
print "done for period", period, ", found", len(d), "lines."


if force == 1:  # force rebuildin stats
    print "rebuild stats for period", period
    db = database.getConnection()
    for id in db.runQuery("select id from node where type='collections' or type='collection'"):
        buildStat(tree.getNode(id[0]), period)
コード例 #5
0
import sys
sys.path += ["../", "."]
import time

from core.init import basic_init
basic_init()

import core.tree as tree
from core.stats import buildStat
from core.db import database
"""
if parameter is given it will be used as period, format: %Y-%m
if not given, current month will be used as period
"""

db = database.getConnection()
args = sys.argv
period = time.strftime("%Y-%m")
fname = None

if len(args) == 2:  # period given
    period = args[1]

if len(args) == 3:  # period and filename given
    period = args[1]
    fname = args[2]

for id in db.runQuery(
        "select id from node where type='collections' or type='collection'"):
    buildStat(tree.getNode(id[0]), period, fname)