예제 #1
0
def save_flowgram(request, flowgram, description, public, title, sent_owner_done_email, \
                      background_audio_loop, background_audio_volume, tags):
    if permissions.can_edit(request.user, flowgram):
        flowgram.description = description
        if public and not flowgram.public:
            flowgram.published_at = datetime.now()
        flowgram.public = public
        flowgram.title = title
        flowgram.sent_owner_done_email = sent_owner_done_email
        flowgram.background_audio_loop = background_audio_loop
        flowgram.background_audio_volume = background_audio_volume
        flowgram.save()
    
    if localsettings.FEATURE['subscriptions_fw']:
        data = {'fg_id': flowgram.id,
                'eventCode': 'FG_MADE'}
        data['active'] = 'make_active' if public else 'make_inactive'
        controller.store_fgmade_event(data)

    if request.POST.has_key('tags'):
        controller.set_tags(request.user, flowgram, tags)
        if localsettings.FEATURE['subscriptions_fw']:
            controller.store_fgtagged_event({'current_user': request.user,
                                            'fg_id': flowgram.id,
                                            'eventCode': 'FG_TAGGED'})
예제 #2
0
def add_tag(request, enc, flowgram, tag_name):
    tag_name = tag_name.strip()
    
    (tag, null) = models.Tag.objects.get_or_create(adder=request.user,
                                                   flowgram=flowgram,
                                                   name=tag_name)
    
    controller.record_stat(request, 'add_tag_website', '0', flowgram.id)
    
    if localsettings.FEATURE['notify_fw']:
        controller.store_fgtagged_event({'current_user': request.user,
                                         'fg_id': flowgram.id,
                                         'eventCode': 'FG_TAGGED'})

    return HttpResponse(tag.name)