Skip to Content Skip to Menu

🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

Change DOCMAN download logs

  • ptannjr
  • ptannjr
  • OFFLINE
  • Posts: 2
  • Thanks: 0
  • Karma: 0
15 years 7 months ago #97005 by ptannjr
Change DOCMAN download logs was created by ptannjr
I have asked this question on joomlatools.eu but have not been able to get an answer so I am asking here in hopes of finding and answer

forum.joomlatools.eu/viewtopic.php?f=24&t=2472

I would like to change the download logs. Currently it shows Date, User, IP, Document, Browser, Operating System.

I would like it to show Date, User, Company Name, IP, Document, Browser, Operating System.

Looking in the logs.html.php

i found this and think this is the right place to do it but when i put in what i think should be there it does not work. I get the cells on the page where the information goes but it does not seem to be calling the information properly. In the title bar it shows "DML_COMPANY_NAME" rather than just company name.

I am not really a coder by any means, but i am willing to try but dont really know where to go with this. I am using Community builders login and registration if that makes any difference. I require a company name on registration. It would be so much easier to see the company name in the downloads section as sometimes i can look up the company easier than the user. Thanks in advance


I have been working with

/administrator/components/com_docman/includes/logs.html


<tr>
<th width="2%" class="title"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($rows);?>);" /></th>
<th class="title" width="10%" nowrap="nowrap"><div align="center"><?php echo _DML_DATE;?></div></th>
<th class="title" width="20%" nowrap="nowrap"><div align="center"><?php echo _DML_USER;?></div></th>
<th class="title" width="20%" nowrap="nowrap"><div align="center"><?php echo Company;?></div></th>
<th class="title" width="20%" nowrap="nowrap"><div align="center"><?php echo _DML_IP;?></div></th>
<th class="title" width="20%" nowrap="nowrap"><div align="center"><?php echo _DML_DOCUMENT;?></div></th>
<th class="title" width="10%" nowrap="nowrap"><div align="center"><?php echo _DML_BROWSER;?></div></th>
<th class="title" width="10%" nowrap="nowrap"><div align="center"><?php echo _DML_OS;?></div></th>
</tr>
</thead>

<tfoot><tr><td colspan="11"><?php echo $pageNav->getListFooter();?></td></tr></tfoot>

<tbody>

<?php
$k = 0;
for ($i = 0, $n = count($rows);$i < $n;$i++) {
$row = &$rows[$i];
echo "<tr class=\"row$k\">";
echo "<td width=\"20\">";
?>

<input type="checkbox" id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $row->id;?>" onclick="isChecked(this.checked);" />
</td>
<td align="center">
<?php echo $row->log_datetime;?>
</td>
<td align="center">
<?php echo $row->user;?>
</td>
<td align="center">
<?php echo $row->user;?> (i have this as user also just to allow me to see i am making changes)
</td>
<td align="center">
<a href=" ws.arin.net/cgi-bin/whois.pl?queryinput= log_ip;?>" target="_blank">log_ip;?>
</td>
<td align="center">
<?php echo $row->dmname;?>
</td>
<td align="center">
<?php echo $row->log_browser;?>
</td>
<td align="center">
<?php echo $row->log_os;?>
</td>
</tr>

http://forum.joomlatools.eu/download/file.php?id=251

http://forum.joomlatools.eu/download/file.php?id=252

Post edited by: ptannjr, at: 2009/04/29 01:32

Please Log in or Create an account to join the conversation.

  • ptannjr
  • ptannjr
  • OFFLINE
  • Posts: 2
  • Thanks: 0
  • Karma: 0
15 years 7 months ago #97013 by ptannjr
Replied by ptannjr on topic Re:Change DOCMAN download logs
looking in the phpmyadmin under jos_docman_log i dont see any listing for the company name. I can only imagine this is the place i need to get the information from. Is this right? can i add the appropriate field here?

Please Log in or Create an account to join the conversation.

  • dsabate
  • dsabate
  • OFFLINE
  • Posts: 1
  • Thanks: 0
  • Karma: 0
13 years 4 months ago - 13 years 4 months ago #174070 by dsabate
Replied by dsabate on topic Re: Change DOCMAN download logs
After 2 years it is maybe too late... :lol: But if anyone is needing it, I've modified the code to show the email of the user.

First: I've modified the file administrator/components/com_docman/includes/logs.html.php to include the email column:
Code:
<tr> <th width="2%" class="title"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($rows);?>);" /></th> <th class="title" width="10%" nowrap="nowrap"><div align="center"><?php echo _DML_DATE;?></div></th> <th class="title" width="20%" nowrap="nowrap"><div align="center"><?php echo _DML_USER;?></div></th> <th class="title" width="20%" nowrap="nowrap"><div align="center"><?php echo _DML_EMAIL;?></div></th> <th class="title" width="20%" nowrap="nowrap"><div align="center"><?php echo _DML_IP;?></div></th> <th class="title" width="20%" nowrap="nowrap"><div align="center"><?php echo _DML_DOCUMENT;?></div></th> <th class="title" width="10%" nowrap="nowrap"><div align="center"><?php echo _DML_BROWSER;?></div></th> <th class="title" width="10%" nowrap="nowrap"><div align="center"><?php echo _DML_OS;?></div></th> </tr>

Note that _DML_EMAIL is a variable used for i18n (this is, internationalization) but you could have directly used any String like 'email'.


Second: Later on the same file administrator/components/com_docman/includes/logs.html.php I've added the row to display the email:
Code:
<td align="center"> <?php echo $row->log_datetime;? </td> <td align="center"> <?php echo $row->user;?> </td> <td align="center"> <?php echo $row->email?> </td> <td align="center"> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php echo $row->log_ip;?>" target="_blank"><?php echo $row->log_ip;?></a> </td> <td align="center"> <?php echo $row->dmname;?> </td> <td align="center"> <?php echo $row->log_browser;?> </td> <td align="center"> <?php echo $row->log_os;?> </td> </tr>

But... this $row->email is pointing to nowhere. So, in order to fetch this information, we have to modify the file administrator/components/com_docman/includes/logs.php (line 78) to add the information in the SQL query:
Code:
// Query $query = "( SELECT l.*, u.name AS user, u.email AS email, d.dmname" ."\n FROM #__docman_log AS l, #__users AS u, #__docman AS d " .$where ."\n AND l.log_user = u.id )" ."\n UNION " ."( SELECT l.*, '"._DML_ANONYMOUS."' AS user, '"._DML_ANONYMOUS."' AS email, d.dmname" ."\n FROM #__docman_log AS l, #__docman AS d " .$where2 ."\n AND l.log_user = 0" .")" ."\n ORDER BY log_datetime DESC";

Don't ask me about that '"._DML_ANONYMOUS."' AS email, I've added it to make it work but... I can't explain it! :whistle:

And that's it! You can add any other row by just adding the column, adding the row information and retrieving the information from the SQL query (of course, you need to know a little bit of SQL and look for the tables fields)
Last edit: 13 years 4 months ago by dsabate.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum