Ejemplo n.º 1
0
def write_groupevents_subsection(xml, group_guid):
    group_events = xml.database.cursor()

    # 6 = select * from elgg_entity_subtypes where subtype='calendar_event';
    group_events.execute(qry.qry_group_posts, (
        group_guid,
        6,
    ))

    # 54 = select * from elgg_metastrings where string='event_calendar_enable';
    perm = qry.postcontent_permission(xml.database, group_guid, 54)

    xml.write_open_tag("eventos", strf.permstr(perm))

    for (post_guid, post_title, post_desc, \
            owner_id, owner_name, owner_username, time)\
        in group_events:

        # 18 = select * from elgg_metastrings where string='venue';
        venue = qry.post_content(xml.database, post_guid, 18)

        # 20 = select * from elgg_metastrings where string='start_date';
        time_start = qry.post_content(xml.database, post_guid, 20)

        # 22 = select * from elgg_metastrings where string='end_date';
        time_end = qry.post_content(xml.database, post_guid, 22)

        # 26 = select * from elgg_metastrings where string='fees';
        fees = qry.post_content(xml.database, post_guid, 26)

        # 28 = select * from elgg_metastrings where string='contact';
        contact = qry.post_content(xml.database, post_guid, 28)

        # 30 = select * from elgg_metastrings where string='organizer';
        organizer = qry.post_content(xml.database, post_guid, 30)

        prefix = 'event_calendar/view/'
        post_attr = strf.pidstr(strf.urlparticipa(prefix, str(post_guid)))
        xml.write_open_tag("evento", post_attr)

        prefix = 'profile/'
        owner_attr = strf.uidstr(strf.urlparticipa(prefix, owner_username))
        xml.write_tag("autor", owner_name, owner_attr)
        xml.write_tag("titulo", post_title, '')
        xml.write_tag("data", strf.datestr(time), '')
        xml.write_tag("organizador", organizer, '')
        xml.write_tag("contato", contact, '')
        xml.write_tag("endereco", venue, '')
        xml.write_tag("data_inicio", strf.datestr(time_start), '')
        xml.write_tag("data_fim", strf.datestr(time_end), '')
        xml.write_tag("taxa_participacao", fees, '')
        xml.write_tag("descricao", strf.cdata(post_desc), '')

        xml.write_close_tag("evento")

        xml.write_comments(post_guid)

    xml.write_close_tag("eventos")

    group_events.close()
Ejemplo n.º 2
0
def write_userevents_subsection (xml, user_guid):
    user_events = xml.database.cursor()
    
    # 6 = select * from elgg_entity_subtypes where subtype='calendar_event';
    user_events.execute(qry.qry_user_posts, (user_guid, user_guid, 6,))
    
    
    xml.write_open_tag("eventos",'')
    
    for (post_guid, post_title, post_desc, time)\
        in user_events:
            
        # 18 = select * from elgg_metastrings where string='venue';
        venue=qry.post_content(xml.database, post_guid, 18)
        
        # 20 = select * from elgg_metastrings where string='start_date';
        time_start=qry.post_content(xml.database, post_guid, 20)

        # 22 = select * from elgg_metastrings where string='end_date';
        time_end=qry.post_content(xml.database, post_guid, 22)
        
        # 26 = select * from elgg_metastrings where string='fees';
        fees=qry.post_content(xml.database, post_guid, 26)
        
        # 28 = select * from elgg_metastrings where string='contact';
        contact=qry.post_content(xml.database, post_guid, 28)
        
        # 30 = select * from elgg_metastrings where string='organizer';
        organizer=qry.post_content(xml.database, post_guid, 30)
        
        prefix='event_calendar/view/'
        post_attr=strf.pidstr(strf.urlparticipa(prefix,str(post_guid)))
        xml.write_open_tag("evento",post_attr)
        
        xml.write_tag("titulo",post_title,'')
        xml.write_tag("data",strf.datestr(time),'')
        xml.write_tag("organizador",organizer,'')
        xml.write_tag("contato",contact,'')
        xml.write_tag("endereco",venue,'')
        xml.write_tag("data_inicio",strf.datestr(time_start),'')
        xml.write_tag("data_fim",strf.datestr(time_end),'')
        xml.write_tag("taxa_participacao",fees,'')
        xml.write_tag("descricao",strf.cdata(post_desc),'')
        
        xml.write_comments(post_guid)
        
        xml.write_close_tag("evento")
    
    xml.write_close_tag("eventos")
    
    user_events.close()
def write_userpages_subsection(json, user_guid):
    user_pages = json.database.cursor()

    # 14 = select * from elgg_entity_subtypes where subtype='page_top';
    user_pages.execute(qry.qry_user_posts, (
        user_guid,
        user_guid,
        14,
    ))

    json.write_open_tag("paginas", "[")

    row = 0
    for (post_guid, post_title, post_desc, time)\
        in user_pages:

        row = row + 1

        prefix = 'pages/view/'
        post_attr = strf.urlparticipa(prefix, str(post_guid))

        json.write_open_tag("", "{")

        json.write_tag("pid", post_attr, ",")
        json.write_tag("titulo", post_title, ",")
        json.write_tag("data", strf.datestr(time), ",")
        json.write_tag("texto", post_desc, ",")

        json.write_comments(post_guid)

        json.write_close_tag("}", (row < user_pages.rowcount))

    json.write_close_tag("]", True)

    user_pages.close()
    def write_comments(self, post_guid):
        post_comments = self.database.cursor()
        post_comments.execute(qry.qry_post_comments, (post_guid, ))

        self.write_open_tag("comentarios", "[")

        row = 0
        for (user_id, user_name, user_username, string, time)\
            in post_comments:

            row = row + 1

            self.write_open_tag("", "{")

            prefix = 'profile/'
            user_attr = strf.urlparticipa(prefix, user_username)

            self.write_open_tag("usuario", "{")
            self.write_tag("uid", user_attr, ",")
            self.write_tag("nome", user_name, "")
            self.write_close_tag("}", True)

            self.write_tag("data", strf.datestr(time), ",")
            self.write_tag("mensagem", string, "")

            self.write_close_tag("}", (row < post_comments.rowcount))

        self.write_close_tag("]", False)

        post_comments.close()
Ejemplo n.º 5
0
def write_uservideos_subsection (xml, user_guid):
    user_videos = xml.database.cursor()
    
    # 12 = select * from elgg_entity_subtypes where subtype='videos';
    user_videos.execute(qry.qry_user_posts, (user_guid, user_guid, 12,))
    
    xml.write_open_tag("videos",'')
    
    for (post_guid, post_title, post_desc, time)\
        in user_videos:
                    
        # 477 = select * from elgg_metastrings where string='video_url';
        video_link=qry.post_content(xml.database, post_guid, 477)
        
        prefix='videos/view/'
        post_attr=strf.pidstr(strf.urlparticipa(prefix,str(post_guid)))
        xml.write_open_tag("video",post_attr)
        
        xml.write_tag("titulo",post_title,'')
        xml.write_tag("data",strf.datestr(time),'')
        xml.write_tag("link",'',strf.hrefstr(video_link))
        xml.write_tag("descricao",strf.cdata(post_desc),'')
        
        xml.write_comments(post_guid)
        
        xml.write_close_tag("video")
        
    xml.write_close_tag("videos")
    
    user_videos.close()
Ejemplo n.º 6
0
def write_userbookmarks_subsection (xml, user_guid):
    user_bookmarks = xml.database.cursor()
    
    # 13 = select * from elgg_entity_subtypes where subtype='bookmarks';
    user_bookmarks.execute(qry.qry_user_posts, (user_guid, user_guid, 13,))
    
    xml.write_open_tag("favoritos",'')
    
    for (post_guid, post_title, post_desc, time)\
        in user_bookmarks:
                    
        # 90 = select * from elgg_metastrings where string='address';
        bookmark_link=qry.post_content(xml.database, post_guid, 90)
  
        prefix='bookmarks/view/'
        post_attr=strf.pidstr(strf.urlparticipa(prefix,str(post_guid)))
        xml.write_open_tag("favorito",post_attr)
    
        xml.write_tag("titulo",post_title,'')
        xml.write_tag("data",strf.datestr(time),'')
        xml.write_tag("link",'',strf.hrefstr(bookmark_link))
        xml.write_tag("descricao",strf.cdata(post_desc),'')
                    
        xml.write_comments(post_guid)
        
        xml.write_close_tag("favorito")
                
    xml.write_close_tag("favoritos")
    
    user_bookmarks.close()
Ejemplo n.º 7
0
def write_userpages_subsection (xml, user_guid):
    user_pages = xml.database.cursor()
    
    # 14 = select * from elgg_entity_subtypes where subtype='page_top';
    user_pages.execute(qry.qry_user_posts, (user_guid, user_guid, 14,))
    
    xml.write_open_tag("paginas",'')
    
    for (post_guid, post_title, post_desc, time)\
        in user_pages:
        
        prefix='pages/view/'
        post_attr=strf.pidstr(strf.urlparticipa(prefix,str(post_guid)))
        xml.write_open_tag("pagina",post_attr)

        xml.write_tag("titulo",post_title,'')
        xml.write_tag("data",strf.datestr(time),'')
        xml.write_tag("texto",strf.cdata(post_desc),'')
                    
        xml.write_comments(post_guid)
        
        xml.write_close_tag("pagina")
        
    xml.write_close_tag("paginas")
    
    user_pages.close()
Ejemplo n.º 8
0
def write_userfiles_subsection (xml, user_guid):
    user_files = xml.database.cursor()
    
    # 1 = select * from elgg_entity_subtypes where subtype='file';
    user_files.execute(qry.qry_user_posts, (user_guid, user_guid, 1,))
    
    xml.write_open_tag("arquivos",'')
    
    for (post_guid, post_title, post_desc, time)\
        in user_files:
        
        prefix="file/download/"
        file_link=strf.urlparticipa(prefix,str(post_guid))
        
        prefix='file/view/'
        post_attr=strf.pidstr(strf.urlparticipa(prefix,str(post_guid)))
        xml.write_open_tag("arquivo",post_attr)
        
        xml.write_tag("titulo",post_title,'')
        xml.write_tag("data",strf.datestr(time),'')
        xml.write_tag("link",'',strf.hrefstr(file_link))
        xml.write_tag("descricao",strf.cdata(post_desc),'')
            
        xml.write_comments(post_guid)
        
        xml.write_close_tag("arquivo")
    
    xml.write_close_tag("arquivos")
    
    user_files.close()
Ejemplo n.º 9
0
def write_userblogs_subsection (xml, user_guid):
    user_blogs = xml.database.cursor()
    
    # 4 = select * from elgg_entity_subtypes where subtype='blog';
    user_blogs.execute(qry.qry_user_posts, (user_guid, user_guid, 4,))
    
    xml.write_open_tag("blogs",'')
    
    for (post_guid, post_title, post_desc, time)\
        in user_blogs:
                    
        post_excerpt = xml.database.cursor()
        
        # 64 = select * from elgg_metastrings where string='excerpt';
        post_excerpt=qry.post_content(xml.database, post_guid, 64)
            
        prefix='blog/view/'
        post_attr=strf.pidstr(strf.urlparticipa(prefix,str(post_guid)))
        xml.write_open_tag("blog",post_attr)

        xml.write_tag("titulo",post_title,'')
        xml.write_tag("data",strf.datestr(time),'')
        xml.write_tag("resumo",strf.cdata(post_excerpt),'')
        xml.write_tag("texto",strf.cdata(post_desc),'')
                    
        xml.write_comments(post_guid)
        
        xml.write_close_tag("blog")
            
    xml.write_close_tag("blogs")
    
    user_blogs.close()
Ejemplo n.º 10
0
def write_groups_section(xml, \
    guid, title, desc, owner_id, owner_name, owner_username, time):

    # 45 = select * from elgg_metastrings where string='briefdescription';
    brief_desc = qry.post_content(xml.database, guid, 45)

    prefix = 'groups/profile/'
    group_attr = strf.cidstr(strf.urlparticipa(prefix, str(guid)))
    xml.write_open_tag("comunidade", group_attr)

    # Write all group's information
    prefix = 'profile/'
    owner_attr = strf.uidstr(strf.urlparticipa(prefix, owner_username))
    xml.write_tag("proprietario", owner_name, owner_attr)
    xml.write_tag("titulo", title, '')
    xml.write_tag("data", strf.datestr(time), '')
    xml.write_tag("descricao", strf.cdata(desc), '')
    xml.write_tag("breve_descricao", strf.cdata(brief_desc), '')

    if qry.groupaccess_permission(xml.database, guid) == 'public':

        # Write a list of group member's name
        write_groupmembers_subsection(xml, guid)

        # Write a list, and all the info, of all posts made on the group.
        write_groupfiles_subsection(xml, guid)
        write_groupforumtopics_subsection(xml, guid)
        write_groupbookmarks_subsection(xml, guid)
        write_grouppages_subsection(xml, guid)
        write_groupvideos_subsection(xml, guid)
        write_groupevents_subsection(xml, guid)

    xml.write_close_tag("comunidade")
def write_userevents_subsection(json, user_guid):
    user_events = json.database.cursor()

    # 6 = select * from elgg_entity_subtypes where subtype='calendar_event';
    user_events.execute(qry.qry_user_posts, (
        user_guid,
        user_guid,
        6,
    ))

    json.write_open_tag("eventos", "[")

    row = 0
    for (post_guid, post_title, post_desc, time)\
        in user_events:

        row = row + 1

        # 18 = select * from elgg_metastrings where string='venue';
        venue = qry.post_content(json.database, post_guid, 18)

        # 20 = select * from elgg_metastrings where string='start_date';
        time_start = qry.post_content(json.database, post_guid, 20)

        # 22 = select * from elgg_metastrings where string='end_date';
        time_end = qry.post_content(json.database, post_guid, 22)

        # 26 = select * from elgg_metastrings where string='fees';
        fees = qry.post_content(json.database, post_guid, 26)

        # 28 = select * from elgg_metastrings where string='contact';
        contact = qry.post_content(json.database, post_guid, 28)

        # 30 = select * from elgg_metastrings where string='organizer';
        organizer = qry.post_content(json.database, post_guid, 30)

        prefix = 'event_calendar/view/'
        post_attr = strf.urlparticipa(prefix, str(post_guid))

        json.write_open_tag("", "{")

        json.write_tag("pid", post_attr, ",")
        json.write_tag("titulo", post_title, ",")
        json.write_tag("data", strf.datestr(time), ",")
        json.write_tag("organizador", organizer, ",")
        json.write_tag("contato", contact, ",")
        json.write_tag("endereco", venue, ",")
        json.write_tag("dataInicio", time_start, ",")
        json.write_tag("dataFim", time_end, ",")
        json.write_tag("taxaParticipacao", fees, ",")
        json.write_tag("descricao", post_desc, ",")

        json.write_comments(post_guid)

        json.write_close_tag("}", (row < user_events.rowcount))

    json.write_close_tag("]", False)

    user_events.close()
def write_groupfiles_subsection(json, group_guid):
    group_files = json.database.cursor()

    # 1 = select * from elgg_entity_subtypes where subtype='file';
    group_files.execute(qry.qry_group_posts, (
        group_guid,
        1,
    ))

    # 50 = select * from elgg_metastrings where string='file_enable';
    perm = qry.postcontent_permission(json.database, group_guid, 50)

    json.write_tag("arquivosHabilitado", perm, ",")
    json.write_open_tag("arquivos", "[")

    row = 0
    for (post_guid, post_title, post_desc, \
            owner_id, owner_name, owner_username, time)\
        in group_files:

        row = row + 1

        json.write_open_tag("", "{")

        prefix = 'file/download/'
        file_link = strf.urlparticipa(prefix, str(post_guid))

        prefix = 'file/view/'
        post_attr = strf.urlparticipa(prefix, str(post_guid))
        json.write_tag("pid", post_attr, ",")

        prefix = 'profile/'
        owner_attr = strf.urlparticipa(prefix, owner_username)

        json.write_open_tag("autor", "{")
        json.write_tag("uid", owner_attr, ",")
        json.write_tag("nome", owner_name, "")
        json.write_close_tag("}", True)

        json.write_tag("titulo", post_title, ",")
        json.write_tag("data", strf.datestr(time), ",")
        json.write_tag("link", file_link, ",")
        json.write_tag("descricao", post_desc, ",")

        json.write_comments(post_guid)

        json.write_close_tag("}", (row < group_files.rowcount))

    json.write_close_tag("]", True)

    group_files.close()
def write_groupbookmarks_subsection(json, group_guid):
    group_bookmarks = json.database.cursor()

    # 13 = select * from elgg_entity_subtypes where subtype='bookmarks';
    group_bookmarks.execute(qry.qry_group_posts, (
        group_guid,
        13,
    ))

    # 49 = select * from elgg_metastrings where string='bookmarks_enable';
    perm = qry.postcontent_permission(json.database, group_guid, 49)

    json.write_tag("favoritosHabilitado", perm, ",")
    json.write_open_tag("favoritos", "[")

    row = 0
    for (post_guid, post_title, post_desc, \
            owner_id, owner_name, owner_username, time)\
        in group_bookmarks:

        row = row + 1

        json.write_open_tag("", "{")

        # 90 = select * from elgg_metastrings where string='address';
        bookmark_link = qry.post_content(json.database, post_guid, 90)

        prefix = 'bookmarks/view/'
        post_attr = strf.urlparticipa(prefix, str(post_guid))
        json.write_tag("pid", post_attr, ",")

        prefix = 'profile/'
        owner_attr = strf.urlparticipa(prefix, owner_username)

        json.write_open_tag("autor", "{")
        json.write_tag("uid", owner_attr, ",")
        json.write_tag("nome", owner_name, "")
        json.write_close_tag("}", True)

        json.write_tag("titulo", post_title, ",")
        json.write_tag("data", strf.datestr(time), ",")
        json.write_tag("link", bookmark_link, ",")
        json.write_tag("descricao", post_desc, ",")

        json.write_comments(post_guid)

        json.write_close_tag("}", (row < group_bookmarks.rowcount))

    json.write_close_tag("]", True)

    group_bookmarks.close()
def write_groupforumtopics_subsection(json, group_guid):
    group_forumtopics = json.database.cursor()

    # 7 = select * from elgg_entity_subtypes where subtype='groupforumtopic';
    group_forumtopics.execute(qry.qry_group_posts, (
        group_guid,
        7,
    ))

    # 52 = select * from elgg_metastrings where string='forum_enable';
    perm = qry.postcontent_permission(json.database, group_guid, 52)

    json.write_tag("debatesHabilitado", perm, ",")
    json.write_open_tag("debates", "[")

    row = 0
    for (post_guid, post_title, post_desc, \
        owner_id, owner_name, owner_username, time)\
        in group_forumtopics:

        row = row + 1

        json.write_open_tag("", "{")

        prefix = 'discussion/view/'
        post_attr = strf.urlparticipa(prefix, str(post_guid))
        json.write_tag("pid", post_attr, ",")

        prefix = 'profile/'
        owner_attr = strf.urlparticipa(prefix, owner_username)

        json.write_open_tag("autor", "{")
        json.write_tag("uid", owner_attr, ",")
        json.write_tag("nome", owner_name, "")
        json.write_close_tag("}", True)

        json.write_tag("titulo", post_title, ",")
        json.write_tag("data", strf.datestr(time), ",")
        json.write_tag("texto", post_desc, ",")

        json.write_comments(post_guid)

        json.write_close_tag("}", (row < group_forumtopics.rowcount))

    json.write_close_tag("]", True)

    group_forumtopics.close()
def write_groups_section (json,\
    guid, title, desc, owner_id, owner_name, owner_username, time):

    # 45 = select * from elgg_metastrings where string='briefdescription';
    brief_desc = qry.post_content(json.database, guid, 45)

    prefix = 'groups/profile/'
    group_attr = strf.urlparticipa(prefix, str(guid))
    json.write_tag("cid", group_attr, ",")

    # Write all group's information
    prefix = 'profile/'
    owner_attr = strf.urlparticipa(prefix, owner_username)

    json.write_open_tag("proprietario", "{")
    json.write_tag("uid", owner_attr, ",")
    json.write_tag("nome", owner_name, "")
    json.write_close_tag("}", True)

    json.write_tag("titulo", title, ",")
    json.write_tag("data", strf.datestr(time), ",")
    json.write_tag("descricao", desc, ",")

    group_access = qry.groupaccess_permission(json.database, guid)

    if group_access == 'public':
        comma = ","
    else:
        comma = ""

    json.write_tag("breveDescricao", brief_desc, comma)

    if group_access == 'public':

        # Write a list of group member's name
        write_groupmembers_subsection(json, guid)

        # Write a list, and all the info, of all posts made on the group.
        write_groupfiles_subsection(json, guid)
        write_groupforumtopics_subsection(json, guid)
        write_groupbookmarks_subsection(json, guid)
        write_grouppages_subsection(json, guid)
        write_groupvideos_subsection(json, guid)
        write_groupevents_subsection(json, guid)
    def write_comments(self, post_guid):
        post_comments = self.database.cursor()
        post_comments.execute(qry.qry_post_comments, (post_guid, ))

        self.write_open_tag("comentarios", '')
        for (user_id, user_name, user_username, string, time)\
            in post_comments:

            self.write_open_tag("comentario", '')

            prefix = 'profile/'
            user_attr = strf.uidstr(strf.urlparticipa(prefix, user_username))
            self.write_tag("usuario", user_name, user_attr)
            self.write_tag("data", strf.datestr(time), '')
            self.write_tag("mensagem", strf.cdata(string), '')

            self.write_close_tag("comentario")

        self.write_close_tag("comentarios")

        post_comments.close()
def write_userblogs_subsection(json, user_guid):
    user_blogs = json.database.cursor()

    # 4 = select * from elgg_entity_subtypes where subtype='blog';
    user_blogs.execute(qry.qry_user_posts, (
        user_guid,
        user_guid,
        4,
    ))

    json.write_open_tag("blogs", "[")

    row = 0
    for (post_guid, post_title, post_desc, time)\
        in user_blogs:

        row = row + 1

        post_excerpt = json.database.cursor()

        # 64 = select * from elgg_metastrings where string='excerpt';
        post_excerpt = qry.post_content(json.database, post_guid, 64)

        prefix = 'blog/view/'
        post_attr = strf.urlparticipa(prefix, str(post_guid))
        json.write_open_tag("", "{")

        json.write_tag("pid", post_attr, ",")
        json.write_tag("titulo", post_title, ",")
        json.write_tag("data", strf.datestr(time), ",")
        json.write_tag("resumo", post_excerpt, ",")
        json.write_tag("texto", post_desc, ",")

        json.write_comments(post_guid)

        json.write_close_tag("}", (row < user_blogs.rowcount))

    json.write_close_tag("]", True)

    user_blogs.close()
Ejemplo n.º 18
0
def write_groupvideos_subsection(xml, group_guid):
    group_videos = xml.database.cursor()

    # 12 = select * from elgg_entity_subtypes where subtype='videos';
    group_videos.execute(qry.qry_group_posts, (
        group_guid,
        12,
    ))

    # 399 = select * from elgg_metastrings where string='videos_enable';
    perm = qry.postcontent_permission(xml.database, group_guid, 399)

    xml.write_open_tag("videos", strf.permstr(perm))

    for (post_guid, post_title, post_desc, \
            owner_id, owner_name, owner_username, time)\
        in group_videos:

        # 477 = select * from elgg_metastrings where string='video_url';
        video_link = qry.post_content(xml.database, post_guid, 477)

        prefix = 'videos/view/'
        post_attr = strf.pidstr(strf.urlparticipa(prefix, str(post_guid)))
        xml.write_open_tag("video", post_attr)

        prefix = 'profile/'
        owner_attr = strf.uidstr(strf.urlparticipa(prefix, owner_username))
        xml.write_tag("autor", owner_name, owner_attr)
        xml.write_tag("titulo", post_title, '')
        xml.write_tag("data", strf.datestr(time), '')
        xml.write_tag("link", '', strf.hrefstr(video_link))
        xml.write_tag("descricao", strf.cdata(post_desc), '')

        xml.write_comments(post_guid)

        xml.write_close_tag("video")

    xml.write_close_tag("videos")

    group_videos.close()
Ejemplo n.º 19
0
def write_groupbookmarks_subsection(xml, group_guid):
    group_bookmarks = xml.database.cursor()

    # 13 = select * from elgg_entity_subtypes where subtype='bookmarks';
    group_bookmarks.execute(qry.qry_group_posts, (
        group_guid,
        13,
    ))

    # 49 = select * from elgg_metastrings where string='bookmarks_enable';
    perm = qry.postcontent_permission(xml.database, group_guid, 49)

    xml.write_open_tag("favoritos", strf.permstr(perm))

    for (post_guid, post_title, post_desc, \
            owner_id, owner_name, owner_username, time)\
        in group_bookmarks:

        # 90 = select * from elgg_metastrings where string='address';
        bookmark_link = qry.post_content(xml.database, post_guid, 90)

        prefix = 'bookmarks/view/'
        post_attr = strf.pidstr(strf.urlparticipa(prefix, str(post_guid)))
        xml.write_open_tag("favorito", post_attr)

        prefix = 'profile/'
        owner_attr = strf.uidstr(strf.urlparticipa(prefix, owner_username))
        xml.write_tag("autor", owner_name, owner_attr)
        xml.write_tag("titulo", post_title, '')
        xml.write_tag("data", strf.datestr(time), '')
        xml.write_tag("link", '', strf.hrefstr(bookmark_link))
        xml.write_tag("descricao", strf.cdata(post_desc), '')

        xml.write_comments(post_guid)

        xml.write_close_tag("favorito")

    xml.write_close_tag("favoritos")

    group_bookmarks.close()
Ejemplo n.º 20
0
def write_groupfiles_subsection(xml, group_guid):
    group_files = xml.database.cursor()

    # 1 = select * from elgg_entity_subtypes where subtype='file';
    group_files.execute(qry.qry_group_posts, (
        group_guid,
        1,
    ))

    # 50 = select * from elgg_metastrings where string='file_enable';
    perm = qry.postcontent_permission(xml.database, group_guid, 50)

    xml.write_open_tag("arquivos", strf.permstr(perm))

    for (post_guid, post_title, post_desc, \
            owner_id, owner_name, owner_username, time)\
        in group_files:

        prefix = 'file/download/'
        file_link = strf.urlparticipa(prefix, str(post_guid))

        prefix = 'file/view/'
        post_attr = strf.pidstr(strf.urlparticipa(prefix, str(post_guid)))
        xml.write_open_tag("arquivo", post_attr)

        prefix = 'profile/'
        owner_attr = strf.uidstr(strf.urlparticipa(prefix, owner_username))
        xml.write_tag("autor", owner_name, owner_attr)
        xml.write_tag("titulo", post_title, '')
        xml.write_tag("data", strf.datestr(time), '')
        xml.write_tag("link", '', strf.hrefstr(file_link))
        xml.write_tag("descricao", strf.cdata(post_desc), '')

        xml.write_comments(post_guid)

        xml.write_close_tag("arquivo")

    xml.write_close_tag("arquivos")

    group_files.close()
def write_userfiles_subsection(json, user_guid):
    user_files = json.database.cursor()

    # 1 = select * from elgg_entity_subtypes where subtype='file';
    user_files.execute(qry.qry_user_posts, (
        user_guid,
        user_guid,
        1,
    ))

    json.write_open_tag("arquivos", "[")

    row = 0
    for (post_guid, post_title, post_desc, time)\
        in user_files:

        row = row + 1

        prefix = "file/download/"
        file_link = strf.urlparticipa(prefix, str(post_guid))

        prefix = 'file/view/'
        post_attr = strf.urlparticipa(prefix, str(post_guid))

        json.write_open_tag("", "{")

        json.write_tag("pid", post_attr, ",")
        json.write_tag("titulo", post_title, ",")
        json.write_tag("data", strf.datestr(time), ",")
        json.write_tag("link", file_link, ",")
        json.write_tag("descricao", post_desc, ",")

        json.write_comments(post_guid)

        json.write_close_tag("}", (row < user_files.rowcount))

    json.write_close_tag("]", True)

    user_files.close()
def write_uservideos_subsection(json, user_guid):
    user_videos = json.database.cursor()

    # 12 = select * from elgg_entity_subtypes where subtype='videos';
    user_videos.execute(qry.qry_user_posts, (
        user_guid,
        user_guid,
        12,
    ))

    json.write_open_tag("videos", "[")

    row = 0
    for (post_guid, post_title, post_desc, time)\
        in user_videos:

        row = row + 1

        # 477 = select * from elgg_metastrings where string='video_url';
        video_link = qry.post_content(json.database, post_guid, 477)

        prefix = 'videos/view/'
        post_attr = strf.urlparticipa(prefix, str(post_guid))

        json.write_open_tag("", "{")

        json.write_tag("pid", post_attr, ",")
        json.write_tag("titulo", post_title, ",")
        json.write_tag("data", strf.datestr(time), ",")
        json.write_tag("link", video_link, ",")
        json.write_tag("descricao", post_desc, ",")

        json.write_comments(post_guid)

        json.write_close_tag("}", (row < user_videos.rowcount))

    json.write_close_tag("]", True)

    user_videos.close()
def write_userbookmarks_subsection(json, user_guid):
    user_bookmarks = json.database.cursor()

    # 13 = select * from elgg_entity_subtypes where subtype='bookmarks';
    user_bookmarks.execute(qry.qry_user_posts, (
        user_guid,
        user_guid,
        13,
    ))

    json.write_open_tag("favoritos", "[")

    row = 0
    for (post_guid, post_title, post_desc, time)\
        in user_bookmarks:

        row = row + 1

        # 90 = select * from elgg_metastrings where string='address';
        bookmark_link = qry.post_content(json.database, post_guid, 90)

        prefix = 'bookmarks/view/'
        post_attr = strf.urlparticipa(prefix, str(post_guid))
        json.write_open_tag("", "{")

        json.write_tag("pid", post_attr, ",")
        json.write_tag("titulo", post_title, ",")
        json.write_tag("data", strf.datestr(time), ",")
        json.write_tag("link", bookmark_link, ",")
        json.write_tag("descricao", post_desc, ",")

        json.write_comments(post_guid)

        json.write_close_tag("}", (row < user_bookmarks.rowcount))

    json.write_close_tag("]", True)

    user_bookmarks.close()
Ejemplo n.º 24
0
def write_groupforumtopics_subsection(xml, group_guid):
    group_forumtopics = xml.database.cursor()

    # 7 = select * from elgg_entity_subtypes where subtype='groupforumtopic';
    group_forumtopics.execute(qry.qry_group_posts, (
        group_guid,
        7,
    ))

    # 52 = select * from elgg_metastrings where string='forum_enable';
    perm = qry.postcontent_permission(xml.database, group_guid, 52)

    xml.write_open_tag("debates", strf.permstr(perm))

    for (post_guid, post_title, post_desc, \
        owner_id, owner_name, owner_username, time)\
        in group_forumtopics:

        prefix = 'discussion/view/'
        post_attr = strf.pidstr(strf.urlparticipa(prefix, str(post_guid)))
        xml.write_open_tag("debate", post_attr)

        prefix = 'profile/'
        owner_attr = strf.uidstr(strf.urlparticipa(prefix, owner_username))
        xml.write_tag("autor", owner_name, owner_attr)
        xml.write_tag("titulo", post_title, '')
        xml.write_tag("data", strf.datestr(time), '')
        xml.write_tag("texto", strf.cdata(post_desc), '')

        xml.write_comments(post_guid)

        xml.write_close_tag("debate")

    xml.write_close_tag("debates")

    group_forumtopics.close()
Ejemplo n.º 25
0
def write_grouppages_subsection(xml, group_guid):
    group_pages = xml.database.cursor()

    # 14 = select * from elgg_entity_subtypes where subtype='page_top';
    group_pages.execute(qry.qry_group_posts, (
        group_guid,
        14,
    ))

    # 53 = select * from elgg_metastrings where string='pages_enable';
    perm = qry.postcontent_permission(xml.database, group_guid, 53)

    xml.write_open_tag("paginas", strf.permstr(perm))

    for (post_guid, post_title, post_desc,
            owner_id, owner_name, owner_username, time)\
        in group_pages:

        prefix = 'pages/view/'
        post_attr = strf.pidstr(strf.urlparticipa(prefix, str(post_guid)))
        xml.write_open_tag("pagina", post_attr)

        prefix = 'profile/'
        owner_attr = strf.uidstr(strf.urlparticipa(prefix, owner_username))
        xml.write_tag("autor", owner_name, owner_attr)
        xml.write_tag("titulo", post_title, '')
        xml.write_tag("data", strf.datestr(time), '')
        xml.write_tag("texto", strf.cdata(post_desc), '')

        xml.write_comments(post_guid)

        xml.write_close_tag("pagina")

    xml.write_close_tag("paginas")

    group_pages.close()
def write_groupevents_subsection(json, group_guid):
    group_events = json.database.cursor()

    # 6 = select * from elgg_entity_subtypes where subtype='calendar_event';
    group_events.execute(qry.qry_group_posts, (
        group_guid,
        6,
    ))

    # 54 = select * from elgg_metastrings where string='event_calendar_enable';
    perm = qry.postcontent_permission(json.database, group_guid, 54)

    json.write_tag("eventosHabilitado", perm, ",")
    json.write_open_tag("eventos", "[")

    row = 0
    for (post_guid, post_title, post_desc, \
            owner_id, owner_name, owner_username, time)\
        in group_events:

        row = row + 1

        json.write_open_tag("", "{")

        # 18 = select * from elgg_metastrings where string='venue';
        venue = qry.post_content(json.database, post_guid, 18)

        # 20 = select * from elgg_metastrings where string='start_date';
        time_start = qry.post_content(json.database, post_guid, 20)

        # 22 = select * from elgg_metastrings where string='end_date';
        time_end = qry.post_content(json.database, post_guid, 22)

        # 26 = select * from elgg_metastrings where string='fees';
        fees = qry.post_content(json.database, post_guid, 26)

        # 28 = select * from elgg_metastrings where string='contact';
        contact = qry.post_content(json.database, post_guid, 28)

        # 30 = select * from elgg_metastrings where string='organizer';
        organizer = qry.post_content(json.database, post_guid, 30)

        prefix = 'event_calendar/view/'
        post_attr = strf.urlparticipa(prefix, str(post_guid))
        json.write_tag("pid", post_attr, ",")

        prefix = 'profile/'
        owner_attr = strf.urlparticipa(prefix, owner_username)

        json.write_open_tag("autor", "{")
        json.write_tag("uid", owner_attr, ",")
        json.write_tag("nome", owner_name, "")
        json.write_close_tag("}", True)

        json.write_tag("titulo", post_title, ",")
        json.write_tag("data", strf.datestr(time), ",")
        json.write_tag("organizador", organizer, ",")
        json.write_tag("contato", contact, ",")
        json.write_tag("endereco", venue, ",")
        json.write_tag("dataInicio", strf.datestr(time_start), ",")
        json.write_tag("dataFim", strf.datestr(time_end), ",")
        json.write_tag("taxaParticipacao", fees, ",")
        json.write_tag("descricao", post_desc, ",")

        json.write_comments(post_guid)

        json.write_close_tag("}", (row < group_events.rowcount))

    json.write_close_tag("]", False)

    group_events.close()