def permission_block(context, object): """Block with objects permissions""" request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] response_format_tags = response_format if 'response_format_tags' in context: response_format_tags = context['response_format_tags'] if 'permission' in request.GET and request.user.profile.has_permission( object, mode='w'): if request.POST: if 'cancel' in request.POST: request.redirect = request.path return Markup( render_to_string('core/tags/permission_block', { 'object': object, 'path': request.path }, context_instance=RequestContext(request), response_format=response_format)) form = PermissionForm(request.POST, instance=object) if form.is_valid(): form.save() request.redirect = request.path return Markup( render_to_string('core/tags/permission_block', { 'object': object, 'path': request.path }, context_instance=RequestContext(request), response_format=response_format)) else: form = PermissionForm(instance=object) context = {'object': object, 'path': request.path, 'form': form} if 'ajax' in response_format_tags: context = converter.preprocess_context(context) return Markup( render_to_string('core/tags/permission_block_edit', context, context_instance=RequestContext(request), response_format=response_format)) return Markup( render_to_string('core/tags/permission_block', { 'object': object, 'path': request.path }, context_instance=RequestContext(request), response_format=response_format))
def attachment(request, object_id, update_id=None): dajax = Dajax() try: if object_id: attachments = Attachment.objects.filter( attached_object__id=object_id) template = 'core/tags/attachments_block' object_markup = render_to_string( template, { 'object_id': object_id, 'attachments': attachments }, context_instance=RequestContext(request), response_format='html') dajax.add_data( { 'target': 'div.attachment-block[object="{0!s}"]'.format(object_id), 'content': object_markup }, 'anaf.add_data') if update_id: attachments = Attachment.objects.filter( attached_record__id=update_id) template = 'core/tags/attachments_record_block' update_markup = render_to_string( template, { 'update_id': update_id, 'attachments': attachments }, context_instance=RequestContext(request), response_format='html') dajax.add_data( { 'target': 'div.attachment-record-block[object="{0!s}"]'.format( update_id), 'content': update_markup }, 'anaf.add_data') except Exception: pass return dajax.json()
def permission_block(context, object): """Block with objects permissions""" request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] response_format_tags = response_format if 'response_format_tags' in context: response_format_tags = context['response_format_tags'] if 'permission' in request.GET and request.user.profile.has_permission(object, mode='w'): if request.POST: if 'cancel' in request.POST: request.redirect = request.path return Markup(render_to_string('core/tags/permission_block', {'object': object, 'path': request.path}, context_instance=RequestContext( request), response_format=response_format)) form = PermissionForm(request.POST, instance=object) if form.is_valid(): form.save() request.redirect = request.path return Markup(render_to_string('core/tags/permission_block', {'object': object, 'path': request.path}, context_instance=RequestContext( request), response_format=response_format)) else: form = PermissionForm(instance=object) context = {'object': object, 'path': request.path, 'form': form} if 'ajax' in response_format_tags: context = converter.preprocess_context(context) return Markup(render_to_string('core/tags/permission_block_edit', context, context_instance=RequestContext( request), response_format=response_format)) return Markup(render_to_string('core/tags/permission_block', {'object': object, 'path': request.path}, context_instance=RequestContext(request), response_format=response_format))
def messaging_unread(context): "Print a number of unread messages" request = context['request'] user = None if request.user.username: try: user = request.user.profile except Exception: pass unread = 0 messaging = None if user: modules = user.get_perspective().get_modules() messaging = modules.filter(name='anaf.messaging') if messaging: unread = Object.filter_permitted( user, Message.objects.filter(reply_to__isnull=True).exclude( read_by=user)).count() response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup( render_to_string('messaging/tags/unread', { 'messaging': messaging, 'unread': unread }, context_instance=RequestContext(request), response_format=response_format))
def account_notification_count(context): """Account notification count""" request = context["request"] user = None if request.user.username: try: user = request.user.profile except Exception: pass notifications = 0 account = None if user: modules = user.get_perspective().get_modules() account = modules.filter(name="anaf.account") if account: notifications = user.notification_set.count() response_format = "html" if "response_format" in context: response_format = context["response_format"] return Markup( render_to_string( "account/tags/notification_count", {"account": account, "notifications": notifications}, response_format=response_format, ) )
def account_notification_count(context): """Account notification count""" request = context['request'] user = None if request.user.username: try: user = request.user.profile except Exception: pass notifications = 0 account = None if user: modules = user.get_perspective().get_modules() account = modules.filter(name='anaf.account') if account: notifications = user.notification_set.count() response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup( render_to_string('account/tags/notification_count', { 'account': account, 'notifications': notifications }, response_format=response_format))
def attachments(context, object=None): "Attachments for an object or update record" request = context['request'] profile = request.user.profile response_format = 'html' if 'response_format' in context: response_format = context['response_format'] update = isinstance(object, UpdateRecord) if not update: attachments = Attachment.objects.filter(attached_object=object) if profile.has_permission(object, mode='w'): template = 'core/tags/attachments' else: template = 'core/tags/attachments_block' else: attachments = Attachment.objects.filter(attached_record=object) if profile == object.author: template = 'core/tags/attachments_record' else: template = 'core/tags/attachments_record_block' return Markup( render_to_string(template, { 'object': object, 'attachments': attachments, }, context_instance=RequestContext(request), response_format=response_format))
def core_watchlist(context, objects=None, skip_group=False, paginate=False): "Print a list of objects a user is subscribed to" request = context['request'] profile = request.user.profile if not objects: objects = profile.subscriptions.all() if 'unsubscribe' in request.GET: for object in objects.filter(pk=request.GET.get('unsubscribe')): object.subscribers.remove(profile) objects = profile.subscriptions.all() pathurl = request.path + '?' if request.GET: params = request.GET.copy() if 'unsubscribe' in params: del params['unsubscribe'] pathurl += urllib.urlencode(params) + '&' response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup( render_to_string('core/tags/watchlist', { 'objects': objects, 'skip_group': skip_group, 'dopaginate': paginate, 'pathurl': pathurl }, context_instance=RequestContext(request), response_format=response_format))
def attachments_block(context, object=None): "Attachments for an object or update record" request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] update = isinstance(object, UpdateRecord) if not update: attachments = Attachment.objects.filter(attached_object=object) template = 'core/tags/attachments_block' else: attachments = Attachment.objects.filter(attached_record=object) template = 'core/tags/attachments_record_block' return Markup( render_to_string(template, { 'object': object, 'attachments': attachments, }, context_instance=RequestContext(request), response_format=response_format))
def user_block(context): """User block :param Context context: """ request = context["request"] user = request.user.profile modules = user.get_perspective().get_modules() account = modules.filter(name="anaf.account") admin = modules.filter(name="anaf.core") if admin: admin = admin[0] response_format = "html" if "response_format" in context: response_format = context["response_format"] trial = False if settings.ANAF_SUBSCRIPTION_USER_LIMIT == 3: trial = True active = context.get("active") return Markup( render_to_string( "core/tags/user_block", {"user": user, "account": account, "admin": admin, "active": active, "trial": trial}, response_format=response_format, ) )
def projects_task_list(context, tasks, time_slots=None, nomass=False, in_progress=False, by_project=False, by_milestone=False, by_assigned=False, noheader=False): "Print a list of tasks" if time_slots is None: time_slots = [] request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup( render_to_string('projects/tags/task_list', { 'tasks': tasks, 'nomass': nomass, 'by_project': by_project, 'by_milestone': by_milestone, 'by_assigned': by_assigned, 'in_progress': in_progress, 'noheader': noheader, 'time_slots': time_slots }, context_instance=RequestContext(request), response_format=response_format))
def services_ticket_list(context, tickets, skip_group=False, tick_group=None, nomass=False, group_by=None, by_assigned=False, by_status=False, noheader=False): "Print a list of tickets" request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup( render_to_string('services/tags/ticket_list', { 'tickets': tickets, 'tick_group': tick_group, 'skip_group': skip_group, 'by_assigned': by_assigned, 'by_status': by_status, 'group_by': group_by, 'noheader': noheader, 'nomass': nomass }, context_instance=RequestContext(request), response_format=response_format))
def messaging_unread(context): "Print a number of unread messages" request = context['request'] user = None if request.user.username: try: user = request.user.profile except Exception: pass unread = 0 messaging = None if user: modules = user.get_perspective().get_modules() messaging = modules.filter(name='anaf.messaging') if messaging: unread = Object.filter_permitted(user, Message.objects.filter(reply_to__isnull=True).exclude(read_by=user)).count() response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup(render_to_string('messaging/tags/unread', {'messaging': messaging, 'unread': unread}, context_instance=RequestContext(request), response_format=response_format))
def user_block(context): """User block :param Context context: """ request = context['request'] user = request.user.profile modules = user.get_perspective().get_modules() account = modules.filter(name='anaf.account') admin = modules.filter(name='anaf.core') if admin: admin = admin[0] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] trial = False if settings.ANAF_SUBSCRIPTION_USER_LIMIT == 3: trial = True active = context.get('active') return Markup(render_to_string('core/tags/user_block', {'user': user, 'account': account, 'admin': admin, 'active': active, 'trial': trial}, response_format=response_format))
def attachments(context, object=None): "Attachments for an object or update record" request = context['request'] profile = request.user.profile response_format = 'html' if 'response_format' in context: response_format = context['response_format'] update = isinstance(object, UpdateRecord) if not update: attachments = Attachment.objects.filter(attached_object=object) if profile.has_permission(object, mode='w'): template = 'core/tags/attachments' else: template = 'core/tags/attachments_block' else: attachments = Attachment.objects.filter(attached_record=object) if profile == object.author: template = 'core/tags/attachments_record' else: template = 'core/tags/attachments_record_block' return Markup(render_to_string(template, {'object': object, 'attachments': attachments, }, context_instance=RequestContext(request), response_format=response_format))
def core_watchlist(context, objects=None, skip_group=False, paginate=False): "Print a list of objects a user is subscribed to" request = context['request'] profile = request.user.profile if not objects: objects = profile.subscriptions.all() if 'unsubscribe' in request.GET: for object in objects.filter(pk=request.GET.get('unsubscribe')): object.subscribers.remove(profile) objects = profile.subscriptions.all() pathurl = request.path + '?' if request.GET: params = request.GET.copy() if 'unsubscribe' in params: del params['unsubscribe'] pathurl += urllib.urlencode(params) + '&' response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup(render_to_string('core/tags/watchlist', {'objects': objects, 'skip_group': skip_group, 'dopaginate': paginate, 'pathurl': pathurl}, context_instance=RequestContext(request), response_format=response_format))
def logo_block_container(context): "Returns logo_block_container" # request = context['request'] response_format = "html" return Markup(render_to_string("core/tags/logo_block_container", response_format=response_format))
def demo_user(context): "Print demo block if demo" response_format = "html" demo = settings.ANAF_DEMO_MODE return Markup(render_to_string("core/tags/demo_user", {"demo": demo}, response_format=response_format))
def logo_block_container(context): "Returns logo_block_container" # request = context['request'] response_format = 'html' return Markup(render_to_string('core/tags/logo_block_container', response_format=response_format))
def email_caller_on_new_ticket(sender, instance, created, **kwargs): "When a new ticket is created send an email to the caller" if created: send_email_to_caller = False try: conf = ModuleSetting.get_for_module( 'anaf.services', 'send_email_to_caller')[0] send_email_to_caller = conf.value except: send_email_to_caller = settings.ANAF_SEND_EMAIL_TO_CALLER if send_email_to_caller: # don't send email to yourself creator_contact = None if instance.creator: creator_contact = instance.creator.get_contact() if instance.caller and instance.caller != creator_contact: if not instance.reference: if instance.queue: instance.reference = instance.queue.ticket_code + \ str(instance.id) else: instance.reference = str(instance.id) instance.save() subject = "[#{0!s}] {1!s}".format(instance.reference, instance.name) # Construct context and render to html, body context = {'ticket': instance} try: conf = ModuleSetting.get_for_module( 'anaf.services', 'send_email_template')[0] send_email_template = conf.value html = render_string_template(send_email_template, context) except: html = render_to_string( 'services/emails/notify_caller', context, response_format='html') body = strip_tags(html) if instance.queue and instance.queue.message_stream: stream = instance.queue.message_stream if stream.outgoing_server_name: try: caller_email = instance.caller.get_email() if caller_email: toaddr = caller_email ssl = False if stream.outgoing_server_type == 'SMTP-SSL': ssl = True email = BaseEmail(stream.outgoing_server_name, stream.outgoing_server_username, stream.outgoing_password, stream.outgoing_email, toaddr, subject, body, html=html, ssl=ssl) email.process_email() except: pass
def tags_box(context, object): request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] response_format_tags = response_format if 'response_format_tags' in context: response_format_tags = context['response_format_tags'] tags = object.tags.all() form = None if 'tags-edit' in request.GET: if request.POST.get('tags_object', 0) == unicode(object.id): form = TagsForm(tags, request.POST) if form.is_valid(): if 'multicomplete_tags' in request.POST: tag_names = request.POST.get('multicomplete_tags').split( ',') new_tags = [] for name in tag_names: name = name.strip() if name: try: tag = Tag.objects.get(name=name) except Tag.DoesNotExist: tag = Tag(name=name) tag.save() new_tags.append(tag) else: new_tags = form.is_valid() object.tags.clear() for tag in new_tags: object.tags.add(tag) tags = object.tags.all() form = None else: form = TagsForm(tags) context = { 'object': object, 'tags': tags, 'form': form, 'editlink': request.path + '?tags-edit' } if 'ajax' in response_format_tags: context = converter.preprocess_context(context) return Markup( render_to_string('core/tags/tags_box', context, context_instance=RequestContext(request), response_format=response_format))
def demo_user(context): "Print demo block if demo" response_format = 'html' demo = settings.ANAF_DEMO_MODE return Markup(render_to_string('core/tags/demo_user', {'demo': demo}, response_format=response_format))
def object_tree_path(context, object, skipself=False): "Object tree path" response_format = 'html' if 'response_format' in context: response_format = context['response_format'] path = object.get_tree_path(skipself) return Markup(render_to_string('core/tags/object_tree_path', {'path': path, 'skipself': skipself}, response_format=response_format))
def changes_set_list(context, changesets): """Print a list of ChangeSets""" request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup(render_to_string('changes/tags/changeset_list', {'changesets': changesets}, context_instance=RequestContext(request), response_format=response_format))
def infrastructure_item_list(context, items, skip_group=False): """Print a list of tasks""" request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup(render_to_string('infrastructure/tags/item_list', {'items': items, 'skip_group': skip_group}, context_instance=RequestContext(request), response_format=response_format))
def identities_user_list(context, users, skip_group=False): "Print a list of users" request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup(render_to_string('identities/tags/user_list', {'users': users, 'skip_group': skip_group}, context_instance=RequestContext(request), response_format=response_format))
def sales_lead_list(context, leads, skip_group=False): """Print a list of leads""" request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup(render_to_string('sales/tags/lead_list', {'leads': leads, 'skip_group': skip_group}, context_instance=RequestContext(request), response_format=response_format))
def tags_box(context, object): request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] response_format_tags = response_format if 'response_format_tags' in context: response_format_tags = context['response_format_tags'] tags = object.tags.all() form = None if 'tags-edit' in request.GET: if request.POST.get('tags_object', 0) == unicode(object.id): form = TagsForm(tags, request.POST) if form.is_valid(): if 'multicomplete_tags' in request.POST: tag_names = request.POST.get( 'multicomplete_tags').split(',') new_tags = [] for name in tag_names: name = name.strip() if name: try: tag = Tag.objects.get(name=name) except Tag.DoesNotExist: tag = Tag(name=name) tag.save() new_tags.append(tag) else: new_tags = form.is_valid() object.tags.clear() for tag in new_tags: object.tags.add(tag) tags = object.tags.all() form = None else: form = TagsForm(tags) context = {'object': object, 'tags': tags, 'form': form, 'editlink': request.path + '?tags-edit'} if 'ajax' in response_format_tags: context = converter.preprocess_context(context) return Markup(render_to_string('core/tags/tags_box', context, context_instance=RequestContext(request), response_format=response_format))
def events_event_list(context, events): "Print a list of events" request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup(render_to_string('events/tags/event_list', {'events': events}, context_instance=RequestContext(request), response_format=response_format))
def administration_module_list(context, modules): "Print a list of users" request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup(render_to_string('core/administration/tags/module_list', {'modules': modules}, context_instance=RequestContext(request), response_format=response_format))
def news_update_list(context, updates, skip_group=False): """Print a list of orders""" request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup( render_to_string('news/tags/update_list', {'updates': updates}, context_instance=RequestContext(request), response_format=response_format))
def administration_user_list(context, users, skip_group=False): """Print a list of users""" request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup(render_to_string('core/administration/tags/user_list', {'users': users, 'skip_group': skip_group}, context_instance=RequestContext(request), response_format=response_format))
def documents_weblink_list(context, links, skip_group=False): "Print a list of links" request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup(render_to_string('documents/tags/weblink_list', {'links': links, 'skip_group': skip_group}, context_instance=RequestContext(request), response_format=response_format))
def tags(request, target, object_id, edit=False, formdata=None): if formdata is None: formdata = {} dajax = Dajax() response_format = 'html' obj = Object.objects.get(pk=object_id) tags = obj.tags.all() form = None if 'tags' in formdata and not type(formdata['tags']) == list: formdata['tags'] = [formdata['tags']] if edit or formdata: if formdata.get('tags_object', 0) == unicode(obj.id): form = TagsForm(tags, formdata) if form.is_valid(): if 'multicomplete_tags' in formdata: tag_names = formdata.get('multicomplete_tags').split(',') new_tags = [] for name in tag_names: name = name.strip() if name: try: tag = Tag.objects.get(name=name) except Tag.DoesNotExist: tag = Tag(name=name) tag.save() new_tags.append(tag) else: new_tags = form.is_valid() obj.tags.clear() for tag in new_tags: obj.tags.add(tag) tags = obj.tags.all() form = None else: form = TagsForm(tags) context = {'object': obj, 'tags': tags, 'form': form} context = converter.preprocess_context(context) output = render_to_string('core/ajax/tags_box', context, context_instance=RequestContext(request), response_format=response_format) dajax.add_data({'target': target, 'content': output}, 'anaf.add_data') return dajax.json()
def changes_set_list(context, changesets): """Print a list of ChangeSets""" request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup( render_to_string('changes/tags/changeset_list', {'changesets': changesets}, context_instance=RequestContext(request), response_format=response_format))
def projects_time_slot_list(context, time_slots, no_dates=False): "Print a list of time slots" request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup(render_to_string('projects/tags/time_slot_list', {'time_slots': time_slots, 'no_dates': no_dates}, context_instance=RequestContext(request), response_format=response_format))
def services_queue_list(context, queues, skip_group=False): "Print a list of queues" request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup(render_to_string('services/tags/queue_list', {'queues': queues, 'skip_group': skip_group}, context_instance=RequestContext(request), response_format=response_format))
def documents_objects_list(context, objects, folder, skip_group=False): "Print a list of all objects" request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup(render_to_string('documents/tags/objects_list', {'objects': objects, 'skip_group': skip_group, 'folder': folder}, context_instance=RequestContext(request), response_format=response_format))
def sales_product_list(context, products, skip_group=False): "Print a list of products" request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup(render_to_string('sales/tags/product_list', {'products': products, 'skip_group': skip_group}, context_instance=RequestContext(request), response_format=response_format))
def documents_document_list(context, documents, skip_group=False): """Print a list of documents""" request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup(render_to_string('documents/tags/document_list', {'documents': documents, 'skip_group': skip_group}, context_instance=RequestContext(request), response_format=response_format))
def finance_liability_list(context, liabilities, skip_group=False): "Print a list of orders" request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup(render_to_string('finance/tags/liability_list', {'liabilities': liabilities, 'skip_group': skip_group}, context_instance=RequestContext(request), response_format=response_format))
def knowledge_folder_list(context, subfolders, skip_group=False): "Print a list of types" request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup(render_to_string('knowledge/tags/folder_list', {'subfolders': subfolders, 'skip_group': skip_group}, context_instance=RequestContext(request), response_format=response_format))
def object_tree_path(context, object, skipself=False): "Object tree path" response_format = "html" if "response_format" in context: response_format = context["response_format"] path = object.get_tree_path(skipself) return Markup( render_to_string( "core/tags/object_tree_path", {"path": path, "skipself": skipself}, response_format=response_format ) )
def sales_opportunity_list(context, opportunities, skip_group=False): "Print a list of opportunitys" request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup(render_to_string('sales/tags/opportunity_list', {'opportunities': opportunities, 'skip_group': skip_group}, context_instance=RequestContext(request), response_format=response_format))
def finance_transaction_list(context, transactions, skip_group=False): "Print a list of orders" request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup(render_to_string('finance/tags/transaction_list', {'transactions': transactions, 'skip_group': skip_group}, context_instance=RequestContext(request), response_format=response_format))
def easy_invite_block(context, emails=None): "The humanized datetime of the last update to an object" if emails is None: emails = [] request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup(render_to_string('core/tags/easy_invite', {'emails': emails, }, context_instance=RequestContext(request), response_format=response_format))
def show_hint(context, hint=None, object=None): "Generic hint framework" request = context['request'] response_format = 'html' user = None if request.user.username: try: user = request.user.profile except Exception: pass return Markup(render_to_string('core/hints/' + hint, {'user': user, 'object': object}, response_format=response_format))
def documents_weblink_list(context, links, skip_group=False): "Print a list of links" request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup( render_to_string('documents/tags/weblink_list', { 'links': links, 'skip_group': skip_group }, context_instance=RequestContext(request), response_format=response_format))
def documents_document_list(context, documents, skip_group=False): """Print a list of documents""" request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup( render_to_string('documents/tags/document_list', { 'documents': documents, 'skip_group': skip_group }, context_instance=RequestContext(request), response_format=response_format))
def services_queue_list(context, queues, skip_group=False): "Print a list of queues" request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup( render_to_string('services/tags/queue_list', { 'queues': queues, 'skip_group': skip_group }, context_instance=RequestContext(request), response_format=response_format))
def projects_time_slot_list(context, time_slots, no_dates=False): "Print a list of time slots" request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup( render_to_string('projects/tags/time_slot_list', { 'time_slots': time_slots, 'no_dates': no_dates }, context_instance=RequestContext(request), response_format=response_format))
def infrastructure_servicing_list(context, items, skip_group=False): """Print a list of tasks""" request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup( render_to_string('infrastructure/tags/servicing_list', { 'service_records': items, 'skip_group': skip_group }, context_instance=RequestContext(request), response_format=response_format))
def identities_group_list(context, groups, skip_group=False): "Print a list of groups" request = context['request'] response_format = 'html' if 'response_format' in context: response_format = context['response_format'] return Markup( render_to_string('identities/tags/group_list', { 'groups': groups, 'skip_group': skip_group }, context_instance=RequestContext(request), response_format=response_format))