Skip to content

Commit

Permalink
feat(ModComments) set default block status and criteria via global va…
Browse files Browse the repository at this point in the history
…riables
  • Loading branch information
joebordes committed Aug 27, 2016
1 parent 52d0227 commit 5f996fd
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@
<td colspan="4" class="dvInnerHeader">
<div style="float: left; font-weight: bold;">
<div style="float: left;">
<a href="javascript:showHideStatus('tbl{$UIKEY}','aid{$UIKEY}','$IMAGE_PATH');"><span class="exp_coll_block inactivate"><img id="aid{$UIKEY}" src="{'activate.gif'|@vtiger_imageurl:$THEME}" style="border: 0px solid rgb(0, 0, 0);" alt="{'LBL_Hide'|@getTranslatedString:'Settings'}" title="{'LBL_Hide'|@getTranslatedString:'Settings'}"></span></a>
<a href="javascript:showHideStatus('tbl{$UIKEY}','aid{$UIKEY}','$IMAGE_PATH');">
{if $BLOCKOPEN}
<span class="exp_coll_block inactivate"><img id="aid{$UIKEY}" src="{'activate.gif'|@vtiger_imageurl:$THEME}" style="border: 0px solid rgb(0, 0, 0);" alt="{'LBL_Hide'|@getTranslatedString:'Settings'}" title="{'LBL_Hide'|@getTranslatedString:'Settings'}"></span></a>
{else}
<span class="exp_coll_block activate"><img id="aid{$UIKEY}" src="{'inactivate.gif'|@vtiger_imageurl:$THEME}" style="border: 0px solid rgb(0, 0, 0);" alt="{'LBL_Show'|@getTranslatedString:'Settings'}" title="{'LBL_Show'|@getTranslatedString:'Settings'}">
{/if}
</span></a>
</div><b>&nbsp;{$WIDGET_TITLE}</b></div>
<span style="float: right;">
<img src="{'vtbusy.gif'|@vtiger_imageurl:$THEME}" border=0 id="indicator{$UIKEY}" style="display:none;">
Expand All @@ -28,7 +34,7 @@
</table>
{/if}

<div id="tbl{$UIKEY}" style="display: block">
<div id="tbl{$UIKEY}" style="display: {if $BLOCKOPEN}block{else}none{/if};">
<table class="small" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr style="height: 25px;">
<td colspan="4" align="left" class="dvtCellInfo commentCell">
Expand Down
2 changes: 2 additions & 0 deletions build/changeSets/DefineGlobalVariables.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ function applyChange() {
'Product_Maximum_Number_Images',
'Workflow_Send_Email_ToCCBCC',
'Workflow_GeoDistance_Country_Default',
'ModComments_DefaultCriteria',
'ModComments_DefaultBlockStatus',

'Report_Send_Scheduled_ifEmpty',

Expand Down
14 changes: 14 additions & 0 deletions modules/GlobalVariable/language/en_us.gvdefs.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,20 @@
'values' => '0 | 1',
'definition' => 'If set to 1, which is the default value, you will not be able to duplicate account names, if set to 0 that will be permitted.',
),
'ModComments_DefaultBlockStatus' => array(
'status' => 'Implemented',
'valuetype' => 'Boolean',
'category' => 'Module Functionality',
'values' => '0 | 1',
'definition' => 'If set to 1, which is the default value, the Comments block will be open, if set to 0 it will be closed.',
),
'ModComments_DefaultCriteria' => array(
'status' => 'Implemented',
'valuetype' => 'String',
'category' => 'Module Functionality',
'values' => 'All | Last5 | Mine',
'definition' => '"All" (default value) will show all comments related to the module, "Last5" will show only the last 5 commentas and "Mine" will show all comments of the current user.',
),
'Debug_Send_VtigerCron_Error' => array(
'status' => 'Implemented',
'valuetype' => 'CSV EMail',
Expand Down
3 changes: 3 additions & 0 deletions modules/ModComments/widgets/DetailViewBlockComment.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class ModComments_DetailViewBlockCommentWidget {
protected $criteria= false;

function __construct() {
$this->defaultCriteria = GlobalVariable::getVariable('ModComments_DefaultCriteria',$this->defaultCriteria);
}

function getFromContext($key, $purify=false) {
Expand Down Expand Up @@ -105,6 +106,8 @@ function process($context = false) {
$viewer = $this->getViewer();
$viewer->assign('ID', $sourceRecordId);
$viewer->assign('CRITERIA', $usecriteria);
$BLOCKOPEN = GlobalVariable::getVariable('ModComments_DefaultBlockStatus',1);
$viewer->assign('BLOCKOPEN', $BLOCKOPEN);
list($void,$canaddcomments) = cbEventHandler::do_filter('corebos.filter.ModComments.canAdd', array($sourceRecordId, true));
$viewer->assign('CANADDCOMMENTS', ($canaddcomments ? 'YES' : 'NO'));
$viewer->assign('COMMENTS', $this->getModels($sourceRecordId, $usecriteria) );
Expand Down

0 comments on commit 5f996fd

Please sign in to comment.