Skip to content

Commit

Permalink
Merge pull request #4 from joomdev/dev
Browse files Browse the repository at this point in the history
Performance Improvements + Live preview + Bug fixes
  • Loading branch information
hiteshaggarwal authored Aug 22, 2019
2 parents 3e5465e + bc533f2 commit d63c781
Show file tree
Hide file tree
Showing 125 changed files with 15,090 additions and 2,416 deletions.
5 changes: 2 additions & 3 deletions com_jdbuilder/administrator/controller.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?php

/**
* @version CVS: 1.0.0
* @package Com_Jdbuilder
* @package JD Builder
* @author Team Joomdev <[email protected]>
* @copyright 2019 Hitesh Aggarwal
* @copyright 2019 www.joomdev.com
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access
Expand Down
31 changes: 15 additions & 16 deletions com_jdbuilder/administrator/controllers/page.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<?php

/**
* @version CVS: 1.0.0
* @package Com_Jdbuilder
* @package JD Builder
* @author Team Joomdev <[email protected]>
* @copyright 2019 Hitesh Aggarwal
* @copyright 2019 www.joomdev.com
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

// No direct access
defined('_JEXEC') or die;

Expand All @@ -17,16 +16,16 @@
*
* @since 1.6
*/
class JdbuilderControllerPage extends JControllerForm
{
/**
* Constructor
*
* @throws Exception
*/
public function __construct()
{
$this->view_list = 'pages';
parent::__construct();
}
class JdbuilderControllerPage extends JControllerForm {

/**
* Constructor
*
* @throws Exception
*/
public function __construct() {
$this->view_list = 'pages';
parent::__construct();
}

}
170 changes: 81 additions & 89 deletions com_jdbuilder/administrator/controllers/pages.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<?php

/**
* @version CVS: 1.0.0
* @package Com_Jdbuilder
* @package JD Builder
* @author Team Joomdev <[email protected]>
* @copyright 2019 Hitesh Aggarwal
* @copyright 2019 www.joomdev.com
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

// No direct access.
defined('_JEXEC') or die;

Expand All @@ -19,89 +18,82 @@
*
* @since 1.6
*/
class JdbuilderControllerPages extends JControllerAdmin
{
/**
* Method to clone existing Pages
*
* @return void
*/
public function duplicate()
{
// Check for request forgeries
Jsession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));

// Get id(s)
$pks = $this->input->post->get('cid', array(), 'array');

try
{
if (empty($pks))
{
throw new Exception(JText::_('COM_JDBUILDER_NO_ELEMENT_SELECTED'));
}

ArrayHelper::toInteger($pks);
$model = $this->getModel();
$model->duplicate($pks);
$this->setMessage(Jtext::_('COM_JDBUILDER_ITEMS_SUCCESS_DUPLICATED'));
}
catch (Exception $e)
{
JFactory::getApplication()->enqueueMessage($e->getMessage(), 'warning');
}

$this->setRedirect('index.php?option=com_jdbuilder&view=pages');
}

/**
* Proxy for getModel.
*
* @param string $name Optional. Model name
* @param string $prefix Optional. Class prefix
* @param array $config Optional. Configuration array for model
*
* @return object The Model
*
* @since 1.6
*/
public function getModel($name = 'page', $prefix = 'JdbuilderModel', $config = array())
{
$model = parent::getModel($name, $prefix, array('ignore_request' => true));

return $model;
}

/**
* Method to save the submitted ordering values for records via AJAX.
*
* @return void
*
* @since 3.0
*/
public function saveOrderAjax()
{
// Get the input
$input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array');
$order = $input->post->get('order', array(), 'array');

// Sanitize the input
ArrayHelper::toInteger($pks);
ArrayHelper::toInteger($order);

// Get the model
$model = $this->getModel();

// Save the ordering
$return = $model->saveorder($pks, $order);

if ($return)
{
echo "1";
}

// Close the application
JFactory::getApplication()->close();
}
class JdbuilderControllerPages extends JControllerAdmin {

/**
* Method to clone existing Pages
*
* @return void
*/
public function duplicate() {
// Check for request forgeries
Jsession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));

// Get id(s)
$pks = $this->input->post->get('cid', array(), 'array');

try {
if (empty($pks)) {
throw new Exception(JText::_('COM_JDBUILDER_NO_ELEMENT_SELECTED'));
}

ArrayHelper::toInteger($pks);
$model = $this->getModel();
$model->duplicate($pks);
$this->setMessage(Jtext::_('COM_JDBUILDER_ITEMS_SUCCESS_DUPLICATED'));
} catch (Exception $e) {
JFactory::getApplication()->enqueueMessage($e->getMessage(), 'warning');
}

$this->setRedirect('index.php?option=com_jdbuilder&view=pages');
}

/**
* Proxy for getModel.
*
* @param string $name Optional. Model name
* @param string $prefix Optional. Class prefix
* @param array $config Optional. Configuration array for model
*
* @return object The Model
*
* @since 1.6
*/
public function getModel($name = 'page', $prefix = 'JdbuilderModel', $config = array()) {
$model = parent::getModel($name, $prefix, array('ignore_request' => true));

return $model;
}

/**
* Method to save the submitted ordering values for records via AJAX.
*
* @return void
*
* @since 3.0
*/
public function saveOrderAjax() {
// Get the input
$input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array');
$order = $input->post->get('order', array(), 'array');

// Sanitize the input
ArrayHelper::toInteger($pks);
ArrayHelper::toInteger($order);

// Get the model
$model = $this->getModel();

// Save the ordering
$return = $model->saveorder($pks, $order);

if ($return) {
echo "1";
}

// Close the application
JFactory::getApplication()->close();
}

}
5 changes: 2 additions & 3 deletions com_jdbuilder/administrator/helpers/jdbuilder.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?php

/**
* @version CVS: 1.0.0
* @package Com_Jdbuilder
* @package JD Builder
* @author Team Joomdev <[email protected]>
* @copyright 2019 Hitesh Aggarwal
* @copyright 2019 www.joomdev.com
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access
Expand Down
33 changes: 16 additions & 17 deletions com_jdbuilder/administrator/helpers/listhelper.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?php

/**
* @version CVS: 1.0.0
* @package Com_Jdbuilder
* @package JD Builder
* @author Team Joomdev <[email protected]>
* @copyright 2019 Hitesh Aggarwal
* @copyright 2019 www.joomdev.com
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access
Expand All @@ -15,20 +14,20 @@
*
* @since 1.6
*/
abstract class JHtmlListhelper
{
static function toggle($value = 0, $view, $field, $i)
{
$states = array(
0 => array('icon-remove', JText::_('Toggle'), 'inactive btn-danger'),
1 => array('icon-checkmark', JText::_('Toggle'), 'active btn-success')
);
abstract class JHtmlListhelper {

$state = \Joomla\Utilities\ArrayHelper::getValue($states, (int) $value, $states[0]);
$text = '<span aria-hidden="true" class="' . $state[0] . '"></span>';
$html = '<a href="#" class="btn btn-micro ' . $state[2] . '"';
$html .= 'onclick="return toggleField(\'cb'.$i.'\',\'' . $view . '.toggle\',\'' . $field . '\')" title="' . JText::_($state[1]) . '">' . $text . '</a>';
static function toggle($value = 0, $view, $field, $i) {
$states = array(
0 => array('icon-remove', JText::_('Toggle'), 'inactive btn-danger'),
1 => array('icon-checkmark', JText::_('Toggle'), 'active btn-success')
);

$state = \Joomla\Utilities\ArrayHelper::getValue($states, (int) $value, $states[0]);
$text = '<span aria-hidden="true" class="' . $state[0] . '"></span>';
$html = '<a href="#" class="btn btn-micro ' . $state[2] . '"';
$html .= 'onclick="return toggleField(\'cb' . $i . '\',\'' . $view . '.toggle\',\'' . $field . '\')" title="' . JText::_($state[1]) . '">' . $text . '</a>';

return $html;
}

return $html;
}
}
12 changes: 5 additions & 7 deletions com_jdbuilder/administrator/jdbuilder.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
<?php

/**
* @version CVS: 1.0.0
* @package Com_Jdbuilder
* @package JD Builder
* @author Team Joomdev <[email protected]>
* @copyright 2019 Hitesh Aggarwal
* @copyright 2019 www.joomdev.com
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

// No direct access
defined('_JEXEC') or die;

// Access check.
if (!JFactory::getUser()->authorise('core.manage', 'com_jdbuilder'))
{
throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'));
if (!JFactory::getUser()->authorise('core.manage', 'com_jdbuilder')) {
throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'));
}

// Include dependancies
Expand Down
Loading

0 comments on commit d63c781

Please sign in to comment.