74 $this->ContextSetMarkup =
get_package(
'gui::context_set::context_set_markup' ,
'last' , __FILE__ );
75 $this->PermitAlgorithms =
get_package(
'permit::permit_algorithms' ,
'last' , __FILE__ );
76 $this->Security =
get_package(
'security' ,
'last' , __FILE__ );
77 $PackageName =
'gui::context_set::common_state_startup::common_state_startup_utilities';
78 $this->StartupUtilities =
get_package( $PackageName ,
'last' , __FILE__ );
79 $this->Trace =
get_package(
'trace' ,
'last' , __FILE__ );
113 $this->Prefix = $ContextSet->Prefix;
114 $this->StartupUtilities->DefaultControllers->set_constants( $ContextSet , $Options );
115 $this->StartupUtilities->DefaultViews->set_constants( $ContextSet , $Options );
117 catch( Exception $e )
149 private function not_processed( &$ContextSet , $Str1 , $Str2 )
153 $this->StartupUtilities->trace_no_need_to_run_state_message( $Str1 , $this->Prefix , $Str2 );
155 catch( Exception $e )
189 private function run_it( &$Options , $State )
193 $HintedContext = $Options->get_setting(
'common_context' ,
false );
195 if( $HintedContext ===
false )
200 return( $HintedContext == $State );
202 catch( Exception $e )
238 private function controller_state_startup( &$ContextSet , &$Options , $State )
242 $ContextSet->Trace->start_group(
'{lang:'.$State.
'_state}' );
244 $Action = $this->Security->get_gp( $this->Prefix.
'_action' ,
'command' ,
'' );
245 $Direct = $Options->get_setting(
'direct_'.$State , 0 );
247 if( $Action == $State.
'_record' || $Direct != 0 )
249 $Result = $this->StartupUtilities->try_run_controller_state( $ContextSet , $Options , $State );
254 $this->not_processed( $ContextSet , $State , $State.
'_record' );
257 $ContextSet->Trace->end_group();
260 catch( Exception $e )
298 $States = array(
'delete' ,
'create' ,
'update' ,
'copy' );
300 foreach( $States as $i => $State )
302 if( $this->run_it( $Options , $State ) )
304 if( $this->controller_state_startup( $ContextSet , $Options , $State ) )
313 catch( Exception $e )
349 private function view_state_startup( &$ContextSet , &$Options , $State )
353 $ContextSet->Trace->start_group(
'{lang:'.$State.
'_form_state}' );
355 $Action = $this->Security->get_gp( $this->Prefix.
'_context_action' ,
'command' ,
'' );
356 $Direct = $Options->get_setting(
'direct_'.$State , 0 );
358 $IsList = ( $State ==
'list' && $Action ==
'' );
360 if( $IsList || $Action == $State.
'_record_form' || $Direct != 0 )
362 $Result = $this->StartupUtilities->try_run_view_state( $ContextSet , $Options , $State );
367 $this->not_processed( $ContextSet , $State , $State.
'_form' );
370 $ContextSet->Trace->end_group();
373 catch( Exception $e )
411 $States = array(
'list' ,
'create' ,
'update' ,
'copy' ,
'record_view' );
413 foreach( $States as $i => $State )
415 if( $this->run_it( $Options , $State ) )
417 if( $this->view_state_startup( $ContextSet , $Options , $State ) )
426 catch( Exception $e )
462 $this->Trace->start_group(
"common_configs_processing" , COMMON );
465 if( $Options->get_setting(
'controller' , 0 ) != 0 )
471 $this->Trace->add_trace_string(
"no_controllers" , COMMON );
473 if( $Options->get_setting(
'view' , 0 ) != 0 )
479 $this->Trace->add_trace_string(
"no_views" , COMMON );
481 $this->Trace->end_group();
484 catch( Exception $e )