def configuracao(request, branch=''): """Renders the 'configuracao' page.""" assert isinstance(request, HttpRequest) context = BaseView(request).context() context.update({ 'menu': 'adminGit', 'appname': 'adminPromax', 'title': 'adminGit/Index', 'year': datetime.now().year, 'request': request, 'user': request.POST.get('user', ''), 'password': request.POST.get('password', ''), 'github': request.POST.get('github', 'https://github.com/hbsistec/2A.git'), 'branch': branch, 'branches': [branch], }) return render(request, 'adminGit/index.html', context)
def build_promax(request, geo, dir=''): assert isinstance(request, HttpRequest) context = BaseView(request).context() geografia = context['geo'] if (len(geo) > 0): geografia = geo.strip('/') server = context['server'] port = int(context['port']) build_promax_path = context['build_promax_path'] command = 'EnvironControls->build_promax->{0}->{1}'.format( geografia, build_promax_path) result = ExecuteRemoteCommand(server, port, command) context.update({ 'menu': 'adminEnviron/visualizacao', 'appname': 'adminPromax', 'title': 'adminEnviron/Index', 'year': datetime.now().year, 'request': request, 'result': result }) return render(request, 'adminEnviron/construcao.html', context)
def selecionar(request): """Renders the 'index' page.""" assert isinstance(request, HttpRequest) context = BaseView(request).context() geo = context['geo'] server = context['server'] port = int(context['port']) if ('dat' in request.POST.keys()): selected = ExecuteRemoteCommand( server, port, 'DataBaseControls->mount_dat->' + geo + '->' + request.POST['dat']) else: selected = 'O sistema de arquivos selecionado não foi montado.' context.update({ 'menu': 'adminBases', 'appname': 'adminPromax', 'title': 'adminBases/Disponivel', 'year': datetime.now().year, 'request': request, 'selected': selected, }) return render(request, 'adminBases/selecionado.html', context)
def disponivel(request): """Renders the 'index' page.""" assert isinstance(request, HttpRequest) context = BaseView(request).context() geo = context['geo'] server = context['server'] port = int(context['port']) available_dat = ExecuteRemoteCommand( server, port, 'DataBaseControls->list_available_dat->' + geo) if (available_dat == 'Sem bases disponíveis.'): available_dat = ExecuteRemoteCommand( server, port, 'DataBaseControls->create_vgs->' + geo) available_dat = ExecuteRemoteCommand( server, port, 'DataBaseControls->list_available_dat->' + geo) available_dat = available_dat.split() context.update({ 'menu': 'adminBases', 'appname': 'adminPromax', 'title': 'adminBases/Disponivel', 'year': datetime.now().year, 'request': request, 'available_dat': available_dat, }) return render(request, 'adminBases/disponivel.html', context)
def index(request): """Renders the 'index' page.""" assert isinstance(request, HttpRequest) context = BaseView(request).context() context.update({ 'menu': 'adminApache', 'appname': 'adminPromax', 'title': 'adminApache/Index', 'year': datetime.now().year, 'request': request, 'errors': [{ 'type': 'danger', 'title': 'Apache inativo!', 'message': 'Verificar se o servidor Apache está ativo em: <a href="/apache/controle/" class="alert-link">Controle</a>.' }], }) return render(request, 'adminApache/index.html', context)
def show_tree(request, geo=''): """Renders the 'controle' page.""" assert isinstance(request, HttpRequest) context = BaseView(request).context() geografia = context['geo'] if (len(geo) > 0): geografia = geo.strip('/') server = context['server'] port = int(context['port']) command = 'EnvironControls->environment_tree->{0}'.format(geografia) path_list = ExecuteRemoteCommand(server, port, command) tree = {} for path in path_list.split(): path = path.split('/') path.remove('') insert_dict(tree, path) html_tree = create_tree(tree, 0) context.update({ 'menu': 'adminEnviron/construcao', 'appname': 'adminPromax', 'title': 'adminEnviron/Index', 'year': datetime.now().year, 'request': request, 'html_tree': html_tree }) return render(request, 'adminEnviron/treeview.html', context)
def monitoramento(request): """Renders the 'index' page.""" assert isinstance(request, HttpRequest) context = BaseView(request).context() context.update({ 'menu': 'adminEnviron', 'appname': 'adminPromax', 'title': 'adminEnviron/Monitoramento', 'year': datetime.now().year, 'request': request, }) return render(request, 'adminEnviron/monitoramento.html', context)
def logs(request, instance='', file=''): """Renders the 'configuracao' page.""" assert isinstance(request, HttpRequest) context = BaseView(request).context() geo = context['geo'] server = context['server'] port = int(context['port']) if (file): command = 'BuildBotControls->logfile_content->{0}->{1}->{2}'.format( geo, instance, file) file_content = ExecuteRemoteCommand(server, port, command) else: file_content = '' file_css = '' if (instance): command = 'BuildBotControls->log_files->{0}->{1}'.format(geo, instance) config_files = ExecuteRemoteCommand(server, port, command) config_files = config_files.split(';') else: config_files = '' instance = 'worker' if (instance == 'master'): master = 'active' worker = '' elif (instance == 'worker'): master = '' worker = 'active' else: master = '' worker = 'active' context.update({ 'menu': 'adminBuildBot/logs', 'appname': 'adminPromax', 'title': 'adminBuildBot/Logs', 'year': datetime.now().year, 'request': request, 'config_files': config_files, 'file_content': file_content, 'instance': instance, 'master': master, 'worker': worker, }) return render(request, 'adminBuildBot/logs.html', context)
def index(request): """Renders the 'index' page.""" assert isinstance(request, HttpRequest) context = BaseView(request).context() context.update({ 'menu': 'adminBuildBot/index', 'appname': 'adminPromax', 'title': 'adminBuildBot/Index', 'year': datetime.now().year, 'request': request, }) return render(request, 'adminBuildBot/buildbot.html', context)
def index(request): """Renders the 'index' page.""" assert isinstance(request, HttpRequest) context = BaseView(request).context() geo = context['geo'] server = context['server'] port = int(context['port']) context.update({ 'menu': 'adminJobs', 'appname': 'adminPromax', 'title': 'adminJobs/Index', 'year': datetime.now().year, 'request': request, }) return render(request, 'adminJobs/index.html', context)
def index(request): """Renders the 'index' page.""" assert isinstance(request, HttpRequest) context = BaseView(request).context() geo = context['geo'] server = context['server'] port = int(context['port']) branches = ExecuteRemoteCommand(server, port, 'BuildBotControls->list_branches->' + geo) branches = branches.split(';') context = BaseView(request).context() context.update({ 'menu': 'adminGit', 'appname': 'adminPromax', 'title': 'adminGit/Index', 'year': datetime.now().year, 'request': request, 'branches': branches, 'user': '', 'password': '', 'github': 'https://github.com/hbsistec/2A.git', 'branch': 'master', }) return render(request, 'adminGit/index.html', context)
def configuracao(request, file=''): """Renders the 'configuracao' page.""" assert isinstance(request, HttpRequest) context = BaseView(request).context() geo = context['geo'] server = context['server'] port = int(context['port']) config_files = ExecuteRemoteCommand(server, port, 'ApacheControls->config_files->' + geo) config_files = config_files.split(';') config_files.reverse() if (file): file_content = ExecuteRemoteCommand( server, port, 'ApacheControls->configfile_content->' + geo + '->' + file) file_content = highlight(file_content, ApacheConfLexer(), HtmlFormatter()) file_css = HtmlFormatter().get_style_defs('.highlight') else: file_content = '' file_css = '' context.update({ 'menu': 'adminApache/configuracao', 'appname': 'adminPromax', 'title': 'adminApache/Configuracao', 'year': datetime.now().year, 'request': request, 'config_files': config_files, 'file_content': file_content, 'file_css': file_css, 'config_file': file, 'errors': [], }) return render(request, 'adminApache/configuracao.html', context)
def status(request): """Renders the 'status' page.""" assert isinstance(request, HttpRequest) context = BaseView(request).context() geo = context['geo'] server = context['server'] port = int(context['port']) status = ExecuteRemoteCommand(server, port, 'BuildBotControls->status->' + geo) context.update({ 'menu': 'adminBuildBot/status', 'appname': 'adminPromax', 'title': 'adminBuildBot/Status', 'year': datetime.now().year, 'request': request, 'status': status, }) return render(request, 'adminBuildBot/status.html', context)
def index(request): """Renders the 'index' page.""" assert isinstance(request, HttpRequest) context = BaseView(request).context() geo = context['geo'] server = context['server'] port = int(context['port']) instancias = ExecuteRemoteCommand(server, port, 'BaseControls->instances->' + geo) instancias = instancias.split(';') context.update({ 'menu': 'adminPromax', 'appname': 'adminPromax', 'title': 'adminPromax/Index', 'year': datetime.now().year, 'request': request, 'instancias': instancias, }) return render(request, 'adminPromax/index.html', context)
def configuracao(request, file=''): """Renders the 'configuracao' page.""" assert isinstance(request, HttpRequest) context = BaseView(request).context() geo = context['geo'] server = context['server'] port = int(context['port']) config_files = ExecuteRemoteCommand( server, port, 'BuildBotControls->config_files->' + geo) config_files = config_files.split(';') config_files.reverse() file_css = '' file_content = '' if (file): command = 'BuildBotControls->configfile_content->{0}->{1}'.format( geo, file) file_content = ExecuteRemoteCommand(server, 9999, command) file_content = highlight(file_content, PythonLexer(), HtmlFormatter()) file_css = HtmlFormatter().get_style_defs('.highlight') context.update({ 'menu': 'adminBuildBot/configuracao', 'appname': 'adminPromax', 'title': 'adminBuildBot/Configuração', 'year': datetime.now().year, 'request': request, 'config_files': config_files, 'file_content': file_content, 'file_css': file_css, }) return render(request, 'adminBuildBot/configuracao.html', context)
def controle(request, command=''): """Renders the 'controle' page.""" assert isinstance(request, HttpRequest) context = BaseView(request).context() geo = context['geo'] server = context['server'] port = int(context['port']) if (command): command = 'BuildBotControls->{0}->{1}'.format(command, geo) config_files = ExecuteRemoteCommand(server, port, command) context.update({ 'menu': 'adminBuildBot/controle', 'appname': 'adminPromax', 'title': 'adminBuildBot/Controle', 'year': datetime.now().year, 'request': request, 'command': command }) return render(request, 'adminBuildBot/controle.html', context)
def visualizacao(request, dir=''): icons = { '*': ['default.png', '[ ]'], '7z': ['archive.png', '[ ]'], 'URL': ['html.png', '[TXT]'], 'aac': ['audio.png', '[SND]'], 'ai': ['eps.png', '[ ]'], 'aif': ['audio.png', '[SND]'], 'aifc': ['audio.png', '[SND]'], 'aiff': ['audio.png', '[SND]'], 'ape': ['audio.png', '[SND]'], 'asf': ['video.png', '[VID]'], 'asx': ['video.png', '[VID]'], 'au': ['audio.png', '[SND]'], 'avi': ['video.png', '[VID]'], 'bat': ['script.png', '[TXT]'], 'bin': ['bin.png', '[HEX]'], 'bmp': ['bmp.png', '[IMG]'], 'bz2': ['archive.png', '[HEX]'], 'c': ['c.png', '[TXT]'], 'cab': ['archive.png', '[ ]'], 'cmd': ['script.png', '[TXT]'], 'cpp': ['cpp.png', '[TXT]'], 'css': ['css.png', '[TXT]'], 'csv': ['calc.png', '[TXT]'], 'deb': ['deb.png', '[PKG]'], 'dmg': ['package.png', '[PKG]'], 'doc': ['doc.png', '[DOC]'], 'docm': ['doc.png', '[DOC]'], 'docx': ['doc.png', '[DOC]'], 'dot': ['doc.png', '[DOC]'], 'dotm': ['doc.png', '[DOC]'], 'dotx': ['doc.png', '[DOC]'], 'eps': ['eps.png', '[ ]'], 'exe': ['exe.png', '[HEX]'], 'f4a': ['audio.png', '[SND]'], 'f4b': ['audio.png', '[SND]'], 'f4p': ['video.png', '[VID]'], 'f4v': ['video.png', '[VID]'], 'flac': ['audio.png', '[SND]'], 'flv': ['video.png', '[VID]'], 'gif': ['gif.png', '[IMG]'], 'gz': ['archive.png', '[ ]'], 'h': ['h.png', '[TXT]'], 'hex': ['bin.png', '[HEX]'], 'htm': ['html.png', '[TXT]'], 'html': ['html.png', '[TXT]'], 'ico': ['ico.png', '[IMG]'], 'iff': ['audio.png', '[SND]'], 'iso': ['cd.png', '[ ]'], 'it': ['audio.png', '[SND]'], 'jar': ['java.png', '[TXT]'], 'jpe': ['jpg.png', '[IMG]'], 'jpeg': ['jpg.png', '[IMG]'], 'jpg': ['jpg.png', '[IMG]'], 'js': ['js.png', '[TXT]'], 'json': ['js.png', '[TXT]'], 'log': ['doc.png', '[TXT]'], 'm3u': ['playlist.png', '[ ]'], 'm3u8': ['playlist.png', '[ ]'], 'm4a': ['audio.png', '[SND]'], 'm4v': ['video.png', '[VID]'], 'md': ['markdown.png', '[ ]'], 'mid': ['audio.png', '[SND]'], 'mkv': ['video.png', '[VID]'], 'mod': ['audio.png', '[SND]'], 'mov': ['video.png', '[VID]'], 'mp3': ['audio.png', '[SND]'], 'mp4': ['video.png', '[VID]'], 'mpa': ['audio.png', '[SND]'], 'mpg': ['video.png', '[VID]'], 'msg': ['doc.png', '[DOC]'], 'nfo': ['text.png', '[TXT]'], 'odt': ['doc.png', '[DOC]'], 'oga': ['audio.png', '[SND]'], 'ogg': ['audio.png', '[SND]'], 'ogv': ['video.png', '[VID]'], 'pages': ['doc.png', '[DOC]'], 'pdf': ['pdf.png', '[ ]'], 'php': ['php.png', '[TXT]'], 'phtml': ['php.png', '[TXT]'], 'pkg': ['package.png', '[PKG]'], 'pls': ['playlist.png', '[ ]'], 'pls8': ['playlist.png', '[ ]'], 'png': ['png.png', '[IMG]'], 'ps': ['ps.png', '[ ]'], 'psd': ['psd.png', '[ ]'], 'py': ['py.png', '[TXT]'], 'ra': ['audio.png', '[SND]'], 'rar': ['rar.png', '[ ]'], 'rb': ['rb.png', '[TXT]'], 'rm': ['video.png', '[VID]'], 'rpm': ['rpm.png', '[PKG]'], 'rss': ['rss.png', '[TXT]'], 'rtf': ['doc.png', '[DOC]'], 's3m': ['audio.png', '[SND]'], 'sass': ['css.png', '[TXT]'], 'scss': ['css.png', '[TXT]'], 'sh': ['script.png', '[TXT]'], 'shtml': ['html.png', '[TXT]'], 'sql': ['sql.png', '[TXT]'], 'srt': ['video.png', '[VID]'], 'svg': ['draw.png', '[ ]'], 'svgz': ['draw.png', '[ ]'], 'swf': ['video.png', '[VID]'], 'tar': ['archive.png', '[ ]'], 'tex': ['doc.png', '[DOC]'], 'tif': ['tiff.png', '[IMG]'], 'tiff': ['tiff.png', '[IMG]'], 'txt': ['text.png', '[TXT]'], 'url': ['html.png', '[TXT]'], 'vob': ['video.png', '[VID]'], 'wav': ['audio.png', '[SND]'], 'wma': ['audio.png', '[SND]'], 'wmv': ['video.png', '[VID]'], 'wpd': ['doc.png', '[DOC]'], 'wps': ['doc.png', '[DOC]'], 'xhtml': ['html.png', '[TXT]'], 'xlam': ['calc.png', '[ ]'], 'xlr': ['calc.png', '[ ]'], 'xls': ['calc.png', '[ ]'], 'xlsm': ['calc.png', '[ ]'], 'xlsx': ['calc.png', '[ ]'], 'xltm': ['calc.png', '[ ]'], 'xltx': ['calc.png', '[ ]'], 'xm': ['audio.png', '[SND]'], 'xml': ['xml.png', '[TXT]'], 'zip': ['zip.png', '[ZIP]'] } """Renders the 'index' page.""" assert isinstance(request, HttpRequest) context = BaseView(request).context() geografia = context['geo'] server = context['server'] port = int(context['port']) if (len(dir) == 0): dir = '/{0}'.format(geografia) if (dir.find('->') > 0): dir = dir.split()[0] command = 'EnvironControls->list_dir->{0}->{1}'.format(geografia, dir) result = ExecuteRemoteCommand(server, port, command) result = result.split('\n') files = [] for line in result: if (len(line) > 0): l = line.split() d = {} d['icon'] = icons['*'][0] d['alt'] = icons['*'][1] if (len(l) >= 8): i = l[8].split('.') if (l[0][0] == 'd'): d['icon'] = 'folder.png' d['alt'] = '[DIR]' else: if (len(i) > 1): if (i[1] in icons.keys()): d['icon'] = icons[i[1]][0] d['alt'] = icons[i[1]][1] d['file'] = ' '.join(l[8:]) d['permissions'] = l[0] if (d['permissions'][0] == 'd'): d['dir'] = True else: d['dir'] = False d['user'] = l[2] d['group'] = l[3] d['size'] = l[4] d['last_modified'] = ' '.join(l[5:8]) files.append(d) path = dir if (len(path) == 0): path = dir.strip('/') context.update({ 'menu': 'adminEnviron/visualizacao', 'appname': 'adminPromax', 'title': 'adminEnviron/Index', 'year': datetime.now().year, 'request': request, 'webdav': files, 'path': dir, }) return render(request, 'adminEnviron/visualizacao.html', context)