Source for file TJQueryDialog.php
Documentation is available at TJQueryDialog.php
namespace
Adianti \
Widget \
Container ;
* JQuery dialog container
* @author Pablo Dall'Oglio
* @copyright Copyright (c) 2006 Adianti Solutions Ltd. (http://www.adianti.com.br)
* @license http://www.adianti.com.br/framework-license
* @param $name Name of the widget
$this -> useOKButton =
TRUE ;
$this -> draggable =
'true' ;
$this -> resizable =
'true' ;
$this -> stackOrder =
2000 ;
$this -> closeEscape =
true ;
$this -> { 'id' } =
'jquery_dialog_' .
mt_rand ( 1000000000 , 1999999999 ) ;
$this -> { 'style' } =
"overflow:auto" ;
* Disable close on escape
$this -> closeEscape =
false ;
$this -> { 'style' } =
"overflow: hidden" ;
* @param $class Class name
$this -> dialogClass =
$class ;
$this -> closeAction =
$action ;
$string_action =
$action -> toString ( ) ;
* Define if will use OK Button
$this -> useOKButton =
$bool ;
* Define the dialog title
$this -> { 'title' } =
$title ;
$this -> modal =
$bool ?
'true' :
'false' ;
$this -> resizable =
$bool ?
'true' :
'false' ;
$this -> draggable =
$bool ?
'true' :
'false' ;
public function setSize ( $width , $height )
$this -> width =
$width <
1 ?
" \$(window).width() * $width " :
$width ;
$this -> height =
"'auto'" ;
$this -> height =
$height <
1 ?
" \$(window).height() * $height " :
$height ;
* Define the window's min width between percent and absolute
$this -> width =
" Math.min(\$(window).width() * $percent , $absolute ) " ;
* Define the dialog position
* Add a JS button to the dialog
* @param $label button label
* @param $action JS action
$this -> actions [ ] =
array ( $label , $action ) ;
* Define the stack order (zIndex)
* @param $order Stack order
$this -> stackOrder =
$order ;
* Shows the widget at the screen
foreach ( $this -> actions as $action_array )
$label =
$action_array [ 0 ] ;
$action =
$action_array [ 1 ] ;
$action_code .=
" \"{$label } \": function() { $action }, " ;
$ok_button =
' OK: function() { $( this ).remove(); }' ;
$left =
$this -> left ?
$this -> left :
0 ;
$top =
$this -> top ?
$this -> top :
0 ;
$close_action =
'undefined' ; // cannot be function, because it is tested inside tjquerydialog.js
if ( isset
( $this -> closeAction ))
$string_action =
$this -> closeAction -> serialize ( FALSE ) ;
$close_action =
" function() { __adianti_ajax_exec('{$string_action } ') } " ;
$close_on_escape =
$this -> closeEscape ?
'true' :
'false' ;
parent :: add ( TScript :: create ( " tjquerydialog_start( '#{$id } ', {$this -> modal } , {
$this -> draggable } , {
$this -> resizable } , {
$this -> width } , {
$this -> height } , {
$top } , {
$left } , {
$this -> stackOrder } , { {
$action_code } {
$ok_button } },
$close_action ,
$close_on_escape , '{
$this -> dialogClass } ' );
" , FALSE )) ;
* Close all TJQueryDialog
if ( ! isset
( $_REQUEST [ 'ajax_lookup' ] ) OR $_REQUEST [ 'ajax_lookup' ] !==
'1' )
// it has to be inline (not external function call)
* Close all TJQueryDialog
if ( ! isset
( $_REQUEST [ 'ajax_lookup' ] ) OR $_REQUEST [ 'ajax_lookup' ] !==
'1' )
// it has to be inline (not external function call)
TScript :: create ( ' $(\'[role=window-wrapper]\').last().remove(); ' ) ;