def get(self, request): context = {} context[ 'system_settings_graphid'] = settings.SYSTEM_SETTINGS_RESOURCE_MODEL_ID context['graph_models'] = [] context['graphs'] = '[]' context['app_title'] = APP_TITLE context['plugins'] = [] context['plugin_labels'] = { 'active-consultations': 'Active', 'init-workflow': 'New' } context['icon'] = 'fa-info' context['title'] = 'Help' context['createable_resources'] = JSONSerializer().serialize( get_createable_resource_types(self.request.user), exclude=[ 'functions', 'ontology', 'subtitle', 'color', 'isactive', 'isresource', 'version', 'deploymentdate', 'deploymentfile', 'author' ]) context['main_script'] = 'views/consultations-help' user_check = request.user.is_authenticated and request.user.username != 'anonymous' for plugin in models.Plugin.objects.all().order_by('sortorder'): if plugin.slug in context['plugin_labels'].keys( ) and request.user.has_perm('view_plugin', plugin) and user_check: plugin.name = context['plugin_labels'][plugin.slug] context['plugins'].append(plugin) context['user_is_reviewer'] = request.user.groups.filter( name='Resource Reviewer').exists() return render(request, 'views/consultations-help.htm', context)
def get_context_data(self, **kwargs): context = super(BaseManagerView, self).get_context_data(**kwargs) context['system_settings_graphid'] = settings.SYSTEM_SETTINGS_RESOURCE_MODEL_ID context['graph_models'] = [] context['graphs'] = '[]' context['createable_resources'] = JSONSerializer().serialize( get_createable_resource_types(self.request.user), exclude=['functions', 'ontology', 'subtitle', 'color', 'isactive', 'isresource', 'version', 'deploymentdate', 'deploymentfile', 'author']) context['nav'] = { 'icon': 'fa fa-chevron-circle-right', 'title': '', 'help': { # title:'',template:'' (leave this commented out) }, 'menu': False, 'search': True, 'res_edit': False, 'login': True, 'print': False, } context['user_is_reviewer'] = self.request.user.groups.filter(name='Resource Reviewer').exists() context['app_name'] = settings.APP_NAME context['iiif_manifests'] = models.IIIFManifest.objects.all() return context
def get_context_data(self, **kwargs): context = super(BaseManagerView, self).get_context_data(**kwargs) context[ "system_settings_graphid"] = settings.SYSTEM_SETTINGS_RESOURCE_MODEL_ID context["graph_models"] = [] context["graphs"] = "[]" context["plugins"] = [] for plugin in models.Plugin.objects.all().order_by("sortorder"): if self.request.user.has_perm("view_plugin", plugin): context["plugins"].append(plugin) createable = get_createable_resource_types(self.request.user) createable.sort(key=lambda x: x.name.lower()) context["createable_resources"] = JSONSerializer().serialize( createable, exclude=[ "functions", "ontology", "isactive", "isresource", "version", "deploymentdate", "deploymentfile", "author", ], ) context["notifications"] = models.UserXNotification.objects.filter( recipient=self.request.user, isread=False) context["nav"] = { "icon": "fa fa-chevron-circle-right", "title": "", "help": { # title:'',template:'' (leave this commented out) }, "menu": False, "search": True, "notifs": True, "res_edit": False, "login": True, "print": False, } context["user_is_reviewer"] = user_is_resource_reviewer( self.request.user) context["user_can_edit"] = len( get_editable_resource_types(self.request.user)) > 0 context["user_can_read"] = (len( get_resource_types_by_perm(self.request.user, [ "models.write_nodegroup", "models.delete_nodegroup", "models.read_nodegroup" ])) > 0) context["app_name"] = settings.APP_NAME context["show_language_swtich"] = settings.SHOW_LANGUAGE_SWITCH return context
def get_context_data(self, **kwargs): datatype_factory = DataTypeFactory() context = super(BaseManagerView, self).get_context_data(**kwargs) context[ 'system_settings_graphid'] = settings.SYSTEM_SETTINGS_RESOURCE_MODEL_ID context['graph_models'] = models.GraphModel.objects.all().exclude( graphid=settings.SYSTEM_SETTINGS_RESOURCE_MODEL_ID) context['graphs'] = JSONSerializer().serialize(context['graph_models']) context['createable_resources'] = JSONSerializer().serialize( get_createable_resource_types(self.request.user)) context['nav'] = { 'icon': 'fa fa-chevron-circle-right', 'title': '', 'help': ('', ''), 'menu': False, 'search': True, 'res_edit': False, 'login': True, 'print': False, } geom_datatypes = [ d.pk for d in models.DDataType.objects.filter(isgeometric=True) ] geom_nodes = models.Node.objects.filter( graph__isresource=True, graph__isactive=True, datatype__in=geom_datatypes).exclude( graph__graphid=settings.SYSTEM_SETTINGS_RESOURCE_MODEL_ID) resource_layers = [] resource_sources = [] for node in geom_nodes: if self.request.user.has_perm('read_nodegroup', node.nodegroup): datatype = datatype_factory.get_instance(node.datatype) map_source = datatype.get_map_source(node) if map_source is not None: resource_sources.append(map_source) map_layer = datatype.get_map_layer(node) if map_layer is not None: resource_layers.append(map_layer) context['app_name'] = settings.APP_NAME context['geom_nodes'] = geom_nodes context['resource_map_layers'] = resource_layers context['resource_map_sources'] = resource_sources context['iiif_manifests'] = models.IIIFManifest.objects.all() return context
def get_context_data(self, **kwargs): context = super(BaseManagerView, self).get_context_data(**kwargs) context[ "system_settings_graphid"] = settings.SYSTEM_SETTINGS_RESOURCE_MODEL_ID context["graph_models"] = [] context["graphs"] = "[]" context["plugins"] = [] for plugin in models.Plugin.objects.all().order_by("sortorder"): if self.request.user.has_perm("view_plugin", plugin): context["plugins"].append(plugin) context["createable_resources"] = JSONSerializer().serialize( get_createable_resource_types(self.request.user), exclude=[ "functions", "ontology", "subtitle", "color", "isactive", "isresource", "version", "deploymentdate", "deploymentfile", "author", ], ) context["notifications"] = models.Notification.objects.filter( recipient_id=self.request.user, is_read=False) context["nav"] = { "icon": "fa fa-chevron-circle-right", "title": "", "help": { # title:'',template:'' (leave this commented out) }, "menu": False, "search": True, "notifs": True, "res_edit": False, "login": True, "print": False, } context["user_is_reviewer"] = self.request.user.groups.filter( name="Resource Reviewer").exists() context["app_name"] = settings.APP_NAME return context
def get_context_data(self, **kwargs): context = super(BaseManagerView, self).get_context_data(**kwargs) context['system_settings_graphid'] = settings.SYSTEM_SETTINGS_RESOURCE_MODEL_ID context['graph_models'] = [] context['graphs'] = '[]' context['createable_resources'] = JSONSerializer().serialize(get_createable_resource_types(self.request.user)) context['nav'] = { 'icon':'fa fa-chevron-circle-right', 'title':'', 'help':('',''), 'menu':False, 'search':True, 'res_edit':False, 'login':True, 'print':False, } context['app_name'] = settings.APP_NAME context['iiif_manifests'] = models.IIIFManifest.objects.all() return context
def get_context_data(self, **kwargs): datatype_factory = DataTypeFactory() context = super(BaseManagerView, self).get_context_data(**kwargs) context['system_settings_graphid'] = settings.SYSTEM_SETTINGS_RESOURCE_MODEL_ID context['graph_models'] = models.GraphModel.objects.all().exclude(graphid=settings.SYSTEM_SETTINGS_RESOURCE_MODEL_ID) context['graphs'] = JSONSerializer().serialize(context['graph_models']) context['createable_resources'] = JSONSerializer().serialize(get_createable_resource_types(self.request.user)) context['nav'] = { 'icon':'fa fa-chevron-circle-right', 'title':'', 'help':('',''), 'menu':False, 'search':True, 'res_edit':False, 'login':True, 'print':False, } context['use_semantic_relationships'] = settings.USE_SEMANTIC_RESOURCE_RELATIONSHIPS geom_datatypes = [d.pk for d in models.DDataType.objects.filter(isgeometric=True)] geom_nodes = models.Node.objects.filter(graph__isresource=True, graph__isactive=True, datatype__in=geom_datatypes).exclude(graph__graphid=settings.SYSTEM_SETTINGS_RESOURCE_MODEL_ID) resource_layers = [] resource_sources = [] for node in geom_nodes: if self.request.user.has_perm('read_nodegroup', node.nodegroup): datatype = datatype_factory.get_instance(node.datatype) map_source = datatype.get_map_source(node) if map_source is not None: resource_sources.append(map_source) map_layer = datatype.get_map_layer(node) if map_layer is not None: resource_layers.append(map_layer) context['app_name'] = settings.APP_NAME context['geom_nodes'] = geom_nodes context['resource_map_layers'] = resource_layers context['resource_map_sources'] = resource_sources context['iiif_manifests'] = models.IIIFManifest.objects.all() return context
def get_context_data(self, **kwargs): context = super(BaseManagerView, self).get_context_data(**kwargs) context[ 'system_settings_graphid'] = settings.SYSTEM_SETTINGS_RESOURCE_MODEL_ID context['graph_models'] = [] context['graphs'] = '[]' context['createable_resources'] = JSONSerializer().serialize( get_createable_resource_types(self.request.user)) context['nav'] = { 'icon': 'fa fa-chevron-circle-right', 'title': '', 'help': ('', ''), 'menu': False, 'search': True, 'res_edit': False, 'login': True, 'print': False, } context['app_name'] = settings.APP_NAME context['iiif_manifests'] = models.IIIFManifest.objects.all() return context
def can_create_resource_instance(user): return len(get_createable_resource_types(user)) > 0
def can_create_resource_instance(user): return len(get_createable_resource_types(user)) > 0