Procházet zdrojové kódy

#2382 Audit for site actions

RomanL před 7 roky
rodič
revize
d7c87e7983

+ 24 - 0
inc/utils.inc.php

@@ -1378,6 +1378,30 @@ function bx_unicode_urldecode($s)
     return urldecode($s);
 }
 
+/**
+ * Raise an audit event
+ * @param int $iProfileId - sender (action's author) profile id, if it is false - then currectly logged in profile id is used
+ * @param int $iContentId - content id
+ * @param string $sContentModule - module name
+ * @param string $sAction - system action key
+ * @param string $sContentTitle - needed in case when original content was deleted
+ * @param string $sContentInfoObject - content info object
+ * @param int $iContextProfileId - context profile id
+ * @param string $sContextProfileTitle - needed in case when original context was deleted
+ * @param array $aActionParams - serialized array of parameters to pass to 'action lang key', for example friend name in case if 'befriend' action
+ */
+function bx_audit($iContentId, $sContentModule, $sAction, $sContentTitle = '', $sContentInfoObject = '', $iContextProfileId = 0, $sContextProfileTitle = '', $aExtras = array(), $aActionParams = array(), $iProfileId = false)
+{
+    if (!$iProfileId)
+        $iProfileId  = bx_get_logged_profile_id();
+    $oDb = BxDolDb::getInstance();
+    
+    
+    $sSql = $oDb->prepare("INSERT INTO `sys_audit`(profile_id, content_id, content_title, content_module, context_profile_id, context_profile_title, action_lang_key, action_lang_key_params, content_info_object, extras) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
+    , $iProfileId, $iContentId, $sContentTitle, $sContentModule, $iContextProfileId, $sContextProfileTitle, $sAction, (count($aActionParams) > 0 ? serialize($aActionParams) : '') ,$sContentInfoObject, (count($aExtras) > 0 ? serialize($aExtras) : ''));
+    return !$oDb->query($sSql);
+}
+
 /**
  * Raise an alert
  * @param string $sUnit - system type

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 0 - 0
install/sql/system.sql


+ 37 - 1
modules/base/general/classes/BxBaseModGeneralFormsEntryHelper.php

@@ -492,6 +492,18 @@ class BxBaseModGeneralFormsEntryHelper extends BxDolProfileForms
         if(($oPrivacy = BxDolPrivacy::getObjectInstance($CNF['OBJECT_PRIVACY_VIEW'])) !== false)
             $oPrivacy->deleteGroupCustomByContentId($iContentId);
 
+        $mContextId = isset($CNF['FIELD_ALLOW_VIEW_TO']) && !empty($aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']]) ? -$aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']] : false;
+        bx_audit(
+            $iContentId, 
+            $this->_oModule->getName(), 
+            '_sys_audit_action_detete',  
+            isset($CNF['FIELD_TITLE']) ? $aContentInfo[$CNF['FIELD_TITLE']] : '', 
+            isset($CNF['OBJECT_CONTENT_INFO']) ? $CNF['OBJECT_CONTENT_INFO'] : '',
+            $mContextId, 
+            $mContextId ? BxDolProfile::getInstance($mContextId)->getDisplayName() : '', 
+            $aContentInfo
+        );
+        
         return '';
     }
 
@@ -521,7 +533,19 @@ class BxBaseModGeneralFormsEntryHelper extends BxDolProfileForms
 
         if(isset($CNF['FIELD_ALLOW_VIEW_TO']) && !empty($aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']]) && ($oPrivacy = BxDolPrivacy::getObjectInstance($CNF['OBJECT_PRIVACY_VIEW'])) !== false)
             $oPrivacy->reassociateGroupCustomWithContent($oProfile->id(), $iContentId, (int)$aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']]);
-
+        
+        $mContextId = isset($CNF['FIELD_ALLOW_VIEW_TO']) && !empty($aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']]) ? -$aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']] : false;
+        bx_audit(
+            $iContentId, 
+            $this->_oModule->getName(), 
+            '_sys_audit_action_edit',  
+            isset($CNF['FIELD_TITLE']) ? $aContentInfo[$CNF['FIELD_TITLE']] : '', 
+            isset($CNF['OBJECT_CONTENT_INFO']) ? $CNF['OBJECT_CONTENT_INFO'] : '',
+            $mContextId, 
+            $mContextId ? BxDolProfile::getInstance($mContextId)->getDisplayName() : '', 
+            $aContentInfo
+        );
+        
         return '';
     }
 
@@ -539,6 +563,18 @@ class BxBaseModGeneralFormsEntryHelper extends BxDolProfileForms
         if(isset($CNF['FIELD_ALLOW_VIEW_TO']) && !empty($aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']]) && ($oPrivacy = BxDolPrivacy::getObjectInstance($CNF['OBJECT_PRIVACY_VIEW'])) !== false)
             $oPrivacy->associateGroupCustomWithContent($oProfile->id(), $iContentId, (int)$aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']]);
 
+        $mContextId = isset($CNF['FIELD_ALLOW_VIEW_TO']) && !empty($aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']]) ? -$aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']] : false;
+        bx_audit(
+            $iContentId, 
+            $this->_oModule->getName(), 
+            '_sys_audit_action_add',  
+            isset($CNF['FIELD_TITLE']) ? $aContentInfo[$CNF['FIELD_TITLE']] : '', 
+            isset($CNF['OBJECT_CONTENT_INFO']) ? $CNF['OBJECT_CONTENT_INFO'] : '',
+            $mContextId, 
+            $mContextId ? BxDolProfile::getInstance($mContextId)->getDisplayName() : '', 
+            $aContentInfo
+        );
+        
         return '';
     }
 

+ 19 - 0
modules/boonex/decorous/data/template/studio/scripts/BxTemplStudioAudit.php

@@ -0,0 +1,19 @@
+<?php
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaStudioView UNA Studio Representation classes
+ * @ingroup     UnaStudio
+ * @{
+ */
+defined('BX_DOL') or die('hack attempt');
+
+class BxTemplStudioAudit extends BxBaseStudioAudit
+{
+    function __construct($sPage = '')
+    {
+        parent::__construct($sPage);
+    }
+}
+/** @} */

+ 19 - 0
modules/boonex/decorous/data/template/studio/scripts/BxTemplStudioAuditGrid.php

@@ -0,0 +1,19 @@
+<?php
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaStudioView UNA Studio Representation classes
+ * @ingroup     UnaStudio
+ * @{
+ */
+defined('BX_DOL') or die('hack attempt');
+
+class BxTemplStudioAuditGrid extends BxBaseStudioAuditGrid
+{
+    function __construct($sPage = '')
+    {
+        parent::__construct($sPage);
+    }
+}
+/** @} */

+ 14 - 1
modules/boonex/english/data/langs/system/en.xml

@@ -769,7 +769,13 @@
     <string name="_adm_form_err_search_forms_title"><![CDATA[Enter name, more than 3 characters]]></string>
 	<string name="_adm_form_txt_all_modules"><![CDATA[All Modules]]></string>
 	<string name="_adm_form_txt_confirm_delete"><![CDATA[Are you sure you want to delete this field? It will be deleted from all Displays! You may just turn it off instead.]]></string>
-	<string name="_adm_form_txt_displays_edit_popup"><![CDATA[Edit "{0}" Display]]></string>
+  <string name="_adm_form_txt_audit_added"><![CDATA[Added]]></string>
+  <string name="_adm_form_txt_audit_profile"><![CDATA[Profile]]></string>
+  <string name="_adm_form_txt_audit_content"><![CDATA[Content]]></string>
+  <string name="_adm_form_txt_audit_module"><![CDATA[Module]]></string>
+  <string name="_adm_pgt_txt_audit_context"><![CDATA[Context]]></string>
+  <string name="_adm_pgt_txt_audit_action"><![CDATA[Action]]></string>
+  <string name="_adm_form_txt_displays_edit_popup"><![CDATA[Edit "{0}" Display]]></string>
 	<string name="_adm_form_txt_displays_gl_fields"><![CDATA[Fields]]></string>
 	<string name="_adm_form_txt_displays_gl_form"><![CDATA[Form]]></string>
 	<string name="_adm_form_txt_displays_gl_module"><![CDATA[Module]]></string>
@@ -1123,6 +1129,7 @@
         <string name="_adm_nav_txt_block_hidden_on_tablet"><![CDATA[tablet]]></string>
         <string name="_adm_nav_txt_block_hidden_on_desktop"><![CDATA[desktop]]></string>
         <string name="_adm_nav_txt_block_hidden_on_mobile"><![CDATA[mobile app]]></string>
+  <string name="_adm_page_cpt_audit"><![CDATA[Audit]]></string>
 	<string name="_adm_page_cpt_builder_forms"><![CDATA[Forms]]></string>
 	<string name="_adm_page_cpt_builder_menus"><![CDATA[Navigation]]></string>
 	<string name="_adm_page_cpt_builder_mobile"><![CDATA[Mobile Builder]]></string>
@@ -1572,6 +1579,7 @@
 	<string name="_adm_txt_show_help"><![CDATA[Help]]></string>
 	<string name="_adm_txt_show_help_content_empty"><![CDATA[Help is not available]]></string>
 	<string name="_adm_txt_uninstall"><![CDATA[Uninstall]]></string>
+  <string name="_adm_wgt_cpt_audit"><![CDATA[Audit]]></string>
 	<string name="_adm_wgt_cpt_builder_forms"><![CDATA[Forms]]></string>
 	<string name="_adm_wgt_cpt_builder_menus"><![CDATA[Navigation]]></string>
 	<string name="_adm_wgt_cpt_builder_pages"><![CDATA[Pages]]></string>
@@ -1704,6 +1712,11 @@
 	<string name="_sys_acl_start"><![CDATA[Start: ]]></string>
 	<string name="_sys_acl_expire"><![CDATA[Expire: ]]></string>
 	<string name="_sys_acl_expire_never"><![CDATA[never]]></string>
+
+  <string name="_sys_audit_action_edit"><![CDATA[Edit]]></string>
+  <string name="_sys_audit_action_add"><![CDATA[Add]]></string>
+  <string name="_sys_audit_action_delete"><![CDATA[Delete]]></string>
+  
 	<string name="_sys_add_friend"><![CDATA[Add friend]]></string>
         <string name="_sys_add_relation"><![CDATA[Add relationship]]></string>
 	<string name="_sys_adm_installed"><![CDATA[Installed]]></string>

+ 19 - 0
modules/boonex/lucid/data/template/studio/scripts/BxTemplStudioAudit.php

@@ -0,0 +1,19 @@
+<?php
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaStudioView UNA Studio Representation classes
+ * @ingroup     UnaStudio
+ * @{
+ */
+defined('BX_DOL') or die('hack attempt');
+
+class BxTemplStudioAudit extends BxBaseStudioAudit
+{
+    function __construct($sPage = '')
+    {
+        parent::__construct($sPage);
+    }
+}
+/** @} */

+ 19 - 0
modules/boonex/lucid/data/template/studio/scripts/BxTemplStudioAuditGrid.php

@@ -0,0 +1,19 @@
+<?php
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaStudioView UNA Studio Representation classes
+ * @ingroup     UnaStudio
+ * @{
+ */
+defined('BX_DOL') or die('hack attempt');
+
+class BxTemplStudioAuditGrid extends BxBaseStudioAuditGrid
+{
+    function __construct($sPage = '')
+    {
+        parent::__construct($sPage);
+    }
+}
+/** @} */

+ 19 - 0
modules/boonex/ocean/data/template/studio/scripts/BxTemplStudioAudit.php

@@ -0,0 +1,19 @@
+<?php
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaStudioView UNA Studio Representation classes
+ * @ingroup     UnaStudio
+ * @{
+ */
+defined('BX_DOL') or die('hack attempt');
+
+class BxTemplStudioAudit extends BxBaseStudioAudit
+{
+    function __construct($sPage = '')
+    {
+        parent::__construct($sPage);
+    }
+}
+/** @} */

+ 19 - 0
modules/boonex/ocean/data/template/studio/scripts/BxTemplStudioAuditGrid.php

@@ -0,0 +1,19 @@
+<?php
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaStudioView UNA Studio Representation classes
+ * @ingroup     UnaStudio
+ * @{
+ */
+defined('BX_DOL') or die('hack attempt');
+
+class BxTemplStudioAuditGrid extends BxBaseStudioAuditGrid
+{
+    function __construct($sPage = '')
+    {
+        parent::__construct($sPage);
+    }
+}
+/** @} */

+ 2 - 0
modules/boonex/posts/classes/BxPostsConfig.php

@@ -138,6 +138,8 @@ class BxPostsConfig extends BxBaseModTextConfig
             'OBJECT_GRID_COMMON' => 'bx_posts_common',
             'OBJECT_GRID_CATEGORIES' => 'bx_posts_categories',
             'OBJECT_UPLOADERS' => array('bx_posts_simple', 'bx_posts_html5'),
+            'OBJECT_CONTENT_INFO' => 'bx_posts',
+            'OBJECT_CMTS_CONTENT_INFO' => 'bx_posts_cmts',
 
             // menu items which visibility depends on custom visibility checking
             'MENU_ITEM_TO_METHOD' => array (

+ 19 - 0
modules/boonex/protean/data/template/studio/scripts/BxTemplStudioAudit.php

@@ -0,0 +1,19 @@
+<?php
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaStudioView UNA Studio Representation classes
+ * @ingroup     UnaStudio
+ * @{
+ */
+defined('BX_DOL') or die('hack attempt');
+
+class BxTemplStudioAudit extends BxBaseStudioAudit
+{
+    function __construct($sPage = '')
+    {
+        parent::__construct($sPage);
+    }
+}
+/** @} */

+ 19 - 0
modules/boonex/protean/data/template/studio/scripts/BxTemplStudioAuditGrid.php

@@ -0,0 +1,19 @@
+<?php
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaStudioView UNA Studio Representation classes
+ * @ingroup     UnaStudio
+ * @{
+ */
+defined('BX_DOL') or die('hack attempt');
+
+class BxTemplStudioAuditGrid extends BxBaseStudioAuditGrid
+{
+    function __construct($sPage = '')
+    {
+        parent::__construct($sPage);
+    }
+}
+/** @} */

+ 34 - 0
studio/audit.php

@@ -0,0 +1,34 @@
+<?php
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaEndAdmin UNA Studio End Admin Pages
+ * @ingroup     UnaStudio
+ * @{
+ */
+
+require_once('./../inc/header.inc.php');
+require_once(BX_DIRECTORY_PATH_INC . 'design.inc.php');
+
+bx_import('BxDolLanguages');
+
+bx_require_authentication(true);
+
+$sPage = bx_get('page');
+$sPage = $sPage !== false ? bx_process_input($sPage) : '';
+
+$oPage = new BxTemplStudioAudit($sPage);
+$oPage->init();
+
+$oTemplate = BxDolStudioTemplate::getInstance();
+$oTemplate->setPageNameIndex($oPage->getPageIndex());
+$oTemplate->setPageHeader($oPage->getPageHeader());
+$oTemplate->setPageContent('page_caption_code', $oPage->getPageCaption());
+$oTemplate->setPageContent('page_attributes', $oPage->getPageAttributes());
+$oTemplate->setPageContent('page_menu_code', $oPage->getPageMenu());
+$oTemplate->setPageContent('page_main_code', $oPage->getPageCode() . $oPage->getPageJsCode());
+$oTemplate->addCss($oPage->getPageCss());
+$oTemplate->addJs($oPage->getPageJs());
+$oTemplate->getPageCode();
+/** @} */

+ 40 - 0
studio/classes/BxDolStudioAudit.php

@@ -0,0 +1,40 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaStudio UNA Studio
+ * @{
+ */
+
+define('BX_DOL_STUDIO_AUD_TYPE_GENERAL', 'general');
+
+define('BX_DOL_STUDIO_AUD_TYPE_DEFAULT', BX_DOL_STUDIO_AUD_TYPE_GENERAL);
+
+class BxDolStudioAudit extends BxTemplStudioPage
+{
+    protected $sPage;
+
+    function __construct($sPage = "")
+    {
+        parent::__construct('audit');
+
+        $this->oDb = new BxDolStudioAuditQuery();
+
+        $this->sPage = BX_DOL_STUDIO_AUD_TYPE_DEFAULT;
+        if(is_string($sPage) && !empty($sPage))
+            $this->sPage = $sPage;
+    }
+
+    public function init()
+    {
+        if(($sAction = bx_get('pgt_action')) === false) 
+        	return;
+
+		$sAction = bx_process_input($sAction);
+        
+		exit;
+    }
+}
+
+/** @} */

+ 18 - 0
studio/classes/BxDolStudioAuditGrid.php

@@ -0,0 +1,18 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaStudio UNA Studio
+ * @{
+ */
+
+class BxDolStudioAuditGrid extends BxTemplStudioGrid
+{
+    public function __construct ($aOptions, $oTemplate = false)
+    {
+        parent::__construct ($aOptions, $oTemplate);
+    }
+}
+
+/** @} */

+ 18 - 0
studio/classes/BxDolStudioAuditQuery.php

@@ -0,0 +1,18 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaStudio UNA Studio
+ * @{
+ */
+
+class BxDolStudioAuditQuery extends BxDolStudioPageQuery
+{
+    function __construct()
+    {
+        parent::__construct();
+    }
+}
+
+/** @} */

+ 2 - 0
studio/template/audit.html

@@ -0,0 +1,2 @@
+__content__
+__js_content__

+ 37 - 0
studio/template/images/icons/wi-audit.svg

@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 20.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+<svg version="1.1" id="Слой_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+	 viewBox="0 0 64 64" style="enable-background:new 0 0 64 64;" xml:space="preserve">
+<style type="text/css">
+	.st0{fill:#738088;}
+	.st1{fill:#FFFFFF;}
+</style>
+<title>developer</title>
+<desc>Created with Sketch.</desc>
+<g id="Page-1">
+	<g id="Artboard" transform="translate(-340.000000, -184.000000)">
+		<g id="developer" transform="translate(340.000000, 184.000000)">
+			<g id="Path">
+				<path id="path-1_1_" class="st0" d="M32,64c14,0,21.8,0,26.9-5.1C64,53.8,64,46,64,32s0-21.8-5.1-26.9C53.8,0,46,0,32,0
+					S10.2,0,5.1,5.1C0,10.2,0,18,0,32s0,21.8,5.1,26.9C10.2,64,18,64,32,64z"/>
+			</g>
+		</g>
+	</g>
+</g>
+<g>
+	<path class="st1" d="M39.4,8.1C30.4,8.1,23,15.5,23,24.6c0,3.7,1.3,7.2,3.4,10L23,37.9c0,0,0,0-0.1,0.1c-0.3-0.1-0.6-0.1-0.8-0.1
+		c-1.1,0-2.1,0.4-2.9,1.2L9.3,49c-0.8,0.8-1.2,1.8-1.2,2.9s0.4,2.1,1.2,2.9c0.8,0.8,1.8,1.2,2.9,1.2s2.1-0.4,2.9-1.2l9.9-9.9
+		c0.8-0.8,1.2-1.8,1.2-2.9c0-0.3,0-0.6-0.1-0.8c0,0,0,0,0.1-0.1l3.3-3.3c2.8,2.1,6.2,3.4,10,3.4c9.1,0,16.5-7.4,16.5-16.5
+		S48.5,8.1,39.4,8.1z M13.9,53.6c-0.5,0.5-1.1,0.7-1.8,0.7c-0.7,0-1.3-0.3-1.8-0.7c-0.5-0.5-0.7-1.1-0.7-1.8s0.3-1.3,0.7-1.8l9-9
+		l3.6,3.6L13.9,53.6z M24,43.6L20.4,40c0.5-0.4,1.1-0.6,1.6-0.6c0.6,0,1.3,0.2,1.8,0.7c0.5,0.5,0.7,1.1,0.7,1.8
+		C24.6,42.5,24.4,43.1,24,43.6z M25.4,39.6c-0.1-0.2-0.3-0.4-0.4-0.5c-0.2-0.2-0.3-0.3-0.5-0.4l2.9-2.9c0.3,0.3,0.6,0.7,1,1
+		L25.4,39.6z M39.4,39.5c-8.2,0-14.9-6.7-14.9-14.9S31.2,9.6,39.4,9.6s14.9,6.7,14.9,14.9S47.7,39.5,39.4,39.5z"/>
+	<path class="st1" d="M39.4,11.4c-7.3,0-13.2,5.9-13.2,13.2s5.9,13.2,13.2,13.2s13.2-5.9,13.2-13.2S46.7,11.4,39.4,11.4z M39.4,36.2
+		c-6.4,0-11.6-5.2-11.6-11.6S33,12.9,39.4,12.9s11.6,5.2,11.6,11.6S45.9,36.2,39.4,36.2z"/>
+	<path class="st1" d="M44.8,16.3c-0.4-0.2-0.8-0.1-1.1,0.2c-0.2,0.4-0.1,0.8,0.2,1.1c2.4,1.5,3.8,4.2,3.8,7c0,1.9-0.7,3.8-1.9,5.3
+		c-0.3,0.3-0.2,0.8,0.1,1.1c0.1,0.1,0.3,0.2,0.5,0.2c0.2,0,0.4-0.1,0.6-0.3c1.5-1.8,2.3-4,2.3-6.3C49.3,21.2,47.6,18.1,44.8,16.3z"
+		/>
+	<path class="st1" d="M41.2,14.8c-0.6-0.1-1.2-0.2-1.8-0.2c-0.4,0-0.8,0.3-0.8,0.8s0.3,0.8,0.8,0.8c0.5,0,1,0,1.5,0.1
+		c0,0,0.1,0,0.1,0c0.4,0,0.7-0.3,0.8-0.6C41.9,15.3,41.7,14.9,41.2,14.8z"/>
+</g>
+</svg>

+ 101 - 0
studio/template/scripts/BxBaseStudioAudit.php

@@ -0,0 +1,101 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaView UNA Studio Representation classes
+ * @ingroup     UnaStudio
+ * @{
+ */
+
+class BxBaseStudioAudit extends BxDolStudioAudit
+{
+    protected $sSubpageUrl;
+    protected $aMenuItems;
+    protected $aGridObjects;
+
+    function __construct($sPage = '')
+    {
+        parent::__construct($sPage);
+
+        $this->sSubpageUrl = BX_DOL_URL_STUDIO . 'audit.php?page=';
+
+		$this->aMenuItems = array(
+            BX_DOL_STUDIO_AUD_TYPE_GENERAL => array('icon' => 'search')
+	    );
+
+		$this->aGridObjects = array(
+        	'audit' => 'sys_studio_audit'
+    );
+    }
+    function getPageCss()
+    {
+        return array_merge(parent::getPageCss(), array('forms.css', 'paginate.css'));
+    }
+    function getPageJs()
+    {
+        return array_merge(parent::getPageJs(), array('settings.js'));
+    }
+    function getPageJsClass()
+    {
+        return 'BxDolStudioAudit';
+    }
+    function getPageJsObject()
+    {
+        return 'oBxDolStudioAudit';
+    }
+    function getPageJsCode($aOptions = array(), $bWrap = true)
+    {
+        $aOptions = array_merge($aOptions, array(
+            'sActionUrl' => BX_DOL_URL_STUDIO . 'audit.php'
+        ));
+
+        return parent::getPageJsCode($aOptions, $bWrap);
+    }
+    function getPageMenu($aMenu = array(), $aMarkers = array())
+    {
+        $sJsObject = $this->getPageJsObject();
+
+        $aMenu = array();
+        foreach($this->aMenuItems as $sMenuItem => $aItem)
+            $aMenu[] = array(
+                'name' => $sMenuItem,
+                'icon' => $aItem['icon'],
+                'link' => $this->sSubpageUrl . $sMenuItem,
+                'title' => _t('_adm_lmi_cpt_' . $sMenuItem),
+                'selected' => $sMenuItem == $this->sPage
+            );
+
+        return parent::getPageMenu($aMenu);
+    }
+
+    function getPageCode($bHidden = false)
+    {
+        $sMethod = 'get' . bx_gen_method_name($this->sPage);
+        if(!method_exists($this, $sMethod))
+            return '';
+
+        return $this->$sMethod();
+    }
+    
+    protected function getGeneral()
+    {
+        return $this->getGrid($this->aGridObjects['audit']);
+    }
+
+    protected function getGrid($sObjectName)
+    {
+        $oGrid = BxDolGrid::getObjectInstance($sObjectName);
+        if(!$oGrid)
+            return '';
+
+        return BxDolStudioTemplate::getInstance()->parseHtmlByName('audit.html', array(
+            'content' => $this->getBlockCode(array(
+				'items' => $oGrid->getCode()
+			)),
+            'js_content' => ''
+        ));
+    }
+}
+
+/** @} */

+ 108 - 0
studio/template/scripts/BxBaseStudioAuditGrid.php

@@ -0,0 +1,108 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaView UNA Studio Representation classes
+ * @ingroup     UnaStudio
+ * @{
+ */
+
+class BxBaseStudioAuditGrid extends BxDolStudioAuditGrid
+{
+    function __construct($aOptions, $oTemplate = false)
+    {
+        parent::__construct($aOptions, $oTemplate);
+    }
+    
+	protected function _getCellAdded($mixedValue, $sKey, $aField, $aRow)
+    {
+        return parent::_getCellDefault(bx_time_js($mixedValue), $sKey, $aField, $aRow);
+    }
+    
+    protected function _getCellAction ($mixedValue, $sKey, $aField, $aRow)
+    {
+        return parent::_getCellDefault(_t($aRow['action_lang_key'], $aRow['action_lang_key_params']), $sKey, $aField, $aRow);
+    }
+    
+    protected function _getCellContent ($mixedValue, $sKey, $aField, $aRow)
+    {
+        $mixedValue = '';
+        if ($aRow['content_id'] > 0 && $aRow['content_info_object'] != ''){
+            $oContentInfo = BxDolContentInfo::getObjectInstance($aRow['content_info_object']);
+            if ($oContentInfo){
+    	        $sTitle = $oContentInfo->getContentTitle($aRow['content_id']);
+                if ($sTitle != ''){
+                    $mixedValue =  $this->_oTemplate->parseHtmlByName('account_link.html', array(
+                        'href' => $oContentInfo->getContentLink($aRow['content_id']),
+                        'title' =>  $sTitle,
+                        'content' =>  $sTitle,
+                        'class' => 'bx-def-font-grayed'
+                    ));
+                }
+            }
+        }
+        if ($mixedValue == ''){
+            $mixedValue = $aRow['content_title'];
+        }
+        return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow);
+    }
+    
+    protected function _getCellContext ($mixedValue, $sKey, $aField, $aRow)
+    {
+        if ($aRow['context_profile_id'] > 0){
+    	    $oProfile = BxDolProfile::getInstance($aRow['context_profile_id']);
+            if ($oProfile){
+    	        $sProfile = $oProfile->getDisplayName();
+                $mixedValue =  $this->_oTemplate->parseHtmlByName('account_link.html', array(
+                    'href' => $oProfile->getUrl(),
+                    'title' => $sProfile,
+                    'content' => $sProfile,
+                    'class' => 'bx-def-font-grayed'
+                ));
+            }
+            else{
+                $mixedValue = $aRow['context_profile_title'];
+            }
+        }
+        else{
+            $mixedValue = '';
+        }
+        return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow);
+    }
+    
+    protected function _getCellModule ($mixedValue, $sKey, $aField, $aRow)
+    {
+        $oModule = bxDolModule::getInstance($aRow['content_module']);
+        if($oModule instanceof iBxDolContentInfoService){
+            $mixedValue = $oModule->_aModule['title'];
+        }
+        return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow);
+    }
+    
+    
+    protected function _getCellProfile ($mixedValue, $sKey, $aField, $aRow)
+    {
+        if ($aRow['profile_id'] > 0){
+    	    $oProfile = BxDolProfile::getInstance($aRow['profile_id']);
+            if ($oProfile){
+    	        $sProfile = $oProfile->getDisplayName();
+                $mixedValue =  $this->_oTemplate->parseHtmlByName('account_link.html', array(
+                    'href' => $oProfile->getUrl(),
+                    'title' => $sProfile,
+                    'content' => $sProfile,
+                    'class' => 'bx-def-font-grayed'
+                ));
+            }
+            else{
+                $mixedValue = 'deleted';
+            }
+        }
+        else{
+            $mixedValue = '';
+        }
+        return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow);
+    }
+}
+
+/** @} */

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů