示例#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 handle_tab(self, tab):
        # Hide this for now
        #tab.add( self.get_create_wdg, "Create")
        #tab.add( self.get_edit_wdg, "Edit" )
        tab.add( LoginWdg, _("Users") )
        tab.add( LoginGroupWdg, _("Groups") )
        tab.add( self.get_user_group_wdg, _("Users -> Groups")) 
        tab.add( self.get_group_user_wdg, _("Groups -> Users") )
        tab.add( QueueWdg, _("Queue") )
        tab.add( self.get_render_policy_wdg, _("Render Policy") )
        #tab.add( PipelineEditorWdg, _("Pipelines") )
        tab.add( self.get_pipeline_wdg, _("Pipelines") )
        tab.add( self.get_group_notification_wdg, _("Notification -> Group") )
        tab.add( self.get_notification_group_wdg, _("Group -> Notification" ) )


        tab.add( self.get_milestone_wdg, _("Project Milestones") )
        tab.add( self.get_project_settings_wdg, _("Project Settings") )
        
        tab.add( CustomProjectTabWdg, _("Customize Project") )


        from setup_tab_wdg import SetupTabWdg
        tab.add( SetupTabWdg, _("Setup Wizard")) 


        tab.add(self.get_import_wdg, _("Import Data") )
        WebContainer.add_js('wz_dragdrop.js')
示例#3
0
 def get_instantiation_options(self):
     options = ['reference', 'import', 'open']
     if WebContainer.get_web().get_selected_app() == 'Houdini':
         options = ['import', 'open']
     elif WebContainer.get_web().get_selected_app() == 'XSI':
         options = ['open']
     return options
示例#4
0
    def get_display(my):
        widget = Widget()
        
        thumb = super(ThumbPublishWdg, my).get_display()

        widget.add(thumb)
        sobject = my.get_current_sobject()
        search_type = sobject.get_search_type()
        search_id = sobject.get_id()

        publish_link = PublishLinkWdg(search_type,search_id) 
        div = DivWdg(publish_link)
        div.set_style('clear: left; padding-top: 6px')
        widget.add(div)

        # build an iframe to show publish browsing
        browse_link = IconButtonWdg("Publish Browser", IconWdg.CONTENTS)
        iframe = WebContainer.get_iframe()
        iframe.set_width(100)

        url = WebContainer.get_web().get_widget_url()
        url.set_option("widget", "pyasm.prod.web.PublishBrowserWdg")
        url.set_option("search_type", search_type)
        url.set_option("search_id", search_id)
        script = iframe.get_on_script(url.to_string())
        browse_link.add_event("onclick", script)

        div.add(browse_link)
        div.set_style('padding-top: 6px')


        return widget
示例#5
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
示例#6
0
文件: applet.py 项目: mincau/TACTIC
    def init(self):
        #print "DEPRECATED"
        #raise TacticException("Use of GeneralAppletWdg is Deprecated")

        # it's generated thru JS in IE
        if WebContainer.get_web().is_IE():
            return
        
        context_url = WebContainer.get_web().get_context_url()
        
        print "-"*20
        print self.APPLET_CLASS


        # create applet
        applet = HtmlElement("applet")
        applet.set_attr("code", self.APPLET_CLASS)
        applet.set_attr("codebase", "%s/java" % context_url.get_url() )
        applet.set_attr("archive", self.APPLET_JAR)
        applet.set_attr("width", "1")
        applet.set_attr("height", "1")
        applet.set_attr("id", self.APPLET_ID)
    
        # create param for applet
        param = HtmlElement("param")
        param.set_attr("name","scriptable")
        param.set_attr("value","true")

        applet.add(param)
        
        self.add(applet)
示例#7
0
 def get_instantiation_options(my):
     options = ["reference", "import", "open"]
     if WebContainer.get_web().get_selected_app() == "Houdini":
         options = ["import", "open"]
     elif WebContainer.get_web().get_selected_app() == "XSI":
         options = ["open"]
     return options
示例#8
0
    def init(my):

        help = HelpItemWdg('Loader', 'The Loader lets you load 3D assets into your 3D applications. Among many options, you can choose to either reference, import, or open the asset through http or the internal file system.')
        my.add(help)

        pref = PrefSetting.get_value_by_key("use_java_maya")
        app = WebContainer.get_web().get_app_name_by_uri()
        
        if app == "Maya":
            if not Container.get('GeneralAppletWdg'):
                my.add( GeneralAppletWdg() )
                Container.put('GeneralAppletWdg', True)
        site_menu = SiteMenuWdg()
        site_menu.add_style("float", "right")
        site_menu.add_style("margin-top", "-2px")
        my.add(site_menu)
        
        WebContainer.add_js('MayaWebTools.js')
        WebContainer.add_js('PyMaya.js')
        
        tab = MayaTabWdgImpl()
        tab_value = tab.set_tab_key("maya_tab")
        #my.handle_tab(tab)
        #my.add(tab,"tab")
        my.setup_tab("maya_tab", tab=tab)
        my.add( ProgressWdg() )
    def execute(my):
        # Since this is not called with Command.execute_cmd
        my.check()

        web = WebContainer.get_web()

        reset_on = my.kwargs.get('reset') == True
        if reset_on:
            security = WebContainer.get_security()
            #Batch()
            login = Login.get_by_login(my.login)
            if not login:
                web.set_form_value(ResetPasswordWdg.MSG, 'This user [%s] does not exist or has been disabled. Please contact the Administrator.'%my.login)
                return
            email = login.get_value('email')
            if not email:
                web.set_form_value(ResetPasswordWdg.MSG, 'This user [%s] does not have an email entry for us to email you the new password. Please contact the Administrator.'%my.login)
                return

        
            # auto pass generation
            unique_code = ''.join([ random.choice('abcdefghijklmno12345') for i in xrange(0, 5)])
            auto_password = unique_code
            
            msg = ResetPasswordWdg.RESET_MSG
            
            # send the email
            try:
                from pyasm.command import EmailTriggerTestCmd

                admin = Login.get_by_login('admin')
                if admin:
                    sender_email = admin.get_value('email')
                else:
                    sender_email = '*****@*****.**'

                recipient_emails = [email]
                email_msg =  'Your TACTIC password has been reset. The new password is:\n%s\nYou can change your password once you log in by going to Edit My Account at the top right corner.'%auto_password
                email_cmd = EmailTriggerTestCmd(sender_email=sender_email, recipient_emails=recipient_emails, msg= email_msg, subject='TACTIC password change')
            
                email_cmd.execute()
            except TacticException, e:
                
                msg = "Failed to send an email for your new password. Reset aborted."
                web.set_form_value(ResetPasswordWdg.MSG, msg)
                raise 
            else:
                encrypted = hashlib.md5(auto_password).hexdigest()
                login.set_value('password', encrypted)
                login.commit()
                web.set_form_value(ResetPasswordWdg.MSG, 'A new password has been sent to your email address. Please check your email.')


                
            # handle windows domains
            #if my.domain:
            #    my.login = "******" % (my.domain, my.login)

            web.set_form_value(ResetPasswordWdg.MSG, msg)
示例#10
0
    def init(my, ticket):
        XmlRpcInit(ticket)

        # initialize the web environment object and register it
        adapter = my.get_adapter()
        
        WebContainer.set_web(adapter)
       
        my.set_templates()
示例#11
0
 def check(my):
     my.add = WebContainer.get_web().get_form_value(\
         SObjectGroupWdg.ADD_LABEL) != ''
     my.remove = WebContainer.get_web().get_form_value(\
         SObjectGroupCmd.REMOVE_CMD) != ''
     if my.add or my.remove:
         if my.grouping_search_type and my.item_foreign_key and \
                 my.container_foreign_key:
             return True
     else:
         return False
示例#12
0
    def get_display(self):
        # set up the self refresh event for other widgets or callbacks to call
        event_container = WebContainer.get_event_container()
        script = ClipboardWdg.get_self_refresh_script(show_progress=False)
        event_container.add_listener(self.EVENT_ID, script, replace=True )

        if self.is_from_ajax():
            div = Widget()
        else:
            div = DivWdg()
            div.set_id(self.ID)
            div.add_style("display: block")
            div.add_class("background_box")
            div.add_style("padding-left: 3px")
            div.add_style("padding-right: 3px")
            div.add_style("height: 1.5em")
            div.add_style("width: 150px")

        # handle the ajax
        self.set_ajax_top_id(self.ID)
        self.register_cmd(ClipboardClearCbk)
        refresh_script = self.get_refresh_script()

        search = Search("sthpw/clipboard")
        search.add_user_filter()
        search.add_filter("category", "select")
        count = search.get_count()

        div.add("Clipboard: %s items: " % count)


        web = WebContainer.get_web()
        url = WebContainer.get_web().get_widget_url()
        url.set_option("widget", "pyasm.widget.ClipboardListWdg")
        ref = url.to_string()

        iframe = WebContainer.get_iframe()
        iframe.set_width(64)
        action = iframe.get_on_script(ref)
       
        button = IconButtonWdg("View Clipboard", IconWdg.LOAD)
        button.add_event("onclick", action)
        div.add(button)



        # add the clear clipboard icon
        clear_icon = IconButtonWdg("Clear Clipboard", IconWdg.CLEAR)
        clear_icon.add_event("onclick", refresh_script)

        div.add(clear_icon)

        return div
示例#13
0
    def get_new_tab_wdg(self):
        widget = Widget()

        span = SpanWdg()
        swap = SwapDisplayWdg.get_triangle_wdg()
        title = SpanWdg("Tab Creation")
        span.add(swap)
        span.add(title)
        span.add_style("float: left")
        widget.add(span)
        widget.add(HtmlElement.br() )

        # add the tab selector
        div = DivWdg()
        SwapDisplayWdg.create_swap_title( title, swap, div)

        tab_text = TextWdg("tab")
        tab_text.set_persistence()
        span = SpanWdg(css="med")
        span.add("Tab: ")
        span.add(tab_text)
        div.add(span)

        # parent
        index_text = TextWdg("parent_tab")
        index_text.set_persistence()
        span = SpanWdg(css="med")
        span.add("Parent Tab: ")
        span.add(index_text)
        span.add(HintWdg("Enter the name of the tab that this will fall under. Leave empty to put on the main tab") )
        div.add(span)


        # index
        index_text = TextWdg("index")
        index_text.set_attr("size", "4")
        index_text.set_persistence()
        span = SpanWdg(css="med")
        span.add("Index: ")
        span.add(index_text)
        span.add(HintWdg("Enter the numeric location for this tab to be placed") )
        div.add(span)

        WebContainer.register_cmd("CreateTabCmd")
        button = IconSubmitWdg("Create Tab", IconWdg.CREATE, True)
        div.add(button)

        widget.add(div)

        return widget
示例#14
0
    def get_popup_script(msg='', css='', icon='', ref=None, width=70):
        ''' returns a javascript that will trigger a popup message box in
            an iframe '''
        if not ref:
            url = WebContainer.get_web().get_widget_url()
            url.set_option("widget", "MessageWdg")
            url.set_option("args", [msg, css, icon])
            
            ref = url.get_url()

        # open iframe
        iframe = WebContainer.get_iframe()
        iframe.set_width(width)
        action = iframe.get_on_script(ref)
        return action    
示例#15
0
    def execute(my):

        from pyasm.web import WebContainer
        web = WebContainer.get_web()

        # If the tag <force_lowercase_login> is set to "true"
        # in the TACTIC config file,
        # then force the login string argument to be lowercase.
        # This tag is false by default.
        my.login = web.get_form_value("login")
        if Config.get_value("security","force_lowercase_login") == "true":
            my.login = my.login.lower()
        my.password = web.get_form_value("password")
        my.domain = web.get_form_value("domain")

        if my.login == "" and my.password == "":
            return False

        
        if my.login == "" or  my.password == "":
            web.set_form_value(WebLoginWdg.LOGIN_MSG, \
                "Empty username or password") 
            return False
        
        security = WebContainer.get_security()

        # handle windows domains
        #if my.domain:
        #    my.login = "******" % (my.domain, my.login)

        verify_password = web.get_form_value("verify_password")
        if verify_password:
            if verify_password != my.password:
                web.set_form_value(WebLoginWdg.LOGIN_MSG, \
                    "Passwords do not match.") 
                return False

            my.password = Login.get_default_password()

        try:
            security.login_user(my.login, my.password, domain=my.domain)
        except SecurityException, e:
            msg = str(e)
            if not msg:
                msg = "Incorrect username or password"

            from pyasm.widget import WebLoginWdg
            web.set_form_value(WebLoginWdg.LOGIN_MSG, msg)
示例#16
0
    def _checkin(my, instance, context, asset_type='asset', is_current=True, \
            is_revision=True, snapshot_type="asset", texture_search_type=None):
        '''retrieve the asset sobject and run the checkin command'''
        
        web = WebContainer.get_web()
        namespace, asset_code, instance_name = instance.split("|")
        description = WebContainer.get_web().get_form_value(\
            "%s_description" % instance_name)

        # get the sobject from asset_code
        
        my.sobject = Search.get_by_code(my.search_type, asset_code)
        if my.sobject == None:
            raise CommandException("SObject '%s' does not exist'" % asset_code)
        # now checkin the asset
        checkin = None

        # we assume asset_type = 'asset' by default
        if asset_type == 'asset':
            checkin = MayaAssetCheckin(my.sobject)
            checkin.set_instance(instance_name)
            checkin.set_option('texture_search_type', texture_search_type)
        elif asset_type =='set':
            checkin = MayaGroupCheckin(my.sobject)
        else:
            raise CommandException('Unknown asset type[%s] found' %asset_type)
        checkin.set_description(description)
        checkin.set_process(my.process)
        checkin.set_context(context)
        checkin.set_current(is_current)
        checkin.set_revision(is_revision)
        use_handoff_dir = web.get_form_value("use_handoff_dir")
        if use_handoff_dir in ['true','on']:
            checkin.set_use_handoff(True)
        if snapshot_type:
            checkin.set_snapshot_type(snapshot_type)

        checkin.set_option("unknown_ref", web.get_form_value("unknown_ref"))
        checkin.execute()

        snapshot = checkin.get_snapshot()
        version = snapshot.get_version()
        if description == "":
            description = "<No description>"
        my.add_description("Checked in %s '%s', context: %s, v%0.3d, %s" % \
            (asset_type.capitalize(), instance_name, context, version, description))
       
        my.sobjects = [my.sobject]
示例#17
0
    def init(my):
        web = WebContainer.get_web()
        
        my.is_refresh = my.kwargs.get('is_refresh')
        my.search_type = my.kwargs.get('search_type')
        if not my.search_type:
            my.search_type = web.get_form_value('search_type_filter')
        my.close_cbfn = my.kwargs.get('close_cbfn')

        my.web_url = web.get_form_value("web_url")
        my.file_path = None
        if my.web_url:
            import urllib2
            response = urllib2.urlopen(my.web_url)
            csv = response.read()
            my.file_path = "/tmp/test.csv"
            f = open(my.file_path, 'w')
            f.write(csv)
            f.close()

        if not my.file_path:
            my.file_path =  web.get_form_value('file_path')

        if not my.file_path:
            file_name =  web.get_form_value('file_name')
            ticket =  web.get_form_value('html5_ticket')
            if not ticket:
                ticket =  web.get_form_value('csv_import|ticket')
                
            if file_name:
                # this is treated the same in FileUplaod class
                #file_name = File.get_filesystem_name(str(file_name))
                my.file_path = '%s/%s' %(web.get_upload_dir(ticket=ticket), file_name)
示例#18
0
    def execute(my):

        left_cb_name , right_cb_name = my.get_checkbox_names()
        
        web = WebContainer.get_web()

        right_search_keys = web.get_form_values(right_cb_name)
        if not right_search_keys:
            return

        right_sobjects = []
        for right_search_key in right_search_keys:
            right_sobject = Search.get_by_search_key(right_search_key)
            right_sobjects.append(right_sobject)

        search_type = my.get_search_type()

        left_search_keys = web.get_form_values(left_cb_name)
        for left_search_key in left_search_keys:

            left_sobject = Search.get_by_search_key( left_search_key )
            for right_sobject in right_sobjects:
                #instance_name = "%s" % right_sobject.get_value("name")

                left_foreign_key = left_sobject.get_foreign_key()
                right_foreign_key = right_sobject.get_foreign_key()

                instance = SObjectFactory.create(search_type)
                instance.set_value(left_foreign_key, left_sobject.get_code() )
                instance.set_value(right_foreign_key, right_sobject.get_code() )

                name = left_sobject.get_code()
                instance.set_value("name", name)
                instance.commit()
示例#19
0
    def get_display(my):
        web = WebContainer.get_web()

        widget = Widget()

        search_type = web.get_form_value("parent_search_type")
        search_id = web.get_form_value("parent_search_id")

        if not search_type:
            widget.add("RenderSubmitInfo: parent type not found")
            return widget

        hidden = HiddenWdg("parent_search_type", search_type)
        widget.add(hidden)
        hidden = HiddenWdg("parent_search_id", search_id)
        widget.add(hidden)

        sobject = Search.get_by_id(search_type, search_id)
        table = TableWdg(search_type, css="embed")
        table.set_show_property(False)
        table.set_sobject(sobject)
        table.remove_widget("render")
        table.remove_widget("description")
        widget.add(table)

        return widget
示例#20
0
    def get_top_wdg(my):

        #if not my.hash and not my.custom_url:
        #    search = Search("config/url")
        #    search.add_filter("url", "/index")
        #    my.custom_url = search.get_sobject()

        # NOTE: this is not the right place for this, but it allows the
        # top widget to completely be customized

        # if there is a custom url, then handle it separately
        if my.custom_url:
            xml = my.custom_url.get_xml_value("widget")
            index = xml.get_value("element/@index")
            admin = xml.get_value("element/@admin")
            widget = xml.get_value("element/@widget")
            bootstrap = xml.get_value("element/@bootstrap")
            if index == 'true' or admin == 'true':
                pass
            elif bootstrap == 'true':
                widget = BootstrapIndexWdg()
                return widget
            elif widget == 'true':
                web = WebContainer.get_web()
                hash = "/".join(my.hash)
                hash = "/%s" % hash
                my.top = CustomTopWdg(url=my.custom_url, hash=hash)
                return my.top

        # This is the default TACTIC html implementation for html
        my.top = TopWdg(hash=my.hash)
        return my.top
示例#21
0
    def get_display(my):

        top = DivWdg()
        my.set_as_panel(top)
        top.add_class("spt_table_view_manager_top")

        my.search_type = my.kwargs.get("search_type")
        my.view = my.kwargs.get("view")

        web = WebContainer.get_web()
        if not my.search_type:
            my.search_type = web.get_form_value("search_type")
        if not my.view:
            my.view = web.get_form_value("view")
        if not my.view:
            my.view = 'table'


        filter_wdg = my.get_filter_wdg()
        top.add(filter_wdg)


        #web = WebContainer.get_web()
        #search_type = web.get_form_value("search_type")
        #view = web.get_form_value("view")

        view_manager_wdg = ViewManagerWdg(search_type=my.search_type,view=my.view)
        top.add(view_manager_wdg)


        return top
示例#22
0
    def get_css_wdg(my):

        widget = Widget()

        web = WebContainer.get_web()
        context_url = web.get_context_url().to_string()

        skin = web.get_skin()

        # first load context css
        Container.append_seq("Page:css", "%s/style/layout.css" % context_url)


        # add the color wheel css
        Container.append_seq("Page:css", "%s/spt_js/mooRainbow/Assets/mooRainbow.css" % context_url)
        Container.append_seq("Page:css", "%s/spt_js/mooDialog/css/MooDialog.css" % context_url)
        Container.append_seq("Page:css", "%s/spt_js/mooScrollable/Scrollable.css" % context_url)

        # TEST
        Container.append_seq("Page:css", "%s/spt_js/video/video-js.css" % context_url)


        # get all of the registered css file
        css_files = Container.get_seq("Page:css")
        for css_file in css_files:
            widget.add('<link rel="stylesheet" href="%s" type="text/css" />\n' % css_file )

       
        return widget
示例#23
0
    def execute(self):

        # make sure tmp config is unset.
        Config.unset_tmp_config()
        Config.reload_config()

        web = WebContainer.get_web()

        vendor = web.get_form_value("database/vendor")

        if vendor == 'Sqlite':
            db_dir = web.get_form_value("database/sqlite_db_dir")
            database = "sthpw"
            db_path = "%s/%s.db" % (db_dir, database)
            if os.path.exists(db_path):
                return

        elif vendor == 'PostgreSQL':
            self.test_postgres(vendor)
            return

        elif vendor in ['MySQL', 'SQLServer', 'Oracle']:
            self.test_postgres(vendor)
            return

        self.info['error'] = "Cannot connect to database"
示例#24
0
 def handle_config(my):
     '''for search type display config'''
     web = WebContainer.get_web()
     WidgetDbConfig.append(my.search_type,
                           my.view,
                           my.element_name,
                           config_xml=my.config_xml)
示例#25
0
    def get_value(my, name):
        web = WebContainer.get_web()
        value = web.get_form_value(name)
        if not value:
            value = my.kwargs.get(name)

        return value
示例#26
0
    def execute(my):
        sobject = my.sobject

        name = my.get_name()

        web = WebContainer.get_web()

        naming = web.get_form_value(name)

        if not naming:
            return

        naming_util = NamingUtil()
        template = naming_util.build_naming2(naming)

        naming = naming.strip("/")
        parts = re.split( '[\\/._]', naming)

        # make some adjustments based on selections
        for idx, part in enumerate(parts):

            type_value = web.get_form_value("type_%s" % idx)

            if type_value:
                template = template.replace("{%d}" % idx, "{%s}" % type_value)
            else:
                template = template.replace("{%d}" % idx, part)


        sobject.set_value(name, template)
示例#27
0
    def _get_sobject_history_wdg(self):
        ''' this method is called thru ajax '''
        args = WebContainer.get_web().get_form_args()

        # get the args in the URL
        search_type = args['search_type']
        search_id = args['search_id']
        #sobject = Search.get_by_id(search_type, search_id)

        div = Widget()

        search = Search("sthpw/sobject_log")
        search.add_filter("search_type", search_type)
        search.add_filter("search_id", search_id)
        sobjects = search.get_sobjects()

        search = Search("sthpw/transaction_log")
        search.add_filters(
            "id", [x.get_value("transaction_log_id") for x in sobjects])
        sobjects = search.get_sobjects()

        table = TableWdg("sthpw/transaction_log", "table", css='table')
        table.set_show_property(False)
        table.set_sobjects(sobjects)
        div.add(table)
        div.add(HtmlElement.br(2))

        return div

        div.add(assigned_shot_wdg)
        div.add(HtmlElement.br(2))
        return div
示例#28
0
    def configure_asset_dir(self):
        self.section = 'Asset Management Setup'

        web = WebContainer.get_web()
        keys = web.get_form_keys()
        option_list = []
        for key in keys:
            if key.startswith('checkin/'):
                key = key.replace('checkin/', '')
                option_list.append(key)

        asset_dir = web.get_form_value("checkin/asset_base_dir")
        if asset_dir != None:
            if asset_dir and not os.path.exists(asset_dir):
                os.makedirs(asset_dir)
            Config.set_value("checkin", "asset_base_dir", asset_dir)

        if 'asset_base_dir' in option_list:
            option_list.remove('asset_base_dir')

        for item_dir in option_list:
            item_in_list = web.get_form_value('checkin/%s' % item_dir)
            if item_in_list:
                Config.set_value("checkin", '%s' % item_dir, item_in_list)
            else:
                Config.set_value("checkin", '%s' % item_dir, "")
示例#29
0
    def check(self):
        web = WebContainer.get_web()
        if web.get_form_value(MayaAssetCheckinWdg.PUBLISH_BUTTON) == "":
            return False
        self.search_type = self.kwargs.get('search_type')
        if not self.search_type:
            self.search_type = 'prod/asset'
        self.texture_search_type = self.kwargs.get('texture_search_type')
        if not self.texture_search_type:
            self.texture_search_type = 'prod/texture'

        # get the process to check this asset in (NEW)
        self.process = web.get_form_value("%s_process" % self.search_type)
        # get the context to check this asset in
        self.context = web.get_form_value("%s_context" % self.search_type)
        if not self.context:
            raise UserException('Please select a context in the drop-down.')
            return False

        sub_context = web.get_form_value("%s_sub_context" % self.search_type)

        if sub_context:
            self.context = "%s/%s" % (self.context, sub_context)

        return True
示例#30
0
    def execute(my):
        my.search_key_list = my.kwargs.get('search_key_list')
        web = WebContainer.get_web()
        skip_duplicated = web.get_form_value('skip_duplicated') == 'on'
        pipeline_mode = web.get_form_value('pipeline_mode')

        sobjects = SearchKey.get_by_search_keys(my.search_key_list)
        count = 0
        offset = 0
        for sobject in sobjects:
            if isinstance(sobject, Task):
                raise TacticException('Creation of task for [Task] is not allowed')
            sk = SearchKey.get_by_sobject(sobject)
            if not sobject.has_value('pipeline_code'):
                #raise TacticException('Creation of task is not allowed for item with no pipeline_code attribute.')
                pipeline_code = '__default__'
                sobject.set_value("pipeline_code", pipeline_code)
            else:
                pipeline_code = sobject.get_value('pipeline_code')
            input_name = '%s|task_process'% pipeline_code
            
            contexts = []
            process_names = web.get_form_values(input_name)
            process_names = [name for name in process_names if name]
            if pipeline_mode == 'context':
                # when pipeline_mode is context, we only specify contexts
                # in add_initial_tasks
                contexts = process_names[:]
                process_names = []
            tasks = Task.add_initial_tasks(sobject, sobject.get_value('pipeline_code'),
                    processes=process_names, contexts=contexts, skip_duplicate=skip_duplicated, mode=pipeline_mode, start_offset=offset)

            count += len(tasks)
            offset += 5
        my.add_description("%s Tasks added in total." % count)
示例#31
0
    def execute(self):

        #self.snapshot_dict = {}

        web = WebContainer.get_web()

        current_section_name = web.get_form_value(MayaSetWdg.CURRENT_SECTION)
        if not current_section_name:
            raise CommandExitException()

        description = web.get_form_value("description")

        current_section_instance, current_section_code = current_section_name.split(
            "|")

        # get the sobject from asset_code
        current_section = Asset.get_by_code(current_section_code)
        if current_section == None:
            # try the name instead
            current_section = Asset.get_by_name(current_section_instance)
            if current_section == None:
                raise CheckinException("Cannot find asset '%s'" %
                                       current_section_code)

        # now checkin the asset
        checkin = MayaGroupCheckin(current_section)
        checkin.set_description(description)
        checkin.set_context(self.context)
        checkin.execute()

        self.add_description("Set '%s': %s" %
                             (current_section_code, description))
        #self.snapshot_dict[current_section_name] = checkin.snapshot

        web.set_form_value('publish_search_type', 'prod/asset')
示例#32
0
    def check(my):
        search_key = my.kwargs.get('search_key')
        my.sobject = SearchKey.get_by_search_key(search_key)

        from pyasm.web import WebContainer
        web = WebContainer.get_web()

        my.old_password = web.get_form_value("old password")
        if isinstance(my.old_password, list):
            my.old_password = my.old_password[0]
        #encrypted = md5.new(my.old_password).hexdigest()
        encrypted = hashlib.md5(my.old_password).hexdigest()

        if encrypted != my.sobject.get_value('password'):
            raise UserException('Old password is incorrect.')
        my.password = web.get_form_value("password")
        if isinstance(my.password, list):
            my.password = my.password[0]

        if my.sobject == None:
            return UserException("Current user cannot be determined.")

        my.re_enter = web.get_form_value("password re-enter")
        if isinstance(my.re_enter, list):
            my.re_enter = my.re_enter[0]
        if my.re_enter != "" and my.re_enter != my.password:
            raise UserException(
                "Passwords must match. Please fill in the re-enter.")

        return True
示例#33
0
    def execute(self):

        web = WebContainer.get_web()
        if web.get_form_value("update") != "true":
            return

        self.element_name = self.kwargs.get("element_name")

        security_groups = web.get_form_values("security")
        from pyasm.security import AccessRuleBuilder, AccessManager

        rule_group = "side_bar"

        for security_group in security_groups:
            if not security_group:
                continue

            search = Search("sthpw/login_group")
            search.add_filter("login_group", security_group)
            login_group = search.get_sobject()
            assert login_group

            access_rules = login_group.get_xml_value("access_rules")

            # add the rule to each group
            builder = AccessRuleBuilder(access_rules)
            builder.add_rule(rule_group, self.element_name, "deny")

            login_group.set_value("access_rules", builder.to_string())
            login_group.commit()
示例#34
0
    def get_display(my):
        # add the add property button
        iframe = WebContainer.get_iframe()
        url = WebContainer.get_web().get_widget_url()
        url.set_option("widget", "pyasm.widget.CustomAddPropertyWdg")
        url.set_option("search_type", my.search_type)
        url.set_option("view", my.view)
        action = iframe.get_on_script(url.to_string() )
        add = IconButtonWdg("Add Property", IconWdg.INSERT, True)

        add.add_event("oncontextmenu", "%s;return false" % action )
        add.add_event("onclick", "%s" % action )

        widget = Widget()
        widget.add(add)
        return widget
示例#35
0
    def execute(my):
        from pyasm.flash.widget import FlashLayerCheckboxWdg    
        web = WebContainer.get_web()
        cam_search_key = web.get_form_value( FlashRenderTableElementWdg.RENDER_CAM)
        # FIXME: why is this called "context"
        context_name = web.get_form_value( FlashRenderTableElementWdg.CONTEXT_NAME)

        # submit all the selected sobjects
        context = "publish"
        for search_key in my.search_keys:
            sobject = Search.get_by_search_key(search_key)

            snapshot = Snapshot.get_latest_by_sobject(sobject, context)
            if not snapshot:
                raise TacticException("No checkins of context '%s' for '%s' exists" % (context, sobject.get_code() ) )
            render = FlashGenerateExecuteXml(sobject.get_code())
            render.set_snapshot_code(snapshot.get_code())
            
            #render.execute()
           
            # store this in the appropriate queue
            dispatch = TacticDispatcher()
            dispatch.set_description("Flash Render: %s" % sobject.get_code())
            dispatch.execute_slave(render)
            
        my.description = "Submitted: %s" % ", ".join(my.search_keys)
示例#36
0
    def get_display(my):

        sobject = my.get_current_sobject()

        widget_class = my.get_option("class")

        if widget_class == '':
            raise WidgetException("No widget class defined")

        url = WebContainer.get_web().get_widget_url()
        url.set_option("widget", widget_class)
        url.set_option("search_key", sobject.get_search_key())

        ref = url.get_url()

        iframe = Container.get("iframe")
        iframe.set_width(90)
        action = iframe.get_on_script(ref)

        info_type = my.get_option("info_type")

        button = IconButtonWdg("%s info" % info_type, IconWdg.INFO)
        button.add_event("onclick", "%s" % (action))
        button.add_style("margin: 3px 5px")

        return button
示例#37
0
    def _add_icon(my):
        # icon is optional
        if not my.icon_path:
            return

        if not my.icon_path.startswith("/"):
            # icon_path = "/context/icons/oo/%s" % my.icon_path
            icon_path = "/context/icons/silk/%s" % my.icon_path
        else:
            icon_path = my.icon_path

        icon = HtmlElement.img(icon_path)
        icon.set_attr("title", my.name)
        icon.add_styles(my.icon_styles)
        if my.long:
            img_id = my.generate_unique_id(my.name)
            icon.add_class("icon_out")
            my.add_event("onmouseover", "wdg_opacity('%s','over');" % (img_id))
            my.add_event("onmouseout", "wdg_opacity('%s','out');" % (img_id))
            icon.set_id(img_id)
        else:
            icon.add_class("simple_button")

        if WebContainer.get_web().is_IE():
            icon.add_style("vertical-align: top")
        else:
            icon.add_style("vertical-align: middle")

        my.add(icon)
示例#38
0
 def handle_config(self):
     '''for search type display config'''
     web = WebContainer.get_web()
     WidgetDbConfig.append(self.search_type,
                           self.view,
                           self.element_name,
                           config_xml=self.config_xml)
示例#39
0
    def url_commit(self):

        from pyasm.web import WebContainer
        web = WebContainer.get_web()
        group_name = web.get_form_value("group_name")
        group = LoginGroup.get_by_group_name(group_name)

        attr = SecurityRulesAttr(group, "access_rules")

        # go through each msg and process
        change_made = False
        msgs = web.get_form_values("url_levels")
        for msg in msgs:
            url, level = msg.split("|")

            try:
                attr.add_url_access(url, level)
            except CommandExitException:
                pass
            else:
                change_made = True

        # only commit if a change has bee made
        if change_made:
            group.set_value("access_rules", attr.get_xml())
            group.commit()
        else:
            raise CommandExitException()

        self.description = "Modified url '%s' security settings" % url
示例#40
0
    def url_commit(self):

        from pyasm.web import WebContainer
        web = WebContainer.get_web()
        group_name = web.get_form_value("group_name")
        group = LoginGroup.get_by_group_name(group_name)

        attr = SecurityRulesAttr(group,"access_rules")

        # go through each msg and process
        change_made = False
        msgs = web.get_form_values("url_levels")
        for msg in msgs:
            url, level = msg.split("|")

            try:
                attr.add_url_access(url,level)
            except CommandExitException:
                pass
            else:
                change_made = True

        # only commit if a change has bee made
        if change_made:
            group.set_value("access_rules", attr.get_xml() )
            group.commit()
        else:
            raise CommandExitException()


        self.description = "Modified url '%s' security settings" % url
示例#41
0
    def execute(my):

        web = WebContainer.get_web()
        if web.get_form_value("update") != "true":
            return

        my.element_name = my.kwargs.get("element_name")

        security_groups = web.get_form_values("security")
        from pyasm.security import AccessRuleBuilder, AccessManager

        rule_group = "side_bar"

        # get all of the groups
        search = Search("sthpw/login_group")
        login_groups = search.get_sobjects()

        for login_group in login_groups:

            access_rules = login_group.get_xml_value("access_rules")

            # add the rule to each group
            builder = AccessRuleBuilder(access_rules)

            code = login_group.get_value("login_group")
            if code in security_groups:
                builder.remove_rule(rule_group, my.element_name)
            else:
                builder.add_rule(rule_group, my.element_name, "deny")

            login_group.set_value("access_rules", builder.to_string())
            login_group.commit()
示例#42
0
文件: icon_wdg.py 项目: blezek/TACTIC
    def _add_icon(my):
        # icon is optional
        if not my.icon_path:
            return
        
        if not my.icon_path.startswith("/"):
            # icon_path = "/context/icons/oo/%s" % my.icon_path
            icon_path = "/context/icons/silk/%s" % my.icon_path
        else:
            icon_path = my.icon_path

        icon = HtmlElement.img(icon_path)
        icon.set_attr("title", my.name)
        icon.add_styles(my.icon_styles)   
        if my.long:
            img_id = my.generate_unique_id(my.name)
            icon.add_class("icon_out") 
            my.add_event("onmouseover","wdg_opacity('%s','over');" % (img_id))
            my.add_event("onmouseout","wdg_opacity('%s','out');" % (img_id))
            icon.set_id(img_id)
        else:
            icon.add_class("simple_button")


        if WebContainer.get_web().is_IE():
            icon.add_style("vertical-align: top")
        else:
            icon.add_style("vertical-align: middle")
       
        my.add(icon)
示例#43
0
    def get_display(my):

        sobject = my.get_current_sobject()

        widget_class = my.get_option("class")
        
        if widget_class == '':
            raise WidgetException("No widget class defined")

        url = WebContainer.get_web().get_widget_url()
        url.set_option("widget", widget_class)
        url.set_option("search_key", sobject.get_search_key())

        ref = url.get_url()

        iframe = Container.get("iframe")
        iframe.set_width(90)
        action = iframe.get_on_script(ref)

        info_type = my.get_option("info_type")
        
        button = IconButtonWdg("%s info" % info_type, IconWdg.INFO)
        button.add_event("onclick", "%s" % (action) )
        button.add_style("margin: 3px 5px")

        return button
示例#44
0
    def postprocess(my):
        web = WebContainer.get_web()
        value = web.get_form_value( my.get_input_name() )
        if not value:
            return
        
        # get all fo the sobjects from the search keys
        instance_type = my.get_option("instance_type")
        
        # path is used for self-relating in an instance table
        src_path = my.get_option("path")

    
        #src_sobject = my.sobject

        search = Search(my.sobject.get_search_type())
        search.add_id_filter(my.sobject.get_id())
        src_sobject = search.get_sobject()

        # this is passed in from EditCmd in insert mode
        parent_key = my.get_option('parent_key')
        # in some rare cases we have project as the parent_key
        if parent_key and my.is_insert and 'sthpw/project' not in parent_key:
            # this is the parent
            dst_sobject = SearchKey.get_by_search_key(parent_key)

            # add all the new sobjects
            #instances = dst_sobject.get_related_sobject(instance_type)
            instance = SearchType.create(instance_type)
            instance.add_related_connection(src_sobject, dst_sobject, src_path=src_path)

            instance.commit()
示例#45
0
    def execute(my):

        # make sure tmp config is unset.
        Config.unset_tmp_config()
        Config.reload_config()

        web = WebContainer.get_web()

        vendor = web.get_form_value("database/vendor")


        if vendor == 'Sqlite':
            db_dir = web.get_form_value("database/sqlite_db_dir")
            database = "sthpw"
            db_path = "%s/%s.db" % (db_dir, database)
            if os.path.exists(db_path):
                return

        elif vendor == 'PostgreSQL':
            my.test_postgres(vendor)
            return

        elif vendor in ['MySQL','SQLServer','Oracle']:
            my.test_postgres(vendor)
            return

        my.info['error'] = "Cannot connect to database"
示例#46
0
    def check(my):
        search_key = my.kwargs.get('search_key')
        my.sobject = SearchKey.get_by_search_key(search_key)
        
        from pyasm.web import WebContainer
        web = WebContainer.get_web()

        my.old_password = web.get_form_value("old password")
        if isinstance(my.old_password, list):
            my.old_password = my.old_password[0]
        #encrypted = md5.new(my.old_password).hexdigest()
        encrypted = hashlib.md5(my.old_password).hexdigest()
        
        if encrypted != my.sobject.get_value('password'):
            raise UserException('Old password is incorrect.')
        my.password = web.get_form_value("password")
        if isinstance(my.password, list):
            my.password = my.password[0]


        if my.sobject == None:
            return UserException("Current user cannot be determined.")

        my.re_enter = web.get_form_value("password re-enter")
        if isinstance(my.re_enter, list):
            my.re_enter = my.re_enter[0]
        if my.re_enter != "" and my.re_enter != my.password:
            raise UserException( "Passwords must match. Please fill in the re-enter.")

        return True
示例#47
0
    def get_file_type_wdg(my):
        '''drop down which selects which file type to export to'''
        # add a filter
        div = DivWdg()

        filter_div = FloatDivWdg(HtmlElement.b("File Type:"), width="15em")
        div.add(filter_div)

        select = SelectWdg()
        select.set_name("file_type")
        select.set_id("file_type")

        app = WebContainer.get_web().get_selected_app()

        if app == 'Maya':
            select.set_option("values", "mayaAscii|mayaBinary|obj|collada")
            select.set_option("labels", "Maya Ascii (.ma)|Maya Binary (.mb)|Wavefront .obj|Collada (.dae)")
        elif app == 'Houdini':
            select.set_option("values", "otl")
            select.set_option("labels", "Houdini Digital Asset(.otl)")
        elif app == 'XSI':
            select.set_option("values", "emdl|dotXSI|obj")
            select.set_option("labels", "3D Model (.emdl)|SoftImage dotXSI (.xsi)|Wavefront .obj")
        else:
            select.set_option("values", "mayaAscii|mayaBinary|obj|collada")
            select.set_option("labels", "Maya Ascii (.ma)|Maya Binary (.mb)|Wavefront .obj|Collada (.dae)")

        select.add_style("font-size: 0.8em")
        select.add_style("margin-top: 5px")
        select.add_style("margin-right: 10px")
        select.set_persistence()
        
        div.add(select)
        return div
示例#48
0
 def init(self):
     self.search_type = self.kwargs.get('search_type')
     if not self.search_type:
         self.search_type = WebContainer.get_web().get_form_value('search_type')
     self.view = self.kwargs.get('view')
     if not self.view:
         self.view = "database_definition"
示例#49
0
文件: task_wdg.py 项目: mincau/TACTIC
    def execute(self):
        self.search_key_list = self.kwargs.get('search_key_list')
        web = WebContainer.get_web()
        skip_duplicated = web.get_form_value('skip_duplicated') == 'on'
        pipeline_mode = web.get_form_value('pipeline_mode')

        sobjects = SearchKey.get_by_search_keys(self.search_key_list)
        count = 0
        offset = 0
        for sobject in sobjects:
            if isinstance(sobject, Task):
                raise TacticException('Creation of task for [Task] is not allowed')
            sk = SearchKey.get_by_sobject(sobject)
            if not sobject.has_value('pipeline_code'):
                #raise TacticException('Creation of task is not allowed for item with no pipeline_code attribute.')
                pipeline_code = '__default__'
                sobject.set_value("pipeline_code", pipeline_code)
            else:
                pipeline_code = sobject.get_value('pipeline_code')
            input_name = '%s|task_process'% pipeline_code
            
            contexts = []
            process_names = web.get_form_values(input_name)
            process_names = [name for name in process_names if name]
            if pipeline_mode == 'context':
                # when pipeline_mode is context, we only specify contexts
                # in add_initial_tasks
                contexts = process_names[:]
                process_names = []
            tasks = Task.add_initial_tasks(sobject, sobject.get_value('pipeline_code'),
                    processes=process_names, contexts=contexts, skip_duplicate=skip_duplicated, mode=pipeline_mode, start_offset=offset)

            count += len(tasks)
            offset += 5
        self.add_description("%s Tasks added in total." % count)
示例#50
0
    def execute(self):

        web = WebContainer.get_web()
        if web.get_form_value("update") != "true":
            return

        self.element_name = self.kwargs.get("element_name")

        security_groups = web.get_form_values("security")
        from pyasm.security import AccessRuleBuilder, AccessManager

        rule_group = "side_bar"

        for security_group in security_groups:
            if not security_group:
                continue

            search = Search("sthpw/login_group")
            search.add_filter("login_group", security_group)
            login_group = search.get_sobject()
            assert login_group

            access_rules = login_group.get_xml_value("access_rules")

            # add the rule to each group
            builder = AccessRuleBuilder(access_rules)
            builder.add_rule(rule_group, self.element_name, "deny")

            login_group.set_value("access_rules", builder.to_string())
            login_group.commit()
示例#51
0
    def configure_asset_dir(my):

        web = WebContainer.get_web()
        keys = web.get_form_keys()
        option_list = []
        for key in keys:
            if key.startswith('checkin/'):
                key = key.replace('checkin/','')
                option_list.append(key)
  
        asset_dir = web.get_form_value("checkin/asset_base_dir")
        if asset_dir != None:
            if asset_dir and not os.path.exists(asset_dir):
                os.makedirs(asset_dir)
            Config.set_value("checkin", "asset_base_dir", asset_dir)

        if 'asset_base_dir' in option_list:
            option_list.remove('asset_base_dir')

        for item_dir in option_list:
            item_in_list=web.get_form_value('checkin/%s'%item_dir)
            if item_in_list:
                Config.set_value("checkin", '%s'%item_dir, item_in_list)
            else:
                Config.set_value("checkin", '%s'%item_dir, "")
示例#52
0
    def execute(my):
        plugin = my.sobject

        web = WebContainer.get_web()
        value = web.get_form_value( my.get_input_name() )
        if not value:
            return
        src_search_keys = jsonloads(value)


        manifest = plugin.get_xml_value("manifest")

        top_node = manifest.get_node("manifest")

        for search_key in src_search_keys:
            sobject = SearchKey.get_by_search_key(search_key)

            node = manifest.create_element("sobject")

            # For now, a plugin must contain project specfic entries
            search_type = sobject.get_base_search_type()
            code = sobject.get_value("code")
            manifest.set_attribute(node, "search_type", search_type)
            manifest.set_attribute(node, "code", code)

            #search_key = SearchKey.get_by_sobject(sobject)
            #manifest.set_attribute(node, "search_key", search_key)

            manifest.append_child(top_node, node)

        plugin.set_value("manifest", manifest.to_string() )
        plugin.commit()
示例#53
0
    def get_value(self, name):
        web = WebContainer.get_web()
        value = web.get_form_value(name)
        if not value:
            value = self.kwargs.get(name)

        return value
示例#54
0
    def execute(my):
        sobject = my.sobject

        name = my.get_name()

        web = WebContainer.get_web()

        naming = web.get_form_value(name)

        if not naming:
            return

        naming_util = NamingUtil()
        template = naming_util.build_naming2(naming)

        naming = naming.strip("/")
        parts = re.split("[\\/._]", naming)

        # make some adjustments based on selections
        for idx, part in enumerate(parts):

            type_value = web.get_form_value("type_%s" % idx)

            if type_value:
                template = template.replace("{%d}" % idx, "{%s}" % type_value)
            else:
                template = template.replace("{%d}" % idx, part)

        sobject.set_value(name, template)
示例#55
0
    def add(my, widget, title=None, index=None):
        if title == None:
            title = widget.__class__.__name__

        # determine the url and check security
        # DEPRECATED!!!! use "tab" security
        url_selector = WebContainer.get_web().get_request_url().get_selector()
        check = "%s|%s" % (url_selector, title)

        # check tab security
        if my.mode != "check":
            security = WebContainer.get_security()
            if not security.check_access("url", check, "view"):
                return
            # new security mechanism
            if not security.check_access("tab_title", title, "view"):
                return
            # new, new security mechanism
            tab_path = my.get_tab_path(title)
            if not security.check_access("tab", tab_path, "view"):
                return

            # check if this tab is invisible
            if not my.check_visibility(tab_path):
                return

        if index == None:
            my.tab_names.append(title)
        else:
            my.tab_names.insert(index, title)

        my.wdg_dict[title] = widget
        # for tabs, the widget passed in can be None.  Only the
        # title is added
        if widget == None:
            return

        # only the selected one really gets added
        if not my.tab_value or title == my.tab_value:
            Container.put("tab_path", my.get_tab_path(title))

            widget = my.init_widget(widget, title)
            # the very first time user click on the main tab
            if not my.tab_value:
                my.tab_value = title

            super(TabWdg, my)._add_widget(widget, title)
示例#56
0
    def get_error_wdg(my):
        div = DivWdg()
        error_div = DivWdg()
        error_div.add("Error %s" % my.status)
        div.add(error_div)
        error_div.add_style("font-size: 18px")
        error_div.add_style("font-weight: bold")
        error_div.add_style("padding: 10px")
        error_div.add_style("width: auto")
        error_div.add_gradient("background", "background")
        error_div.add_border()
        error_div.add_style("margin-left: 5px")
        error_div.add_style("margin-right: 5px")
        error_div.add_style("margin-top: -10px")

        div.add("<br/>")

        span = DivWdg()
        #span.add_color("color", "color")
        span.add_style("color", "#FFF")
        if my.status == 404:
            span.add(
                HtmlElement.b(
                    "You have tried to access a url that is not recognized."))
        else:
            span.add(HtmlElement.b(my.message))
        span.add(HtmlElement.br(2))

        web = WebContainer.get_web()
        root = web.get_site_root()
        if my.message.startswith('No project ['):
            label = 'You may need to correct the default_project setting in the TACTIC config.'
        else:
            label = "Go to the Main page for a list of valid projects"
        span.add(label)
        div.add(span)
        div.add(HtmlElement.br())

        from tactic.ui.widget import ActionButtonWdg
        button_div = DivWdg()
        button_div.add_style("width: 90px")
        button_div.add_style("margin: 0px auto")

        div.add(button_div)
        button = ActionButtonWdg(title="Go to Main",
                                 tip='Click to go to main page')
        button_div.add(button)

        button.add_behavior({
            'type':
            'click_up',
            'cbjs_action':
            '''
        document.location = '/';
        '''
        })
        button.add_event("onmouseup", "document.location='/'")

        return div
示例#57
0
    def postprocess(self):
        web = WebContainer.get_web()
        add_initial_tasks = web.get_form_value("add_initial_tasks")

        if add_initial_tasks != "on":
            return

        Task.add_initial_tasks(self.sobject)
示例#58
0
 def get(cls):
     filter_data = Container.get("FilterData")
     if filter_data == None:
         web = WebContainer.get_web()
         data = web.get_form_value('json')
         filter_data = FilterData(data)
         Container.put("FilterData", filter_data)
     return filter_data
示例#59
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
 def init(my):
     my.search_type = my.kwargs.get('search_type')
     if not my.search_type:
         my.search_type = WebContainer.get_web().get_form_value(
             'search_type')
     my.view = my.kwargs.get('view')
     if not my.view:
         my.view = "database_definition"