예제 #1
0
    def get_display(my):

        top = DivWdg()

        value = my.get_value()
        widget_type = my.get_option("type")
        if widget_type in ['integer', 'float', 'timecode', 'currency']:
            top.add_style("float: right")
            my.justify = "right"

        elif widget_type in ['date','time']:
            name = my.get_name()
            if value and not SObject.is_day_column(name):
                value = SPTDate.convert_to_local(value)
                value = str(value)

        else:
            top.add_style("float: left")
            my.justify = "left"
        top.add_style("padding-right: 3px")

        top.add_style("min-height: 15px")

        format = my.get_option('format')
        value = my.get_format_value( value, format )

        top.add(value)

        return top
예제 #2
0
    def get_display(my):
        sobject = my.get_current_sobject()

        column = my.kwargs.get('column')
        if column:
            name = column
        else:
            name = my.get_name()

        value = my.get_value(name=name)

        if sobject:
            data_type = SearchType.get_column_type(sobject.get_search_type(),
                                                   name)
        else:
            data_type = 'text'

        if type(value) in types.StringTypes:
            wiki = WikiUtil()
            value = wiki.convert(value)
        if name == 'id' and value == -1:
            value = ''

        elif data_type == "timestamp" or name == "timestamp":
            if value == 'now':
                value = ''
            elif value:
                # This date is assumed to be GMT
                date = parser.parse(value)
                # convert to local
                if not SObject.is_day_column(name):
                    date = SPTDate.convert_to_local(date)
                try:
                    encoding = locale.getlocale()[1]
                    value = date.strftime("%b %d, %Y - %H:%M").decode(encoding)
                except:
                    value = date.strftime("%b %d, %Y - %H:%M")

            else:
                value = ''
        else:
            if isinstance(value, Widget):
                return value
            elif not isinstance(value, basestring):
                try:
                    value + 1
                except TypeError:
                    value = str(value)
                else:
                    value_wdg = DivWdg()
                    value_wdg.add_style("float: right")
                    value_wdg.add_style("padding-right: 3px")
                    value_wdg.add(str(value))
                    return value_wdg

        return value
    def get_display(my):
        sobject = my.get_current_sobject()

        column =  my.kwargs.get('column')
        if column:
            name = column
        else:
            name = my.get_name()
        
        value = my.get_value(name=name)

        if sobject:
            data_type = SearchType.get_column_type(sobject.get_search_type(), name)
        else:
            data_type = 'text'

        if type(value) in types.StringTypes:
            wiki = WikiUtil()
            value = wiki.convert(value) 
        if name == 'id' and value == -1:
            value = ''

        elif data_type == "timestamp" or name == "timestamp":
	    if value == 'now':
                value = ''
            elif value:
                # This date is assumed to be GMT
                date = parser.parse(value)
                # convert to local
                if not SObject.is_day_column(name):
                    date = SPTDate.convert_to_local(date)
		try:
		   encoding = locale.getlocale()[1]		
		   value = date.strftime("%b %d, %Y - %H:%M").decode(encoding)
		except:
		   value = date.strftime("%b %d, %Y - %H:%M")

            else:
                value = ''
        else:
            if isinstance(value, Widget):
                return value
            elif not isinstance(value, basestring):
                try:
                    value + 1
                except TypeError:
                    value = str(value)
                else:
                    value_wdg = DivWdg()
                    value_wdg.add_style("float: right")
                    value_wdg.add_style("padding-right: 3px")
                    value_wdg.add( str(value) )
                    return value_wdg

        return value
예제 #4
0
    def get_display(my):

        top = DivWdg()

        value = my.get_value()
        widget_type = my.get_option("type")
        
        if widget_type in ['integer', 'float', 'timecode', 'currency']:
            top.add_style("float: right")
            my.justify = "right"

        elif widget_type in ['date','time']:
            name = my.get_name()
            if value and not SObject.is_day_column(name):               
                value = my.get_timezone_value(value)
         

                value = str(value)

        else:
            top.add_style("float: left")
            my.justify = "left"
        top.add_style("padding-right: 3px")

        top.add_style("min-height: 15px")

        format = my.get_option('format')
        value = my.get_format_value( value, format )
        top.add(value)


        sobject = my.get_current_sobject()
        if sobject:

            column =  my.kwargs.get('column')
            if column:
                name = column
            else:
                name = my.get_name()

            top.add_update( {
                'search_key': sobject.get_search_key(),
                'column': name,
                'format': format

            } )

        return top
예제 #5
0
    def get_display(my):

        top = DivWdg()

        value = my.get_value()
        widget_type = my.get_option("type")

        if widget_type in ['integer', 'float', 'timecode', 'currency']:
            top.add_style("float: right")
            my.justify = "right"

        elif widget_type in ['date', 'time']:
            name = my.get_name()
            if value and not SObject.is_day_column(name):
                value = my.get_timezone_value(value)

                value = str(value)

        else:
            top.add_style("float: left")
            my.justify = "left"
        top.add_style("padding-right: 3px")

        top.add_style("min-height: 15px")

        format = my.get_option('format')
        value = my.get_format_value(value, format)
        top.add(value)

        sobject = my.get_current_sobject()
        if sobject:

            column = my.kwargs.get('column')
            if column:
                name = column
            else:
                name = my.get_name()

            top.add_update({
                'search_key': sobject.get_search_key(),
                'column': name,
                'format': format
            })

        return top
예제 #6
0
    def get_text_value(my):

        value = my.get_value()
        widget_type = my.get_option("type")

        if widget_type in ['date', 'time']:
            name = my.get_name()
            if not SObject.is_day_column(name):
                value = my.get_timezone_value(value)
                value = str(value)

        format = my.get_option('format')

        if format == 'Checkbox':
            value = str(value)
        else:
            value = my.get_format_value(value, format)

        return value
예제 #7
0
    def get_text_value(my):

        value = my.get_value()
        widget_type = my.get_option("type")
        
        if widget_type in ['date','time']:
            name = my.get_name()
            if not SObject.is_day_column(name):
                value = my.get_timezone_value(value)
                value = str(value)
 
        format = my.get_option('format')
        
        if format == 'Checkbox':
            value = str(value)
        else:
            value = my.get_format_value( value, format )

       
        return value
예제 #8
0
    def get_display(self):
        sobject = self.get_current_sobject()

        column = self.kwargs.get('column')
        if column:
            name = column
        else:
            name = self.get_name()

        value = self.get_value(name=name)

        empty = self.get_option("empty")
        if empty and self.is_editable() and not value:
            from pyasm.web import SpanWdg
            div = DivWdg()
            div.add_style("text-align: center")
            div.add_style("width: 100%")
            div.add_style("white-space: nowrap")
            if empty in [True, 'true']:
                div.add("--Select--")
            div.add_style("opacity: 0.5")
            return div

        if sobject:
            data_type = SearchType.get_column_type(sobject.get_search_type(),
                                                   name)
        else:
            data_type = 'text'

        if type(value) in types.StringTypes:
            wiki = WikiUtil()
            value = wiki.convert(value)
        if name == 'id' and value == -1:
            value = ''

        elif data_type in ["timestamp", "time"] or name == "timestamp":
            if value == 'now':
                value = ''
            elif value:
                # This date is assumed to be GMT
                date = parser.parse(value)
                # convert to user timezone
                if not SObject.is_day_column(name):
                    date = self.get_timezone_value(date)
                try:
                    encoding = locale.getlocale()[1]
                    value = date.strftime("%b %d, %Y - %H:%M").decode(encoding)
                except:
                    value = date.strftime("%b %d, %Y - %H:%M")

            else:
                value = ''
        else:
            if isinstance(value, Widget):
                return value
            elif not isinstance(value, basestring):
                try:
                    value + 1
                except TypeError:
                    value = str(value)
                #else:
                #    value_wdg.add_style("float: right")
                #    value_wdg.add_style("padding-right: 3px")

        if sobject and SearchType.column_exists(sobject.get_search_type(),
                                                name):
            value_wdg = DivWdg()

            self.add_value_update(value_wdg, sobject, name)

            # don't call str() to prevent utf-8 encode error
            value_wdg.add(value)

            value_wdg.add_style("overflow-x: hidden")
            value_wdg.add_style("text-overflow: ellipsis")

            # sompe properties
            min_height = 25
            value_wdg.add_style("min-height: %spx" % min_height)

            single_line = self.get_option("single_line") or False
            if single_line in ["true", True]:
                value_wdg.add_style("line-height: %spx" % min_height)
                value_wdg.add_style("white-space: nowrap")

            #value_wdg.add_style("overflow-y: hidden")
            #value_wdg.add_class("spt_scrollable")
            #value_wdg.add_attr("title", value)

            link_expression = self.get_option("link_expression")
            if link_expression:
                value_wdg.add_class("tactic_new_tab")
                value_wdg.add_style("display: inline-block")
                value_wdg.add_attr("search_key", sobject.get_search_key())
                value_wdg.add_style("text-decoration: underline")
                #value_wdg.add_attr("spt_class_name", "tactic.ui.tools.SObjectDetailWdg")
                value_wdg.add_class("hand")

            return value_wdg

        return value
예제 #9
0
    def get_display(my):
        sobject = my.get_current_sobject()

        column =  my.kwargs.get('column')
        if column:
            name = column
        else:
            name = my.get_name()
        
        value = my.get_value(name=name)

        if sobject:
            data_type = SearchType.get_column_type(sobject.get_search_type(), name)
        else:
            data_type = 'text'

        if type(value) in types.StringTypes:
            wiki = WikiUtil()
            value = wiki.convert(value) 
        if name == 'id' and value == -1:
            value = ''

        elif data_type in ["timestamp","time"] or name == "timestamp":
            if value == 'now':
                value = ''
            elif value:
                # This date is assumed to be GMT
                date = parser.parse(value)
                # convert to user timezone
                if not SObject.is_day_column(name):
                    date = my.get_timezone_value(date)
                try:
                    encoding = locale.getlocale()[1]		
                    value = date.strftime("%b %d, %Y - %H:%M").decode(encoding)
                except:
                    value = date.strftime("%b %d, %Y - %H:%M")

            else:
                value = ''
        else:
            if isinstance(value, Widget):
                return value
            elif not isinstance(value, basestring):
                try:
                    value + 1
                except TypeError:
                    value = str(value)
                #else:
                #    value_wdg.add_style("float: right")
                #    value_wdg.add_style("padding-right: 3px")



        if sobject and SearchType.column_exists(sobject.get_search_type(), name):
            value_wdg = DivWdg()
            value_wdg.add_update( {
                'search_key': sobject.get_search_key(),
                'column': name
            } )
            # don't call str() to prevent utf-8 encode error
            value_wdg.add(value)


            return value_wdg

        return value
예제 #10
0
    def get_display(self):
        sobject = self.get_current_sobject()

        column =  self.kwargs.get('column')
        if column:
            name = column
        else:
            name = self.get_name()
        
        value = self.get_value(name=name)

        empty = self.get_option("empty")
        if empty and self.is_editable() and not value:
            from pyasm.web import SpanWdg
            div = DivWdg()
            div.add_style("text-align: center")
            div.add_style("width: 100%")
            div.add_style("white-space: nowrap" )
            if empty in [True, 'true']:
                div.add("--Select--")
            div.add_style("opacity: 0.5")
            return div




        if sobject:
            data_type = SearchType.get_column_type(sobject.get_search_type(), name)
        else:
            data_type = 'text'

        if type(value) in types.StringTypes:
            wiki = WikiUtil()
            value = wiki.convert(value) 
        if name == 'id' and value == -1:
            value = ''

        elif data_type in ["timestamp","time"] or name == "timestamp":
            if value == 'now':
                value = ''
            elif value:
                # This date is assumed to be GMT
                date = parser.parse(value)
                # convert to user timezone
                if not SObject.is_day_column(name):
                    date = self.get_timezone_value(date)
                try:
                    encoding = locale.getlocale()[1]		
                    value = date.strftime("%b %d, %Y - %H:%M").decode(encoding)
                except:
                    value = date.strftime("%b %d, %Y - %H:%M")

            else:
                value = ''
        else:
            if isinstance(value, Widget):
                return value
            elif not isinstance(value, basestring):
                try:
                    value + 1
                except TypeError:
                    value = str(value)
                #else:
                #    value_wdg.add_style("float: right")
                #    value_wdg.add_style("padding-right: 3px")



        if sobject and SearchType.column_exists(sobject.get_search_type(), name):
            value_wdg = DivWdg()

            self.add_value_update(value_wdg, sobject, name)

            # don't call str() to prevent utf-8 encode error
            value_wdg.add(value)


            value_wdg.add_style("overflow-x: hidden")
            value_wdg.add_style("text-overflow: ellipsis")



            # sompe properties
            min_height = 25
            value_wdg.add_style("min-height: %spx" % min_height)

            single_line = self.get_option("single_line") or False
            if single_line in ["true", True]:
                value_wdg.add_style("line-height: %spx" % min_height)
                value_wdg.add_style("white-space: nowrap")

            #value_wdg.add_style("overflow-y: hidden")
            #value_wdg.add_class("spt_scrollable")
            #value_wdg.add_attr("title", value)


            link_expression = self.get_option("link_expression")
            if link_expression:
                value_wdg.add_class("tactic_new_tab")
                value_wdg.add_style("display: inline-block")
                value_wdg.add_attr("search_key", sobject.get_search_key())
                value_wdg.add_style("text-decoration: underline")
                #value_wdg.add_attr("spt_class_name", "tactic.ui.tools.SObjectDetailWdg")
                value_wdg.add_class("hand")



            return value_wdg



        return value