def do_macro(request, **kw):
    pagename = request.page.page_name
    baseurl = request.getScriptname()
    args = {"pagename": pagename, "baseurl": baseurl}

    try:
        baseurl = request.cfg.collab_baseurl
        args["baseurl"] = baseurl

        user = request.user.name
        active = request.cfg.interwikiname
        path = request.cfg.collab_basedir

        from collabbackend import listCollabs

        collabs = []
        for (shortName, title, motd, link, active) in listCollabs(baseurl, user, path, active):
            collabs.append(shortName)

        if not "collabs" in kw:
            args["collabs"] = collabs

        else:
            if type(kw["collabs"]) is not type([]):
                kw["collabs"] = [kw["collabs"]]

            for collab in kw["collabs"]:
                if not collab in collabs:
                    kw["collabs"].remove(collab)
                    if "inaccessibleCollabs" not in args:
                        args["inaccessibleCollabs"] = list()

                    args["inaccessibleCollabs"].append(collab)

    except:
        pass

    return u"""
    <div class="InterMetaTable" data-options="%s"></div>
    """ % quote(
        json.dumps(dict(args.items() + kw.items()))
    )
Beispiel #2
0
def execute(pagename, request):
    request.content_type = "application/json"
    user = request.user.name
    active = request.cfg.interwikiname
    path = request.cfg.collab_basedir
    baseurl = request.cfg.collab_baseurl

    collabs = listCollabs(baseurl, user, path, active)
    results = []
    for collab in collabs:
        results.append({
            "shortName": collab[0],
            "title": collab[1],
            "motd": collab[2],
            "url": collab[3],
            "active": collab[4]
        })

    json.dump(results, request, indent=2)
    return
Beispiel #3
0
def do_macro(request, **kw):
    pagename = request.page.page_name
    baseurl = request.getScriptname()
    args = {"pagename": pagename, "baseurl": baseurl}

    try:
        baseurl = request.cfg.collab_baseurl
        args['baseurl'] = baseurl

        user = request.user.name
        active = request.cfg.interwikiname
        path = request.cfg.collab_basedir

        from collabbackend import listCollabs
        collabs = []
        for (shortName, title, motd, link,
             active) in listCollabs(baseurl, user, path, active):
            collabs.append(shortName)

        args['active'] = request.cfg.interwikiname
        if not 'collabs' in kw:
            args['collabs'] = [request.cfg.interwikiname]

        else:
            if type(kw['collabs']) is not type([]):
                kw['collabs'] = [kw['collabs']]

            for collab in kw['collabs']:
                if not collab in collabs:
                    kw['collabs'].remove(collab)
                    if 'inaccessibleCollabs' not in args:
                        args['inaccessibleCollabs'] = list()

                    args['inaccessibleCollabs'].append(collab)
    except:
        pass

    return u'''
    <div class="MetaTable2" data-options="%s"></div>
    ''' % quote(json.dumps(dict(args.items() + kw.items())))
Beispiel #4
0
def execute(self, modearg):
    myuser = self.request.user.name
    active = self.request.cfg.interwikiname
    path = self.request.cfg.collab_basedir
    baseurl = self.request.cfg.collab_baseurl

    collablist = listCollabs(baseurl, myuser, path, active, nocheck=True)
    userlist = user.getUserList(self.request)
    domainset = {}

    for uid in userlist:
        account = user.User(self.request, uid)
        nameparts = account.name.split("@", 1)
        if len(nameparts) > 1:
            domainset[nameparts[1]] = 1

    f = self.formatter

    if not modearg or len(modearg) == 0:
        stattext = "Currently hosting " + str(len(collablist)) \
            + " collaboration instances"
        stattext += " for " + str(len(userlist)) + " collaborators"
        stattext += " from " + str(len(domainset)) + " organisations."
    else:
        stattext = "Uknown stat mode: " + modearg

    divfmt = {'class': 'collab_stats'}
       
    result = ''
    result = f.div(1, **divfmt)
    result += f.strong(1)
    result += f.text(stattext)
    result += f.strong(0)
    result += f.div(0)

    return result
Beispiel #5
0
def execute(self):
    user = self.request.user.name
    active = self.request.cfg.interwikiname
    path = self.request.cfg.collab_basedir
    baseurl = self.request.cfg.collab_baseurl
    return listCollabs(baseurl, user, path, active)
Beispiel #6
0
def execute(self, args):
    user = self.request.user.name
    active = self.request.cfg.interwikiname
    path = self.request.cfg.collab_basedir
    baseurl = self.request.cfg.collab_baseurl
    return formatCollabList(self.formatter, user, listCollabs(baseurl, user, path, active))