Skip to content
Permalink
Browse files

Removed required from all code/editor field to improve the behavior o…

…f the codemirror editor. Improved the token validation via Ajax.
  • Loading branch information...
Llewellynvdm committed Jul 8, 2019
1 parent 3497104 commit 2af4b8cf50234c20a8d5fd4fc0a7572dca342b17
Showing with 860 additions and 2,383 deletions.
  1. +2 −2 README.md
  2. +2 −2 admin/README.txt
  3. BIN admin/assets/images/icons/servers.png
  4. +8 −8 admin/assets/js/get_snippets.js
  5. +1 −1 admin/compiler/joomla_3/JControllerLegacyAjax.php
  6. +1 −1 admin/compiler/joomla_3/JControllerLegacyAjaxSite.php
  7. +1 −1 admin/controllers/ajax.json.php
  8. +59 −0 admin/helpers/componentbuilder.php
  9. +1 −1 admin/layouts/fieldtype/fields_fullwidth.php
  10. +1 −1 admin/layouts/server/linked_components_fullwidth.php
  11. +0 −36 admin/models/custom_admin_view.php
  12. +6 −6 admin/models/fieldtype.php
  13. +2 −3 admin/models/forms/admin_fields_conditions.js
  14. +4 −4 admin/models/forms/admin_fields_relations.js
  15. +59 −629 admin/models/forms/admin_view.js
  16. +0 −30 admin/models/forms/admin_view.xml
  17. +2 −2 admin/models/forms/component_dashboard.js
  18. +13 −251 admin/models/forms/custom_admin_view.js
  19. +0 −12 admin/models/forms/custom_admin_view.xml
  20. +22 −22 admin/models/forms/custom_code.js
  21. +0 −1 admin/models/forms/custom_code.xml
  22. +75 −208 admin/models/forms/dynamic_get.js
  23. +0 −7 admin/models/forms/dynamic_get.xml
  24. +31 −107 admin/models/forms/field.js
  25. +0 −4 admin/models/forms/field.xml
  26. +37 −37 admin/models/forms/fieldtype.js
  27. +25 −44 admin/models/forms/help_document.js
  28. +0 −1 admin/models/forms/help_document.xml
  29. +48 −314 admin/models/forms/joomla_component.js
  30. +0 −14 admin/models/forms/joomla_component.xml
  31. +1 −1 admin/models/forms/language_translation.js
  32. +9 −57 admin/models/forms/layout.js
  33. +0 −2 admin/models/forms/layout.xml
  34. +20 −20 admin/models/forms/library.js
  35. +0 −1 admin/models/forms/placeholder.js
  36. +45 −45 admin/models/forms/server.js
  37. +13 −251 admin/models/forms/site_view.js
  38. +0 −12 admin/models/forms/site_view.xml
  39. +11 −59 admin/models/forms/template.js
  40. +0 −2 admin/models/forms/template.xml
  41. +6 −6 admin/models/forms/validation_rule.js
  42. +0 −36 admin/models/layout.php
  43. +9 −9 admin/models/server.php
  44. +0 −36 admin/models/site_view.php
  45. +0 −36 admin/models/template.php
  46. +18 −1 admin/views/admin_fields_conditions/tmpl/edit.php
  47. +24 −1 admin/views/admin_fields_relations/tmpl/edit.php
  48. +15 −14 admin/views/compiler/tmpl/default.php
  49. +2 −2 admin/views/compiler/view.html.php
  50. +24 −1 admin/views/component_dashboard/tmpl/edit.php
  51. +18 −1 admin/views/custom_admin_view/tmpl/edit.php
  52. +18 −1 admin/views/custom_code/tmpl/edit.php
  53. +17 −4 admin/views/dynamic_get/tmpl/edit.php
  54. +19 −0 admin/views/fieldtype/tmpl/edit.php
  55. +1 −1 admin/views/fieldtype/view.html.php
  56. +18 −1 admin/views/get_snippets/tmpl/default.php
  57. +1 −1 admin/views/languages/tmpl/default.php
  58. +37 −24 admin/views/layout/tmpl/edit.php
  59. +1 −1 admin/views/library/tmpl/edit.php
  60. +18 −1 admin/views/placeholder/tmpl/edit.php
  61. +1 −1 admin/views/server/view.html.php
  62. +18 −1 admin/views/site_view/tmpl/edit.php
  63. +18 −1 admin/views/template/tmpl/edit.php
  64. +18 −3 admin/views/validation_rule/tmpl/edit.php
  65. +1 −1 componentbuilder.xml
  66. +59 −0 site/helpers/componentbuilder.php
@@ -146,11 +146,11 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 6th July, 2019
+ *Last Build*: 8th July, 2019
+ *Version*: 2.9.21
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **211603**
+ *Line count*: **210080**
+ *Field count*: **1143**
+ *File count*: **1346**
+ *Folder count*: **209**
@@ -146,11 +146,11 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 6th July, 2019
+ *Last Build*: 8th July, 2019
+ *Version*: 2.9.21
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **211603**
+ *Line count*: **210080**
+ *Field count*: **1143**
+ *File count*: **1346**
+ *Folder count*: **209**
Binary file not shown.
@@ -386,16 +386,16 @@ function bulkSnippetGithub(status) {
function doBulkUpdate_server(path, status) {
// set the ajax scope
ajaxcall = null;
var getUrl = "index.php?option=com_componentbuilder&task=ajax.setSnippetGithub&format=json";
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.setSnippetGithub&format=json&raw=true");
if (token.length > 0 && path.length > 0 && status.length > 0) {
var request = 'token='+token+'&path='+path+'&status='+status;
var request = token+'=1&path='+path+'&status='+status;
}
return jQuery.ajax({
type: 'POST',
url: getUrl,
dataType: 'jsonp',
dataType: 'json',
data: request,
jsonp: 'callback'
jsonp: false
});
}

@@ -423,16 +423,16 @@ function setSnippetGithub(key, status) {
function setSnippetGithub_server(path, status) {
// set the ajax scope
ajaxcall = null;
var getUrl = "index.php?option=com_componentbuilder&task=ajax.setSnippetGithub&format=json";
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.setSnippetGithub&format=json&raw=true");
if (token.length > 0 && path.length > 0 && status.length > 0) {
var request = 'token='+token+'&path='+path+'&status='+status;
var request = token+'=1&path='+path+'&status='+status;
}
return jQuery.ajax({
type: 'POST',
url: getUrl,
dataType: 'jsonp',
dataType: 'json',
data: request,
jsonp: 'callback'
jsonp: false
});
}

@@ -39,7 +39,7 @@ public function ajax()
// Check Token!
$token = JSession::getFormToken();
$call_token = $jinput->get('token', 0, 'ALNUM');
if($token == $call_token)
if($jinput->get($token, 0, 'ALNUM') || $token === $call_token)
{
$task = $this->getTask();
switch($task)
@@ -39,7 +39,7 @@ public function ajax()
// Check Token!
$token = JSession::getFormToken();
$call_token = $jinput->get('token', 0, 'ALNUM');
if($token == $call_token)
if($jinput->get($token, 0, 'ALNUM') || $token === $call_token)
{
$task = $this->getTask();
switch($task)
@@ -67,7 +67,7 @@ public function ajax()
// Check Token!
$token = JSession::getFormToken();
$call_token = $jinput->get('token', 0, 'ALNUM');
if($token == $call_token)
if($jinput->get($token, 0, 'ALNUM') || $token === $call_token)
{
$task = $this->getTask();
switch($task)
@@ -124,6 +124,65 @@ public static function globalEvent($document)
'JPATH_THEMES' => JPATH_THEMES
);
/**
* get the method code
*
* @input int The method ID
*
* @returns string on success
**/
public static function getMethodCode($id)
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.comment','a.name','a.visibility','a.params','a.code')));
$query->from($db->quoteName('#__componentbuilder_method','a'));
$query->where($db->quoteName('a.id') . ' = ' . (int) $id);
// Implement View Level Access
if (!$user->authorise('core.options', 'com_componentbuilder'))
{
$columns = $db->getTableColumns('#__componentbuilder_method');
if(isset($columns['access']))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
}
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
// get the method
$method = $db->loadObject;
// combine method values
$combinded = array();
// add comment if set
if (self::checkString($method->comment))
{
$combinded[] = $method->comment;
}
// set the method sginature
$combinded[] = "\t" . $method->visibility . ' function ' . $method->name . '(' . $method->params . ')';
// set the method code
$combinded[] = "\t" . "{";
// add comment if set
if (self::checkString($method->code))
{
$combinded[] = $method->code;
}
else
{
$combinded[] = "\t\t// add your code here";
}
$combinded[] = "\t" . "}";
// return the method
return implode(PHP_EOL, $combinded);
}
return false;
}
/**
* Making class or function name safe
*
@@ -13,7 +13,7 @@
defined('_JEXEC') or die('Restricted access');
// set the defaults
$items = $displayData->warfields;
$items = $displayData->vxqfields;
$user = JFactory::getUser();
$id = $displayData->item->id;
// set the edit URL
@@ -13,7 +13,7 @@
defined('_JEXEC') or die('Restricted access');
// set the defaults
$items = $displayData->wbblinked_components;
$items = $displayData->vyalinked_components;
$user = JFactory::getUser();
$id = $displayData->item->id;
// set the edit URL
@@ -604,42 +604,6 @@ protected function loadFormData()
return $data;
}
/**
* Method to validate the form data.
*
* @param JForm $form The form to validate against.
* @param array $data The data to validate.
* @param string $group The name of the field group to validate.
*
* @return mixed Array of filtered data if valid, false otherwise.
*
* @see JFormRule
* @see JFilterInput
* @since 12.2
*/
public function validate($form, $data, $group = null)
{
// check if the not_required field is set
if (ComponentbuilderHelper::checkString($data['not_required']))
{
$requiredFields = (array) explode(',',(string) $data['not_required']);
$requiredFields = array_unique($requiredFields);
// now change the required field attributes value
foreach ($requiredFields as $requiredField)
{
// make sure there is a string value
if (ComponentbuilderHelper::checkString($requiredField))
{
// change to false
$form->setFieldAttribute($requiredField, 'required', 'false');
// also clear the data set
$data[$requiredField] = '';
}
}
}
return parent::validate($form, $data, $group);
}
/**
* Method to get the unique fields of this table.
*
@@ -203,7 +203,7 @@ public function getItem($pk = null)
*
* @return mixed An array of data items on success, false on failure.
*/
public function getWarfields()
public function getVxqfields()
{
// Get the user object.
$user = JFactory::getUser();
@@ -285,13 +285,13 @@ public function getWarfields()
foreach ($items as $nr => &$item)
{
// convert datatype
$item->datatype = $this->selectionTranslationWarfields($item->datatype, 'datatype');
$item->datatype = $this->selectionTranslationVxqfields($item->datatype, 'datatype');
// convert indexes
$item->indexes = $this->selectionTranslationWarfields($item->indexes, 'indexes');
$item->indexes = $this->selectionTranslationVxqfields($item->indexes, 'indexes');
// convert null_switch
$item->null_switch = $this->selectionTranslationWarfields($item->null_switch, 'null_switch');
$item->null_switch = $this->selectionTranslationVxqfields($item->null_switch, 'null_switch');
// convert store
$item->store = $this->selectionTranslationWarfields($item->store, 'store');
$item->store = $this->selectionTranslationVxqfields($item->store, 'store');
}
}
@@ -305,7 +305,7 @@ public function getWarfields()
*
* @return translatable string
*/
public function selectionTranslationWarfields($value,$name)
public function selectionTranslationVxqfields($value,$name)
{
// Array of datatype language strings
if ($name === 'datatype')
@@ -12,9 +12,9 @@


function getFieldSelectOptions_server(fieldId){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.fieldSelectOptions&format=json";
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.fieldSelectOptions&format=json");
if(token.length > 0 && fieldId > 0){
var request = 'token='+token+'&id='+fieldId;
var request = token+'=1&id='+fieldId;
}
return jQuery.ajax({
type: 'GET',
@@ -24,7 +24,6 @@ function getFieldSelectOptions_server(fieldId){
jsonp: 'callback'
});
}

function getFieldSelectOptions(fieldKey){
// first check if the field is set
if(jQuery("#jform_addconditions__addconditions"+fieldKey+"__match_field").length) {
@@ -47,13 +47,13 @@ function getCodeGlueOptions(field) {
}

function getCodeGlueOptions_server(listfield, joinfields, type, area){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getCodeGlueOptions&format=json";
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getCodeGlueOptions&format=json");
// make sure the joinfields are set
if (!_isSet(joinfields)) {
joinfields = 'none';
}
if(token.length > 0 && listfield > 0 && type > 0 && area > 0) {
var request = 'token='+token+'&listfield='+listfield+'&type='+type+'&area='+area+'&joinfields='+joinfields;
var request = token+'=1&listfield='+listfield+'&type='+type+'&area='+area+'&joinfields='+joinfields;
}
return jQuery.ajax({
type: 'GET',
@@ -74,9 +74,9 @@ function _isSet(val)
}

function getEditCustomCodeButtons_server(id){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod;
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod);
if(token.length > 0 && id > 0){
var request = 'token='+token+'&id='+id+'&return_here='+return_here;
var request = token+'=1&id='+id+'&return_here='+return_here;
}
return jQuery.ajax({
type: 'GET',

0 comments on commit 2af4b8c

Please sign in to comment.
You can’t perform that action at this time.