From 2a0dfa26cafd2c790a59cb6b168023b85afe3362 Mon Sep 17 00:00:00 2001 From: Joseph Geller Date: Fri, 28 Sep 2018 17:48:35 -0500 Subject: [PATCH] Updated 4a. JCB Demo Component Directory, Folders and Files (markdown) --- ...-Component-Directory,-Folders-and-Files.md | 33 ++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/4a.-JCB-Demo-Component-Directory,-Folders-and-Files.md b/4a.-JCB-Demo-Component-Directory,-Folders-and-Files.md index c451da4..1618635 100644 --- a/4a.-JCB-Demo-Component-Directory,-Folders-and-Files.md +++ b/4a.-JCB-Demo-Component-Directory,-Folders-and-Files.md @@ -330,19 +330,20 @@ Doing the above also ensures only certain actions are allowed for certain users. * Save and Close * Close -The filter allows them to edit only their own look records in the demo_look table. Login to the site area as a Super Administrator to see all records in the admin view. Performing the previous instructions also restricts a Registered User's actions to display only the following buttons in the looking view: +The filter allows them to edit only their own look records in the demo_look table. If you need to see all of the demo records, using all the edit features and available buttons, and more, login to the site area as a Super Administrator to see all records in the admin view. If you perform the previous instructions a Registered User's actions will be restricted to display only the following buttons in the looking view: * Save button * Save and Close button * Close button -If you add more permissions, more actions, as long as they have been defined first as was mentioned previously, and hence more buttons will be allowed such as Save and Copy. After adding the appropriate actions to the view and compiling it, change the JCB Demo component Joomla! ACL permissions and you can see the effect on what edit buttons appear immediately since components do not need to be compiled by JCB for these settings to change. +If you add more permissions such as Create, two more buttons will appear, Save and Copy plus Save and New. You can remove buttons by changing the permissions back to inherited which should then display as not allowed. Remember they must have been defined first, as mentioned previously, to appear in the list of Permissions. After adding the appropriate actions and permissions to the view and compiling it, the changes will take effect. Note, you can change the JCB Demo component Joomla! ACL permissions and see the effect since components do not need to be compiled by JCB for these settings to change since the change is being done within Joomla!. Continuing with the edit functionality: -* Edit the look record in the demo_look table. It is important you understand this is reusing the admin view look, edit look. You can see this in the form tag located in the source of the page. Use a browser tool such as Chrome, Developer tools to do this. +* Edit the look record in the demo_look table. It is important you understand this is reusing the admin view look, edit look. If you use Chrome Developer tools to view the page source and go to the form tag you will see it is using the admin form in the looks view: +
* The registered user id of the logged in user must match the created_by value for it to display and allow the user to edit the record. -By default, the JCB demo allows all user types except public and guest user groups to view all looks, whether they created them or not. To restrict the looks to the specific user, besides the changes to the Joomla! ACL, one must filter the look records in the demo_looks table by owner id. Note, these will take effect without compiling the JCB Demo and other components built using it. The reason is the Joomla! ACL or the global options permissions of the JCB Demo component are being changed for Joomla!'s Registered User Group and not individual permissions within the JCB component. The latter allows for granularity by changing the Joomla! +allows all user types except public and guest user groups to view all looks, whether they created them or not. To restrict the looks view to only list records owned by the specific user, besides the changes to the Joomla! ACL, one must filter the look records in the demo_looks table by the created_by column. Note, these will take effect without compiling the JCB Demo and other components built using it. The reason is the Joomla! ACL or the global options permissions of the JCB Demo component are being changed for Joomla!'s Registered User Group and not individual permissions within the JCB component. The latter allows for granularity but normally should remain at the default value. * First, login as the registered user and select the looks option from the main menu. * The site view looks displays with the Name and Description of the registered user's look and an edit toolbar underneath. @@ -355,6 +356,30 @@ Then, click the edit toolbar and display the admin view look, displaying only th Note, the More button was enabled in the JCB demo to allow entry of additional fields on the form. +The role of libraries should be mentioned at this point. + +The code in the JCB Demos's looking view allows one to: +* Look (looking site view) at a +* Look (look site view and admin edit view of demo_look table record using +* Looks - Looks site view that lists look records in the demo_look table + +It's vital to understand the UIkit library and gain some familiarity with Foo Table and Bootstrap since JCB implements them. UIKit components are used quite a bit in the JCB freely distributed components. To construct a view in JCB, you must familiarize yourself with it. It has a small but powerful footprint. It is suggested to have the following link close by in your browser tabs as you code your site views using its button component as the example. + +https://getuikit.com/docs/button + +JCB uses the following version of UIkit: +/*! UIkit 2.27.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */ + +UIkit JavaScript for the button component is located at: +\media\com_componentbuilder\uikit-v2\js\components\button.js + +A button is called a component in the UIkit and there are many others that encapsulate client side code into more generalized functions that can be treated as objects with individual methods and properties. They are identified with the prefix "ui-". An example is the uk-comment class found in the JCB CSS file located at: +\media\com_componentbuilder\uikit-v2\css\uikit.css + +JCB adds this and other classes by adding the uiKit files to \media\com_demo\uikit-v2 in the Joomla! Demo installation package. For details see the link and list of uiKit components and code required to implement them as was done below in the area in JCB labeled Site View's Default View. Much of the code is straightforward PHP. Use the view's $this reference to the current object to get the value of an element on the page. For example, the template for the JCB Demo component exposes the logged in user's id in $this. The value of the id is obtained using $this->user->id and a good explanation of what $this is can be found [here ](http://www.php.net/manual/en/language.oop5.basic.php). Other values are also available and Observe the code reuse of Joomla! API classes, plus standard HTML. See the [[[Component]]]Helper JCB tag below also; it is located at: + +* Looking Site View + The code to do this is located in JCB in the view prefaced by: Custom Script - Add PHP (after getting the items) * - Yes - PHP getItems Method - Target (array) $items values *