def get_display(my): wdg = TextAreaWdg(my.get_input_name()) wdg.set_attr("rows", "8") parent_asset_code = WebContainer.get_web().get_form_value("edit|related") asset = Asset.get_by_code(parent_asset_code) if asset: wdg.set_value(asset.get_description()) return wdg
def get_display(my): wdg = TextAreaWdg(my.get_input_name()) wdg.set_attr("rows", "8") parent_asset_code = WebContainer.get_web().get_form_value( "edit|related") asset = Asset.get_by_code(parent_asset_code) if asset: wdg.set_value(asset.get_description()) return wdg
def handle_instance(my, table, instance, asset, node_name='', publish=True, allow_ref_checkin=False): # handle the case where asset is not defined if not asset: table.add_row() table.add_blank_cell() table.add_blank_cell() # FIXME: Maya specific parts = instance.split(":") instance_name = parts[0] asset_code = parts[1] if instance_name == asset_code: table.add_cell(instance_name) else: table.add_cell(instance) td = table.add_cell() td.add("< %s node >" % my.session.get_node_type(instance_name)) table.add_blank_cell() return # get the pipeline for this asset and handlers for the pipeline process_name = my.process_select.get_value() handler_hidden = my.get_handler_input(asset, process_name) pipeline = Pipeline.get_by_sobject(asset) # TEST: switch this to using node name instead, if provided if node_name: instance_node = my.session.get_node(node_name) else: instance_node = my.session.get_node(instance) if instance_node is None: return if Xml.get_attribute(instance_node, "reference") == "true": is_ref = True else: is_ref = False namespace = Xml.get_attribute(instance_node, "namespace") if not namespace: namespace = instance asset_code = asset.get_code() is_set = False if asset.get_value('asset_type', no_exception=True) in ['set', 'section']: is_set = True tr = table.add_row() if is_set: tr.add_class("group") if publish and (allow_ref_checkin or not is_ref): checkbox = CheckboxWdg("asset_instances") if is_set: checkbox = CheckboxWdg("set_instances") checkbox.set_option("value", "%s|%s|%s" % \ (namespace, asset_code, instance) ) checkbox.set_persist_on_submit() td = table.add_cell(checkbox) else: td = table.add_blank_cell() # only one will be added even if there are multiple if handler_hidden: td.add(handler_hidden) # add the thumbnail thumb = ThumbWdg() thumb.set_name("images") thumb.set_sobject(asset) thumb.set_icon_size(60) table.add_cell(thumb) info_wdg = Widget() info_wdg.add(HtmlElement.b(instance)) if not node_name: node_name = '%s - %s' % (asset_code, asset.get_name()) info_div = DivWdg(node_name) info_div.add_style('font-size: 0.8em') info_wdg.add(info_div) info_div.add(HtmlElement.br(2)) if pipeline: info_div.add(pipeline.get_code()) table.add_cell(info_wdg) # by default can't checkin references if not allow_ref_checkin and is_ref: #icon = IconWdg("error", IconWdg.ERROR) #td = table.add_cell(icon) td = table.add_cell() td.add(HtmlElement.b("Ref. instance")) ''' import_button = ProdIconButtonWdg('import') import_button.add_event('onclick', "import_instance('%s')" %instance) td.add(import_button) ''' table.add_cell(my.get_save_wdg(my.current_sobject)) elif publish: textarea = TextAreaWdg() textarea.set_persist_on_submit() textarea.set_name("%s_description" % instance) textarea.set_attr("cols", "35") textarea.set_attr("rows", "2") table.add_cell(textarea) table.add_cell(my.get_save_wdg(my.current_sobject)) else: table.add_blank_cell() table.add_blank_cell()
def handle_instance(my, table, instance, asset, node_name='', publish=True, allow_ref_checkin=False): # handle the case where asset is not defined if not asset: table.add_row() table.add_blank_cell() table.add_blank_cell() # FIXME: Maya specific parts = instance.split(":") instance_name = parts[0] asset_code = parts[1] if instance_name == asset_code: table.add_cell(instance_name) else: table.add_cell(instance) td = table.add_cell() td.add("< %s node >" % my.session.get_node_type(instance_name)) table.add_blank_cell() return # get the pipeline for this asset and handlers for the pipeline process_name = my.process_select.get_value() handler_hidden = my.get_handler_input(asset, process_name) pipeline = Pipeline.get_by_sobject(asset) # TEST: switch this to using node name instead, if provided if node_name: instance_node = my.session.get_node(node_name) else: instance_node = my.session.get_node(instance) if instance_node is None: return if Xml.get_attribute(instance_node,"reference") == "true": is_ref = True else: is_ref = False namespace = Xml.get_attribute(instance_node, "namespace") if not namespace: namespace = instance asset_code = asset.get_code() is_set = False if asset.get_value('asset_type', no_exception=True) in ['set','section']: is_set = True tr = table.add_row() if is_set: tr.add_class("group") if publish and (allow_ref_checkin or not is_ref): checkbox = CheckboxWdg("asset_instances") if is_set: checkbox = CheckboxWdg("set_instances") checkbox.set_option("value", "%s|%s|%s" % \ (namespace, asset_code, instance) ) checkbox.set_persist_on_submit() td = table.add_cell(checkbox) else: td = table.add_blank_cell() # only one will be added even if there are multiple if handler_hidden: td.add(handler_hidden) # add the thumbnail thumb = ThumbWdg() thumb.set_name("images") thumb.set_sobject(asset) thumb.set_icon_size(60) table.add_cell(thumb) info_wdg = Widget() info_wdg.add(HtmlElement.b(instance)) if not node_name: node_name = '%s - %s' %(asset_code, asset.get_name()) info_div = DivWdg(node_name) info_div.add_style('font-size: 0.8em') info_wdg.add(info_div) info_div.add(HtmlElement.br(2)) if pipeline: info_div.add(pipeline.get_code()) table.add_cell(info_wdg) # by default can't checkin references if not allow_ref_checkin and is_ref: #icon = IconWdg("error", IconWdg.ERROR) #td = table.add_cell(icon) td = table.add_cell() td.add(HtmlElement.b("Ref. instance")) ''' import_button = ProdIconButtonWdg('import') import_button.add_event('onclick', "import_instance('%s')" %instance) td.add(import_button) ''' table.add_cell(my.get_save_wdg(my.current_sobject) ) elif publish: textarea = TextAreaWdg() textarea.set_persist_on_submit() textarea.set_name("%s_description" % instance) textarea.set_attr("cols", "35") textarea.set_attr("rows", "2") table.add_cell(textarea) table.add_cell(my.get_save_wdg(my.current_sobject) ) else: table.add_blank_cell() table.add_blank_cell()