Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

JoomlaTune Support Forum    JComments component    Integration with third-party extensions    Topic: [HACK] Comments quantity in DOCMAN
Pages: [1]   Go Down
  Print  
Author Topic: [HACK] Comments quantity in DOCMAN  (Read 3930 times)
0 Members and 1 Guest are viewing this topic.
DeviDarkL
Newbie
*

Karma: -1
Offline Offline

Posts: 12


« on: June 19, 2009, 06:01:04 »

Hi Smiley

I wanted to show how many comments are in files in DOCman. So I hacked the file list_item.tlp.php in (YOUR_SITE/components/com_docman/themes/default/templates/documents) and added this code:

Code:
<span class="dm_date">
<?php
//output comments quantity
  
global $mosConfig_absolute_path;
  
$comments $mosConfig_absolute_path '/components/com_jcomments/jcomments.php';
  if (
file_exists($comments)) {
    require_once(
$comments);
    
$count JComments::getCommentsCount($this->doc->data->id'com_docman');
    echo 
$count ? ('Comments: '$count) : 'No comments';
  }
?>

</span>

After:
Code:
//output document counter
if ( $this->theme->conf->item_hits  ) :
    ?>
    <span class="dm_counter">
        <img src="" align="absbottom" alt="" />
<?php echo _DML_TPL_HITS;?>: <?php echo $this->doc->data->dmcounter;?>
<?php echo ' | '?>
    </span>
    <?php
endif;

?>

Hope this helps someone who want this hack Wink

DeviDarkL
« Last Edit: January 22, 2012, 10:50:41 by DeviDarkL » Logged
Raik
Newbie
*

Karma: 1
Offline Offline

Posts: 2


« Reply #1 on: June 04, 2010, 09:25:05 »

Thanks @DeviDarkL

I modified your code a little bit to make it work at the current default theme of DOCman 1.5.7.
This has been tested on Joomla 1.5.18.
Hopefully this is gonna help everybody which are still trying.  Wink

Add following code to list_item.tlp.php in your DOCman installation:
Code:
<?php  //output comments quantity
global $mainframe;?>

<?php $comments $mainframe->getCfg('absolute_path') . '/components/com_jcomments/jcomments.php';?>
<?php if (file_exists($comments)): require_once($comments);?>
    <?php $count JComments::getCommentsCount($this->doc->data->id'com_docman');?>
    <tr>
<td><strong><?php echo 'Kommentare';?>:</strong></td>
<td><?php echo $count;?></td>
</tr>
<?php endif; ?>

After:
Code:
<?php // output document counter
if ( $this->theme->conf->item_downloads  ) : ?>

<tr>
<td><strong><?php echo _DML_TPL_DOWNLOADS;?>:</strong></td>
    <td><?php echo $this->doc->data->dmcounter;?></td>
</tr>
<?php endif; ?>

Instead of "Kommentare", as shown in line 7, put your word for "comments" in your own language.
Logged
TopCop
Newbie
*

Karma: 0
Offline Offline

Posts: 20


Email
« Reply #2 on: June 04, 2010, 12:24:19 »

This sounds really good, BUT I haven't found how to integrate JComments into Docman Ver. 1.5.

Can someone give me a hint what I have to do?


Thanks,
TopCop
Logged
Raik
Newbie
*

Karma: 1
Offline Offline

Posts: 2


« Reply #3 on: June 05, 2010, 02:26:06 »

@TopCop
This will show comments on the file details page in DOCman.
Tested with Joomla 1.5.18 and the default theme of DOCman 1.5.7.

1. Modify document.tpl.php in YOUR_SITE/components/com_docman/themes/default/templates/documents.

Add following code at the end of the file:
Code:
<?php
global 
$mainframe;
$comments $mainframe->getCfg('absolute_path') . '/components/com_jcomments/jcomments.php';
if (file_exists($comments))
{
require_once ($comments);
echo JComments::showComments($this->data->id'com_docman'$this->data->dmname);
}
else {return;}
?>

2. If you want to get rid of the lightbox (when you hit "Details") and show your comments on "regular" page, then you have to modify standardbuttons.php located in YOUR_SITE/plugins/docman.

Find following code:
Code:
if($botParams->get('details', 1)) {
    $params = new DMmosParameters('popup=1');
        $buttons['details'] = new DOCMAN_Button('details', _DML_BUTTON_DETAILS, $doc->_formatLink('doc_details', array('tmpl'=>'component')), $params);
}

and replace it with:
Code:
if($botParams->get('details', 1)) {
    //$params = new DMmosParameters('popup=1');
        $buttons['details'] = new DOCMAN_Button('details', _DML_BUTTON_DETAILS, $doc->_formatLink('doc_details', array('tmpl'=>'component')), $params);
}

3. In order to show your default language labels, you have to modify the language file of DOCman (YOUR_SITE/components/com_docman/themes/default/language). Place alle necessary labels at the end of the file.
Logged
TopCop
Newbie
*

Karma: 0
Offline Offline

Posts: 20


Email
« Reply #4 on: June 05, 2010, 15:13:32 »

Raik,

thank you very much - works perfect!


TopCop
Logged
svito
Newbie
*

Karma: 0
Offline Offline

Posts: 2


« Reply #5 on: August 08, 2010, 18:17:41 »

As the edit button for details as to when you could click to be redirected now to write commentary.

Or how to add a new button for writing comments in the file list.
Logged
Pages: [1]   Go Up
  Print  
JoomlaTune Support Forum    JComments component    Integration with third-party extensions    Topic: [HACK] Comments quantity in DOCMAN
 
Jump to: