63 $this->ContextSetConfigs =
get_package(
'gui::context_set::context_set_configs' ,
'last' , __FILE__ );
64 $this->DefaultControllers =
get_package(
'gui::context_set::default_controllers' ,
'last' , __FILE__ );
65 $this->DefaultViews =
get_package(
'gui::context_set::default_views' ,
'last' , __FILE__ );
67 $this->Security =
get_package(
'security' ,
'last' , __FILE__ );
68 $this->Trace =
get_package(
'trace' ,
'last' , __FILE__ );
114 $FieldName =
'common_state_config_'.$StateName.$Suffix;
115 $FileName =
'cfcxs_'.$StateName.$Suffix;
118 $this->ContextSetConfigs->get_common_state_config(
119 $ContextSet->ContextSetSettings , $FieldName , $FileName , $Options->get_setting(
'file_path' )
123 catch( Exception $e )
155 private function trace_field( $Prefix , $FieldSuffix , $RequiredValue )
159 $Field = $Prefix.
'_'.$FieldSuffix;
161 $PostedValue = $this->Security->get_gp( $Field ,
'command' ,
'not set' );
163 $Message = $Prefix.
'_'.$FieldSuffix.
': "'.$PostedValue.
'"';
165 $this->Trace->add_trace_string( $Message );
167 $this->Trace->add_trace_string(
"required_".$FieldSuffix.
" : \"$RequiredValue\"" );
169 catch( Exception $e )
205 $this->Trace->add_trace_string(
'{lang:no_need_to_run_trace_message}' , COMMON );
207 if( strpos( $ContextAction ,
'_form' ) !==
false )
209 $this->trace_field( $Prefix ,
'context_action' , $ContextAction );
212 if( strpos( $ContextAction ,
'_form' ) ===
false )
214 $this->trace_field( $Prefix ,
'action' , $StateName );
217 catch( Exception $e )
245 $this->Trace->add_trace_string(
"State config was not found ( $StateName )" );
247 catch( Exception $e )
287 if( strpos( $Config ,
'success_message=' ) ===
false )
289 $Config .=
"\r\nsuccess_message=".$ContextSet->Prefix.
'_'.$StateName.
'_was_completed';
291 if( strpos( $Config ,
'cleanup_fields=' ) ===
false )
293 $Config .=
"\r\ncleanup_fields=".$ContextSet->Prefix.
"_action,".
294 $ContextSet->Prefix.
"_context_action";
296 if( strpos( $Config ,
'success_func=' ) ===
false )
298 $Config .=
"\r\nsuccess_func=$StateName";
303 catch( Exception $e )
347 $Config = $this->
prepare_config( $ContextSet , $Config , $StateName );
349 $this->LocalOptions->clear();
350 $this->LocalOptions->append_settings( $Config );
351 $this->LocalOptions->add_settings_from_object( $Options );
352 $this->LocalOptions->set_undefined(
'access_package_version' ,
'last' );
353 $this->LocalOptions->set_undefined( $StateName.
'_func' , $StateName ==
'copy' ?
'create' : $StateName );
355 $ContextSet->Context->load_raw_config( $Config );
356 if( $ContextSet->run_execution( $this->LocalOptions , $this->DefaultControllers , 1 ) )
363 catch( Exception $e )
403 $this->LocalOptions->clear();
404 $this->LocalOptions->append_settings( $Config );
405 $this->LocalOptions->add_settings_from_object( $Options );
406 $this->LocalOptions->set_undefined(
'access_package_version' ,
'last' );
408 if( strpos( $Config ,
'success_func' ) ===
false )
411 $Config .=
"\r\nsuccess_func=".$StateName.$Suffix;
412 $this->LocalOptions->set_undefined(
'success_func' , $StateName.$Suffix );
417 catch( Exception $e )
461 $this->Trace->add_trace_string(
'{lang:run_view_state}' , COMMON );
465 $ContextSet->Context->load_raw_config( $Config );
467 if( $ContextSet->Context->execute( $this->LocalOptions , $this->DefaultViews ) )
469 $this->Trace->add_trace_string(
'{lang:run_view_state_true}' , COMMON );
473 $this->Trace->add_trace_string(
'{lang:run_view_state_false}' , COMMON );
476 catch( Exception $e )
518 if( $Config !==
false )
529 catch( Exception $e )
571 if( $Config !==
false )
573 return( $this->
run_view_state( $ContextSet , $Options , $StateName , $Config ) );
582 catch( Exception $e )