def contentContext(request, project): from pyworkflow.gui.tree import ProjectRunsTreeProvider projectName = project.getShortName() print "ProjectName: ", projectName project_settings = project.getSettings() request.session['projectPath'] = project.getPath() request.session['projectName'] = projectName provider = ProjectRunsTreeProvider(project) runs = formatProvider(provider, "runs") request.session['runs'] = runs # Get the selected runs stored in BD selectedRuns = project_settings.runSelection # Get the run mode view (0:list / 1:graph / 2:small graph) stored in BD runsView = project_settings.runsView.get() # load the protocol tree current active htmlTree = loadProtTree(project) # get the choices to load protocol trees choices = project.getProtocolViews() # get the choice current choiceSelected = choices.index(project.getCurrentProtocolView().text.get()) # show the project name in the header.html projectNameHeader = 'Project ' + str(projectName) context = { 'projectName': projectName, 'view': 'protocols', 'editTool': getResourceIcon('edit_toolbar'), 'copyTool': getResourceIcon('copy_toolbar'), 'deleteTool': getResourceIcon('delete_toolbar'), 'browseTool': getResourceIcon('browse_toolbar'), 'stopTool': getResourceIcon('stop_toolbar'), 'analyzeTool': getResourceIcon('analyze_toolbar'), 'treeTool': getResourceIcon('tree_toolbar'), 'listTool': getResourceIcon('list_toolbar'), 'graph_utils': getResourceJs('graph_utils'), 'project_content_utils': getResourceJs('project_content_utils'), 'jquery_cookie': getResourceJs('jquery_cookie'), 'jquery_treeview': getResourceJs('jquery_treeview'), 'project_content_css': getResourceCss('project_content'), 'protTreeHtml': htmlTree, 'choices': choices, 'choiceSelected': choiceSelected, 'runs': runs, 'columns': provider.getColumns(), 'projectNameHeader': projectNameHeader, 'runsView': runsView, 'selectedRuns': selectedRuns } context = base_flex(request, context) return context
def VARS_base(request, context): from pyworkflow.web.app.properties import MessageWeb, ColorWeb, IconWeb # Properties class messages = MessageWeb() colors = ColorWeb() icons = IconWeb() context_base = { # ABSOLUTE PATH URL CONFIG 'abs_url': getAbsoluteURL(), 'config': getResourceJs('config'), 'js_root': getResourceJs(), 'css_root': getResourceCss(), 'analytics': django_settings.ANALYTICS_SCRIPT, # OTHER 'msg': messages, 'color': colors, 'icon': icons, 'cwd': os.getcwd() # Not used? } context.update(context_base) return context
def base(request, context): # Keep existing service name previously set by any of the webtools serviceName = getVarFromRequest(request, SERVICE_NAME) if serviceName is None and SERVICE_NAME in context: serviceName = context[SERVICE_NAME] context_base = { # ICON 'favicon': getResourceIcon('favicon'), 'logo_scipion': getResourceIcon('logo_scipion'), 'logo_scipion_transparent': getResourceIcon('logo_scipion_transparent'), # CSS 'general_css': getResourceCss('general'), 'messi_css': getResourceCss('messi'), 'font_awesome': getResourceCss('font_awesome'), # JS 'jquery': getResourceJs('jquery'), 'messi_js': getResourceJs('messi'), # JS 'utils': getResourceJs('utils'), "projectName": getVarFromRequest(request, PROJECT_NAME), SERVICE_NAME: serviceName } context = VARS_base(request, context) context.update(context_base) return context
def contentContext(request, project, serviceName=None): from pyworkflow.gui.tree import ProjectRunsTreeProvider projectName = project.getShortName() if serviceName is None: serviceName = getVarFromRequest(request, SERVICE_NAME) project_settings = project.getSettings() request.session[CTX_PROJECT_PATH] = project.getPath() request.session[PROJECT_NAME] = projectName provider = ProjectRunsTreeProvider(project) runs = formatProvider(provider, "runs") request.session['runs'] = runs # Get the selected runs stored in BD selectedRuns = project_settings.runSelection # Get the run mode view (0:list / 1:graph / 2:small graph) stored in BD runsView = project_settings.runsView.get() # load the protocol tree current active htmlTree = loadProtTree(project, serviceName) # get the choices to load protocol trees choices = project.getProtocolViews() # get the choice current choiceSelected = choices.index(project.getCurrentProtocolView().text.get()) context = { CTX_PROJECT_NAME: projectName, 'view': 'protocols', 'editTool': getResourceIcon('edit_toolbar'), 'copyTool': getResourceIcon('copy_toolbar'), 'deleteTool': getResourceIcon('delete_toolbar'), 'browseTool': getResourceIcon('browse_toolbar'), 'stopTool': getResourceIcon('stop_toolbar'), 'analyzeTool': getResourceIcon('analyze_toolbar'), 'treeTool': getResourceIcon('tree_toolbar'), 'listTool': getResourceIcon('list_toolbar'), 'graph_utils': getResourceJs('graph_utils'), 'project_content_utils': getResourceJs('project_content_utils'), 'jquery_cookie': getResourceJs('jquery_cookie'), 'jquery_treeview': getResourceJs('jquery_treeview'), 'project_content_css': getResourceCss('project_content'), 'protTreeHtml': htmlTree, 'choices': choices, 'choiceSelected': choiceSelected, 'runs': runs, 'columns': provider.getColumns(), 'runsView': runsView, 'selectedRuns': selectedRuns, SERVICE_NAME: serviceName } context = base_flex(request, context) return context
def contentContext(request, project): from pyworkflow.gui.tree import ProjectRunsTreeProvider projectName = project.getShortName() print "ProjectName: ", projectName project_settings = project.getSettings() request.session['projectPath'] = project.getPath() request.session['projectName'] = projectName provider = ProjectRunsTreeProvider(project) runs = formatProvider(provider, "runs") request.session['runs'] = runs # Get the selected runs stored in BD selectedRuns = project_settings.runSelection # Get the run mode view (0:list / 1:graph / 2:small graph) stored in BD runsView = project_settings.runsView.get() # load the protocol tree current active htmlTree = loadProtTree(project) # get the choices to load protocol trees choices = project.getProtocolViews() # get the choice current choiceSelected = choices.index(project.getCurrentProtocolView().text.get()) # show the project name in the header.html projectNameHeader = 'Project '+ str(projectName) context = {'projectName': projectName, 'view':'protocols', 'editTool': getResourceIcon('edit_toolbar'), 'copyTool': getResourceIcon('copy_toolbar'), 'deleteTool': getResourceIcon('delete_toolbar'), 'browseTool': getResourceIcon('browse_toolbar'), 'stopTool': getResourceIcon('stop_toolbar'), 'analyzeTool': getResourceIcon('analyze_toolbar'), 'treeTool': getResourceIcon('tree_toolbar'), 'listTool': getResourceIcon('list_toolbar'), 'graph_utils': getResourceJs('graph_utils'), 'project_content_utils': getResourceJs('project_content_utils'), 'jquery_cookie': getResourceJs('jquery_cookie'), 'jquery_treeview': getResourceJs('jquery_treeview'), 'project_content_css':getResourceCss('project_content'), 'protTreeHtml': htmlTree, 'choices':choices, 'choiceSelected': choiceSelected, 'runs': runs, 'columns': provider.getColumns(), 'projectNameHeader': projectNameHeader, 'runsView': runsView, 'selectedRuns': selectedRuns } context = base_flex(request, context) return context
def base_grid(request, context): context_base = { # CSS 'general_grid': getResourceCss('general_grid'), # JS 'jquery_sizes': getResourceJs('jquery_sizes'), 'jlayout_border': getResourceJs('jlayout_border'), 'jquery_layout': getResourceJs('jquery_layout') } context = base(request, context) context.update(context_base) return context
def base_grid(request, context): context_base = { #CSS 'general_grid': getResourceCss('general_grid'), #JS 'jquery_sizes': getResourceJs('jquery_sizes'), 'jlayout_border': getResourceJs('jlayout_border'), 'jquery_layout': getResourceJs('jquery_layout') } context = base(request, context) context.update(context_base) return context
def base_form(request, context): context_base = { # Folder 'project_folder': getProjectPathFromRequest(request), # CSS 'form_css': getResourceCss('form'), 'jquery_ui_css': getResourceCss('jquery_ui'), # JS 'jquery_ui': getResourceJs('jquery_ui'), 'jquery_ui_touch': getResourceJs('jquery_ui_touch'), 'jquery_browser': getResourceJs('jquery_browser'), "upload_utils": getResourceJs('upload_utils'), } context = base(request, context) context.update(context_base) return context
def base_form(request, context): context_base = { #Folder 'project_folder': request.session['projectPath'], #CSS 'form_css': getResourceCss('form'), 'jquery_ui_css': getResourceCss('jquery_ui'), #JS 'jquery_ui': getResourceJs('jquery_ui'), 'jquery_ui_touch': getResourceJs('jquery_ui_touch'), 'jquery_browser': getResourceJs('jquery_browser'), "upload_utils": getResourceJs('upload_utils'), } context = base(request, context) context.update(context_base) return context
def base_wiz(request, context): context_base = {'general_style': getResourceCss('general'), 'wizard_style': getResourceCss('wizard'), 'jquery_ui_style': getResourceCss('jquery_ui'), 'font_awesome': getResourceCss('font_awesome'), 'jquery': getResourceJs('jquery'), 'jquery_ui': getResourceJs('jquery_ui'), 'jquery_ui_touch': getResourceJs('jquery_ui_touch'), 'wizard_utils': getResourceJs('wizard_utils'), 'raphael':getResourceJs('raphael'), 'projectName': request.session['projectName'], 'loading' : getResourceIcon('loading'), } context = VARS_base(request, context) context.update(context_base) return context
def base_wiz(request, context): context_base = { 'general_style': getResourceCss('general'), 'wizard_style': getResourceCss('wizard'), 'jquery_ui_style': getResourceCss('jquery_ui'), 'font_awesome': getResourceCss('font_awesome'), 'jquery': getResourceJs('jquery'), 'jquery_ui': getResourceJs('jquery_ui'), 'jquery_ui_touch': getResourceJs('jquery_ui_touch'), 'wizard_utils': getResourceJs('wizard_utils'), 'raphael': getResourceJs('raphael'), 'projectName': request.session['projectName'], 'loading': getResourceIcon('loading'), } context = VARS_base(request, context) context.update(context_base) return context
def base(request, context): context_base = { #ICON 'favicon': getResourceIcon('favicon'), 'logo_scipion': getResourceIcon('logo_scipion'), 'logo_scipion_transparent' : getResourceIcon('logo_scipion_transparent'), #CSS 'general_css': getResourceCss('general'), 'messi_css': getResourceCss('messi'), 'font_awesome': getResourceCss('font_awesome'), #JS 'jquery': getResourceJs('jquery'), 'messi_js': getResourceJs('messi'), #JS 'utils': getResourceJs('utils'), } context = VARS_base(request, context) context.update(context_base) return context
def base(request, context): context_base = { #ICON 'favicon': getResourceIcon('favicon'), 'logo_scipion': getResourceIcon('logo_scipion'), 'logo_scipion_transparent': getResourceIcon('logo_scipion_transparent'), #CSS 'general_css': getResourceCss('general'), 'messi_css': getResourceCss('messi'), 'font_awesome': getResourceCss('font_awesome'), #JS 'jquery': getResourceJs('jquery'), 'messi_js': getResourceJs('messi'), #JS 'utils': getResourceJs('utils'), } context = VARS_base(request, context) context.update(context_base) return context
def VARS_base(request, context): from pyworkflow.web.app.properties import MessageWeb, ColorWeb, IconWeb # Properties class messages = MessageWeb() colors = ColorWeb() icons = IconWeb() context_base = { #ABSOLUTE PATH URL CONFIG 'abs_url': django_settings.ABSOLUTE_URL, 'config': getResourceJs('config'), 'js_root': getResourceJs(), 'css_root': getResourceCss(), #OTHER 'msg': messages, 'color': colors, 'icon': icons, } context.update(context_base) return context
def base_showj(request, context): context_base = { # CSS 'showj_css': getResourceCss('showj'), 'smoothness': getResourceCss('ui_smoothness'), 'demo_table_jui': getResourceCss('showj_demo_table_jui'), # JS 'jquery_datatable': getResourceJs('jquery_datatables'), 'jquerydataTables_colreorder': getResourceJs('jquery_colreorder'), 'jeditable': getResourceJs('jquery_editable'), 'jquery_waypoints': getResourceJs('jquery_waypoints'), 'jquery_hover_intent': getResourceJs('jquery_hover_intent'), 'showj_js': getResourceJs('showj_utils'), 'jquery_ui': getResourceJs('jquery_ui'), 'transpose_lib': getResourceJs('transpose'), 'showj_menu_utils': getResourceJs('showj_menu_utils'), } context = base_grid(request, context) context.update(context_base) return context
def base_showj(request, context): context_base = { #CSS 'showj_css': getResourceCss('showj'), 'smoothness': getResourceCss('ui_smoothness'), 'demo_table_jui': getResourceCss('showj_demo_table_jui'), #JS 'jquery_datatable': getResourceJs('jquery_datatables'), 'jquerydataTables_colreorder': getResourceJs('jquery_colreorder'), 'jeditable': getResourceJs('jquery_editable'), 'jquery_waypoints':getResourceJs('jquery_waypoints'), 'jquery_hover_intent':getResourceJs('jquery_hover_intent'), 'showj_js':getResourceJs('showj_utils'), 'jquery_ui':getResourceJs('jquery_ui'), 'transpose_lib':getResourceJs('transpose'), 'showj_menu_utils': getResourceJs('showj_menu_utils'), } context = base_grid(request, context) context.update(context_base) return context
def projects(request): from pyworkflow.utils.utils import prettyDate manager = Manager() projects = manager.listProjects() for p in projects: p.pTime = prettyDate(p.mTime) if 'projectName' in request.session: request.session['projectName'] = "" if 'projectPath' in request.session: request.session['projectPath'] = "" context = {'projects': projects, 'projects_css': getResourceCss('projects'), 'project_utils_js': getResourceJs('project_utils'), } context = base_grid(request, context) return render_to_response('projects.html', context)
def upload(request, form=None): # Load documents for the list page mode = request.GET.get('mode', None) path = os.path.join(request.session['projectPath'],'Uploads') split_path = path.split("/ScipionUserData/") relative_path = "ScipionUserData/" + split_path[1] context = {'relative_path': relative_path, 'form': DocumentForm(), 'logo_scipion_small': getResourceIcon('logo_scipion_small'), "upload_utils": getResourceJs('upload_utils'), "mode": mode, } context = base_form(request, context) # Render list page with the documents and the form return render_to_response('upload/upload.html', context, context_instance=RequestContext(request))
def projects(request): from pyworkflow.utils.utils import prettyDate manager = Manager() projects = manager.listProjects() for p in projects: p.pTime = prettyDate(p.mTime) if 'projectName' in request.session: request.session['projectName'] = "" if 'projectPath' in request.session: request.session['projectPath'] = "" context = { 'projects': projects, 'projects_css': getResourceCss('projects'), 'project_utils_js': getResourceJs('project_utils'), } context = base_grid(request, context) return render_to_response('projects.html', context)
def base_flex(request, context): context_base = { # CSS 'general_flex': getResourceCss('general_flex'), 'jquery_ui_css': getResourceCss('jquery_ui'), # JS 'jquery_ui': getResourceJs('jquery_ui'), 'jquery_ui_touch': getResourceJs('jquery_ui_touch'), 'jsplumb': getResourceJs('jsplumb'), 'jquery_sizes': getResourceJs('jquery_sizes'), 'jlayout_border': getResourceJs('jlayout_border'), 'jquery_layout': getResourceJs('jquery_layout') } context = base(request, context) context.update(context_base) return context
def projects(request): from pyworkflow.utils.utils import prettyDate manager = Manager() projectsList = manager.listProjects() for p in projectsList: p.pTime = prettyDate(p.mTime) if CTX_PROJECT_NAME in request.session: request.session[CTX_PROJECT_NAME] = "" if CTX_PROJECT_PATH in request.session: request.session[CTX_PROJECT_PATH] = "" context = { 'projects': projectsList, 'projects_css': getResourceCss('projects'), 'project_utils_js': getResourceJs('project_utils'), 'workflows': json.dumps(getWorkflowsList()) } context = base_grid(request, context) return render_to_response('projects.html', context)
def base_flex(request, context): context_base = { #CSS 'general_flex': getResourceCss('general_flex'), 'jquery_ui_css': getResourceCss('jquery_ui'), #JS 'jquery_ui': getResourceJs('jquery_ui'), 'jquery_ui_touch': getResourceJs('jquery_ui_touch'), 'jsplumb': getResourceJs('jsplumb'), 'jquery_sizes': getResourceJs('jquery_sizes'), 'jlayout_border': getResourceJs('jlayout_border'), 'jquery_layout': getResourceJs('jquery_layout'), } context = base(request, context) context.update(context_base) return context
def workflows(request): workflows = getWorkflowsList() # Annotate existence of projects (hashed) manager = getServiceManager(None) for workflow in workflows: # Project for the workflow should be the hashed value if manager.hasProject(workflow['project']): workflow['exists'] = True else: workflow['exists'] = False context = { 'projects_css': getResourceCss('projects'), 'project_utils_js': getResourceJs('project_utils'), 'workflows': workflows } context = base_grid(request, context) return render_to_response('workflows.html', context)
def base_wiz(request, context): context_base = { 'general_style': getResourceCss('general'), 'wizard_style': getResourceCss('wizard'), 'jquery_ui_style': getResourceCss('jquery_ui'), 'font_awesome': getResourceCss('font_awesome'), 'jquery': getResourceJs('jquery'), 'jquery_ui': getResourceJs('jquery_ui'), 'jquery_ui_touch': getResourceJs('jquery_ui_touch'), 'wizard_utils': getResourceJs('wizard_utils'), 'raphael': getResourceJs('raphael'), 'utils': getResourceJs('utils'), CTX_PROJECT_NAME: getVarFromRequest(request, PROJECT_NAME), SERVICE_NAME: getVarFromRequest(request, SERVICE_NAME), 'loading': getResourceIcon('loading'), } context = VARS_base(request, context) context.update(context_base) return context
def contextForm(request): from views_base import base_form from django.core.context_processors import csrf from views_util import getResourceCss, getResourceIcon, getResourceJs, getResourceLogo from pyworkflow.protocol.params import Group, Line project, protocol = loadProtocolProject(request, requestType='GET') action = request.GET.get('action', None) paramProt = request.GET.get('paramProt', None) protRunIdViewer = request.GET.get('protRunIdViewer', None) # Patch : to fix the relion dynamic way to generate the viewer form # For this is necessary to call setProtocol method if protRunIdViewer is not None: protocol_parent = project.getProtocol(int(protRunIdViewer)) protocol.setProtocol(protocol_parent) hosts = project.getHostNames() print "Host in the project: ", hosts visualize = 0 viewerDict = None if action == 'visualize': visualize = 1 viewerDict = protocol._getVisualizeDict() elif action == 'protSimple': visualize = 2 elif action == 'copy': protocol = project.copyProtocol(protocol) package = protocol.getClassPackage() logoPath = '' path = getattr(package, '_logo', '') if path != '': logoPath = getResourceLogo(path) wizards = findWizardsWeb(protocol) protocol.htmlCitations = parseText(protocol.citations()) protocol.htmlDoc = parseText(protocol.getDoc()) for section in protocol._definition.iterSections(): for paramName, param in section.iterParams(): protVar = getattr(protocol, paramName, None) if protVar is None: # raise Exception("_fillSection: param '%s' not found in protocol" % paramName) # GROUP PARAM if isinstance(param, Group): for paramGroupName, paramGroup in param.iterParams(): protVar = getattr(protocol, paramGroupName, None) # LINE PARAM if isinstance(paramGroup, Line): for paramLineName, paramLine in paramGroup.iterParams(): protVar = getattr(protocol, paramLineName, None) if protVar is None: pass else: paramLine = PreprocessParamForm(request, paramLine, paramLineName, wizards, viewerDict, visualize, protVar) # PATCH: This is applied to all the params in the line, maybe just need for the first one. for name, _ in paramGroup.iterParams(): wizParamName = name if wizParamName in wizards: paramGroup.hasWizard = True paramGroup.wizardClassName = wizards[wizParamName].__name__ if visualize == 1: if paramGroupName in viewerDict: paramGroup.hasViewer = True if not paramGroup.help.empty(): paramGroup.htmlHelp = parseText(paramGroup.help.get()) paramGroup.htmlCond = paramGroup.condition.get() paramGroup.htmlDepend = ','.join(paramGroup._dependants) paramGroup.htmlCondParams = ','.join(paramGroup._conditionParams) elif protVar is None: pass else: paramGroup = PreprocessParamForm(request, paramGroup, paramGroupName, wizards, viewerDict, visualize, protVar) param.htmlCond = param.condition.get() param.htmlDepend = ','.join(param._dependants) param.htmlCondParams = ','.join(param._conditionParams) # LINE PARAM if isinstance(param, Line): for paramLineName, paramLine in param.iterParams(): protVar = getattr(protocol, paramLineName, None) if protVar is None: pass else: paramLine = PreprocessParamForm(request, paramLine, paramLineName, wizards, viewerDict, visualize, protVar) # PATCH: This is applied to all the params in the line, maybe just need for the first one. for name, _ in param.iterParams(): wizParamName = name if wizParamName in wizards: param.hasWizard = True param.wizardClassName = wizards[wizParamName].__name__ if visualize == 1: if paramName in viewerDict: param.hasViewer = True if not param.help.empty(): param.htmlHelp = parseText(param.help.get()) param.htmlCond = param.condition.get() param.htmlDepend = ','.join(param._dependants) param.htmlCondParams = ','.join(param._conditionParams) else: # OTHER PARAM param = PreprocessParamForm(request, param, paramName, wizards, viewerDict, visualize, protVar) context = {SERVICE_NAME: getVarFromRequest(request, SERVICE_NAME), CTX_PROJECT_NAME: project.getShortName(), 'protocol': protocol, 'package_logo': logoPath, 'protRunIdViewer': protRunIdViewer, 'definition': protocol._definition, 'visualize': visualize, 'paramProt': paramProt, 'favicon': getResourceIcon('favicon'), 'comment': getResourceIcon('edit_toolbar'), 'jquery_ui_css': getResourceCss('jquery_ui'), 'wizard': getResourceIcon('wizard'), 'protocol_form_utils': getResourceJs('protocol_form_utils'), 'hosts': hosts, 'comment': parseText(protocol.getObjComment()), 'showHost': True, 'showParallel': True } # Update the context dictionary with the special params for paramName in SPECIAL_PARAMS: context[paramName] = protocol.getAttributeValue(paramName, '') # Cross Site Request Forgery protection is need it context.update(csrf(request)) context = base_form(request, context) return context
def contextForm(request): from views_base import base_form from django.core.context_processors import csrf from views_util import getResourceCss, getResourceIcon, getResourceJs, getResourceLogo from pyworkflow.protocol.params import Group, Line project, protocol = loadProtocolProject(request, requestType="GET") action = request.GET.get("action", None) paramProt = request.GET.get("paramProt", None) protRunIdViewer = request.GET.get("protRunIdViewer", None) # Patch : to fix the relion dynamic way to generate the viewer form # For this is necessary to call setProtocol method if protRunIdViewer is not None: protocol_parent = project.getProtocol(int(protRunIdViewer)) protocol.setProtocol(protocol_parent) hosts = project.getHostNames() print "Host in the project: ", hosts visualize = 0 viewerDict = None if action == "visualize": visualize = 1 viewerDict = protocol._getVisualizeDict() elif action == "protSimple": visualize = 2 elif action == "copy": protocol = project.copyProtocol(protocol) package = protocol.getClassPackage() logoPath = "" path = getattr(package, "_logo", "") if path != "": logoPath = getResourceLogo(path) wizards = findWizardsWeb(protocol) protocol.htmlCitations = parseText(protocol.citations()) protocol.htmlDoc = parseText(protocol.getDoc()) for section in protocol._definition.iterSections(): for paramName, param in section.iterParams(): protVar = getattr(protocol, paramName, None) if protVar is None: # raise Exception("_fillSection: param '%s' not found in protocol" % paramName) # GROUP PARAM if isinstance(param, Group): for paramGroupName, paramGroup in param.iterParams(): protVar = getattr(protocol, paramGroupName, None) # LINE PARAM if isinstance(paramGroup, Line): for paramLineName, paramLine in paramGroup.iterParams(): protVar = getattr(protocol, paramLineName, None) if protVar is None: pass else: paramLine = PreprocessParamForm( request, paramLine, paramLineName, wizards, viewerDict, visualize, protVar ) # PATCH: This is applied to all the params in the line, maybe just need for the first one. for name, _ in paramGroup.iterParams(): wizParamName = name if wizParamName in wizards: paramGroup.hasWizard = True paramGroup.wizardClassName = wizards[wizParamName].__name__ if visualize == 1: if paramGroupName in viewerDict: paramGroup.hasViewer = True if not paramGroup.help.empty(): paramGroup.htmlHelp = parseText(paramGroup.help.get()) paramGroup.htmlCond = paramGroup.condition.get() paramGroup.htmlDepend = ",".join(paramGroup._dependants) paramGroup.htmlCondParams = ",".join(paramGroup._conditionParams) elif protVar is None: pass else: paramGroup = PreprocessParamForm( request, paramGroup, paramGroupName, wizards, viewerDict, visualize, protVar ) param.htmlCond = param.condition.get() param.htmlDepend = ",".join(param._dependants) param.htmlCondParams = ",".join(param._conditionParams) # LINE PARAM if isinstance(param, Line): for paramLineName, paramLine in param.iterParams(): protVar = getattr(protocol, paramLineName, None) if protVar is None: pass else: paramLine = PreprocessParamForm( request, paramLine, paramLineName, wizards, viewerDict, visualize, protVar ) # PATCH: This is applied to all the params in the line, maybe just need for the first one. for name, _ in param.iterParams(): wizParamName = name if wizParamName in wizards: param.hasWizard = True param.wizardClassName = wizards[wizParamName].__name__ if visualize == 1: if paramName in viewerDict: param.hasViewer = True if not param.help.empty(): param.htmlHelp = parseText(param.help.get()) param.htmlCond = param.condition.get() param.htmlDepend = ",".join(param._dependants) param.htmlCondParams = ",".join(param._conditionParams) else: # OTHER PARAM param = PreprocessParamForm(request, param, paramName, wizards, viewerDict, visualize, protVar) context = { "projectName": project.getName(), "package_logo": logoPath, "protocol": protocol, "protRunIdViewer": protRunIdViewer, "definition": protocol._definition, "visualize": visualize, "paramProt": paramProt, "favicon": getResourceIcon("favicon"), "comment": getResourceIcon("edit_toolbar"), "jquery_ui_css": getResourceCss("jquery_ui"), "wizard": getResourceIcon("wizard"), "protocol_form_utils": getResourceJs("protocol_form_utils"), "hosts": hosts, "comment": parseText(protocol.getObjComment()), "showHost": True, "showParallel": True, } # Update the context dictionary with the special params for paramName in SPECIAL_PARAMS: context[paramName] = protocol.getAttributeValue(paramName, "") # Cross Site Request Forgery protection is need it context.update(csrf(request)) context = base_form(request, context) return context