2222 */
2323class RuntemplateConfigForm extends EngineForm
2424{
25- private array $ modulesEnv ;
26-
2725 public function __construct (\MultiFlexi \RunTemplate $ engine )
2826 {
2927 parent ::__construct ($ engine , null , ['method ' => 'post ' , 'action ' => 'runtemplate.php ' , 'enctype ' => 'multipart/form-data ' ]);
@@ -45,7 +43,7 @@ public function __construct(\MultiFlexi\RunTemplate $engine)
4543
4644 $ this ->addItem (new RuntemplateRequirementsChoser ($ engine ));
4745
48- $ appFields = \MultiFlexi \Conffield::getAppConfigs ($ engine ->getDataValue ( ' app_id ' ));
46+ $ appFields = \MultiFlexi \Conffield::getAppConfigs ($ engine ->getApplication ( ));
4947 $ runTemplateFields = $ engine ->getEnvironment ();
5048
5149 $ appFields ->addFields ($ customized );
@@ -59,32 +57,41 @@ public function __construct(\MultiFlexi\RunTemplate $engine)
5957
6058 $ runTemplateField = $ runTemplateFields ->getFieldByCode ($ fieldName );
6159
62- if ($ runTemplateField ) {
63- if (\array_key_exists ($ fieldName , $ credData )) {
64- $ input ->setTagProperty ('disabled ' , '1 ' );
65- $ input ->setValue ($ credData [$ fieldName ]);
66- }
60+ if ($ runTemplateField ) { // Filed by Credential
61+ $ input ->setTagProperty ('disabled ' , '1 ' );
62+
63+ $ runTemplateFieldSource = $ runTemplateField ->getSource ();
64+
65+ if (\Ease \Functions::isSerialized ($ runTemplateFieldSource )) {
66+ $ credential = unserialize ($ runTemplateFieldSource );
67+
68+ if ($ credential ) {
69+ $ credentialType = $ credential ->getCredentialType ();
70+
71+ $ credentialLink = new \Ease \Html \ATag ('credential.php?id= ' .$ credential ->getMyKey (), new \Ease \Html \SmallTag ($ credential ->getRecordName ()));
6772
68- $ formIcon = new \Ease \Html \ImgTag ($ runTemplateField ->getLogo (), $ runTemplateField -> getSource (), ['height ' => 20 , 'title ' => $ runTemplateField -> getSource ()]);
73+ $ formIcon = new \Ease \Html \ImgTag (' images/ ' . $ runTemplateField ->getLogo (), $ credentialType -> getRecordName (), ['height ' => 20 , 'title ' => $ credentialType -> getRecordName ()]);
6974
70- if (\array_key_exists ($ fieldName , $ credSource )) {
71- $ fieldLink = new \Ease \Html \ATag ('credential.php?id= ' .$ credSource [$ fieldName ], $ formIcon .' ' .$ fieldName );
75+ $ credentialTypeLink = new \Ease \Html \ATag ('credentialtype.php?id= ' .$ credentialType ->getMyKey (), $ formIcon );
76+
77+ $ inputCaption = new \Ease \Html \SpanTag ([$ credentialTypeLink , new \Ease \Html \StrongTag ($ fieldName ), ' ' , $ credentialLink ]);
78+ }
7279 } else {
73- $ fieldLink = $ formIcon . ' ' . $ fieldName ;
80+ $ inputCaption = new \ Ease \ Html \ StrongTag ( $ fieldName) ;
7481 }
7582
76- $ formGroup = $ this ->addInput ($ input , $ fieldLink , $ field -> getDefaultValue (), $ field ->getDescription ());
77- } else {
78- $ formGroup = $ this ->addInput ($ input , $ fieldName. ' ( ' . $ field -> getSource (). ' ) ' , $ field ->getDefaultValue (), $ field ->getDescription ());
83+ $ formGroup = $ this ->addInput ($ input , $ inputCaption , $ runTemplateField -> getValue (), $ field ->getDescription ());
84+ } else { // Simple Fields
85+ $ formGroup = $ this ->addInput ($ input , $ fieldName , $ field ->getDefaultValue (), $ field ->getDescription ());
7986 }
8087
81- if ($ field ->isRequired ()) {
82- $ formGroup ->addTagClass ('bg-danger ' );
83- }
84-
85- if ($ field ->getSource ()) {
86- $ formGroup ->addTagClass ('bg-info ' );
87- }
88+ // if ($field->isRequired()) {
89+ // $formGroup->addTagClass('bg-danger');
90+ // }
91+ //
92+ // if ($field->getSource()) {
93+ // $formGroup->addTagClass('bg-info');
94+ // }
8895 }
8996
9097 // $this->addItem( new RuntemplateTopicsChooser('topics', $engine)); //TODO
0 commit comments