Skip to content

Commit

Permalink
Merge pull request #224 from techjoomla/release-1.4.4
Browse files Browse the repository at this point in the history
Release 1.4.4
  • Loading branch information
ankush-maherwal authored Dec 2, 2019
2 parents 0854c9d + f230a5a commit 21eb04f
Show file tree
Hide file tree
Showing 18 changed files with 347 additions and 33 deletions.
2 changes: 2 additions & 0 deletions admin_language/en-GB/en-GB.com_tjfields.ini
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ COM_TJFIELDS_YES="Yes"
COMTJFILEDS_FIELD_CREATED_SUCCESSFULLY="Field saved successfully"
COMTJFILEDS_GROUP_CREATED_SUCCESSFULLY="Group saved successfully"
COM_TJFIELDS_NUMBER="Number"
COM_TJFIELDS_COLOR="Colour(color)"


; Since 1.1 - Aug 2014
; Countries list
Expand Down
1 change: 1 addition & 0 deletions administrator/assets/css/bootstrap-tagsinput.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions administrator/assets/js/bootstrap-tagsinput.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 26 additions & 2 deletions administrator/assets/js/tjlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,19 @@
* @license GNU General Public License version 2, or later
*/
var tjlist = {

addOtherOption: function (element) {

jQuery(tjlist.getTextBox(element)).insertAfter(element.next(".chzn-container"));

setTimeout(function() {
element.siblings('div.tjfieldTjListOtherText').children('.bootstrap-tagsinput').children().focus();

if (element.attr('multiple') == undefined)
{
element.siblings('div.tjfieldTjListOtherText').children().focus();
}

}, 100);
},
removeOtherOption: function (element) {

Expand All @@ -21,7 +30,22 @@ var tjlist = {
isRequired = (element.attr('required') != undefined) ? 'required="required"' : '',
requiredClass = (isRequired != '') ? 'required' : '';

return '<div class="tjfieldTjListOtherText"><br/><input ' + isRequired + ' type="text" name="' + inputName + '" id="' + inputId + '" value="" class=" ' + requiredClass + '" aria-invalid="false"></div>';
if (element.attr('multiple') != undefined)
{
this.loadTagsinputjs();
var tagInput = (element.attr('multiple') != undefined) ? 'data-role="tagsinput"' : '';
}

return '<div class="tjfieldTjListOtherText"><br/><input ' + tagInput + ' placeholder="' + Joomla.JText._('COM_TJFIELDS_OTHER_VALUE') + '" ' + isRequired + ' type="text" name="' + inputName + '" id="' + inputId + '" value="" class=" focus ' + requiredClass + '" aria-invalid="false"></div>';
},
loadTagsinputjs: function()
{
var head= document.getElementsByTagName('head')[0];
var script= document.createElement('script');

// @Todo - Decide right place to store below JS
script.src= Joomla.getOptions('system.paths').base +'/administrator/components/com_tjfields/assets/js/bootstrap-tagsinput.min.js';
head.appendChild(script);
}
}

Expand Down
2 changes: 1 addition & 1 deletion administrator/assets/js/tjlist.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions administrator/helpers/tjfields.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,13 @@ public function createXml($data, $fields, $category = null)
// Get backend XML file path
if (!empty($category['category_id']))
{
$filePathBackend = JPATH_SITE . DS . 'administrator/components/' .
$filePathBackend = JPATH_ADMINISTRATOR . '/components/' .
$explodeForCom[0] . '/models/forms/' . $category['category_id'] .
$data['client_type'] . '_extra.xml';
}
else
{
$filePathBackend = JPATH_SITE . DS . 'administrator/components/' .
$filePathBackend = JPATH_ADMINISTRATOR . '/components/' .
$explodeForCom[0] . '/models/forms/' .
$data['client_type'] . '_extra.xml';
}
Expand Down
29 changes: 28 additions & 1 deletion administrator/models/field.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
jimport('joomla.application.component.modeladmin');

use Joomla\Registry\Registry;
use Joomla\CMS\Form\FormHelper;

/**
* Tjfields model.
Expand Down Expand Up @@ -288,7 +289,7 @@ public function save($data)
if ($data['id'] == 0)
{
// Escape apostraphe
$data_name = trim(preg_replace('/[^A-Za-z0-9\-\']/', '', $data['name']));
$data_name = trim(preg_replace('/[^a-zA-Z0-9]/', '', $data['name']));
$client = explode('.', $data['client']);
$client = $client[0];
$data_unique_name = $client . '_' . $data['client_type'] . '_' . $data_name;
Expand Down Expand Up @@ -692,6 +693,32 @@ public function getRelatedFieldOptions($fieldId)
{
$query->where($db->quoteName('cluster_id') . ' = ' . $clusterId);
}
else
{
FormHelper::addFieldPath(JPATH_ADMINISTRATOR . '/components/com_tjfields/models/fields/');
$cluster = FormHelper::loadFieldType('cluster', false);
$clusterList = $cluster->getOptionsExternally();
$usersClusters = array();

if (!empty($clusterList))
{
foreach ($clusterList as $clusterList)
{
if (!empty($clusterList->value))
{
$usersClusters[] = $clusterList->value;
}
}
}

// If cluster array empty then we set 0 in whereclause query
if (empty($usersClusters))
{
$usersClusters[] = 0;
}

$query->where($db->quoteName('cluster_id') . ' IN (' . implode(",", $usersClusters) . ')');
}
}

$parentContentId = $jInput->get('id', 0, 'INT');
Expand Down
13 changes: 13 additions & 0 deletions administrator/models/fields/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,23 @@ protected function getInput()
$data = $this->buildData($layoutData);
$html .= $data->html;

// To get the file name from URL
$substrString = substr($data->mediaLink, strlen('fpht=') + strpos($data->mediaLink, 'fpht='));
$substrString = substr($substrString, 0, strpos($substrString, '&'));

// Decode the filename
$fileName = base64_decode($substrString);

if (!empty($data->mediaLink))
{
$html .= $this->canDownloadFile($data, $layoutData);
$html .= $this->canDeleteFile($data, $layoutData);

// To display the file name if exist and skip the prepended file name value
if (!empty($fileName))
{
$html .= '<strong class="ml-15"> ' . substr($fileName, strpos($fileName, '_', 12) + 1) . '</strong>';
}
}

$html .= '</div>';
Expand Down
13 changes: 13 additions & 0 deletions administrator/models/fields/related.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,25 @@ protected function getInput()

// UCM fields and field value to get
$showAddNewRecordLink = $fieldParams->get('showAddNewRecordLink');
$clusterAware = $fieldParams->get('clusterAware');

if ($canCreate && !empty($showAddNewRecordLink))
{
$tjUcmFrontendHelper = new TjucmHelpersTjucm;
$itemId = $tjUcmFrontendHelper->getItemId('index.php?option=com_tjucm&view=itemform&client=' . $ucmTypeTable->unique_identifier);
$masterUcmLink = Route::_('index.php?option=com_tjucm&view=itemform&Itemid=' . $itemId, false);

if ($clusterAware)
{
$input = JFactory::getApplication()->input;
$clusterId = $input->get("cluster_id", 0, "INT");

if ($clusterId)
{
$masterUcmLink .= (strpos($masterUcmLink, '?')) ? '&cluster_id=' . $clusterId : '?cluster_id=' . $clusterId;
}
}

$html .= "<div><a target='_blank' href='" . $masterUcmLink . "'>" . Text::_("COM_TJFIELDS_FORM_DESC_FIELD_RELATED_ADD_RECORD") . "</a></div>";
}
}
Expand Down
1 change: 1 addition & 0 deletions administrator/models/fields/tjfieldfields.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ protected function getInput()
}

$options[] = JHtml::_('select.option', 'ownership', JText::_('COM_TJFIELDS_OWNERSHIP'));
$options[] = JHtml::_('select.option', 'color', JText::_('COM_TJFIELDS_COLOR'));

$options = array_merge(parent::getOptions(), $options);

Expand Down
Loading

0 comments on commit 21eb04f

Please sign in to comment.