예제 #1
0
    def get_display(my):

        web = WebContainer.get_web()
        user = WebContainer.get_user_name()
        local_dir = web.get_local_dir()
        context_url = web.get_site_context_url().to_string()
        server = web.get_base_url().to_string()
        upload_url = web.get_upload_url()

        html = Html()

        html.writeln('''\n<script>try{ app = new PyXSI(); }
                                catch(e){
                                    app = null;}
        if (app) {
            app.user = '******';
            app.local_dir = '%(local_dir)s';
            app.context_url = '%(context_url)s';
            app.base_url = '%(server)s';
            app.upload_url = '%(upload_url)s';
            app.project_code = '%(project_code)s';} </script>'''%{'user': user,
                                           'local_dir': local_dir,
                                           'context_url' : context_url,
                                           'server': server,
                                           'upload_url':  upload_url,
                                           'project_code':  Project.get_project_code()})
                            


        return html
예제 #2
0
    def get_display(self):

        web = WebContainer.get_web()
        user = WebContainer.get_user_name()
        local_dir = web.get_local_dir()
        context_url = web.get_site_context_url().to_string()
        server = web.get_base_url().to_string()
        upload_url = web.get_upload_url()

        html = Html()
        html.writeln('<script language="JavaScript" src="resource:///res/RunHCommand.js"></script>')

        html.writeln('''\n<script>try{ app = new PyHoudini(); }
                                catch(e){
                                    app = null;}
        if (app) {
            app.user = '******';
            app.local_dir = '%(local_dir)s';
            app.context_url = '%(context_url)s';
            app.base_url = '%(server)s';
            app.upload_url = '%(upload_url)s';
            app.project_code = '%(project_code)s';} </script>'''%{'user': user,
                                           'local_dir': local_dir,
                                           'context_url' : context_url,
                                           'server': server,
                                           'upload_url':  upload_url,
                                           'project_code':  Project.get_project_code()})
        return html
예제 #3
0
 def get_display(my):
     html = Html()
     html.writeln("<script>var pyp4=new PyPerforce()</script>")
     
     upload_url = WebContainer.get_web().get_upload_url()
     html.writeln("<script>var tactic_repo=new TacticRepo()</script>")
     html.writeln("<script>tactic_repo.upload_url='%s'</script>" %upload_url)
     return html
예제 #4
0
    def get_display(my):
        sobject = my.get_current_sobject()

        if my.name == None:
            my.name = "snapshot"

        xml = sobject.get_xml_value(my.name)

        images = xml.get_values("snapshot/file/@name")
        if len(images) != 3:
            return "No images"
        file_codes = xml.get_values("snapshot/file/@file_code")

        html = Html()
        for i in range(0, len(images)):
            html.writeln("%0.10d : %s<br/>" % (int(file_codes[i]), images[i]) )

        return html.getvalue()
예제 #5
0
파일: file_wdg.py 프로젝트: menechel/TACTIC
    def get_display(my):
        sobject = my.get_current_sobject()

        if my.name == None:
            my.name = "snapshot"

        xml = sobject.get_xml_value(my.name)

        images = xml.get_values("snapshot/file/@name")
        if len(images) != 3:
            return "No images"
        file_codes = xml.get_values("snapshot/file/@file_code")

        html = Html()
        for i in range(0, len(images)):
            html.writeln("%0.10d : %s<br/>" % (int(file_codes[i]), images[i]) )

        return html.getvalue()
예제 #6
0
    def get_display(self):

        web = WebContainer.get_web()
        user = WebContainer.get_user_name()
        local_dir = web.get_local_dir()
        context_url = web.get_site_context_url().to_string()
        server = web.get_base_url().to_string()
        upload_url = web.get_upload_url()

        html = Html()
        html.writeln(
            '<script language="JavaScript" src="resource:///res/RunHCommand.js"></script>'
        )

        html.writeln(
            '''\n<script>try{ app = new PyHoudini(); }
                                catch(e){
                                    app = null;}
        if (app) {
            app.user = '******';
            app.local_dir = '%(local_dir)s';
            app.context_url = '%(context_url)s';
            app.base_url = '%(server)s';
            app.upload_url = '%(upload_url)s';
            app.project_code = '%(project_code)s';} </script>''' % {
                'user': user,
                'local_dir': local_dir,
                'context_url': context_url,
                'server': server,
                'upload_url': upload_url,
                'project_code': Project.get_project_code()
            })
        return html
예제 #7
0
    def replace_elements(my, html_str):

        """
        # NOTE: this likely is a better way to extract elements, but still
        # need to find a way to inject html back into the xml
        xml = Xml()
        xml.read_string("<div>%s</div>" % html_str)
        elements = xml.get_nodes("//element")

        for element in elements:
            # create a complete config
            full_line_str = xml.to_string(element)
            tmp_config = '''<config><tmp>%s</tmp></config>''' % full_line_str

            try:
                element_wdg = my.get_element_wdg(xml, my.def_config)
                element_html = element_wdg.get_buffer_display()
            except Exception, e:
                from pyasm.widget import ExceptionWdg
                element_html = ExceptionWdg(e).get_buffer_display()

            xml = Xml()
            try:
                xml.read_string(element_html)
            except Exception, e:
                print "Error: ", e
                xml.read_string("<h1>%s</h1>" % str(e) )
            root = xml.get_root_node()

            parent = xml.get_parent(element)
            xml.replace_child(parent, element, root)

        return xml.to_string()
        """


        # a simple readline interpreter
        html = Html()
        full_line = []
        parse_context = None
        for line in html_str.split("\n"):
            line2 = line.strip()


            #if not parse_context and not line2.startswith('<element '):
            index = line2.find('<element>')
            if index == -1:
                index = line2.find('<element ')


            if not parse_context and index == -1:
                #line = Common.process_unicode_string(line)
                html.writeln(line)
                continue

            if index != -1:
                part1 = line2[:index]
                html.write(part1)
                line2 = line2[index:]

            full_line.append(line2)
            xml = Xml()
            # determine if this is valid xml
            try:
                # create a complete config
                full_line_str = "".join(full_line)
                tmp_config = '''<config><tmp>%s</tmp></config>''' % full_line_str
                xml.read_string(tmp_config, print_error=False)

                full_line = []
                parse_context = ''

            except XmlException, e:
                parse_context = 'element'
                #raise e
                continue

            try:
                element_wdg = my.get_element_wdg(xml, my.def_config)
                if element_wdg:
                    element_html = element_wdg.get_buffer_display()
                else:
                    element_html = ''
            except Exception, e:
                from pyasm.widget import ExceptionWdg
                element_html = ExceptionWdg(e).get_buffer_display()
예제 #8
0
    def replace_elements(my, html_str):

        """
        # NOTE: this likely is a better way to extract elements, but still
        # need to find a way to inject html back into the xml
        xml = Xml()
        xml.read_string("<div>%s</div>" % html_str)
        elements = xml.get_nodes("//element")

        for element in elements:
            # create a complete config
            full_line_str = xml.to_string(element)
            tmp_config = '''<config><tmp>%s</tmp></config>''' % full_line_str

            try:
                element_wdg = my.get_element_wdg(xml, my.def_config)
                element_html = element_wdg.get_buffer_display()
            except Exception, e:
                from pyasm.widget import ExceptionWdg
                element_html = ExceptionWdg(e).get_buffer_display()

            xml = Xml()
            try:
                xml.read_string(element_html)
            except Exception, e:
                print "Error: ", e
                xml.read_string("<h1>%s</h1>" % str(e) )
            root = xml.get_root_node()

            parent = xml.get_parent(element)
            xml.replace_child(parent, element, root)

        return xml.to_string()
        """


        # a simple readline interpreter
        html = Html()
        full_line = []
        parse_context = None
        for line in html_str.split("\n"):
            line2 = line.strip()


            #if not parse_context and not line2.startswith('<element '):
            index = line2.find('<element>')
            if index == -1:
                index = line2.find('<element ')


            if not parse_context and index == -1:
                #line = Common.process_unicode_string(line)
                html.writeln(line)
                continue

            if index != -1:
                part1 = line2[:index]
                html.write(part1)
                line2 = line2[index:]

            full_line.append(line2)
            xml = Xml()
            # determine if this is valid xml
            try:
                # create a complete config
                full_line_str = "".join(full_line)
                tmp_config = '''<config><tmp>%s</tmp></config>''' % full_line_str
                xml.read_string(tmp_config, print_error=False)

                full_line = []
                parse_context = ''

            except XmlException, e:
                parse_context = 'element'
                #raise e
                continue

            try:
                element_wdg = my.get_element_wdg(xml, my.def_config)
                if element_wdg:
                    element_html = element_wdg.get_buffer_display()
                else:
                    element_html = ''
            except Exception, e:
                from pyasm.widget import ExceptionWdg
                element_html = ExceptionWdg(e).get_buffer_display()
예제 #9
0
    def get_display(my):
        web = WebContainer.get_web()

        html = Html()

        html.writeln("<script>var pyflash=new PyFlash()</script>")

        # add in parameters for pyflash
        user = WebContainer.get_user_name()
        html.writeln("<script>pyflash.user = '******'</script>" % user)
        local_dir = web.get_local_dir()
        html.writeln("<script>pyflash.local_dir = '%s'</script>" % local_dir)

        server = web.get_base_url().to_string()
        html.writeln("<script>pyflash.server_url = '%s'</script>" % server)
       
        context_url = web.get_site_context_url().to_string()
        html.writeln("<script>pyflash.context_url = '%s%s'</script>" % (server, context_url))

        upload_url = web.get_upload_url()
        html.writeln("<script>pyflash.upload_url = '%s'</script>" % upload_url)

        return html