73 $this->CachedMultyFS =
get_package(
'cached_multy_fs' ,
'last' , __FILE__ );
74 $this->PageJS =
get_package(
'page::page_js' ,
'last' , __FILE__ );
75 $this->String =
get_package(
'string' ,
'last' , __FILE__ );
76 $this->Utilities =
get_package(
'utilities' ,
'last' , __FILE__ );
106 private function get_dialog_parameters( &$Settings )
110 $id = md5( $Settings->get_setting(
'package_name' ).microtime(
true ) );
111 $DataSource = $Settings->get_setting(
'data_source' , $id );
112 $Name = $Settings->get_setting(
'name' , $DataSource );
114 return( array( $id , $DataSource , $Name ) );
116 catch( Exception $e )
144 private function select_dialog_content( &$Settings )
148 list( $id , $DataSource , $Name ) = $this->get_dialog_parameters( $Settings );
150 $Checked =
'checked';
152 $Records = $this->Utilities->get_records( $Settings );
153 foreach( $Records as $k => $v )
155 $PlaceHolders = array(
'{checked}' ,
'{id}' ,
'{value}' ,
'{title}' );
156 $id = $DataSource.get_field( $v ,
'id' );
158 $Code = $this->CachedMultyFS->get_template( __FILE__ ,
'select_dialog_item.tpl' );
159 $Code = str_replace( $PlaceHolders , $Data , $Code );
165 catch( Exception $e )
193 $Path =
'{http_host}/'._get_package_relative_path_ex(
'jquery::dialog_markup' ,
'last' );
195 $this->PageJS->add_javascript(
"$Path/include/js/iframe.dialog.js" );
196 $this->PageJS->add_javascript(
"$Path/include/js/jquery.dialog.js" );
198 catch( Exception $e )
230 $id = $Settings->get_setting(
'id' , md5( microtime(
true ) ) );
232 $Type = $Settings->get_setting(
'type' ,
'simple' );
233 $Script = $Type ==
'simple' ?
234 $this->CachedMultyFS->get_template( __FILE__ ,
'simple_select_dialog.tpl' ) :
'';
236 $Script = str_replace(
'{id}' , $id , $Script );
237 $SimpleRecords = $this->select_dialog_content( $ettings );
238 $Script = str_replace(
'{records}' , $SimpleRecords , $Script );
242 catch( Exception $e )
274 $DataSource = $Settings->get_setting(
'data_source' , md5( rand().microtime(
true ) ) );
275 $Settings->set_setting(
'data_source' , $DataSource );
277 $id = $Settings->get_setting(
'id' , md5( microtime(
true ) ) );
278 $Settings->set_setting(
'id' , $id );
280 $Code =
'{select_dialog_content:'.$Settings->get_all_settings().
281 '}{dialog:selector=#'.$id.
';'.$Settings->get_all_settings().
282 ';cancel=true;ok_processor=ultimix.ExtractSimpleSelectResult}';
286 catch( Exception $e )
318 $id = $Settings->get_setting(
'id' , md5( microtime(
true ) ) );
321 if( isset( $this->Dialogs[ $id ] ) ===
false )
323 $Code = $this->CachedMultyFS->get_template( __FILE__ ,
'view_dialog.tpl' );
324 $Code = str_replace(
'{id}' , $id , $Code );
325 $Code = str_replace(
'{all_settings}' , $Settings->get_all_settings() , $Code );
326 $this->Dialogs[ $id ] =
true;
331 catch( Exception $e )
363 $id = $BlockSettings->get_setting(
'id' , md5( microtime(
true ) ) );
364 $Script = $this->CachedMultyFS->get_template( __FILE__ ,
'static_dialog.tpl' );
365 $Script = str_replace(
'{id}' , $id , $Script );
366 $Script = str_replace(
'{all_settings}' , $BlockSettings->get_all_settings() , $Script );
370 catch( Exception $e )
402 $id = $Settings->get_setting(
'id' , md5( microtime(
true ) ) );
403 $Code = $this->CachedMultyFS->get_template( __FILE__ ,
'iframe_dialog.tpl' );
405 $PlaceHolders = array(
'{id}' ,
'{href}' ,
'{all_settings}' );
406 $Data = array( $id , $Settings->get_setting(
'href' ) , $Settings->get_all_settings() );
407 $Code = str_replace( $PlaceHolders , $Data , $Code );
411 catch( Exception $e )
443 list( $Selector , $Opener )= $Settings->get_settings(
'selector,opener' );
444 $DataSource = $Settings->get_setting(
'data_source' , $Selector );
445 $DataAcceptor = $Settings->get_setting(
'data_acceptor' ,
'' );
446 $StatusAcceptor = $Settings->get_setting(
'status_acceptor' ,
'' );
447 $Validation = $Settings->get_setting(
'before_open_validation' ,
'nop' );
450 "{add_opener:data_source=$DataSource;data_acceptor=$DataAcceptor;status_acceptor=$StatusAcceptor;".
451 "before_open_validation=$Validation;opener=$Opener;selector=$Selector}"
454 catch( Exception $e )
486 private function append_add_opener_if_necessary( $Code , &$BlockSettings )
490 if( $BlockSettings->get_setting(
'opener' ,
'' ) !=
'' )
497 catch( Exception $e )
521 private function prepare_basic_settings( &$BlockSettings )
525 $BlockSettings->set_undefined(
'title' ,
'' );
526 $BlockSettings->set_undefined(
'width' ,
'480' );
527 $BlockSettings->set_undefined(
'height' ,
'320' );
528 $BlockSettings->set_undefined(
'modal' ,
'true' );
529 $BlockSettings->set_undefined(
'auto_open' ,
'false' );
530 $BlockSettings->set_undefined(
'close_on_escape' ,
'true' );
531 $BlockSettings->set_undefined(
'resizable' ,
'true' );
533 catch( Exception $e )
561 $BlockSettings->get_setting(
'selector' );
563 $this->prepare_basic_settings( $BlockSettings );
565 $BlockSettings->set_undefined(
'hide_close_button' ,
'false' );
566 $BlockSettings->set_undefined(
'ok_processor' ,
'' );
567 $BlockSettings->set_undefined(
'cancel' ,
'false' );
568 $BlockSettings->set_undefined(
'on_open' ,
'nop()' );
570 catch( Exception $e )
604 $Code = $this->CachedMultyFS->get_template( __FILE__ ,
'dialog_init.tpl' );
606 $Data = $BlockSettings->get_raw_settings();
608 $Code = $this->String->print_record( $Code , $Data );
610 $Code = $this->append_add_opener_if_necessary( $Code , $BlockSettings );
614 catch( Exception $e )
638 private function prepare_data_for_opener( &$BlockSettings )
642 $BlockSettings->get_setting(
'selector' );
643 $BlockSettings->get_setting(
'opener' );
645 $BlockSettings->set_undefined(
'before_open_validation' ,
'nop' );
646 $BlockSettings->set_undefined(
'data_source' ,
'' );
647 $BlockSettings->set_undefined(
'data_acceptor' ,
'' );
648 $BlockSettings->set_undefined(
'status_acceptor' ,
'' );
650 catch( Exception $e )
682 $this->prepare_data_for_opener( $BlockSettings );
684 $AddOpenerScript = $this->CachedMultyFS->get_template( __FILE__ ,
'add_opener.tpl' );
685 $Data = $BlockSettings->get_raw_settings();
686 $AddOpenerScript = $this->String->print_record( $AddOpenerScript , $Data );
688 return( $AddOpenerScript );
690 catch( Exception $e )