imported>Aeric |
imported>Aeric Β |
(39 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
| These Javascript functions and variables are available for use in a JSP/HTML [[Page]] in the platform. They can also be used in Javascript defined for [[Action]] buttons.
| | #REDIRECT [[JavaScript Functions]] |
| __TOC__
| |
| Β | |
| ==Functions==
| |
| Β | |
| ===lj_functionName===
| |
| ...
| |
| Β | |
| ;Syntax:
| |
| :<syntaxhighlight lang="javascript" enclose="div">
| |
| lj_functionName('{option1}={value}&{option2}={value}&...');
| |
| lj_functionName(param, param, "string-param", ...);
| |
| </syntaxhighlight>
| |
| Β | |
| ;Sample Usage:
| |
| ...
| |
| Β | |
| :<syntaxhighlight lang="javascript" enclose="div">
| |
| </syntaxhighlight>
| |
| Β | |
| ;Parameters:
| |
| ...
| |
| Β | |
| :{| border="1" cellpadding="5" cellspacing="1"
| |
| ! align="left"| Parameter !! align="left"| Description (default value in '''bold''')
| |
| |-
| |
| | param || descrΒ
| |
| |}
| |
| Β | |
| Β | |
| ===lj_printRecord===
| |
| This function displays a customized print dialog for a record. Use it to set defaults, to limit the available choices, and to choose the [[Print Template]] which is used. (It is only available for {{type|}}s.)
| |
| Β | |
| ;Syntax:
| |
| :<syntaxhighlight lang="javascript" enclose="div">
| |
| lj_printRecord('{option1}={value}&{option2}={value}&...');
| |
| </syntaxhighlight>
| |
| Β | |
| ;Sample Usage:
| |
| This code adds a '''[customPrint]''' button to a page. {{TBD|Specified where?}}
| |
| :<syntaxhighlight lang="javascript" enclose="div">
| |
| $("#edit_button").parent().append("<input type='button' id='customPrint' value='Custom Print' class='lj-button fg-button ui-state-default ui-corner-all' onClick=\"javascript:lj_printRecord('default_print_layout=template&show_print_layout=no&default_print_document=jsp&default_page_orientation=landscape&default_pdf=yes&show_pdf=no&print_immediately=yes');\">");
| |
| </syntaxhighlight>
| |
| Β | |
| ;Parameters:
| |
| Each option has two parameters: One to specify a default value, the other to determine whether it should be displayed so it can be overridden by the user.
| |
| Β | |
| By default, an option is always shown, unless explicitly hidden.
| |
| Β | |
| :{| border="1" cellpadding="5" cellspacing="1"
| |
| ! align="left"| Parameter !! align="left"| Description (default value in '''bold''')
| |
| |-
| |
| | default_print_document || Object '''form''' or JSP/HTML [Page]
| |
| |-
| |
| | show_print_document || '''yes'''
| |
| |-
| |
| | default_print_layout || The form layout or template page to use.
| |
| |-
| |
| | show_print_layout || '''yes'''
| |
| |-
| |
| | default_page_orientation || '''portrait''' or landscape
| |
| |-
| |
| | show_page_orientation || '''yes'''
| |
| |-
| |
| | default_pdf || '''yes''' (otherwise, an HTML page is generated)
| |
| |-
| |
| | show_pdf || '''yes'''
| |
| |-
| |
| | print_immediately || '''no''' (queued, instead)
| |
| |-
| |
| | show_print_immediately || '''yes'''Β
| |
| |}
| |
| Β | |
| ===lj_functionName===
| |
| ...
| |
| Β | |
| ;Syntax:
| |
| :<syntaxhighlight lang="javascript" enclose="div">
| |
| lj_functionName('{option1}={value}&{option2}={value}&...');
| |
| lj_functionName(param, param, "string-param", ...);
| |
| </syntaxhighlight>
| |
| Β | |
| ;Sample Usage:
| |
| ...
| |
| Β | |
| :<syntaxhighlight lang="javascript" enclose="div">
| |
| </syntaxhighlight>
| |
| Β | |
| ;Parameters:
| |
| ...
| |
| Β | |
| :{| border="1" cellpadding="5" cellspacing="1"
| |
| ! align="left"| Parameter !! align="left"| Description (default value in '''bold''')
| |
| |-
| |
| | param || descrΒ
| |
| |}
| |
| Β | |
| Β | |
| ===lj_showDialog===
| |
| This function displays a JSP/HTML [[Page]] as a dialog.
| |
| Β | |
| ;Syntax:
| |
| :<syntaxhighlight lang="javascript" enclose="div">
| |
| lj_showDialog(url,vertical_coordinate, horizontal_coordinate, "dialog-type", "title");
| |
| </syntaxhighlight>
| |
| :{{TBD|Are horizontal & vertical coordinates in the right order?}}
| |
| Β | |
| ;Sample Usage:
| |
| This sample displays a page at the specified URL in a popup dialog that has a close button.
| |
| Β | |
| :<syntaxhighlight lang="javascript" enclose="div">
| |
| var url = "/networking/pages/MyPage.jsp?recordId="+someValue
| |
| Β Β Β Β + "&returnUrl="+encodeURIComponent(lj_window_src);
| |
| Β | |
| top.lj_showDialog(url,300,350,"popupdialogWithCloser","My Page Title");
| |
| </syntaxhighlight>
| |
| Β | |
| ;Parameters:
| |
| All parameters are coded as strings.
| |
| Β | |
| :{| border="1" cellpadding="5" cellspacing="1"
| |
| ! align="left"| Parameter !! align="left"| Description
| |
| |-
| |
| | url || The URL of a JSP/HTML [[Page]] in the platform, in the form <tt>/networking/pages/SomePage.jsp</tt> with optional query parameters to pass data, in the form <tt>?param1=abc¶m2=xyz&...</tt>
| |
| |-
| |
| | vertical_coordinate || Pixel location of the upper left corner, counting down from the top of the parent window.
| |
| |-
| |
| | horizontal_coordinate || Pixel location of the upper left corner, counting from the left side of the parent window.
| |
| |-
| |
| | type of dialog ||
| |
| * '''popupdialogWithCloser -''' Displays the page in a popup, with a close button.
| |
| :{{TBD|What other types of dialogs are there?}}
| |
| |-
| |
| | title || Displayed in the banner of the dialog.
| |
| |}
| |
| Β | |
| ==Variables==
| |
| Β | |
| ===lj_window_src===
| |
| Contains the URL of the current page. (Needs to be URL encoded when used.)
| |
| Β | |
| ;Sample Usage:
| |
| :<syntaxhighlight lang="javascript" enclose="div">
| |
| encodeURIComponent(lj_window_src)
| |
| </syntaxhighlight>
| |