Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def htmlSchemaAreas( areasList = False ):
actualWebPath = currentPath()
dirList = [ dir.strip() for dir in actualWebPath.split( "/" ) if not dir.strip() == "" ]
htmlData = ""
if not areasList:
areasList = gWebConfig.getSchemaSections( "" )
for area in areasList:
htmlData += "" % area
if area.lower() == dirList[0]:
htmlData += "<div class="selectedLabel" id="%sMenuAnchor">" % area
else:
htmlData += "<div class="label" id="%sMenuAnchor">" % area
htmlData += "%s</div>\n" % area.capitalize()
return htmlData
</div>
def getSchemaContents( section = "" ):
subContents = []
for subSection in gWebConfig.getSchemaSections( section ):
subSectionPath = "%s/%s" % ( section, subSection )
subJSTxt = getSchemaContents( subSectionPath )
if len( subJSTxt ) > 0:
subContents.append( "{ text: '%s', menu : %s }" % ( subSection.capitalize(), subJSTxt ) )
for page in gWebConfig.getSchemaPages( section ):
pageData = gWebConfig.getSchemaPageData( "%s/%s" % ( section, page ) )
if len( pageData ) is not 3:
continue
if not checkPropertiesWithUser( pageData[2:] ):
continue
if pageData[0].find( "http" ) == 0:
pagePath = pageData[0]
else:
pagePath = diracURL( "/%s" % ( pageData[0] ) )
subContents.append( "{ text : '%s', url : '%s' }" % ( page, pagePath ) )
def jsSchemaSection( area, section ):
jsTxt = "["
for subSection in gWebConfig.getSchemaSections( section ):
subSectionPath = "%s/%s" % ( section, subSection )
subJSTxt = jsSchemaSection( area, subSectionPath )
if len( subJSTxt ) > 0:
jsTxt += "{ text: '%s', submenu : { id: '%s', itemdata : %s } }, " % ( subSection, subSectionPath, subJSTxt )
for page in gWebConfig.getSchemaPages( section ):
pageData = gWebConfig.getSchemaPageData( "%s/%s" % ( section, page ) )
if page != "Delimiter" or len( pageData ) < 3 or 'all' in pageData[2:] or credentials.getSelectedGroup() in pageData[2:]:
if pageData[0].find( "http" ) == 0:
pagePath = pageData[0]
else:
pagePath = diracURL( "/%s/%s" % ( area, pageData[0] ) )
jsTxt += "{ text : '%s', url : '%s' }," % ( page, pagePath )
jsTxt += "]"
return jsTxt
def schemaAreas():
return gWebConfig.getSchemaSections( "" )