-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update code to use auto loaded joomla resources and components update view to be joomla 4 compatible update datatables js Library remove old jquery Library
- Loading branch information
1 parent
9c7221d
commit 9ab5fd7
Showing
38 changed files
with
1,064 additions
and
1,066 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# SuiteCRM-Portal-Joomla 2.0.3 | ||
# SuiteCRM-Portal-Joomla 3.0.0-beta | ||
Joomla Plugin for the SuiteCRM Portal | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,70 @@ | ||
<?php | ||
// No direct access to this file | ||
defined('_JEXEC') or die('Restricted access'); | ||
|
||
// import Joomla controller library | ||
jimport('joomla.application.component.controller'); | ||
include_once 'components/com_advancedopenportal/models/advancedopenportals.php'; | ||
|
||
use Joomla\CMS\Language\Text; | ||
use Joomla\CMS\MVC\Controller\AdminController; | ||
use Joomla\CMS\MVC\Factory\MVCFactoryInterface; | ||
|
||
include_once 'components/com_advancedopenportal/models/AdvancedOpenPortalModel.php'; | ||
|
||
/** | ||
* General Controller of Advanced OpenPortal component | ||
*/ | ||
class AdvancedOpenPortalController extends JControllerLegacy | ||
class AdvancedOpenPortalController extends AdminController | ||
{ | ||
/** | ||
* display task | ||
* | ||
* @return void | ||
*/ | ||
function display($cachable = false) | ||
{ | ||
if(array_key_exists('submit',$_REQUEST)){ | ||
$url = $_REQUEST['sugar_url']; | ||
$user = $_REQUEST['sugar_user']; | ||
$pass = $_REQUEST['sugar_pass']; | ||
$reopen = !empty($_REQUEST['allow_case_reopen']); | ||
$close = !empty($_REQUEST['allow_case_closing']); | ||
$priority = !empty($_REQUEST['allow_priority']); | ||
$type = !empty($_REQUEST['allow_type']); | ||
AdvancedOpenPortalModelAdvancedOpenPortals::storeSettings($url,$user,$pass, $reopen, $close, $priority, $type); | ||
JFactory::getApplication()->enqueueMessage(JText::_('COM_ADVANCEDOPENPORTAL_SETTINGS_SAVED')); | ||
|
||
} | ||
/** | ||
* @throws Exception | ||
*/ | ||
public function __construct($config = [], MVCFactoryInterface $factory = null, $app = null, $input = null) | ||
{ | ||
$this->name = 'AdvancedOpenPortals'; | ||
$this->model_prefix = 'AdvancedOpenPortalModel'; | ||
|
||
parent::__construct($config, $factory, $app, $input); | ||
} | ||
|
||
|
||
/** | ||
* display task | ||
* | ||
* @return void | ||
* @throws Exception | ||
*/ | ||
public function display($cachable = false, $urlparams = []): void | ||
{ | ||
// set default view if not set | ||
JRequest::setVar('view', JRequest::getCmd('view', 'AdvancedOpenPortals')); | ||
|
||
// call parent behavior | ||
parent::display($cachable); | ||
} | ||
} | ||
$this->input->set('view', $this->app->input->getCmd('view', 'AdvancedOpenPortals')); | ||
|
||
// call parent behavior | ||
parent::display($cachable, $urlparams); | ||
} | ||
|
||
/** | ||
* @throws Exception | ||
*/ | ||
public function save() | ||
{ | ||
// Check for request forgeries. | ||
$this->checkToken(); | ||
|
||
$url = $this->input->get('sugar_url', '', 'trim'); | ||
$user = $this->input->get('sugar_user', '','trim'); | ||
$pass = $this->input->get('sugar_pass', '', 'trim'); | ||
$reopen = $this->input->get('allow_case_reopen', false, 'bool'); | ||
$close = $this->input->get('allow_case_closing', false, 'bool'); | ||
$priority = $this->input->get('allow_priority', false, 'bool'); | ||
$type = $this->input->get('allow_type', false, 'bool'); | ||
|
||
/** @var AdvancedOpenPortalModelAdvancedOpenPortals $model */ | ||
$model = $this->getModel(); | ||
|
||
if ($model->storeSettings($url, $user, $pass, $reopen, $close, $priority, $type)) { | ||
$this->app->enqueueMessage(Text::_('COM_ADVANCEDOPENPORTAL_SETTINGS_SAVED')); | ||
} | ||
|
||
$this->display(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
COM_ADVANCEDOPENPORTAL="Advanced OpenPortal" | ||
COM_ADVANCEDOPENPORTAL_MANAGER_ADVANCEDOPENPORTALS="Advanced OpenPortal Settings" | ||
COM_ADVANCEDOPENPORTAL="SuiteCRM Portal" | ||
COM_ADVANCEDOPENPORTAL_MANAGER_ADVANCEDOPENPORTALS="SuiteCRM Portal Settings" | ||
COM_ADVANCEDOPENPORTAL_SETTINGS_SAVED='Settings saved' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<?php | ||
// No direct access to this file | ||
defined('_JEXEC') or die('Restricted access'); | ||
|
||
use Joomla\CMS\Factory; | ||
use Joomla\CMS\Language\Text; | ||
use Joomla\CMS\MVC\Model\AdminModel; | ||
|
||
/** | ||
* AdvancedOpenPortalList Model | ||
*/ | ||
class AdvancedOpenPortalModelAdvancedOpenPortals extends AdminModel | ||
{ | ||
|
||
public function storeSettings($url, $user, $pass, $reopen, $close, $priority, $type): bool | ||
{ | ||
$db = Factory::getDbo(); | ||
|
||
$ob = new stdClass(); | ||
$ob->id = 1; | ||
$ob->sugar_url = $url; | ||
$ob->sugar_user = $user; | ||
$ob->allow_case_reopen = $reopen ? 1 : 0; | ||
$ob->allow_case_closing = $close ? 1 : 0; | ||
$ob->allow_priority = $priority ? 1 : 0; | ||
$ob->allow_type = $type ? 1 : 0; | ||
if (!empty($pass)) { | ||
$ob->sugar_pass = md5($pass); | ||
} | ||
|
||
try { | ||
$db->updateObject('#__advancedopenportal', $ob, 'id'); | ||
if ($db->getAffectedRows() === 0) { | ||
$db->insertObject('#__advancedopenportal', $ob); | ||
} | ||
} catch (Exception $e) { | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
/** | ||
* Method to build an SQL query to load the list data. | ||
* | ||
* @return string An SQL query | ||
*/ | ||
protected function getListQuery() | ||
{ | ||
// Create a new query object. | ||
$db = Factory::getDbo(); | ||
$query = $db->getQuery(true); | ||
// Select some fields | ||
$query->select('*'); | ||
// From the hello table | ||
$query->from('#__advancedopenportal'); | ||
return $query; | ||
} | ||
|
||
public function getItems() | ||
{ | ||
$db = Factory::getDbo(); | ||
$query = $this->getListQuery(); | ||
try { | ||
$result = $db->setQuery($query)->loadObjectList(); | ||
} catch (Exception $e) { | ||
echo Text::sprintf('JLIB_DATABASE_ERROR_FUNCTION_FAILED', $e->getCode(), $e->getMessage()) . '<br>'; | ||
|
||
return []; | ||
} | ||
|
||
return $result; | ||
} | ||
|
||
public function getForm($data = [], $loadData = true) | ||
{ | ||
// Get the form. | ||
$form = $this->loadForm('com_advancedopenportal.source', 'source', | ||
['control' => 'jform', 'load_data' => $loadData]); | ||
|
||
if (empty($form)) { | ||
return false; | ||
} | ||
|
||
return $form; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.