本文整理汇总了Python中pyasm.common.Environment.get_group_names方法的典型用法代码示例。如果您正苦于以下问题:Python Environment.get_group_names方法的具体用法?Python Environment.get_group_names怎么用?Python Environment.get_group_names使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.common.Environment
的用法示例。
在下文中一共展示了Environment.get_group_names方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_group_names [as 别名]
def get_display(my):
sobject = my.get_current_sobject()
sk = sobject.get_search_key()
widget = DivWdg()
sts_to_perm = {'twog/qc_report_vars': 'compression|qc supervisor|edeliveries'}
if '-1' not in sk:
table = Table()
table.add_attr('width', '50px')
login = Environment.get_login()
user_name = login.get_login()
groups = Environment.get_group_names()
st = sk.split('?')[0];
perms = sts_to_perm[st]
allow = False
for g in groups:
if g in perms:
allow = True
if user_name == 'admin':
allow = True
if allow:
table.add_row()
cell1 = table.add_cell(my.x_butt)
cell1.add_attr('id','sp_del_%s' % sk)
launch_behavior = my.get_delete_behavior(sk)
cell1.add_style('cursor: pointer;')
cell1.add_behavior(launch_behavior)
widget.add(table)
return widget
示例2: init
# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_group_names [as 别名]
def init(self):
self.task_code = self.kwargs.get('task_code', '')
self.task_pipelines = ''
self.parent_sk = self.kwargs.get('parent_sk', '')
self.parent_pyclass = ''
self.order_sk = self.kwargs.get('order_sk', '')
self.groups = Environment.get_group_names()
if 'user' in self.kwargs.keys():
self.user = str(self.kwargs.get('user'))
else:
self.user = Environment.get_user_name()
示例3: init
# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_group_names [as 别名]
def init(my):
nothing = 'true'
my.server = None
my.login = Environment.get_login()
my.groups_arr = Environment.get_group_names()
my.groups_str = ''
for guy in my.groups_arr:
if my.groups_str == '':
my.groups_str = guy
else:
my.groups_str = '%s,%s' % (my.groups_str, guy)
my.user_name = my.login.get_login()
示例4: init
# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_group_names [as 别名]
def init(my):
my.group_list = Environment.get_group_names()
login = Environment.get_login()
my.user = login.get_login()
my.server = TacticServerStub.get()
my.sk = ''
my.code = ''
my.st = ''
my.is_scheduler = False
for gname in my.group_list:
if 'scheduling' in gname:
my.is_scheduler = True
if my.user == 'admin':
my.is_scheduler = True
示例5: init
# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_group_names [as 别名]
def init(my):
from client.tactic_client_lib import TacticServerStub
from pyasm.common import Environment
my.group_list = Environment.get_group_names()
login = Environment.get_login()
my.user = login.get_login()
my.server = TacticServerStub.get()
my.sk = ''
my.code = ''
my.st = ''
my.is_scheduler = False
for gname in my.group_list:
if 'scheduling' in gname:
my.is_scheduler = True
if my.user == 'admin':
my.is_scheduler = True
示例6: get_display
# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_group_names [as 别名]
def get_display(self):
"""
Get the code for displaying this widget.
:return: the sobject edit widget
"""
search_type = self.kwargs.get('search_type')
sobject_code = self.kwargs.get('sobject_code')
if not (search_type and sobject_code):
return DivWdg('Could not display [{0}]: [{1}]'.format(search_type, sobject_code))
mode = 'view'
user_groups = Environment.get_group_names()
if 'scheduling' in user_groups:
mode = 'edit'
sobject_type = ctu.get_sobject_type(search_type)
# TODO: get a relevant display name
display_name = sobject_code
title = '{0} {1}: {2}'.format(mode.title(), sobject_type.title(), display_name)
edit_widget = EditWdg(search_type=search_type, code=sobject_code, title=title, mode=mode,
view='edit', show_header='true')
return edit_widget
示例7: get_display
# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_group_names [as 别名]
def get_display(my):
login_groups = Environment.get_group_names()
top = DivWdg()
if 'admin' not in login_groups:
return top
top.add_border()
top.add_style("padding: 10px")
top.add_color("color", "color")
top.add_gradient("background", "background", 0, -5)
#top.add_style("height: 550px")
top.add_behavior( {
'type': 'load',
'cbjs_action': '''
spt.named_events.fire_event("side_bar|hide_now", {} );
'''
} )
project = Project.get()
title = DivWdg()
title.add("Project Startup and Configuration")
title.add_style("font-size: 18px")
title.add_style("font-weight: bold")
title.add_style("text-align: center")
title.add_style("padding: 10px")
title.add_style("margin: -10px -10px 10px -10px")
top.add(title)
title.add_gradient("background", "background3", 5, -10)
shelf = DivWdg()
top.add(shelf)
shelf.add_style("margin-left: -8px")
shelf.add_style("width: 130px")
button_div = DivWdg()
shelf.add(button_div)
button_div.add_style("float: left")
button_div.add_style("margin-top: -3px")
security = Environment.get_security()
view_side_bar = security.check_access("builtin", "view_side_bar", "allow", default='allow')
if view_side_bar:
button = IconButtonWdg(title="Side Bar", icon=IconWdg.ARROW_LEFT)
button_div.add(button)
shelf.add("Toggle Side Bar")
shelf.add_attr("title", "Toggle Side Bar (or press '1')")
button.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
spt.named_events.fire_event("side_bar|toggle");
'''
} )
shelf.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
spt.named_events.fire_event("side_bar|toggle");
'''
} )
shelf.add_class("hand")
else:
shelf.add(" ")
search_wdg = Table()
top.add(search_wdg)
search_wdg.add_row()
search_wdg.add_class("spt_main_top")
search_wdg.add_style("padding: 10px")
search_wdg.add_style("margin: 20px auto")
search_wdg.add_style("width: 430px")
td = search_wdg.add_cell("Search: ")
td.add_style("vertical-align: top")
td.add_style("padding-top: 8px")
custom_cbk = {}
custom_cbk['enter'] = '''
var top = bvr.src_el.getParent(".spt_main_top");
var search_el = top.getElement(".spt_main_search");
var keywords = search_el.value;
if (keywords != '') {
var class_name = 'tactic.ui.panel.ViewPanelWdg';
var kwargs = {
'search_type': 'sthpw/sobject_list',
'view': 'result_list',
'keywords': keywords,
'simple_search_view': 'simple_filter',
//'show_shelf': false,
}
spt.tab.set_main_body_tab();
spt.tab.add_new("Search Results", "Search Results", class_name, kwargs);
}
'''
#.........这里部分代码省略.........
示例8: get_display
# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_group_names [as 别名]
#.........这里部分代码省略.........
search = Search("config/url")
search.add_filter("url", "/%s/%%"%key, "like")
search.add_filter("url", "/%s"%key)
search.add_where("or")
url = search.get_sobject()
if url:
xml = url.get_xml_value("widget")
palette_key = xml.get_value("element/@palette")
# look up palette the expression for index
from pyasm.web import Palette
palette = Palette.get()
palette.set_palette(palette_key)
colors = palette.get_colors()
colors = jsondumps(colors)
script = HtmlElement.script('''
var env = spt.Environment.get();
env.set_colors(%s);
env.set_palette('%s');
''' % (colors, palette_key)
)
body.add(script)
env = Environment.get()
client_handoff_dir = env.get_client_handoff_dir(include_ticket=False, no_exception=True)
client_asset_dir = env.get_client_repo_dir()
login = Environment.get_login()
user_name = login.get_value("login")
user_id = login.get_id()
login_groups = Environment.get_group_names()
# add environment information
script = HtmlElement.script('''
var env = spt.Environment.get();
env.set_project('%s');
env.set_user('%s');
env.set_user_id('%s');
var login_groups = '%s'.split('|');
env.set_login_groups(login_groups);
env.set_client_handoff_dir('%s');
env.set_client_repo_dir('%s');
''' % (Project.get_project_code(), user_name, user_id, '|'.join(login_groups), client_handoff_dir,client_asset_dir))
body.add(script)
# add a global container for commonly used widgets
div = DivWdg()
body.add(div)
div.set_id("global_container")
# add in the app busy widget
# find out if there is an override for this
search = Search("config/url")
search.add_filter("url", "/app_busy")
url = search.get_sobject()
if url:
busy_div = DivWdg()
div.add(busy_div)
busy_div.add_class( "SPT_PUW" )
示例9: get_display
# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_group_names [as 别名]
def get_display(my):
my.sk = str(my.kwargs.get('sk'))
my.code = my.sk.split('code=')[1]
my.order_sk = str(my.kwargs.get('parent_sk'))
order_code = my.order_sk.split('code=')[1]
my.parent_sid = str(my.kwargs.get('parent_sid'))
if 'display_mode' in my.kwargs.keys():
my.disp_mode = str(my.kwargs.get('display_mode'))
if my.disp_mode == 'Small':
my.small = True
if 'user' in my.kwargs.keys():
my.user = my.kwargs.get('user')
else:
my.user = Environment.get_user_name()
if 'groups_str' in my.kwargs.keys():
my.groups_str = my.kwargs.get('groups_str')
if my.groups_str in [None,'']:
user_group_names = Environment.get_group_names()
for mg in user_group_names:
if my.groups_str == '':
my.groups_str = mg
else:
my.groups_str = '%s,%s' % (my.groups_str, mg)
user_is_scheduler = False
if 'scheduling' in my.groups_str or 'onboarding' in my.groups_str:
user_is_scheduler = True
if 'is_master' in my.kwargs.keys():
my.is_master_str = my.kwargs.get('is_master')
if my.is_master_str == 'true':
my.is_master = True
else:
order_search = Search("twog/order")
order_search.add_filter('code', order_code)
order = order_search.get_sobject()
order_classification = order.get_value('classification')
if order_classification in ['master', 'Master']:
my.is_master = True
my.is_master_str = 'true'
open_bottom = False
if 'open_bottom' in my.kwargs.keys():
ob_text = my.kwargs.get('open_bottom')
if ob_text in [True, 'true', 't', '1', 1]:
open_bottom = True
my.parent_sk = my.order_sk
if 'main_obj' in my.kwargs.keys():
main_obj = my.kwargs.get('main_obj')
else:
main_search = Search("twog/title")
main_search.add_filter('code', my.code)
main_obj = main_search.get_sobject()
my.search_id = main_obj.get_value('id')
proj_search = Search("twog/proj")
proj_search.add_filter('title_code', my.code)
proj_search.add_order_by('order_in_pipe')
projs = proj_search.get_sobjects()
table = Table()
table.add_attr('cellpadding', '0')
table.add_attr('cellspacing', '0')
table.add_attr('class', 'TitleRow_%s' % my.code)
table.add_style('border-collapse', 'separate')
table.add_style('border-spacing', '25px 0px')
table.add_style('border-bottom-right-radius', '10px')
table.add_style('border-bottom-left-radius', '10px')
table.add_style('border-top-right-radius', '10px')
table.add_style('border-top-left-radius', '10px')
table.add_style('color: #00056a;')
table.add_style('background-color: %s;' % my.off_color)
table.add_style('width: 100%;')
table.add_row()
epis = ''
full_title_name = main_obj.get_value('title')
if main_obj.get_value('episode'):
epis = ' Episode: %s' % main_obj.get_value('episode')
full_title_name = '%s: %s' % (full_title_name, main_obj.get_value('episode'))
title_cell = table.add_cell('<b><u>Title: %s%s</u></b>' % (main_obj.get_value('title'), epis))
title_cell.add_attr('nowrap', 'nowrap')
title_cell.add_style('cursor: pointer;')
title_cell.add_behavior(get_panel_change_behavior('twog/title', my.code, my.sk, my.order_sk, my.title, '',
'builder/refresh_from_save', '', my.parent_sk,
'%s: %s' % (main_obj.get_value('title'),
main_obj.get_value('episode')),
user_is_scheduler))
due_cell = table.add_cell('Due: %s' % fix_date(main_obj.get_value('due_date')).split(' ')[0])
due_cell.add_attr('nowrap', 'nowrap')
pipe_disp = main_obj.get_value('pipeline_code')
if 'XsX' in pipe_disp:
pipe_disp = 'Not Assigned'
pipe_cell = table.add_cell('Pipeline: %s' % pipe_disp)
pipe_cell.add_attr('nowrap', 'nowrap')
long_cell1 = table.add_cell(' ')
long_cell1.add_attr('align', 'right')
long_cell1.add_style('width: 100%')
if my.small:
select_check = CustomCheckboxWdg(name='select_%s' % my.code, value_field=my.code, checked='false',
dom_class='ob_selector', parent_table="TitleRow_%s" % my.code,
normal_color=my.off_color, selected_color=my.on_color, code=my.code,
ntype='title', search_key=my.sk,
additional_js=get_selected_color_behavior(my.code,
#.........这里部分代码省略.........
示例10: get_display
# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_group_names [as 别名]
def get_display(my):
my.work_order_sk = str(my.kwargs.get('work_order_sk'))
my.work_order_code = str(my.kwargs.get('work_order_code'))
my.client_code = str(my.kwargs.get('client_code'))
my.order_sk = str(my.kwargs.get('order_sk'))
order_code = my.order_sk.split('code=')[1]
overhead = Table()
overhead.add_attr('class', 'out_overhead_%s' % my.work_order_code)
overhead.add_attr('client_code', my.client_code)
wo_search = Search("twog/work_order")
wo_search.add_filter('code', my.work_order_code)
work_order = wo_search.get_sobject()
delivs_search = Search("twog/work_order_deliverables")
delivs_search.add_filter('work_order_code', my.work_order_code)
delivs = delivs_search.get_sobjects()
inter_search = Search("twog/work_order_intermediate")
inter_search.add_filter('work_order_code', my.work_order_code)
inters = inter_search.get_sobjects()
user_group_names = Environment.get_group_names()
groups_str = ''
for mg in user_group_names:
if groups_str == '':
groups_str = mg
else:
groups_str = '%s,%s' % (groups_str, mg)
user_is_scheduler = False
if 'scheduling' in groups_str:
user_is_scheduler = True
if 'is_master' in my.kwargs.keys():
my.is_master_str = my.kwargs.get('is_master')
if my.is_master_str == 'true':
my.is_master = True
else:
order_search = Search("twog/order")
order_search.add_filter('code',order_code)
order = order_search.get_sobject()
order_classification = order.get_value('classification')
if order_classification in ['master','Master']:
my.is_master = True
my.is_master_str = 'true'
table = Table()
table.add_row()
table.add_cell('<font size="4"><b><u>Intermediates</u></b></font>')
add_inter = table.add_cell('<input type="button" value="Add Intermediate File"/>')
add_inter.add_attr('nowrap','nowrap')
add_inter.add_style('cursor: pointer;')
add_inter.add_behavior(get_add_inter_behavior(my.work_order_code, my.client_code, my.is_master_str,
my.order_sk))
inters_tbl = Table()
for inter1 in inters:
i_search = Search("twog/intermediate_file")
i_search.add_filter('code',inter1.get_value('intermediate_file_code'))
inter = i_search.get_sobject()
inters_tbl.add_row()
if user_is_scheduler:
killer = inters_tbl.add_cell(my.x_butt)
killer.add_style('cursor: pointer;')
killer.add_behavior(get_intermediate_killer_behavior(inter1.get_value('code'), inter.get_value('title'),
my.work_order_code, my.is_master_str, my.order_sk))
alabel = inters_tbl.add_cell('Intermediate: ')
alabel.add_attr('align','center')
popper = inters_tbl.add_cell('<u>%s</u>' % inter.get_value('title'))
popper.add_attr('nowrap','nowrap')
popper.add_style('cursor: pointer;')
popper.add_behavior(get_open_intermediate_behavior(inter.get_value('code'), my.work_order_code,
my.client_code, my.order_sk))
if str(inter1.get_value('satisfied')) == 'True':
check_val = 'true'
else:
check_val = 'false'
checkbox = CustomCheckboxWdg(name='satisfied_%s' % inter.get_value('code'),
value_field=inter.get_value('code'), checked=check_val,
dom_class='inter_selector', code=inter.get_value('code'),
additional_js=get_change_inter_satisfied_behavior(inter1.get_value('code'),
my.work_order_code,
my.client_code,
str(inter1.get_value('satisfied')),
my.order_sk))
ck = inters_tbl.add_cell(checkbox)
ck.add_attr('align','center')
inters_tbl.add_cell(' ')
if my.is_master:
if inter.get_value('intermediate_file_templ_code') in [None,'']:
template_button = ButtonSmallNewWdg(title="Template This Intermediate File", icon=CustomIconWdg.icons.get('TEMPLATE'))
template_button.add_behavior(get_template_intermediate_behavior(inter.get_value('code'),
my.work_order_code, my.order_sk))
else:
template_button = '<img border="0" style="vertical-align: middle" title="Templated" name="Templated" src="/context/icons/silk/tick.png">'
tb = inters_tbl.add_cell(template_button)
tb.add_class('inter_templ_%s' % inter.get_value('code'))
table.add_row()
intr = table.add_cell(inters_tbl)
intr.add_attr('colspan','2')
table.add_row()
table.add_cell('<hr/>')
#.........这里部分代码省略.........
示例11: get_display
# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_group_names [as 别名]
def get_display(my):
from scraper import *
my.order_sk = my.kwargs.get('order_sk')
order_code = my.order_sk.split('code=')[1]
my.groups_str = my.kwargs.get('groups_str')
main_obj = None
if 'display_mode' in my.kwargs.keys():
my.disp_mode = my.kwargs.get('display_mode')
if my.disp_mode == 'Small':
my.small = True
if 'user' in my.kwargs.keys():
my.user = my.kwargs.get('user')
else:
my.user = Environment.get_user_name()
if 'groups_str' in my.kwargs.keys():
my.groups_str = my.kwargs.get('groups_str')
if my.groups_str in [None,'']:
user_group_names = Environment.get_group_names()
for mg in user_group_names:
if my.groups_str == '':
my.groups_str = mg
else:
my.groups_str = '%s,%s' % (my.groups_str, mg)
if 'is_master' in my.kwargs.keys():
my.is_master_str = my.kwargs.get('is_master')
if my.is_master_str == 'true':
my.is_master = True
else:
server = TacticServerStub.get()
main_obj = server.eval("@SOBJECT(twog/order['code','%s'])" % order_code)[0]
if main_obj.get('classification') in ['master', 'Master']:
my.is_master = True
my.is_master_str = 'true'
user_is_scheduler = False
if 'scheduling' in my.groups_str or 'onboarding' in my.groups_str:
user_is_scheduler = True
if main_obj in [None, '']:
server = TacticServerStub.get()
main_obj = server.eval("@SOBJECT(twog/order['code','%s'])" % order_code)[0]
table = Table()
table.add_attr('cellspacing', '3')
table.add_attr('cellpadding', '3')
table.add_attr('height', '100%')
table.add_attr('bgcolor', '#e4e6f0')
table.add_style('border-bottom-right-radius', '10px')
table.add_style('border-bottom-left-radius', '10px')
table.add_style('border-top-right-radius', '10px')
table.add_style('border-top-left-radius', '10px')
# NEW START
table.add_row()
title = table.add_cell(' <i><b>2G Order Builder</b></i> ')
title.add_attr('nowrap', 'nowrap')
title.add_style('font-size: 120%;')
selected_obj = table.add_cell('')
selected_obj.add_attr('class', 'selected_sobject')
selected_obj.add_attr('width', '100%')
associator_launcher = OrderAssociatorLauncherWdg(code=order_code, search_on_load='false')
associator = table.add_cell(associator_launcher)
associator.add_attr('align', 'right')
if main_obj.get('imdb_url') not in [None, '', 'none']:
lnk = table.add_cell('<a href="%s" target="_blank">Link</a>' % main_obj.get('imdb_url'))
else:
lnk = table.add_cell("No Link")
lnk.add_attr('align', 'left')
lnk.add_attr('nowrap', 'nowrap')
table.add_cell(' ')
refresher = ButtonSmallNewWdg(title="Refresh", icon=CustomIconWdg.icons.get('REFRESH'))
refresher.add_behavior(get_refresh_behavior(my.order_sk, my.user))
refr = table.add_cell(refresher)
refr.add_attr('align', 'right')
checker_launcher = OrderCheckerLauncherWdg(order_code=order_code)
checker = table.add_cell(checker_launcher)
checker.add_attr('align', 'right')
if user_is_scheduler:
global_replacer = ButtonSmallNewWdg(title="Global Replacer", icon=CustomIconWdg.icons.get('DEPENDENCY'))
global_replacer.add_behavior(get_global_replacer_wdg(my.order_sk, my.user))
globalr = table.add_cell(global_replacer)
globalr.add_attr('align', 'right')
if my.small:
normal_edit = ButtonSmallNewWdg(title="Normal Edit", icon=CustomIconWdg.icons.get('NORMAL_EDIT'))
normal_edit.add_behavior(get_quick_edit_behavior(my.order_sk, my.user))
normr = table.add_cell(normal_edit)
normr.add_attr('align', 'right')
else:
quick_edit = ButtonSmallNewWdg(title="Quick Edit", icon=CustomIconWdg.icons.get('QUICK_EDIT'))
quick_edit.add_behavior(get_quick_edit_behavior(my.order_sk, my.user))
quickr = table.add_cell(quick_edit)
quickr.add_attr('align', 'right')
clear_cache = ButtonSmallNewWdg(title="Clear Cache", icon=CustomIconWdg.icons.get('TRASH'))
clear_cache.add_behavior(get_clear_cache_behavior(my.order_sk, my.user))
clearc = table.add_cell(clear_cache)
clearc.add_attr('align', 'right')
#.........这里部分代码省略.........
示例12: get_display
# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_group_names [as 别名]
def get_display(my):
my.order_sk = my.kwargs.get('order_sk')
order_code = my.order_sk.split('code=')[1]
my.groups_str = None
if 'display_mode' in my.kwargs.keys():
my.disp_mode = my.kwargs.get('display_mode')
if my.disp_mode == 'Small':
my.small = True
if 'user' in my.kwargs.keys():
my.user = my.kwargs.get('user')
else:
my.user = Environment.get_user_name()
if 'groups_str' in my.kwargs.keys():
my.groups_str = my.kwargs.get('groups_str')
if my.groups_str in [None, '']:
user_group_names = Environment.get_group_names()
for mg in user_group_names:
if my.groups_str == '':
my.groups_str = mg
else:
my.groups_str = '%s,%s' % (my.groups_str, mg)
if 'is_master' in my.kwargs.keys():
my.is_master_str = my.kwargs.get('is_master')
if my.is_master_str == 'true':
my.is_master = True
else:
server = TacticServerStub.get()
main_obj = server.eval("@SOBJECT(twog/order['code','%s'])" % order_code)[0]
if main_obj.get('classification') in ['master', 'Master']:
my.is_master = True
my.is_master_str = 'true'
# Get the javascript functions
table = Table()
table.add_attr('class', 'qe_top_%s' % my.order_sk)
table.add_attr('width', '100%')
table.add_row()
type_checks_tbl = Table()
long_row = type_checks_tbl.add_row()
long_row.add_attr('width', '100%')
title_check = CustomCheckboxWdg(name='qe_titles_%s' % my.order_sk, value_field='title', checked='false',
dom_class='quick_edit_selector')
type_checks_tbl.add_cell(title_check)
type_checks_tbl.add_cell('Titles')
proj_check = CustomCheckboxWdg(name='qe_projects_%s' % my.order_sk, value_field='projects', checked='false',
dom_class='quick_edit_selector')
type_checks_tbl.add_cell(proj_check)
type_checks_tbl.add_cell('Projects')
wo_check = CustomCheckboxWdg(name='qe_work_orders_%s' % my.order_sk, value_field='work orders', checked='false',
dom_class='quick_edit_selector')
type_checks_tbl.add_cell(wo_check)
wo = type_checks_tbl.add_cell('Work Orders')
wo.add_attr('nowrap', 'nowrap')
eq_check = CustomCheckboxWdg(name='qe_equipment_%s' % my.order_sk, value_field='equipment', checked='false',
dom_class='quick_edit_selector')
type_checks_tbl.add_cell(eq_check)
type_checks_tbl.add_cell('Equipment')
group_selector = my.get_assigned_group_select(None, 'group_selector')
group_selector.add_behavior(get_select_checks_by_group_behavior(my.order_sk))
type_checks_tbl.add_cell(' ')
sbd = type_checks_tbl.add_cell('Select by Dept:')
sbd.add_attr('nowrap', 'nowrap')
type_checks_tbl.add_cell(group_selector)
tog_check = CustomCheckboxWdg(name='qe_toggler', additional_js=my.get_toggle_select_check_behavior(),
value_field='toggler', id='selection_toggler', checked='false')
last_cell = type_checks_tbl.add_cell(tog_check)
last_cell.add_attr('width', '100%')
last_cell.add_attr('align', 'right')
lc1 = type_checks_tbl.add_cell('Select/Deselect All In Table')
lc1.add_attr('width', '100%')
lc1.add_attr('align', 'right')
lc1.add_attr('nowrap', 'nowrap')
long_cell = table.add_cell(type_checks_tbl)
long_cell.add_attr('colspan', '8')
table.add_row()
table.add_cell('Platform: ')
# Get the list of platforms from the db
# Create the platform select wdg
platforms = my.server.eval("@GET(twog/platform['@ORDER_BY','name'].name)")
platform_sel = SelectWdg('platform_sel_%s' % my.order_sk)
platform_sel.append_option('--Select--', '--Select--')
for platform in platforms:
platform_sel.append_option(platform, platform)
table.add_cell(platform_sel)
# Create the territory select wdg
territories = my.territory_str.split('|')
territory_sel = SelectWdg('territory_sel_%s' % my.order_sk)
territory_sel.append_option('--Select--', '--Select--')
#.........这里部分代码省略.........
示例13: get_display
# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_group_names [as 别名]
def get_display(my):
login = Environment.get_login()
this_user = login.get_login()
groups = Environment.get_group_names()
my.get_stub()
show_save = False
for g in groups:
if 'qc' in g or 'edeliveries' in g:
show_save = True
if this_user == 'admin':
show_save = True
this_timestamp = str(datetime.datetime.now()).split('.')[0]
code = my.kwargs.get('code')
original_code = code
widget = DivWdg()
if 'TITLE' in code:
wos = my.server.eval("@GET(twog/work_order['title_code','%s'].code)" % code)
if len(wos) > 0:
code = wos[0]
else:
none_msg = 'THERE ARE NO WORK ORDERS IN THIS TITLE'
none_tbl = Table()
none_tbl.add_row()
none_tbl.add_cell(none_msg)
widget.add(none_tbl)
return widget
work_order = my.server.eval("@SOBJECT(twog/work_order['code','%s'])" % code)[0]
title = my.server.eval("@SOBJECT(twog/title['code','%s'])" % work_order.get('title_code'))[0]
tech_code = ''
tech = {
'code': '',
'description': '',
'timestamp': this_timestamp,
'login': this_user,
'barcode': '',
'client_code': '',
'client_name': '',
'title': title.get('title'),
'title_code': title.get('code'),
'episode': '',
'type': '',
'trt': '',
'part': '',
'label_date': '',
'capture_or_layoff': '',
'date': this_timestamp,
'order_code': work_order.get('order_code'),
'source_deck': '',
'record_deck': '',
'aspect_ratio': '',
'format': '',
'standard': '',
'timecode': '',
'text': '',
'vitc_lines': '',
'horiz_blank': '',
'active_video_lines': '',
'title_safe': '',
'error_logger': '',
'audio_ch01': '',
'audio_ch02': '',
'audio_ch03': '',
'audio_ch04': '',
'audio_ch05': '',
'audio_ch06': '',
'audio_ch07': '',
'audio_ch08': '',
'audio_ch09': '',
'audio_ch10': '',
'audio_ch11': '',
'audio_ch12': '',
'peak_ch01': '',
'peak_ch02': '',
'peak_ch03': '',
'peak_ch04': '',
'peak_ch05': '',
'peak_ch06': '',
'peak_ch07': '',
'peak_ch08': '',
'peak_ch09': '',
'peak_ch10': '',
'peak_ch11': '',
'peak_ch12': '',
'in_phase_0102': '',
'in_phase_0304': '',
'in_phase_0506': '',
'in_phase_0708': '',
'in_phase_0910': '',
'in_phase_1112': '',
'first_cut': '',
'first_cut_field': '',
'last_cut': '',
'last_cut_field': '',
'tc_verify': '',
'error_logger_messages': '',
'general_comments': '',
'operator': this_user,
'source_code': '',
#.........这里部分代码省略.........
示例14: main
# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_group_names [as 别名]
#.........这里部分代码省略.........
filled = '%s%s' % (filled, line)
filled = '%s\nMATTACHMENT:%s/%s' % (filled, upload_dir, file_name)
template.close()
filled_in_email = '/var/www/html/formatted_emails/ext_snap_inserted_%s.html' % code
filler = open(filled_in_email, 'w')
filler.write(filled)
filler.close()
os.system("php /opt/spt/custom/formatted_emailer/trusty_emailer.php '''%s''' '''%s''' '''%s''' '''%s''' '''%s''' '''%s'''" % (filled_in_email, ext_data['to_email'], ext_data['from_email'], ext_data['from_name'], subject, ext_data['ccs'].replace(';','#Xs*')))
else:
print "THIS MAKES NO SENSE. THE SNAPSHOT WAS CREATED BEFORE THE ORDER?"
elif find_str == 'NOTE':
#So it was attached to a note
#Need to make a code with the search id, as there's different ways the order and note deal with their snapshots
full_ending = make_note_code_ending(srch_id)
parent_code = 'NOTE%s' % (full_ending)
parent_sk = server.build_search_key('sthpw/note', parent_code)
#Get the note sobject
#note_obj = server.eval("@SOBJECT(sthpw/note['code','%s'])" % parent_code)[0]
note_obj = server.eval("@SOBJECT(sthpw/note['id','%s'])" % srch_id)[0]
note = note_obj.get('note')
#Need to wait until all files have been checked in to Tactic
if process == 'note_attachment':
timestamp = note_obj.get('timestamp').split('.')[0]
search_id = note_obj.get('search_id')
login = note_obj.get('login')
process = note_obj.get('process')
note_id = note_obj.get('id')
addressed_to = note_obj.get('addressed_to')
override_compression = True
#if addressed_to not in [None,'']:
# override_compression = True
search_type = note_obj.get('search_type').split('?')[0]
parent_tall_str = search_type.split('/')[1].upper()
groups = Environment.get_group_names()
note = note_obj.get('note')
note = note.replace('\t',' ')
note = note.replace('\n','<br/>')
note = note.replace(' ', ' ')
note = fix_note_chars(note)
order = None
title = None
proj = None
work_order = None
order_code = ''
display_ccs = ''
subject_see = ''
message = ''
title_row = ''
proj_row = ''
#If the note was attached to an order, title, proj or work_order, and compression didn't write the note, then send it. If compression intended to send it, then go ahead and send.
if parent_tall_str in ['ORDER','TITLE','PROJ','WORK_ORDER']: # and (('compression' not in groups and 'compression supervisor' not in groups) or override_compression):
from formatted_emailer import EmailDirections
#create the note parent's code from search_id
right_ending = make_right_code_ending(search_id)
parent_code = '%s%s' % (parent_tall_str, right_ending)
parent = server.eval("@SOBJECT(%s['code','%s'])" % (search_type, parent_code))
if parent:
parent = parent[0]
ident_str = ''
going_to_client = False
#Get info from the related elements, going up the chain
if parent_tall_str == 'WORK_ORDER':
proj = server.eval("@SOBJECT(twog/work_order['code','%s'].twog/proj)" % parent_code)[0]
title = server.eval("@SOBJECT(twog/work_order['code','%s'].twog/proj.twog/title)" % parent_code)[0]
order = server.eval("@SOBJECT(twog/order['code','%s'])" % title.get('order_code'))[0]
elif parent_tall_str == 'PROJ':
示例15: get_display
# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_group_names [as 别名]
def get_display(my):
my.sk = str(my.kwargs.get('sk'))
my.code = my.sk.split('code=')[1]
my.parent_sk = str(my.kwargs.get('parent_sk'))
my.order_sk = str(my.kwargs.get('order_sk'))
order_code = my.order_sk.split('code=')[1]
my.parent_sid = str(my.kwargs.get('parent_sid'))
if 'user' in my.kwargs.keys():
my.user = my.kwargs.get('user')
else:
my.user = Environment.get_user_name()
if 'groups_str' in my.kwargs.keys():
my.groups_str = my.kwargs.get('groups_str')
if my.groups_str in [None,'']:
user_group_names = Environment.get_group_names()
for mg in user_group_names:
if my.groups_str == '':
my.groups_str = mg
else:
my.groups_str = '%s,%s' % (my.groups_str, mg)
user_is_scheduler = False
if 'scheduling' in my.groups_str or 'onboarding' in my.groups_str:
user_is_scheduler = True
if 'display_mode' in my.kwargs.keys():
my.disp_mode = str(my.kwargs.get('display_mode'))
if my.disp_mode == 'Small':
my.small = True
if 'is_master' in my.kwargs.keys():
my.is_master_str = my.kwargs.get('is_master')
if my.is_master_str == 'true':
my.is_master = True
else:
order_search = Search("twog/order")
order_search.add_filter('code',order_code)
order = order_search.get_sobject()
order_classification = order.get_value('classification')
if order_classification in ['master', 'Master']:
my.is_master = True
my.is_master_str = 'true'
open_bottom = False
if 'open_bottom' in my.kwargs.keys():
ob_text = my.kwargs.get('open_bottom')
if ob_text in [True, 'true', 't', '1', 1]:
open_bottom = True
main_obj = None
if 'main_obj' in my.kwargs.keys():
main_obj = my.kwargs.get('main_obj')
else:
main_search = Search("twog/proj")
main_search.add_filter('code', my.code)
main_obj = main_search.get_sobject()
pipe_disp = main_obj.get_value('pipeline_code')
if pipe_disp in [None, '', 'twog/proj', 'NOTHINGXsXNOTHING']:
pipe_disp = "Not Assigned"
tp_search = Search("twog/title")
tp_search.add_filter('code', main_obj.get_value('title_code'))
titl = tp_search.get_sobject()
title_pipe = titl.get_value('pipeline_code')
cp_search = Search("twog/client_pipes")
cp_search.add_filter('process_name', main_obj.get_value('process'))
cp_search.add_filter('pipeline_code', title_pipe)
client_pipes = cp_search.get_sobjects()
if len(client_pipes) > 0:
client_pipe = client_pipes[0]
my.server.update(main_obj.get_search_key(), {'pipeline_code': client_pipe.get_value('pipe_to_assign')})
pipe_disp = client_pipe.get_value('pipe_to_assign')
my.search_id = main_obj.get_value('id')
due_date = ''
task_search = Search("sthpw/task")
task_search.add_filter('code', main_obj.get_value('task_code'))
task = task_search.get_sobjects()
task_sk = ''
status = ''
active_status = ''
if len(task) > 0:
due_date = task[0].get_value('bid_end_date')
status = task[0].get_value('status')
task_sk = task[0].get_search_key()
active_bool = task[0].get_value('active')
if active_bool in [True, 'true', 't', 1, '1']:
active_status = '<font color="#0ff000">Active</font>'
else:
active_status = '<font color="#ff0000">Inactive</font>'
wo_search = Search("twog/work_order")
wo_search.add_filter('proj_code', my.code)
wo_search.add_order_by('order_in_pipe')
wos = wo_search.get_sobjects()
table = Table()
table.add_attr('class', 'ProjRow_%s' % my.code)
table.add_attr('id', main_obj.get_value('code'))
table.add_attr('cellpadding', '0')
table.add_attr('cellspacing', '0')
table.add_style('border-collapse', 'separate')
table.add_style('border-spacing', '25px 0px')
table.add_style('color: #1d216a;')
table.add_style('background-color: %s;' % my.off_color)
table.add_style('width', '100%')
#.........这里部分代码省略.........