Skip to content

Commit

Permalink
Fix showSimpleMessage error
Browse files Browse the repository at this point in the history
  • Loading branch information
jcheron committed Jun 27, 2019
1 parent d68db23 commit 52a5478
Show file tree
Hide file tree
Showing 13 changed files with 495 additions and 413 deletions.
379 changes: 208 additions & 171 deletions src/Ubiquity/controllers/admin/traits/CheckTrait.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Ubiquity/controllers/admin/traits/ConfigTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ abstract protected function reloadConfig();

abstract protected function showConfMessage($content, $type, $title, $icon, $url, $responseElement, $data, $attributes = NULL): HtmlMessage;

abstract protected function showSimpleMessage($content, $type, $title = null, $icon = "info", $timeout = NULL, $staticName = null): HtmlMessage;
abstract public function showSimpleMessage($content, $type, $title = null, $icon = "info", $timeout = NULL, $staticName = null, $closeAction = null): HtmlMessage;

public function formConfig($hasHeader = true) {
global $config;
Expand Down
2 changes: 1 addition & 1 deletion src/Ubiquity/controllers/admin/traits/ControllersTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ abstract protected function _createController($controllerName, $variables = [],

abstract protected function _addMessageForRouteCreation($path);

abstract public function showSimpleMessage($content, $type, $title = null, $icon = "info", $timeout = NULL, $staticName = null): HtmlMessage;
abstract public function showSimpleMessage($content, $type, $title = null, $icon = "info", $timeout = NULL, $staticName = null, $closeAction = null): HtmlMessage;

public function createController($force = null) {
if (URequest::isPost()) {
Expand Down
75 changes: 42 additions & 33 deletions src/Ubiquity/controllers/admin/traits/DatabaseTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,63 +13,72 @@
use Ajax\semantic\html\collections\HtmlMessage;

/**
*
* @author jc
* @property \Ajax\JsUtils $jquery
*/
trait DatabaseTrait{
trait DatabaseTrait {

abstract public function _getAdminData();

abstract public function _getAdminViewer();

abstract public function _getFiles();
abstract public function loadView($viewName, $pData=NULL, $asString=false);
abstract protected function showSimpleMessage($content, $type, $title=null,$icon="info", $timeout=NULL, $staticName=null):HtmlMessage;

protected function getModels(){
$config=Startup::getConfig();
$models=CacheManager::getModels($config,true);
$result=[];
foreach ($models as $model){
$table=OrmUtils::getTableName($model);
$simpleM=ClassUtils::getClassSimpleName($model);
if($simpleM!==$table)
$result[$table]=$simpleM."[".$table."]";
abstract public function loadView($viewName, $pData = NULL, $asString = false);

abstract public function showSimpleMessage($content, $type, $title = null, $icon = "info", $timeout = NULL, $staticName = null, $closeAction = null): HtmlMessage;

protected function getModels() {
$config = Startup::getConfig();
$models = CacheManager::getModels($config, true);
$result = [];
foreach ($models as $model) {
$table = OrmUtils::getTableName($model);
$simpleM = ClassUtils::getClassSimpleName($model);
if ($simpleM !== $table)
$result[$table] = $simpleM . "[" . $table . "]";
else
$result[$table]=$simpleM;
$result[$table] = $simpleM;
}
return $result;
}

public function createSQLScript(){
if(URequest::isPost()){
$db=$_POST["dbName"];
if(DAO::isConnected()){
$actualDb=DAO::$db->getDbName();
public function createSQLScript() {
if (URequest::isPost()) {
$db = $_POST["dbName"];
if (DAO::isConnected()) {
$actualDb = DAO::$db->getDbName();
}
$generator=new DatabaseReversor(new DbGenerator());
$generator = new DatabaseReversor(new DbGenerator());
$generator->createDatabase($db);
$frm=$this->jquery->semantic()->htmlForm("form-sql");
$text=$frm->addElement("sql", $generator->__toString(),"SQL script","div","ui segment editor");
$frm = $this->jquery->semantic()->htmlForm("form-sql");
$text = $frm->addElement("sql", $generator->__toString(), "SQL script", "div", "ui segment editor");
$text->getField()->setProperty("style", "background-color: #002B36;");
$bts=$this->jquery->semantic()->htmlButtonGroups("buttons");
$bts = $this->jquery->semantic()->htmlButtonGroups("buttons");
$bts->addElement("Generate database")->addClass("green");
if(isset($actualDb) && $actualDb!==$db){
$btExport=$bts->addElement("Export datas script : ".$actualDb." => ".$db);
if (isset($actualDb) && $actualDb !== $db) {
$btExport = $bts->addElement("Export datas script : " . $actualDb . " => " . $db);
$btExport->addIcon("exchange");
$btExport->postOnClick($this->_getFiles()->getAdminBaseRoute()."/exportDatasScript","{}","#div-datas");
$btExport->postOnClick($this->_getFiles()
->getAdminBaseRoute() . "/exportDatasScript", "{}", "#div-datas");
}
$frm->addDivider();
$this->jquery->exec("setAceEditor('sql');",true);
$this->jquery->exec("setAceEditor('sql');", true);
$this->jquery->compile($this->view);
$this->loadView($this->_getFiles()->getViewDatabaseCreate());
$this->loadView($this->_getFiles()
->getViewDatabaseCreate());
}
}

public function exportDatasScript(){
$dbExport=new DbExport();
$frm=$this->jquery->semantic()->htmlForm("form-sql-datas");
$text=$frm->addElement("datas-sql", $dbExport->exports(),"Datas export script","div","ui segment editor");
public function exportDatasScript() {
$dbExport = new DbExport();
$frm = $this->jquery->semantic()->htmlForm("form-sql-datas");
$text = $frm->addElement("datas-sql", $dbExport->exports(), "Datas export script", "div", "ui segment editor");
$text->getField()->setProperty("style", "background-color: #002B36;");
$this->jquery->exec("setAceEditor('datas-sql');",true);
$this->jquery->exec("setAceEditor('datas-sql');", true);
$this->jquery->compile($this->view);
$this->loadView($this->_getFiles()->getViewDatasExport());
$this->loadView($this->_getFiles()
->getViewDatasExport());
}
}
2 changes: 1 addition & 1 deletion src/Ubiquity/controllers/admin/traits/GitTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ abstract public function git();

abstract protected function showConfMessage($content, $type, $itle, $icon, $url, $responseElement, $data, $attributes = NULL): HtmlMessage;

abstract protected function showSimpleMessage($content, $type, $title = null, $icon = "info", $timeout = NULL, $staticName = null): HtmlMessage;
abstract public function showSimpleMessage($content, $type, $title = null, $icon = "info", $timeout = NULL, $staticName = null, $closeAction = null): HtmlMessage;

public function gitRefresh() {
echo $this->_git();
Expand Down
2 changes: 1 addition & 1 deletion src/Ubiquity/controllers/admin/traits/LogsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ abstract protected function reloadConfig();

abstract protected function showConfMessage($content, $type, $title, $icon, $url, $responseElement, $data, $attributes = NULL): HtmlMessage;

abstract protected function showSimpleMessage($content, $type, $title = null, $icon = "info", $timeout = NULL, $staticName = null): HtmlMessage;
abstract public function showSimpleMessage($content, $type, $title = null, $icon = "info", $timeout = NULL, $staticName = null, $closeAction = null): HtmlMessage;

public function logsRefresh() {
$maxLines = URequest::post("maxLines", null);
Expand Down
2 changes: 1 addition & 1 deletion src/Ubiquity/controllers/admin/traits/MaintenanceTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ abstract public function loadView($viewName, $pData = NULL, $asString = false);

abstract protected function showConfMessage($content, $type, $title, $icon, $url, $responseElement, $data, $attributes = NULL): HtmlMessage;

abstract protected function showSimpleMessage($content, $type, $title = null, $icon = "info", $timeout = NULL, $staticName = null): HtmlMessage;
abstract public function showSimpleMessage($content, $type, $title = null, $icon = "info", $timeout = NULL, $staticName = null, $closeAction = null): HtmlMessage;

protected function _displayActiveMaintenance(MaintenanceMode $maintenance) {
$semantic = $this->jquery->semantic();
Expand Down
2 changes: 1 addition & 1 deletion src/Ubiquity/controllers/admin/traits/ModelsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ abstract public function _getModelViewer();

abstract public function _getFiles();

abstract protected function showSimpleMessage($content, $type, $title = null, $icon = "info", $timeout = NULL, $staticName = null): HtmlMessage;
abstract public function showSimpleMessage($content, $type, $title = null, $icon = "info", $timeout = NULL, $staticName = null, $closeAction = null): HtmlMessage;

abstract public function showConfMessage($content, $type, $title, $icon, $url, $responseElement, $data, $attributes = NULL): HtmlMessage;

Expand Down
Loading

0 comments on commit 52a5478

Please sign in to comment.