Skip to content

Commit

Permalink
Merge pull request #186 from ankush-maherwal/release-1.2.1
Browse files Browse the repository at this point in the history
Task #123 feat: related fields
  • Loading branch information
ankush-maherwal authored Oct 4, 2019
2 parents 5250b5d + 0e455c2 commit 54295f5
Show file tree
Hide file tree
Showing 22 changed files with 2,332 additions and 327 deletions.
1,079 changes: 1,079 additions & 0 deletions src/components/com_tjucm/administrator/assets/js/itemform.js

Large diffs are not rendered by default.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<option value="2">JARCHIVED</option>
<option value="-2">JTRASHED</option>
</field>
<field name="allowed_count" type="number" label="COM_TJUCM_FORM_LBL_TYPE_ALLOWED_COUNT" description="COM_TJUCM_FORM_DESC_TYPE_ALLOWED_COUNT" hint="COM_TJUCM_FORM_LBL_TYPE_ALLOWED_COUNT" showon="is_subform:0"/>
<field name="allowed_count" type="number" label="COM_TJUCM_FORM_LBL_TYPE_ALLOWED_COUNT" description="COM_TJUCM_FORM_DESC_TYPE_ALLOWED_COUNT" hint="COM_TJUCM_FORM_LBL_TYPE_ALLOWED_COUNT" default="0" showon="is_subform:0"/>
<field name="allow_auto_save" type="radio" class="btn-group" default="1" label="COM_TJUCM_FORM_LBL_TYPE_ALLOW_AUTO_SAVE" description="COM_TJUCM_FORM_DESC_TYPE_ALLOW_AUTO_SAVE" hint="COM_TJUCM_FORM_LBL_TYPE_ALLOW_AUTO_SAVE" showon="is_subform:0">
<option value="0">JNO</option>
<option value="1">JYES</option>
Expand Down
53 changes: 9 additions & 44 deletions src/components/com_tjucm/administrator/tables/item.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,63 +34,28 @@ public function __construct(&$db)
/**
* Overloaded bind function to pre-process the params.
*
* @param array $array Named array
* @param array $data Named array
* @param mixed $ignore Optional array or list of parameters to ignore
*
* @return null|string null is operation was satisfactory, otherwise returns an error
*
* @see JTable:bind
* @since 1.5
*/
public function bind($array, $ignore = '')
public function bind($data, $ignore = '')
{
if ($array['id'] == 0)
if (empty($data['id']))
{
$array['created_by'] = !empty($array['created_by']) ? $array['created_by'] : JFactory::getUser()->id;
$array['created_date'] = JFactory::getDate()->toSql();
$data['created_by'] = JFactory::getUser()->id;
$data['created_date'] = JFactory::getDate()->toSql();
}

$array['modified_by'] = JFactory::getUser()->id;
$array['modified_date'] = JFactory::getDate()->toSql();

if (isset($array['params']) && is_array($array['params']))
{
$registry = new JRegistry;
$registry->loadArray($array['params']);
$array['params'] = (string) $registry;
}

if (isset($array['metadata']) && is_array($array['metadata']))
{
$registry = new JRegistry;
$registry->loadArray($array['metadata']);
$array['metadata'] = (string) $registry;
}

if (!JFactory::getUser()->authorise('core.admin', 'com_tjucm.item.' . $array['id']))
{
$actions = JAccess::getActionsFromFile(
JPATH_ADMINISTRATOR . '/components/com_tjucm/access.xml',
"/access/section[@name='item']/"
);
$default_actions = JAccess::getAssetRules('com_tjucm.item.' . $array['id'])->getData();
$array_jaccess = array();

foreach ($actions as $action)
{
$array_jaccess[$action->name] = $default_actions[$action->name];
}

$array['rules'] = $this->JAccessRulestoArray($array_jaccess);
}

// Bind the rules for ACL where supported.
if (isset($array['rules']) && is_array($array['rules']))
else
{
$this->setRules($array['rules']);
$data['modified_by'] = JFactory::getUser()->id;
$data['modified_date'] = JFactory::getDate()->toSql();
}

return parent::bind($array, $ignore);
return parent::bind($data, $ignore);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
$lang->load('com_tjucm', JPATH_SITE);
$doc = JFactory::getDocument();
$doc->addScript(JUri::root() . 'administrator/components/com_tjucm/assets/js/jquery.form.js');
$doc->addScript(JUri::root() . 'administrator/components/com_tjucm/assets/js/tjucm_ajaxForm_save.js');
$doc->addScript(JUri::root() . 'administrator/components/com_tjucm/assets/js/itemform.js');
$doc->addScript(JUri::root() . 'administrator/components/com_tjucm/assets/js/tjfield.js');

$jinput = JFactory::getApplication();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
COM_TJUCM="TJ - UCM"
COM_TJUCM_ITEM_SAVED_SUCCESSFULLY="Item saved successfully"
COM_TJUCM_ITEM_DRAFT_SAVED_SUCCESSFULLY="Item successfully saved as draft"
COM_TJUCM_ITEM_DELETED_SUCCESSFULLY="Item deleted successfully"
COM_TJUCM_ITEM_DOESNT_EXIST="Item does not exist"
COM_TJUCM_ITEM_NOT_LOADED="Could not load the item"
Expand Down Expand Up @@ -169,3 +170,11 @@ COM_TJUCM_FILE_DELETE_ERROR="Sorry the file could not be deleted, please try aga
COM_TJUCM_FILE_DELETE_CONFIRM="Are you sure you want to delete this file?"
COM_TJUCM_MSG_FOR_AUTOSAVE_FEATURE_DISABLED="Your changes will be lost if you don’t save them. Submit the form to update your changes.";
COM_TJUCM_NO_FORM_DATA="No data to save";

; Since 1.2.1
COM_TJUCM_FORM_VALIDATATION_FAILED="Provided data is not valid"
COM_TJUCM_FORM_SAVE_FAILED="Unable to process the request"
COM_TJUCM_FORM_SAVE_FAILED_CLIENT_REQUIRED="Unable to process the request as client is not provided"
COM_TJUCM_FORM_SAVE_FAILED_RECORD_ID_REQUIRED="Unable to process the request as record id is not provided"
COM_TJUCM_FORM_SAVE_FAILED_FIELD_DATA_REQUIRED="Unable to process the request as field data is not provided"
COM_TJUCM_FORM_SAVE_FAILED_AUTHORIZATION_ERROR="You are not authorized to perform this operation."
3 changes: 3 additions & 0 deletions src/components/com_tjucm/media/js/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<FilesMatch ".*">
Allow from All
</FilesMatch>
9 changes: 9 additions & 0 deletions src/components/com_tjucm/media/js/com_tjucm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Declare Namespace
/** global: window */
window.com_tjucm = {};
var Services = function () {};
var UI = function () {};
window.com_tjucm.Services = new Services();
window.com_tjucm.UI = new UI();
Services = undefined;
UI = undefined;
Loading

0 comments on commit 54295f5

Please sign in to comment.