update to version 1.0.2

This commit is contained in:
Llewellyn van der Merwe 2018-12-27 13:06:27 +02:00
parent e683b47eb8
commit aa78275365
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
134 changed files with 3200 additions and 2440 deletions

View File

@ -12,14 +12,14 @@ Just a basic Questions & Answers.
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Questions and Answers](https://www.vdm.io/) + *Name*: [Questions and Answers](https://www.vdm.io/)
+ *First Build*: 30th January, 2017 + *First Build*: 30th January, 2017
+ *Last Build*: 5th May, 2018 + *Last Build*: 27th December, 2018
+ *Version*: 1.0.x + *Version*: 1.0.x
+ *Copyright*: Copyright (C) 2015. All Rights Reserved + *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
# Component Number # Component Number
+ *Line count*: **28377** + *Line count*: **29049**
+ *File count*: **201** + *File count*: **201**
+ *Folder count*: **62** + *Folder count*: **62**

View File

@ -12,14 +12,14 @@ Just a basic Questions & Answers.
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Questions and Answers](https://www.vdm.io/) + *Name*: [Questions and Answers](https://www.vdm.io/)
+ *First Build*: 30th January, 2017 + *First Build*: 30th January, 2017
+ *Last Build*: 5th May, 2018 + *Last Build*: 27th December, 2018
+ *Version*: 1.0.x + *Version*: 1.0.x
+ *Copyright*: Copyright (C) 2015. All Rights Reserved + *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
# Component Number # Component Number
+ *Line count*: **28377** + *Line count*: **29049**
+ *File count*: **201** + *File count*: **201**
+ *Folder count*: **62** + *Folder count*: **62**

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage admin.css @subpackage admin.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage dashboard.css @subpackage dashboard.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage help_document.css @subpackage help_document.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage help_documents.css @subpackage help_documents.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage question_and_answer.css @subpackage question_and_answer.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage questions_and_answers.css @subpackage questions_and_answers.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage admin.js @subpackage admin.js

View File

@ -141,7 +141,8 @@
description="COM_QUESTIONSANSWERS_CONFIG_DOCUMENT_FORMATS_DESCRIPTION" description="COM_QUESTIONSANSWERS_CONFIG_DOCUMENT_FORMATS_DESCRIPTION"
class="list_class" class="list_class"
multiple="true" multiple="true"
filter="ARRAY"> filter="ARRAY"
default="">
<!-- Option Set. --> <!-- Option Set. -->
<option value="doc"> <option value="doc">
COM_QUESTIONSANSWERS_CONFIG_DOC</option> COM_QUESTIONSANSWERS_CONFIG_DOC</option>
@ -180,7 +181,8 @@
description="COM_QUESTIONSANSWERS_CONFIG_IMAGE_FORMATS_DESCRIPTION" description="COM_QUESTIONSANSWERS_CONFIG_IMAGE_FORMATS_DESCRIPTION"
class="list_class" class="list_class"
multiple="true" multiple="true"
filter="ARRAY"> filter="ARRAY"
default="">
<!-- Option Set. --> <!-- Option Set. -->
<option value="jpg"> <option value="jpg">
COM_QUESTIONSANSWERS_CONFIG_JPG</option> COM_QUESTIONSANSWERS_CONFIG_JPG</option>

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage controller.php @subpackage controller.php
@ -26,9 +26,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controller library
jimport('joomla.application.component.controller');
/** /**
* General Controller of Questionsanswers component * General Controller of Questionsanswers component
*/ */

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage ajax.json.php @subpackage ajax.json.php
@ -26,9 +26,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controller');
/** /**
* Questionsanswers Ajax Controller * Questionsanswers Ajax Controller
*/ */

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage download.php @subpackage download.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage help.php @subpackage help.php
@ -26,9 +26,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controller');
/** /**
* Questionsanswers Help Controller * Questionsanswers Help Controller
*/ */

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage help_document.php @subpackage help_document.php
@ -26,9 +26,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controllerform');
/** /**
* Help_document Controller * Help_document Controller
*/ */
@ -43,6 +40,13 @@ class QuestionsanswersControllerHelp_document extends JControllerForm
*/ */
protected $task; protected $task;
/**
* Class constructor.
*
* @param array $config A named array of configuration variables.
*
* @since 1.6
*/
public function __construct($config = array()) public function __construct($config = array())
{ {
$this->view_list = 'Help_documents'; // safeguard for setting the return view listing to the main view. $this->view_list = 'Help_documents'; // safeguard for setting the return view listing to the main view.
@ -60,14 +64,17 @@ class QuestionsanswersControllerHelp_document extends JControllerForm
*/ */
protected function allowAdd($data = array()) protected function allowAdd($data = array())
{ {
// Get user object.
$user = JFactory::getUser();
// Access check. // Access check.
$access = JFactory::getUser()->authorise('help_document.access', 'com_questionsanswers'); $access = $user->authorise('help_document.access', 'com_questionsanswers');
if (!$access) if (!$access)
{ {
return false; return false;
} }
// In the absense of better information, revert to the component permissions. // In the absense of better information, revert to the component permissions.
return JFactory::getUser()->authorise('help_document.create', $this->option); return $user->authorise('help_document.create', $this->option);
} }
/** /**
@ -141,42 +148,25 @@ class QuestionsanswersControllerHelp_document extends JControllerForm
* *
* @return string The arguments to append to the redirect URL. * @return string The arguments to append to the redirect URL.
* *
* @since 12.2 * @since 1.6
*/ */
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{ {
$tmpl = $this->input->get('tmpl'); // get the referral options (old method use return instead see parent)
$layout = $this->input->get('layout', 'edit', 'string');
$ref = $this->input->get('ref', 0, 'string'); $ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int'); $refid = $this->input->get('refid', 0, 'int');
// Setup redirect info. // get redirect info.
$append = parent::getRedirectToItemAppend($recordId, $urlVar);
$append = ''; // set the referral options
if ($refid && $ref)
if ($refid)
{ {
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid; $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
} }
elseif ($ref) elseif ($ref)
{ {
$append .= '&ref='.(string)$ref; $append = '&ref='. (string)$ref . $append;
}
if ($tmpl)
{
$append .= '&tmpl=' . $tmpl;
}
if ($layout)
{
$append .= '&layout=' . $layout;
}
if ($recordId)
{
$append .= '&' . $urlVar . '=' . $recordId;
} }
return $append; return $append;
@ -215,17 +205,29 @@ class QuestionsanswersControllerHelp_document extends JControllerForm
*/ */
public function cancel($key = null) public function cancel($key = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key); $cancel = parent::cancel($key);
if ($cancel) if (!is_null($return) && JUri::isInternal(base64_decode($return)))
{ {
if ($this->refid) $redirect = base64_decode($return);
// Redirect to the return value.
$this->setRedirect(
JRoute::_(
$redirect, false
)
);
}
elseif ($this->refid && $this->ref)
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the item screen. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
@ -245,16 +247,6 @@ class QuestionsanswersControllerHelp_document extends JControllerForm
) )
); );
} }
}
else
{
// Redirect to the items screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . '&view=' . $this->view_list, false
)
);
}
return $cancel; return $cancel;
} }
@ -270,11 +262,15 @@ class QuestionsanswersControllerHelp_document extends JControllerForm
*/ */
public function save($key = null, $urlVar = null) public function save($key = null, $urlVar = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
if ($this->ref || $this->refid) // Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
if ($this->ref || $this->refid || $canReturn)
{ {
// to make sure the item is checkedin on redirect // to make sure the item is checkedin on redirect
$this->task = 'save'; $this->task = 'save';
@ -282,9 +278,22 @@ class QuestionsanswersControllerHelp_document extends JControllerForm
$saved = parent::save($key, $urlVar); $saved = parent::save($key, $urlVar);
if ($this->refid && $saved) // This is not needed since parent save already does this
// Due to the ref and refid implementation we need to add this
if ($canReturn)
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; $redirect = base64_decode($return);
// Redirect to the return value.
$this->setRedirect(
JRoute::_(
$redirect, false
)
);
}
elseif ($this->refid && $this->ref)
{
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the item screen. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
@ -293,9 +302,9 @@ class QuestionsanswersControllerHelp_document extends JControllerForm
) )
); );
} }
elseif ($this->ref && $saved) elseif ($this->ref)
{ {
$redirect = '&view='.(string)$this->ref; $redirect = '&view=' . (string)$this->ref;
// Redirect to the list screen. // Redirect to the list screen.
$this->setRedirect( $this->setRedirect(

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage help_documents.php @subpackage help_documents.php
@ -26,24 +26,33 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/** /**
* Help_documents Controller * Help_documents Controller
*/ */
class QuestionsanswersControllerHelp_documents extends JControllerAdmin class QuestionsanswersControllerHelp_documents extends JControllerAdmin
{ {
protected $text_prefix = 'COM_QUESTIONSANSWERS_HELP_DOCUMENTS';
/** /**
* Proxy for getModel. * The prefix to use with controller messages.
* @since 2.5 *
* @var string
* @since 1.6
*/ */
public function getModel($name = 'Help_document', $prefix = 'QuestionsanswersModel', $config = array()) protected $text_prefix = 'COM_QUESTIONSANSWERS_HELP_DOCUMENTS';
{
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
return $model; /**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JModelLegacy The model.
*
* @since 1.6
*/
public function getModel($name = 'Help_document', $prefix = 'QuestionsanswersModel', $config = array('ignore_request' => true))
{
return parent::getModel($name, $prefix, $config);
} }
public function exportData() public function exportData()

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage import.php @subpackage import.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage question_and_answer.php @subpackage question_and_answer.php
@ -26,9 +26,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controllerform');
/** /**
* Question_and_answer Controller * Question_and_answer Controller
*/ */
@ -43,6 +40,13 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm
*/ */
protected $task; protected $task;
/**
* Class constructor.
*
* @param array $config A named array of configuration variables.
*
* @since 1.6
*/
public function __construct($config = array()) public function __construct($config = array())
{ {
$this->view_list = 'Questions_and_answers'; // safeguard for setting the return view listing to the main view. $this->view_list = 'Questions_and_answers'; // safeguard for setting the return view listing to the main view.
@ -60,14 +64,17 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm
*/ */
protected function allowAdd($data = array()) protected function allowAdd($data = array())
{ {
// Get user object.
$user = JFactory::getUser();
// Access check. // Access check.
$access = JFactory::getUser()->authorise('question_and_answer.access', 'com_questionsanswers'); $access = $user->authorise('question_and_answer.access', 'com_questionsanswers');
if (!$access) if (!$access)
{ {
return false; return false;
} }
// In the absense of better information, revert to the component permissions. // In the absense of better information, revert to the component permissions.
return JFactory::getUser()->authorise('question_and_answer.create', $this->option); return $user->authorise('question_and_answer.create', $this->option);
} }
/** /**
@ -140,42 +147,25 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm
* *
* @return string The arguments to append to the redirect URL. * @return string The arguments to append to the redirect URL.
* *
* @since 12.2 * @since 1.6
*/ */
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{ {
$tmpl = $this->input->get('tmpl'); // get the referral options (old method use return instead see parent)
$layout = $this->input->get('layout', 'edit', 'string');
$ref = $this->input->get('ref', 0, 'string'); $ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int'); $refid = $this->input->get('refid', 0, 'int');
// Setup redirect info. // get redirect info.
$append = parent::getRedirectToItemAppend($recordId, $urlVar);
$append = ''; // set the referral options
if ($refid && $ref)
if ($refid)
{ {
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid; $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
} }
elseif ($ref) elseif ($ref)
{ {
$append .= '&ref='.(string)$ref; $append = '&ref='. (string)$ref . $append;
}
if ($tmpl)
{
$append .= '&tmpl=' . $tmpl;
}
if ($layout)
{
$append .= '&layout=' . $layout;
}
if ($recordId)
{
$append .= '&' . $urlVar . '=' . $recordId;
} }
return $append; return $append;
@ -214,17 +204,29 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm
*/ */
public function cancel($key = null) public function cancel($key = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key); $cancel = parent::cancel($key);
if ($cancel) if (!is_null($return) && JUri::isInternal(base64_decode($return)))
{ {
if ($this->refid) $redirect = base64_decode($return);
// Redirect to the return value.
$this->setRedirect(
JRoute::_(
$redirect, false
)
);
}
elseif ($this->refid && $this->ref)
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the item screen. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
@ -244,16 +246,6 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm
) )
); );
} }
}
else
{
// Redirect to the items screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . '&view=' . $this->view_list, false
)
);
}
return $cancel; return $cancel;
} }
@ -269,11 +261,15 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm
*/ */
public function save($key = null, $urlVar = null) public function save($key = null, $urlVar = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
if ($this->ref || $this->refid) // Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
if ($this->ref || $this->refid || $canReturn)
{ {
// to make sure the item is checkedin on redirect // to make sure the item is checkedin on redirect
$this->task = 'save'; $this->task = 'save';
@ -281,9 +277,22 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm
$saved = parent::save($key, $urlVar); $saved = parent::save($key, $urlVar);
if ($this->refid && $saved) // This is not needed since parent save already does this
// Due to the ref and refid implementation we need to add this
if ($canReturn)
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; $redirect = base64_decode($return);
// Redirect to the return value.
$this->setRedirect(
JRoute::_(
$redirect, false
)
);
}
elseif ($this->refid && $this->ref)
{
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the item screen. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
@ -292,9 +301,9 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm
) )
); );
} }
elseif ($this->ref && $saved) elseif ($this->ref)
{ {
$redirect = '&view='.(string)$this->ref; $redirect = '&view=' . (string)$this->ref;
// Redirect to the list screen. // Redirect to the list screen.
$this->setRedirect( $this->setRedirect(

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage questions_and_answers.php @subpackage questions_and_answers.php
@ -26,24 +26,33 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/** /**
* Questions_and_answers Controller * Questions_and_answers Controller
*/ */
class QuestionsanswersControllerQuestions_and_answers extends JControllerAdmin class QuestionsanswersControllerQuestions_and_answers extends JControllerAdmin
{ {
protected $text_prefix = 'COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS';
/** /**
* Proxy for getModel. * The prefix to use with controller messages.
* @since 2.5 *
* @var string
* @since 1.6
*/ */
public function getModel($name = 'Question_and_answer', $prefix = 'QuestionsanswersModel', $config = array()) protected $text_prefix = 'COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS';
{
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
return $model; /**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JModelLegacy The model.
*
* @since 1.6
*/
public function getModel($name = 'Question_and_answer', $prefix = 'QuestionsanswersModel', $config = array('ignore_request' => true))
{
return parent::getModel($name, $prefix, $config);
} }
public function exportData() public function exportData()

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage questionsanswers.php @subpackage questionsanswers.php
@ -26,9 +26,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/** /**
* Questionsanswers Controller * Questionsanswers Controller
*/ */

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage headercheck.php @subpackage headercheck.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage batch_.php @subpackage batch_.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage questionsanswers.php @subpackage questionsanswers.php
@ -77,6 +77,10 @@ abstract class QuestionsanswersHelper
**/ **/
public static function set($key, $value) public static function set($key, $value)
{ {
if (!isset(self::$session) || !self::checkObject(self::$session))
{
self::$session = JFactory::getSession();
}
// set to local memory to speed up program // set to local memory to speed up program
self::$localSession[$key] = $value; self::$localSession[$key] = $value;
// load to session for later use // load to session for later use
@ -88,6 +92,10 @@ abstract class QuestionsanswersHelper
**/ **/
public static function get($key, $default = null) public static function get($key, $default = null)
{ {
if (!isset(self::$session) || !self::checkObject(self::$session))
{
self::$session = JFactory::getSession();
}
// check if in local memory // check if in local memory
if (!isset(self::$localSession[$key])) if (!isset(self::$localSession[$key]))
{ {
@ -268,8 +276,13 @@ abstract class QuestionsanswersHelper
* @return string On success the path or url is returned based on the type requested * @return string On success the path or url is returned based on the type requested
* *
*/ */
public static function getFolderPath($type = 'path', $target = 'folderpath', $default = JPATH_SITE . '/images/', $createIfNotSet = true) public static function getFolderPath($type = 'path', $target = 'folderpath', $default = '', $createIfNotSet = true)
{ {
// make sure to always have a string/path
if(!self::checkString($default))
{
$default = JPATH_SITE . '/images/';
}
// get the global settings // get the global settings
if (!self::checkObject(self::$params)) if (!self::checkObject(self::$params))
{ {
@ -311,8 +324,13 @@ abstract class QuestionsanswersHelper
* @return string On success the path or url is returned based on the type requested * @return string On success the path or url is returned based on the type requested
* *
*/ */
public static function getFilePath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = JPATH_SITE . '/images/', $createIfNotSet = true) public static function getFilePath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = '', $createIfNotSet = true)
{ {
// make sure to always have a string/path
if(!self::checkString($default))
{
$default = JPATH_SITE . '/images/';
}
// get the global settings // get the global settings
if (!self::checkObject(self::$params)) if (!self::checkObject(self::$params))
{ {
@ -477,6 +495,30 @@ abstract class QuestionsanswersHelper
return date('G:i',$time); return date('G:i',$time);
} }
/**
* set the date as 2004/05 (for charts)
*/
public static function setYearMonth($date)
{
if (!self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('Y/m', $date);
}
/**
* set the date as 2004/05/03 (for charts)
*/
public static function setYearMonthDay($date)
{
if (!self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('Y/m/d', $date);
}
/** /**
* Check if string is a valid time stamp * Check if string is a valid time stamp
*/ */
@ -514,26 +556,53 @@ abstract class QuestionsanswersHelper
} }
/**
* The Dynamic Data Array
*
* @var array
*/
protected static $dynamicData = array(); protected static $dynamicData = array();
/**
* Set the Dynamic Data
*
* @param string $data The data to update
* @param array $placeholders The placeholders to use to update data
*
* @return string of updated data
*
*/
public static function setDynamicData($data, $placeholders) public static function setDynamicData($data, $placeholders)
{ {
// make sure data is a string & placeholders is an array
if (self::checkString($data) && self::checkArray($placeholders))
{
// store in memory in case it is build multiple times
$keyMD5 = md5($data.json_encode($placeholders)); $keyMD5 = md5($data.json_encode($placeholders));
if (!isset(self::$dynamicData[$keyMD5])) if (!isset(self::$dynamicData[$keyMD5]))
{ {
if (self::checkArray($placeholders)) // remove all values that are not strings (just to be safe)
{ $placeholders = array_filter($placeholders, function ($val){ if (self::checkArray($val) || self::checkObject($val)) { return false; } return true; });
// model (basic) based on logic
self::setTheIF($data, $placeholders); self::setTheIF($data, $placeholders);
// update the string and store in memory
self::$dynamicData[$keyMD5] = str_replace(array_keys($placeholders), array_values($placeholders), $data); self::$dynamicData[$keyMD5] = str_replace(array_keys($placeholders), array_values($placeholders), $data);
} }
else // return updated string
{
self::$dynamicData[$keyMD5] = $data;
}
}
return self::$dynamicData[$keyMD5]; return self::$dynamicData[$keyMD5];
} }
return $data;
}
/**
* Set the IF statements
*
* @param string $string The string to update
* @param array $placeholders The placeholders to use to update string
*
* @return void
*
*/
protected static function setTheIF(&$string, $placeholders) protected static function setTheIF(&$string, $placeholders)
{ {
// only normal if endif // only normal if endif
@ -578,6 +647,15 @@ abstract class QuestionsanswersHelper
} }
} }
/**
* Set the remainder IF
*
* @param array $match The match search
* @param array $placeholders The placeholders to use to match
*
* @return string of remainder
*
*/
protected static function remainderIF(&$match, &$placeholders) protected static function remainderIF(&$match, &$placeholders)
{ {
// default we keep nothing // default we keep nothing
@ -2267,16 +2345,16 @@ abstract class QuestionsanswersHelper
{ {
if ($external) if ($external)
{ {
if ($name = self::getVar(null, $val, $id, $name, '=', $table)) if ($_name = self::getVar(null, $val, $id, $name, '=', $table))
{ {
$names[] = $name; $names[] = $_name;
} }
} }
else else
{ {
if ($name = self::getVar($table, $val, $id, $name)) if ($_name = self::getVar($table, $val, $id, $name))
{ {
$names[] = $name; $names[] = $_name;
} }
} }
} }
@ -2332,183 +2410,149 @@ abstract class QuestionsanswersHelper
} }
/** /**
* Get the actions permissions * Get the action permissions
*
* @param string $view The related view name
* @param int $record The item to act upon
* @param string $views The related list view name
* @param mixed $target Only get this permission (like edit, create, delete)
* @param string $component The target component
*
* @return object The JObject of permission/authorised actions
*
**/ **/
public static function getActions($view,&$record = null,$views = null) public static function getActions($view, &$record = null, $views = null, $target = null, $component = 'questionsanswers')
{ {
jimport('joomla.access.access'); // get the user object
$user = JFactory::getUser(); $user = JFactory::getUser();
// load the JObject
$result = new JObject; $result = new JObject;
// make view name safe (just incase)
$view = self::safeString($view); $view = self::safeString($view);
if (self::checkString($views)) if (self::checkString($views))
{ {
$views = self::safeString($views); $views = self::safeString($views);
} }
// get all actions from component // get all actions from component
$actions = JAccess::getActions('com_questionsanswers', 'component'); $actions = JAccess::getActionsFromFile(
// set acctions only set in component settiongs JPATH_ADMINISTRATOR . '/components/com_' . $component . '/access.xml',
$componentActions = array('core.admin','core.manage','core.options','core.export'); "/access/section[@name='component']/"
);
// if non found then return empty JObject
if (empty($actions))
{
return $result;
}
// get created by if not found
if (self::checkObject($record) && !isset($record->created_by) && isset($record->id))
{
$record->created_by = self::getVar($view, $record->id, 'id', 'created_by', '=', $component);
}
// set actions only set in component settings
$componentActions = array('core.admin', 'core.manage', 'core.options', 'core.export');
// check if we have a target
$checkTarget = false;
if ($target)
{
// convert to an array
if (self::checkString($target))
{
$target = array($target);
}
// check if we are good to go
if (self::checkArray($target))
{
$checkTarget = true;
}
}
// loop the actions and set the permissions // loop the actions and set the permissions
foreach ($actions as $action) foreach ($actions as $action)
{ {
// check target action filter
if ($checkTarget && self::filterActions($view, $action->name, $target))
{
continue;
}
// set to use component default // set to use component default
$fallback= true; $fallback = true;
if (self::checkObject($record) && isset($record->id) && $record->id > 0 && !in_array($action->name,$componentActions)) // reset permission per/action
$permission = false;
$catpermission = false;
// set area
$area = 'comp';
// check if the record has an ID and the action is item related (not a component action)
if (self::checkObject($record) && isset($record->id) && $record->id > 0 && !in_array($action->name, $componentActions) &&
(strpos($action->name, 'core.') !== false || strpos($action->name, $view . '.') !== false))
{ {
// we are in item
$area = 'item';
// The record has been set. Check the record permissions. // The record has been set. Check the record permissions.
$permission = $user->authorise($action->name, 'com_questionsanswers.'.$view.'.' . (int) $record->id); $permission = $user->authorise($action->name, 'com_' . $component . '.' . $view . '.' . (int) $record->id);
if (!$permission) // TODO removed && !is_null($permission) // if no permission found, check edit own
if (!$permission)
{ {
if ($action->name == 'core.edit' || $action->name == $view.'.edit') // With edit, if the created_by matches current user then dig deeper.
if (($action->name === 'core.edit' || $action->name === $view . '.edit') && $record->created_by > 0 && ($record->created_by == $user->id))
{ {
if ($user->authorise('core.edit.own', 'com_questionsanswers.'.$view.'.' . (int) $record->id)) // the correct target
{ $coreCheck = (array) explode('.', $action->name);
// If the owner matches 'me' then allow. // check that we have both local and global access
if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id)) if ($user->authorise($coreCheck[0] . '.edit.own', 'com_' . $component . '.' . $view . '.' . (int) $record->id) &&
$user->authorise($coreCheck[0] . '.edit.own', 'com_' . $component))
{ {
// allow edit
$result->set($action->name, true); $result->set($action->name, true);
// set not to use component default // set not to use global default
$fallback= false; // because we already validated it
$fallback = false;
} }
else else
{ {
// do not allow edit
$result->set($action->name, false); $result->set($action->name, false);
// set not to use component default $fallback = false;
$fallback= false;
}
}
elseif ($user->authorise($view.'edit.own', 'com_questionsanswers.'.$view.'.' . (int) $record->id))
{
// If the owner matches 'me' then allow.
if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id))
{
$result->set($action->name, true);
// set not to use component default
$fallback= false;
}
else
{
$result->set($action->name, false);
// set not to use component default
$fallback= false;
}
}
elseif ($user->authorise('core.edit.own', 'com_questionsanswers'))
{
// If the owner matches 'me' then allow.
if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id))
{
$result->set($action->name, true);
// set not to use component default
$fallback= false;
}
else
{
$result->set($action->name, false);
// set not to use component default
$fallback= false;
}
}
elseif ($user->authorise($view.'edit.own', 'com_questionsanswers'))
{
// If the owner matches 'me' then allow.
if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id))
{
$result->set($action->name, true);
// set not to use component default
$fallback= false;
}
else
{
$result->set($action->name, false);
// set not to use component default
$fallback= false;
}
} }
} }
} }
elseif (self::checkString($views) && isset($record->catid) && $record->catid > 0) elseif (self::checkString($views) && isset($record->catid) && $record->catid > 0)
{ {
// we are in item
$area = 'category';
// set the core check
$coreCheck = explode('.', $action->name);
$core = $coreCheck[0];
// make sure we use the core. action check for the categories // make sure we use the core. action check for the categories
if (strpos($action->name,$view) !== false && strpos($action->name,'core.') === false ) { if (strpos($action->name, $view) !== false && strpos($action->name, 'core.') === false )
$coreCheck = explode('.',$action->name); {
$coreCheck[0] = 'core'; $coreCheck[0] = 'core';
$categoryCheck = implode('.',$coreCheck); $categoryCheck = implode('.', $coreCheck);
} }
else else
{ {
$categoryCheck = $action->name; $categoryCheck = $action->name;
} }
// The record has a category. Check the category permissions. // The record has a category. Check the category permissions.
$catpermission = $user->authorise($categoryCheck, 'com_questionsanswers.'.$views.'.category.' . (int) $record->catid); $catpermission = $user->authorise($categoryCheck, 'com_' . $component . '.' . $views . '.category.' . (int) $record->catid);
if (!$catpermission && !is_null($catpermission)) if (!$catpermission && !is_null($catpermission))
{ {
if ($action->name == 'core.edit' || $action->name == $view.'.edit') // With edit, if the created_by matches current user then dig deeper.
if (($action->name === 'core.edit' || $action->name === $view . '.edit') && $record->created_by > 0 && ($record->created_by == $user->id))
{ {
if ($user->authorise('core.edit.own', 'com_questionsanswers.'.$views.'.category.' . (int) $record->catid)) // check that we have both local and global access
{ if ($user->authorise('core.edit.own', 'com_' . $component . '.' . $views . '.category.' . (int) $record->catid) &&
// If the owner matches 'me' then allow. $user->authorise($core . '.edit.own', 'com_' . $component))
if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id))
{ {
// allow edit
$result->set($action->name, true); $result->set($action->name, true);
// set not to use component default // set not to use global default
$fallback= false; // because we already validated it
$fallback = false;
} }
else else
{ {
// do not allow edit
$result->set($action->name, false); $result->set($action->name, false);
// set not to use component default $fallback = false;
$fallback= false;
}
}
elseif ($user->authorise($view.'edit.own', 'com_questionsanswers.'.$views.'.category.' . (int) $record->catid))
{
// If the owner matches 'me' then allow.
if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id))
{
$result->set($action->name, true);
// set not to use component default
$fallback= false;
}
else
{
$result->set($action->name, false);
// set not to use component default
$fallback= false;
}
}
elseif ($user->authorise('core.edit.own', 'com_questionsanswers'))
{
// If the owner matches 'me' then allow.
if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id))
{
$result->set($action->name, true);
// set not to use component default
$fallback= false;
}
else
{
$result->set($action->name, false);
// set not to use component default
$fallback= false;
}
}
elseif ($user->authorise($view.'edit.own', 'com_questionsanswers'))
{
// If the owner matches 'me' then allow.
if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id))
{
$result->set($action->name, true);
// set not to use component default
$fallback= false;
}
else
{
$result->set($action->name, false);
// set not to use component default
$fallback= false;
}
} }
} }
} }
@ -2517,12 +2561,47 @@ abstract class QuestionsanswersHelper
// if allowed then fallback on component global settings // if allowed then fallback on component global settings
if ($fallback) if ($fallback)
{ {
$result->set($action->name, $user->authorise($action->name, 'com_questionsanswers')); // if item/category blocks access then don't fall back on global
if ((($area === 'item') && !$permission) || (($area === 'category') && !$catpermission))
{
// do not allow
$result->set($action->name, false);
}
// Finally remember the global settings have the final say. (even if item allow)
// The local item permissions can block, but it can't open and override of global permissions.
// Since items are created by users and global permissions is set by system admin.
else
{
$result->set($action->name, $user->authorise($action->name, 'com_' . $component));
}
} }
} }
return $result; return $result;
} }
/**
* Filter the action permissions
*
* @param string $action The action to check
* @param array $targets The array of target actions
*
* @return boolean true if action should be filtered out
*
**/
protected static function filterActions(&$view, &$action, &$targets)
{
foreach ($targets as $target)
{
if (strpos($action, $view . '.' . $target) !== false ||
strpos($action, 'core.' . $target) !== false)
{
return false;
break;
}
}
return true;
}
/** /**
* Get any component's model * Get any component's model
**/ **/
@ -2570,7 +2649,7 @@ abstract class QuestionsanswersHelper
/** /**
* Add to asset Table * Add to asset Table
*/ */
public static function setAsset($id,$table) public static function setAsset($id, $table, $inherit = true)
{ {
$parent = JTable::getInstance('Asset'); $parent = JTable::getInstance('Asset');
$parent->loadByName('com_questionsanswers'); $parent->loadByName('com_questionsanswers');
@ -2602,7 +2681,7 @@ abstract class QuestionsanswersHelper
$asset->name = $name; $asset->name = $name;
$asset->title = $title; $asset->title = $title;
// get the default asset rules // get the default asset rules
$rules = self::getDefaultAssetRules('com_questionsanswers',$table); $rules = self::getDefaultAssetRules('com_questionsanswers', $table, $inherit);
if ($rules instanceof JAccessRules) if ($rules instanceof JAccessRules)
{ {
$asset->rules = (string) $rules; $asset->rules = (string) $rules;
@ -2632,7 +2711,12 @@ abstract class QuestionsanswersHelper
/** /**
* Gets the default asset Rules for a component/view. * Gets the default asset Rules for a component/view.
*/ */
protected static function getDefaultAssetRules($component,$view) protected static function getDefaultAssetRules($component, $view, $inherit = true)
{
// if new or inherited
$assetId = 0;
// Only get the actual item rules if not inheriting
if (!$inherit)
{ {
// Need to find the asset id by the name of the component. // Need to find the asset id by the name of the component.
$db = JFactory::getDbo(); $db = JFactory::getDbo();
@ -2642,10 +2726,14 @@ abstract class QuestionsanswersHelper
->where($db->quoteName('name') . ' = ' . $db->quote($component)); ->where($db->quoteName('name') . ' = ' . $db->quote($component));
$db->setQuery($query); $db->setQuery($query);
$db->execute(); $db->execute();
if ($db->loadRowList()) // check that there is a value
if ($db->getNumRows())
{ {
// asset alread set so use saved rules // asset already set so use saved rules
$assetId = (int) $db->loadResult(); $assetId = (int) $db->loadResult();
}
}
// get asset rules
$result = JAccess::getAssetRules($assetId); $result = JAccess::getAssetRules($assetId);
if ($result instanceof JAccessRules) if ($result instanceof JAccessRules)
{ {
@ -2659,7 +2747,7 @@ abstract class QuestionsanswersHelper
// remove since it is not part of this view // remove since it is not part of this view
unset($_result->$name); unset($_result->$name);
} }
else elseif ($inherit)
{ {
// clear the value since we inherit // clear the value since we inherit
$rule = array(); $rule = array();
@ -2672,14 +2760,12 @@ abstract class QuestionsanswersHelper
$_result = array($_result); $_result = array($_result);
// Instantiate and return the JAccessRules object for the asset rules. // Instantiate and return the JAccessRules object for the asset rules.
$rules = new JAccessRules($_result); $rules = new JAccessRules($_result);
// return filtered rules
return $rules; return $rules;
} }
}
return $result; return $result;
} }
}
return JAccess::getAssetRules(0);
}
/** /**
* xmlAppend * xmlAppend
@ -2772,6 +2858,46 @@ abstract class QuestionsanswersHelper
} }
} }
/**
* get the field object
*
* @param array $attributes The array of attributes
* @param string $default The default of the field
* @param array $options The options to apply to the XML element
*
* @return object
*
*/
public static function getFieldObject(&$attributes, $default = '', $options = null)
{
// make sure we have attributes and a type value
if (self::checkArray($attributes) && isset($attributes['type']))
{
// make sure the form helper class is loaded
if (!method_exists('JFormHelper', 'loadFieldType'))
{
jimport('joomla.form.form');
}
// get field type
$field = JFormHelper::loadFieldType($attributes['type'],true);
// start field xml
$XML = new SimpleXMLElement('<field/>');
// load the attributes
self::xmlAddAttributes($XML, $attributes);
// check if we have options
if (self::checkArray($options))
{
// load the options
self::xmlAddOptions($XML, $options);
}
// setup the field
$field->setup($XML, $default);
// return the field object
return $field;
}
return false;
}
/** /**
* Render Bool Button * Render Bool Button
* *
@ -2790,8 +2916,6 @@ abstract class QuestionsanswersHelper
$args = func_get_args(); $args = func_get_args();
// check if there is additional button class // check if there is additional button class
$additional = isset($args[1]) ? (string) $args[1] : ''; // not used at this time $additional = isset($args[1]) ? (string) $args[1] : ''; // not used at this time
// start the xml
$buttonXML = new SimpleXMLElement('<field/>');
// button attributes // button attributes
$buttonAttributes = array( $buttonAttributes = array(
'type' => 'radio', 'type' => 'radio',
@ -2800,22 +2924,12 @@ abstract class QuestionsanswersHelper
'class' => 'btn-group', 'class' => 'btn-group',
'filter' => 'INT', 'filter' => 'INT',
'default' => isset($args[2]) ? (int) $args[2] : 0); 'default' => isset($args[2]) ? (int) $args[2] : 0);
// load the haskey attributes
self::xmlAddAttributes($buttonXML, $buttonAttributes);
// set the button options // set the button options
$buttonOptions = array( $buttonOptions = array(
'1' => isset($args[3]) ? self::htmlEscape($args[3]) : 'JYES', '1' => isset($args[3]) ? self::htmlEscape($args[3]) : 'JYES',
'0' => isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO'); '0' => isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO');
// load the button options // return the input
self::xmlAddOptions($buttonXML, $buttonOptions); return self::getFieldObject($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input;
// get the radio element
$button = JFormHelper::loadFieldType('radio');
// run
$button->setup($buttonXML, $buttonAttributes['default']);
return $button->input;
} }
/** /**
@ -2856,11 +2970,11 @@ abstract class QuestionsanswersHelper
* *
* @input array The array to check * @input array The array to check
* *
* @returns bool true on success * @returns bool/int number of items in array on success
**/ **/
public static function checkArray($array, $removeEmptyString = false) public static function checkArray($array, $removeEmptyString = false)
{ {
if (isset($array) && is_array($array) && count($array) > 0) if (isset($array) && is_array($array) && ($nr = count((array)$array)) > 0)
{ {
// also make sure the empty strings are removed // also make sure the empty strings are removed
if ($removeEmptyString) if ($removeEmptyString)
@ -2874,7 +2988,7 @@ abstract class QuestionsanswersHelper
} }
return self::checkArray($array, false); return self::checkArray($array, false);
} }
return true; return $nr;
} }
return false; return false;
} }
@ -2963,7 +3077,7 @@ abstract class QuestionsanswersHelper
{ {
$initial = strlen($string); $initial = strlen($string);
$words = preg_split('/([\s\n\r]+)/', $string, null, PREG_SPLIT_DELIM_CAPTURE); $words = preg_split('/([\s\n\r]+)/', $string, null, PREG_SPLIT_DELIM_CAPTURE);
$words_count = count($words); $words_count = count((array)$words);
$word_length = 0; $word_length = 0;
$last_word = 0; $last_word = 0;
@ -2998,7 +3112,7 @@ abstract class QuestionsanswersHelper
* *
* @returns string on success * @returns string on success
**/ **/
public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true) public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true)
{ {
if ($replaceNumbers === true) if ($replaceNumbers === true)
{ {
@ -3027,7 +3141,16 @@ abstract class QuestionsanswersHelper
$string = trim($string); $string = trim($string);
$string = preg_replace('/'.$spacer.'+/', ' ', $string); $string = preg_replace('/'.$spacer.'+/', ' ', $string);
$string = preg_replace('/\s+/', ' ', $string); $string = preg_replace('/\s+/', ' ', $string);
// remove all and keep only characters
if ($keepOnlyCharacters)
{
$string = preg_replace("/[^A-Za-z ]/", '', $string); $string = preg_replace("/[^A-Za-z ]/", '', $string);
}
// keep both numbers and characters
else
{
$string = preg_replace("/[^A-Za-z0-9 ]/", '', $string);
}
// select final adaptations // select final adaptations
if ($type === 'L' || $type === 'strtolower') if ($type === 'L' || $type === 'strtolower')
{ {

View File

@ -113,7 +113,7 @@ COM_QUESTIONSANSWERS_HELP_DOCUMENTS_BATCH_USE_DESC="Allows users in this group t
COM_QUESTIONSANSWERS_HELP_DOCUMENTS_CREATE="Help Documents Create" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_CREATE="Help Documents Create"
COM_QUESTIONSANSWERS_HELP_DOCUMENTS_CREATE_DESC="Allows the users in this group to create create help documents" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_CREATE_DESC="Allows the users in this group to create create help documents"
COM_QUESTIONSANSWERS_HELP_DOCUMENTS_DASHBOARD_LIST="Help Documents Dashboard List" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_DASHBOARD_LIST="Help Documents Dashboard List"
COM_QUESTIONSANSWERS_HELP_DOCUMENTS_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the help document" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of help document"
COM_QUESTIONSANSWERS_HELP_DOCUMENTS_DELETE="Help Documents Delete" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_DELETE="Help Documents Delete"
COM_QUESTIONSANSWERS_HELP_DOCUMENTS_DELETE_DESC="Allows the users in this group to delete delete help documents" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_DELETE_DESC="Allows the users in this group to delete delete help documents"
COM_QUESTIONSANSWERS_HELP_DOCUMENTS_EDIT="Help Documents Edit" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_EDIT="Help Documents Edit"
@ -146,7 +146,7 @@ COM_QUESTIONSANSWERS_HELP_DOCUMENTS_N_ITEMS_UNFEATURED_1="%s Help Document unfea
COM_QUESTIONSANSWERS_HELP_DOCUMENTS_N_ITEMS_UNPUBLISHED="%s Help Documents unpublished." COM_QUESTIONSANSWERS_HELP_DOCUMENTS_N_ITEMS_UNPUBLISHED="%s Help Documents unpublished."
COM_QUESTIONSANSWERS_HELP_DOCUMENTS_N_ITEMS_UNPUBLISHED_1="%s Help Document unpublished." COM_QUESTIONSANSWERS_HELP_DOCUMENTS_N_ITEMS_UNPUBLISHED_1="%s Help Document unpublished."
COM_QUESTIONSANSWERS_HELP_DOCUMENTS_SUBMENU="Help Documents Submenu" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_SUBMENU="Help Documents Submenu"
COM_QUESTIONSANSWERS_HELP_DOCUMENTS_SUBMENU_DESC="Allows the users in this group to update the submenu of the help document" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_SUBMENU_DESC="Allows the users in this group to submenu of help document"
COM_QUESTIONSANSWERS_HELP_DOCUMENT_ADMIN="Admin" COM_QUESTIONSANSWERS_HELP_DOCUMENT_ADMIN="Admin"
COM_QUESTIONSANSWERS_HELP_DOCUMENT_ADMIN_VIEW="Admin View" COM_QUESTIONSANSWERS_HELP_DOCUMENT_ADMIN_VIEW="Admin View"
COM_QUESTIONSANSWERS_HELP_DOCUMENT_ADMIN_VIEW_DESCRIPTION="Select the view being target." COM_QUESTIONSANSWERS_HELP_DOCUMENT_ADMIN_VIEW_DESCRIPTION="Select the view being target."
@ -271,29 +271,29 @@ COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_BATCH_USE_DESC="Allows users in this
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_CREATE="Questions And Answers Create" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_CREATE="Questions And Answers Create"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_CREATE_DESC="Allows the users in this group to create create questions and answers" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_CREATE_DESC="Allows the users in this group to create create questions and answers"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DASHBOARD_ADD="Questions And Answers Dashboard Add" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DASHBOARD_ADD="Questions And Answers Dashboard Add"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DASHBOARD_ADD_DESC="Allows the users in this group to update the dashboard add of the question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of question and answer"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DASHBOARD_LIST="Questions And Answers Dashboard List" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DASHBOARD_LIST="Questions And Answers Dashboard List"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of question and answer"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DELETE="Questions And Answers Delete" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DELETE="Questions And Answers Delete"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DELETE_DESC="Allows the users in this group to delete delete questions and answers" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DELETE_DESC="Allows the users in this group to delete delete questions and answers"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT="Questions And Answers Edit" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT="Questions And Answers Edit"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_ANSWER="Questions And Answers Edit Answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_ANSWER="Questions And Answers Edit Answer"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_ANSWER_DESC="Allows the users in this group to update the edit answer of the question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_ANSWER_DESC="Allows the users in this group to edit answer of question and answer"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_ANSWER_DOCUMENTS="Questions And Answers Edit Answer Documents" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_ANSWER_DOCUMENTS="Questions And Answers Edit Answer Documents"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_ANSWER_DOCUMENTS_DESC="Allows the users in this group to update the edit answer documents of the question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_ANSWER_DOCUMENTS_DESC="Allows the users in this group to edit answer documents of question and answer"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CATID="Questions And Answers Edit Catid" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CATID="Questions And Answers Edit Catid"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CATID_DESC="Allows the users in this group to update the edit catid of the question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CATID_DESC="Allows the users in this group to edit catid of question and answer"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CREATED_BY="Questions And Answers Edit Created By" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CREATED_BY="Questions And Answers Edit Created By"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by questions and answers" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by questions and answers"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CREATED_DATE="Questions And Answers Edit Created Date" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CREATED_DATE="Questions And Answers Edit Created Date"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created questions and answers" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created questions and answers"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_DESC="Allows the users in this group to edit the question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_DESC="Allows the users in this group to edit the question and answer"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_MAIN_IMAGE_UPLOADER="Questions And Answers Edit Main Image Uploader" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_MAIN_IMAGE_UPLOADER="Questions And Answers Edit Main Image Uploader"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_MAIN_IMAGE_UPLOADER_DESC="Allows the users in this group to update the edit main image uploader of the question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_MAIN_IMAGE_UPLOADER_DESC="Allows the users in this group to edit main image uploader of question and answer"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_OWN="Questions And Answers Edit Own" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_OWN="Questions And Answers Edit Own"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_OWN_DESC="Allows the users in this group to edit edit own questions and answers created by them" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_OWN_DESC="Allows the users in this group to edit edit own questions and answers created by them"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_QUESTION="Questions And Answers Edit Question" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_QUESTION="Questions And Answers Edit Question"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_QUESTION_DESC="Allows the users in this group to update the edit question of the question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_QUESTION_DESC="Allows the users in this group to edit question of question and answer"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_STATE="Questions And Answers Edit State" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_STATE="Questions And Answers Edit State"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_STATE_DESC="Allows the users in this group to update the state of the question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_STATE_DESC="Allows the users in this group to update the state of the question and answer"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_VERSION="Questions And Answers Edit Version" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_VERSION="Questions And Answers Edit Version"
@ -320,11 +320,33 @@ COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_N_ITEMS_UNFEATURED_1="%s Question and
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_N_ITEMS_UNPUBLISHED="%s Questions and Answers unpublished." COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_N_ITEMS_UNPUBLISHED="%s Questions and Answers unpublished."
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_N_ITEMS_UNPUBLISHED_1="%s Question and Answer unpublished." COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_N_ITEMS_UNPUBLISHED_1="%s Question and Answer unpublished."
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_SUBMENU="Questions And Answers Submenu" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_SUBMENU="Questions And Answers Submenu"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_SUBMENU_DESC="Allows the users in this group to update the submenu of the question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_SUBMENU_DESC="Allows the users in this group to submenu of question and answer"
COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER="Question and Answer" COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER="Question and Answer"
COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_ANSWER="Answer" COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_ANSWER="Answer"
COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_ANSWER_DOCUMENTS="Answer Documents" COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_ANSWER_DOCUMENTS="Answer Documents"
COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_ANSWER_DOCUMENTS_UPLOADER_DESCRIPTION="<div id='upload-drop-answer-documents' class='uk-placeholder'><br /><br /><i class='uk-icon-cloud-upload uk-icon-medium uk-text-muted uk-margin-small-right'></i> Upload Your <strong>answer documents</span></strong> by dropping the file here or <a class='uk-form-file'>selecting the file from your computer<input id='upload-select-answer-documents' type='file'></a> (formates allowed: <span id='answer-documents-formats'></span>)<br /><br /><br /></div><div id='progressbar-answer-documents' class='uk-progress uk-hidden'><div class='uk-progress-bar' style='width: 0%;'>...</div></div>" COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_ANSWER_DOCUMENTS_UPLOADER_DESCRIPTION="
<div id='uikittwo-answer-documents-uploader' style='display:none'>
<div id='uikittwo-upload-drop-answer-documents' class='uk-placeholder uk-text-center'>
<br /><br />
<i class='uk-icon-cloud-upload uk-icon-medium uk-text-muted uk-margin-small-right'></i>
Upload Your <strong>answer</strong> by dropping the file here or
<a class='uk-form-file'>selecting the file from your device<input id='uikittwo-upload-select-answer-documents' type='file'></a> (formats allowed: <span id='answer-documents-formats'></span>)
<br /><br /><br />
</div>
<div id='uikittwo-progressbar-answer-documents' class='uk-progress uk-hidden'><div class='uk-progress-bar' style='width: 0%;'>...</div></div>
</div>
<div id='uikitthree-answer-documents-uploader' style='display:none'>
<div id='uikitthree-upload-answer-documents' class='uk-placeholder uk-text-center'>
<span uk-icon='icon: cloud-upload'></span>
<span class='uk-text-middle'>Upload Your <strong>answer</strong> by dropping the file here or
<div uk-form-custom>
<input type='file' multiple>
<span class='uk-link'>selecting the file from your device</span> (formats allowed: <span id='answer-documents-formats'></span>)
</div>
</div>
<progress id='uikitthree-progressbar-answer-documents' class='uk-progress' value='0' max='100' hidden></progress>
</div>
<div id='error-answer-documents-uploader'></div>"
COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_ANSWER_DOCUMENTS_UPLOADER_LABEL="Answer Documents" COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_ANSWER_DOCUMENTS_UPLOADER_LABEL="Answer Documents"
COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_ANSWER_LABEL="Answer" COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_ANSWER_LABEL="Answer"
COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_CATID_DESCRIPTION="select one of the following categories" COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_CATID_DESCRIPTION="select one of the following categories"
@ -338,7 +360,29 @@ COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_EDIT="Editing the Question and Answer"
COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_ERROR_UNIQUE_ALIAS="Another Question and Answer has the same alias." COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_ERROR_UNIQUE_ALIAS="Another Question and Answer has the same alias."
COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_ID="Id" COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_ID="Id"
COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_MAIN_IMAGE="Main Image" COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_MAIN_IMAGE="Main Image"
COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_MAIN_IMAGE_UPLOADER_DESCRIPTION="<div id='upload-drop-main-image' class='uk-placeholder'><br /><br /><i class='uk-icon-cloud-upload uk-icon-medium uk-text-muted uk-margin-small-right'></i> Upload Your <strong>image <span id='size-main'></span></strong> by dropping the file here or <a class='uk-form-file'>selecting the file from your computer<input id='upload-select-main-image' type='file'></a> (formates allowed: <span id='main-image-formats'></span>)<br /><br /><br /></div><div id='progressbar-main-image' class='uk-progress uk-hidden'><div class='uk-progress-bar' style='width: 0%;'>...</div></div>" COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_MAIN_IMAGE_UPLOADER_DESCRIPTION="
<div id='uikittwo-main-image-uploader' style='display:none'>
<div id='uikittwo-upload-drop-main-image' class='uk-placeholder uk-text-center'>
<br /><br />
<i class='uk-icon-cloud-upload uk-icon-medium uk-text-muted uk-margin-small-right'></i>
Upload Your <strong>main image <span id='size-main'></span></strong> by dropping the file here or
<a class='uk-form-file'>selecting the file from your computer<input id='uikittwo-upload-select-main-image' type='file'></a> (formats allowed: <span id='main-image-formats'></span>)
<br /><br /><br />
</div>
<div id='uikittwo-progressbar-main-image' class='uk-progress uk-hidden'><div class='uk-progress-bar' style='width: 0%;'>...</div></div>
</div>
<div id='uikitthree-main-image-uploader' style='display:none'>
<div id='uikitthree-upload-main-image' class='uk-placeholder uk-text-center'>
<span uk-icon='icon: cloud-upload'></span>
<span class='uk-text-middle'>Upload Your <strong>main image <span id='size-main'></span></strong> by dropping the file here or</span>
<div uk-form-custom>
<input type='file' multiple>
<span class='uk-link'>selecting the file from your computer</span> (formats allowed: <span id='main-image-formats'></span>)
</div>
</div>
<progress id='uikitthree-progressbar-main-image' class='uk-progress' value='0' max='100' hidden></progress>
</div>
<div id='error-main-image-uploader'></div>"
COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_MAIN_IMAGE_UPLOADER_LABEL="Image" COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_MAIN_IMAGE_UPLOADER_LABEL="Image"
COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_MODIFIED_BY_DESC="The last user that modified this Question and Answer." COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_MODIFIED_BY_DESC="The last user that modified this Question and Answer."
COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_MODIFIED_BY_LABEL="Modified By" COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_MODIFIED_BY_LABEL="Modified By"

View File

@ -15,7 +15,7 @@ COM_QUESTIONSANSWERS_HELP_DOCUMENTS_BATCH_USE_DESC="Allows users in this group t
COM_QUESTIONSANSWERS_HELP_DOCUMENTS_CREATE="Help Documents Create" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_CREATE="Help Documents Create"
COM_QUESTIONSANSWERS_HELP_DOCUMENTS_CREATE_DESC="Allows the users in this group to create create help documents" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_CREATE_DESC="Allows the users in this group to create create help documents"
COM_QUESTIONSANSWERS_HELP_DOCUMENTS_DASHBOARD_LIST="Help Documents Dashboard List" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_DASHBOARD_LIST="Help Documents Dashboard List"
COM_QUESTIONSANSWERS_HELP_DOCUMENTS_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the help document" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of help document"
COM_QUESTIONSANSWERS_HELP_DOCUMENTS_DELETE="Help Documents Delete" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_DELETE="Help Documents Delete"
COM_QUESTIONSANSWERS_HELP_DOCUMENTS_DELETE_DESC="Allows the users in this group to delete delete help documents" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_DELETE_DESC="Allows the users in this group to delete delete help documents"
COM_QUESTIONSANSWERS_HELP_DOCUMENTS_EDIT="Help Documents Edit" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_EDIT="Help Documents Edit"
@ -31,7 +31,7 @@ COM_QUESTIONSANSWERS_HELP_DOCUMENTS_EXPORT_DESC="Allows the users in this group
COM_QUESTIONSANSWERS_HELP_DOCUMENTS_IMPORT="Help Documents Import" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_IMPORT="Help Documents Import"
COM_QUESTIONSANSWERS_HELP_DOCUMENTS_IMPORT_DESC="Allows the users in this group to import import help documents" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_IMPORT_DESC="Allows the users in this group to import import help documents"
COM_QUESTIONSANSWERS_HELP_DOCUMENTS_SUBMENU="Help Documents Submenu" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_SUBMENU="Help Documents Submenu"
COM_QUESTIONSANSWERS_HELP_DOCUMENTS_SUBMENU_DESC="Allows the users in this group to update the submenu of the help document" COM_QUESTIONSANSWERS_HELP_DOCUMENTS_SUBMENU_DESC="Allows the users in this group to submenu of help document"
COM_QUESTIONSANSWERS_IMPORT_DATA="Import Data" COM_QUESTIONSANSWERS_IMPORT_DATA="Import Data"
COM_QUESTIONSANSWERS_IMPORT_DATA_DESC=" Allows users in this group to import data." COM_QUESTIONSANSWERS_IMPORT_DATA_DESC=" Allows users in this group to import data."
COM_QUESTIONSANSWERS_MENU="Questions and Answers" COM_QUESTIONSANSWERS_MENU="Questions and Answers"
@ -52,29 +52,29 @@ COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_BATCH_USE_DESC="Allows users in this
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_CREATE="Questions And Answers Create" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_CREATE="Questions And Answers Create"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_CREATE_DESC="Allows the users in this group to create create questions and answers" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_CREATE_DESC="Allows the users in this group to create create questions and answers"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DASHBOARD_ADD="Questions And Answers Dashboard Add" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DASHBOARD_ADD="Questions And Answers Dashboard Add"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DASHBOARD_ADD_DESC="Allows the users in this group to update the dashboard add of the question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of question and answer"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DASHBOARD_LIST="Questions And Answers Dashboard List" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DASHBOARD_LIST="Questions And Answers Dashboard List"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of question and answer"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DELETE="Questions And Answers Delete" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DELETE="Questions And Answers Delete"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DELETE_DESC="Allows the users in this group to delete delete questions and answers" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_DELETE_DESC="Allows the users in this group to delete delete questions and answers"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT="Questions And Answers Edit" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT="Questions And Answers Edit"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_ANSWER="Questions And Answers Edit Answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_ANSWER="Questions And Answers Edit Answer"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_ANSWER_DESC="Allows the users in this group to update the edit answer of the question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_ANSWER_DESC="Allows the users in this group to edit answer of question and answer"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_ANSWER_DOCUMENTS="Questions And Answers Edit Answer Documents" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_ANSWER_DOCUMENTS="Questions And Answers Edit Answer Documents"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_ANSWER_DOCUMENTS_DESC="Allows the users in this group to update the edit answer documents of the question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_ANSWER_DOCUMENTS_DESC="Allows the users in this group to edit answer documents of question and answer"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CATID="Questions And Answers Edit Catid" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CATID="Questions And Answers Edit Catid"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CATID_DESC="Allows the users in this group to update the edit catid of the question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CATID_DESC="Allows the users in this group to edit catid of question and answer"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CREATED_BY="Questions And Answers Edit Created By" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CREATED_BY="Questions And Answers Edit Created By"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by questions and answers" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by questions and answers"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CREATED_DATE="Questions And Answers Edit Created Date" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CREATED_DATE="Questions And Answers Edit Created Date"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created questions and answers" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created questions and answers"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_DESC="Allows the users in this group to edit the question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_DESC="Allows the users in this group to edit the question and answer"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_MAIN_IMAGE_UPLOADER="Questions And Answers Edit Main Image Uploader" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_MAIN_IMAGE_UPLOADER="Questions And Answers Edit Main Image Uploader"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_MAIN_IMAGE_UPLOADER_DESC="Allows the users in this group to update the edit main image uploader of the question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_MAIN_IMAGE_UPLOADER_DESC="Allows the users in this group to edit main image uploader of question and answer"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_OWN="Questions And Answers Edit Own" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_OWN="Questions And Answers Edit Own"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_OWN_DESC="Allows the users in this group to edit edit own questions and answers created by them" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_OWN_DESC="Allows the users in this group to edit edit own questions and answers created by them"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_QUESTION="Questions And Answers Edit Question" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_QUESTION="Questions And Answers Edit Question"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_QUESTION_DESC="Allows the users in this group to update the edit question of the question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_QUESTION_DESC="Allows the users in this group to edit question of question and answer"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_STATE="Questions And Answers Edit State" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_STATE="Questions And Answers Edit State"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_STATE_DESC="Allows the users in this group to update the state of the question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_STATE_DESC="Allows the users in this group to update the state of the question and answer"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_VERSION="Questions And Answers Edit Version" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EDIT_VERSION="Questions And Answers Edit Version"
@ -84,6 +84,6 @@ COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_EXPORT_DESC="Allows the users in this
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_IMPORT="Questions And Answers Import" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_IMPORT="Questions And Answers Import"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_IMPORT_DESC="Allows the users in this group to import import questions and answers" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_IMPORT_DESC="Allows the users in this group to import import questions and answers"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_SUBMENU="Questions And Answers Submenu" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_SUBMENU="Questions And Answers Submenu"
COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_SUBMENU_DESC="Allows the users in this group to update the submenu of the question and answer" COM_QUESTIONSANSWERS_QUESTIONS_AND_ANSWERS_SUBMENU_DESC="Allows the users in this group to submenu of question and answer"
COM_QUESTIONSANSWERS_USE_BATCH="Use Batch" COM_QUESTIONSANSWERS_USE_BATCH="Use Batch"
COM_QUESTIONSANSWERS_USE_BATCH_DESC=" Allows users in this group to use batch copy/update method." COM_QUESTIONSANSWERS_USE_BATCH_DESC=" Allows users in this group to use batch copy/update method."

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage batchselection.php @subpackage batchselection.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage details_above.php @subpackage details_above.php
@ -24,7 +24,6 @@
/-----------------------------------------------------------------------------------------------------------------------------*/ /-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm(); $form = $displayData->getForm();

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage details_fullwidth.php @subpackage details_fullwidth.php
@ -24,7 +24,6 @@
/-----------------------------------------------------------------------------------------------------------------------------*/ /-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm(); $form = $displayData->getForm();

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage details_left.php @subpackage details_left.php
@ -24,7 +24,6 @@
/-----------------------------------------------------------------------------------------------------------------------------*/ /-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm(); $form = $displayData->getForm();

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage details_right.php @subpackage details_right.php
@ -24,7 +24,6 @@
/-----------------------------------------------------------------------------------------------------------------------------*/ /-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm(); $form = $displayData->getForm();

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage details_under.php @subpackage details_under.php
@ -24,7 +24,6 @@
/-----------------------------------------------------------------------------------------------------------------------------*/ /-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm(); $form = $displayData->getForm();

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage publishing.php @subpackage publishing.php
@ -24,7 +24,6 @@
/-----------------------------------------------------------------------------------------------------------------------------*/ /-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
$app = JFactory::getApplication(); $app = JFactory::getApplication();

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage publlshing.php @subpackage publlshing.php
@ -24,7 +24,6 @@
/-----------------------------------------------------------------------------------------------------------------------------*/ /-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
$app = JFactory::getApplication(); $app = JFactory::getApplication();

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage details_fullwidth.php @subpackage details_fullwidth.php
@ -24,7 +24,6 @@
/-----------------------------------------------------------------------------------------------------------------------------*/ /-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm(); $form = $displayData->getForm();

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage details_rightside.php @subpackage details_rightside.php
@ -24,7 +24,6 @@
/-----------------------------------------------------------------------------------------------------------------------------*/ /-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm(); $form = $displayData->getForm();

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage details_under.php @subpackage details_under.php
@ -24,7 +24,6 @@
/-----------------------------------------------------------------------------------------------------------------------------*/ /-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm(); $form = $displayData->getForm();

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage metadata.php @subpackage metadata.php
@ -24,7 +24,6 @@
/-----------------------------------------------------------------------------------------------------------------------------*/ /-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
$form = $displayData->getForm(); $form = $displayData->getForm();

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage publishing.php @subpackage publishing.php
@ -24,7 +24,6 @@
/-----------------------------------------------------------------------------------------------------------------------------*/ /-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
$app = JFactory::getApplication(); $app = JFactory::getApplication();

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage ajax.php @subpackage ajax.php
@ -26,8 +26,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.helper');
/** /**
* Questionsanswers Ajax Model * Questionsanswers Ajax Model
*/ */
@ -56,6 +54,7 @@ class QuestionsanswersModelAjax extends JModelList
$vdm = $jinput->get('vdm', null, 'WORD'); $vdm = $jinput->get('vdm', null, 'WORD');
if ($vdm) if ($vdm)
{ {
// set view and id
if ($view = QuestionsanswersHelper::get($vdm)) if ($view = QuestionsanswersHelper::get($vdm))
{ {
$current = (array) explode('__', $view); $current = (array) explode('__', $view);
@ -68,6 +67,14 @@ class QuestionsanswersModelAjax extends JModelList
); );
} }
} }
// set return if found
if ($return = QuestionsanswersHelper::get($vdm . '__return'))
{
if (QuestionsanswersHelper::checkString($return))
{
$this->viewid[$call]['a_return'] = $return;
}
}
} }
} }
if (isset($this->viewid[$call])) if (isset($this->viewid[$call]))

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage adminviewfolderlist.php @subpackage adminviewfolderlist.php
@ -47,7 +47,7 @@ class JFormFieldAdminviewfolderlist extends JFormFieldList
* *
* @return array An array of JHtml options. * @return array An array of JHtml options.
*/ */
public function getOptions() protected function getOptions()
{ {
// get custom folder files // get custom folder files
$localfolder = JPATH_COMPONENT_ADMINISTRATOR.'/views'; $localfolder = JPATH_COMPONENT_ADMINISTRATOR.'/views';

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage articles.php @subpackage articles.php
@ -47,7 +47,7 @@ class JFormFieldArticles extends JFormFieldList
* *
* @return array An array of JHtml options. * @return array An array of JHtml options.
*/ */
public function getOptions() protected function getOptions()
{ {
$db = JFactory::getDBO(); $db = JFactory::getDBO();
$query = $db->getQuery(true); $query = $db->getQuery(true);

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage siteviewfolderlist.php @subpackage siteviewfolderlist.php
@ -47,7 +47,7 @@ class JFormFieldSiteviewfolderlist extends JFormFieldList
* *
* @return array An array of JHtml options. * @return array An array of JHtml options.
*/ */
public function getOptions() protected function getOptions()
{ {
// get custom folder files // get custom folder files
$localfolder = JPATH_COMPONENT_SITE.'/views'; $localfolder = JPATH_COMPONENT_SITE.'/views';

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage help_document.js @subpackage help_document.js
@ -59,6 +59,7 @@ function vvvvvvv(location_vvvvvvv)
if (location_vvvvvvv == 1) if (location_vvvvvvv == 1)
{ {
jQuery('#jform_admin_view').closest('.control-group').show(); jQuery('#jform_admin_view').closest('.control-group').show();
// add required attribute to admin_view field
if (jform_vvvvvvvvvv_required) if (jform_vvvvvvvvvv_required)
{ {
updateFieldRequired('admin_view',0); updateFieldRequired('admin_view',0);
@ -67,11 +68,11 @@ function vvvvvvv(location_vvvvvvv)
jQuery('#jform_admin_view').addClass('required'); jQuery('#jform_admin_view').addClass('required');
jform_vvvvvvvvvv_required = false; jform_vvvvvvvvvv_required = false;
} }
} }
else else
{ {
jQuery('#jform_admin_view').closest('.control-group').hide(); jQuery('#jform_admin_view').closest('.control-group').hide();
// remove required attribute from admin_view field
if (!jform_vvvvvvvvvv_required) if (!jform_vvvvvvvvvv_required)
{ {
updateFieldRequired('admin_view',1); updateFieldRequired('admin_view',1);
@ -90,6 +91,7 @@ function vvvvvvw(location_vvvvvvw)
if (location_vvvvvvw == 2) if (location_vvvvvvw == 2)
{ {
jQuery('#jform_site_view').closest('.control-group').show(); jQuery('#jform_site_view').closest('.control-group').show();
// add required attribute to site_view field
if (jform_vvvvvvwvvw_required) if (jform_vvvvvvwvvw_required)
{ {
updateFieldRequired('site_view',0); updateFieldRequired('site_view',0);
@ -98,11 +100,11 @@ function vvvvvvw(location_vvvvvvw)
jQuery('#jform_site_view').addClass('required'); jQuery('#jform_site_view').addClass('required');
jform_vvvvvvwvvw_required = false; jform_vvvvvvwvvw_required = false;
} }
} }
else else
{ {
jQuery('#jform_site_view').closest('.control-group').hide(); jQuery('#jform_site_view').closest('.control-group').hide();
// remove required attribute from site_view field
if (!jform_vvvvvvwvvw_required) if (!jform_vvvvvvwvvw_required)
{ {
updateFieldRequired('site_view',1); updateFieldRequired('site_view',1);
@ -134,6 +136,7 @@ function vvvvvvx(type_vvvvvvx)
if (type) if (type)
{ {
jQuery('#jform_url').closest('.control-group').show(); jQuery('#jform_url').closest('.control-group').show();
// add required attribute to url field
if (jform_vvvvvvxvvx_required) if (jform_vvvvvvxvvx_required)
{ {
updateFieldRequired('url',0); updateFieldRequired('url',0);
@ -142,11 +145,11 @@ function vvvvvvx(type_vvvvvvx)
jQuery('#jform_url').addClass('required'); jQuery('#jform_url').addClass('required');
jform_vvvvvvxvvx_required = false; jform_vvvvvvxvvx_required = false;
} }
} }
else else
{ {
jQuery('#jform_url').closest('.control-group').hide(); jQuery('#jform_url').closest('.control-group').hide();
// remove required attribute from url field
if (!jform_vvvvvvxvvx_required) if (!jform_vvvvvvxvvx_required)
{ {
updateFieldRequired('url',1); updateFieldRequired('url',1);
@ -189,6 +192,7 @@ function vvvvvvy(type_vvvvvvy)
if (type) if (type)
{ {
jQuery('#jform_article').closest('.control-group').show(); jQuery('#jform_article').closest('.control-group').show();
// add required attribute to article field
if (jform_vvvvvvyvvy_required) if (jform_vvvvvvyvvy_required)
{ {
updateFieldRequired('article',0); updateFieldRequired('article',0);
@ -197,11 +201,11 @@ function vvvvvvy(type_vvvvvvy)
jQuery('#jform_article').addClass('required'); jQuery('#jform_article').addClass('required');
jform_vvvvvvyvvy_required = false; jform_vvvvvvyvvy_required = false;
} }
} }
else else
{ {
jQuery('#jform_article').closest('.control-group').hide(); jQuery('#jform_article').closest('.control-group').hide();
// remove required attribute from article field
if (!jform_vvvvvvyvvy_required) if (!jform_vvvvvvyvvy_required)
{ {
updateFieldRequired('article',1); updateFieldRequired('article',1);
@ -244,6 +248,7 @@ function vvvvvvz(type_vvvvvvz)
if (type) if (type)
{ {
jQuery('#jform_content-lbl').closest('.control-group').show(); jQuery('#jform_content-lbl').closest('.control-group').show();
// add required attribute to content field
if (jform_vvvvvvzvvz_required) if (jform_vvvvvvzvvz_required)
{ {
updateFieldRequired('content',0); updateFieldRequired('content',0);
@ -252,11 +257,11 @@ function vvvvvvz(type_vvvvvvz)
jQuery('#jform_content').addClass('required'); jQuery('#jform_content').addClass('required');
jform_vvvvvvzvvz_required = false; jform_vvvvvvzvvz_required = false;
} }
} }
else else
{ {
jQuery('#jform_content-lbl').closest('.control-group').hide(); jQuery('#jform_content-lbl').closest('.control-group').hide();
// remove required attribute from content field
if (!jform_vvvvvvzvvz_required) if (!jform_vvvvvvzvvz_required)
{ {
updateFieldRequired('content',1); updateFieldRequired('content',1);
@ -286,6 +291,7 @@ function vvvvvwa(target_vvvvvwa)
if (target_vvvvvwa == 1) if (target_vvvvvwa == 1)
{ {
jQuery('#jform_groups').closest('.control-group').show(); jQuery('#jform_groups').closest('.control-group').show();
// add required attribute to groups field
if (jform_vvvvvwavwa_required) if (jform_vvvvvwavwa_required)
{ {
updateFieldRequired('groups',0); updateFieldRequired('groups',0);
@ -294,11 +300,11 @@ function vvvvvwa(target_vvvvvwa)
jQuery('#jform_groups').addClass('required'); jQuery('#jform_groups').addClass('required');
jform_vvvvvwavwa_required = false; jform_vvvvvwavwa_required = false;
} }
} }
else else
{ {
jQuery('#jform_groups').closest('.control-group').hide(); jQuery('#jform_groups').closest('.control-group').hide();
// remove required attribute from groups field
if (!jform_vvvvvwavwa_required) if (!jform_vvvvvwavwa_required)
{ {
updateFieldRequired('groups',1); updateFieldRequired('groups',1);

View File

@ -101,7 +101,8 @@
description="COM_QUESTIONSANSWERS_HELP_DOCUMENT_TYPE_DESCRIPTION" description="COM_QUESTIONSANSWERS_HELP_DOCUMENT_TYPE_DESCRIPTION"
class="list_class" class="list_class"
multiple="false" multiple="false"
required="true"> required="true"
default="">
<!-- Option Set. --> <!-- Option Set. -->
<option value=""> <option value="">
COM_QUESTIONSANSWERS_HELP_DOCUMENT_SELECT_AN_OPTION</option> COM_QUESTIONSANSWERS_HELP_DOCUMENT_SELECT_AN_OPTION</option>
@ -128,6 +129,7 @@
label="COM_QUESTIONSANSWERS_HELP_DOCUMENT_LOCATION_LABEL" label="COM_QUESTIONSANSWERS_HELP_DOCUMENT_LOCATION_LABEL"
description="COM_QUESTIONSANSWERS_HELP_DOCUMENT_LOCATION_DESCRIPTION" description="COM_QUESTIONSANSWERS_HELP_DOCUMENT_LOCATION_DESCRIPTION"
class="btn-group" class="btn-group"
default=""
required="true"> required="true">
<!-- Option Set. --> <!-- Option Set. -->
<option value="1"> <option value="1">
@ -143,6 +145,7 @@
description="COM_QUESTIONSANSWERS_HELP_DOCUMENT_ADMIN_VIEW_DESCRIPTION" description="COM_QUESTIONSANSWERS_HELP_DOCUMENT_ADMIN_VIEW_DESCRIPTION"
class="list_class" class="list_class"
multiple="false" multiple="false"
default=""
required="true" required="true"
button="false" button="false"
/> />
@ -154,6 +157,7 @@
description="COM_QUESTIONSANSWERS_HELP_DOCUMENT_SITE_VIEW_DESCRIPTION" description="COM_QUESTIONSANSWERS_HELP_DOCUMENT_SITE_VIEW_DESCRIPTION"
class="list_class" class="list_class"
multiple="false" multiple="false"
default=""
required="true" required="true"
button="false" button="false"
/> />
@ -191,6 +195,7 @@
label="COM_QUESTIONSANSWERS_HELP_DOCUMENT_URL_LABEL" label="COM_QUESTIONSANSWERS_HELP_DOCUMENT_URL_LABEL"
size="60" size="60"
maxlength="150" maxlength="150"
default=""
description="COM_QUESTIONSANSWERS_HELP_DOCUMENT_URL_DESCRIPTION" description="COM_QUESTIONSANSWERS_HELP_DOCUMENT_URL_DESCRIPTION"
class="text_area" class="text_area"
required="true" required="true"
@ -207,6 +212,7 @@
label="COM_QUESTIONSANSWERS_HELP_DOCUMENT_TARGET_LABEL" label="COM_QUESTIONSANSWERS_HELP_DOCUMENT_TARGET_LABEL"
description="COM_QUESTIONSANSWERS_HELP_DOCUMENT_TARGET_DESCRIPTION" description="COM_QUESTIONSANSWERS_HELP_DOCUMENT_TARGET_DESCRIPTION"
class="btn-group" class="btn-group"
default=""
required="true"> required="true">
<!-- Option Set. --> <!-- Option Set. -->
<option value="1"> <option value="1">

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage question_and_answer.js @subpackage question_and_answer.js
@ -97,8 +97,12 @@ function setFile(filename, fileFormat, target, type){
return true; return true;
} }
function removeFileCheck(clearServer, target, type){ function removeFileCheck(clearServer, target, type, uiVer){
UIkit.modal.confirm('Are you sure you want to delete this '+target+'?', function(){ removeFile(clearServer, target, 1, type); }); if (3 == uiVer) {
UIkit.modal.confirm('Are you sure you want to delete this '+target+'?').then(function(){ removeFile(clearServer, target, 1, type); });
} else {
UIkit2.modal.confirm('Are you sure you want to delete this '+target+'?', function(){ removeFile(clearServer, target, 1, type); });
}
} }
function removeFile(clearServer, target, flush, type){ function removeFile(clearServer, target, flush, type){
@ -135,16 +139,16 @@ function removeFile(clearServer, target, flush, type){
} }
function removeFile_server(currentFileName, target, flush, type){ function removeFile_server(currentFileName, target, flush, type){
var getUrl = JRouter("index.php?option=com_questionsanswers&task=ajax.removeFile&format=json&vdm="+vastDevMod); var getUrl = JRouter("index.php?option=com_questionsanswers&task=ajax.removeFile&format=json&raw=true&vdm="+vastDevMod);
if(token.length > 0 && target.length > 0 && type.length > 0){ if(token.length > 0 && target.length > 0 && type.length > 0){
var request = 'token='+token+'&filename='+currentFileName+'&target='+target+'&flush='+flush+'&type='+type; var request = 'token='+token+'&filename='+currentFileName+'&target='+target+'&flush='+flush+'&type='+type;
} }
return jQuery.ajax({ return jQuery.ajax({
type: 'GET', type: 'GET',
url: getUrl, url: getUrl,
dataType: 'jsonp', dataType: 'json',
data: request, data: request,
jsonp: 'callback' jsonp: false
}); });
} }
function isJsonString(str) { function isJsonString(str) {

View File

@ -110,6 +110,7 @@
label="COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_QUESTION_LABEL" label="COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_QUESTION_LABEL"
rows="2" rows="2"
cols="5" cols="5"
default=""
description="COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_QUESTION_DESCRIPTION" description="COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_QUESTION_DESCRIPTION"
class="text_area span12" class="text_area span12"
filter="STRING" filter="STRING"
@ -121,6 +122,7 @@
type="editor" type="editor"
name="answer" name="answer"
label="COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_ANSWER_LABEL" label="COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_ANSWER_LABEL"
default=""
width="100%" width="100%"
height="500" height="500"
buttons="false" buttons="false"
@ -134,6 +136,7 @@
name="catid" name="catid"
label="COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_CATID_LABEL" label="COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_CATID_LABEL"
extension="com_questionsanswers.questions_and_answers" extension="com_questionsanswers.questions_and_answers"
default=""
description="COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_CATID_DESCRIPTION" description="COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_CATID_DESCRIPTION"
class="inputbox" class="inputbox"
/> />

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage help_document.php @subpackage help_document.php
@ -28,9 +28,6 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
// import Joomla modelform library
jimport('joomla.application.component.modeladmin');
/** /**
* Questionsanswers Help_document Model * Questionsanswers Help_document Model
*/ */
@ -63,6 +60,9 @@ class QuestionsanswersModelHelp_document extends JModelAdmin
*/ */
public function getTable($type = 'help_document', $prefix = 'QuestionsanswersTable', $config = array()) public function getTable($type = 'help_document', $prefix = 'QuestionsanswersTable', $config = array())
{ {
// add table path for when model gets used from other component
$this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_questionsanswers/tables');
// get instance of the table
return JTable::getInstance($type, $prefix, $config); return JTable::getInstance($type, $prefix, $config);
} }
@ -116,15 +116,18 @@ class QuestionsanswersModelHelp_document extends JModelAdmin
* *
* @param array $data Data for the form. * @param array $data Data for the form.
* @param boolean $loadData True if the form is to load its own data (default case), false if not. * @param boolean $loadData True if the form is to load its own data (default case), false if not.
* @param array $options Optional array of options for the form creation.
* *
* @return mixed A JForm object on success, false on failure * @return mixed A JForm object on success, false on failure
* *
* @since 1.6 * @since 1.6
*/ */
public function getForm($data = array(), $loadData = true) public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform'))
{ {
// set load data option
$options['load_data'] = $loadData;
// Get the form. // Get the form.
$form = $this->loadForm('com_questionsanswers.help_document', 'help_document', array('control' => 'jform', 'load_data' => $loadData)); $form = $this->loadForm('com_questionsanswers.help_document', 'help_document', $options);
if (empty($form)) if (empty($form))
{ {
@ -185,17 +188,20 @@ class QuestionsanswersModelHelp_document extends JModelAdmin
// Only load these values if no id is found // Only load these values if no id is found
if (0 == $id) if (0 == $id)
{ {
// Set redirected field name // Set redirected view name
$redirectedField = $jinput->get('ref', null, 'STRING'); $redirectedView = $jinput->get('ref', null, 'STRING');
// Set redirected field value // Set field name (or fall back to view name)
$redirectedValue = $jinput->get('refid', 0, 'INT'); $redirectedField = $jinput->get('field', $redirectedView, 'STRING');
// Set redirected view id
$redirectedId = $jinput->get('refid', 0, 'INT');
// Set field id (or fall back to redirected view id)
$redirectedValue = $jinput->get('field_id', $redirectedId, 'INT');
if (0 != $redirectedValue && $redirectedField) if (0 != $redirectedValue && $redirectedField)
{ {
// Now set the local-redirected field default value // Now set the local-redirected field default value
$form->setValue($redirectedField, null, $redirectedValue); $form->setValue($redirectedField, null, $redirectedValue);
} }
} }
return $form; return $form;
} }

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage help_documents.php @subpackage help_documents.php
@ -26,9 +26,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import the Joomla modellist library
jimport('joomla.application.component.modellist');
/** /**
* Help_documents Model * Help_documents Model
*/ */
@ -122,11 +119,9 @@ class QuestionsanswersModelHelp_documents extends JModelList
// set values to display correctly. // set values to display correctly.
if (QuestionsanswersHelper::checkArray($items)) if (QuestionsanswersHelper::checkArray($items))
{ {
// get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item) foreach ($items as $nr => &$item)
{ {
$access = ($user->authorise('help_document.access', 'com_questionsanswers.help_document.' . (int) $item->id) && $user->authorise('help_document.access', 'com_questionsanswers')); $access = (JFactory::getUser()->authorise('help_document.access', 'com_questionsanswers.help_document.' . (int) $item->id) && JFactory::getUser()->authorise('help_document.access', 'com_questionsanswers'));
if (!$access) if (!$access)
{ {
unset($items[$nr]); unset($items[$nr]);
@ -325,11 +320,9 @@ class QuestionsanswersModelHelp_documents extends JModelList
// set values to display correctly. // set values to display correctly.
if (QuestionsanswersHelper::checkArray($items)) if (QuestionsanswersHelper::checkArray($items))
{ {
// get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item) foreach ($items as $nr => &$item)
{ {
$access = ($user->authorise('help_document.access', 'com_questionsanswers.help_document.' . (int) $item->id) && $user->authorise('help_document.access', 'com_questionsanswers')); $access = (JFactory::getUser()->authorise('help_document.access', 'com_questionsanswers.help_document.' . (int) $item->id) && JFactory::getUser()->authorise('help_document.access', 'com_questionsanswers'));
if (!$access) if (!$access)
{ {
unset($items[$nr]); unset($items[$nr]);

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage import.php @subpackage import.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage question_and_answer.php @subpackage question_and_answer.php
@ -28,9 +28,6 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
// import Joomla modelform library
jimport('joomla.application.component.modeladmin');
/** /**
* Questionsanswers Question_and_answer Model * Questionsanswers Question_and_answer Model
*/ */
@ -63,6 +60,9 @@ class QuestionsanswersModelQuestion_and_answer extends JModelAdmin
*/ */
public function getTable($type = 'question_and_answer', $prefix = 'QuestionsanswersTable', $config = array()) public function getTable($type = 'question_and_answer', $prefix = 'QuestionsanswersTable', $config = array())
{ {
// add table path for when model gets used from other component
$this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_questionsanswers/tables');
// get instance of the table
return JTable::getInstance($type, $prefix, $config); return JTable::getInstance($type, $prefix, $config);
} }
@ -86,9 +86,14 @@ class QuestionsanswersModelQuestion_and_answer extends JModelAdmin
} }
else else
{ {
// set the vast development method key
$this->vastDevMod = QuestionsanswersHelper::randomkey(50); $this->vastDevMod = QuestionsanswersHelper::randomkey(50);
QuestionsanswersHelper::set($this->vastDevMod, 'question_and_answer__'.$id); QuestionsanswersHelper::set($this->vastDevMod, 'question_and_answer__'.$id);
QuestionsanswersHelper::set('question_and_answer__'.$id, $this->vastDevMod); QuestionsanswersHelper::set('question_and_answer__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
QuestionsanswersHelper::set($this->vastDevMod . '__return', $return);
} }
} }
return $this->vastDevMod; return $this->vastDevMod;
@ -156,9 +161,14 @@ class QuestionsanswersModelQuestion_and_answer extends JModelAdmin
} }
else else
{ {
// set the vast development method key
$this->vastDevMod = QuestionsanswersHelper::randomkey(50); $this->vastDevMod = QuestionsanswersHelper::randomkey(50);
QuestionsanswersHelper::set($this->vastDevMod, 'question_and_answer__'.$id); QuestionsanswersHelper::set($this->vastDevMod, 'question_and_answer__'.$id);
QuestionsanswersHelper::set('question_and_answer__'.$id, $this->vastDevMod); QuestionsanswersHelper::set('question_and_answer__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
QuestionsanswersHelper::set($this->vastDevMod . '__return', $return);
} }
// build download links // build download links
$item->links = array(); $item->links = array();
@ -209,15 +219,18 @@ class QuestionsanswersModelQuestion_and_answer extends JModelAdmin
* *
* @param array $data Data for the form. * @param array $data Data for the form.
* @param boolean $loadData True if the form is to load its own data (default case), false if not. * @param boolean $loadData True if the form is to load its own data (default case), false if not.
* @param array $options Optional array of options for the form creation.
* *
* @return mixed A JForm object on success, false on failure * @return mixed A JForm object on success, false on failure
* *
* @since 1.6 * @since 1.6
*/ */
public function getForm($data = array(), $loadData = true) public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform'))
{ {
// set load data option
$options['load_data'] = $loadData;
// Get the form. // Get the form.
$form = $this->loadForm('com_questionsanswers.question_and_answer', 'question_and_answer', array('control' => 'jform', 'load_data' => $loadData)); $form = $this->loadForm('com_questionsanswers.question_and_answer', 'question_and_answer', $options);
if (empty($form)) if (empty($form))
{ {
@ -285,6 +298,7 @@ class QuestionsanswersModelQuestion_and_answer extends JModelAdmin
$form->setFieldAttribute('question', 'disabled', 'true'); $form->setFieldAttribute('question', 'disabled', 'true');
// Disable fields for display. // Disable fields for display.
$form->setFieldAttribute('question', 'readonly', 'true'); $form->setFieldAttribute('question', 'readonly', 'true');
// If there is no value continue.
if (!$form->getValue('question')) if (!$form->getValue('question'))
{ {
// Disable fields while saving. // Disable fields while saving.
@ -301,6 +315,7 @@ class QuestionsanswersModelQuestion_and_answer extends JModelAdmin
$form->setFieldAttribute('answer', 'disabled', 'true'); $form->setFieldAttribute('answer', 'disabled', 'true');
// Disable fields for display. // Disable fields for display.
$form->setFieldAttribute('answer', 'readonly', 'true'); $form->setFieldAttribute('answer', 'readonly', 'true');
// If there is no value continue.
if (!$form->getValue('answer')) if (!$form->getValue('answer'))
{ {
// Disable fields while saving. // Disable fields while saving.
@ -317,6 +332,7 @@ class QuestionsanswersModelQuestion_and_answer extends JModelAdmin
$form->setFieldAttribute('catid', 'disabled', 'true'); $form->setFieldAttribute('catid', 'disabled', 'true');
// Disable fields for display. // Disable fields for display.
$form->setFieldAttribute('catid', 'readonly', 'true'); $form->setFieldAttribute('catid', 'readonly', 'true');
// If there is no value continue.
if (!$form->getValue('catid')) if (!$form->getValue('catid'))
{ {
// Disable fields while saving. // Disable fields while saving.
@ -333,6 +349,7 @@ class QuestionsanswersModelQuestion_and_answer extends JModelAdmin
$form->setFieldAttribute('answer_documents', 'disabled', 'true'); $form->setFieldAttribute('answer_documents', 'disabled', 'true');
// Disable fields for display. // Disable fields for display.
$form->setFieldAttribute('answer_documents', 'readonly', 'true'); $form->setFieldAttribute('answer_documents', 'readonly', 'true');
// If there is no value continue.
if (!$form->getValue('answer_documents')) if (!$form->getValue('answer_documents'))
{ {
// Disable fields while saving. // Disable fields while saving.
@ -349,6 +366,7 @@ class QuestionsanswersModelQuestion_and_answer extends JModelAdmin
$form->setFieldAttribute('main_image_uploader', 'disabled', 'true'); $form->setFieldAttribute('main_image_uploader', 'disabled', 'true');
// Disable fields for display. // Disable fields for display.
$form->setFieldAttribute('main_image_uploader', 'readonly', 'true'); $form->setFieldAttribute('main_image_uploader', 'readonly', 'true');
// If there is no value continue.
if (!$form->getValue('main_image_uploader')) if (!$form->getValue('main_image_uploader'))
{ {
// Disable fields while saving. // Disable fields while saving.
@ -360,17 +378,20 @@ class QuestionsanswersModelQuestion_and_answer extends JModelAdmin
// Only load these values if no id is found // Only load these values if no id is found
if (0 == $id) if (0 == $id)
{ {
// Set redirected field name // Set redirected view name
$redirectedField = $jinput->get('ref', null, 'STRING'); $redirectedView = $jinput->get('ref', null, 'STRING');
// Set redirected field value // Set field name (or fall back to view name)
$redirectedValue = $jinput->get('refid', 0, 'INT'); $redirectedField = $jinput->get('field', $redirectedView, 'STRING');
// Set redirected view id
$redirectedId = $jinput->get('refid', 0, 'INT');
// Set field id (or fall back to redirected view id)
$redirectedValue = $jinput->get('field_id', $redirectedId, 'INT');
if (0 != $redirectedValue && $redirectedField) if (0 != $redirectedValue && $redirectedField)
{ {
// Now set the local-redirected field default value // Now set the local-redirected field default value
$form->setValue($redirectedField, null, $redirectedValue); $form->setValue($redirectedField, null, $redirectedValue);
} }
} }
return $form; return $form;
} }

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage questions_and_answers.php @subpackage questions_and_answers.php
@ -26,9 +26,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import the Joomla modellist library
jimport('joomla.application.component.modellist');
/** /**
* Questions_and_answers Model * Questions_and_answers Model
*/ */
@ -110,11 +107,9 @@ class QuestionsanswersModelQuestions_and_answers extends JModelList
// set values to display correctly. // set values to display correctly.
if (QuestionsanswersHelper::checkArray($items)) if (QuestionsanswersHelper::checkArray($items))
{ {
// get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item) foreach ($items as $nr => &$item)
{ {
$access = ($user->authorise('question_and_answer.access', 'com_questionsanswers.question_and_answer.' . (int) $item->id) && $user->authorise('question_and_answer.access', 'com_questionsanswers')); $access = (JFactory::getUser()->authorise('question_and_answer.access', 'com_questionsanswers.question_and_answer.' . (int) $item->id) && JFactory::getUser()->authorise('question_and_answer.access', 'com_questionsanswers'));
if (!$access) if (!$access)
{ {
unset($items[$nr]); unset($items[$nr]);
@ -272,11 +267,9 @@ class QuestionsanswersModelQuestions_and_answers extends JModelList
// set values to display correctly. // set values to display correctly.
if (QuestionsanswersHelper::checkArray($items)) if (QuestionsanswersHelper::checkArray($items))
{ {
// get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item) foreach ($items as $nr => &$item)
{ {
$access = ($user->authorise('question_and_answer.access', 'com_questionsanswers.question_and_answer.' . (int) $item->id) && $user->authorise('question_and_answer.access', 'com_questionsanswers')); $access = (JFactory::getUser()->authorise('question_and_answer.access', 'com_questionsanswers.question_and_answer.' . (int) $item->id) && JFactory::getUser()->authorise('question_and_answer.access', 'com_questionsanswers'));
if (!$access) if (!$access)
{ {
unset($items[$nr]); unset($items[$nr]);

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage questionsanswers.php @subpackage questionsanswers.php
@ -26,10 +26,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import the Joomla modellist library
jimport('joomla.application.component.modellist');
jimport('joomla.application.component.helper');
/** /**
* Questionsanswers Model * Questionsanswers Model
*/ */

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage questionsanswers.php @subpackage questionsanswers.php
@ -25,33 +25,26 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.tabstate');
// Access check. // Access check.
if (!JFactory::getUser()->authorise('core.manage', 'com_questionsanswers')) if (!JFactory::getUser()->authorise('core.manage', 'com_questionsanswers'))
{ {
return JError::raiseWaring(404, JText::_('JERROR_ALERTNOAUTHOR')); throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403);
}; };
// Load cms libraries
JLoader::registerPrefix('J', JPATH_PLATFORM . '/cms');
// Load joomla libraries without overwrite
JLoader::registerPrefix('J', JPATH_PLATFORM . '/joomla',false);
// Add CSS file for all pages // Add CSS file for all pages
$document = JFactory::getDocument(); $document = JFactory::getDocument();
$document->addStyleSheet('components/com_questionsanswers/assets/css/admin.css'); $document->addStyleSheet('components/com_questionsanswers/assets/css/admin.css');
$document->addScript('components/com_questionsanswers/assets/js/admin.js'); $document->addScript('components/com_questionsanswers/assets/js/admin.js');
// require helper files // require helper files
JLoader::register('QuestionsanswersHelper', dirname(__FILE__) . '/helpers/questionsanswers.php'); JLoader::register('QuestionsanswersHelper', __DIR__ . '/helpers/questionsanswers.php');
JLoader::register('JHtmlBatch_', dirname(__FILE__) . '/helpers/html/batch_.php'); JLoader::register('JHtmlBatch_', __DIR__ . '/helpers/html/batch_.php');
// Triger the Global Admin Event // Triger the Global Admin Event
QuestionsanswersHelper::globalEvent($document); QuestionsanswersHelper::globalEvent($document);
// import joomla controller library
jimport('joomla.application.component.controller');
// Get an instance of the controller prefixed by Questionsanswers // Get an instance of the controller prefixed by Questionsanswers
$controller = JControllerLegacy::getInstance('Questionsanswers'); $controller = JControllerLegacy::getInstance('Questionsanswers');

View File

@ -28,7 +28,7 @@ CREATE TABLE IF NOT EXISTS `#__questionsanswers_question_and_answer` (
KEY `idx_modifiedby` (`modified_by`), KEY `idx_modifiedby` (`modified_by`),
KEY `idx_state` (`published`), KEY `idx_state` (`published`),
KEY `idx_catid` (`catid`) KEY `idx_catid` (`catid`)
) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `#__questionsanswers_help_document` ( CREATE TABLE IF NOT EXISTS `#__questionsanswers_help_document` (
`id` INT(11) NOT NULL AUTO_INCREMENT, `id` INT(11) NOT NULL AUTO_INCREMENT,
@ -67,7 +67,7 @@ CREATE TABLE IF NOT EXISTS `#__questionsanswers_help_document` (
KEY `idx_article` (`article`), KEY `idx_article` (`article`),
KEY `idx_target` (`target`), KEY `idx_target` (`target`),
KEY `idx_alias` (`alias`) KEY `idx_alias` (`alias`)
) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage help_document.php @subpackage help_document.php
@ -28,9 +28,6 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
// import Joomla table library
jimport('joomla.database.table');
/** /**
* Help_documents Table class * Help_documents Table class
*/ */
@ -237,7 +234,7 @@ class QuestionsanswersTableHelp_document extends JTable
{ {
// asset alread set so use saved rules // asset alread set so use saved rules
$assetId = (int) $db->loadResult(); $assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId); return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
} }
// try again // try again
elseif ($try) elseif ($try)

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage question_and_answer.php @subpackage question_and_answer.php
@ -28,9 +28,6 @@ defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry; use Joomla\Registry\Registry;
// import Joomla table library
jimport('joomla.database.table');
/** /**
* Questions_and_answers Table class * Questions_and_answers Table class
*/ */
@ -237,7 +234,7 @@ class QuestionsanswersTableQuestion_and_answer extends JTable
{ {
// asset alread set so use saved rules // asset alread set so use saved rules
$assetId = (int) $db->loadResult(); $assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId); return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed.
} }
// try again // try again
elseif ($try) elseif ($try)

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage submitbutton.js @subpackage submitbutton.js

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage edit.php @subpackage edit.php
@ -31,7 +31,7 @@ JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation'); JHtml::_('behavior.formvalidation');
JHtml::_('formbehavior.chosen', 'select'); JHtml::_('formbehavior.chosen', 'select');
JHtml::_('behavior.keepalive'); JHtml::_('behavior.keepalive');
$componentParams = JComponentHelper::getParams('com_questionsanswers'); $componentParams = $this->params; // will be removed just use $this->params instead
?> ?>
<script type="text/javascript"> <script type="text/javascript">
// waiting spinner // waiting spinner
@ -56,7 +56,7 @@ $componentParams = JComponentHelper::getParams('com_questionsanswers');
}); });
</script> </script>
<div id="questionsanswers_loader" style="display: none;"> <div id="questionsanswers_loader" style="display: none;">
<form action="<?php echo JRoute::_('index.php?option=com_questionsanswers&layout=edit&id='.(int) $this->item->id.$this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data"> <form action="<?php echo JRoute::_('index.php?option=com_questionsanswers&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
<?php echo JLayoutHelper::render('help_document.details_above', $this); ?> <?php echo JLayoutHelper::render('help_document.details_above', $this); ?>
<div class="form-horizontal"> <div class="form-horizontal">
@ -79,6 +79,10 @@ $componentParams = JComponentHelper::getParams('com_questionsanswers');
</div> </div>
<?php echo JHtml::_('bootstrap.endTab'); ?> <?php echo JHtml::_('bootstrap.endTab'); ?>
<?php $this->ignore_fieldsets = array('details','metadata','vdmmetadata','accesscontrol'); ?>
<?php $this->tab_name = 'help_documentTab'; ?>
<?php echo JLayoutHelper::render('joomla.edit.params', $this); ?>
<?php if ($this->canDo->get('help_document.delete') || $this->canDo->get('core.edit.created_by') || $this->canDo->get('help_document.edit.state') || $this->canDo->get('core.edit.created')) : ?> <?php if ($this->canDo->get('help_document.delete') || $this->canDo->get('core.edit.created_by') || $this->canDo->get('help_document.edit.state') || $this->canDo->get('core.edit.created')) : ?>
<?php echo JHtml::_('bootstrap.addTab', 'help_documentTab', 'publishing', JText::_('COM_QUESTIONSANSWERS_HELP_DOCUMENT_PUBLISHING', true)); ?> <?php echo JHtml::_('bootstrap.addTab', 'help_documentTab', 'publishing', JText::_('COM_QUESTIONSANSWERS_HELP_DOCUMENT_PUBLISHING', true)); ?>
<div class="row-fluid form-horizontal-desktop"> <div class="row-fluid form-horizontal-desktop">

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage view.html.php @subpackage view.html.php
@ -26,9 +26,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla view library
jimport('joomla.application.component.view');
/** /**
* Help_document View class * Help_document View class
*/ */
@ -40,27 +37,37 @@ class QuestionsanswersViewHelp_document extends JViewLegacy
*/ */
public function display($tpl = null) public function display($tpl = null)
{ {
// set params
$this->params = JComponentHelper::getParams('com_questionsanswers');
// Assign the variables // Assign the variables
$this->form = $this->get('Form'); $this->form = $this->get('Form');
$this->item = $this->get('Item'); $this->item = $this->get('Item');
$this->script = $this->get('Script'); $this->script = $this->get('Script');
$this->state = $this->get('State'); $this->state = $this->get('State');
// get action permissions // get action permissions
$this->canDo = QuestionsanswersHelper::getActions('help_document',$this->item); $this->canDo = QuestionsanswersHelper::getActions('help_document', $this->item);
// get input // get input
$jinput = JFactory::getApplication()->input; $jinput = JFactory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word'); $this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int'); $this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = ''; $this->referral = '';
if ($this->refid) if ($this->refid && $this->ref)
{ {
// return to the item that refered to this item // return to the item that referred to this item
$this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid; $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid;
} }
elseif($this->ref) elseif($this->ref)
{ {
// return to the list view that refered to this item // return to the list view that referred to this item
$this->referral = '&ref='.(string)$this->ref; $this->referral = '&ref=' . (string)$this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string)$return;
} }
// Set the toolbar // Set the toolbar
@ -92,7 +99,7 @@ class QuestionsanswersViewHelp_document extends JViewLegacy
JToolbarHelper::title( JText::_($isNew ? 'COM_QUESTIONSANSWERS_HELP_DOCUMENT_NEW' : 'COM_QUESTIONSANSWERS_HELP_DOCUMENT_EDIT'), 'pencil-2 article-add'); JToolbarHelper::title( JText::_($isNew ? 'COM_QUESTIONSANSWERS_HELP_DOCUMENT_NEW' : 'COM_QUESTIONSANSWERS_HELP_DOCUMENT_EDIT'), 'pencil-2 article-add');
// Built the actions for new and existing records. // Built the actions for new and existing records.
if ($this->refid || $this->ref) if (QuestionsanswersHelper::checkString($this->referral))
{ {
if ($this->canDo->get('help_document.create') && $isNew) if ($this->canDo->get('help_document.create') && $isNew)
{ {

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage default.php @subpackage default.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage default_batch_body.php @subpackage default_batch_body.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage default_batch_footer.php @subpackage default_batch_footer.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage default_body.php @subpackage default_body.php
@ -75,16 +75,16 @@ $edit = "index.php?option=com_questionsanswers&view=help_documents&task=help_doc
<?php endif; ?> <?php endif; ?>
</td> </td>
<td class="nowrap"> <td class="nowrap">
<?php if ($canDo->get('help_document.edit')): ?>
<div class="name"> <div class="name">
<?php if ($canDo->get('help_document.edit')): ?>
<a href="<?php echo $edit; ?>&id=<?php echo $item->id; ?>"><?php echo $this->escape($item->title); ?></a> <a href="<?php echo $edit; ?>&id=<?php echo $item->id; ?>"><?php echo $this->escape($item->title); ?></a>
<?php if ($item->checked_out): ?> <?php if ($item->checked_out): ?>
<?php echo JHtml::_('jgrid.checkedout', $i, $userChkOut->name, $item->checked_out_time, 'help_documents.', $canCheckin); ?> <?php echo JHtml::_('jgrid.checkedout', $i, $userChkOut->name, $item->checked_out_time, 'help_documents.', $canCheckin); ?>
<?php endif; ?> <?php endif; ?>
</div>
<?php else: ?> <?php else: ?>
<div class="name"><?php echo $this->escape($item->title); ?></div> <?php echo $this->escape($item->title); ?>
<?php endif; ?> <?php endif; ?>
</div>
</td> </td>
<td class="hidden-phone"> <td class="hidden-phone">
<?php echo JText::_($item->type); ?> <?php echo JText::_($item->type); ?>

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage default_foot.php @subpackage default_foot.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage default_head.php @subpackage default_head.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage default_toolbar.php @subpackage default_toolbar.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage view.html.php @subpackage view.html.php
@ -26,9 +26,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla view library
jimport('joomla.application.component.view');
/** /**
* Questionsanswers View class for the Help_documents * Questionsanswers View class for the Help_documents
*/ */
@ -54,6 +51,8 @@ class QuestionsanswersViewHelp_documents extends JViewLegacy
$this->listOrder = $this->escape($this->state->get('list.ordering')); $this->listOrder = $this->escape($this->state->get('list.ordering'));
$this->listDirn = $this->escape($this->state->get('list.direction')); $this->listDirn = $this->escape($this->state->get('list.direction'));
$this->saveOrder = $this->listOrder == 'ordering'; $this->saveOrder = $this->listOrder == 'ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) JUri::getInstance()));
// get global action permissions // get global action permissions
$this->canDo = QuestionsanswersHelper::getActions('help_document'); $this->canDo = QuestionsanswersHelper::getActions('help_document');
$this->canEdit = $this->canDo->get('help_document.edit'); $this->canEdit = $this->canDo->get('help_document.edit');
@ -246,7 +245,7 @@ class QuestionsanswersViewHelp_documents extends JViewLegacy
} }
// Set Admin View Selection // Set Admin View Selection
$this->admin_viewOptions = JFormHelper::loadFieldType('Adminviewfolderlist')->getOptions(); $this->admin_viewOptions = JFormHelper::loadFieldType('Adminviewfolderlist')->options;
if ($this->admin_viewOptions) if ($this->admin_viewOptions)
{ {
// Admin View Filter // Admin View Filter
@ -268,7 +267,7 @@ class QuestionsanswersViewHelp_documents extends JViewLegacy
} }
// Set Site View Selection // Set Site View Selection
$this->site_viewOptions = JFormHelper::loadFieldType('Siteviewfolderlist')->getOptions(); $this->site_viewOptions = JFormHelper::loadFieldType('Siteviewfolderlist')->options;
if ($this->site_viewOptions) if ($this->site_viewOptions)
{ {
// Site View Filter // Site View Filter

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage default.php @subpackage default.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage view.html.php @subpackage view.html.php
@ -26,9 +26,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla view library
jimport('joomla.application.component.view');
/** /**
* Questionsanswers Import View * Questionsanswers Import View
*/ */

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage submitbutton.js @subpackage submitbutton.js

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage edit.php @subpackage edit.php
@ -31,7 +31,7 @@ JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation'); JHtml::_('behavior.formvalidation');
JHtml::_('formbehavior.chosen', 'select'); JHtml::_('formbehavior.chosen', 'select');
JHtml::_('behavior.keepalive'); JHtml::_('behavior.keepalive');
$componentParams = JComponentHelper::getParams('com_questionsanswers'); $componentParams = $this->params; // will be removed just use $this->params instead
?> ?>
<script type="text/javascript"> <script type="text/javascript">
// waiting spinner // waiting spinner
@ -56,7 +56,7 @@ $componentParams = JComponentHelper::getParams('com_questionsanswers');
}); });
</script> </script>
<div id="questionsanswers_loader" style="display: none;"> <div id="questionsanswers_loader" style="display: none;">
<form action="<?php echo JRoute::_('index.php?option=com_questionsanswers&layout=edit&id='.(int) $this->item->id.$this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data"> <form action="<?php echo JRoute::_('index.php?option=com_questionsanswers&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
<div class="form-horizontal"> <div class="form-horizontal">
<div class="span9"> <div class="span9">
@ -73,6 +73,10 @@ $componentParams = JComponentHelper::getParams('com_questionsanswers');
</div> </div>
<?php echo JHtml::_('bootstrap.endTab'); ?> <?php echo JHtml::_('bootstrap.endTab'); ?>
<?php $this->ignore_fieldsets = array('details','metadata','vdmmetadata','accesscontrol'); ?>
<?php $this->tab_name = 'question_and_answerTab'; ?>
<?php echo JLayoutHelper::render('joomla.edit.params', $this); ?>
<?php if ($this->canDo->get('question_and_answer.delete') || $this->canDo->get('question_and_answer.edit.created_by') || $this->canDo->get('question_and_answer.edit.state') || $this->canDo->get('question_and_answer.edit.created')) : ?> <?php if ($this->canDo->get('question_and_answer.delete') || $this->canDo->get('question_and_answer.edit.created_by') || $this->canDo->get('question_and_answer.edit.state') || $this->canDo->get('question_and_answer.edit.created')) : ?>
<?php echo JHtml::_('bootstrap.addTab', 'question_and_answerTab', 'publishing', JText::_('COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_PUBLISHING', true)); ?> <?php echo JHtml::_('bootstrap.addTab', 'question_and_answerTab', 'publishing', JText::_('COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_PUBLISHING', true)); ?>
<div class="row-fluid form-horizontal-desktop"> <div class="row-fluid form-horizontal-desktop">
@ -126,9 +130,41 @@ $componentParams = JComponentHelper::getParams('com_questionsanswers');
<?php if ($formats = $componentParams->get('image_formats', null)) : ?> <?php if ($formats = $this->params->get('image_formats', null)) : ?>
jQuery(function($){ <?php $uikitVersion = $this->params->get('uikit_version', 2); // get Uikit Version ?>
var progressbar = $("#progressbar-main-image"), // set some details
var sizeNotice = '';
<?php if ($resize = $this->params->get('crop_main', null)) : ?>
var sizemain = '(';
<?php if ($width = $this->params->get('main_width', null)): ?>
sizemain += 'width: <?php echo $width; ?>px';
<?php else: ?>
sizemain += 'width: <?php echo JText::_('COM_QUESTIONSANSWERS_PROPORTIONALLY'); ?>';
<?php endif; ?>
<?php if ($height = $this->params->get('main_height', null)): ?>
sizemain += ' height: <?php echo $height; ?>px';
<?php else: ?>
sizemain += ' height: <?php echo JText::_('COM_QUESTIONSANSWERS_PROPORTIONALLY'); ?>';
<?php endif; ?>
sizemain += ')';
<?php if (2 == $uikitVersion) : ?>
sizeNotice = '<span data-uk-tooltip title="<?php echo JText::_('COM_QUESTIONSANSWERS_THE_MAIN_WILL_BE_CROPPED_TO_THIS_SIZE'); ?>">'+sizemain+'</span>';
<?php else: ?>
sizeNotice = '<span uk-tooltip title="<?php echo JText::_('COM_QUESTIONSANSWERS_THE_MAIN_WILL_BE_CROPPED_TO_THIS_SIZE'); ?>">'+sizemain+'</span>';
<?php endif; ?>
<?php endif; ?>
// load the UIKIT script
<?php if (2 == $uikitVersion) : ?>
// load uikit 2 uploader script
jQuery(function($){
// prep the placeholder uploading divs
$('#uikittwo-main-image-uploader').show();
$('#uikitthree-main-image-uploader').remove();
$('#error-main-image-uploader').remove();
$('#size-main').html(sizeNotice);
$('#main-image-formats').html('<b><?php echo implode(', ', $formats); ?></b>');
// get progressbar
var progressbar = $("#uikittwo-progressbar-main-image"),
bar = progressbar.find('.uk-progress-bar'), bar = progressbar.find('.uk-progress-bar'),
settings = { settings = {
@ -160,35 +196,101 @@ jQuery(function($){
setFilekey(response.success, response.fileformat, 'main', 'image'); setFilekey(response.success, response.fileformat, 'main', 'image');
} }
} }
}; };
var select = UIkit.uploadSelect($("#upload-select-main-image"), settings), var select = UIkit2.uploadSelect($("#uikittwo-upload-select-main-image"), settings),
drop = UIkit.uploadDrop($("#upload-drop-main-image"), settings); drop = UIkit2.uploadDrop($("#uikittwo-upload-drop-main-image"), settings);
}); });
jQuery('#main-image-formats').html('<b><?php echo implode(', ', $formats); ?></b>');
<?php if ($resize = $componentParams->get('crop_main', null)) : ?>
var sizemain = '(';
<?php if ($width = $componentParams->get('main_width', null)): ?>
sizemain += 'width: <?php echo $width; ?>px';
<?php else: ?> <?php else: ?>
sizemain += 'width: <?php echo JText::_('COM_QUESTIONSANSWERS_PROPORTIONALLY'); ?>'; // load uikit 3 uploader script
jQuery(function($){
// prep the placeholder uploading divs
$('#uikitthree-main-image-uploader').show();
$('#uikittwo-main-image-uploader').remove();
$('#error-main-image-uploader').remove();
$('#size-main').html(sizeNotice);
$('#main-image-formats').html('<b><?php echo implode(', ', $formats); ?></b>');
// get progressbar
var bar = document.getElementById('uikitthree-progressbar-main-image');
UIkit.upload('#uikitthree-upload-main-image', {
url: JRouter('index.php?option=com_questionsanswers&task=ajax.uploadfile&format=json&type=image&target=main&raw=true&token='+token+'&vdm='+vastDevMod), // upload url
multiple: true,
allow : '*.(<?php echo implode('|', $formats); ?>)', // allow uploads
beforeSend: function (environment) {
// console.log('beforeSend', arguments);
// The environment object can still be modified here.
// var {data, method, headers, xhr, responseType} = environment;
},
beforeAll: function () {
// console.log('beforeAll', arguments);
},
load: function () {
// console.log('load', arguments);
},
error: function () {
// console.log('error', arguments);
},
complete: function () {
// console.log('complete', arguments);
},
loadStart: function (e) {
jQuery(".success-main-image-8768").remove();
bar.removeAttribute('hidden');
bar.max = e.total;
bar.value = e.loaded;
},
progress: function (e) {
bar.max = e.total;
bar.value = e.loaded;
},
loadEnd: function (e) {
bar.max = e.total;
bar.value = e.loaded;
},
completeAll: function (response) {
setTimeout(function () {
bar.setAttribute('hidden', 'hidden');
}, 250);
// act upon the response
if (response.response) {
response = JSON.parse(response.response);
if (response.error){
alert(response.error);
} else if (response.success) {
// set the new file name and if another is found delete it
setFilekey(response.success, response.fileformat, 'main', 'image');
}
}
}
});
});
<?php endif; ?> <?php endif; ?>
<?php if ($height = $componentParams->get('main_height', null)): ?>
sizemain += ' height: <?php echo $height; ?>px';
<?php else: ?>
sizemain += ' height: <?php echo JText::_('COM_QUESTIONSANSWERS_PROPORTIONALLY'); ?>';
<?php endif; ?>
sizemain += ')';
sizeNotice = '<span data-uk-tooltip title="<?php echo JText::_('COM_QUESTIONSANSWERS_THE_MAIN_WILL_BE_CROPPED_TO_THIS_SIZE'); ?>">'+sizemain+'</span>';
jQuery('#size-main').html(sizeNotice);
<?php endif; ?>
<?php else: ?> <?php else: ?>
jQuery('#upload-drop-main-image').html('<b><?php echo JText::_('COM_QUESTIONSANSWERS_ALLOWED_IMAGE_FORMATS_ARE_NOT_SET_IN_THE_GLOBAL_SETTINGS_PLEASE_NOTIFY_YOUR_SYSTEM_ADMINISTRATOR'); ?></b>'); jQuery('#error-main-image-uploader').html('<b><?php echo JText::_('COM_QUESTIONSANSWERS_ALLOWED_IMAGE_FORMATS_ARE_NOT_SET_IN_THE_GLOBAL_SETTINGS_PLEASE_NOTIFY_YOUR_SYSTEM_ADMINISTRATOR'); ?></b>');
<?php endif; ?> <?php endif; ?>
<?php if ($formats = $componentParams->get('document_formats', null)) : ?> <?php if ($formats = $this->params->get('document_formats', null)) : ?>
jQuery(function($){ <?php $uikitVersion = $this->params->get('uikit_version', 2); // get Uikit Version ?>
var progressbar = $("#progressbar-answer-documents"), // load the UIKIT script
<?php if (2 == $uikitVersion) : ?>
// load uikit 2 uploader script
jQuery(function($){
// prep the placeholder uploading divs
$('#uikittwo-answer-documents-uploader').show();
$('#uikitthree-answer-documents-uploader').remove();
$('#error-answer-documents-uploader').remove();
$('#answer-documents-formats').html('<b><?php echo implode(', ', $formats); ?></b>');
// get progressbar
var progressbar = $("#uikittwo-progressbar-answer-documents"),
bar = progressbar.find('.uk-progress-bar'), bar = progressbar.find('.uk-progress-bar'),
settings = { settings = {
@ -216,20 +318,89 @@ jQuery(function($){
if (response.error){ if (response.error){
alert(response.error); alert(response.error);
} else if (response.success) { } else if (response.success) {
// load the link to the document links object
documentsLinks[response.key] = response.link;
// set the new file name and if another is found delete it // set the new file name and if another is found delete it
setFilekey(response.success, response.fileformat, 'answer', 'documents'); setFilekey(response.success, response.fileformat, 'answer', 'documents');
} }
} }
}; };
var select = UIkit.uploadSelect($("#upload-select-answer-documents"), settings), var select = UIkit2.uploadSelect($("#uikittwo-upload-select-answer-documents"), settings),
drop = UIkit.uploadDrop($("#upload-drop-answer-documents"), settings); drop = UIkit2.uploadDrop($("#uikittwo-upload-drop-answer-documents"), settings);
}); });
jQuery('#answer-documents-formats').html('<b><?php echo implode(', ', $formats); ?></b>'); <?php else: ?>
// load uikit 3 uploader script
jQuery(function($){
// prep the placeholder uploading divs
$('#uikitthree-answer-documents-uploader').show();
$('#uikittwo-answer-documents-uploader').remove();
$('#error-answer-documents-uploader').remove();
$('#answer-documents-formats').html('<b><?php echo implode(', ', $formats); ?></b>');
// get progressbar
var bar = document.getElementById('uikitthree-progressbar-answer-documents');
UIkit.upload('#uikitthree-upload-answer-documents', {
url: JRouter('index.php?option=com_questionsanswers&task=ajax.uploadfile&format=json&type=documents&target=answer&raw=true&token='+token+'&vdm='+vastDevMod), // upload url
multiple: true,
allow : '*.(<?php echo implode('|', $formats); ?>)', // allow uploads
beforeSend: function (environment) {
// console.log('beforeSend', arguments);
// The environment object can still be modified here.
// var {data, method, headers, xhr, responseType} = environment;
},
beforeAll: function () {
// console.log('beforeAll', arguments);
},
load: function () {
// console.log('load', arguments);
},
error: function () {
// console.log('error', arguments);
},
complete: function () {
// console.log('complete', arguments);
},
loadStart: function (e) {
jQuery(".success-answer-documents-8768").remove();
bar.removeAttribute('hidden');
bar.max = e.total;
bar.value = e.loaded;
},
progress: function (e) {
bar.max = e.total;
bar.value = e.loaded;
},
loadEnd: function (e) {
bar.max = e.total;
bar.value = e.loaded;
},
completeAll: function (response) {
setTimeout(function () {
bar.setAttribute('hidden', 'hidden');
}, 250);
// act upon the response
if (response.response) {
response = JSON.parse(response.response);
if (response.error){
alert(response.error);
} else if (response.success) {
// set the new file name and if another is found delete it
setFilekey(response.success, response.fileformat, 'answer', 'documents');
}
}
}
});
});
<?php endif; ?>
<?php else: ?> <?php else: ?>
jQuery('#upload-drop-answer-documents').html('<b><?php echo JText::_('COM_QUESTIONSANSWERS_ALLOWED_DOCUMENT_FORMATS_ARE_NOT_SET_IN_THE_GLOBAL_SETTINGS_PLEASE_NOTIFY_YOUR_SYSTEM_ADMINISTRATOR'); ?></b>'); jQuery('#error-answer-documents-uploader').html('<b><?php echo JText::_('COM_QUESTIONSANSWERS_ALLOWED_DOCUMENT_FORMATS_ARE_NOT_SET_IN_THE_GLOBAL_SETTINGS_PLEASE_NOTIFY_YOUR_SYSTEM_ADMINISTRATOR'); ?></b>');
<?php endif; ?> <?php endif; ?>
<?php <?php
@ -250,12 +421,14 @@ function JRouter(link) {
} }
function getFile(filename, fileFormat, target, type){ function getFile(filename, fileFormat, target, type){
// set uikit version
var uiVer = <?php echo (int) $this->params->get('uikit_version', 2); ?>;
// set the link // set the link
var link = '<?php echo QuestionsanswersHelper::getFolderPath('url'); ?>'; var link = '<?php echo QuestionsanswersHelper::getFolderPath('url'); ?>';
// build the return // build the return
if (type === 'image') { if (type === 'image') {
var thePath = link+filename+'.'+fileFormat; var thePath = link+filename+'.'+fileFormat;
var thedelete = '<button onclick="removeFileCheck(\''+filename+'\', \''+target+'\', \''+type+'\')" type="button" class="uk-button uk-width-1-1 uk-button-small uk-margin-small-bottom uk-button-danger"><i class="uk-icon-trash"></i> <?php echo JText::_('COM_QUESTIONSANSWERS_REMOVE'); ?> '+target+' '+type+'</button></div>'; var thedelete = '<button onclick="removeFileCheck(\''+filename+'\', \''+target+'\', \''+type+'\', \''+uiVer+'\')" type="button" class="uk-button uk-width-1-1 uk-button-small uk-margin-small-bottom uk-button-danger"><i class="uk-icon-trash"></i> <?php echo JText::_('COM_QUESTIONSANSWERS_REMOVE'); ?> '+target+' '+type+'</button></div>';
return '<img alt="'+target+' Image" src="'+thePath+'" /><br /><br />'+thedelete; return '<img alt="'+target+' Image" src="'+thePath+'" /><br /><br />'+thedelete;
} else if (type === 'images') { } else if (type === 'images') {
var imageNum = filename.length; var imageNum = filename.length;
@ -275,7 +448,7 @@ function getFile(filename, fileFormat, target, type){
imagesBox += '<div class="uk-panel">'; imagesBox += '<div class="uk-panel">';
var fileFormat = item.split('_')[2]; var fileFormat = item.split('_')[2];
var thePath = link+item+'.'+fileFormat; var thePath = link+item+'.'+fileFormat;
var thedelete = '<button onclick="removeFileCheck(\''+item+'\', \''+target+'\', \''+type+'\')" type="button" class="uk-button uk-width-1-1 uk-button-small uk-margin-small-bottom uk-button-danger"><i class="uk-icon-trash"></i> <?php echo JText::_('COM_QUESTIONSANSWERS_REMOVE'); ?> '+target+' '+type+'</button>'; var thedelete = '<button onclick="removeFileCheck(\''+item+'\', \''+target+'\', \''+type+'\', \''+uiVer+'\')" type="button" class="uk-button uk-width-1-1 uk-button-small uk-margin-small-bottom uk-button-danger"><i class="uk-icon-trash"></i> <?php echo JText::_('COM_QUESTIONSANSWERS_REMOVE'); ?> '+target+' '+type+'</button>';
imagesBox += '<img alt="'+target+' Image" src="'+thePath+'" /><br /><br />'+thedelete; imagesBox += '<img alt="'+target+' Image" src="'+thePath+'" /><br /><br />'+thedelete;
if (perRow == counter) { if (perRow == counter) {
counter = 0; counter = 0;
@ -316,7 +489,7 @@ function getFile(filename, fileFormat, target, type){
if (documentsLinks.hasOwnProperty(item)) { if (documentsLinks.hasOwnProperty(item)) {
thedownload = '<a href="'+JRouter(documentsLinks[item])+'" class="uk-button uk-width-1-1 uk-button-small uk-margin-small-bottom uk-button-success"><i class="uk-icon-download"></i> <?php echo JText::_('COM_QUESTIONSANSWERS_DOWNLOAD'); ?> '+fileName+'</a>'; thedownload = '<a href="'+JRouter(documentsLinks[item])+'" class="uk-button uk-width-1-1 uk-button-small uk-margin-small-bottom uk-button-success"><i class="uk-icon-download"></i> <?php echo JText::_('COM_QUESTIONSANSWERS_DOWNLOAD'); ?> '+fileName+'</a>';
} }
var thedelete = '<button onclick="removeFileCheck(\''+item+'\', \''+target+'\', \''+type+'\')" type="button" class="uk-button uk-width-1-1 uk-button-small uk-margin-small-bottom uk-button-danger"><i class="uk-icon-trash"></i> <?php echo JText::_('COM_QUESTIONSANSWERS_REMOVE'); ?> '+fileName+'</button>'; var thedelete = '<button onclick="removeFileCheck(\''+item+'\', \''+target+'\', \''+type+'\', \''+uiVer+'\')" type="button" class="uk-button uk-width-1-1 uk-button-small uk-margin-small-bottom uk-button-danger"><i class="uk-icon-trash"></i> <?php echo JText::_('COM_QUESTIONSANSWERS_REMOVE'); ?> '+fileName+'</button>';
fileBox += theplaceholder+thedownload+thedelete; fileBox += theplaceholder+thedownload+thedelete;
if (perRow == counter) { if (perRow == counter) {
counter = 0; counter = 0;
@ -342,7 +515,7 @@ function getFile(filename, fileFormat, target, type){
if (documentsLinks.hasOwnProperty(filename)) { if (documentsLinks.hasOwnProperty(filename)) {
thedownload = '<a href="'+JRouter(documentsLinks[filename])+'" class="uk-button uk-width-1-1 uk-button-small uk-margin-small-bottom uk-button-success"><i class="uk-icon-download"></i> <?php echo JText::_('COM_QUESTIONSANSWERS_DOWNLOAD'); ?> '+fileName+'</a>'; thedownload = '<a href="'+JRouter(documentsLinks[filename])+'" class="uk-button uk-width-1-1 uk-button-small uk-margin-small-bottom uk-button-success"><i class="uk-icon-download"></i> <?php echo JText::_('COM_QUESTIONSANSWERS_DOWNLOAD'); ?> '+fileName+'</a>';
} }
var thedelete = '<button onclick="removeFileCheck(\''+filename+'\', \''+target+'\', \''+type+'\')" type="button" class="uk-button uk-width-1-1 uk-button-small uk-margin-small-bottom uk-button-danger"><i class="uk-icon-trash"></i> <?php echo JText::_('COM_QUESTIONSANSWERS_REMOVE'); ?> '+fileName+'</button>'; var thedelete = '<button onclick="removeFileCheck(\''+filename+'\', \''+target+'\', \''+type+'\', \''+uiVer+'\')" type="button" class="uk-button uk-width-1-1 uk-button-small uk-margin-small-bottom uk-button-danger"><i class="uk-icon-trash"></i> <?php echo JText::_('COM_QUESTIONSANSWERS_REMOVE'); ?> '+fileName+'</button>';
return theplaceholder+thedownload+thedelete + '</div>'; return theplaceholder+thedownload+thedelete + '</div>';
} }
} }

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage view.html.php @subpackage view.html.php
@ -26,9 +26,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla view library
jimport('joomla.application.component.view');
/** /**
* Question_and_answer View class * Question_and_answer View class
*/ */
@ -40,27 +37,37 @@ class QuestionsanswersViewQuestion_and_answer extends JViewLegacy
*/ */
public function display($tpl = null) public function display($tpl = null)
{ {
// set params
$this->params = JComponentHelper::getParams('com_questionsanswers');
// Assign the variables // Assign the variables
$this->form = $this->get('Form'); $this->form = $this->get('Form');
$this->item = $this->get('Item'); $this->item = $this->get('Item');
$this->script = $this->get('Script'); $this->script = $this->get('Script');
$this->state = $this->get('State'); $this->state = $this->get('State');
// get action permissions // get action permissions
$this->canDo = QuestionsanswersHelper::getActions('question_and_answer',$this->item); $this->canDo = QuestionsanswersHelper::getActions('question_and_answer', $this->item);
// get input // get input
$jinput = JFactory::getApplication()->input; $jinput = JFactory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word'); $this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int'); $this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = ''; $this->referral = '';
if ($this->refid) if ($this->refid && $this->ref)
{ {
// return to the item that refered to this item // return to the item that referred to this item
$this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid; $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid;
} }
elseif($this->ref) elseif($this->ref)
{ {
// return to the list view that refered to this item // return to the list view that referred to this item
$this->referral = '&ref='.(string)$this->ref; $this->referral = '&ref=' . (string)$this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string)$return;
} }
// Set the toolbar // Set the toolbar
@ -92,7 +99,7 @@ class QuestionsanswersViewQuestion_and_answer extends JViewLegacy
JToolbarHelper::title( JText::_($isNew ? 'COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_NEW' : 'COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_EDIT'), 'pencil-2 article-add'); JToolbarHelper::title( JText::_($isNew ? 'COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_NEW' : 'COM_QUESTIONSANSWERS_QUESTION_AND_ANSWER_EDIT'), 'pencil-2 article-add');
// Built the actions for new and existing records. // Built the actions for new and existing records.
if ($this->refid || $this->ref) if (QuestionsanswersHelper::checkString($this->referral))
{ {
if ($this->canDo->get('question_and_answer.create') && $isNew) if ($this->canDo->get('question_and_answer.create') && $isNew)
{ {

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage default.php @subpackage default.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage default_batch_body.php @subpackage default_batch_body.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage default_batch_footer.php @subpackage default_batch_footer.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage default_body.php @subpackage default_body.php
@ -75,16 +75,16 @@ $edit = "index.php?option=com_questionsanswers&view=questions_and_answers&task=q
<?php endif; ?> <?php endif; ?>
</td> </td>
<td class="nowrap"> <td class="nowrap">
<?php if ($canDo->get('question_and_answer.edit')): ?>
<div class="name"> <div class="name">
<?php if ($canDo->get('question_and_answer.edit')): ?>
<a href="<?php echo $edit; ?>&id=<?php echo $item->id; ?>"><?php echo $this->escape($item->question); ?></a> <a href="<?php echo $edit; ?>&id=<?php echo $item->id; ?>"><?php echo $this->escape($item->question); ?></a>
<?php if ($item->checked_out): ?> <?php if ($item->checked_out): ?>
<?php echo JHtml::_('jgrid.checkedout', $i, $userChkOut->name, $item->checked_out_time, 'questions_and_answers.', $canCheckin); ?> <?php echo JHtml::_('jgrid.checkedout', $i, $userChkOut->name, $item->checked_out_time, 'questions_and_answers.', $canCheckin); ?>
<?php endif; ?> <?php endif; ?>
</div>
<?php else: ?> <?php else: ?>
<div class="name"><?php echo $this->escape($item->question); ?></div> <?php echo $this->escape($item->question); ?>
<?php endif; ?> <?php endif; ?>
</div>
</td> </td>
<td class="hidden-phone"> <td class="hidden-phone">
<?php echo $this->escape($item->answer); ?> <?php echo $this->escape($item->answer); ?>

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage default_foot.php @subpackage default_foot.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage default_head.php @subpackage default_head.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage default_toolbar.php @subpackage default_toolbar.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage view.html.php @subpackage view.html.php
@ -26,9 +26,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla view library
jimport('joomla.application.component.view');
/** /**
* Questionsanswers View class for the Questions_and_answers * Questionsanswers View class for the Questions_and_answers
*/ */
@ -54,6 +51,8 @@ class QuestionsanswersViewQuestions_and_answers extends JViewLegacy
$this->listOrder = $this->escape($this->state->get('list.ordering')); $this->listOrder = $this->escape($this->state->get('list.ordering'));
$this->listDirn = $this->escape($this->state->get('list.direction')); $this->listDirn = $this->escape($this->state->get('list.direction'));
$this->saveOrder = $this->listOrder == 'ordering'; $this->saveOrder = $this->listOrder == 'ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) JUri::getInstance()));
// get global action permissions // get global action permissions
$this->canDo = QuestionsanswersHelper::getActions('question_and_answer'); $this->canDo = QuestionsanswersHelper::getActions('question_and_answer');
$this->canEdit = $this->canDo->get('question_and_answer.edit'); $this->canEdit = $this->canDo->get('question_and_answer.edit');

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage default.php @subpackage default.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage default_main.php @subpackage default_main.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage default_readme_information.php @subpackage default_readme_information.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage default_vast_development_method_notice_board.php @subpackage default_vast_development_method_notice_board.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage default_vdm.php @subpackage default_vdm.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage view.html.php @subpackage view.html.php
@ -26,9 +26,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla view library
jimport('joomla.application.component.view');
/** /**
* Questionsanswers View class * Questionsanswers View class
*/ */

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage A4.print.css @subpackage A4.print.css

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade"> <extension type="component" version="3.2" method="upgrade">
<name>COM_QUESTIONSANSWERS</name> <name>COM_QUESTIONSANSWERS</name>
<creationDate>5th May, 2018</creationDate> <creationDate>27th December, 2018</creationDate>
<author>Llewellyn van der Merwe</author> <author>Llewellyn van der Merwe</author>
<authorEmail>joomla@vdm.io</authorEmail> <authorEmail>joomla@vdm.io</authorEmail>
<authorUrl>https://www.vdm.io/</authorUrl> <authorUrl>https://www.vdm.io/</authorUrl>
@ -53,6 +53,9 @@
<filename>index.html</filename> <filename>index.html</filename>
<filename>router.php</filename> <filename>router.php</filename>
<filename>questionsanswers.php</filename> <filename>questionsanswers.php</filename>
<filename>questionsanswers.php</filename>
<filename>router.php</filename>
<filename>controller.php</filename>
<folder>assets</folder> <folder>assets</folder>
<folder>helpers</folder> <folder>helpers</folder>
<folder>controllers</folder> <folder>controllers</folder>
@ -75,9 +78,14 @@
<files folder="admin"> <files folder="admin">
<filename>access.xml</filename> <filename>access.xml</filename>
<filename>config.xml</filename> <filename>config.xml</filename>
<filename>controller.php</filename>###WHMCS_ENCRYPT_FILE### <filename>controller.php</filename>
<filename>index.html</filename> <filename>index.html</filename>
<filename>questionsanswers.php</filename> <filename>questionsanswers.php</filename>
<filename>access.xml</filename>
<filename>config.xml</filename>
<filename>controller.php</filename>
<filename>questionsanswers.php</filename>
<filename>README.txt</filename>
<filename>README.txt</filename> <filename>README.txt</filename>
<folder>assets</folder> <folder>assets</folder>
<folder>controllers</folder> <folder>controllers</folder>

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage script.php @subpackage script.php
@ -27,8 +27,6 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
JHTML::_('behavior.modal'); JHTML::_('behavior.modal');
jimport('joomla.installer.installer');
jimport('joomla.installer.helper');
/** /**
* Script File of Questionsanswers Component * Script File of Questionsanswers Component
@ -83,7 +81,7 @@ class com_questionsanswersInstallerScript
$db->setQuery($query); $db->setQuery($query);
// Execute the query to remove Question_and_answer items // Execute the query to remove Question_and_answer items
$question_and_answer_done = $db->execute(); $question_and_answer_done = $db->execute();
if ($question_and_answer_done); if ($question_and_answer_done)
{ {
// If succesfully remove Question_and_answer add queued success message. // If succesfully remove Question_and_answer add queued success message.
$app->enqueueMessage(JText::_('The (com_questionsanswers.question_and_answer) type alias was removed from the <b>#__content_type</b> table')); $app->enqueueMessage(JText::_('The (com_questionsanswers.question_and_answer) type alias was removed from the <b>#__content_type</b> table'));
@ -98,7 +96,7 @@ class com_questionsanswersInstallerScript
$db->setQuery($query); $db->setQuery($query);
// Execute the query to remove Question_and_answer items // Execute the query to remove Question_and_answer items
$question_and_answer_done = $db->execute(); $question_and_answer_done = $db->execute();
if ($question_and_answer_done); if ($question_and_answer_done)
{ {
// If succesfully remove Question_and_answer add queued success message. // If succesfully remove Question_and_answer add queued success message.
$app->enqueueMessage(JText::_('The (com_questionsanswers.question_and_answer) type alias was removed from the <b>#__contentitem_tag_map</b> table')); $app->enqueueMessage(JText::_('The (com_questionsanswers.question_and_answer) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
@ -113,7 +111,7 @@ class com_questionsanswersInstallerScript
$db->setQuery($query); $db->setQuery($query);
// Execute the query to remove Question_and_answer items // Execute the query to remove Question_and_answer items
$question_and_answer_done = $db->execute(); $question_and_answer_done = $db->execute();
if ($question_and_answer_done); if ($question_and_answer_done)
{ {
// If succesfully remove Question_and_answer add queued success message. // If succesfully remove Question_and_answer add queued success message.
$app->enqueueMessage(JText::_('The (com_questionsanswers.question_and_answer) type alias was removed from the <b>#__ucm_content</b> table')); $app->enqueueMessage(JText::_('The (com_questionsanswers.question_and_answer) type alias was removed from the <b>#__ucm_content</b> table'));
@ -169,7 +167,7 @@ class com_questionsanswersInstallerScript
$db->setQuery($query); $db->setQuery($query);
// Execute the query to remove Question_and_answer catid items // Execute the query to remove Question_and_answer catid items
$question_and_answer_catid_done = $db->execute(); $question_and_answer_catid_done = $db->execute();
if ($question_and_answer_catid_done); if ($question_and_answer_catid_done)
{ {
// If succesfully remove Question_and_answer catid add queued success message. // If succesfully remove Question_and_answer catid add queued success message.
$app->enqueueMessage(JText::_('The (com_questionsanswers.questions_and_answers.category) type alias was removed from the <b>#__content_type</b> table')); $app->enqueueMessage(JText::_('The (com_questionsanswers.questions_and_answers.category) type alias was removed from the <b>#__content_type</b> table'));
@ -184,7 +182,7 @@ class com_questionsanswersInstallerScript
$db->setQuery($query); $db->setQuery($query);
// Execute the query to remove Question_and_answer catid items // Execute the query to remove Question_and_answer catid items
$question_and_answer_catid_done = $db->execute(); $question_and_answer_catid_done = $db->execute();
if ($question_and_answer_catid_done); if ($question_and_answer_catid_done)
{ {
// If succesfully remove Question_and_answer catid add queued success message. // If succesfully remove Question_and_answer catid add queued success message.
$app->enqueueMessage(JText::_('The (com_questionsanswers.questions_and_answers.category) type alias was removed from the <b>#__contentitem_tag_map</b> table')); $app->enqueueMessage(JText::_('The (com_questionsanswers.questions_and_answers.category) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
@ -199,7 +197,7 @@ class com_questionsanswersInstallerScript
$db->setQuery($query); $db->setQuery($query);
// Execute the query to remove Question_and_answer catid items // Execute the query to remove Question_and_answer catid items
$question_and_answer_catid_done = $db->execute(); $question_and_answer_catid_done = $db->execute();
if ($question_and_answer_catid_done); if ($question_and_answer_catid_done)
{ {
// If succesfully remove Question_and_answer catid add queued success message. // If succesfully remove Question_and_answer catid add queued success message.
$app->enqueueMessage(JText::_('The (com_questionsanswers.questions_and_answers.category) type alias was removed from the <b>#__ucm_content</b> table')); $app->enqueueMessage(JText::_('The (com_questionsanswers.questions_and_answers.category) type alias was removed from the <b>#__ucm_content</b> table'));
@ -255,7 +253,7 @@ class com_questionsanswersInstallerScript
$db->setQuery($query); $db->setQuery($query);
// Execute the query to remove Help_document items // Execute the query to remove Help_document items
$help_document_done = $db->execute(); $help_document_done = $db->execute();
if ($help_document_done); if ($help_document_done)
{ {
// If succesfully remove Help_document add queued success message. // If succesfully remove Help_document add queued success message.
$app->enqueueMessage(JText::_('The (com_questionsanswers.help_document) type alias was removed from the <b>#__content_type</b> table')); $app->enqueueMessage(JText::_('The (com_questionsanswers.help_document) type alias was removed from the <b>#__content_type</b> table'));
@ -270,7 +268,7 @@ class com_questionsanswersInstallerScript
$db->setQuery($query); $db->setQuery($query);
// Execute the query to remove Help_document items // Execute the query to remove Help_document items
$help_document_done = $db->execute(); $help_document_done = $db->execute();
if ($help_document_done); if ($help_document_done)
{ {
// If succesfully remove Help_document add queued success message. // If succesfully remove Help_document add queued success message.
$app->enqueueMessage(JText::_('The (com_questionsanswers.help_document) type alias was removed from the <b>#__contentitem_tag_map</b> table')); $app->enqueueMessage(JText::_('The (com_questionsanswers.help_document) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
@ -285,7 +283,7 @@ class com_questionsanswersInstallerScript
$db->setQuery($query); $db->setQuery($query);
// Execute the query to remove Help_document items // Execute the query to remove Help_document items
$help_document_done = $db->execute(); $help_document_done = $db->execute();
if ($help_document_done); if ($help_document_done)
{ {
// If succesfully remove Help_document add queued success message. // If succesfully remove Help_document add queued success message.
$app->enqueueMessage(JText::_('The (com_questionsanswers.help_document) type alias was removed from the <b>#__ucm_content</b> table')); $app->enqueueMessage(JText::_('The (com_questionsanswers.help_document) type alias was removed from the <b>#__ucm_content</b> table'));
@ -329,7 +327,7 @@ class com_questionsanswersInstallerScript
$query->where($questionsanswers_condition); $query->where($questionsanswers_condition);
$db->setQuery($query); $db->setQuery($query);
$help_document_done = $db->execute(); $help_document_done = $db->execute();
if ($help_document_done); if ($help_document_done)
{ {
// If succesfully remove questionsanswers add queued success message. // If succesfully remove questionsanswers add queued success message.
$app->enqueueMessage(JText::_('All related items was removed from the <b>#__assets</b> table')); $app->enqueueMessage(JText::_('All related items was removed from the <b>#__assets</b> table'));

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage category.css @subpackage category.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage downloads.css @subpackage downloads.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage question_and_answer.css @subpackage question_and_answer.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage questions_and_answers.css @subpackage questions_and_answers.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage site.css @subpackage site.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage site.js @subpackage site.js

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage controller.php @subpackage controller.php
@ -26,9 +26,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controller library
jimport('joomla.application.component.controller');
/** /**
* Questionsanswers Component Controller * Questionsanswers Component Controller
*/ */

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage ajax.json.php @subpackage ajax.json.php
@ -26,9 +26,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controller');
/** /**
* Questionsanswers Ajax Controller * Questionsanswers Ajax Controller
*/ */

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage download.php @subpackage download.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage help.php @subpackage help.php
@ -26,9 +26,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controller');
/** /**
* Questionsanswers Help Controller * Questionsanswers Help Controller
*/ */

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.0.x @version 1.0.x
@build 5th May, 2018 @build 27th December, 2018
@created 30th January, 2017 @created 30th January, 2017
@package Questions and Answers @package Questions and Answers
@subpackage question_and_answer.php @subpackage question_and_answer.php
@ -26,9 +26,6 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controllerform');
/** /**
* Question_and_answer Controller * Question_and_answer Controller
*/ */
@ -43,6 +40,13 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm
*/ */
protected $task; protected $task;
/**
* Class constructor.
*
* @param array $config A named array of configuration variables.
*
* @since 1.6
*/
public function __construct($config = array()) public function __construct($config = array())
{ {
$this->view_list = 'questions_and_answers'; // safeguard for setting the return view listing to the default site view. $this->view_list = 'questions_and_answers'; // safeguard for setting the return view listing to the default site view.
@ -60,14 +64,17 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm
*/ */
protected function allowAdd($data = array()) protected function allowAdd($data = array())
{ {
// Get user object.
$user = JFactory::getUser();
// Access check. // Access check.
$access = JFactory::getUser()->authorise('question_and_answer.access', 'com_questionsanswers'); $access = $user->authorise('question_and_answer.access', 'com_questionsanswers');
if (!$access) if (!$access)
{ {
return false; return false;
} }
// In the absense of better information, revert to the component permissions. // In the absense of better information, revert to the component permissions.
return JFactory::getUser()->authorise('question_and_answer.create', $this->option); return $user->authorise('question_and_answer.create', $this->option);
} }
/** /**
@ -140,42 +147,25 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm
* *
* @return string The arguments to append to the redirect URL. * @return string The arguments to append to the redirect URL.
* *
* @since 12.2 * @since 1.6
*/ */
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{ {
$tmpl = $this->input->get('tmpl'); // get the referral options (old method use return instead see parent)
$layout = $this->input->get('layout', 'edit', 'string');
$ref = $this->input->get('ref', 0, 'string'); $ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int'); $refid = $this->input->get('refid', 0, 'int');
// Setup redirect info. // get redirect info.
$append = parent::getRedirectToItemAppend($recordId, $urlVar);
$append = ''; // set the referral options
if ($refid && $ref)
if ($refid)
{ {
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid; $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
} }
elseif ($ref) elseif ($ref)
{ {
$append .= '&ref='.(string)$ref; $append = '&ref='. (string)$ref . $append;
}
if ($tmpl)
{
$append .= '&tmpl=' . $tmpl;
}
if ($layout)
{
$append .= '&layout=' . $layout;
}
if ($recordId)
{
$append .= '&' . $urlVar . '=' . $recordId;
} }
return $append; return $append;
@ -214,17 +204,29 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm
*/ */
public function cancel($key = null) public function cancel($key = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
// Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$cancel = parent::cancel($key); $cancel = parent::cancel($key);
if ($cancel) if (!is_null($return) && JUri::isInternal(base64_decode($return)))
{ {
if ($this->refid) $redirect = base64_decode($return);
// Redirect to the return value.
$this->setRedirect(
JRoute::_(
$redirect, false
)
);
}
elseif ($this->refid && $this->ref)
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the item screen. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
@ -235,7 +237,7 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm
} }
elseif ($this->ref) elseif ($this->ref)
{ {
$redirect = '&view='.(string)$this->ref; $redirect = '&view=' . (string)$this->ref;
// Redirect to the list screen. // Redirect to the list screen.
$this->setRedirect( $this->setRedirect(
@ -244,16 +246,6 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm
) )
); );
} }
}
else
{
// Redirect to the items screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . '&view=' . $this->view_list, false
)
);
}
return $cancel; return $cancel;
} }
@ -269,11 +261,15 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm
*/ */
public function save($key = null, $urlVar = null) public function save($key = null, $urlVar = null)
{ {
// get the referal details // get the referral options
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
if ($this->ref || $this->refid) // Check if there is a return value
$return = $this->input->get('return', null, 'base64');
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
if ($this->ref || $this->refid || $canReturn)
{ {
// to make sure the item is checkedin on redirect // to make sure the item is checkedin on redirect
$this->task = 'save'; $this->task = 'save';
@ -281,9 +277,22 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm
$saved = parent::save($key, $urlVar); $saved = parent::save($key, $urlVar);
if ($this->refid && $saved) // This is not needed since parent save already does this
// Due to the ref and refid implementation we need to add this
if ($canReturn)
{ {
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; $redirect = base64_decode($return);
// Redirect to the return value.
$this->setRedirect(
JRoute::_(
$redirect, false
)
);
}
elseif ($this->refid && $this->ref)
{
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
// Redirect to the item screen. // Redirect to the item screen.
$this->setRedirect( $this->setRedirect(
@ -292,9 +301,9 @@ class QuestionsanswersControllerQuestion_and_answer extends JControllerForm
) )
); );
} }
elseif ($this->ref && $saved) elseif ($this->ref)
{ {
$redirect = '&view='.(string)$this->ref; $redirect = '&view=' . (string)$this->ref;
// Redirect to the list screen. // Redirect to the list screen.
$this->setRedirect( $this->setRedirect(

Some files were not shown because too many files have changed in this diff Show More