Moving the Features folder again in order to ensure compatibility with the namespaces convention

This commit is contained in:
Gustavo Cruz
2015-02-24 18:14:41 -04:00
parent c7a7736edf
commit 077033adca
78 changed files with 330 additions and 265 deletions

View File

@@ -334,7 +334,7 @@ class WebApplication
}
// adding features extension api classes
$featuresPath = $this->workflowDir .'engine' . DS . 'features';
$featuresPath = $this->workflowDir .'engine' . DS . 'Features';
// $apiDir - contains directory to scan classes and add them to Restler
$featureDirList = glob($featuresPath . "/*", GLOB_ONLYDIR);
foreach ($featureDirList as $directory) {
@@ -430,7 +430,7 @@ class WebApplication
define("PATH_XMLFORM", PATH_CORE . "xmlform" . PATH_SEP);
define("PATH_CONFIG", PATH_CORE . "config" . PATH_SEP);
define("PATH_PLUGINS", PATH_CORE . "plugins" . PATH_SEP);
define("PATH_FEATURES", PATH_CORE . "features" . PATH_SEP);
define("PATH_FEATURES", PATH_CORE . "Features" . PATH_SEP);
define("PATH_HTMLMAIL", PATH_CORE . "html_templates" . PATH_SEP);
define("PATH_TPL", PATH_CORE . "templates" . PATH_SEP);
define("PATH_TEST", PATH_CORE . "test" . PATH_SEP);

View File

@@ -50,7 +50,7 @@
define( 'PATH_METHODS', PATH_CORE . 'methods' . PATH_SEP );
define( 'PATH_XMLFORM', PATH_CORE . 'xmlform' . PATH_SEP );
define( 'PATH_PLUGINS', PATH_CORE . 'plugins' . PATH_SEP );
define( 'PATH_FEATURES', PATH_CORE . 'features' . PATH_SEP );
define( 'PATH_FEATURES', PATH_CORE . 'Features' . PATH_SEP );
define( 'PATH_HTMLMAIL', PATH_CORE . 'html_templates' . PATH_SEP );
define( 'PATH_TPL', PATH_CORE . 'templates' . PATH_SEP );
define( 'PATH_TEST', PATH_CORE . 'test' . PATH_SEP );

View File

@@ -1,5 +1,6 @@
<?php
namespace Features;
/**
* Description of ActionsByEmailFeature
*

View File

@@ -1,5 +1,5 @@
<?php
namespace ProcessMaker\Services\Api;
namespace Features\ActionsByEmail\Services;
use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
@@ -13,12 +13,12 @@ require_once 'classes/model/Application.php';
require_once 'classes/model/Users.php';
/**
* Class ActionsByEmail
* Class ActionsByEmailApi
*
* @author gustavo cruz <gustavo.cruz@colosa.com>
* @protected
*/
class ActionsByEmail extends Api
class ActionsByEmailApi extends Api
{
/**
@@ -203,6 +203,7 @@ class ActionsByEmail extends Api
throw $error;
}
}
return $response;
}
/**
@@ -318,6 +319,7 @@ class ActionsByEmail extends Api
$response = array();
$response['totalCount'] = $totalCount;
$response['data'] = $data;
return $response;
}
/**
@@ -431,8 +433,7 @@ class ActionsByEmail extends Api
$message = 'An unexpected error occurred please try again later.';
}
print_r($message);
die;
return $message;
}
/**
@@ -512,9 +513,7 @@ class ActionsByEmail extends Api
}
}
}
print_r($message);
die;
return $message;
}
}

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 93 KiB

View File

Before

Width:  |  Height:  |  Size: 211 KiB

After

Width:  |  Height:  |  Size: 211 KiB

View File

@@ -0,0 +1,220 @@
<?php
/**
* Description of ActivityViews
*
*/
class ActivityConfigurationView
{
public function retrieveView()
{
$view = array(
'type' => 'form',
'language' => 'en',
'title' => 'Actions by email configuration',
'layouts' => array(),
'fields' => array(
array(
'name' => 'IFORM',
'type' => 'hidden'
),
array(
'name' => 'INDEX',
'type' => 'hidden'
),
array(
'name' => 'ABE_UID',
'type' => 'hidden'
),
array(
'name' => 'PRO_UID',
'type' => 'hidden'
),
array(
'name' => 'PRJ_UID',
'type' => 'hidden'
),
array(
'name' => 'TAS_UID',
'type' => 'hidden'
),
array(
'name' => 'SYS_LANG',
'type' => 'hidden'
),
array(
'name' => 'ABE_EMAIL_FIELD_VALUE',
'type' => 'hidden'
),
array(
'name' => 'ABE_ACTION_FIELD_VALUE',
'type' => 'hidden'
),
array(
'name' => 'ABE_TYPE',
'label' => 'Type',
'type' => 'dropdown',
'options' => array(
array(
'name' => '',
'value' => '',
'text' => '- None -',
'type' => 'default'
),
array(
'name' => 'LINK',
'value' => 'LINK',
'text' => 'Link to fill a form',
),
array(
'name' => 'FIELD',
'value' => 'FIELD',
'text' => 'Use a field to generate actions links',
)
)
),
array(
'name' => 'ABE_TEMPLATE',
'label' => 'Template',
'type' => 'dropdown',
'data_source' => array(
'type' => 'REST',
'method' => 'GET',
'end_point' => '/ActionsByEmail/Templates',
'parameters' => array()
),
'options' => array(
array(
'name' => '',
'value' => '',
'text' => '- Select a Template -',
'type' => 'default'
)
)
),
array(
'name' => 'EDIT',
'type' => 'link',
'value' => 'Edit',
'action' => array(
'type' => 'view-render',
'data_source' => array(
'type' => 'REST',
'method' => 'GET',
'end_point' => '/ActionsByEmail/Templates/editTemplate',
'parameters' => array('ABE_TEMPLATE')
)
)
),
array(
'name' => 'DYN_UID',
'label' => 'Dynaform',
'value' => 'DYN_UID',
'type' => 'dropdown',
'data_source' => array(
'type' => 'REST',
'method' => 'GET',
'end_point' => '/project/{prj_uid}/dynaforms',
'parameters' => array()
),
'options' => array(
array(
'name' => '',
'value' => '',
'text' => '- Select a Dynaform -',
'type' => 'default'
)
),
'events' => array(
'change' => array(
'listeners' => array('email-field', 'action-field')
)
),
),
array(
'name' => 'ABE_EMAIL_FIELD',
'value' => 'ABE_EMAIL_FIELD',
'label' => 'Field with the email',
'type' => 'dropdown',
'options' => array(
array(
'name' => '',
'value' => '',
'text' => '- Send to the email of the assigned user to the task -',
'type' => 'default'
)
),
'listeners' => array(
array(
'name' => 'email-field',
'action' => array(
'type' => 'field-render',
'data_source' => array(
'type' => 'REST',
'method' => 'GET',
'end_point' => '/project/{prj_uid}/dynaform/{dyn_uid}/fields',
'parameters' => array()
)
)
)
)
),
array(
'name' => 'ABE_ACTION_FIELD',
'value' => 'ABE_ACTION_FIELD',
'label' => 'Field to Send in the Email',
'type' => 'dropdown',
'options' => array(
array(
'name' => '',
'value' => '',
'text' => '- Select a Field -',
'type' => 'default'
)
),
'listeners' => array(
'name' => 'action-field',
'action' => array(
'type' => 'field-render',
'data_source' => array(
'type' => 'REST',
'method' => 'GET',
'end_point' => '/project/:prj_uid/dynaform/:dyn_uid/fields',
'parameters' => array()
)
)
)
),
array(
'name' => 'ABE_CASE_NOTE_IN_RESPONSE',
'value' => true,
'default' => false,
'label' => 'Register a Case Note when the recipient submits the Response',
'type' => 'checkbox'
),
array(
'name' => 'APPLY_CHANGES',
'type' => 'button',
'label' => 'Apply Changes',
'value' => 'APPLY_CHANGES',
'action' => array(
'type' => 'view-close',
'data_source' => array(
'type' => 'REST',
'method' => 'POST',
'end_point' => '/ActionsByEmail/saveConfiguration',
'parameters' => array('_ALL')
)
)
),
array(
'name' => 'REQUIRED_LABEL',
'type' => 'label',
'label' => 'Required Field',
'value' => 'REQUIRED_LABEL'
)
)
);
return $view;
}
}

View File

@@ -0,0 +1,36 @@
<?php
namespace Features;
/**
* Description of ConfigurationManager
*
*/
class ConfigurationHandler
{
public function retrieveFeatureConfiguration($feature)
{
$configuration = new stdClass();
$configuration->views = $this->retrieveViews($feature);
}
public function retrieveViews($feature, $type = 'configuration')
{
require_once $feature->path . PATH_SEPARATOR . $feature->name;
}
public function getViewList($feature)
{
$forbiddenFolders = array();
$views = glob($feature->path.'/*', GLOB_ONLYDIR);
$viewFiles = array();
foreach ($views as $directory) {
$feature = new stdClass();
if (in_array($directory, $forbiddenFolders)) {
continue;
}
$feature->path = PATH_FEATURES . PATH_SEP . $directory;
$feature->name = $directory;
$viewFiles[] = $feature;
}
return $viewFiles;
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace Features;
use Features\ActionsByEmail\views\ActivityConfigurationView;
/**
* Description of FeaturesService
*
*/
class FeatureServices
{
public function retrieveView($params)
{
$viewsFolder = 'views';
$className = ucfirst($params['type']) . ucfirst($params['view']) . 'View';
require_once $viewsFolder.DS.$className.'.php';
$view = new $className();
return $view->retrieveView();
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace Features;
/**
* Description of FeatureManager
*
*/
class FeaturesHandler
{
public function retrieveConfigurations($params)
{
foreach ($this->getFeatureList() as $feature) {
}
}
public function getFeatureList()
{
$invalidFolders = array('ViewContainers');
$featuresFolders = glob(PATH_FEATURES.'/*', GLOB_ONLYDIR);
$features = array();
foreach ($featuresFolders as $directory) {
$feature = new stdClass();
if (in_array($directory, $invalidFolders)) {
continue;
}
$feature->path = PATH_FEATURES . PATH_SEP . $directory;
$feature->name = $directory;
$features[] = $feature;
}
return $features;
}
}

View File

@@ -4,7 +4,7 @@ namespace Features\ViewContainers;
* Description of TaskContainer
*
*/
class TaskContainer extends ViewContainer
class ActivityContainer extends ViewContainer
{
}

View File

@@ -1,211 +0,0 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
$features['ActionsByEmail']['views'][] = array(
'taskConfiguration' => array(
'type' => 'form',
'language' => 'en',
'layouts' => array(),
'fields' => array(
array(
'name' => 'IFORM',
'type' => 'hidden'
),
array(
'name' => 'INDEX',
'type' => 'hidden'
),
array(
'name' => 'ABE_UID',
'type' => 'hidden'
),
array(
'name' => 'PRO_UID',
'type' => 'hidden'
),
array(
'name' => 'TAS_UID',
'type' => 'hidden'
),
array(
'name' => 'SYS_LANG',
'type' => 'hidden'
),
array(
'name' => 'ABE_EMAIL_FIELD_VALUE',
'type' => 'hidden'
),
array(
'name' => 'ABE_ACTION_FIELD_VALUE',
'type' => 'hidden'
),
array(
'name' => 'ABE_TYPE',
'label' => 'Type',
'type' => 'dropdown',
'options' => array(
array(
'name' => '',
'value' => '',
'text' => '- None -',
'type' => 'default'
),
array(
'name' => 'LINK',
'value' => 'LINK',
'text' => 'Link to fill a form',
),
array(
'name' => 'FIELD',
'value' => 'FIELD',
'text' => 'Use a field to generate actions links',
)
)
),
array(
'name' => 'ABE_TEMPLATE',
'label' => 'Template',
'type' => 'dropdown',
'data_source' => array(
'type' => 'REST',
'method' => 'GET',
'end_point' => '/ActionsByEmail/Templates',
'parameters' => array()
),
'options' => array(
array(
'name' => '',
'value' => '',
'text' => '- Select a Template -',
'type' => 'default'
)
)
),
array(
'name' => 'EDIT',
'type' => 'link',
'value' => 'Edit',
'action' => array (
'type' => 'view-render',
'data_source' => array(
'type' => 'REST',
'method' => 'GET',
'end_point' => '/ActionsByEmail/Templates/editTemplate',
'parameters' => array('ABE_TEMPLATE')
)
)
),
array(
'name' => 'DYN_UID',
'value' => 'DYN_UID',
'type' => 'dropdown',
'data_source' => array(
'type' => 'REST',
'method' => 'GET',
'end_point' => 'Dynaform',
'parameters' => array()
),
'options' => array(
array(
'name' => '',
'value' => '',
'text' => '- Select a Dynaform -',
'type' => 'default'
)
),
'events' => array(
'change' => array(
'listeners' => array('email-field', 'action-field')
)
),
),
array(
'name' => 'ABE_EMAIL_FIELD',
'value' => 'ABE_EMAIL_FIELD',
'label' => 'Field with the email',
'type' => 'dropdown',
'options' => array(
array(
'name' => '',
'value' => '',
'text' => '- Send to the email of the assigned user to the task -',
'type' => 'default'
)
),
'listeners' => array (
array (
'name' => 'email-field',
'action' => array (
'type' => 'field-render',
'data_source' => array (
'type' => 'REST',
'method' => 'GET',
'end_point' => '/ActionsByEmail/Dynaform/loadFields',
'parameters' => array('DYN_UID')
)
)
)
)
),
array(
'name' => 'ABE_ACTION_FIELD',
'value' => 'ABE_ACTION_FIELD',
'label' => 'Field to Send in the Email',
'type' => 'dropdown',
'options' => array(
array(
'name' => '',
'value' => '',
'text' => '- Select a Field -',
'type' => 'default'
)
),
'listeners' => array(
'name' => 'action-field',
'action' => array(
'type' => 'field-render',
'data_source' => array(
'type' => 'REST',
'method' => 'GET',
'end_point' => '/ActionsByEmail/Dynaform/loadFields',
'parameters' => array('DYN_UID')
)
)
)
),
array(
'name' => 'ABE_CASE_NOTE_IN_RESPONSE',
'value' => true,
'default' => false,
'label' => 'Register a Case Note when the recipient submits the Response',
'type' => 'checkbox'
),
array(
'name' => 'APPLY_CHANGES',
'type' => 'button',
'label' => 'Apply Changes',
'value' => 'APPLY_CHANGES',
'action' => array (
'type' => 'view-close',
'data_source' => array(
'type' => 'REST',
'method' => 'POST',
'end_point' => '/ActionsByEmail/saveConfiguration',
'parameters' => array('_ALL')
)
)
),
array(
'name' => 'REQUIRED_LABEL',
'type' => 'label',
'label' => 'Required Field',
'value' => 'REQUIRED_LABEL'
)
)
)
);

View File

@@ -1,10 +0,0 @@
<?php
/**
* Description of ConfigurationManager
*
*/
class ConfigurationHandler
{
//put your code here
}

View File

@@ -1,10 +0,0 @@
<?php
/**
* Description of FeatureManager
*
*/
class FeatureHandler
{
//put your code here
}

View File

@@ -74,7 +74,14 @@ class Activity extends Api
public function doGetProjectActivityFeatureConfiguration($prj_uid, $act_uid, $filter = '')
{
try {
return array('status' => 200, 'message' => 'success');
$featureServices = new \Features\FeatureServices();
$configuration = $featureServices->retrieveView(array(
'type' => 'activity',
'view' => 'configuration',
'prj_uid' => $prj_uid,
'act_uid' => $act_uid
));
return $configuration;
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}

View File

@@ -31,25 +31,6 @@ class DynaForm extends Api
}
}
/**
* @url GET /:prj_uid/dynaform
*
* @param string $prj_uid {@min 32}{@max 32}
*/
public function doGetDynaFormList($prj_uid)
{
try {
$dynaForm = new \ProcessMaker\BusinessModel\DynaForm();
$dynaForm->setFormatFieldNameInUppercase(false);
$response = $dynaForm->getDynaForm();
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url POST /:prj_uid/dynaform
*

View File

@@ -29,10 +29,10 @@ try {
}
}
$loader->add($rootDir . 'workflow/engine/', 'Features');
$loader->add($rootDir . 'workflow/engine/src/', "ProcessMaker");
//$loader->add($rootDir . "workflow/engine/classes/model/");
$loader->add($rootDir . 'workflow/engine/src/');
// add vendors to autoloader
$loader->add($rootDir . 'vendor/luracast/restler/vendor', "Luracast");
$loader->add($rootDir . 'vendor/bshaffer/oauth2-server-php/src/', "OAuth2");