Beispiel #1
0
def create_group(request, site, template_name="plus_groups/create_group.html", current_app='plus_groups', **kwargs):

    if request.POST :
        form = TgGroupForm(request.POST)

        if not form.is_valid() :
            print form.errors
        else :
            group = form.save(request.user, site)

            from apps.plus_feed.models import FeedItem
            FeedItem.post_CREATE_GROUP(request.user, group.get_inner())

            return HttpResponseRedirect(reverse(current_app + ':group', args=(group.id,)))
    else :
        form = TgGroupForm()
    
    if current_app == 'groups' :
        name_of_created = "Group"
        is_hub = False
    else :
        name_of_created = hub_name()
        is_hub = True

    return render_to_response(template_name, {
            "head_title" : "Create New %s"%name_of_created,
            "name_of_created": name_of_created,
            "head_title_status" : "",
            "group" : form,
            "form" : form,
            "is_hub" : is_hub, 
            }, context_instance=RequestContext(request, current_app=current_app))
Beispiel #2
0
def create_group(request, site, template_name="plus_groups/create_group.html", current_app='plus_groups', **kwargs):

    if request.POST :
        form = TgGroupForm(request.POST)

        if not form.is_valid() :
            print form.errors
        else :
            group = form.save(request.user, site)
            return HttpResponseRedirect(reverse(current_app + ':group', args=(group.id,)))
    else :
        form = TgGroupForm()
    
    if current_app == 'groups' :
        name_of_created = "Group"
        is_hub = False
    else :
        name_of_created = hub_name()
        is_hub = True

    return render_to_response(template_name, {
            "head_title" : "Create New %s"%name_of_created,
            "name_of_created": name_of_created,
            "head_title_status" : "",
            "group" : form,
            "form" : form,
            "is_hub" : is_hub, 
            }, context_instance=RequestContext(request, current_app=current_app))
Beispiel #3
0
def change_group_avatar(request, group_id, **kwargs):
    target_obj = get_object_or_404(TgGroup, id=group_id)
    if target_obj.is_hub_type():
        from_name = hub_name()
    else:
        from_name = 'Group'

    return change_avatar(request, target_obj, 'group', from_name, **kwargs)
Beispiel #4
0
def change_group_avatar(request, group_id, **kwargs) :
    target_obj = get_object_or_404(TgGroup, id=group_id)
    if target_obj.is_hub_type() :
        from_name = hub_name()
    else :
        from_name = 'Group'

    return change_avatar(request, target_obj, 'group', from_name, **kwargs)
Beispiel #5
0
def get_search_types():
    v_groups = TgGroup.objects.virtual()
    hubs = TgGroup.objects.hubs()
    #('All', (None, None, _('All')))
    return (('Profile', ({'content_type__model':'profile'}, None, _('Members'))), 
            ('Group', ({'content_type__model':'tggroup', 'object_id__in':v_groups}, None, _('Groups'))), 
            #(hub_name(),({'content_type__model':'tggroup'}, {'object_id__in':v_groups}, _(hub_name_plural()))), 
            (hub_name(),({'content_type__model':'tggroup','object_id__in':hubs},None,_(hub_name_plural()))),
            ('Resource', ({'content_type__model__in':['resource', 'wikipage']}, None, _('Resources'))), 
            )
Beispiel #6
0
def show_group(context, group):
    #group = TemplateSecureWrapper(group)
    no_of_members = group.get_no_members()
    try:
        if group.place.name == settings.VIRTUAL_HUB_NAME:
            group_label = "group"
        else:
            group_label = hub_name().lower()
    except Location.DoesNotExist:
        group_label = "group"
    

    urlvar = group_label + u's:group'
    group_url = reverse(urlvar, args=[group.id])
    
    return {"group": group, "no_of_members":no_of_members, "group_label":group_label, "group_url":group_url}
Beispiel #7
0
def get_search_types():
    v_groups = TgGroup.objects.virtual()
    hubs = TgGroup.objects.hubs()
    #('All', (None, None, _('All')))
    return (
        ('Profile', ({
            'content_type__model': 'profile'
        }, None, _('Members'))),
        ('Group', ({
            'content_type__model': 'tggroup',
            'object_id__in': v_groups
        }, None, _('Groups'))),
        #(hub_name(),({'content_type__model':'tggroup'}, {'object_id__in':v_groups}, _(hub_name_plural()))),
        (hub_name(), ({
            'content_type__model': 'tggroup',
            'object_id__in': hubs
        }, None, _(hub_name_plural()))),
        ('Resource', ({
            'content_type__model__in': ['resource', 'wikipage']
        }, None, _('Resources'))),
    )
Beispiel #8
0
def show_resource(context, item):
    if item.in_agent.obj.place.name == settings.VIRTUAL_HUB_NAME:
        group_label = "group"
    else:
        group_label = hub_name().lower()

    if item.__class__.__name__ == 'SecureWrapper':
        item = item.get_inner()

    if item.__class__.__name__ == "WikiPage":
        url_name = "view_WikiPage"
        url_name = group_label + "s:" + url_name
        url = reverse(url_name, args=[item.in_agent.obj.id, item.name])
    elif item.__class__.__name__ == "Resource":
        #url_name = context.current_app + ":view_Resource"
        url_name = 'view_Resource'
        url_name = group_label + "s:" + url_name
        url = reverse(url_name, args=[item.in_agent.obj.id, item.name])
        #download_url = item.download_url()

    tags = get_tags(item)
    #item = TemplateSecureWrapper(item)
    return {'resource': item, 'resource_url': url, 'tags': tags}
Beispiel #9
0
def show_resource(context, item):
    if item.in_agent.obj.place.name == settings.VIRTUAL_HUB_NAME :
        group_label = "group"
    else:
        group_label = hub_name().lower()

    if item.__class__.__name__ == 'SecureWrapper' :
        item = item.get_inner()


    if item.__class__.__name__ == "WikiPage":
        url_name = "view_WikiPage"
        url_name = group_label + "s:"+ url_name
        url = reverse(url_name, args=[item.in_agent.obj.id, item.name])
    elif item.__class__.__name__ == "Resource":
        #url_name = context.current_app + ":view_Resource"
        url_name = 'view_Resource'
        url_name = group_label+"s:"+url_name
        url = reverse(url_name, args=[item.in_agent.obj.id, item.name])
        #download_url = item.download_url()

    tags = get_tags(item)
    #item = TemplateSecureWrapper(item)
    return {'resource':item, 'resource_url':url, 'tags':tags}
Beispiel #10
0
        def group_app_label(self):
            from apps.plus_lib.utils import hub_name

            if self.group_type == settings.GROUP_HUB_TYPE:
                return hub_name().lower() + 's'
            return 'groups'
Beispiel #11
0
 def get_url_root(self) :
     group_label = 'group'
     if self.in_agent.obj.is_hub_type():
         group_label = hub_name().lower()
     return group_label + "s:"
Beispiel #12
0
    create_group = False

    if request.user.is_authenticated() :
        try :
            if current_app == 'groups' :
                site.create_virtual
            else :
                site.create_hub
            create_group = True
        except Exception, e:
            print "User can't create a group",e


    if type == 'hub' :
        head_title = _(hub_name_plural())
        type_name = hub_name()
    else:
        head_title = _('Groups')
        type_name = "Group"
        
    search_types = narrow_search_types(type_name)
    search_types_len = len(search_types)
    search_type_label = search_types[0][1][2]
    search_type = current_app + ':groups'
    tag_search_type = current_app + ':groups_tag'


    all_results, search_types, tag_intersection  = plus_search(tags, search, search_types, order)

    
    return render_to_response(template_name, {'head_title':head_title, 
Beispiel #13
0
        def group_app_label(self):
            from apps.plus_lib.utils import hub_name

            if self.group_type == settings.GROUP_HUB_TYPE:
                return hub_name().lower()+'s'
            return 'groups'
Beispiel #14
0
        if has_access(request.user, None, 'Application.Accept', group._inner.get_security_context()):
            has_accept = True
        else:
            has_accept = False
    
    tweets = FeedItem.feed_manager.get_from_permissioned(group, request.user)

    try:
        group.get_all_sliders
        perms_bool = True
    except PlusPermissionsNoAccessException:
        perms_bool = False

    if kwargs['type'] == 'hub':
        type_name = hub_name()
    else:
        type_name = "Group"

    search_types = narrow_search_types(type_name)
    side_search = side_search_args(current_app + ':groups', search_types[0][1][2])

    search = request.GET.get('search', '')
    order = request.GET.get('order', '')
    resource_search = resources(group=group, search=search, order=order)
    resource_listing_args = listing_args(current_app + ':group_resources', current_app + ':group_resources_tag', tag_string='', search_terms=search, multitabbed=False, order=order, template_base='plus_lib/listing_frag.html', search_type_label='resources')
    resource_listing_args['group_id'] = group.id

    ##############Here we should use the "plus_search" function from plus_explore as above########

    member_search = a_member_search(group=group, search=search, order=order, 
Beispiel #15
0
 def get_url_root(self):
     group_label = 'group'
     if self.in_agent.obj.is_hub_type():
         group_label = hub_name().lower()
     return group_label + "s:"