<commit_before>###########################################################
#
# Copyright (c) 2005-2008, Southpaw Technology
#                     All Rights Reserved
#
# PROPRIETARY INFORMATION.  This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permission.
#
#
#

__all__ = ['SObjectDetailElementWdg']

from pyasm.common import Environment
from pyasm.search import SearchKey
from pyasm.web import DivWdg
from pyasm.widget import IconWdg

from tactic.ui.widget import IconButtonWdg

from tactic.ui.common import BaseTableElementWdg

class SObjectDetailElementWdg(BaseTableElementWdg):
    '''The element widget that displays according to type'''

    ARGS_KEYS = {
    'tab_element_names': {
        "description": "List of element names that will be in the tab",
        'category': 'Options',
        'order': 1

    },
    'use_parent': {
        'description': 'Display the parent of this sobject for the detail',
        'type': 'SelectWdg',
        'values': 'true|false',
        'category': 'Options',
        'order': 2
    },
    'show_task_process': {
        'description': 'Determine if Add Note widget only shows the processes of existing tasks',
        'category': 'Options',
        'type': 'SelectWdg',
        'values': 'true|false',
        'order': 3
    }

    }
 
    def __init__(my, **kwargs):
        my.widget = None
        super(SObjectDetailElementWdg, my).__init__(**kwargs)

    def init(my):
        my.show_task_process = my.kwargs.get('show_task_process')

    def set_widget(my, widget):
        my.widget = widget

    def get_width(my):
        return 50

    def get_display(my):

        sobject = my.get_current_sobject()

        use_parent = my.get_option("use_parent")
        use_parent = use_parent in ['true', True]
        #if use_parent in ['true', True]:
        #    sobject = sobject.get_parent()
        #    if not sobject:
        #        return DivWdg()

        my.search_key = SearchKey.get_by_sobject(sobject)
    
        div = DivWdg()
        div.add_class("hand")
        #div.add_style("width: 100%")
        #div.add_style("height: 100%")

        target_id = "main_body"

        title = "Show Item Details"
        if my.widget:
            widget = my.widget
        else:
            widget = IconButtonWdg(title=title, icon=IconWdg.ZOOM)


        code = sobject.get_code()
        name = sobject.get_value("name", no_exception=True)
        if not name:
            name = code


        tab_element_names = my.kwargs.get("tab_element_names") or ""

        widget.add_behavior( {
        'type': 'click_up',
        'search_key': my.search_key,
        'use_parent': use_parent,
        'tab_element_names': tab_element_names,
        'show_task_process': my.show_task_process,
        'code': code,
        'name': name,
        'cbjs_action': '''
        spt.tab.set_main_body_tab();
        var class_name = 'tactic.ui.tools.SObjectDetailWdg';
        var kwargs = {
            search_key: bvr.search_key,
            use_parent: bvr.use_parent,
            tab_element_names: bvr.tab_element_names,
            show_task_process: bvr.show_task_process
        };


        var mode = 'xxx';
        var layout = bvr.src_el.getParent(".spt_tool_top");
        if (layout != null) {
            mode = 'tool'
        }

        if (mode == 'tool') {
            spt.app_busy.show("Loading ...");
            var layout = bvr.src_el.getParent(".spt_tool_top");
            var element = layout.getElement(".spt_tool_content");
            spt.panel.load(element, class_name, kwargs);
            spt.app_busy.hide();<commit_msg>allowed SObjectDetailElementWdg to receive detail_view arg<commit_after>###########################################################
#
# Copyright (c) 2005-2008, Southpaw Technology
#                     All Rights Reserved
#
# PROPRIETARY INFORMATION.  This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permission.
#
#
#

__all__ = ['SObjectDetailElementWdg']

from pyasm.common import Environment
from pyasm.search import SearchKey
from pyasm.web import DivWdg
from pyasm.widget import IconWdg

from tactic.ui.widget import IconButtonWdg

from tactic.ui.common import BaseTableElementWdg

class SObjectDetailElementWdg(BaseTableElementWdg):
    '''The element widget that displays according to type'''

    ARGS_KEYS = {
    'tab_element_names': {
        "description": "List of element names that will be in the tab",
        'category': 'Options',
        'order': 1

    },
    'use_parent': {
        'description': 'Display the parent of this sobject for the detail',
        'type': 'SelectWdg',
        'values': 'true|false',
        'category': 'Options',
        'order': 2
    },
    'show_task_process': {
        'description': 'Determine if Add Note widget only shows the processes of existing tasks',
        'category': 'Options',
        'type': 'SelectWdg',
        'values': 'true|false',
        'order': 3
    }

    }
 
    def __init__(my, **kwargs):
        my.widget = None
        super(SObjectDetailElementWdg, my).__init__(**kwargs)

    def init(my):
        my.show_task_process = my.kwargs.get('show_task_process')

    def set_widget(my, widget):
        my.widget = widget

    def get_width(my):
        return 50

    def get_display(my):

        sobject = my.get_current_sobject()

        use_parent = my.get_option("use_parent")
        use_parent = use_parent in ['true', True]
        #if use_parent in ['true', True]:
        #    sobject = sobject.get_parent()
        #    if not sobject:
        #        return DivWdg()

        my.search_key = SearchKey.get_by_sobject(sobject)
    
        div = DivWdg()
        div.add_class("hand")
        #div.add_style("width: 100%")
        #div.add_style("height: 100%")

        target_id = "main_body"

        title = "Show Item Details"
        if my.widget:
            widget = my.widget
        else:
            widget = IconButtonWdg(title=title, icon=IconWdg.ZOOM)


        code = sobject.get_code()
        name = sobject.get_value("name", no_exception=True)
        if not name:
            name = code


        tab_element_names = my.kwargs.get("tab_element_names") or ""
        detail_view = my.kwargs.get("detail_view") or ""

        widget.add_behavior( {
        'type': 'click_up',
        'search_key': my.search_key,
        'use_parent': use_parent,
        'tab_element_names': tab_element_names,
        'detail_view': detail_view,
        'show_task_process': my.show_task_process,
        'code': code,
        'name': name,
        'cbjs_action': '''
        spt.tab.set_main_body_tab();
        var class_name = 'tactic.ui.tools.SObjectDetailWdg';
        var kwargs = {
            search_key: bvr.search_key,
            use_parent: bvr.use_parent,
            tab_element_names: bvr.tab_element_names,
            show_task_process: bvr.show_task_process,
            detail_view: bvr.detail_view
        };

        var mode = 'xxx';
        var layout = bvr.src_el.getParent(".spt_tool_top");
        if (layout != null) {
            mode = 'tool'
        }

        if (mode == 'tool') {
            spt.app_busy.show("Loading ...");
            var layout = bvr.src_el.getParent(".spt_tool_top");
            var element = layout.getElement(".spt_tool_content");
            spt.panel.load(element, class_name, kwargs);
            spt.app_busy.hide();
{'fraction_non_alphanumeric': 0.1269337564458548, 'fraction_numerical': 0.00502446119264842, 'mean_word_length': 2.3543237250554325, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6974965', 'n_tokens_mistral': 2403, 'n_tokens_neox': 2273, 'n_words': 533}