Skip to content

Commit dc9bb9b

Browse files
authored
Merge pull request #180 from WebFiori/dev
Fix to Missing Methods + Upgrade CLI + Documentation
2 parents 3d8d2fb + add8d48 commit dc9bb9b

File tree

8 files changed

+100
-24
lines changed

8 files changed

+100
-24
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
"ext-fileinfo": "*",
2020
"ext-openssl": "*",
2121
"webfiori/err":"v1.0.6",
22-
"webfiori/cli":"v1.1.1",
22+
"webfiori/cli":"v1.1.3",
2323
"webfiori/file":"v1.3.2",
2424
"webfiori/collections":"v1.1.3",
2525
"webfiori/ui":"v2.5.5",
2626
"webfiori/jsonx":"v3.2.2",
27-
"webfiori/http":"v3.3.2 ",
27+
"webfiori/http":"v3.3.3 ",
2828
"webfiori/database":"v0.7.4",
2929
"webfiori/mailer":"v1.0.6"
3030
},

webfiori/framework/ThemeLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public static function resetLoaded() {
152152
* Loads a theme given its name or class name.
153153
*
154154
* If the given name is null or empty string, the method will load the default theme as
155-
* specified by the method AppConfig::getBaseThemeName().
155+
* which is set by application configuration.
156156
*
157157
* @param string|null $themeName The name of the theme. This also can be the name of
158158
* theme class including its namespace (e.g. Theme::class).

webfiori/framework/cli/helpers/CreateFullRESTHelper.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,9 @@ private function getUniqueAPIParams() : array {
192192
}
193193
private function IncludeAPISetProps(WebServiceWriter $w, $type) {
194194
$t = $this->getTable();
195-
$w->addProcessCode('$entity = new '.$t->getEntityMapper()->getEntityName().'();');
195+
$w->addProcessCode('$entity = $this->getObject('.$t->getEntityMapper()->getEntityName().'::class);');
196196

197-
foreach ($t->getColsKeys() as $paramName) {
198-
$w->addProcessCode('$entity->'.EntityMapper::mapToMethodName($paramName, 's').'($this->getParamVal(\''.$paramName.'\'));');
199-
}
197+
200198
$dbClassName = $this->dbObjWriter->getName();
201199
$entityName = $this->dbObjWriter->getEntityName();
202200
$w->addProcessCode("");

webfiori/framework/config/ClassDriver.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1269,7 +1269,16 @@ public function setTitle(string $title, string $langCode) {
12691269
$this->configVars['site']['titles'][$langCode] = $title;
12701270
$this->writeAppConfig();
12711271
}
1272-
1272+
/**
1273+
* Initialize configuration driver.
1274+
*
1275+
* This method should be used to create application configuration and
1276+
* pubulate it with default values if needed.
1277+
*
1278+
* @param bool $reCreate If the configuration is exist and this one is set
1279+
* to true, the method should remove existing configuration and re-create it
1280+
* using default values.
1281+
*/
12731282
public function initialize(bool $reCreate = false) {
12741283
$cfgNs = self::CONFIG_NS;
12751284
if ($reCreate) {

webfiori/framework/config/JsonDriver.php

Lines changed: 79 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public function __construct() {
6868
'database-connections' => new Json(),
6969
]);
7070
$this->json->setIsFormatted(true);
71+
$this->json->setPropsStyle('none');
7172
}
7273
/**
7374
* Adds application environment variable to the configuration.
@@ -313,7 +314,15 @@ public function setAppVersion(string $vNum, string $vType, string $releaseDate)
313314
public function setBaseURL(string $url) {
314315

315316
}
316-
317+
/**
318+
* Sets or update default description of the application that will be used
319+
* by web pages.
320+
*
321+
* @param string $description The default description.
322+
*
323+
* @param string $langCode The code of the language at which the description
324+
* will be updated for.
325+
*/
317326
public function setDescription(string $description, string $langCode) {
318327
$code = $this->isValidLangCode($langCode);
319328

@@ -324,12 +333,27 @@ public function setDescription(string $description, string $langCode) {
324333
$appNamesJson->add($code, $description);
325334
$this->writeJson();
326335
}
327-
336+
/**
337+
* Sets the home page of the application.
338+
*
339+
*
340+
* @param string $url The URL of the home page of the website. For example,
341+
* This page is served when the user visits the domain without specifying a path.
342+
*/
328343
public function setHomePage(string $url) {
329344
$this->json->add('home-page', $url);
330345
$this->writeJson();
331346
}
332-
347+
/**
348+
* Update application version information.
349+
*
350+
* @param string $vNum Version number such as 1.0.0.
351+
*
352+
* @param string $vType Version type such as 'Beta', 'Alpha' or 'RC'.
353+
*
354+
* @param string $releaseDate The date at which the version was released on.
355+
*
356+
*/
333357
public function setPrimaryLanguage(string $langCode) {
334358
$code = $this->isValidLangCode($langCode);
335359

@@ -339,22 +363,47 @@ public function setPrimaryLanguage(string $langCode) {
339363
$this->json->add('primary-lang', $code);
340364
$this->writeJson();
341365
}
342-
366+
/**
367+
* Updates the password which is used to protect tasks from unauthorized
368+
* execution.
369+
*
370+
* @param string $newPass The new password. Note that provided value
371+
* must be hashed using SHA256 algorithm.
372+
*
373+
*/
343374
public function setSchedulerPassword(string $newPass) {
344375
$this->json->add('scheduler-password', $newPass);
345376
$this->writeJson();
346377
}
347-
378+
/**
379+
* Sets the default theme which will be used to style web pages.
380+
*
381+
* @param string $theme The name of the theme that will be used to style
382+
* website UI. This can also be class name of the theme.
383+
*/
348384
public function setTheme(string $theme) {
349385
$this->json->add('theme', $theme);
350386
$this->writeJson();
351387
}
352-
388+
/**
389+
* Sets the string which is used to separate application name from page name.
390+
*
391+
* @param string $separator A character or a string that is used
392+
* to separate application name from web page title. Two common
393+
* values are '-' and '|'.
394+
*/
353395
public function setTitleSeparator(string $separator) {
354396
$this->json->add('name-separator', $separator);
355397
$this->writeJson();
356398
}
357-
399+
/**
400+
* Returns an array that holds different names for the web application
401+
* on different languages.
402+
*
403+
* @return array The indices of the array are language codes such as 'AR' and
404+
* the value of the index is the name.
405+
*
406+
*/
358407
public function getAppNames(): array {
359408
$appNamesJson = $this->json->get('app-names');
360409
$retVal = [];
@@ -363,7 +412,13 @@ public function getAppNames(): array {
363412
}
364413
return $retVal;
365414
}
366-
415+
/**
416+
* Returns an array that holds different descriptions for the web application
417+
* on different languages.
418+
*
419+
* @return array The indices of the array are language codes such as 'AR' and
420+
* the value of the index is the description.
421+
*/
367422
public function getDescriptions(): array {
368423
$descriptions = $this->json->get('app-descriptions');
369424
$retVal = [];
@@ -372,7 +427,14 @@ public function getDescriptions(): array {
372427
}
373428
return $retVal;
374429
}
375-
430+
/**
431+
* Returns an array that holds different page titles for the web application
432+
* on different languages.
433+
*
434+
* @return array The indices of the array are language codes such as 'AR' and
435+
* the value of the index is the title.
436+
*
437+
*/
376438
public function getTitles(): array {
377439
$titles = $this->json->get('titles');
378440
$retVal = [];
@@ -381,7 +443,14 @@ public function getTitles(): array {
381443
}
382444
return $retVal;
383445
}
384-
446+
/**
447+
* Sets or updates default web page title for a specific display language.
448+
*
449+
* @param string $title The title that will be set.
450+
*
451+
* @param string $langCode The display language at which the title will be
452+
* set or updated for.
453+
*/
385454
public function setTitle(string $title, string $langCode) {
386455
$code = $this->isValidLangCode($langCode);
387456

webfiori/framework/scheduler/TaskStatusEmail.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ private function createTaskInfoTable(AbstractTask $task): HTMLNode {
118118
$taskTable->addChild($this->createTableRow('Framework Release Date:', WF_RELEASE_DATE));
119119
$taskTable->addChild($this->createTableRow('Root Directory:', ROOT_PATH));
120120
$taskTable->addChild($this->createTableRow('Application Directory:', ROOT_PATH.DS.APP_DIR));
121-
$taskTable->addChild($this->createTableRow('Application Version:', App::getConfig()->getVersion()));
122-
$taskTable->addChild($this->createTableRow('Version Type:', App::getConfig()->getVersionType()));
123-
$taskTable->addChild($this->createTableRow('Application Release Date:', App::getConfig()->getReleaseDate()));
121+
$taskTable->addChild($this->createTableRow('Application Version:', App::getConfig()->getAppVersion()));
122+
$taskTable->addChild($this->createTableRow('Version Type:', App::getConfig()->getAppVersionType()));
123+
$taskTable->addChild($this->createTableRow('Application Release Date:', App::getConfig()->getAppReleaseDate()));
124124

125125
if ($task->isSuccess()) {
126126
$taskTable->addChild($this->createTableRow('Exit Status:', '<b style="color:green">Success</b>'));

webfiori/framework/ui/HTTPCodeView.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class HTTPCodeView extends WebPage {
2424
*/
2525
public function __construct($errCode) {
2626
parent::__construct();
27-
$this->setTheme(App::getConfig()->getBaseThemeName());
27+
$this->setTheme(App::getConfig()->getTheme());
2828

2929
$this->setTitle($this->get("general/http-codes/$errCode/code").' - '.$this->get("general/http-codes/$errCode/type"));
3030
http_response_code(intval($this->get("general/http-codes/$errCode/code")));

webfiori/framework/ui/WebPage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -988,8 +988,8 @@ public function setLang(string $lang = 'EN') {
988988
*
989989
* @param string $themeNameOrClass The name of the theme as specified by the
990990
* variable 'name' in theme definition. If the given name is 'null', the
991-
* method will load the default theme as specified by the method
992-
* 'AppConfig::getBaseThemeName()'. Note that once the theme is updated,
991+
* method will load the default theme as specified by application configuration.
992+
* Note that once the theme is updated,
993993
* the document content of the page will reset if it was set before calling this
994994
* method. This also can be the value which can be taken from 'ClassName::class'.
995995
*

0 commit comments

Comments
 (0)