Skip to content

Commit

Permalink
Task #123 feat: manual merge
Browse files Browse the repository at this point in the history
  • Loading branch information
ankush-maherwal committed Dec 11, 2019
2 parents e171fd2 + b495dcd commit f7ff1e3
Show file tree
Hide file tree
Showing 11 changed files with 96 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ public function migrate()
}
else
{
$tjfieldsFieldTable->name = str_replace('.', '_', $updatedUniqueIdentifier) . '_' . strtolower(preg_replace("/[^a-zA-Z0-9]/", "", $field->label));
$tjfieldsFieldTable->name = str_replace('.', '_', $updatedUniqueIdentifier) . '_' .
strtolower(preg_replace("/[^a-zA-Z0-9]/", "", $field->label));
}

$tjfieldsFieldTable->store();
Expand Down
13 changes: 0 additions & 13 deletions src/components/com_tjucm/administrator/models/item.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,6 @@ class TjucmModelItem extends JModelAdmin
// Use imported Trait in model
use TjfieldsFilterField;

/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
*
* @see JController
* @since 1.6
*/
public function __construct($config = array())
{
parent::__construct($config);
}

/**
* Get an array of data items
*
Expand Down
13 changes: 0 additions & 13 deletions src/components/com_tjucm/administrator/models/type.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,6 @@ class TjucmModelType extends JModelAdmin
*/
protected $item = null;

/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
*
* @see JController
* @since 1.6
*/
public function __construct($config = array())
{
parent::__construct($config);
}

/**
* Returns a reference to the a Table object, always creating it.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected function addToolbar()
$state = $this->get('State');
$canDo = TjucmHelper::getActions();

JToolBarHelper::title(JText::_('COM_TJUCM_TITLE_TYPES'), 'types.png');
JToolBarHelper::title(JText::_('COM_TJUCM_TITLE_TYPES'), 'list');

// Check if the form exists before showing the add/edit buttons
$formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/type';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ 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";
COM_TJUCM_FORM_LIST="LIST"
COM_TJUCM_EDIT_FORM="EDIT"


; Since 1.2.1
COM_TJUCM_FORM_VALIDATATION_FAILED="Provided data is not valid"
Expand Down
5 changes: 4 additions & 1 deletion src/components/com_tjucm/site/includes/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public function getShortVersion()
{
return self::MAJOR_VERSION . '.' . self::MINOR_VERSION . '.' . self::PATCH_VERSION;
}

/**
* Gets a version string for the current TJVendors with all release information.
*
Expand All @@ -73,6 +74,7 @@ public function getLongVersion()
{
return self::PRODUCT . ' ' . $this->getShortVersion() . ' ' . self::RELDATE;
}

/**
* Generate a media version string for assets
* Public to allow third party developers to use it
Expand All @@ -85,6 +87,7 @@ public function generateMediaVersion()
{
return md5($this->getLongVersion() . Factory::getConfig()->get('secret'));
}

/**
* Gets a media version which is used to append to TJVendors core media files.
*
Expand All @@ -100,4 +103,4 @@ public function getMediaVersion()
{
return $this->generateMediaVersion();
}
}
}
24 changes: 10 additions & 14 deletions src/components/com_tjucm/site/models/itemform.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,6 @@ class TjucmModelItemForm extends JModelAdmin
// Use imported Trait in model
use TjfieldsFilterField;

/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
*
* @see JController
* @since 1.0
*/
public function __construct($config = array())
{
parent::__construct($config);
}

/**
* Method to auto-populate the model state.
*
Expand Down Expand Up @@ -623,7 +610,16 @@ public function saveFieldsData($fieldData)

if (!empty($fieldData['fieldsvalue'][$ownerShipFieldName]))
{
$ucmItemTable->created_by = $fieldData['fieldsvalue'][$ownerShipFieldName];
JLoader::import('components.com_tjfields.tables.field', JPATH_ADMINISTRATOR);
$fieldTable = JTable::getInstance('Field', 'TjfieldsTable', array('dbo', JFactory::getDbo()));
$fieldTable->load(array('name' => $ownerShipFieldName));
$fieldParams = new Registry($fieldTable->params);

// If enabled then the selected user will be set as creator of the UCM type item
if ($fieldParams->get('ucmItemOwner'))
{
$ucmItemTable->created_by = $fieldData['fieldsvalue'][$ownerShipFieldName];
}
}

if (!empty($fieldData['fieldsvalue'][$itemCategoryFieldName]))
Expand Down
39 changes: 28 additions & 11 deletions src/components/com_tjucm/site/views/itemform/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,34 @@
</fieldset>
</div>
<?php
if ($this->form_extra)
{
?>
<div class="form-horizontal">
<?php
// Code to display the form
echo $this->loadTemplate('extrafields');
?>
</div>
<?php
}
if ($this->form_extra)
{
if($this->id!='0')
{
?>
<div class="page-header">
<h1 class="page-title">
<?php echo JText::_("COM_TJUCM_EDIT_FORM") .": ". strtoupper($this->title); ?>
<h1>
</div><?php
}
else
{
?>
<div class="page-header">
<h1 class="page-title">
<?php echo strtoupper($this->title); ?>
<h1>
</div><?php
}?>
<div class="form-horizontal">
<?php
// Code to display the form
echo $this->loadTemplate('extrafields');
?>
</div>
<?php
}

if ($editRecordId)
{
Expand Down
33 changes: 30 additions & 3 deletions src/components/com_tjucm/site/views/items/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,31 @@
$statusColumnWidth = 0;
?>
<form action="<?php echo JRoute::_($link . '&Itemid=' . $itemId); ?>" method="post" name="adminForm" id="adminForm">
<?php echo $this->loadTemplate('filters'); ?>
<?php
if(isset($this->items))
{
?>
<div class="page-header">
<h1 class="page-title">
<?php echo strtoupper($this->title)." ".JText::_("COM_TJUCM_FORM_LIST"); ?>
<h1>
</div> <?php
}?>
<?php echo $this->loadTemplate('filters'); ?>
<div class="pull-right">
<?php
if ($this->allowedToAdd)
{
?>
<a href="<?php echo JRoute::_('index.php?option=com_tjucm&task=itemform.edit' . $appendUrl, false); ?>" class="btn btn-success btn-small">
<i class="icon-plus"></i><?php echo JText::_('COM_TJUCM_ADD_ITEM'); ?>
</a>
<?php
}
?>
</div>
<div class="row">
<div class="col-xs-12">
<div class="table-responsive">
<table class="table table-striped" id="itemList">
<?php
Expand Down Expand Up @@ -92,7 +116,8 @@
$fieldsData[$fieldId] = $tjFieldsFieldTable;
}
?>
<th style="word-break: break-word;" width="<?php echo (88 - $statusColumnWidth)/count($this->listcolumn).'%';?>">

<th style="word-break: break-word;" width="<?php echo (85 - $statusColumnWidth)/count($this->listcolumn).'%';?>">
<?php echo htmlspecialchars($col_name, ENT_COMPAT, 'UTF-8'); ?>
</th>
<?php
Expand All @@ -102,7 +127,7 @@
if ($this->canEdit || $this->canDelete)
{
?>
<th class="center" width="7%">
<th class="center" width="10%">
<?php echo JText::_('COM_TJUCM_ITEMS_ACTIONS'); ?>
</th>
<?php
Expand Down Expand Up @@ -171,6 +196,8 @@
?>
</tbody>
</table>
</div>
</div>
</div>
<?php
if ($this->allowedToAdd)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</div>
<div class="pull-left">
<button class="btn btn-default" type="submit" title="<?php echo JText::_('JSEARCH_FILTER_SUBMIT'); ?>"><span class="icon-search"></span></button>
<button class="btn btn-default qtc-hasTooltip" id="clear-search-button" onclick="getElementById('filter_search').value='';this.form.submit();" type="button" title="<?php echo JText::_('JSEARCH_FILTER_CLEAR'); ?>"><span class="icon-remove"></span></button>
<button class="btn btn-default qtc-hasTooltip" id="clear-search-button" onclick="document.getElementById('filter_search').value='';this.form.submit();" type="button" title="<?php echo JText::_('JSEARCH_FILTER_CLEAR'); ?>"><span class="icon-remove"></span></button>
</div>
<div class="btn-group pull-right hidden-xs">
<?php echo $this->pagination->getLimitBox(); ?>
Expand Down
17 changes: 17 additions & 0 deletions src/components/com_tjucm/site/views/items/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class TjucmViewItems extends JViewLegacy

protected $ucmTypeParams;

protected $title;

/**
* Display the view
*
Expand Down Expand Up @@ -121,6 +123,21 @@ public function display($tpl = null)
}
}

// To get title of list as per the ucm type
if (empty($this->title))
{
// Get the active item
$menuItem = $app->getMenu()->getActive();

// Get the params
$this->menuparams = $menuItem->params;

if (!empty($this->menuparams))
{
$this->title = $this->menuparams->get('ucm_type');
}
}

// If there are no fields column to show in list view then dont allow to show data
$this->showList = $model->showListCheck($this->client);

Expand Down

0 comments on commit f7ff1e3

Please sign in to comment.