fixed a line break incorrectly escaped, added better description to new fields layout

This commit is contained in:
2017-10-14 20:07:23 +02:00
parent 5a14049afd
commit c2972c3e17
59 changed files with 248 additions and 104 deletions

View File

@ -10,7 +10,7 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 184 of this MVC
@version @update number 185 of this MVC
@build 14th October, 2017
@created 30th April, 2015
@package Component Builder
@ -523,6 +523,23 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
{
$items = $db->loadObjectList();
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
$access = ($user->authorise('joomla_component.access', 'com_componentbuilder.joomla_component.' . (int) $item->id) && $user->authorise('joomla_component.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);
continue;
}
}
}
// Filter by addadmin_viewsvvvz in this Repetable Field
if (ComponentbuilderHelper::checkArray($items) && isset($this->addadmin_viewsvvvz))
{

View File

@ -10,7 +10,7 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 184 of this MVC
@version @update number 185 of this MVC
@build 14th October, 2017
@created 30th April, 2015
@package Component Builder

View File

@ -238,7 +238,7 @@ class ComponentbuilderModelAjax extends JModelList
<label>' . ucwords($type) . '</label>
</div>
<div class="controls">
<a class="btn btn-success vdm-button-new" onclick="UIkit.modal.confirm(\''.JText::_('COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE').'\', function(){ window.location.href = \'index.php?option=com_componentbuilder&amp;view='.$type.'&amp;layout=edit'.$ref.'\' })" href="javascript:void(0)" >
<a class="btn btn-success vdm-button-new" onclick="UIkit.modal.confirm(\''.JText::_('COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE').'\', function(){ window.location.href = \'index.php?option=com_componentbuilder&amp;view='.$type.'&amp;layout=edit'.$ref.'\' })" href="javascript:void(0)" >
<span class="icon-new icon-white"></span>
' . JText::_('COM_COMPONENTBUILDER_NEW') . '
</a>
@ -293,7 +293,7 @@ class ComponentbuilderModelAjax extends JModelList
$button[] = '</div>';
$button[] = '<div class="controls">';
}
$button[] = '<a class="btn btn-success vdm-button-new" onclick="UIkit.modal.confirm(\''.JText::_('COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE').'\', function(){ window.location.href = \''.$editThis.$ref.'\' })" href="javascript:void(0)" >';
$button[] = '<a class="btn btn-success vdm-button-new" onclick="UIkit.modal.confirm(\''.JText::_('COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE').'\', function(){ window.location.href = \''.$editThis.$ref.'\' })" href="javascript:void(0)" >';
if (1 == $size)
{
$button[] = '<span class="'.$icon.' icon-white"></span>';
@ -563,7 +563,7 @@ class ComponentbuilderModelAjax extends JModelList
if ($this->canEdit($id))
{
$edit = "index.php?option=com_componentbuilder&view=".$views."&task=".$view.".edit&id=".$id.$this->ref;
return ' <a onclick="UIkit.modal.confirm(\''.JText::_('COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE').'\', function(){ window.location.href = \''.$edit.'\' })" href="javascript:void(0)" class="uk-icon-pencil"></a>';
return ' <a onclick="UIkit.modal.confirm(\''.JText::_('COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE').'\', function(){ window.location.href = \''.$edit.'\' })" href="javascript:void(0)" class="uk-icon-pencil"></a>';
}
return '';

View File

@ -49,6 +49,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList
$viewAccess = array(
'compiler.submenu' => 'compiler.submenu',
'compiler.dashboard_list' => 'compiler.dashboard_list',
'joomla_component.create' => 'joomla_component.create',
'joomla_components.access' => 'joomla_component.access',
'joomla_component.access' => 'joomla_component.access',
'joomla_components.submenu' => 'joomla_component.submenu',

View File

@ -248,6 +248,23 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin
{
$items = $db->loadObjectList();
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
$access = ($user->authorise('joomla_component.access', 'com_componentbuilder.joomla_component.' . (int) $item->id) && $user->authorise('joomla_component.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);
continue;
}
}
}
// Filter by addcustom_admin_viewsvvwa in this Repetable Field
if (ComponentbuilderHelper::checkArray($items) && isset($this->addcustom_admin_viewsvvwa))
{

View File

@ -79,7 +79,7 @@ class JFormFieldComponent extends JFormFieldList
}
$user = JFactory::getUser();
// only add if user allowed to create joomla_component
if ($user->authorise('core.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
if ($user->authorise('joomla_component.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
{
// build Create button
$buttonNamee = trim($buttonName);
@ -92,7 +92,7 @@ class JFormFieldComponent extends JFormFieldList
<span class="icon-new icon-white"></span></a>';
}
// only add if user allowed to edit joomla_component
if (($buttonName === 'joomla_component' || $buttonName === 'joomla_components') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
if (($buttonName === 'joomla_component' || $buttonName === 'joomla_components') && $user->authorise('joomla_component.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
{
// build edit button
$buttonNamee = trim($buttonName);

View File

@ -79,7 +79,7 @@ class JFormFieldComponents extends JFormFieldList
}
$user = JFactory::getUser();
// only add if user allowed to create joomla_component
if ($user->authorise('core.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
if ($user->authorise('joomla_component.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
{
// build Create button
$buttonNamee = trim($buttonName);
@ -92,7 +92,7 @@ class JFormFieldComponents extends JFormFieldList
<span class="icon-new icon-white"></span></a>';
}
// only add if user allowed to edit joomla_component
if (($buttonName === 'joomla_component' || $buttonName === 'joomla_components') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
if (($buttonName === 'joomla_component' || $buttonName === 'joomla_components') && $user->authorise('joomla_component.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
{
// build edit button
$buttonNamee = trim($buttonName);

View File

@ -9,7 +9,7 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 184 of this MVC
@version @update number 185 of this MVC
@build 14th October, 2017
@created 30th April, 2015
@package Component Builder

View File

@ -9,7 +9,7 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 388 of this MVC
@version @update number 389 of this MVC
@build 14th October, 2017
@created 6th May, 2015
@package Component Builder

View File

@ -176,6 +176,23 @@ class ComponentbuilderModelFtp extends JModelAdmin
if ($db->getNumRows())
{
$items = $db->loadObjectList();
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
$access = ($user->authorise('joomla_component.access', 'com_componentbuilder.joomla_component.' . (int) $item->id) && $user->authorise('joomla_component.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);
continue;
}
}
}
return $items;
}
return false;

View File

@ -10,7 +10,7 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 388 of this MVC
@version @update number 389 of this MVC
@build 14th October, 2017
@created 6th May, 2015
@package Component Builder
@ -619,8 +619,8 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
// Check for existing item.
// Modify the form based on Edit State access controls.
if ($id != 0 && (!$user->authorise('core.edit.state', 'com_componentbuilder.joomla_component.' . (int) $id))
|| ($id == 0 && !$user->authorise('core.edit.state', 'com_componentbuilder')))
if ($id != 0 && (!$user->authorise('joomla_component.edit.state', 'com_componentbuilder.joomla_component.' . (int) $id))
|| ($id == 0 && !$user->authorise('joomla_component.edit.state', 'com_componentbuilder')))
{
// Disable fields for display.
$form->setFieldAttribute('ordering', 'disabled', 'true');
@ -636,7 +636,8 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
$form->setValue('created_by', null, $user->id);
}
// Modify the form based on Edit Creaded By access controls.
if (!$user->authorise('core.edit.created_by', 'com_componentbuilder'))
if ($id != 0 && (!$user->authorise('joomla_component.edit.created_by', 'com_componentbuilder.joomla_component.' . (int) $id))
|| ($id == 0 && !$user->authorise('joomla_component.edit.created_by', 'com_componentbuilder')))
{
// Disable fields for display.
$form->setFieldAttribute('created_by', 'disabled', 'true');
@ -646,7 +647,8 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
$form->setFieldAttribute('created_by', 'filter', 'unset');
}
// Modify the form based on Edit Creaded Date access controls.
if (!$user->authorise('core.edit.created', 'com_componentbuilder'))
if ($id != 0 && (!$user->authorise('joomla_component.edit.created', 'com_componentbuilder.joomla_component.' . (int) $id))
|| ($id == 0 && !$user->authorise('joomla_component.edit.created', 'com_componentbuilder')))
{
// Disable fields for display.
$form->setFieldAttribute('created', 'disabled', 'true');
@ -700,7 +702,7 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
$user = JFactory::getUser();
// The record has been set. Check the record permissions.
return $user->authorise('core.delete', 'com_componentbuilder.joomla_component.' . (int) $record->id);
return $user->authorise('joomla_component.delete', 'com_componentbuilder.joomla_component.' . (int) $record->id);
}
return false;
}
@ -722,14 +724,14 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
if ($recordId)
{
// The record has been set. Check the record permissions.
$permission = $user->authorise('core.edit.state', 'com_componentbuilder.joomla_component.' . (int) $recordId);
$permission = $user->authorise('joomla_component.edit.state', 'com_componentbuilder.joomla_component.' . (int) $recordId);
if (!$permission && !is_null($permission))
{
return false;
}
}
// In the absense of better information, revert to the component permissions.
return parent::canEditState($record);
return $user->authorise('joomla_component.edit.state', 'com_componentbuilder');
}
/**
@ -744,8 +746,9 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
protected function allowEdit($data = array(), $key = 'id')
{
// Check specific edit permission then general edit permission.
$user = JFactory::getUser();
return JFactory::getUser()->authorise('core.edit', 'com_componentbuilder.joomla_component.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key);
return $user->authorise('joomla_component.edit', 'com_componentbuilder.joomla_component.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('joomla_component.edit', 'com_componentbuilder');
}
/**
@ -1033,7 +1036,7 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
$this->canDo = ComponentbuilderHelper::getActions('joomla_component');
}
if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch'))
if (!$this->canDo->get('joomla_component.create') && !$this->canDo->get('joomla_component.batch'))
{
return false;
}
@ -1048,7 +1051,7 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
{
$values['published'] = 0;
}
elseif (isset($values['published']) && !$this->canDo->get('core.edit.state'))
elseif (isset($values['published']) && !$this->canDo->get('joomla_component.edit.state'))
{
$values['published'] = 0;
}
@ -1065,7 +1068,7 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
// only allow copy if user may edit this item.
if (!$this->user->authorise('core.edit', $contexts[$pk]))
if (!$this->user->authorise('joomla_component.edit', $contexts[$pk]))
{
@ -1182,14 +1185,14 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
$this->canDo = ComponentbuilderHelper::getActions('joomla_component');
}
if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch'))
if (!$this->canDo->get('joomla_component.edit') && !$this->canDo->get('joomla_component.batch'))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
return false;
}
// make sure published only updates if user has the permission.
if (isset($values['published']) && !$this->canDo->get('core.edit.state'))
if (isset($values['published']) && !$this->canDo->get('joomla_component.edit.state'))
{
unset($values['published']);
}
@ -1199,7 +1202,7 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
// Parent exists so we proceed
foreach ($pks as $pk)
{
if (!$this->user->authorise('core.edit', $contexts[$pk]))
if (!$this->user->authorise('joomla_component.edit', $contexts[$pk]))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));

View File

@ -10,7 +10,7 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 388 of this MVC
@version @update number 389 of this MVC
@build 14th October, 2017
@created 6th May, 2015
@package Component Builder
@ -1212,7 +1212,24 @@ class ComponentbuilderModelJoomla_components extends JModelList
$this->checkInNow();
// load parent items
$items = parent::getItems();
$items = parent::getItems();
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
$access = ($user->authorise('joomla_component.access', 'com_componentbuilder.joomla_component.' . (int) $item->id) && $user->authorise('joomla_component.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);
continue;
}
}
}
// return items
return $items;
@ -1348,8 +1365,17 @@ class ComponentbuilderModelJoomla_components extends JModelList
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
$access = ($user->authorise('joomla_component.access', 'com_componentbuilder.joomla_component.' . (int) $item->id) && $user->authorise('joomla_component.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);
continue;
}
// decode sql
$item->sql = base64_decode($item->sql);
// decode php_preflight_update

View File

@ -280,6 +280,23 @@ class ComponentbuilderModelSite_view extends JModelAdmin
{
$items = $db->loadObjectList();
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
$access = ($user->authorise('joomla_component.access', 'com_componentbuilder.joomla_component.' . (int) $item->id) && $user->authorise('joomla_component.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);
continue;
}
}
}
// Filter by addsite_viewsvvwb in this Repetable Field
if (ComponentbuilderHelper::checkArray($items) && isset($this->addsite_viewsvvwb))
{