def _get_inner_div(self): '''get the inner div for the process dialog''' inner_div = FloatDivWdg() inner_div.add_style("padding: 5px") inner_div.add_style('height: 260px') inner_div.add_color("background", "background") inner_div.add_color("color", "color") return inner_div
def _get_inner_div(my): '''get the inner div for the process dialog''' inner_div = FloatDivWdg() inner_div.add_style("padding: 5px") inner_div.add_style('height: 260px') inner_div.add_color("background", "background") inner_div.add_color("color", "color") return inner_div
def get_display(my): assert my.load_script widget = DivWdg() widget.add_style('float', 'right') load_button = TextOptionBtnWdg(label=' Load ', size='medium') load_button.get_top_el().add_style('float', 'left') load_button.get_top_el().set_id(my.LOAD_BUTTON_ID) load_button.add_behavior( {'type': "click_up", "cbjs_action": "setTimeout(function() {%s}, 200) "% my.load_script }) widget.add(load_button) arrow_button = load_button.get_option_widget() #widget.add(arrow_button) suffix = "ASSET_LOADER_FUNCTIONS" menus_in = [ my.smart_menu_data ] SmartMenu.add_smart_menu_set( arrow_button, menus_in) SmartMenu.assign_as_local_activator(arrow_button, None, True) #SmartMenu.attach_smart_context_menu( load_button, menus_in, False ) x_div = FloatDivWdg("x") x_div.add_color('color','color') x_div.add_style('margin-right: 6px') widget.add(x_div) multiplier = TextWdg() multiplier.set_id("load_multiplier") multiplier.set_option("size", "1.5") multiplier.add_style("font-size: 0.8em") multiplier.add_style("float: left") multiplier.add_class("load_multiplier") widget.add( multiplier ) return widget
def get_title(my): div = DivWdg() div.add_behavior({'type': 'load', 'cbjs_action': my.get_onload_js()}) # for csv export hid = HiddenWdg('start_date', my.start_date) div.add(hid) mday = my.today.strftime("%d") mmonth = my.today.strftime("%m") my.weekday_dict = {} days = [] for idx, date in enumerate(my.dates): day_div = DivWdg() days.append(day_div) week_day = date.strftime("%a") day_div.add("%s<br/>%s" % (week_day, date.strftime("%d"))) my.weekday_dict[idx] = week_day table = Table() div.add(table) table.add_row() table.add_color("color", "color") table.add_style("width: %spx" % my.table_width) table.add_style("float: left") month_div = FloatDivWdg(my.start_date.strftime("%b")) month_div.add_style('font-weight: 600') td = table.add_cell(month_div) td.add_style('width', '%spx' % my.MONTH_WIDTH) icon = IconButtonWdg(tip="Previous Week", icon=IconWdg.LEFT) td = table.add_cell(icon) offset = 0 if not my.use_straight_time: offset = 12 td.add_style("width: %spx" % (my.LEFT_WIDTH + offset)) display_days = my.days_per_page next_start_date = my.start_date + datetime.timedelta(days=display_days) prev_start_date = my.start_date + datetime.timedelta( days=-display_days) icon.add_behavior({ 'type': 'click_up', 'start_date': prev_start_date.__str__(), 'cbjs_action': ''' spt.app_busy.show('Loading previous week...'); var header = bvr.src_el.getParent('.spt_table_header'); if (!header) { spt.alert('Work hour widget requires the new Fast Table Layout to scroll to previous week. You can do so in [Manage Side Bar].'); spt.app_busy.hide(); return; } var cur_name = spt.table.get_element_name_by_header(header); var values = {'start_date': bvr.start_date}; spt.table.refresh_column(cur_name, values); spt.app_busy.hide(); ''' }) for day in days: day_wdg = DivWdg() day_wdg.add(day) td = table.add_cell() td.add(day_wdg) td.add_styles( "text-align: center; padding-left: 2px;min-width: %spx" % my.day_width) icon = IconButtonWdg(tip="Next Week", icon=IconWdg.RIGHT) icon.add_behavior({ 'type': 'click_up', 'start_date': next_start_date.__str__(), 'cbjs_action': ''' spt.app_busy.show('Loading next week...'); var header = bvr.src_el.getParent('.spt_table_header'); if (!header) { spt.alert('Work hour widget requires the new Fast Table Layout to scroll to next week. You can do so in [Manage Side Bar].'); spt.app_busy.hide(); return; } var cur_name = spt.table.get_element_name_by_header(header); var values = {'start_date': bvr.start_date}; spt.table.refresh_column(cur_name, values); spt.app_busy.hide(); ''' }) td = table.add_cell(icon) td.add_style('width: %spx' % my.day_width) # empty total cell td = table.add_blank_cell() td.add_style('width: 100%') return div
def get_display(my): sobject = my.get_current_sobject() if isinstance(sobject, Shot): frame_range = sobject.get_frame_range() frame_in, frame_out = sobject.get_frame_handles() frame_notes = sobject.get_frame_notes() else: from pyasm.prod.biz import FrameRange frame_start = my._get_frame_num(sobject, "tc_frame_start") frame_end = my._get_frame_num(sobject, "tc_frame_end") frame_range = FrameRange(frame_start, frame_end, 1 ) frame_in, frame_out = my._get_frame_handles(sobject) frame_notes = sobject.get_value("frame_note", no_exception=True) frame_notes = WikiUtil().convert(frame_notes) if frame_range.frame_end == frame_range.frame_start == 0: return 'n/a' widget = SpanWdg() widget.set_attr("nowrap", "1") offset = 2 label_width = 16 if frame_range.frame_start > 99: label_width = 20 # start / end frame duration_color = '#969353' div = DivWdg() div.add_tip('START -- END (TOTAL)') wdg_width = 150 div.add_style('width', wdg_width) total = frame_range.frame_end - frame_range.frame_start + 1 start_frame = SpanWdg(str(frame_range.frame_start)) end_frame = SpanWdg(str(frame_range.frame_end)) end_div = FloatDivWdg(end_frame) duration_width = wdg_width * 0.2 - offset #spacer_width = float('%.2f' %((duration_width + offset) * (frame_range.frame_start -1 ) /\ # frame_range.frame_end)) spacer_width = 0 start_div = FloatDivWdg(start_frame, width=label_width+spacer_width ) start_div.add_class('right_content') duration = FloatDivWdg( width=duration_width ) duration.add_style("border: 1px dotted %s" % duration_color) duration.add_style("margin-top: 3px") duration.add_style("margin-left: 5px") duration.add_style("margin-right: 5px") duration.add_style("height: 3px") duration.add_style("line-height: 3px") div.add(start_div) div.add(duration) div.add(end_div) dur_text = FloatDivWdg('<i>(%s)</i>' %total) dur_text.add_style("opacity", "0.3") div.add(dur_text) widget.add(div) widget.add(HtmlElement.br()) if frame_in: # in / out frame duration_color = '#b8b365' div = DivWdg() div.add_tip('IN -- OUT') div.add_style('width', wdg_width) handle_total = frame_out - frame_in + 1 in_frame = SpanWdg(str(frame_in)) out_frame = SpanWdg(str(frame_out)) if frame_range.frame_start == 0: frame_range.frame_start = 0.001 spacer_width = float('%.2f' % ((spacer_width) * \ float(frame_in) /frame_range.frame_start )) in_div = FloatDivWdg(in_frame, width=label_width + spacer_width) in_div.add_class('right_content') out_div = FloatDivWdg(out_frame) factor = float(handle_total) / total if factor > 1: factor = 1 duration_width = (duration_width + offset) * factor - offset duration = FloatDivWdg( width=duration_width ) duration.add_style("border: 1px solid %s" % duration_color) duration.add_style("background", duration_color) duration.add_style("margin-top: 5px") duration.add_style("margin-left: 5px") duration.add_style("margin-right: 5px") duration.add_style("line-height: 1px") duration.add(' ') # IE needs that to draw a 1px wide div bar = FloatDivWdg('<!-- -->', width=1) bar.add_style("margin-top: 1px") bar.add_style("line-height: 10px") bar.add_style("background", duration_color) div.add(in_div) div.add(bar) div.add(duration) div.add(bar) div.add(out_div) dur_text = SpanWdg('<i>(%s)</i>' %handle_total) dur_text.add_style("opacity", "0.3") div.add(dur_text) widget.add(div) if frame_notes: widget.add(HtmlElement.br()) widget.add(frame_notes) return widget
def get_display(self): self.check() if self.is_refresh: div = Widget() else: div = DivWdg() self.set_as_panel(div) div.add_style('padding', '6px') min_width = '400px' div.add_style('min-width', min_width) div.add_color('background', 'background') div.add_class('spt_add_task_panel') div.add_style("padding: 20px") from tactic.ui.app import HelpButtonWdg help_button = HelpButtonWdg(alias="creating-tasks") div.add(help_button) help_button.add_style("float: right") help_button.add_style("margin-top: -5px") if not self.search_key_list: msg_div = DivWdg() msg_table = Table() msg_div.add(msg_table) msg_table.add_row() msg_table.add_cell(IconWdg("No items selected", IconWdg.WARNING)) msg_table.add_cell( 'Please select at least 1 item to add tasks to.') msg_div.add_style('margin: 10px') msg_table.add_style("font-weight: bold") div.add(msg_div) return div msg_div = DivWdg() msg_div.add_style('margin-left: 4px') div.add(msg_div, 'info') msg_div.add('Total: %s item/s to add tasks to' % len(self.search_key_list)) div.add(HtmlElement.br()) hint = HintWdg('Tasks are added according to the assigned pipeline.') msg_div.add(" ") msg_div.add(hint) msg_div.add(HtmlElement.br()) option_div = DivWdg(css='spt_ui_options') #option_div.add_style('margin-left: 12px') sel = SelectWdg('pipeline_mode', label='Create tasks by: ') sel.set_option('values', ['simple process', 'context', 'standard']) sel.set_option('labels', ['process', 'context', 'all contexts in process']) sel.set_persistence() sel.add_behavior({ 'type': 'change', 'cbjs_action': 'spt.panel.refresh(bvr.src_el)' }) option_div.add(sel) value = sel.get_value() # default to simple process if not value: value = 'simple process' msg = '' if value not in ['simple process', 'context', 'standard']: value = 'simple process' if value == 'context': msg = 'In context mode, a single task will be created for each selected context.' elif value == 'simple process': msg = 'In process mode, a single task will be created for each selected process.' elif value == 'standard': msg = 'In this mode, a task will be created for all contexts of each selected process.' option_div.add(HintWdg(msg)) div.add(option_div) div.add(HtmlElement.br()) title = DivWdg('Assigned Pipelines') title.add_style('padding: 6px') title.add_color('background', 'background2') title.add_color('color', 'color', +120) div.add(title) content_div = DivWdg() content_div.add_style('min-height', '150px') div.add(content_div) content_div.add_border() filtered_search_key_list = [] for sk in self.search_key_list: id = SearchKey.extract_id(sk) if id == '-1': continue filtered_search_key_list.append(sk) sobjects = SearchKey.get_by_search_keys(filtered_search_key_list) skipped = [] pipeline_codes = [] for sobject in sobjects: if isinstance(sobject, Task): msg_div = DivWdg( 'WARNING: Creation of task for [Task] is not allowed.') msg_div.add_style('margin-left: 10px') div.add(msg_div, 'info') return div pipeline_code = sobject.get_value('pipeline_code', no_exception=True) if not pipeline_code: skipped.append(sobject) if pipeline_code not in pipeline_codes: pipeline_codes.append(pipeline_code) pipelines = Search.get_by_code('sthpw/pipeline', pipeline_codes) if pipelines == None: pipelines = [] #if not pipelines: # msg_div = DivWdg('WARNING: No Pipelines found for selected.') # msg_div.add_style('margin-left: 10px') # div.add(msg_div, 'info') # return div # expand the width according to num of pipelines content_div.add_style('min-width', len(pipelines) * 250) mode_cb = SelectWdg('pipeline_mode') mode_cb.set_persistence() mode = mode_cb.get_value() if 'context' == mode: mode = 'context' else: mode = 'process' show_subpipeline = True min_height = '150px' # create a temp default pipeline if not pipelines: pipeline = SearchType.create("sthpw/pipeline") pipeline.set_value("code", "__default__") pipeline.set_value( "pipeline", ''' <pipeline> <process name='publish'/> </pipeline> ''') # FIXME: HACK to initialize virtual pipeline pipeline.set_pipeline(pipeline.get_value("pipeline")) pipelines = [pipeline] for pipeline in pipelines: name = pipeline.get_value("name") if not name: name = pipeline.get_code() span = SpanWdg("Pipeline: %s" % name) span.add_style('font-weight: bold') v_div = FloatDivWdg(span) v_div.add_style('margin: 20px') v_div.add_style('min-height', min_height) v_div.add(HtmlElement.br(2)) content_div.add(v_div) processes = pipeline.get_processes(recurse=show_subpipeline, type=['manual', 'approval']) cb_name = '%s|task_process' % pipeline.get_code() master_cb = CheckboxWdg('master_control') master_cb.set_checked() master_cb.add_behavior({ 'type': 'click_up', 'propagate_evt': True, 'cbjs_action': ''' var inputs = spt.api.Utility.get_inputs(bvr.src_el.getParent('.spt_add_task_panel'),'%s'); for (var i = 0; i < inputs.length; i++) inputs[i].checked = bvr.src_el.checked; ''' % cb_name }) toggle_div = DivWdg() toggle_div.add(SpanWdg(master_cb, css='small')) label = HtmlElement.i('toggle all') label.add_style('color: #888') toggle_div.add_styles( 'border-bottom: 1px solid #888; width: 170px') toggle_div.add(label) v_div.add(toggle_div) process_names = [] for process in processes: process_labels = [] if process.is_from_sub_pipeline(): process_name = process.get_full_name() else: process_name = process.get_name() process_label = process.get_label() if not process_label: process_label = '' if mode == 'context': contexts = pipeline.get_output_contexts(process.get_name()) labels = contexts if process.is_from_sub_pipeline(): labels = [ '%s/%s' % (process.parent_pipeline_code, x) for x in contexts ] for x in labels: process_labels.append(process_label) # prepend process to contexts in this mode to ensure uniqueness contexts = ['%s:%s' % (process_name, x) for x in contexts] else: contexts = [process_name] labels = contexts process_labels.append(process_label) for idx, context in enumerate(contexts): cb = CheckboxWdg(cb_name) cb.set_checked() cb.set_option('value', context) v_div.add(SpanWdg(cb, css='small')) if mode == 'context': span = SpanWdg(process_name, css='med') #span.add_color('color','color') v_div.add(span) v_div.add(SpanWdg(labels[idx])) process_label = process_labels[idx] if process_label: v_div.add(SpanWdg("(%s)" % process_label, css='small')) v_div.add(HtmlElement.br()) content_div.add("<br clear='all'/>") skipped = [] if True: div.add("<br/>") btn = ActionButtonWdg(title='Add Tasks') btn.add_behavior({ 'type': 'click_up', 'post_event': 'search_table_%s' % self.table_id, 'cbjs_action': ''' spt.dg_table.add_task_selected(bvr); ''', 'search_key_list': self.search_key_list }) cb = CheckboxWdg('skip_duplicated', label='Skip Duplicates') cb.set_checked() option_div = DivWdg(cb) option_div.add_style('width', '130px') option_div.add_style('align: left') div.add(option_div) div.add(HtmlElement.br()) btn.add_style("float: right") div.add(btn) div.add(HtmlElement.br(clear="all")) if skipped: content_div.add(HtmlElement.br()) skip_div = DivWdg('Missing pipeline code (Skipped)') skip_div.add_style('text-decoration: underline') content_div.add(skip_div) content_div.add(HtmlElement.br()) item_div = DivWdg() item_div.add_style('margin-left: 10px') content_div.add(item_div) for skip in skipped: item_div.add(skip.get_code()) item_div.add(HtmlElement.br()) return div
def get_display(self): self.check() if self.is_refresh: div = Widget() else: div = DivWdg() self.set_as_panel(div) div.add_style('padding','6px') min_width = '400px' div.add_style('min-width', min_width) div.add_color('background','background') div.add_class('spt_add_task_panel') div.add_style("padding: 20px") from tactic.ui.app import HelpButtonWdg help_button = HelpButtonWdg(alias="creating-tasks") div.add(help_button) help_button.add_style("float: right") help_button.add_style("margin-top: -5px") if not self.search_key_list: msg_div = DivWdg() msg_table = Table() msg_div.add(msg_table) msg_table.add_row() msg_table.add_cell( IconWdg("No items selected", IconWdg.WARNING) ) msg_table.add_cell('Please select at least 1 item to add tasks to.') msg_div.add_style('margin: 10px') msg_table.add_style("font-weight: bold") div.add(msg_div) return div msg_div = DivWdg() msg_div.add_style('margin-left: 4px') div.add(msg_div, 'info') msg_div.add('Total: %s item/s to add tasks to' %len(self.search_key_list)) div.add(HtmlElement.br()) hint = HintWdg('Tasks are added according to the assigned pipeline.') msg_div.add(" ") msg_div.add(hint) msg_div.add(HtmlElement.br()) option_div = DivWdg(css='spt_ui_options') #option_div.add_style('margin-left: 12px') sel = SelectWdg('pipeline_mode', label='Create tasks by: ') sel.set_option('values', ['simple process','context', 'standard']) sel.set_option('labels', ['process','context', 'all contexts in process']) sel.set_persistence() sel.add_behavior({'type':'change', 'cbjs_action': 'spt.panel.refresh(bvr.src_el)'}) option_div.add(sel) value = sel.get_value() # default to simple process if not value: value = 'simple process' msg = '' if value not in ['simple process','context','standard']: value = 'simple process' if value == 'context': msg = 'In context mode, a single task will be created for each selected context.' elif value == 'simple process': msg = 'In process mode, a single task will be created for each selected process.' elif value == 'standard': msg = 'In this mode, a task will be created for all contexts of each selected process.' option_div.add(HintWdg(msg)) div.add(option_div) div.add(HtmlElement.br()) title = DivWdg('Assigned Pipelines') title.add_style('padding: 6px') title.add_color('background','background2') title.add_color('color','color', +120) div.add(title) content_div = DivWdg() content_div.add_style('min-height', '150px') div.add(content_div) content_div.add_border() filtered_search_key_list = [] for sk in self.search_key_list: id = SearchKey.extract_id(sk) if id=='-1': continue filtered_search_key_list.append(sk) sobjects = SearchKey.get_by_search_keys(filtered_search_key_list) skipped = [] pipeline_codes = [] for sobject in sobjects: if isinstance(sobject, Task): msg_div = DivWdg('WARNING: Creation of task for [Task] is not allowed.') msg_div.add_style('margin-left: 10px') div.add(msg_div, 'info') return div pipeline_code = sobject.get_value('pipeline_code', no_exception=True) if not pipeline_code: skipped.append(sobject) if pipeline_code not in pipeline_codes: pipeline_codes.append(pipeline_code) pipelines = Search.get_by_code('sthpw/pipeline', pipeline_codes) if pipelines == None: pipelines = [] #if not pipelines: # msg_div = DivWdg('WARNING: No Pipelines found for selected.') # msg_div.add_style('margin-left: 10px') # div.add(msg_div, 'info') # return div # expand the width according to num of pipelines content_div.add_style('min-width', len(pipelines)*250) mode_cb = SelectWdg('pipeline_mode') mode_cb.set_persistence() mode = mode_cb.get_value() if 'context' == mode: mode = 'context' else: mode = 'process' show_subpipeline = True min_height = '150px' # create a temp default pipeline if not pipelines: pipeline = SearchType.create("sthpw/pipeline") pipeline.set_value("code", "__default__") pipeline.set_value("pipeline", ''' <pipeline> <process name='publish'/> </pipeline> ''') # FIXME: HACK to initialize virtual pipeline pipeline.set_pipeline(pipeline.get_value("pipeline")) pipelines = [pipeline] for pipeline in pipelines: name = pipeline.get_value("name") if not name: name = pipeline.get_code() span = SpanWdg("Pipeline: %s" % name) span.add_style('font-weight: bold') v_div = FloatDivWdg(span) v_div.add_style('margin: 20px') v_div.add_style('min-height', min_height) v_div.add(HtmlElement.br(2)) content_div.add(v_div) processes = pipeline.get_processes(recurse=show_subpipeline, type=['manual','approval']) cb_name = '%s|task_process' %pipeline.get_code() master_cb = CheckboxWdg('master_control') master_cb.set_checked() master_cb.add_behavior({'type': 'click_up', 'propagate_evt': True, 'cbjs_action': ''' var inputs = spt.api.Utility.get_inputs(bvr.src_el.getParent('.spt_add_task_panel'),'%s'); for (var i = 0; i < inputs.length; i++) inputs[i].checked = bvr.src_el.checked; ''' %cb_name}) toggle_div = DivWdg() toggle_div.add(SpanWdg(master_cb, css='small')) label = HtmlElement.i('toggle all') label.add_style('color: #888') toggle_div.add_styles('border-bottom: 1px solid #888; width: 170px') toggle_div.add(label) v_div.add(toggle_div) process_names = [] for process in processes: process_labels = [] if process.is_from_sub_pipeline(): process_name = process.get_full_name() else: process_name = process.get_name() process_label = process.get_label() if not process_label: process_label = '' if mode =='context': contexts = pipeline.get_output_contexts(process.get_name()) labels = contexts if process.is_from_sub_pipeline(): labels = ['%s/%s'%(process.parent_pipeline_code, x) for x in contexts] for x in labels: process_labels.append(process_label) # prepend process to contexts in this mode to ensure uniqueness contexts = ['%s:%s' %(process_name, x) for x in contexts] else: contexts = [process_name] labels = contexts process_labels.append(process_label) for idx, context in enumerate(contexts): cb = CheckboxWdg(cb_name) cb.set_checked() cb.set_option('value', context) v_div.add(SpanWdg(cb, css='small')) if mode == 'context': span = SpanWdg(process_name, css='med') #span.add_color('color','color') v_div.add(span) v_div.add(SpanWdg(labels[idx])) process_label = process_labels[idx] if process_label: v_div.add(SpanWdg("(%s)" %process_label, css='small')) v_div.add(HtmlElement.br()) content_div.add("<br clear='all'/>") skipped = [] if True: div.add("<br/>") btn = ActionButtonWdg(title='Add Tasks') btn.add_behavior({'type' : 'click_up', 'post_event': 'search_table_%s'% self.table_id, 'cbjs_action': ''' spt.dg_table.add_task_selected(bvr); ''', 'search_key_list': self.search_key_list }) cb = CheckboxWdg('skip_duplicated', label='Skip Duplicates') cb.set_checked() option_div =DivWdg(cb) option_div.add_style('width', '130px') option_div.add_style('align: left') div.add(option_div) div.add(HtmlElement.br()) btn.add_style("float: right") div.add(btn) div.add(HtmlElement.br(clear="all")) if skipped: content_div.add(HtmlElement.br()) skip_div = DivWdg('Missing pipeline code (Skipped)') skip_div.add_style('text-decoration: underline') content_div.add(skip_div) content_div.add(HtmlElement.br()) item_div = DivWdg() item_div.add_style('margin-left: 10px') content_div.add(item_div) for skip in skipped: item_div.add(skip.get_code()) item_div.add(HtmlElement.br()) return div
def get_title(my): div = DivWdg() div.add_behavior({'type': 'load', 'cbjs_action': my.get_onload_js()}) # for csv export hid = HiddenWdg('start_date', my.start_date) div.add(hid) mday = my.today.strftime("%d") mmonth = my.today.strftime("%m") my.weekday_dict = {} days = [] for idx, date in enumerate(my.dates): day_div = DivWdg() days.append( day_div ) week_day = date.strftime("%a") day_div.add( "%s<br/>%s" % (week_day, date.strftime("%d") )) my.weekday_dict[idx] = week_day table = Table() div.add(table) table.add_row() table.add_color("color", "color") table.add_style("width: %spx"%my.table_width) table.add_style("float: left") month_div = FloatDivWdg(my.start_date.strftime("%b")) month_div.add_style('font-weight: 600') td = table.add_cell(month_div) td.add_style('width', '%spx'%my.MONTH_WIDTH) icon = IconButtonWdg(tip="Previous Week", icon=IconWdg.LEFT) td = table.add_cell(icon) offset = 0 if not my.use_straight_time: offset = 12 td.add_style("width: %spx" % (my.LEFT_WIDTH + offset) ) display_days = my.days_per_page next_start_date = my.start_date + datetime.timedelta(days=display_days) prev_start_date = my.start_date + datetime.timedelta(days=-display_days) icon.add_behavior( { 'type': 'click_up', 'start_date': prev_start_date.__str__(), 'cbjs_action': ''' spt.app_busy.show('Loading previous week...'); var header = bvr.src_el.getParent('.spt_table_header'); if (!header) { spt.alert('Work hour widget requires the new Fast Table Layout to scroll to previous week. You can do so in [Manage Side Bar].'); spt.app_busy.hide(); return; } var cur_name = spt.table.get_element_name_by_header(header); var values = {'start_date': bvr.start_date}; spt.table.refresh_column(cur_name, values); spt.app_busy.hide(); ''' } ) for day in days: day_wdg = DivWdg() day_wdg.add(day) td = table.add_cell() td.add(day_wdg) td.add_styles("text-align: center; padding-left: 2px;min-width: %spx"%my.day_width) icon = IconButtonWdg(tip="Next Week", icon=IconWdg.RIGHT) icon.add_behavior( { 'type': 'click_up', 'start_date': next_start_date.__str__(), 'cbjs_action': ''' spt.app_busy.show('Loading next week...'); var header = bvr.src_el.getParent('.spt_table_header'); if (!header) { spt.alert('Work hour widget requires the new Fast Table Layout to scroll to next week. You can do so in [Manage Side Bar].'); spt.app_busy.hide(); return; } var cur_name = spt.table.get_element_name_by_header(header); var values = {'start_date': bvr.start_date}; spt.table.refresh_column(cur_name, values); spt.app_busy.hide(); ''' } ) td = table.add_cell(icon) td.add_style('width: %spx'%my.day_width) # empty total cell td = table.add_blank_cell() td.add_style('width: 100%') return div
def get_upload_wdg(my): '''get search type select and upload wdg''' widget = DivWdg(css='spt_import_csv') widget.add_color('color','color') widget.add_color('background','background') widget.add_style('width: 600px') # get the search type title = DivWdg("<b>Select sType to import data into:</b> ") widget.add( title ) title.add_style("float: left") # handle new search_types new_search_type = CheckboxWdg("new_search_type_checkbox") new_search_type.add_event("onclick", "toggle_display('new_search_type_div')") #span = SpanWdg(css="med") #span.add(new_search_type) #span.add("Create new type") #span.add(" ... or ... ") #widget.add(span) new_search_type_div = DivWdg() new_search_type_div.set_id("new_search_type_div") name_input = TextWdg("asset_name") title = TextWdg("asset_title") description = TextAreaWdg("asset_description") key='csv_import' table = Table() table.set_id('csv_main_body') table.add_style("margin: 10px 10px") table.add_col().set_attr('width','140') table.add_col().set_attr('width','400') table.add_row() table.add_header("Search Type: ").set_attr('align','left') table.add_cell(name_input) table.add_row() table.add_header("Title: ").set_attr('align','left') table.add_cell(title) table.add_row() table.add_header("Description: ").set_attr('align','left') table.add_cell(description) new_search_type_div.add(table) new_search_type_div.add_style("display: none") #widget.add(new_search_type_div) div = DivWdg() search_type_select = SearchTypeSelectWdg("search_type_filter", mode=SearchTypeSelectWdg.ALL) search_type_select.add_empty_option("-- Select --") if not search_type_select.get_value(): search_type_select.set_value(my.search_type) search_type_select.set_persist_on_submit() div.add(search_type_select) widget.add(div) search_type_select.add_behavior( {'type': 'change', \ 'cbjs_action': "spt.panel.load('csv_import_main','%s', {}, {\ 'search_type_filter': bvr.src_el.value});" %(Common.get_full_class_name(my)) } ) if my.search_type: sobj = None try: sobj = SObjectFactory.create(my.search_type) except ImportError: widget.add(HtmlElement.br()) widget.add(SpanWdg('WARNING: Import Error encountered. Please choose another search type.', css='warning')) return widget required_columns = sobj.get_required_columns() if required_columns: widget.add(HtmlElement.br()) req_span = SpanWdg("Required Columns: ", css='med') req_span.add_color('color','color') widget.add(req_span) #required_columns = ['n/a'] req_span.add(', '.join(required_columns)) widget.add( HtmlElement.br() ) if my.file_path: hidden = HiddenWdg("file_path", my.file_path) widget.add(hidden) if my.web_url: file_span = FloatDivWdg('URL: <i>%s</i> ' %my.web_url, css='med') else: file_span = FloatDivWdg('File uploaded: <i>%s</i> ' %os.path.basename(my.file_path), css='med') file_span.add_color('color','color') file_span.add_style('margin: 8px 0 0 10px') file_span.add_style('font-size: 14px') widget.add(file_span) button = ActionButtonWdg(title='Change') button.add_style('float','left') button.add_behavior( {'type': 'click_up', \ 'cbjs_action': "spt.panel.load('csv_import_main','%s', {}, {\ 'search_type_filter': '%s'});" %(Common.get_full_class_name(my), my.search_type) } ) widget.add(button) widget.add("<br clear='all'/>") widget.add(HtmlElement.br()) return widget widget.add("<br/>") widget.add_style("overflow-y: auto") msg = DivWdg() widget.add(msg) msg.add( "<div style='float: left; padding-left: 100px; padding-top: 6px'><b>Upload a csv file: </b></div>") msg.add_border() msg.add_style("width: 400px") msg.add_color("background", "background3") msg.add_style("padding: 20px") msg.add_style("margin: 30 auto") msg.add_style("text-align: center") ticket = Environment.get_security().get_ticket_key() on_complete = '''var server = TacticServerStub.get(); var file = spt.html5upload.get_file(); if (file) { var file_name = file.name; // clean up the file name the way it is done in the server file_name = spt.path.get_filesystem_name(file_name); var server = TacticServerStub.get(); var class_name = 'tactic.ui.widget.CsvImportWdg'; var values = spt.api.Utility.get_input_values('csv_import_main'); values['is_refresh'] = true; values['file_name'] = file_name; values['html5_ticket'] = '%s'; try { var info = spt.panel.load('csv_import_main', class_name, {}, values); spt.app_busy.hide(); } catch(e) { spt.alert(spt.exception.handler(e)); } } else { alert('Error: file object cannot be found.') } spt.app_busy.hide();'''%ticket from tactic.ui.input import UploadButtonWdg browse = UploadButtonWdg(name='new_csv_upload', title="Browse", tip="Click to choose a csv file",\ on_complete=on_complete, ticket=ticket) browse.add_style('float: left') msg.add(browse) # this is now only used in the copy and paste Upload button for backward-compatibility upload_wdg = SimpleUploadWdg(key=key, show_upload=False) upload_wdg.add_style('display: none') msg.add(upload_wdg) #widget.add(span) msg.add("<br/><br/>-- OR --</br/><br/>") msg.add("<b>Published URL: </b>") text = TextWdg("web_url") msg.add(text) msg.add("<br/><br/>-- OR --</br/><br/>") msg.add("<b>Copy and Paste from a Spreadsheet: </b>") text = TextAreaWdg("data") text.add_style('width: 33em') text.add_class("spt_import_cut_paste") msg.add(text) button = ActionButtonWdg(title="Parse") button.add_style("margin: 5px auto") msg.add(button) button.add_behavior( { 'type': 'click_up', 'cbjs_action': ''' var top = bvr.src_el.getParent(".spt_import_top"); var el = top.getElement(".spt_import_cut_paste"); var applet = spt.Applet.get(); var value = el.value; var csv = []; // convert to a csv file! lines = value.split("\\n"); for (var i = 0; i < lines.length; i++) { if (lines[i] == '') { continue; } var parts = lines[i].split("\\t"); var new_line = []; for (var j = 0; j < parts.length; j++) { if (parts[j] == '') { new_line.push(''); } else { new_line.push('"'+parts[j]+'"'); } } new_line = new_line.join(","); csv.push(new_line); } csv = csv.join("\\n") // FIXME: need to get a local temp directory var path = spt.browser.os_is_Windows() ? "C:/sthpw/copy_n_paste.csv" : "/tmp/sthpw/copy_n_paste.csv"; applet.create_file(path, csv); // upload the file applet.upload_file(path) applet.rmtree(path); var top = bvr.src_el.getParent(".spt_import_csv"); var hidden = top.getElement(".spt_upload_hidden"); hidden.value = path; var file_name = spt.path.get_basename(hidden.value); file_name = spt.path.get_filesystem_name(file_name); var class_name = 'tactic.ui.widget.CsvImportWdg'; var values = spt.api.Utility.get_input_values('csv_import_main'); values['is_refresh'] = true; values['file_name'] = file_name; var info = spt.panel.load('csv_import_main', class_name, {}, values); ''' } ) return widget
def get_display(my): search_key = my.kwargs.get("search_key") msg = None base_search_type = SearchKey.extract_search_type(search_key) sobject = SearchKey.get_by_search_key(search_key) process_div = DivWdg() process_div.add_style('padding-top: 10px') if base_search_type in ['sthpw/task', 'sthpw/note']: my.process = sobject.get_value('process') my.context = sobject.get_value('context') if not my.process: my.process = '' parent = sobject.get_parent() if parent: search_key = SearchKey.get_by_sobject(parent) else: msg = "Parent for [%s] not found"%search_key else: my.process = my.kwargs.get('process') top = my.top top.add_class('spt_simple_checkin') top.add_color("background", "background") top.add_styles("position: relative") content = DivWdg(msg) top.add(content) #content.add_border() #content.add_color("background", "background3") #content.add_color("color", "background3") content.add_style("width: 600px") content.add_styles("margin-left: auto; margin-right: auto;") content.add_style("height: 200px") from tactic.ui.widget import CheckinWdg content.add_behavior( { 'type': 'load', 'cbjs_action': CheckinWdg.get_onload_js() } ) button_div = DivWdg() content.add(process_div) content.add(button_div) button = IconWdg(title="Check-In", icon=IconWdg.CHECK_IN_3D_LG) title = Common.get_display_title(my.checkin_action) button.add_attr('title', title) button_div.add(button) button_div.set_box_shadow("1px 1px 1px 1px") button_div.add_style("width: 60px") button_div.add_style("height: 60px") button_div.add_style("float: left") button_div.add_style("background: white") button_div.add_class("hand") button_div.add_style("padding: 2px 3px 0 0") button_div.add_style("margin: 20px 60px 20px 200px") button_div.add_style("text-align: center") button_div.add("Check-in") # to be consistent with Check-in New File if my.process: checkin_process = my.process else: # Dont' specify, the user can choose later in check-in widget checkin_process = '' button.add_behavior( { 'type': 'click_up', 'search_key': search_key, 'process': checkin_process, 'context': my.context, 'cbjs_action': ''' var class_name = 'tactic.ui.widget.CheckinWdg'; var applet = spt.Applet.get(); spt.app_busy.show("Choose file(s) to check in") var current_dir = null; var is_sandbox = false; var refresh = false var values = spt.checkin.browse_folder(current_dir, is_sandbox, refresh); if (!values) { spt.app_busy.hide(); return; } var file_paths = values.file_paths; if (file_paths.length == 0) { spt.alert("You need to select files(s) to check in."); spt.app_busy.hide(); return; } spt.app_busy.hide(); var args = { 'search_key': bvr.search_key, 'show_links': false, 'show_history': false, 'close_on_publish': true } if (bvr.process) args.process = bvr.process; if (bvr.context) args.context = bvr.context; var kwargs = {}; kwargs.values = values; spt.panel.load_popup("Check-in", class_name, args, kwargs); /* var options= { title: "Check-in Widget", class_name: 'tactic.ui.widget.CheckinWdg', popup_id: 'checkin_widget' }; var bvr2 = {}; bvr2.options = options; bvr2.values = values; bvr2.args = args; spt.popup.get_widget({}, bvr2) */ ''' } ) button_div = DivWdg() content.add(button_div) button = IconWdg(title="Check-Out", icon=IconWdg.CHECK_OUT_3D_LG) button_div.add(button) button_div.set_box_shadow("1px 1px 1px 1px") button_div.add_style("width: 60px") button_div.add_style("height: 60px") button_div.add_style("float: left") button_div.add_style("margin: 20px") button_div.add_style("padding: 2px 3px 0 0") button_div.add_style("background: white") button_div.add_class("hand") button_div.add_style("text-align: center") button_div.add("Check-out") sobject = SearchKey.get_by_search_key(search_key) # snapshot is retrieved for getting the process informatoin, they are not being used # for loading as real_time snapshot query option is used. search = Search("sthpw/snapshot") search.add_sobject_filter(sobject) if my.process: search.add_filter("process", my.process) search.add_filter("is_latest", True) snapshot = search.get_sobject() if not my.process and snapshot: my.process = snapshot.get_value('process') # for old process-less snapshots if not my.process: my.process = snapshot.get_value('context') process_wdg = DivWdg(HtmlElement.b(checkin_process)) if checkin_process: width = len(checkin_process)*10 else: width = 10 process_wdg.add_styles('margin-left: auto; margin-right: auto; text-align: center; width: %s'%width) process_div.add(process_wdg) # DO NOT pass in snapshot_code, get it in real time snapshot_codes = [] show_status = True if my.checkout_action == 'latest': cbjs_action = CheckinSandboxListWdg.get_checkout_cbjs_action(my.process, show_status) bvr = {'snapshot_codes': snapshot_codes, 'real_time': True, 'file_types': ['main'], 'filename_mode': 'repo', 'cbjs_action': cbjs_action} elif my.checkout_action == 'latest (version_omitted)': cbjs_action = CheckinSandboxListWdg.get_checkout_cbjs_action(my.process, show_status) bvr = {'snapshot_codes':snapshot_codes, 'real_time': True, 'file_types': ['main'], 'filename_mode': 'versionless', 'cbjs_action': cbjs_action} elif my.checkout_action == 'latest versionless': cbjs_action = CheckinSandboxListWdg.get_checkout_cbjs_action(my.process, show_status) bvr = {'snapshot_codes':snapshot_codes, 'real_time': True, 'versionless': True, 'file_types': ['main'], 'filename_mode': 'versionless', 'cbjs_action': cbjs_action} elif my.checkout_action == 'open file browser': bvr = { 'cbjs_action': ''' var class_name = 'tactic.ui.checkin.SObjectDirListWdg'; var kwargs = { search_keys: [bvr.search_key], process: '%s' }; spt.panel.load_popup("Check-out", class_name, kwargs); '''%my.process } bvr.update({ 'type': 'click_up', 'search_key': search_key}) button.add_behavior(bvr) title = Common.get_display_title(my.checkout_action) button.add_attr('title', title) #TODO: remove these margin-top which is used to compensate all the ButtonNewWdg top extra white space content.add("<br clear='all'/>") status_div = DivWdg() status_div.add_style('margin: 20px 0 0 10px') status_div.add_style('width: 100%') text_info = FloatDivWdg() text_info.add_styles('padding: 4px; width: 500px') text_info.add_style('margin-top: 8px') text_info.add_attr('title','Displays the last checked out file path') text_info.add_border() text_info.set_round_corners() text_content = DivWdg() text_content.add(' ') text_content.add_class('spt_status_area') text_info.add(text_content) label = FloatDivWdg('path:') label.add_style('margin: 12px 6px 0 6px') # button button = ButtonNewWdg(title="Explore", icon=IconWdg.FOLDER_GO) button.add_style('padding-bottom: 15px') button.add_behavior( { 'type': 'click_up', 'cbjs_action': ''' var applet = spt.Applet.get(); var status_div = bvr.src_el.getParent('.spt_simple_checkin').getElement('.spt_status_area'); var value = status_div.get('text'); var dir_name = spt.path.get_dirname(value); if (dir_name) applet.open_explorer(dir_name); ''' } ) status_div.add(label) status_div.add(text_info) content.add(status_div) content.add(button) content.add_behavior({'type':'load', 'cbjs_action': ''' if (!spt.Applet.applet) { spt.api.app_busy_show('Initializing Java', 'Please wait...'); var exec = function() {var applet = spt.Applet.get()}; spt.api.app_busy_hide(exec); }'''}) return top
def get_display(my): sobject = my.get_current_sobject() if isinstance(sobject, Shot): frame_range = sobject.get_frame_range() frame_in, frame_out = sobject.get_frame_handles() frame_notes = sobject.get_frame_notes() else: from pyasm.prod.biz import FrameRange frame_start = my._get_frame_num(sobject, "tc_frame_start") frame_end = my._get_frame_num(sobject, "tc_frame_end") frame_range = FrameRange(frame_start, frame_end, 1) frame_in, frame_out = my._get_frame_handles(sobject) frame_notes = sobject.get_value("frame_note", no_exception=True) frame_notes = WikiUtil().convert(frame_notes) if frame_range.frame_end == frame_range.frame_start == 0: return 'n/a' widget = SpanWdg() widget.set_attr("nowrap", "1") offset = 2 label_width = 16 if frame_range.frame_start > 99: label_width = 20 # start / end frame duration_color = '#969353' div = DivWdg() div.add_tip('START -- END (TOTAL)') wdg_width = 100 div.add_style('width', wdg_width) total = frame_range.frame_end - frame_range.frame_start + 1 start_frame = SpanWdg(str(frame_range.frame_start)) end_frame = SpanWdg(str(frame_range.frame_end)) end_div = FloatDivWdg(end_frame) duration_width = wdg_width * 0.2 - offset spacer_width = float('%.2f' %((duration_width + offset) * (frame_range.frame_start -1 ) /\ frame_range.frame_end)) start_div = FloatDivWdg(start_frame, width=label_width + spacer_width) start_div.add_class('right_content') duration = FloatDivWdg(width=duration_width) duration.add_style("border: 1px dotted %s" % duration_color) duration.add_style("margin-top: 3px") duration.add_style("margin-left: 5px") duration.add_style("margin-right: 5px") duration.add_style("height: 3px") duration.add_style("line-height: 3px") div.add(start_div) div.add(duration) div.add(end_div) dur_text = FloatDivWdg('(%s)' % total) dur_text.add_style("opacity", "0.5") div.add(dur_text) widget.add(div) widget.add(HtmlElement.br()) if frame_in: # in / out frame duration_color = '#b8b365' div = DivWdg() div.add_tip('IN -- OUT') div.add_style('width', wdg_width) handle_total = frame_out - frame_in + 1 in_frame = SpanWdg(str(frame_in)) out_frame = SpanWdg(str(frame_out)) if frame_range.frame_start == 0: frame_range.frame_start = 0.001 spacer_width = float('%.2f' % ((spacer_width) * \ float(frame_in) /frame_range.frame_start )) in_div = FloatDivWdg(in_frame, width=label_width + spacer_width) in_div.add_class('right_content') out_div = FloatDivWdg(out_frame) factor = float(handle_total) / total if factor > 1: factor = 1 duration_width = (duration_width + offset) * factor - offset duration = FloatDivWdg(width=duration_width) duration.add_style("border: 1px solid %s" % duration_color) duration.add_style("background", duration_color) duration.add_style("margin-top: 5px") duration.add_style("margin-left: 5px") duration.add_style("margin-right: 5px") duration.add_style("line-height: 1px") duration.add(' ') # IE needs that to draw a 1px wide div bar = FloatDivWdg('<!-- -->', width=1) bar.add_style("margin-top: 1px") bar.add_style("height: 10px") bar.add_style("line-height: 10px") bar.add_style("background", duration_color) div.add(in_div) div.add(bar) div.add(duration) div.add(bar) div.add(out_div) dur_text = SpanWdg('(%s)' % handle_total) div.add(dur_text) widget.add(div) if frame_notes: widget.add(HtmlElement.br()) widget.add(frame_notes) return widget
def get_upload_wdg(my): '''get search type select and upload wdg''' widget = DivWdg(css='spt_import_csv') widget.add_color('color','color') widget.add_color('background','background') widget.add_style('width: 600px') # get the search type title = DivWdg("<b>Select sType to import data into:</b> ") widget.add( title ) title.add_style("float: left") # handle new search_types new_search_type = CheckboxWdg("new_search_type_checkbox") new_search_type.add_event("onclick", "toggle_display('new_search_type_div')") #span = SpanWdg(css="med") #span.add(new_search_type) #span.add("Create new type") #span.add(" ... or ... ") #widget.add(span) new_search_type_div = DivWdg() new_search_type_div.set_id("new_search_type_div") name_input = TextWdg("asset_name") title = TextWdg("asset_title") description = TextAreaWdg("asset_description") key='csv_import' table = Table() table.set_id('csv_main_body') table.add_style("margin: 10px 10px") table.add_col().set_attr('width','140') table.add_col().set_attr('width','400') table.add_row() table.add_header("Search Type: ").set_attr('align','left') table.add_cell(name_input) table.add_row() table.add_header("Title: ").set_attr('align','left') table.add_cell(title) table.add_row() table.add_header("Description: ").set_attr('align','left') table.add_cell(description) new_search_type_div.add(table) new_search_type_div.add_style("display: none") #widget.add(new_search_type_div) div = DivWdg() search_type_select = SearchTypeSelectWdg("search_type_filter", mode=SearchTypeSelectWdg.ALL) search_type_select.add_empty_option("-- Select --") if not search_type_select.get_value(): search_type_select.set_value(my.search_type) search_type_select.set_persist_on_submit() div.add(search_type_select) widget.add(div) search_type_select.add_behavior( {'type': 'change', \ 'cbjs_action': "spt.panel.load('csv_import_main','%s', {}, {\ 'search_type_filter': bvr.src_el.value});" %(Common.get_full_class_name(my)) } ) if my.search_type: sobj = None try: sobj = SObjectFactory.create(my.search_type) except ImportError: widget.add(HtmlElement.br()) widget.add(SpanWdg('WARNING: Import Error encountered. Please choose another search type.', css='warning')) return widget required_columns = sobj.get_required_columns() if required_columns: widget.add(HtmlElement.br()) req_span = SpanWdg("Required Columns: ", css='med') req_span.add_color('color','color') widget.add(req_span) #required_columns = ['n/a'] req_span.add(', '.join(required_columns)) widget.add( HtmlElement.br() ) if my.file_path: hidden = HiddenWdg("file_path", my.file_path) widget.add(hidden) if my.web_url: file_span = FloatDivWdg('URL: <i>%s</i> ' %my.web_url, css='med') else: file_span = FloatDivWdg('File uploaded: <i>%s</i> ' %os.path.basename(my.file_path), css='med') file_span.add_color('color','color') file_span.add_style('margin: 8px 0 0 10px') file_span.add_style('font-size: 14px') widget.add(file_span) button = ActionButtonWdg(title='Change') button.add_style('float','left') button.add_behavior( {'type': 'click_up', \ 'cbjs_action': "spt.panel.load('csv_import_main','%s', {}, {\ 'search_type_filter': '%s'});" %(Common.get_full_class_name(my), my.search_type) } ) widget.add(button) widget.add("<br clear='all'/>") widget.add(HtmlElement.br()) return widget widget.add("<br/>") widget.add_style("overflow-y: auto") msg = DivWdg() widget.add(msg) msg.add( "<div style='float: left; padding-left: 100px; padding-top: 6px'><b>Upload a csv file: </b></div>") msg.add_border() msg.add_style("width: 400px") msg.add_color("background", "background3") msg.add_style("padding: 20px") msg.add_style("margin: 30 auto") msg.add_style("text-align: center") ticket = Environment.get_security().get_ticket_key() on_complete = '''var server = TacticServerStub.get(); var file = spt.html5upload.get_file(); if (file) { var file_name = file.name; // clean up the file name the way it is done in the server //file_name = spt.path.get_filesystem_name(file_name); var server = TacticServerStub.get(); var class_name = 'tactic.ui.widget.CsvImportWdg'; var values = spt.api.Utility.get_input_values('csv_import_main'); values['is_refresh'] = true; values['file_name'] = file_name; values['html5_ticket'] = '%s'; try { var info = spt.panel.load('csv_import_main', class_name, {}, values); spt.app_busy.hide(); } catch(e) { spt.alert(spt.exception.handler(e)); } } else { alert('Error: file object cannot be found.') } spt.app_busy.hide();'''%ticket from tactic.ui.input import UploadButtonWdg browse = UploadButtonWdg(name='new_csv_upload', title="Browse", tip="Click to choose a csv file",\ on_complete=on_complete, ticket=ticket) browse.add_style('float: left') msg.add(browse) # this is now only used in the copy and paste Upload button for backward-compatibility upload_wdg = SimpleUploadWdg(key=key, show_upload=False) upload_wdg.add_style('display: none') msg.add(upload_wdg) #widget.add(span) msg.add("<br/><br/>-- OR --</br/><br/>") msg.add("<b>Published URL: </b>") text = TextWdg("web_url") msg.add(text) msg.add("<br/><br/>-- OR --</br/><br/>") msg.add("<b>Copy and Paste from a Spreadsheet: </b>") text = TextAreaWdg("data") text.add_style('width: 33em') text.add_class("spt_import_cut_paste") msg.add(text) button = ActionButtonWdg(title="Parse") button.add_style("margin: 5px auto") msg.add(button) button.add_behavior( { 'type': 'click_up', 'cbjs_action': ''' var top = bvr.src_el.getParent(".spt_import_top"); var el = top.getElement(".spt_import_cut_paste"); var applet = spt.Applet.get(); var value = el.value; var csv = []; // convert to a csv file! lines = value.split("\\n"); for (var i = 0; i < lines.length; i++) { if (lines[i] == '') { continue; } var parts = lines[i].split("\\t"); var new_line = []; for (var j = 0; j < parts.length; j++) { if (parts[j] == '') { new_line.push(''); } else { new_line.push('"'+parts[j]+'"'); } } new_line = new_line.join(","); csv.push(new_line); } csv = csv.join("\\n") // FIXME: need to get a local temp directory var path = spt.browser.os_is_Windows() ? "C:/sthpw/copy_n_paste.csv" : "/tmp/sthpw/copy_n_paste.csv"; applet.create_file(path, csv); // upload the file applet.upload_file(path) applet.rmtree(path); var top = bvr.src_el.getParent(".spt_import_csv"); var hidden = top.getElement(".spt_upload_hidden"); hidden.value = path; var file_name = spt.path.get_basename(hidden.value); file_name = spt.path.get_filesystem_name(file_name); var class_name = 'tactic.ui.widget.CsvImportWdg'; var values = spt.api.Utility.get_input_values('csv_import_main'); values['is_refresh'] = true; values['file_name'] = file_name; var info = spt.panel.load('csv_import_main', class_name, {}, values); ''' } ) return widget