def get_display(my): sobject = my.get_current_sobject() search_type = sobject.get_search_type() search_id = sobject.get_id() button = IconButtonWdg("Dependency", IconWdg.DEPENDENCY) button.add_style("margin: 3px 5px") # view doesn't matter behavior = my.get_edit_behavior('pyasm.widget.DependencyWdg', search_type, \ search_id) button.add_behavior(behavior) return button
def get_display(self): sobject = self.get_current_sobject() search_type = sobject.get_search_type() search_id = sobject.get_id() button = IconButtonWdg("Dependency", IconWdg.DEPENDENCY) button.add_style("margin: 3px 5px") # view doesn't matter behavior = self.get_edit_behavior('pyasm.widget.DependencyWdg', search_type, \ search_id) button.add_behavior(behavior) return button
def _handle_files(self, snapshot, widget, upstream, recursive=True): web_dir = snapshot.get_web_dir() xml = snapshot.get_xml_value("snapshot") # handle files files = xml.get_nodes("snapshot/file") for file in files: file_code = Xml.get_attribute(file, "file_code") file_type = Xml.get_attribute(file, "type") file_range = Xml.get_attribute(file, "file_range") #file_range = "1-4/1" dir = snapshot.get_client_lib_dir(file_type=file_type) lib_dir = snapshot.get_lib_dir(file_type=file_type) open_button = IconButtonWdg( "Explore: %s" % dir, IconWdg.LOAD, False) if dir == lib_dir: open_button.add_behavior({'type':'click_up', 'cbjs_action': '''var applet = spt.Applet.get(); spt.alert('You are not allowed to browse directories on a web server.'); '''}) else: open_button.add_behavior({'type':'click_up', 'dir' : dir, 'cbjs_action': ''' var applet = spt.Applet.get(); var dir = bvr.dir; applet.open_explorer(dir);'''}) open_button.add_class('small') open_button.add_style('float: left') widget.add(open_button) if file_range: file_name = Xml.get_attribute(file, "name") widget.add("%s [code = %s, type = %s]" % (file_name, file_code, file_type)) widget.add(HtmlElement.br(2)) # display all of the paths file_names = FileGroup.expand_paths( file_name, FileRange.get(file_range) ) for file_name in file_names: #link = HtmlElement.href(file_name, "%s/%s" % (web_dir, file_name), target="_blank" ) link = SpanWdg(file_name) link.add_color("color", "color") widget.add(link) widget.add(HtmlElement.br()) else: thumb = DependencyThumbWdg() thumb.set_show_filename(True) thumb.set_sobject(snapshot) thumb.set_icon_size(15) thumb.set_image_link_order([file_type]) thumb.set_option('detail', 'false') widget.add(SpanWdg(thumb, css='small')) widget.add("[code = %s, type = %s]" % ( file_code, file_type)) widget.add(HtmlElement.br()) block = DivWdg() block.add_style("margin-left: 30px") block.add_style("margin-top: 10px") nodes = xml.get_nodes("snapshot/file[@file_code='%s']/ref" % file_code) widget.add(HtmlElement.br(clear="all")) # handle sub refs for node in nodes: self._handle_ref_node(node, block, upstream, recursive) block.add(HtmlElement.br()) if nodes: widget.add(block) widget.add(HtmlElement.br()) files = xml.get_nodes("snapshot/unknown_ref") if files: widget.add(HtmlElement.b("Unknown ref.")) for file in files: block = DivWdg() block.add_style("margin-left: 30px") block.add_style("margin-top: 10px") block.add( IconWdg( "Unknown", IconWdg.UNKNOWN) ) path = Xml.get_attribute(file, "path") block.add(path) widget.add(block)