This repository has been archived by the owner on Feb 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
265 changed files
with
23,021 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
code/administrator/components/com_activities/activities.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
/** | ||
* @version $Id: activities.php 1485 2012-02-10 12:32:02Z johanjanssens $ | ||
* @package Nooku_Components | ||
* @subpackage Activities | ||
* @copyright Copyright (C) 2010 - 2012 Timble CVBA and Contributors. (http://www.timble.net) | ||
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> | ||
* @link http://www.nooku.org | ||
*/ | ||
|
||
/** | ||
* Component Loader | ||
* | ||
* @author Israel Canasa <http://nooku.assembla.com/profile/israelcanasa> | ||
* @category Nooku | ||
* @package Nooku_Components | ||
* @subpackage Activities | ||
*/ | ||
defined('KOOWA') or die; | ||
|
||
echo KService::get('com://admin/activities.dispatcher')->dispatch(); |
29 changes: 29 additions & 0 deletions
29
code/administrator/components/com_activities/controllers/behaviors/executable.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
/** | ||
* @version $Id: executable.php 1485 2012-02-10 12:32:02Z johanjanssens $ | ||
* @package Nooku_Server | ||
* @subpackage Activities | ||
* @copyright Copyright (C) 2011 - 2012 Timble CVBA and Contributors. (http://www.timble.net). | ||
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> | ||
* @link http://www.nooku.org | ||
*/ | ||
|
||
/** | ||
* Executable Controller Behavior | ||
* | ||
* @author Johan Janssens <http://nooku.assembla.com/profile/johanjanssens> | ||
* @package Nooku_Server | ||
* @subpackage Activities | ||
*/ | ||
class ComActivitiesControllerBehaviorExecutable extends ComDefaultControllerBehaviorExecutable | ||
{ | ||
public function canAdd() | ||
{ | ||
return false; | ||
} | ||
|
||
public function canEdit() | ||
{ | ||
return false; | ||
} | ||
} |
127 changes: 127 additions & 0 deletions
127
code/administrator/components/com_activities/controllers/behaviors/loggable.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
<?php | ||
/** | ||
* @version $Id: loggable.php 1485 2012-02-10 12:32:02Z johanjanssens $ | ||
* @package Nooku_Components | ||
* @subpackage Activities | ||
* @copyright Copyright (C) 2010 - 2012 Timble CVBA and Contributors. (http://www.timble.net) | ||
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> | ||
* @link http://www.nooku.org | ||
*/ | ||
|
||
/** | ||
* Loggable Controller Behavior Class | ||
* | ||
* @author Israel Canasa <http://nooku.assembla.com/profile/israelcanasa> | ||
* @package Nooku_Components | ||
* @subpackage Activities | ||
*/ | ||
|
||
class ComActivitiesControllerBehaviorLoggable extends KControllerBehaviorAbstract | ||
{ | ||
/** | ||
* List of actions to log | ||
* | ||
* @var array | ||
*/ | ||
protected $_actions; | ||
|
||
/** | ||
* The name of the column to use as the title column in the log entry | ||
* | ||
* @var string | ||
*/ | ||
protected $_title_column; | ||
|
||
public function __construct(KConfig $config) | ||
{ | ||
parent::__construct($config); | ||
|
||
$this->_actions = KConfig::unbox($config->actions); | ||
$this->_title_column = KConfig::unbox($config->title_column); | ||
} | ||
|
||
protected function _initialize(KConfig $config) | ||
{ | ||
$config->append(array( | ||
'priority' => KCommand::PRIORITY_LOWEST, | ||
'actions' => array('after.edit', 'after.add', 'after.delete'), | ||
'title_column' => array('title', 'name'), | ||
)); | ||
|
||
parent::_initialize($config); | ||
} | ||
|
||
public function execute($name, KCommandContext $context) | ||
{ | ||
if(in_array($name, $this->_actions)) | ||
{ | ||
$data = $context->result; | ||
|
||
if($data instanceof KDatabaseRowAbstract || $data instanceof KDatabaseRowsetAbstract ) | ||
{ | ||
$rowset = array(); | ||
|
||
if ($data instanceof KDatabaseRowAbstract) { | ||
$rowset[] = $data; | ||
} else { | ||
$rowset = $data; | ||
} | ||
|
||
foreach ($rowset as $row) | ||
{ | ||
//Only log if the row status is valid. | ||
$status = $row->getStatus(); | ||
|
||
if(!empty($status) && $status !== KDatabase::STATUS_FAILED) | ||
{ | ||
$identifier = $context->caller->getIdentifier(); | ||
|
||
$log = array( | ||
'action' => $context->action, | ||
'application' => $identifier->application, | ||
'type' => $identifier->type, | ||
'package' => $identifier->package, | ||
'name' => $identifier->name, | ||
'status' => $status | ||
); | ||
|
||
if ($context->action === 'edit') { | ||
$log['created_by'] = JFactory::getUser()->id; | ||
} | ||
elseif (!empty($row->created_by)) { | ||
$log['created_by'] = $row->created_by; | ||
} | ||
|
||
if (is_array($this->_title_column)) | ||
{ | ||
foreach($this->_title_column as $title) | ||
{ | ||
if($row->{$title}){ | ||
$log['title'] = $row->{$title}; | ||
break; | ||
} | ||
} | ||
} | ||
elseif($row->{$this->_title_column}) | ||
{ | ||
$log['title'] = $row->{$this->_title_column}; | ||
} | ||
|
||
if (!isset($log['title'])) { | ||
$log['title'] = '#'.$row->id; | ||
} | ||
|
||
$log['row'] = $row->id; | ||
|
||
$this->getService('com://admin/activities.database.row.activity', array('data' => $log))->save(); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
public function getHandle() | ||
{ | ||
return KMixinAbstract::getHandle(); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
code/administrator/components/com_activities/databases/tables/activities.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
/** | ||
* @version $Id: activities.php 1485 2012-02-10 12:32:02Z johanjanssens $ | ||
* @package Nooku_Components | ||
* @subpackage Activities | ||
* @copyright Copyright (C) 2010 - 2012 Timble CVBA and Contributors. (http://www.timble.net) | ||
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> | ||
* @link http://www.nooku.org | ||
*/ | ||
|
||
/** | ||
* Activities Database Table Class | ||
* | ||
* @author Israel Canasa <http://nooku.assembla.com/profile/israelcanasa> | ||
* @package Nooku_Components | ||
* @subpackage Activities | ||
*/ | ||
|
||
class ComActivitiesDatabaseTableActivities extends KDatabaseTableDefault | ||
{ | ||
protected function _initialize(KConfig $config) | ||
{ | ||
$config->append(array( | ||
'behaviors' => array('creatable', 'identifiable') | ||
)); | ||
|
||
parent::_initialize($config); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
code/administrator/components/com_activities/dispatcher.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
/** | ||
* @version $Id: dispatcher.php 1485 2012-02-10 12:32:02Z johanjanssens $ | ||
* @package Nooku_Components | ||
* @subpackage Activities | ||
* @copyright Copyright (C) 2010 - 2012 Timble CVBA and Contributors. (http://www.timble.net) | ||
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> | ||
* @link http://www.nooku.org | ||
*/ | ||
|
||
/** | ||
* Component Dispatcher | ||
* | ||
* @author Israel Canasa <http://nooku.assembla.com/profile/israelcanasa> | ||
* @category Nooku | ||
* @package Nooku_Components | ||
* @subpackage Activities | ||
*/ | ||
class ComActivitiesDispatcher extends ComDefaultDispatcher | ||
{ | ||
protected function _initialize(KConfig $config) | ||
{ | ||
$config->append(array( | ||
'request' => array( | ||
'view' => 'activities' | ||
), | ||
)); | ||
|
||
parent::_initialize($config); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
code/administrator/components/com_activities/install/install.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
-- $Id: install.sql 1244 2010-09-08 22:51:47Z johanjanssens $ | ||
|
||
CREATE TABLE IF NOT EXISTS `#__activities_activities` ( | ||
`activities_activity_id` int(11) unsigned NOT NULL AUTO_INCREMENT, | ||
`uuid` VARCHAR(36) NOT NULL DEFAULT '' UNIQUE, | ||
`application` VARCHAR(10) NOT NULL DEFAULT '', | ||
`type` VARCHAR(3) NOT NULL DEFAULT '', | ||
`package` VARCHAR(50) NOT NULL DEFAULT '', | ||
`name` VARCHAR(50) NOT NULL DEFAULT '', | ||
`action` VARCHAR(50) NOT NULL DEFAULT '', | ||
`row` BIGINT NOT NULL DEFAULT '0', | ||
`title` VARCHAR(255) NOT NULL DEFAULT '', | ||
`status` varchar(100) NOT NULL, | ||
`created_on` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', | ||
`created_by` INT(11) NOT NULL DEFAULT '0', | ||
PRIMARY KEY(`activities_activity_id`) | ||
) ENGINE=MyISAM DEFAULT CHARSET=utf8; |
1 change: 1 addition & 0 deletions
1
code/administrator/components/com_activities/install/uninstall.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DROP TABLE IF EXISTS `#__activities_activities`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<install type="component" version="1.5.0" method="upgrade"> | ||
<identifier>com:activities</identifier> | ||
<name>Activities</name> | ||
<author>Nooku Project</author> | ||
<creationDate>June 2011</creationDate> | ||
<copyright>Copyright (C) 2011 - 2012 Timble CVBA and Contributors. (http://www.timble.net)</copyright> | ||
<license>http://www.gnu.org/licenses/gpl.html GNU/GPL v3</license> | ||
<authorEmail>[email protected]</authorEmail> | ||
<authorUrl>www.nooku.org</authorUrl> | ||
<version>12.2</version> | ||
<description>This component provides user activity logging</description> | ||
|
||
<install> | ||
<sql> | ||
<file driver="mysql" charset="utf8">install/install.sql</file> | ||
</sql> | ||
</install> | ||
<uninstall> | ||
<sql> | ||
<file driver="mysql" charset="utf8">install/uninstall.sql</file> | ||
</sql> | ||
</uninstall> | ||
|
||
<administration> | ||
<files folder="admin"> | ||
<filename>dispatcher.php</filename> | ||
|
||
<folder>controllers</folder> | ||
<folder>databases</folder> | ||
<folder>install</folder> | ||
<folder>models</folder> | ||
<folder>templates</folder> | ||
<folder>views</folder> | ||
</files> | ||
</administration> | ||
</install> |
Oops, something went wrong.