ultimix
jsdialogs.php
Go to the documentation of this file.
1 <?php
2 
3  /*
4  * This source code is a part of the Ultimix Project.
5  * It is distributed under BSD license. All other third side source code (like tinyMCE) is distributed under
6  * it's own license wich could be found from the corresponding files or sources.
7  * This source code is provided "as is" without any warranties or garanties.
8  *
9  * Have a nice day!
10  *
11  * @url http://ultimix.sorceforge.net
12  *
13  * @author Alexey "gdever" Dodonov
14  */
15 
27 
38  var $CachedMultyFS = false;
39  var $PageCSS = false;
40  var $PageJS = false;
41  var $Settings = false;
42  var $String = false;
43 
58  function __construct()
59  {
60  try
61  {
62  $this->CachedMultyFS = get_package( 'cached_multy_fs' , 'last' , __FILE__ );
63  $this->PageCSS = get_package( 'page::page_css' , 'last' , __FILE__ );
64  $this->PageJS = get_package( 'page::page_js' , 'last' , __FILE__ );
65  $this->Settings = get_package_object( 'settings::settings' , 'last' , __FILE__ );
66  $this->String = get_package( 'string' , 'last' , __FILE__ );
67  }
68  catch( Exception $e )
69  {
70  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
71  }
72  }
73 
92  function pre_generation( $Options )
93  {
94  try
95  {
96  $Path = _get_package_relative_path_ex( 'jsdialogs' , '1.0.0' );
97  $this->PageCSS->add_stylesheet( "{http_host}/$Path/res/css/jsdialogs.css" );
98  $this->PageJS->add_javascript( "{http_host}/$Path/include/js/dialogs.js" );
99  }
100  catch( Exception $e )
101  {
102  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
103  }
104  }
105 
132  private function add_opener( &$Settings , $Template )
133  {
134  try
135  {
136  $OpenerId = $Settings->get_setting( 'opener_id' , false );
137  if( $OpenerId )
138  {
139  $Template = str_replace( '{opener_selector}' , 'opener=#visible_{opener_id};' , $Template );
140  $Template = str_replace( '{opener_id}' , $OpenerId , $Template );
141  }
142 
143  return( $Template );
144  }
145  catch( Exception $e )
146  {
147  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
148  }
149  }
150 
185  function selection_dialog( $FilePath , $EntityName , $Str , &$Changed )
186  {
187  try
188  {
189  $MacroName = $EntityName.'_selection_dialog';
190 
191  for( ; $MacroParameters = $this->String->get_macro_parameters( $Str , $MacroName ) ; )
192  {
193  $this->Settings->load_settings( $MacroParameters );
194  $Template = $this->CachedMultyFS->get_template( $FilePath , "$MacroName.tpl" );
195  $Template = $this->add_opener( $Settings , $Template );
196 
197  $id = $this->Settings->get_setting( 'id' , md5( microtime( true ) ) );
198  $Template = str_replace( '{id}' , $id , $Template );
199 
200  $Str = str_replace( '{'."$MacroName:$MacroParameters}" , $Template , $Str );
201  $Changed = true;
202  }
203 
204  return( $Str );
205  }
206  catch( Exception $e )
207  {
208  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
209  }
210  }
211 
230  function view( $Options )
231  {
232  try
233  {
234  return( '' );
235  }
236  catch( Exception $e )
237  {
238  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
239  }
240  }
241  }
242 
243 ?>