Skip to content

Commit

Permalink
installation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Praesidiarius committed Jan 23, 2020
1 parent e49d171 commit b9eef98
Show file tree
Hide file tree
Showing 8 changed files with 164 additions and 50 deletions.
18 changes: 16 additions & 2 deletions docs/book/dynamic-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,29 @@ INSERT INTO `core_form_field` (`Field_ID`, `type`, `label`, `fieldkey`, `tab`, `
### Text

### Textarea
```sql
ALTER TABLE `skeleton` ADD `description` TEXT NOT NULL DEFAULT '' AFTER `label`;
INSERT INTO `core_form_field` (`Field_ID`, `type`, `label`, `fieldkey`, `tab`, `form`, `class`, `url_view`, `url_ist`, `show_widget_left`, `allow_clear`, `readonly`, `tbl_cached_name`, `tbl_class`, `tbl_permission`) VALUES (NULL, 'textarea', 'Description', 'description', 'skeleton-base', 'skeleton-single', 'col-md-12', '', '', '0', '1', '0', '', '', '');
```

### Date

### Datetime

```sql
ALTER TABLE `skeleton` ADD `custom_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `modified_date`;
INSERT INTO `core_form_field` (`Field_ID`, `type`, `label`, `fieldkey`, `tab`, `form`, `class`, `url_view`, `url_ist`, `show_widget_left`, `allow_clear`, `readonly`, `tbl_cached_name`, `tbl_class`, `tbl_permission`) VALUES (NULL, 'datetime', 'Custom Date', 'custom_date', 'skeleton-base', 'skeleton-single', 'col-md-3', '', '', '0', '1', '0', '', '', '');
```
### Time

### Tel

### E-Mail

### Partial
### Partial

## After SQL installation of field

Then go to selected user, edit, and add the new fields so you can see/edit them
You can also add to index column if you like.

Have fun
24 changes: 24 additions & 0 deletions docs/book/quick-start.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Quick Start

Now that you have basic knowledge of oneplace, we'll show you the easy way to get started.

## Install onePlace Core Application

The easiest way to get started is to install the core application via
Composer.

If you have not yet done so, [install Composer](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx).

Once you have, use the `create-project` command to create a new application:

```bash
$ composer create-project oneplace/oneplace-core my-app
```

## Setup
Open the browser and go to your configured URL for onePlace.
You will see the setup screen.

Enter you MySQL Connection Data and your desirec admin credentials.

After successfull setup, you will be forwarded to login page - congrats, your oneplace is working!
10 changes: 10 additions & 0 deletions module/Application/config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@
],
],
],
'update' => [
'type' => Literal::class,
'options' => [
'route' => '/update',
'defaults' => [
'controller' => Controller\IndexController::class,
'action' => 'update',
],
],
],
'application' => [
'type' => Segment::class,
'options' => [
Expand Down
8 changes: 7 additions & 1 deletion module/Application/data/data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,10 @@ INSERT INTO `settings` (`settings_key`, `settings_value`) VALUES
('noreply-from', 'YOURNAME'),
('noreply-port', '587'),
('noreply-pw', 'EMAILACCOUNTPASS'),
('noreply-server', 'SMTPHOSTNAME');
('noreply-server', 'SMTPHOSTNAME');

INSERT INTO `permission` (`permission_key`, `module`, `label`, `nav_label`, `nav_href`, `show_in_menu`) VALUES
('index', 'Application\\Controller\\IndexController', 'Home', 'Home', '/', 0),
('update', 'Application\\Controller\\IndexController', 'Updates', '', '', 0),
('addtheme', 'Application\\Controller\\IndexController', 'Upload Theme', '', '/application/addtheme', 0),
('themes', 'Application\\Controller\\IndexController', 'Theme Selection', '', '/application/themes', 0);
41 changes: 0 additions & 41 deletions module/Application/data/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -89,47 +89,6 @@ ALTER TABLE `core_form_field`
ALTER TABLE `core_form_field`
MODIFY `Field_ID` int(11) NOT NULL AUTO_INCREMENT;

--
-- Core Tag
--
CREATE TABLE `core_tag` (
`Tag_ID` int(11) NOT NULL,
`tag_key` varchar(50) NOT NULL,
`tag_label` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

INSERT INTO `core_tag` (`Tag_ID`, `tag_key`, `tag_label`) VALUES
(1, 'category', 'Category'),
(2, 'state', 'State');

ALTER TABLE `core_tag`
ADD PRIMARY KEY (`Tag_ID`),
ADD UNIQUE KEY `tag_key` (`tag_key`);

ALTER TABLE `core_tag`
MODIFY `Tag_ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- Core Entity Tag
--
CREATE TABLE `core_entity_tag` (
`Entitytag_ID` int(11) NOT NULL,
`entity_form_idfs` varchar(50) NOT NULL,
`tag_idfs` int(11) NOT NULL,
`tag_value` varchar(255) NOT NULL,
`parent_tag_idfs` int(11) NOT NULL DEFAULT 0,
`created_by` int(11) NOT NULL,
`created_date` datetime NOT NULL,
`modified_by` int(11) NOT NULL,
`modified_date` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

ALTER TABLE `core_entity_tag`
ADD PRIMARY KEY (`Entitytag_ID`);

ALTER TABLE `core_entity_tag`
MODIFY `Entitytag_ID` int(11) NOT NULL AUTO_INCREMENT;

--
-- Core Metric
--
Expand Down
67 changes: 67 additions & 0 deletions module/Application/src/Controller/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ public function setupAction() {
'permission'=>'index',
'module'=>'Application\Controller\IndexController',
]);
# Updates
$oUserPermTbl->insert([
'user_idfs'=>$iAdminUserID,
'permission'=>'updates',
'module'=>'Application\Controller\IndexController',
]);
# User Index
$oUserPermTbl->insert([
'user_idfs'=>$iAdminUserID,
Expand Down Expand Up @@ -346,4 +352,65 @@ public function addthemeAction() {
return $this->redirect()->toRoute('application',['action'=>'themes']);
}
}

public function updateAction() {
$oRequest = $this->getRequest();

if(!$oRequest->isPost()) {
$this->setThemeBasedLayout('application');

$aInfo = [
'install' => [],
'update' => [],
];

foreach(glob($_SERVER['DOCUMENT_ROOT'].'/../vendor/oneplace/*', GLOB_NOSORT) as $sModulePath) {
$sModule = basename($sModulePath);
$sModuleName = explode('-',$sModule)[1];

try {
$oBaseTbl = new TableGateway($sModuleName,$this->oDbAdapter);
$oBaseTbl->select();
} catch(\RuntimeException $e) {
$aInfo['install'][] = $sModuleName;
}
}

return new ViewModel([
'aInfo'=>$aInfo,
]);
} else {
$aInfo = [
'install' => [],
'update' => [],
];

foreach(glob($_SERVER['DOCUMENT_ROOT'].'/../vendor/oneplace/*', GLOB_NOSORT) as $sModulePath) {
$sModule = basename($sModulePath);
$sModuleName = explode('-',$sModule)[1];

try {
$oBaseTbl = new TableGateway($sModuleName,$this->oDbAdapter);
$oBaseTbl->select();
} catch(\RuntimeException $e) {
$aInfo['install'][] = $sModule;
}
}

$this->layout('layout/json');
foreach($aInfo['install'] as $sInstallMod) {
# Core DB Structure
$filename = $_SERVER['DOCUMENT_ROOT'] . '/../vendor/oneplace/'.$sInstallMod.'/data/install.sql';
echo 'update '.$sInstallMod;
if (file_exists($filename)) {
echo 'go';
$this->parseSQLInstallFile($filename, $this->oDbAdapter);
}
}

return false;

return $this->redirect()->toRoute('home');
}
}
}
12 changes: 6 additions & 6 deletions module/Application/view/application/index/index.phtml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<div class="jumbotron">
<h1>Welcome <?=$oUser->getLabel()?> to <span class="zf-green">Laminas MVC Skeleton Application</span></h1>
<h1>Welcome <?=$oUser->getLabel()?> to <span class="zf-green">onePlace Core</span></h1>
<p>
Congratulations! You have successfully installed the
<a href="https://github.com/laminas/laminas-mvc-skeleton" target="_blank">Laminas MVC Skeleton</a>.
This skeleton can serve as a simple starting point for you to begin
building your application on Laminas MVC.
Congratulations! You have successfully installed
<a href="https://github.com/laminas/laminas-mvc-skeleton" target="_blank">onePlace Core</a>.
This Application can serve as a simple starting point for you to begin
building your application on onePlace Framework.
</p>

<p><a class="btn btn-success btn-lg" href="https://github.com/laminas" target="_blank">Check Laminas on GitHub &raquo;</a></p>
<p><a class="btn btn-success btn-lg" href="https://github.com/oneplc/plc_x_core" target="_blank">Check onePlace on GitHub &raquo;</a></p>
</div>

<div class="row">
Expand Down
34 changes: 34 additions & 0 deletions module/Application/view/application/index/update.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

?>
<h1>Update</h1>
Modules that need db installation:
<ul class="list-group">
<?php
if(count($aInfo['install']) > 0) {
foreach($aInfo['install'] as $sModule) { ?>
<li class="list-group-item"><?=$sModule?></li>
<?php
}
}
?>
</ul>
<hr/>
Modules that need db upgrade:
<ul class="list-group">
<?php
if(count($aInfo['update']) > 0) {
foreach($aInfo['update'] as $sModule) { ?>
<li class="list-group-item"><?=$sModule?></li>
<?php
}
}
?>
</ul>

<form method="POST" action="">
<div class="form-row">
<!-- Submit -->
<button type="submit" class="btn btn-primary">Update</button>
</div>
</form>

0 comments on commit b9eef98

Please sign in to comment.