Added image to readme, added access control to look view and its fields , other changes are only random variable name and date changes (due to automation sorry)

This commit is contained in:
Llewellyn van der Merwe 2015-12-03 04:39:36 +02:00
parent 6518f2416c
commit dac176fa2b
15 changed files with 318 additions and 172 deletions

View File

@ -1,5 +1,7 @@
# Demo (1.0.4)
![Demo image] (https://raw.githubusercontent.com/namibia/demo-joomla-3-component/master/admin/assets/images/component-300.jpg "The Demo")
Just a basic demo of the most basic implementations of the [Joomla] (http://www.joomla.org) Component Builder's ability.
# Build Details
@ -15,13 +17,13 @@ Just a basic demo of the most basic implementations of the [Joomla] (http://www.
## Build Time
**42 Hours** or **5 Eight Hour Days** (actual time the author saved -
**43 Hours** or **5 Eight Hour Days** (actual time the author saved -
due to [Automated Component Builder] (https://www.vdm.io/joomla-component-builder))
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> never making one mistake or taking any coffee break.)
+ *Line count*: **15117**
+ *Line count*: **15263**
+ *File count*: **147**
+ *Folder count*: **50**
@ -33,7 +35,7 @@ due to [Automated Component Builder] (https://www.vdm.io/joomla-component-builde
> **mapping @4hours** = codingtime / 10;
> **office @7hours** = codingtime / 6;)
**70 Hours** or **9 Eight Hour Days**
**71 Hours** or **9 Eight Hour Days**
(a total of the realistic time frame for this project)
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,

View File

@ -27,15 +27,37 @@
<action name="help_document.export" title="COM_DEMO_HELP_DOCUMENTS_EXPORT" description="COM_DEMO_HELP_DOCUMENTS_EXPORT_DESC" />
<action name="help_document.import" title="COM_DEMO_HELP_DOCUMENTS_IMPORT" description="COM_DEMO_HELP_DOCUMENTS_IMPORT_DESC" />
<action name="help_document.submenu" title="COM_DEMO_HELP_DOCUMENTS_SUBMENU" description="COM_DEMO_HELP_DOCUMENTS_SUBMENU_DESC" />
<action name="look.access" title="COM_DEMO_LOOKS_ACCESS" description="COM_DEMO_LOOKS_ACCESS_DESC" />
<action name="look.batch" title="COM_DEMO_LOOKS_BATCH_USE" description="COM_DEMO_LOOKS_BATCH_USE_DESC" />
<action name="look.create" title="COM_DEMO_LOOKS_CREATE" description="COM_DEMO_LOOKS_CREATE_DESC" />
<action name="look.dashboard_add" title="COM_DEMO_LOOKS_DASHBOARD_ADD" description="COM_DEMO_LOOKS_DASHBOARD_ADD_DESC" />
<action name="look.dashboard_list" title="COM_DEMO_LOOKS_DASHBOARD_LIST" description="COM_DEMO_LOOKS_DASHBOARD_LIST_DESC" />
<action name="look.delete" title="COM_DEMO_LOOKS_DELETE" description="COM_DEMO_LOOKS_DELETE_DESC" />
<action name="look.edit" title="COM_DEMO_LOOKS_EDIT" description="COM_DEMO_LOOKS_EDIT_DESC" />
<action name="look.edit.acronym" title="COM_DEMO_LOOKS_EDIT_ACRONYM" description="COM_DEMO_LOOKS_EDIT_ACRONYM_DESC" />
<action name="look.edit.created_by" title="COM_DEMO_LOOKS_EDIT_CREATED_BY" description="COM_DEMO_LOOKS_EDIT_CREATED_BY_DESC" />
<action name="look.edit.created" title="COM_DEMO_LOOKS_EDIT_CREATED_DATE" description="COM_DEMO_LOOKS_EDIT_CREATED_DATE_DESC" />
<action name="look.edit.description" title="COM_DEMO_LOOKS_EDIT_DESCRIPTION" description="COM_DEMO_LOOKS_EDIT_DESCRIPTION_DESC" />
<action name="look.edit.male" title="COM_DEMO_LOOKS_EDIT_MALE" description="COM_DEMO_LOOKS_EDIT_MALE_DESC" />
<action name="look.edit.own" title="COM_DEMO_LOOKS_EDIT_OWN" description="COM_DEMO_LOOKS_EDIT_OWN_DESC" />
<action name="look.edit.state" title="COM_DEMO_LOOKS_EDIT_STATE" description="COM_DEMO_LOOKS_EDIT_STATE_DESC" />
<action name="look.version" title="COM_DEMO_LOOKS_EDIT_VERSION" description="COM_DEMO_LOOKS_EDIT_VERSION_DESC" />
<action name="look.export" title="COM_DEMO_LOOKS_EXPORT" description="COM_DEMO_LOOKS_EXPORT_DESC" />
<action name="look.import" title="COM_DEMO_LOOKS_IMPORT" description="COM_DEMO_LOOKS_IMPORT_DESC" />
<action name="look.submenu" title="COM_DEMO_LOOKS_SUBMENU" description="COM_DEMO_LOOKS_SUBMENU_DESC" />
</section>
<section name="look">
<action name="look.edit" title="COM_DEMO_LOOKS_EDIT" description="COM_DEMO_LOOKS_EDIT_DESC" />
<action name="look.edit.own" title="COM_DEMO_LOOKS_EDIT_OWN" description="COM_DEMO_LOOKS_EDIT_OWN_DESC" />
<action name="look.edit.state" title="COM_DEMO_LOOKS_EDIT_STATE" description="COM_DEMO_LOOKS_EDIT_STATE_DESC" />
<action name="look.edit.created_by" title="COM_DEMO_LOOKS_EDIT_CREATED_BY" description="COM_DEMO_LOOKS_EDIT_CREATED_BY_DESC" />
<action name="look.edit.created" title="COM_DEMO_LOOKS_EDIT_CREATED_DATE" description="COM_DEMO_LOOKS_EDIT_CREATED_DATE_DESC" />
<action name="look.create" title="COM_DEMO_LOOKS_CREATE" description="COM_DEMO_LOOKS_CREATE_DESC" />
<action name="look.delete" title="COM_DEMO_LOOKS_DELETE" description="COM_DEMO_LOOKS_DELETE_DESC" />
<action name="look.access" title="COM_DEMO_LOOKS_ACCESS" description="COM_DEMO_LOOKS_ACCESS_DESC" />
<action name="look.edit.description" title="COM_DEMO_LOOKS_EDIT_DESCRIPTION" description="COM_DEMO_LOOKS_EDIT_DESCRIPTION_DESC" />
<action name="look.edit.acronym" title="COM_DEMO_LOOKS_EDIT_ACRONYM" description="COM_DEMO_LOOKS_EDIT_ACRONYM_DESC" />
<action name="look.edit.male" title="COM_DEMO_LOOKS_EDIT_MALE" description="COM_DEMO_LOOKS_EDIT_MALE_DESC" />
<action name="look.version" title="COM_DEMO_LOOKS_EDIT_VERSION" description="COM_DEMO_LOOKS_EDIT_VERSION_DESC" />
</section>
<section name="help_document">

View File

@ -54,8 +54,15 @@ class DemoControllerLook extends JControllerForm
* @since 1.6
*/
protected function allowAdd($data = array())
{ // In the absense of better information, revert to the component permissions.
return parent::allowAdd($data);
{
// Access check.
$access = JFactory::getUser()->authorise('look.access', 'com_demo');
if (!$access)
{
return false;
}
// In the absense of better information, revert to the component permissions.
return JFactory::getUser()->authorise('look.create', $this->option);
}
/**
@ -76,13 +83,20 @@ class DemoControllerLook extends JControllerForm
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
// Access check.
$access = ($user->authorise('look.access', 'com_demo.look.' . (int) $recordId) && $user->authorise('look.access', 'com_demo'));
if (!$access)
{
return false;
}
if ($recordId)
{
// The record has been set. Check the record permissions.
$permission = $user->authorise('core.edit', 'com_demo.look.' . (int) $recordId);
$permission = $user->authorise('look.edit', 'com_demo.look.' . (int) $recordId);
if (!$permission && !is_null($permission))
{
if ($user->authorise('core.edit.own', 'com_demo.look.' . $recordId))
if ($user->authorise('look.edit.own', 'com_demo.look.' . $recordId))
{
// Now test the owner is the user.
$ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
@ -101,7 +115,7 @@ class DemoControllerLook extends JControllerForm
// If the owner matches 'me' then allow.
if ($ownerId == $user->id)
{
if ($user->authorise('core.edit.own', 'com_demo'))
if ($user->authorise('look.edit.own', 'com_demo'))
{
return true;
}
@ -111,7 +125,7 @@ class DemoControllerLook extends JControllerForm
}
}
// Since there is no permission, revert to the component permissions.
return parent::allowEdit($data, $key);
return $user->authorise('look.edit', $this->option);
}
/**

View File

@ -154,7 +154,10 @@ abstract class DemoHelper
$user = JFactory::getUser();
// load the submenus to sidebar
JHtmlSidebar::addEntry(JText::_('COM_DEMO_SUBMENU_DASHBOARD'), 'index.php?option=com_demo&view=demo', $submenu == 'demo');
JHtmlSidebar::addEntry(JText::_('COM_DEMO_SUBMENU_LOOKS'), 'index.php?option=com_demo&view=looks', $submenu == 'looks');
if ($user->authorise('look.access', 'com_demo') && $user->authorise('look.submenu', 'com_demo'))
{
JHtmlSidebar::addEntry(JText::_('COM_DEMO_SUBMENU_LOOKS'), 'index.php?option=com_demo&view=looks', $submenu == 'looks');
}
if ($user->authorise('help_document.access', 'com_demo') && $user->authorise('help_document.submenu', 'com_demo'))
{
JHtmlSidebar::addEntry(JText::_('COM_DEMO_SUBMENU_HELP_DOCUMENTS'), 'index.php?option=com_demo&view=help_documents', $submenu == 'help_documents');

View File

@ -178,14 +178,36 @@ COM_DEMO_KEEP_ORIGINAL_STATE="- Keep Original State -"
COM_DEMO_LICENSE="License"
COM_DEMO_LOOK="Look"
COM_DEMO_LOOKS="Looks"
COM_DEMO_LOOKS_ACCESS="Looks Access"
COM_DEMO_LOOKS_ACCESS_DESC="Allows the users in this group to access access looks"
COM_DEMO_LOOKS_BATCH_OPTIONS="Batch process the selected Looks"
COM_DEMO_LOOKS_BATCH_TIP="All changes will be applied to all selected Looks"
COM_DEMO_LOOKS_BATCH_USE="Looks Batch Use"
COM_DEMO_LOOKS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch looks"
COM_DEMO_LOOKS_CREATE="Looks Create"
COM_DEMO_LOOKS_CREATE_DESC="Allows the users in this group to create create looks"
COM_DEMO_LOOKS_DASHBOARD_ADD="Looks Dashboard Add"
COM_DEMO_LOOKS_DASHBOARD_ADD_DESC="Allows the users in this group to update the dashboard add of the look"
COM_DEMO_LOOKS_DASHBOARD_LIST="Looks Dashboard List"
COM_DEMO_LOOKS_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the look"
COM_DEMO_LOOKS_DELETE="Looks Delete"
COM_DEMO_LOOKS_DELETE_DESC="Allows the users in this group to delete delete looks"
COM_DEMO_LOOKS_EDIT="Looks Edit"
COM_DEMO_LOOKS_EDIT_ACRONYM="Looks Edit Acronym"
COM_DEMO_LOOKS_EDIT_ACRONYM_DESC="Allows the users in this group to update the edit acronym of the look"
COM_DEMO_LOOKS_EDIT_CREATED_BY="Looks Edit Created By"
COM_DEMO_LOOKS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by looks"
COM_DEMO_LOOKS_EDIT_CREATED_DATE="Looks Edit Created Date"
COM_DEMO_LOOKS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created looks"
COM_DEMO_LOOKS_EDIT_DESC="Allows the users in this group to edit the look"
COM_DEMO_LOOKS_EDIT_DESCRIPTION="Looks Edit Description"
COM_DEMO_LOOKS_EDIT_DESCRIPTION_DESC="Allows the users in this group to update the edit description of the look"
COM_DEMO_LOOKS_EDIT_MALE="Looks Edit Male"
COM_DEMO_LOOKS_EDIT_MALE_DESC="Allows the users in this group to update the edit male of the look"
COM_DEMO_LOOKS_EDIT_OWN="Looks Edit Own"
COM_DEMO_LOOKS_EDIT_OWN_DESC="Allows the users in this group to edit edit own looks created by them"
COM_DEMO_LOOKS_EDIT_STATE="Looks Edit State"
COM_DEMO_LOOKS_EDIT_STATE_DESC="Allows the users in this group to update the state of the look"
COM_DEMO_LOOKS_EDIT_VERSION="Looks Edit Version"
COM_DEMO_LOOKS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version looks"
COM_DEMO_LOOKS_EXPORT="Looks Export"

View File

@ -42,6 +42,9 @@ class DemoModelDemo extends JModelList
);
// view access array
$viewAccess = array(
'look.create' => 'look.create',
'looks.access' => 'look.access',
'look.access' => 'look.access',
'looks.submenu' => 'look.submenu',
'looks.dashboard_list' => 'look.dashboard_list',
'look.dashboard_add' => 'look.dashboard_add',

View File

@ -18,38 +18,38 @@
/------------------------------------------------------------------------------------------------------*/
// Some Global Values
jform_XvephxzImu_required = false;
jform_yFWFBjoUSy_required = false;
jform_revjpJkdku_required = false;
jform_MhQPsZtPMB_required = false;
jform_CLxRiyFDWv_required = false;
jform_zgwHidMmGR_required = false;
jform_dapwGJswww_required = false;
jform_KfchXiEDHv_required = false;
// Initial Script
jQuery(document).ready(function()
{
var location_sLnxlWV = jQuery("#jform_location input[type='radio']:checked").val();
sLnxlWV(location_sLnxlWV);
var location_gvgNtFm = jQuery("#jform_location input[type='radio']:checked").val();
gvgNtFm(location_gvgNtFm);
var location_fqbSveC = jQuery("#jform_location input[type='radio']:checked").val();
fqbSveC(location_fqbSveC);
var location_GxWLKer = jQuery("#jform_location input[type='radio']:checked").val();
GxWLKer(location_GxWLKer);
var type_Xvephxz = jQuery("#jform_type").val();
Xvephxz(type_Xvephxz);
var type_CLxRiyF = jQuery("#jform_type").val();
CLxRiyF(type_CLxRiyF);
var type_yFWFBjo = jQuery("#jform_type").val();
yFWFBjo(type_yFWFBjo);
var type_zgwHidM = jQuery("#jform_type").val();
zgwHidM(type_zgwHidM);
var type_revjpJk = jQuery("#jform_type").val();
revjpJk(type_revjpJk);
var type_dapwGJs = jQuery("#jform_type").val();
dapwGJs(type_dapwGJs);
var target_MhQPsZt = jQuery("#jform_target input[type='radio']:checked").val();
MhQPsZt(target_MhQPsZt);
var target_KfchXiE = jQuery("#jform_target input[type='radio']:checked").val();
KfchXiE(target_KfchXiE);
});
// the sLnxlWV function
function sLnxlWV(location_sLnxlWV)
// the gvgNtFm function
function gvgNtFm(location_gvgNtFm)
{
// set the function logic
if (location_sLnxlWV == 1)
if (location_gvgNtFm == 1)
{
jQuery('#jform_admin_view').closest('.control-group').show();
}
@ -59,11 +59,11 @@ function sLnxlWV(location_sLnxlWV)
}
}
// the fqbSveC function
function fqbSveC(location_fqbSveC)
// the GxWLKer function
function GxWLKer(location_GxWLKer)
{
// set the function logic
if (location_fqbSveC == 2)
if (location_GxWLKer == 2)
{
jQuery('#jform_site_view').closest('.control-group').show();
}
@ -73,198 +73,198 @@ function fqbSveC(location_fqbSveC)
}
}
// the Xvephxz function
function Xvephxz(type_Xvephxz)
// the CLxRiyF function
function CLxRiyF(type_CLxRiyF)
{
if (isSet(type_Xvephxz) && type_Xvephxz.constructor !== Array)
if (isSet(type_CLxRiyF) && type_CLxRiyF.constructor !== Array)
{
var temp_Xvephxz = type_Xvephxz;
var type_Xvephxz = [];
type_Xvephxz.push(temp_Xvephxz);
var temp_CLxRiyF = type_CLxRiyF;
var type_CLxRiyF = [];
type_CLxRiyF.push(temp_CLxRiyF);
}
else if (!isSet(type_Xvephxz))
else if (!isSet(type_CLxRiyF))
{
var type_Xvephxz = [];
var type_CLxRiyF = [];
}
var type = type_Xvephxz.some(type_Xvephxz_SomeFunc);
var type = type_CLxRiyF.some(type_CLxRiyF_SomeFunc);
// set this function logic
if (type)
{
jQuery('#jform_url').closest('.control-group').show();
if (jform_XvephxzImu_required)
if (jform_CLxRiyFDWv_required)
{
updateFieldRequired('url',0);
jQuery('#jform_url').prop('required','required');
jQuery('#jform_url').attr('aria-required',true);
jQuery('#jform_url').addClass('required');
jform_XvephxzImu_required = false;
jform_CLxRiyFDWv_required = false;
}
}
else
{
jQuery('#jform_url').closest('.control-group').hide();
if (!jform_XvephxzImu_required)
if (!jform_CLxRiyFDWv_required)
{
updateFieldRequired('url',1);
jQuery('#jform_url').removeAttr('required');
jQuery('#jform_url').removeAttr('aria-required');
jQuery('#jform_url').removeClass('required');
jform_XvephxzImu_required = true;
jform_CLxRiyFDWv_required = true;
}
}
}
// the Xvephxz Some function
function type_Xvephxz_SomeFunc(type_Xvephxz)
// the CLxRiyF Some function
function type_CLxRiyF_SomeFunc(type_CLxRiyF)
{
// set the function logic
if (type_Xvephxz == 3)
if (type_CLxRiyF == 3)
{
return true;
}
return false;
}
// the yFWFBjo function
function yFWFBjo(type_yFWFBjo)
// the zgwHidM function
function zgwHidM(type_zgwHidM)
{
if (isSet(type_yFWFBjo) && type_yFWFBjo.constructor !== Array)
if (isSet(type_zgwHidM) && type_zgwHidM.constructor !== Array)
{
var temp_yFWFBjo = type_yFWFBjo;
var type_yFWFBjo = [];
type_yFWFBjo.push(temp_yFWFBjo);
var temp_zgwHidM = type_zgwHidM;
var type_zgwHidM = [];
type_zgwHidM.push(temp_zgwHidM);
}
else if (!isSet(type_yFWFBjo))
else if (!isSet(type_zgwHidM))
{
var type_yFWFBjo = [];
var type_zgwHidM = [];
}
var type = type_yFWFBjo.some(type_yFWFBjo_SomeFunc);
var type = type_zgwHidM.some(type_zgwHidM_SomeFunc);
// set this function logic
if (type)
{
jQuery('#jform_article').closest('.control-group').show();
if (jform_yFWFBjoUSy_required)
if (jform_zgwHidMmGR_required)
{
updateFieldRequired('article',0);
jQuery('#jform_article').prop('required','required');
jQuery('#jform_article').attr('aria-required',true);
jQuery('#jform_article').addClass('required');
jform_yFWFBjoUSy_required = false;
jform_zgwHidMmGR_required = false;
}
}
else
{
jQuery('#jform_article').closest('.control-group').hide();
if (!jform_yFWFBjoUSy_required)
if (!jform_zgwHidMmGR_required)
{
updateFieldRequired('article',1);
jQuery('#jform_article').removeAttr('required');
jQuery('#jform_article').removeAttr('aria-required');
jQuery('#jform_article').removeClass('required');
jform_yFWFBjoUSy_required = true;
jform_zgwHidMmGR_required = true;
}
}
}
// the yFWFBjo Some function
function type_yFWFBjo_SomeFunc(type_yFWFBjo)
// the zgwHidM Some function
function type_zgwHidM_SomeFunc(type_zgwHidM)
{
// set the function logic
if (type_yFWFBjo == 1)
if (type_zgwHidM == 1)
{
return true;
}
return false;
}
// the revjpJk function
function revjpJk(type_revjpJk)
// the dapwGJs function
function dapwGJs(type_dapwGJs)
{
if (isSet(type_revjpJk) && type_revjpJk.constructor !== Array)
if (isSet(type_dapwGJs) && type_dapwGJs.constructor !== Array)
{
var temp_revjpJk = type_revjpJk;
var type_revjpJk = [];
type_revjpJk.push(temp_revjpJk);
var temp_dapwGJs = type_dapwGJs;
var type_dapwGJs = [];
type_dapwGJs.push(temp_dapwGJs);
}
else if (!isSet(type_revjpJk))
else if (!isSet(type_dapwGJs))
{
var type_revjpJk = [];
var type_dapwGJs = [];
}
var type = type_revjpJk.some(type_revjpJk_SomeFunc);
var type = type_dapwGJs.some(type_dapwGJs_SomeFunc);
// set this function logic
if (type)
{
jQuery('#jform_content-lbl').closest('.control-group').show();
if (jform_revjpJkdku_required)
if (jform_dapwGJswww_required)
{
updateFieldRequired('content',0);
jQuery('#jform_content').prop('required','required');
jQuery('#jform_content').attr('aria-required',true);
jQuery('#jform_content').addClass('required');
jform_revjpJkdku_required = false;
jform_dapwGJswww_required = false;
}
}
else
{
jQuery('#jform_content-lbl').closest('.control-group').hide();
if (!jform_revjpJkdku_required)
if (!jform_dapwGJswww_required)
{
updateFieldRequired('content',1);
jQuery('#jform_content').removeAttr('required');
jQuery('#jform_content').removeAttr('aria-required');
jQuery('#jform_content').removeClass('required');
jform_revjpJkdku_required = true;
jform_dapwGJswww_required = true;
}
}
}
// the revjpJk Some function
function type_revjpJk_SomeFunc(type_revjpJk)
// the dapwGJs Some function
function type_dapwGJs_SomeFunc(type_dapwGJs)
{
// set the function logic
if (type_revjpJk == 2)
if (type_dapwGJs == 2)
{
return true;
}
return false;
}
// the MhQPsZt function
function MhQPsZt(target_MhQPsZt)
// the KfchXiE function
function KfchXiE(target_KfchXiE)
{
// set the function logic
if (target_MhQPsZt == 1)
if (target_KfchXiE == 1)
{
jQuery('#jform_groups').closest('.control-group').show();
if (jform_MhQPsZtPMB_required)
if (jform_KfchXiEDHv_required)
{
updateFieldRequired('groups',0);
jQuery('#jform_groups').prop('required','required');
jQuery('#jform_groups').attr('aria-required',true);
jQuery('#jform_groups').addClass('required');
jform_MhQPsZtPMB_required = false;
jform_KfchXiEDHv_required = false;
}
}
else
{
jQuery('#jform_groups').closest('.control-group').hide();
if (!jform_MhQPsZtPMB_required)
if (!jform_KfchXiEDHv_required)
{
updateFieldRequired('groups',1);
jQuery('#jform_groups').removeAttr('required');
jQuery('#jform_groups').removeAttr('aria-required');
jQuery('#jform_groups').removeClass('required');
jform_MhQPsZtPMB_required = true;
jform_KfchXiEDHv_required = true;
}
}
}

View File

@ -18,23 +18,23 @@
/------------------------------------------------------------------------------------------------------*/
// Some Global Values
jform_FKWPxIhXqG_required = false;
jform_xEVTobmbza_required = false;
// Initial Script
jQuery(document).ready(function()
{
var name_CxBsGuj = jQuery("#jform_name").val();
CxBsGuj(name_CxBsGuj);
var name_RJYiubJ = jQuery("#jform_name").val();
RJYiubJ(name_RJYiubJ);
var add_FKWPxIh = jQuery("#jform_add input[type='radio']:checked").val();
FKWPxIh(add_FKWPxIh);
var add_xEVTobm = jQuery("#jform_add input[type='radio']:checked").val();
xEVTobm(add_xEVTobm);
});
// the CxBsGuj function
function CxBsGuj(name_CxBsGuj)
// the RJYiubJ function
function RJYiubJ(name_RJYiubJ)
{
// set the function logic
if (isSet(name_CxBsGuj))
if (isSet(name_RJYiubJ))
{
jQuery('#jform_alias').closest('.control-group').show();
jQuery('#jform_description').closest('.control-group').show();
@ -46,20 +46,20 @@ function CxBsGuj(name_CxBsGuj)
}
}
// the FKWPxIh function
function FKWPxIh(add_FKWPxIh)
// the xEVTobm function
function xEVTobm(add_xEVTobm)
{
// set the function logic
if (add_FKWPxIh == 1)
if (add_xEVTobm == 1)
{
jQuery('#jform_acronym').closest('.control-group').show();
if (jform_FKWPxIhXqG_required)
if (jform_xEVTobmbza_required)
{
updateFieldRequired('acronym',0);
jQuery('#jform_acronym').prop('required','required');
jQuery('#jform_acronym').attr('aria-required',true);
jQuery('#jform_acronym').addClass('required');
jform_FKWPxIhXqG_required = false;
jform_xEVTobmbza_required = false;
}
jQuery('#jform_website').closest('.control-group').show();
@ -67,13 +67,13 @@ function FKWPxIh(add_FKWPxIh)
else
{
jQuery('#jform_acronym').closest('.control-group').hide();
if (!jform_FKWPxIhXqG_required)
if (!jform_xEVTobmbza_required)
{
updateFieldRequired('acronym',1);
jQuery('#jform_acronym').removeAttr('required');
jQuery('#jform_acronym').removeAttr('aria-required');
jQuery('#jform_acronym').removeClass('required');
jform_FKWPxIhXqG_required = true;
jform_xEVTobmbza_required = true;
}
jQuery('#jform_website').closest('.control-group').hide();
}

View File

@ -136,8 +136,8 @@ class DemoModelLook extends JModelAdmin
// Check for existing item.
// Modify the form based on Edit State access controls.
if ($id != 0 && (!$user->authorise('core.edit.state', 'com_demo.look.' . (int) $id))
|| ($id == 0 && !$user->authorise('core.edit.state', 'com_demo')))
if ($id != 0 && (!$user->authorise('look.edit.state', 'com_demo.look.' . (int) $id))
|| ($id == 0 && !$user->authorise('look.edit.state', 'com_demo')))
{
// Disable fields for display.
$form->setFieldAttribute('ordering', 'disabled', 'true');
@ -147,7 +147,8 @@ class DemoModelLook extends JModelAdmin
$form->setFieldAttribute('published', 'filter', 'unset');
}
// Modify the form based on Edit Creaded By access controls.
if (!$user->authorise('core.edit.created_by', 'com_demo'))
if ($id != 0 && (!$user->authorise('look.edit.created_by', 'com_demo.look.' . (int) $id))
|| ($id == 0 && !$user->authorise('look.edit.created_by', 'com_demo')))
{
// Disable fields for display.
$form->setFieldAttribute('created_by', 'disabled', 'true');
@ -157,13 +158,65 @@ class DemoModelLook 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_demo'))
if ($id != 0 && (!$user->authorise('look.edit.created', 'com_demo.look.' . (int) $id))
|| ($id == 0 && !$user->authorise('look.edit.created', 'com_demo')))
{
// Disable fields for display.
$form->setFieldAttribute('created', 'disabled', 'true');
// Disable fields while saving.
$form->setFieldAttribute('created', 'filter', 'unset');
}
// Modify the form based on Edit Description access controls.
if ($id != 0 && (!$user->authorise('look.edit.description', 'com_demo.look.' . (int) $id))
|| ($id == 0 && !$user->authorise('look.edit.description', 'com_demo')))
{
// Disable fields for display.
$form->setFieldAttribute('description', 'disabled', 'true');
// Disable fields for display.
$form->setFieldAttribute('description', 'readonly', 'true');
if (!$form->getValue('description'))
{
// Disable fields while saving.
$form->setFieldAttribute('description', 'filter', 'unset');
// Disable fields while saving.
$form->setFieldAttribute('description', 'required', 'false');
}
}
// Modify the form based on Edit Acronym access controls.
if ($id != 0 && (!$user->authorise('look.edit.acronym', 'com_demo.look.' . (int) $id))
|| ($id == 0 && !$user->authorise('look.edit.acronym', 'com_demo')))
{
// Disable fields for display.
$form->setFieldAttribute('acronym', 'disabled', 'true');
// Disable fields for display.
$form->setFieldAttribute('acronym', 'readonly', 'true');
if (!$form->getValue('acronym'))
{
// Disable fields while saving.
$form->setFieldAttribute('acronym', 'filter', 'unset');
// Disable fields while saving.
$form->setFieldAttribute('acronym', 'required', 'false');
}
}
// Modify the form based on Edit Male access controls.
if ($id != 0 && (!$user->authorise('look.edit.male', 'com_demo.look.' . (int) $id))
|| ($id == 0 && !$user->authorise('look.edit.male', 'com_demo')))
{
// Disable fields for display.
$form->setFieldAttribute('male', 'disabled', 'true');
// Disable fields for display.
$form->setFieldAttribute('male', 'readonly', 'true');
// Disable radio button for display.
$class = $form->getFieldAttribute('male', 'class', '');
$form->setFieldAttribute('male', 'class', $class.' disabled no-click');
if (!$form->getValue('male'))
{
// Disable fields while saving.
$form->setFieldAttribute('male', 'filter', 'unset');
// Disable fields while saving.
$form->setFieldAttribute('male', 'required', 'false');
}
}
return $form;
}
@ -198,7 +251,7 @@ class DemoModelLook extends JModelAdmin
$user = JFactory::getUser();
// The record has been set. Check the record permissions.
return $user->authorise('core.delete', 'com_demo.look.' . (int) $record->id);
return $user->authorise('look.delete', 'com_demo.look.' . (int) $record->id);
}
return false;
}
@ -220,14 +273,14 @@ class DemoModelLook extends JModelAdmin
if ($recordId)
{
// The record has been set. Check the record permissions.
$permission = $user->authorise('core.edit.state', 'com_demo.look.' . (int) $recordId);
$permission = $user->authorise('look.edit.state', 'com_demo.look.' . (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('look.edit.state', 'com_demo');
}
/**
@ -242,8 +295,9 @@ class DemoModelLook 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_demo.look.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key);
return $user->authorise('look.edit', 'com_demo.look.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('look.edit', 'com_demo');
}
/**
@ -492,7 +546,7 @@ class DemoModelLook extends JModelAdmin
$this->canDo = DemoHelper::getActions('look');
}
if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch'))
if (!$this->canDo->get('look.create') && !$this->canDo->get('look.batch'))
{
return false;
}
@ -507,7 +561,7 @@ class DemoModelLook extends JModelAdmin
{
$values['published'] = 0;
}
elseif (isset($values['published']) && !$this->canDo->get('core.edit.state'))
elseif (isset($values['published']) && !$this->canDo->get('look.edit.state'))
{
$values['published'] = 0;
}
@ -524,7 +578,7 @@ class DemoModelLook extends JModelAdmin
// only allow copy if user may edit this item.
if (!$this->user->authorise('core.edit', $contexts[$pk]))
if (!$this->user->authorise('look.edit', $contexts[$pk]))
{
@ -641,14 +695,14 @@ class DemoModelLook extends JModelAdmin
$this->canDo = DemoHelper::getActions('look');
}
if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch'))
if (!$this->canDo->get('look.edit') && !$this->canDo->get('look.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('look.edit.state'))
{
unset($values['published']);
}
@ -658,7 +712,7 @@ class DemoModelLook extends JModelAdmin
// Parent exists so we proceed
foreach ($pks as $pk)
{
if (!$this->user->authorise('core.edit', $contexts[$pk]))
if (!$this->user->authorise('look.edit', $contexts[$pk]))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));

View File

@ -112,7 +112,24 @@ class DemoModelLooks extends JModelList
$this->checkInNow();
// load parent items
$items = parent::getItems();
$items = parent::getItems();
// set values to display correctly.
if (DemoHelper::checkArray($items))
{
// get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
$access = ($user->authorise('look.access', 'com_demo.look.' . (int) $item->id) && $user->authorise('look.access', 'com_demo'));
if (!$access)
{
unset($items[$nr]);
continue;
}
}
}
// set selection value to a translatable value
if (DemoHelper::checkArray($items))
@ -275,8 +292,17 @@ class DemoModelLooks extends JModelList
// set values to display correctly.
if (DemoHelper::checkArray($items))
{
// get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
$access = ($user->authorise('look.access', 'com_demo.look.' . (int) $item->id) && $user->authorise('look.access', 'com_demo'));
if (!$access)
{
unset($items[$nr]);
continue;
}
// unset the values we don't want exported.
unset($item->asset_id);
unset($item->checked_out);

View File

@ -95,93 +95,93 @@ $componentParams = JComponentHelper::getParams('com_demo');
<script type="text/javascript">
// #jform_location listeners for location_sLnxlWV function
// #jform_location listeners for location_gvgNtFm function
jQuery('#jform_location').on('keyup',function()
{
var location_sLnxlWV = jQuery("#jform_location input[type='radio']:checked").val();
sLnxlWV(location_sLnxlWV);
var location_gvgNtFm = jQuery("#jform_location input[type='radio']:checked").val();
gvgNtFm(location_gvgNtFm);
});
jQuery('#adminForm').on('change', '#jform_location',function (e)
{
e.preventDefault();
var location_sLnxlWV = jQuery("#jform_location input[type='radio']:checked").val();
sLnxlWV(location_sLnxlWV);
var location_gvgNtFm = jQuery("#jform_location input[type='radio']:checked").val();
gvgNtFm(location_gvgNtFm);
});
// #jform_location listeners for location_fqbSveC function
// #jform_location listeners for location_GxWLKer function
jQuery('#jform_location').on('keyup',function()
{
var location_fqbSveC = jQuery("#jform_location input[type='radio']:checked").val();
fqbSveC(location_fqbSveC);
var location_GxWLKer = jQuery("#jform_location input[type='radio']:checked").val();
GxWLKer(location_GxWLKer);
});
jQuery('#adminForm').on('change', '#jform_location',function (e)
{
e.preventDefault();
var location_fqbSveC = jQuery("#jform_location input[type='radio']:checked").val();
fqbSveC(location_fqbSveC);
var location_GxWLKer = jQuery("#jform_location input[type='radio']:checked").val();
GxWLKer(location_GxWLKer);
});
// #jform_type listeners for type_Xvephxz function
// #jform_type listeners for type_CLxRiyF function
jQuery('#jform_type').on('keyup',function()
{
var type_Xvephxz = jQuery("#jform_type").val();
Xvephxz(type_Xvephxz);
var type_CLxRiyF = jQuery("#jform_type").val();
CLxRiyF(type_CLxRiyF);
});
jQuery('#adminForm').on('change', '#jform_type',function (e)
{
e.preventDefault();
var type_Xvephxz = jQuery("#jform_type").val();
Xvephxz(type_Xvephxz);
var type_CLxRiyF = jQuery("#jform_type").val();
CLxRiyF(type_CLxRiyF);
});
// #jform_type listeners for type_yFWFBjo function
// #jform_type listeners for type_zgwHidM function
jQuery('#jform_type').on('keyup',function()
{
var type_yFWFBjo = jQuery("#jform_type").val();
yFWFBjo(type_yFWFBjo);
var type_zgwHidM = jQuery("#jform_type").val();
zgwHidM(type_zgwHidM);
});
jQuery('#adminForm').on('change', '#jform_type',function (e)
{
e.preventDefault();
var type_yFWFBjo = jQuery("#jform_type").val();
yFWFBjo(type_yFWFBjo);
var type_zgwHidM = jQuery("#jform_type").val();
zgwHidM(type_zgwHidM);
});
// #jform_type listeners for type_revjpJk function
// #jform_type listeners for type_dapwGJs function
jQuery('#jform_type').on('keyup',function()
{
var type_revjpJk = jQuery("#jform_type").val();
revjpJk(type_revjpJk);
var type_dapwGJs = jQuery("#jform_type").val();
dapwGJs(type_dapwGJs);
});
jQuery('#adminForm').on('change', '#jform_type',function (e)
{
e.preventDefault();
var type_revjpJk = jQuery("#jform_type").val();
revjpJk(type_revjpJk);
var type_dapwGJs = jQuery("#jform_type").val();
dapwGJs(type_dapwGJs);
});
// #jform_target listeners for target_MhQPsZt function
// #jform_target listeners for target_KfchXiE function
jQuery('#jform_target').on('keyup',function()
{
var target_MhQPsZt = jQuery("#jform_target input[type='radio']:checked").val();
MhQPsZt(target_MhQPsZt);
var target_KfchXiE = jQuery("#jform_target input[type='radio']:checked").val();
KfchXiE(target_KfchXiE);
});
jQuery('#adminForm').on('change', '#jform_target',function (e)
{
e.preventDefault();
var target_MhQPsZt = jQuery("#jform_target input[type='radio']:checked").val();
MhQPsZt(target_MhQPsZt);
var target_KfchXiE = jQuery("#jform_target input[type='radio']:checked").val();
KfchXiE(target_KfchXiE);
});

View File

@ -101,33 +101,33 @@ $componentParams = JComponentHelper::getParams('com_demo');
<script type="text/javascript">
// #jform_name listeners for name_CxBsGuj function
// #jform_name listeners for name_RJYiubJ function
jQuery('#jform_name').on('keyup',function()
{
var name_CxBsGuj = jQuery("#jform_name").val();
CxBsGuj(name_CxBsGuj);
var name_RJYiubJ = jQuery("#jform_name").val();
RJYiubJ(name_RJYiubJ);
});
jQuery('#adminForm').on('change', '#jform_name',function (e)
{
e.preventDefault();
var name_CxBsGuj = jQuery("#jform_name").val();
CxBsGuj(name_CxBsGuj);
var name_RJYiubJ = jQuery("#jform_name").val();
RJYiubJ(name_RJYiubJ);
});
// #jform_add listeners for add_FKWPxIh function
// #jform_add listeners for add_xEVTobm function
jQuery('#jform_add').on('keyup',function()
{
var add_FKWPxIh = jQuery("#jform_add input[type='radio']:checked").val();
FKWPxIh(add_FKWPxIh);
var add_xEVTobm = jQuery("#jform_add input[type='radio']:checked").val();
xEVTobm(add_xEVTobm);
});
jQuery('#adminForm').on('change', '#jform_add',function (e)
{
e.preventDefault();
var add_FKWPxIh = jQuery("#jform_add input[type='radio']:checked").val();
FKWPxIh(add_FKWPxIh);
var add_xEVTobm = jQuery("#jform_add input[type='radio']:checked").val();
xEVTobm(add_xEVTobm);
});

View File

@ -90,12 +90,12 @@ class DemoViewLook extends JViewLegacy
// Built the actions for new and existing records.
if ($this->refid || $this->ref)
{
if ($this->canDo->get('core.create') && $isNew)
if ($this->canDo->get('look.create') && $isNew)
{
// We can create the record.
JToolBarHelper::save('look.save', 'JTOOLBAR_SAVE');
}
elseif ($this->canDo->get('core.edit'))
elseif ($this->canDo->get('look.edit'))
{
// We can save the record.
JToolBarHelper::save('look.save', 'JTOOLBAR_SAVE');
@ -116,7 +116,7 @@ class DemoViewLook extends JViewLegacy
if ($isNew)
{
// For new records, check the create permission.
if ($this->canDo->get('core.create'))
if ($this->canDo->get('look.create'))
{
JToolBarHelper::apply('look.apply', 'JTOOLBAR_APPLY');
JToolBarHelper::save('look.save', 'JTOOLBAR_SAVE');
@ -126,24 +126,24 @@ class DemoViewLook extends JViewLegacy
}
else
{
if ($this->canDo->get('core.edit'))
if ($this->canDo->get('look.edit'))
{
// We can save the new record
JToolBarHelper::apply('look.apply', 'JTOOLBAR_APPLY');
JToolBarHelper::save('look.save', 'JTOOLBAR_SAVE');
// We can save this record, but check the create permission to see
// if we can return to make a new one.
if ($this->canDo->get('core.create'))
if ($this->canDo->get('look.create'))
{
JToolBarHelper::custom('look.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
}
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('look.version'));
if ($this->state->params->get('save_history', 1) && $this->canDo->get('') && $canVersion)
if ($this->state->params->get('save_history', 1) && $this->canDo->get('look.edit') && $canVersion)
{
JToolbarHelper::versions('com_demo.look', $this->item->id);
}
if ($this->canDo->get('core.create'))
if ($this->canDo->get('look.create'))
{
JToolBarHelper::custom('look.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}

View File

@ -32,7 +32,7 @@ $edit = "index.php?option=com_demo&view=looks&task=look.edit";
?>
<tr class="row<?php echo $i % 2; ?>">
<td class="order nowrap center hidden-phone">
<?php if ($canDo->get('core.edit.state')): ?>
<?php if ($canDo->get('look.edit.state')): ?>
<?php
if ($this->saveOrder)
{
@ -55,7 +55,7 @@ $edit = "index.php?option=com_demo&view=looks&task=look.edit";
<?php endif; ?>
</td>
<td class="nowrap center">
<?php if ($canDo->get('core.edit')): ?>
<?php if ($canDo->get('look.edit')): ?>
<?php if ($item->checked_out) : ?>
<?php if ($canCheckin) : ?>
<?php echo JHtml::_('grid.id', $i, $item->id); ?>
@ -70,7 +70,7 @@ $edit = "index.php?option=com_demo&view=looks&task=look.edit";
<?php endif; ?>
</td>
<td class="nowrap">
<?php if ($canDo->get('core.edit')): ?>
<?php if ($canDo->get('look.edit')): ?>
<div class="name">
<a href="<?php echo $edit; ?>&id=<?php echo $item->id; ?>"><?php echo $this->escape($item->name); ?></a>
<?php if ($item->checked_out): ?>
@ -94,7 +94,7 @@ $edit = "index.php?option=com_demo&view=looks&task=look.edit";
<?php echo $this->escape($item->website); ?>
</td>
<td class="center">
<?php if ($canDo->get('core.edit.state')) : ?>
<?php if ($canDo->get('look.edit.state')) : ?>
<?php if ($item->checked_out) : ?>
<?php if ($canCheckin) : ?>
<?php echo JHtml::_('jgrid.published', $item->published, $i, 'looks.', true, 'cb'); ?>

View File

@ -58,10 +58,10 @@ class DemoViewLooks extends JViewLegacy
$this->saveOrder = $this->listOrder == 'ordering';
// get global action permissions
$this->canDo = DemoHelper::getActions('look');
$this->canEdit = $this->canDo->get('core.edit');
$this->canState = $this->canDo->get('core.edit.state');
$this->canCreate = $this->canDo->get('core.create');
$this->canDelete = $this->canDo->get('core.delete');
$this->canEdit = $this->canDo->get('look.edit');
$this->canState = $this->canDo->get('look.edit.state');
$this->canCreate = $this->canDo->get('look.create');
$this->canDelete = $this->canDo->get('look.delete');
$this->canBatch = $this->canDo->get('core.batch');
// We don't need toolbar in the modal window.