mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-05-14 23:08:18 +03:00
Адаптация плагина "profiler" для шаблонов на jquery
This commit is contained in:
parent
7d9a77f9a5
commit
6f8764e386
|
@ -138,7 +138,7 @@ class PluginProfiler_ActionProfiler extends ActionPlugin {
|
|||
$this->Viewer_Assign('aPaging',$aPaging);
|
||||
$this->Viewer_Assign('aReports',$aReports);
|
||||
$this->Viewer_Assign('aDatabaseStat',($aData=$this->PluginProfiler_Profiler_GetDatabaseStat())?$aData:array('max_date'=>'','count'=>''));
|
||||
$this->Viewer_AddBlock('right',$this->getTemplatePathPlugin().'/actions/ActionProfiler/sidebar.tpl');
|
||||
$this->Viewer_AddBlock('right','actions/ActionProfiler/sidebar.tpl',array('plugin'=>'profiler'));
|
||||
$this->Viewer_AddHtmlTitle($this->Lang_Get('profiler_report_page_title'));
|
||||
}
|
||||
|
||||
|
@ -208,7 +208,7 @@ class PluginProfiler_ActionProfiler extends ActionPlugin {
|
|||
* @return
|
||||
*/
|
||||
protected function EventAjaxLoadReport() {
|
||||
$this->Viewer_SetResponseAjax();
|
||||
$this->Viewer_SetResponseAjax('json');
|
||||
|
||||
$sReportId=str_replace('report_','',getRequest('reportId',null,'post'));
|
||||
$bTreeView=getRequest('bTreeView',false,'post');
|
||||
|
@ -232,7 +232,7 @@ class PluginProfiler_ActionProfiler extends ActionPlugin {
|
|||
* @return
|
||||
*/
|
||||
protected function EventAjaxLoadEntriesByFilter() {
|
||||
$this->Viewer_SetResponseAjax();
|
||||
$this->Viewer_SetResponseAjax('json');
|
||||
|
||||
$sAction = $this->GetParam(0);
|
||||
$sReportId=str_replace('report_','',getRequest('reportId',null,'post'));
|
||||
|
|
|
@ -6,10 +6,11 @@
|
|||
<author>
|
||||
<lang name="default">LiveStreet Developers Team</lang>
|
||||
</author>
|
||||
<homepage>http://livestreet.ru/</homepage>
|
||||
<version>1.0.1</version>
|
||||
<homepage>http://livestreet.ru</homepage>
|
||||
<settings>{profiler}</settings>
|
||||
<version>1.2.0</version>
|
||||
<requires>
|
||||
<livestreet>0.4.1</livestreet>
|
||||
<livestreet>0.4.2</livestreet>
|
||||
<plugins>
|
||||
|
||||
</plugins>
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
<div class="profiler-table">
|
||||
<table class="profiler entries">
|
||||
{foreach from=$oReport->getAllEntries() item=oEntry}
|
||||
<tr class="entry_{$oReport->getId()}_all entry_{$oReport->getId()}_{$oEntry->getName()}{if $oEntry->getChildCount()!=0} has-child{/if}">
|
||||
<td align="center" width="20px">{if $oEntry->getChildCount()!=0}<img src="{$aTemplateWebPathPlugin.profiler}images/open.gif" alt="+" title="{$aLang.comment_collapse}/{$aLang.comment_expand}" class="folding lsProfiler_tree" id="tree_{$oReport->getId()}_{$oEntry->getId()}" style="margin-right:3px;"/>{/if}</td>
|
||||
<td width="5%">{$oEntry->getId()}</td>
|
||||
<td width="12%">{$oEntry->getName()}</td>
|
||||
<td width="12%" class="time">{$oEntry->getTimeFull()}</td>
|
||||
<td width="18%">{$oReport->getEntryFullShare($oEntry->getId())}% ({$oReport->getEntryShare($oEntry->getId())}%)</td>
|
||||
<td>{$oEntry->getComment()}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
</div>
|
|
@ -0,0 +1,22 @@
|
|||
{if $oReport}
|
||||
<a href="#" class="profiler tree {if $sAction=='tree'}active{/if}" onclick="ls.profiler.toggleEntriesByClass('{$oReport->getId()}','tree',this); return false;">{$aLang.profiler_entries_show_tree}</a>
|
||||
<a href="#" class="profiler all {if $sAction=='all'}active{/if}" onclick="ls.profiler.toggleEntriesByClass('{$oReport->getId()}','all',this); return false;">{$aLang.profiler_entries_show_all} ({$oReport->getStat('count')})</a>
|
||||
<a href="#" class="profiler query {if $sAction=='query'}active{/if}" onclick="ls.profiler.toggleEntriesByClass('{$oReport->getId()}','query',this); return false;">{$aLang.profiler_entries_show_query} ({$oReport->getStat('query')})</a>
|
||||
|
||||
<div class="profiler-table">
|
||||
<table class="profiler entries">
|
||||
{foreach from=$oReport->getAllEntries() item=oEntry}
|
||||
<tr class="entry_{$oReport->getId()}_all entry_{$oReport->getId()}_{$oEntry->getName()}{if $oEntry->getChildCount()!=0} child{/if}">
|
||||
<td></td>
|
||||
<td width="5%">{$oEntry->getId()}</td>
|
||||
<td width="12%">{$oEntry->getName()}</td>
|
||||
<td width="12%" class="time">{$oEntry->getTimeFull()}</td>
|
||||
<td width="18%">{$oReport->getEntryFullShare($oEntry->getId())}% ({$oReport->getEntryShare($oEntry->getId())}%)</td>
|
||||
<td>{$oEntry->getComment()}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
</div>
|
||||
{else}
|
||||
{$aLang.error}
|
||||
{/if}
|
|
@ -0,0 +1,10 @@
|
|||
{if $oReport}
|
||||
<a href="#" class="profiler tree {if $sAction=='tree'}active{/if}" onclick="ls.profiler.toggleEntriesByClass('{$oReport->getId()}','tree',this); return false;">{$aLang.profiler_entries_show_tree}</a>
|
||||
<a href="#" class="profiler all {if $sAction=='all'}active{/if}" onclick="ls.profiler.toggleEntriesByClass('{$oReport->getId()}','all',this); return false;">{$aLang.profiler_entries_show_all} ({$oReport->getStat('count')})</a>
|
||||
<a href="#" class="profiler query {if $sAction=='query'}active{/if}" onclick="ls.profiler.toggleEntriesByClass('{$oReport->getId()}','query',this); return false;">{$aLang.profiler_entries_show_query} ({$oReport->getStat('query')})</a>
|
||||
|
||||
{assign var="sTemplatePathPlugin" value=$aTemplatePathPlugin.profiler}
|
||||
{include file="$sTemplatePathPlugin/actions/ActionProfiler/ajax/level.tpl"}
|
||||
{else}
|
||||
{$aLang.error}
|
||||
{/if}
|
|
@ -0,0 +1,46 @@
|
|||
{include file='header.tpl' noShowSystemMessage=false}
|
||||
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
var DIR_PLUGIN_SKIN='{$aTemplateWebPathPlugin.profiler}';
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="{$aTemplateWebPathPlugin.profiler}js/profiler.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="{$aTemplateWebPathPlugin.profiler}css/style.css" media="all" />
|
||||
|
||||
|
||||
|
||||
<h2>{$aLang.profiler_reports_title}</h2>
|
||||
|
||||
<form action="{router page='profiler'}" method="post" id="form_report_list">
|
||||
<input type="hidden" name="security_ls_key" value="{$LIVESTREET_SECURITY_KEY}" />
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td width="20px"><input type="checkbox" name="" onclick="ls.tools.checkAll('form_reports_checkbox', this, true);"></td>
|
||||
<td></td>
|
||||
<td>{$aLang.profiler_table_date}</td>
|
||||
<td align="center">{$aLang.profiler_table_time_full}</td>
|
||||
<td align="center">{$aLang.profiler_table_count_id}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{foreach from=$aReports item=oReport}
|
||||
<tr>
|
||||
<td><input type="checkbox" name="report_del[{$oReport.request_id}]" class="form_reports_checkbox"></td>
|
||||
<td align="center"><img src="{$aTemplateWebPathPlugin.profiler}images/open.gif" alt="+" title="{$aLang.comment_collapse}/{$aLang.comment_expand}" class="folding" id="img_{$oReport.request_id}" /></td>
|
||||
<td>{date_format date=$oReport.request_date}</td>
|
||||
<td align="center" class="time">{$oReport.time_full}</td>
|
||||
<td align="center">{$oReport.count_time_id}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<input type="submit" name="submit_report_delete" value="{$aLang.profiler_report_delete}" onclick="return ($$('.form_reports_checkbox').length==0)?false:confirm('{$aLang.profiler_report_delete_confirm}');">
|
||||
</form>
|
||||
|
||||
|
||||
{include file='paging.tpl' aPaging="$aPaging"}
|
||||
{include file='footer.tpl'}
|
|
@ -0,0 +1,59 @@
|
|||
<div class="block">
|
||||
<div class="profiler-highlight">
|
||||
{$aLang.profiler_filter_highlight} ({$aLang.profiler_filter_seconds}):<br />
|
||||
<input type="text" name="profiler_filter_entries" id="profiler_filter_entries" onchange="ls.profiler.filterNode(this);" class="input-100" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="block">
|
||||
<h3>{$aLang.profiler_dbstat_title}</h3>
|
||||
|
||||
<form action="{router page='profiler'}" method="POST" name="profiler_import_form">
|
||||
<p>{$aLang.profiler_dbstat_count}: <strong>{$aDatabaseStat.count}</strong><br />
|
||||
{$aLang.profiler_dbstat_max_date}: <strong>{$aDatabaseStat.max_date}</strong></p>
|
||||
|
||||
<p><label for="profiler_date_import">{$aLang.profiler_import_label}:</label><br />
|
||||
<input type="text" id="profiler_date_import" name="profiler_date_import" value="{if $_aRequest.date_import}{$_aRequest.date_import}{else}{if $aDatabaseStat.max_date}{$aDatabaseStat.max_date}{else}{date_format date=$smarty.now format='Y-m-d \0\0\:\0\0\:\0\0'}{/if}{/if}" class="input-200" /><br />
|
||||
<span class="note">{$aLang.profiler_import_notice}</span></p>
|
||||
|
||||
<input type="submit" name="submit_profiler_import" value="{$aLang.profiler_import_submit}" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="block">
|
||||
<h3>{$aLang.profiler_filter_title}</h3>
|
||||
|
||||
{literal}
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
|
||||
function eraseFilterForm() {
|
||||
$("#profiler_filter_per_page, #profiler_filter_time, #profiler_filter_start, #profiler_filter_end").each(
|
||||
function(k,v){
|
||||
return $(v).attr('value','');
|
||||
}
|
||||
);
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
{/literal}
|
||||
|
||||
|
||||
<form action="{router page='profiler'}" method="GET" name="profiler_filter_form">
|
||||
<p><label for="profiler_filter_start">{$aLang.profiler_filter_label_date}:</label><br />
|
||||
<input type="text" id="profiler_filter_start" name="start" value="{$_aRequest.start}" style="width: 43%" readonly="readonly" class="date-picker"/> —
|
||||
<input type="text" id="profiler_filter_end" name="end" value="{$_aRequest.end}" style="width: 43%" readonly="readonly" class="date-picker"/><br />
|
||||
<span class="note">{$aLang.profiler_filter_notice_date}</span></p>
|
||||
|
||||
<p><label for="profiler_filter_time">{$aLang.profiler_filter_label_time}:</label><br />
|
||||
<input type="text" id="profiler_filter_time" name="time" value="{$_aRequest.time}" class="input-100" /><br />
|
||||
<span class="note">{$aLang.profiler_filter_notice_time}</span></p>
|
||||
|
||||
<p><label for="profiler_filter_per_page">{$aLang.profiler_filter_label_per_page}:</label><br />
|
||||
<input type="text" id="profiler_filter_per_page" name="per_page" value="{if $_aRequest.per_page}{$_aRequest.per_page}{else}{cfg name='module.profiler.per_page'}{/if}" class="input-200" /></p>
|
||||
|
||||
<input type="submit" name="submit_profiler_filter" value="{$aLang.profiler_filter_submit}"/>
|
||||
</form>
|
||||
|
||||
<div class="bottom"><a href="#" onclick="return eraseFilterForm();">{$aLang.profiler_filter_erase_form}</a> | <a href="{router page='profiler'}">{$aLang.profiler_filter_erase}</a></div>
|
||||
</div>
|
|
@ -0,0 +1 @@
|
|||
a.profiler { margin: 2px; padding: 4px 5px; text-decoration: none; }
a.profiler.active { background: #333; color: #fff; }
.profiler.entries { margin-top: 5px; }
.profiler-table .has-child { background: #f4f4f4; }
.profiler-table .filter { background: #dafad8; }
.profiler-highlight { color: #4bb23b; }
|
Binary file not shown.
After Width: | Height: | Size: 70 B |
BIN
plugins/profiler/templates/skin/developer-jquery/images/open.gif
Normal file
BIN
plugins/profiler/templates/skin/developer-jquery/images/open.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 73 B |
186
plugins/profiler/templates/skin/developer-jquery/js/profiler.js
Normal file
186
plugins/profiler/templates/skin/developer-jquery/js/profiler.js
Normal file
|
@ -0,0 +1,186 @@
|
|||
var ls = ls || {};
|
||||
|
||||
ls.profiler = (function ($) {
|
||||
|
||||
this.options = {
|
||||
img : {
|
||||
path: DIR_PLUGIN_SKIN+'images/',
|
||||
openName: 'open.gif',
|
||||
closeName: 'close.gif'
|
||||
},
|
||||
classes: {
|
||||
visible: 'lsProfiler_visible',
|
||||
hidden: 'lsProfiler_hidden',
|
||||
openImg: 'lsProfiler_open',
|
||||
closeImg: 'lsProfiler_close',
|
||||
treeNode: 'lsProfiler_tree',
|
||||
filterNode: 'lsProfiler_filter'
|
||||
},
|
||||
prefix: {
|
||||
img: 'img_',
|
||||
td: 'report_',
|
||||
entry: 'entry_',
|
||||
tree: 'tree_',
|
||||
treeNode: 'tree_node_'
|
||||
},
|
||||
path: {
|
||||
loadReport: aRouter['profiler']+'ajaxloadreport/',
|
||||
loadEntries: aRouter['profiler']+'ajaxloadentriesbyfilter/'
|
||||
}
|
||||
}
|
||||
|
||||
this.init = function(options) {
|
||||
if (options) {
|
||||
$.extend(true,this.options,options);
|
||||
}
|
||||
this.make();
|
||||
}
|
||||
|
||||
|
||||
this.make = function(expandClass){
|
||||
var aImgFolding=(!expandClass)?$('img.folding'):$('img.folding.'+expandClass);
|
||||
$.each(aImgFolding,function(k,v){
|
||||
this.makeImg(v);
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
this.makeImg = function(img) {
|
||||
img=$(img);
|
||||
img.css({
|
||||
'cursor' : 'pointer',
|
||||
'display' : 'inline'
|
||||
});
|
||||
img.removeClass(this.options.classes.closeImg);
|
||||
img.addClass(this.options.classes.openImg);
|
||||
img.unbind('click');
|
||||
img.bind('click',function(){
|
||||
this.toggleNode(img);
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
this.toggleNode = function(img) {
|
||||
if (img.hasClass(this.options.classes.closeImg)) {
|
||||
this.collapseNode(img);
|
||||
} else {
|
||||
this.expandNode(img);
|
||||
}
|
||||
}
|
||||
|
||||
this.expandNode = function(img) {
|
||||
img.attr({'src': this.options.img.path + this.options.img.closeName});
|
||||
img.removeClass(this.options.classes.openImg);
|
||||
img.addClass(this.options.classes.closeImg);
|
||||
|
||||
if(img.hasClass(this.options.classes.treeNode)) {
|
||||
// Это элемент дерева - обрабатываем его соответствующим образом
|
||||
ids = img.attr('id').replace(this.options.prefix.tree,'').split('_');
|
||||
|
||||
reportId=ids[0];
|
||||
var trReportId=this.options.prefix.treeNode+ids[0]+'_'+ids[1];
|
||||
var trReport=$('#'+trReportId);
|
||||
var parentId=ids[1];
|
||||
} else {
|
||||
reportId=img.attr('id').replace(this.options.prefix.img,this.options.prefix.td);
|
||||
var trReport = $('#'+reportId);
|
||||
var parentId = 0;
|
||||
var trReportId = 0;
|
||||
}
|
||||
|
||||
if(trReport.length){
|
||||
trReport.show();
|
||||
} else {
|
||||
this.loadReport(img.parent('td').parent('tr'),reportId,parentId,trReportId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.loadReport = function(obj,reportId,parentId,namedId) {
|
||||
var trCurrent = obj;
|
||||
|
||||
ls.ajax(this.options.path.loadReport, {reportId: reportId, bTreeView: 1, parentId: parentId}, function(result) {
|
||||
if (!result) {
|
||||
ls.msg.error('Error','Please try again later');
|
||||
}
|
||||
if (result.bStateError) {
|
||||
ls.msg.error(result.sMsgTitle,result.sMsg);
|
||||
} else {
|
||||
var trReport=$('<tr id="'+(new String(!namedId?reportId:namedId))+'"><td colspan="6">'+result.sReportText+'</td></tr>');
|
||||
console.log(trCurrent);
|
||||
trCurrent.after(trReport);
|
||||
$.each(trReport.find('img'),function(k,v){
|
||||
this.makeImg(v);
|
||||
}.bind(this));
|
||||
}
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
|
||||
this.collapseNode = function(img) {
|
||||
img.attr({'src': this.options.img.path + this.options.img.openName});
|
||||
img.removeClass(this.options.classes.closeImg);
|
||||
img.addClass(this.options.classes.openImg);
|
||||
|
||||
if(img.hasClass(this.options.classes.treeNode)) {
|
||||
// Это элемент дерева - обрабатываем его соответствующим образом
|
||||
trReport=img.parent('td').parent('tr').next('tr');
|
||||
} else {
|
||||
reportId=img.attr('id').replace(this.options.prefix.img,this.options.prefix.td);
|
||||
var trReport = $('#'+reportId);
|
||||
}
|
||||
|
||||
trReport.hide();
|
||||
}
|
||||
|
||||
this.toggleEntriesByClass = function(reportId,name,link) {
|
||||
$('a.profiler').removeClass('active');
|
||||
$('a.profiler.'+name).addClass('active');
|
||||
|
||||
ls.ajax(this.options.path.loadEntries+name+'/', {reportId: reportId}, function(result) {
|
||||
if (!result) {
|
||||
ls.msg.error('Error','Please try again later');
|
||||
}
|
||||
if (result.bStateError) {
|
||||
ls.msg.error(result.sMsgTitle,result.sMsg);
|
||||
} else {
|
||||
var trReport = $('#'+this.options.prefix.td+reportId).empty();
|
||||
trReport.append('<td colspan="5" >'+result.sReportText+'</td>');
|
||||
|
||||
$.each(trReport.find('img'),function(k,v){
|
||||
this.makeImg(v);
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
this.filterNode = function(obj) {
|
||||
var iTime=$(obj).attr('value');
|
||||
if(iTime!='' && parseFloat(iTime)){ this.highlightFilterNode(iTime); }
|
||||
},
|
||||
|
||||
this.highlightFilterNode = function(iTime) {
|
||||
$.each($('.time'),function(k,v){
|
||||
$(v).parent('tr').removeClass(this.options.classes.filterNode);
|
||||
|
||||
if($(v).text()>iTime) {
|
||||
$(v).parent('tr').addClass(this.options.classes.filterNode);
|
||||
}
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
return this;
|
||||
}).call(ls.profiler || {},jQuery);
|
||||
|
||||
|
||||
jQuery(window).load(function () {
|
||||
ls.profiler.init({
|
||||
img: {
|
||||
path: DIR_PLUGIN_SKIN+'images/'
|
||||
},
|
||||
classes: {
|
||||
openImg: 'folding-open',
|
||||
closeImg: 'folding',
|
||||
filterNode: 'filter'
|
||||
}
|
||||
});
|
||||
});
|
|
@ -0,0 +1,4 @@
|
|||
<p align="center">
|
||||
Profiler: {if $oConfig->GetValue('sys.logs.profiler')}On{else}Off{/if} |
|
||||
<a href="{router page='profiler'}">Profiler reports</a>
|
||||
</p>
|
|
@ -0,0 +1,14 @@
|
|||
<div class="profiler-table">
|
||||
<table class="profiler entries">
|
||||
{foreach from=$oReport->getAllEntries() item=oEntry}
|
||||
<tr class="entry_{$oReport->getId()}_all entry_{$oReport->getId()}_{$oEntry->getName()}{if $oEntry->getChildCount()!=0} has-child{/if}">
|
||||
<td align="center" width="20px">{if $oEntry->getChildCount()!=0}<img src="{$aTemplateWebPathPlugin.profiler}images/open.gif" alt="+" title="{$aLang.comment_collapse}/{$aLang.comment_expand}" class="folding lsProfiler_tree" id="tree_{$oReport->getId()}_{$oEntry->getId()}" style="margin-right:3px;"/>{/if}</td>
|
||||
<td width="5%">{$oEntry->getId()}</td>
|
||||
<td width="12%">{$oEntry->getName()}</td>
|
||||
<td width="12%" class="time">{$oEntry->getTimeFull()}</td>
|
||||
<td width="18%">{$oReport->getEntryFullShare($oEntry->getId())}% ({$oReport->getEntryShare($oEntry->getId())}%)</td>
|
||||
<td>{$oEntry->getComment()}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
</div>
|
|
@ -0,0 +1,22 @@
|
|||
{if $oReport}
|
||||
<a href="#" class="profiler tree {if $sAction=='tree'}active{/if}" onclick="ls.profiler.toggleEntriesByClass('{$oReport->getId()}','tree',this); return false;">{$aLang.profiler_entries_show_tree}</a>
|
||||
<a href="#" class="profiler all {if $sAction=='all'}active{/if}" onclick="ls.profiler.toggleEntriesByClass('{$oReport->getId()}','all',this); return false;">{$aLang.profiler_entries_show_all} ({$oReport->getStat('count')})</a>
|
||||
<a href="#" class="profiler query {if $sAction=='query'}active{/if}" onclick="ls.profiler.toggleEntriesByClass('{$oReport->getId()}','query',this); return false;">{$aLang.profiler_entries_show_query} ({$oReport->getStat('query')})</a>
|
||||
|
||||
<div class="profiler-table">
|
||||
<table class="profiler entries">
|
||||
{foreach from=$oReport->getAllEntries() item=oEntry}
|
||||
<tr class="entry_{$oReport->getId()}_all entry_{$oReport->getId()}_{$oEntry->getName()}{if $oEntry->getChildCount()!=0} child{/if}">
|
||||
<td></td>
|
||||
<td width="5%">{$oEntry->getId()}</td>
|
||||
<td width="12%">{$oEntry->getName()}</td>
|
||||
<td width="12%" class="time">{$oEntry->getTimeFull()}</td>
|
||||
<td width="18%">{$oReport->getEntryFullShare($oEntry->getId())}% ({$oReport->getEntryShare($oEntry->getId())}%)</td>
|
||||
<td>{$oEntry->getComment()}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
</div>
|
||||
{else}
|
||||
{$aLang.error}
|
||||
{/if}
|
|
@ -0,0 +1,10 @@
|
|||
{if $oReport}
|
||||
<a href="#" class="profiler tree {if $sAction=='tree'}active{/if}" onclick="ls.profiler.toggleEntriesByClass('{$oReport->getId()}','tree',this); return false;">{$aLang.profiler_entries_show_tree}</a>
|
||||
<a href="#" class="profiler all {if $sAction=='all'}active{/if}" onclick="ls.profiler.toggleEntriesByClass('{$oReport->getId()}','all',this); return false;">{$aLang.profiler_entries_show_all} ({$oReport->getStat('count')})</a>
|
||||
<a href="#" class="profiler query {if $sAction=='query'}active{/if}" onclick="ls.profiler.toggleEntriesByClass('{$oReport->getId()}','query',this); return false;">{$aLang.profiler_entries_show_query} ({$oReport->getStat('query')})</a>
|
||||
|
||||
{assign var="sTemplatePathPlugin" value=$aTemplatePathPlugin.profiler}
|
||||
{include file="$sTemplatePathPlugin/actions/ActionProfiler/ajax/level.tpl"}
|
||||
{else}
|
||||
{$aLang.error}
|
||||
{/if}
|
|
@ -0,0 +1,46 @@
|
|||
{include file='header.tpl' noShowSystemMessage=false}
|
||||
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
var DIR_PLUGIN_SKIN='{$aTemplateWebPathPlugin.profiler}';
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="{$aTemplateWebPathPlugin.profiler}js/profiler.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="{$aTemplateWebPathPlugin.profiler}css/style.css" media="all" />
|
||||
|
||||
|
||||
|
||||
<h2>{$aLang.profiler_reports_title}</h2>
|
||||
|
||||
<form action="{router page='profiler'}" method="post" id="form_report_list">
|
||||
<input type="hidden" name="security_ls_key" value="{$LIVESTREET_SECURITY_KEY}" />
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td width="20px"><input type="checkbox" name="" onclick="ls.tools.checkAll('form_reports_checkbox', this, true);"></td>
|
||||
<td></td>
|
||||
<td>{$aLang.profiler_table_date}</td>
|
||||
<td align="center">{$aLang.profiler_table_time_full}</td>
|
||||
<td align="center">{$aLang.profiler_table_count_id}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{foreach from=$aReports item=oReport}
|
||||
<tr>
|
||||
<td><input type="checkbox" name="report_del[{$oReport.request_id}]" class="form_reports_checkbox"></td>
|
||||
<td align="center"><img src="{$aTemplateWebPathPlugin.profiler}images/open.gif" alt="+" title="{$aLang.comment_collapse}/{$aLang.comment_expand}" class="folding" id="img_{$oReport.request_id}" /></td>
|
||||
<td>{date_format date=$oReport.request_date}</td>
|
||||
<td align="center" class="time">{$oReport.time_full}</td>
|
||||
<td align="center">{$oReport.count_time_id}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<input type="submit" name="submit_report_delete" value="{$aLang.profiler_report_delete}" onclick="return ($$('.form_reports_checkbox').length==0)?false:confirm('{$aLang.profiler_report_delete_confirm}');">
|
||||
</form>
|
||||
|
||||
|
||||
{include file='paging.tpl' aPaging="$aPaging"}
|
||||
{include file='footer.tpl'}
|
|
@ -0,0 +1,59 @@
|
|||
<div class="block">
|
||||
<div class="profiler-highlight">
|
||||
{$aLang.profiler_filter_highlight} ({$aLang.profiler_filter_seconds}):<br />
|
||||
<input type="text" name="profiler_filter_entries" id="profiler_filter_entries" onchange="ls.profiler.filterNode(this);" class="input-100" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="block">
|
||||
<h3>{$aLang.profiler_dbstat_title}</h3>
|
||||
|
||||
<form action="{router page='profiler'}" method="POST" name="profiler_import_form">
|
||||
<p>{$aLang.profiler_dbstat_count}: <strong>{$aDatabaseStat.count}</strong><br />
|
||||
{$aLang.profiler_dbstat_max_date}: <strong>{$aDatabaseStat.max_date}</strong></p>
|
||||
|
||||
<p><label for="profiler_date_import">{$aLang.profiler_import_label}:</label><br />
|
||||
<input type="text" id="profiler_date_import" name="profiler_date_import" value="{if $_aRequest.date_import}{$_aRequest.date_import}{else}{if $aDatabaseStat.max_date}{$aDatabaseStat.max_date}{else}{date_format date=$smarty.now format='Y-m-d \0\0\:\0\0\:\0\0'}{/if}{/if}" class="input-200" /><br />
|
||||
<span class="note">{$aLang.profiler_import_notice}</span></p>
|
||||
|
||||
<input type="submit" name="submit_profiler_import" value="{$aLang.profiler_import_submit}" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="block">
|
||||
<h3>{$aLang.profiler_filter_title}</h3>
|
||||
|
||||
{literal}
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
|
||||
function eraseFilterForm() {
|
||||
$("#profiler_filter_per_page, #profiler_filter_time, #profiler_filter_start, #profiler_filter_end").each(
|
||||
function(k,v){
|
||||
return $(v).attr('value','');
|
||||
}
|
||||
);
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
{/literal}
|
||||
|
||||
|
||||
<form action="{router page='profiler'}" method="GET" name="profiler_filter_form">
|
||||
<p><label for="profiler_filter_start">{$aLang.profiler_filter_label_date}:</label><br />
|
||||
<input type="text" id="profiler_filter_start" name="start" value="{$_aRequest.start}" style="width: 43%" readonly="readonly" class="date-picker"/> —
|
||||
<input type="text" id="profiler_filter_end" name="end" value="{$_aRequest.end}" style="width: 43%" readonly="readonly" class="date-picker"/><br />
|
||||
<span class="note">{$aLang.profiler_filter_notice_date}</span></p>
|
||||
|
||||
<p><label for="profiler_filter_time">{$aLang.profiler_filter_label_time}:</label><br />
|
||||
<input type="text" id="profiler_filter_time" name="time" value="{$_aRequest.time}" class="input-100" /><br />
|
||||
<span class="note">{$aLang.profiler_filter_notice_time}</span></p>
|
||||
|
||||
<p><label for="profiler_filter_per_page">{$aLang.profiler_filter_label_per_page}:</label><br />
|
||||
<input type="text" id="profiler_filter_per_page" name="per_page" value="{if $_aRequest.per_page}{$_aRequest.per_page}{else}{cfg name='module.profiler.per_page'}{/if}" class="input-200" /></p>
|
||||
|
||||
<input type="submit" name="submit_profiler_filter" value="{$aLang.profiler_filter_submit}"/>
|
||||
</form>
|
||||
|
||||
<div class="bottom"><a href="#" onclick="return eraseFilterForm();">{$aLang.profiler_filter_erase_form}</a> | <a href="{router page='profiler'}">{$aLang.profiler_filter_erase}</a></div>
|
||||
</div>
|
1
plugins/profiler/templates/skin/new-jquery/css/style.css
Normal file
1
plugins/profiler/templates/skin/new-jquery/css/style.css
Normal file
|
@ -0,0 +1 @@
|
|||
a.profiler { margin: 2px; padding: 4px 5px; text-decoration: none; }
a.profiler.active { background: #333; color: #fff; }
.profiler.entries { margin-top: 5px; }
.profiler-table .has-child { background: #f4f4f4; }
.profiler-table .filter { background: #dafad8; }
.profiler-highlight { color: #4bb23b; }
|
BIN
plugins/profiler/templates/skin/new-jquery/images/close.gif
Normal file
BIN
plugins/profiler/templates/skin/new-jquery/images/close.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 70 B |
BIN
plugins/profiler/templates/skin/new-jquery/images/open.gif
Normal file
BIN
plugins/profiler/templates/skin/new-jquery/images/open.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 73 B |
186
plugins/profiler/templates/skin/new-jquery/js/profiler.js
Normal file
186
plugins/profiler/templates/skin/new-jquery/js/profiler.js
Normal file
|
@ -0,0 +1,186 @@
|
|||
var ls = ls || {};
|
||||
|
||||
ls.profiler = (function ($) {
|
||||
|
||||
this.options = {
|
||||
img : {
|
||||
path: DIR_PLUGIN_SKIN+'images/',
|
||||
openName: 'open.gif',
|
||||
closeName: 'close.gif'
|
||||
},
|
||||
classes: {
|
||||
visible: 'lsProfiler_visible',
|
||||
hidden: 'lsProfiler_hidden',
|
||||
openImg: 'lsProfiler_open',
|
||||
closeImg: 'lsProfiler_close',
|
||||
treeNode: 'lsProfiler_tree',
|
||||
filterNode: 'lsProfiler_filter'
|
||||
},
|
||||
prefix: {
|
||||
img: 'img_',
|
||||
td: 'report_',
|
||||
entry: 'entry_',
|
||||
tree: 'tree_',
|
||||
treeNode: 'tree_node_'
|
||||
},
|
||||
path: {
|
||||
loadReport: aRouter['profiler']+'ajaxloadreport/',
|
||||
loadEntries: aRouter['profiler']+'ajaxloadentriesbyfilter/'
|
||||
}
|
||||
}
|
||||
|
||||
this.init = function(options) {
|
||||
if (options) {
|
||||
$.extend(true,this.options,options);
|
||||
}
|
||||
this.make();
|
||||
}
|
||||
|
||||
|
||||
this.make = function(expandClass){
|
||||
var aImgFolding=(!expandClass)?$('img.folding'):$('img.folding.'+expandClass);
|
||||
$.each(aImgFolding,function(k,v){
|
||||
this.makeImg(v);
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
this.makeImg = function(img) {
|
||||
img=$(img);
|
||||
img.css({
|
||||
'cursor' : 'pointer',
|
||||
'display' : 'inline'
|
||||
});
|
||||
img.removeClass(this.options.classes.closeImg);
|
||||
img.addClass(this.options.classes.openImg);
|
||||
img.unbind('click');
|
||||
img.bind('click',function(){
|
||||
this.toggleNode(img);
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
this.toggleNode = function(img) {
|
||||
if (img.hasClass(this.options.classes.closeImg)) {
|
||||
this.collapseNode(img);
|
||||
} else {
|
||||
this.expandNode(img);
|
||||
}
|
||||
}
|
||||
|
||||
this.expandNode = function(img) {
|
||||
img.attr({'src': this.options.img.path + this.options.img.closeName});
|
||||
img.removeClass(this.options.classes.openImg);
|
||||
img.addClass(this.options.classes.closeImg);
|
||||
|
||||
if(img.hasClass(this.options.classes.treeNode)) {
|
||||
// Это элемент дерева - обрабатываем его соответствующим образом
|
||||
ids = img.attr('id').replace(this.options.prefix.tree,'').split('_');
|
||||
|
||||
reportId=ids[0];
|
||||
var trReportId=this.options.prefix.treeNode+ids[0]+'_'+ids[1];
|
||||
var trReport=$('#'+trReportId);
|
||||
var parentId=ids[1];
|
||||
} else {
|
||||
reportId=img.attr('id').replace(this.options.prefix.img,this.options.prefix.td);
|
||||
var trReport = $('#'+reportId);
|
||||
var parentId = 0;
|
||||
var trReportId = 0;
|
||||
}
|
||||
|
||||
if(trReport.length){
|
||||
trReport.show();
|
||||
} else {
|
||||
this.loadReport(img.parent('td').parent('tr'),reportId,parentId,trReportId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.loadReport = function(obj,reportId,parentId,namedId) {
|
||||
var trCurrent = obj;
|
||||
|
||||
ls.ajax(this.options.path.loadReport, {reportId: reportId, bTreeView: 1, parentId: parentId}, function(result) {
|
||||
if (!result) {
|
||||
ls.msg.error('Error','Please try again later');
|
||||
}
|
||||
if (result.bStateError) {
|
||||
ls.msg.error(result.sMsgTitle,result.sMsg);
|
||||
} else {
|
||||
var trReport=$('<tr id="'+(new String(!namedId?reportId:namedId))+'"><td colspan="6">'+result.sReportText+'</td></tr>');
|
||||
console.log(trCurrent);
|
||||
trCurrent.after(trReport);
|
||||
$.each(trReport.find('img'),function(k,v){
|
||||
this.makeImg(v);
|
||||
}.bind(this));
|
||||
}
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
|
||||
this.collapseNode = function(img) {
|
||||
img.attr({'src': this.options.img.path + this.options.img.openName});
|
||||
img.removeClass(this.options.classes.closeImg);
|
||||
img.addClass(this.options.classes.openImg);
|
||||
|
||||
if(img.hasClass(this.options.classes.treeNode)) {
|
||||
// Это элемент дерева - обрабатываем его соответствующим образом
|
||||
trReport=img.parent('td').parent('tr').next('tr');
|
||||
} else {
|
||||
reportId=img.attr('id').replace(this.options.prefix.img,this.options.prefix.td);
|
||||
var trReport = $('#'+reportId);
|
||||
}
|
||||
|
||||
trReport.hide();
|
||||
}
|
||||
|
||||
this.toggleEntriesByClass = function(reportId,name,link) {
|
||||
$('a.profiler').removeClass('active');
|
||||
$('a.profiler.'+name).addClass('active');
|
||||
|
||||
ls.ajax(this.options.path.loadEntries+name+'/', {reportId: reportId}, function(result) {
|
||||
if (!result) {
|
||||
ls.msg.error('Error','Please try again later');
|
||||
}
|
||||
if (result.bStateError) {
|
||||
ls.msg.error(result.sMsgTitle,result.sMsg);
|
||||
} else {
|
||||
var trReport = $('#'+this.options.prefix.td+reportId).empty();
|
||||
trReport.append('<td colspan="5" >'+result.sReportText+'</td>');
|
||||
|
||||
$.each(trReport.find('img'),function(k,v){
|
||||
this.makeImg(v);
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
this.filterNode = function(obj) {
|
||||
var iTime=$(obj).attr('value');
|
||||
if(iTime!='' && parseFloat(iTime)){ this.highlightFilterNode(iTime); }
|
||||
},
|
||||
|
||||
this.highlightFilterNode = function(iTime) {
|
||||
$.each($('.time'),function(k,v){
|
||||
$(v).parent('tr').removeClass(this.options.classes.filterNode);
|
||||
|
||||
if($(v).text()>iTime) {
|
||||
$(v).parent('tr').addClass(this.options.classes.filterNode);
|
||||
}
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
return this;
|
||||
}).call(ls.profiler || {},jQuery);
|
||||
|
||||
|
||||
jQuery(window).load(function () {
|
||||
ls.profiler.init({
|
||||
img: {
|
||||
path: DIR_PLUGIN_SKIN+'images/'
|
||||
},
|
||||
classes: {
|
||||
openImg: 'folding-open',
|
||||
closeImg: 'folding',
|
||||
filterNode: 'filter'
|
||||
}
|
||||
});
|
||||
});
|
4
plugins/profiler/templates/skin/new-jquery/link.tpl
Normal file
4
plugins/profiler/templates/skin/new-jquery/link.tpl
Normal file
|
@ -0,0 +1,4 @@
|
|||
<p align="center">
|
||||
Profiler: {if $oConfig->GetValue('sys.logs.profiler')}On{else}Off{/if} |
|
||||
<a href="{router page='profiler'}">Profiler reports</a>
|
||||
</p>
|
Loading…
Reference in a new issue