Skip to content

Commit

Permalink
preparing for next release
Browse files Browse the repository at this point in the history
  • Loading branch information
Praesidiarius committed Feb 11, 2020
1 parent d3e3940 commit 2046d2d
Show file tree
Hide file tree
Showing 6 changed files with 336 additions and 117 deletions.
37 changes: 35 additions & 2 deletions module/Application/config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
'options' => [
'route' => '/filepond',
'defaults' => [
'controller' => Controller\IndexController::class,
'controller' => Controller\UploadController::class,
'action' => 'filepond',
],
],
Expand All @@ -49,11 +49,44 @@
'options' => [
'route' => '/uppy',
'defaults' => [
'controller' => Controller\IndexController::class,
'controller' => Controller\UploadController::class,
'action' => 'uppy',
],
],
],
'uppy-togglepub' => [
'type' => Literal::class,
'options' => [
'route' => '/uppy/togglemediapub[/:id]',
'constraints' => [
'id' => '[0-9]+',
],
'defaults' => [
'controller' => Controller\UploadController::class,
'action' => 'togglemediapub',
],
],
],
'uppy-updatesort' => [
'type' => Literal::class,
'options' => [
'route' => '/uppy/updatesort',
'defaults' => [
'controller' => Controller\UploadController::class,
'action' => 'updateuppysort',
],
],
],
'add-theme' => [
'type' => Literal::class,
'options' => [
'route' => '/themes/add',
'defaults' => [
'controller' => Controller\UploadController::class,
'action' => 'addtheme',
],
],
],
'setup' => [
'type' => Literal::class,
'options' => [
Expand Down
10 changes: 5 additions & 5 deletions module/Application/data/data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ INSERT INTO `settings` (`settings_key`, `settings_value`) VALUES
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),
('addtheme', 'Application\\Controller\\UploadController', 'Upload Theme', '', '/application/addtheme', 0),
('themes', 'Application\\Controller\\IndexController', 'Theme Selection', '', '/application/themes', 0),
('filepond', 'Application\\Controller\\IndexController', 'Upload Featured Image', '', '', 0),
('uppy', 'Application\\Controller\\IndexController', 'Gallery Upload', '', '', 0),
('togglemediapub', 'Application\\Controller\\IndexController', 'Gallery Upload', '', '', 0),
('updateuppysort', 'Application\\Controller\\IndexController', 'Gallery Upload', '', '', 0),
('filepond', 'Application\\Controller\\UploadController', 'Upload Featured Image', '', '', 0),
('uppy', 'Application\\Controller\\UploadController', 'Gallery Upload', '', '', 0),
('togglemediapub', 'Application\\Controller\\UploadController', 'Gallery Upload', '', '', 0),
('updateuppysort', 'Application\\Controller\\UploadController', 'Gallery Upload', '', '', 0),
('quicksearch', 'Application\\Controller\\IndexController', 'Quick Search', '', '', 0),
('updatefieldsort', 'Application\\Controller\\IndexController', 'Update Form Field Sorting', '', '', 0),
('selectbool', 'Application\\Controller\\IndexController', 'Select Yes/No', '', '', 0);
Expand Down
107 changes: 0 additions & 107 deletions module/Application/src/Controller/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,113 +338,6 @@ public function filepondAction() {
}
}

/**
* Server Side for UPPY Fileupload
*
* @return bool
* @since 1.0.7
*/
public function uppyAction() {
$this->layout('layout/json');

$iEntityID = (int)$_REQUEST['entity_id'];
$sEntityType = $_REQUEST['entity_type'];
$sPath = '';
$oEntityTbl = false;

switch($sEntityType) {
default:
$oForm = CoreController::$aCoreTables['core-form']->select(['form_key'=>$sEntityType.'-single']);
if(count($oForm) > 0) {
$oForm = $oForm->current();
$oEntityTbl = CoreController::$oServiceManager->get($oForm->entity_tbl_class);
$oEntity = $oEntityTbl->getSingle($iEntityID);
if($oEntity) {
$sPath = $_SERVER['DOCUMENT_ROOT'].'/data/'.$sEntityType.'/'.$oEntity->getID().'/';
}
if(!is_dir($sPath)) {
mkdir($sPath);
}
}
$aFile = $_FILES['files'];
if(move_uploaded_file($aFile['tmp_name'][0],$sPath.'/'.trim($aFile['name'][0]))) {
if(isset($oForm)) {
CoreController::$aCoreTables['core-gallery-media']->insert([
'filename'=>trim($aFile['name'][0]),
'entity_idfs'=>$iEntityID,
'entity_type'=>$sEntityType,
'is_public'=>0,
'created_by'=>CoreController::$oSession->oUser->getID(),
'created_date'=>date('Y-m-d H:i:s',time()),
'modified_by'=>CoreController::$oSession->oUser->getID(),
'modified_date'=>date('Y-m-d H:i:s',time()),
'sort_id'=>0,
]);
}
}
break;
}

return false;
}

/**
* Sorting for uppy galleries
*
* @return bool no viewfile. echo json
* @since 1.0.12
*/
public function updateuppysortAction() {
$this->layout('layout/json');


$oRequest = $this->getRequest();
$aImagesToSort = $oRequest->getPost('images');

$oGalleryTbl = CoreController::$aCoreTables['core-gallery-media'];

$iSortID = 0;
# Loop over all columns provided
foreach($aImagesToSort as $sImgInfo) {
$iMediaID = substr($sImgInfo,strlen('gallery-media-'));
$oGalleryTbl->update(['sort_id'=>$iSortID],'Media_ID = '.$iMediaID);
$iSortID++;
}

$aReturn = ['state'=>'success','message'=>'gallery successfully updated'];

echo json_encode($aReturn);

return false;
}

/**
* Toggle Media Public Status
*
* @return \Laminas\Http\Response
* @since 1.0.12
*/
public function togglemediapubAction() {
$this->layout('layout/json');

$iMediaID = $this->params()->fromRoute('id',0);

if($iMediaID != 0) {
$oGalleryTbl = CoreController::$aCoreTables['core-gallery-media'];
$oMedia = $oGalleryTbl->select(['Media_ID'=>$iMediaID]);
if(count($oMedia) > 0) {
$oMedia = $oMedia->current();
$bPublic = ($oMedia->is_public == 1) ? 0 : 1;
$oGalleryTbl->update(['is_public'=>$bPublic],'Media_ID = '.$iMediaID);

return $this->redirect()->toRoute($oMedia->entity_type,['action'=>'view','id'=>$oMedia->entity_idfs]);

}
}

return $this->redirect()->toRoute('home');
}

/**
* Quicksearch across all registered entities
*
Expand Down
Loading

0 comments on commit 2046d2d

Please sign in to comment.