Skip to content

Commit

Permalink
Merge pull request #153 from techjoomla/release-1.2.0
Browse files Browse the repository at this point in the history
Release 1.2.0
  • Loading branch information
ankush-maherwal authored Jul 25, 2019
2 parents d7b58ec + e314c43 commit ce0f9f6
Show file tree
Hide file tree
Showing 70 changed files with 799 additions and 647 deletions.
1 change: 1 addition & 0 deletions src/components/com_tjucm/administrator/access.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
<action name="core.type.edititemstate" title="COM_TJUCM_PERMISSION_TYPE_ITEM_EDITSTATE" description="COM_TJUCM_PERMISSION_TYPE_ITEM_EDITSTATE_DESC" />
<action name="core.type.editownitem" title="COM_TJUCM_PERMISSION_TYPE_ITEM_EDITOWN" description="COM_TJUCM_PERMISSION_TYPE_ITEM_EDITOWN_DESC" />
<action name="core.type.deleteitem" title="COM_TJUCM_PERMISSION_TYPE_ITEM_DELETE" description="COM_TJUCM_PERMISSION_TYPE_ITEM_DELETE_DESC" />
<action name="core.type.deleteownitem" title="COM_TJUCM_PERMISSION_TYPE_ITEM_DELETEOWN" description="COM_TJUCM_PERMISSION_TYPE_ITEM_DELETEOWN_DESC" />
</section>
</access>
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ $(function() {
return
}
$('a').bind('click', function(evt) {
let href = $(evt.target).closest('a').attr('href');
let response = '';
let msg = '';
if (href !== undefined && !(href.match(/^#/) || href.trim() == '')) {
response = $(window).triggerHandler('beforeunload', response);
if (response && response != "") {
msg = response + "\n\n" + "Press OK to leave this page or Cancel to stay.";
if (!confirm(msg)) {
var tjucm_href = $(evt.target).closest('a').attr('href');
var tjucm_response = '';
var tjucm_msg = '';
if (tjucm_href !== undefined && !(tjucm_href.match(/^#/) || tjucm_href.trim() == '')) {
tjucm_response = $(window).triggerHandler('beforeunload', tjucm_response);
if (tjucm_response && tjucm_response != "") {
tjucm_msg = tjucm_response + "\n\n" + "Press OK to leave this page or Cancel to stay.";
if (!confirm(tjucm_msg)) {
return !1
}
}
window.location.href = href;
window.location.tjucm_href = tjucm_href;
return !1
}
return !0
Expand Down
14 changes: 7 additions & 7 deletions src/components/com_tjucm/administrator/assets/js/tjucm.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ var tjUcm = {
return false;
}

let cid = jQuery("input[name='cid[]']:checked");
let url = Joomla.getOptions('system.paths').base + "/index.php?option=com_tjucm&task=types.export&tmpl=component&"+Joomla.getOptions('csrf.token')+"=1";
var cid = jQuery("input[name='cid[]']:checked");
var url = Joomla.getOptions('system.paths').base + "/index.php?option=com_tjucm&task=types.export&tmpl=component&"+Joomla.getOptions('csrf.token')+"=1";

jQuery.each(cid, function(index, ele) {
url += '&cid[]='+ele.value;
Expand All @@ -28,12 +28,12 @@ var tjUcm = {
},
admin:{
openTjUcmSqueezeBox: function (link, modalWidth, modalHeight){
let width = jQuery(window).width();
let height = jQuery(window).height();
var width = jQuery(window).width();
var height = jQuery(window).height();

let wwidth = width-(width*((100-modalWidth)/100));
let hheight = height-(height*((100-modalHeight)/100));
var wwidth = width-(width*((100-modalWidth)/100));
var hheight = height-(height*((100-modalHeight)/100));
parent.SqueezeBox.open(link, { handler: 'iframe', size: {x: wwidth, y: hheight},classWindow: 'tjucm-modal'});
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,56 +5,54 @@ var tjucmRelatedFieldUpdatedOptions = '';
jQuery(document).ready(function()
{
/*Code to get item state*/
let itemState = jQuery('#itemState').val();
var itemState = jQuery('#itemState').val();

/*Code for auto save on blur event add new record or editing draft record only*/
if (itemState == '' || itemState === 0)
{
let showDraftSuccessMsg = "0";

let tjUcmAutoSave = jQuery('#item-form #tjucm-autosave').val();
var tjUcmAutoSave = jQuery('#item-form #tjucm-autosave').val();

/*Check if auto save is enabled for UCM type*/
if (tjUcmAutoSave == 1)
{
/* Save form values */
jQuery("#item-form").on("change select", ":input", function(){
steppedFormSave(this.form.id, "draft", showDraftSuccessMsg);
steppedFormSave(this.form.id, "draft", 0);
});

/* To save calendar field value */
jQuery("#item-form .field-calendar input:text").blur(function(){
let tjUcmFormDirty = jQuery('#item-form').hasClass('dirty');
var tjUcmFormDirty = jQuery('#item-form').hasClass('dirty');

if (tjUcmFormDirty === true)
{
steppedFormSave(this.form.id, "draft", showDraftSuccessMsg);
steppedFormSave(this.form.id, "draft", 0);
}
});
}
}

/*Update the options of related field for new record of subform*/
jQuery(document).on('subform-row-add', function(event, row){
let count = jQuery(row).attr('data-group').replace(jQuery(row).attr('data-base-name'), "");
var tjucmSubFormCount = jQuery(row).attr('data-group').replace(jQuery(row).attr('data-base-name'), "");

jQuery.each(tjucmRelatedFieldUpdatedOptions, function(index, value) {
if (value.templateId)
{
let newTemplateId = value.templateId.replace("XXX_XXX", count);
jQuery(row).find("#"+newTemplateId).html('');
var tjucmNewTemplateId = value.templateId.replace("XXX_XXX", tjucmSubFormCount);
jQuery(row).find("#"+tjucmNewTemplateId).html('');
jQuery.each(value.options, function(i, val) {
jQuery(row).find("#"+newTemplateId).append('<option value="'+val.value+'">'+val.text+'</option>');
jQuery(row).find("#"+tjucmNewTemplateId).append('<option value="'+val.value+'">'+val.text+'</option>');
});

jQuery(row).find("#"+newTemplateId).trigger("liszt:updated");
jQuery(row).find("#"+tjucmNewTemplateId).trigger("liszt:updated");
}
});
});
});

/* This function carries stepped saving via ajax */
function steppedFormSave(form_id, status, showDraftSuccessMsg = "1")
function steppedFormSave(form_id, status, showDraftSuccessMsg)
{
/* For AJAX save need to add this to prevent popup message for page unload*/
window.onbeforeunload = null;
Expand Down Expand Up @@ -100,7 +98,7 @@ function steppedFormSave(form_id, status, showDraftSuccessMsg = "1")
datatype:'JSON',
async: false,
success: function(data) {
let returnedData = JSON.parse(data);
var returnedData = JSON.parse(data);

if (returnedData.messages !== null)
{
Expand Down Expand Up @@ -146,9 +144,9 @@ function steppedFormSave(form_id, status, showDraftSuccessMsg = "1")
}

/* Update item id in the URL if the data is stored successfully */
let url = window.location.href.split('#')[0];
let separator = (url.indexOf("?")===-1)?"?":"&";
let newParam = "id=" + returnedData.data.id;
var tjucmUrl = window.location.href.split('#')[0];
var tjucmUrlSeparator = (tjucmUrl.indexOf("?")===-1)?"?":"&";
var tjucmNewParam = "id=" + returnedData.data.id;

/* Add content_id in ucmsubform records */
jQuery.each(returnedData.data.childContentIds, function(i, val) {
Expand All @@ -161,24 +159,24 @@ function steppedFormSave(form_id, status, showDraftSuccessMsg = "1")
jQuery("#"+value.elementId).html('');

jQuery.each(value.options, function(i, val) {
let selected = '';
var tjucmSelectedFieldOption = '';

if (val.selected == '1'){
selected = ' selected="selected" ';
tjucmSelectedFieldOption = ' selected="selected" ';
}

jQuery("#"+value.elementId).append('<option value="'+val.value+'" '+selected+'>'+val.text+'</option>');
jQuery("#"+value.elementId).append('<option value="'+val.value+'" '+tjucmSelectedFieldOption+'>'+val.text+'</option>');
});

jQuery("#"+value.elementId).trigger("liszt:updated");
});

if (!(url.indexOf(newParam) >= 0))
if (!(tjucmUrl.indexOf(tjucmNewParam) >= 0))
{
url+=separator+newParam;
tjucmUrl+=tjucmUrlSeparator+tjucmNewParam;
}

history.pushState(null, null, url);
history.pushState(null, null, tjucmUrl);
}

jQuery('#draftSave').attr('disabled', false);
Expand All @@ -205,7 +203,7 @@ function itemformactions(tab_id, navDirection)
var prevTabName = jQuery('ul#' + getTabId).find('li.active').prev('li').children('a').attr('href');

/* Once all fields are validated, enable Final Save*/
steppedFormSave('item-form', 'draft');
steppedFormSave('item-form', 'draft', 1);

if (navDirection == "next")
{
Expand Down
12 changes: 7 additions & 5 deletions src/components/com_tjucm/administrator/classes/funlist.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?php
/**
* @version SVN: <svn_id>
* @package Com_Tjucm
* @author Techjoomla <[email protected]>
* @copyright Copyright (c) 2009-2017 TechJoomla. All rights reserved.
* @license GNU General Public License version 2 or later.
* @package TJ-UCM
* @subpackage com_tjucm
*
* @author Techjoomla <[email protected]>
* @copyright Copyright (C) 2009 - 2019 Techjoomla. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/

defined('_JEXEC') or die('Restricted access');
jimport('joomla.form.form');

Expand Down
11 changes: 6 additions & 5 deletions src/components/com_tjucm/administrator/controller.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
/**
* @version SVN: <svn_id>
* @package Com_Tjucm
* @author Techjoomla <[email protected]>
* @copyright Copyright (c) 2009-2017 TechJoomla. All rights reserved.
* @license GNU General Public License version 2 or later.
* @package TJ-UCM
* @subpackage com_tjucm
*
* @author Techjoomla <[email protected]>
* @copyright Copyright (C) 2009 - 2019 Techjoomla. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/

// No direct access
Expand Down
13 changes: 7 additions & 6 deletions src/components/com_tjucm/administrator/controllers/item.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
/**
* @version SVN: <svn_id>
* @package Com_Tjucm
* @author Techjoomla <[email protected]>
* @copyright Copyright (c) 2009-2017 TechJoomla. All rights reserved.
* @license GNU General Public License version 2 or later.
* @package TJ-UCM
* @subpackage com_tjucm
*
* @author Techjoomla <[email protected]>
* @copyright Copyright (C) 2009 - 2019 Techjoomla. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/

// No direct access
Expand Down Expand Up @@ -329,7 +330,7 @@ public function save($key = null, $urlVar = null)
"clientComponent" => 'com_tjucm',
"client" => $this->client,
"view" => $client[1],
"layout" => 'edit')
"layout" => 'edit', )
);

if (!$formExtra)
Expand Down
11 changes: 6 additions & 5 deletions src/components/com_tjucm/administrator/controllers/items.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
/**
* @version SVN: <svn_id>
* @package Com_Tjucm
* @author Techjoomla <[email protected]>
* @copyright Copyright (c) 2009-2017 TechJoomla. All rights reserved.
* @license GNU General Public License version 2 or later.
* @package TJ-UCM
* @subpackage com_tjucm
*
* @author Techjoomla <[email protected]>
* @copyright Copyright (C) 2009 - 2019 Techjoomla. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/

// No direct access.
Expand Down
11 changes: 6 additions & 5 deletions src/components/com_tjucm/administrator/controllers/type.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
/**
* @version SVN: <svn_id>
* @package Com_Tjucm
* @author Techjoomla <[email protected]>
* @copyright Copyright (c) 2009-2017 TechJoomla. All rights reserved.
* @license GNU General Public License version 2 or later.
* @package TJ-UCM
* @subpackage com_tjucm
*
* @author Techjoomla <[email protected]>
* @copyright Copyright (C) 2009 - 2019 Techjoomla. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/

// No direct access
Expand Down
15 changes: 8 additions & 7 deletions src/components/com_tjucm/administrator/controllers/types.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
/**
* @version SVN: <svn_id>
* @package Com_Tjucm
* @author Techjoomla <[email protected]>
* @copyright Copyright (c) 2009-2017 TechJoomla. All rights reserved.
* @license GNU General Public License version 2 or later.
* @package TJ-UCM
* @subpackage com_tjucm
*
* @author Techjoomla <[email protected]>
* @copyright Copyright (C) 2009 - 2019 Techjoomla. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/

// No direct access.
Expand All @@ -29,7 +30,7 @@
class TjucmControllerTypes extends JControllerAdmin
{
use TjControllerHouseKeeping;

/**
* Method to clone existing Types
*
Expand Down Expand Up @@ -335,7 +336,7 @@ public function import()
$field['asset_id'] = '';
$field['created_by'] = $user->id;
$field['group_id'] = $fieldGroupId;
$field['saveOption'] = empty($options) ? 0 : 1 ;
$field['saveOption'] = empty($options) ? 0 : 1;
$field['params'] = (array) json_decode($field['params']);
$tmpName = str_replace('.', '_', $ucmTypeData['unique_identifier']) . '_';
$field['name'] = str_replace($tmpName, '', $field['name']);
Expand Down
13 changes: 7 additions & 6 deletions src/components/com_tjucm/administrator/helpers/listhelper.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
/**
* @version SVN: <svn_id>
* @package Com_Tjucm
* @author Techjoomla <[email protected]>
* @copyright Copyright (c) 2009-2017 TechJoomla. All rights reserved.
* @license GNU General Public License version 2 or later.
* @package TJ-UCM
* @subpackage com_tjucm
*
* @author Techjoomla <[email protected]>
* @copyright Copyright (C) 2009 - 2019 Techjoomla. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/

// No direct access
Expand Down Expand Up @@ -33,7 +34,7 @@ public static function toggle($value = 0, $view = '', $field = '', $i = '')
{
$states = array(
0 => array('icon-remove', JText::_('Toggle'), 'inactive btn-danger'),
1 => array('icon-checkmark', JText::_('Toggle'), 'active btn-success')
1 => array('icon-checkmark', JText::_('Toggle'), 'active btn-success'),
);

$state = \Joomla\Utilities\ArrayHelper::getValue($states, (int) $value, $states[0]);
Expand Down
17 changes: 6 additions & 11 deletions src/components/com_tjucm/administrator/helpers/tjucm.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
/**
* @version SVN: <svn_id>
* @package Com_Tjucm
* @author Techjoomla <[email protected]>
* @copyright Copyright (c) 2009-2017 TechJoomla. All rights reserved.
* @license GNU General Public License version 2 or later.
* @package TJ-UCM
* @subpackage com_tjucm
*
* @author Techjoomla <[email protected]>
* @copyright Copyright (C) 2009 - 2019 Techjoomla. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/

// No direct access
Expand All @@ -31,12 +32,6 @@ public static function addSubmenu($vName = '')
'index.php?option=com_tjucm&view=types',
$vName == 'types'
);

JHtmlSidebar::addEntry(
JText::_('COM_TJUCM_TITLE_ITEMS'),
'index.php?option=com_tjucm&view=items',
$vName == 'items'
);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
/**
* @package TJ-UCM
* @package TJ-UCM
* @subpackage com_tjucm
*
* @author Techjoomla <[email protected]>
* @copyright Copyright (c) 2009-2019 TechJoomla. All rights reserved.
* @license GNU General Public License version 2 or later.
* @author Techjoomla <[email protected]>
* @copyright Copyright (C) 2009 - 2019 Techjoomla. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/

// No direct access
Expand Down
Loading

0 comments on commit ce0f9f6

Please sign in to comment.