mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-26 03:30:48 +03:00
Система плагинов: возможность подключения шаблонов из директорий плагинов.
This commit is contained in:
parent
2231be580a
commit
a8d79c8e09
|
@ -19,7 +19,7 @@
|
|||
* Обрабатывает вывод отчетов профилирования
|
||||
*
|
||||
*/
|
||||
class PluginProfiler_ActionProfiler extends Action {
|
||||
class PluginProfiler_ActionProfiler extends ActionPlugin {
|
||||
/**
|
||||
* Текущий юзер
|
||||
*
|
||||
|
@ -138,7 +138,7 @@ class PluginProfiler_ActionProfiler extends Action {
|
|||
$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','plugins/profiler/actions/ActionProfiler/sidebar.tpl');
|
||||
$this->Viewer_AddBlock('right','profiler/templates/skin/[skin_name]/actions/ActionProfiler/sidebar.tpl',array('plugin'=>'profiler'));
|
||||
$this->Viewer_AddHtmlTitle($this->Lang_Get('profiler_report_page_title'));
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,7 @@ class PluginProfiler_ActionProfiler extends Action {
|
|||
? 'level'
|
||||
: 'tree')
|
||||
:'report';
|
||||
$this->Viewer_AssignAjax('sReportText',$oViewerLocal->Fetch("plugins/profiler/actions/ActionProfiler/ajax/{$sTemplateName}.tpl"));
|
||||
$this->Viewer_AssignAjax('sReportText',$oViewerLocal->Fetch("profiler/templates/skin/[skin_name]/actions/ActionProfiler/ajax/{$sTemplateName}.tpl"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -253,7 +253,7 @@ class PluginProfiler_ActionProfiler extends Action {
|
|||
$oViewerLocal->Assign('oReport',$oReport);
|
||||
|
||||
$sTemplateName=($sAction=='tree')?'tree':'report';
|
||||
$this->Viewer_AssignAjax('sReportText',$oViewerLocal->Fetch("plugins/profiler/actions/ActionProfiler/ajax/{$sTemplateName}.tpl"));
|
||||
$this->Viewer_AssignAjax('sReportText',$oViewerLocal->Fetch("profiler/templates/skin/[skin_name]/actions/ActionProfiler/ajax/{$sTemplateName}.tpl"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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>{if $oEntry->getChildCount()!=0}<img src="{cfg name='path.static.skin'}/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="lsProfiler.toggleEntriesByClass('{$oReport->getId()}','tree',this); return false;">{$aLang.profiler_entries_show_tree}</a>
|
||||
<a href="#" class="profiler all {if $sAction=='all'}active{/if}" onclick="lsProfiler.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="lsProfiler.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,9 @@
|
|||
{if $oReport}
|
||||
<a href="#" class="profiler tree {if $sAction=='tree'}active{/if}" onclick="lsProfiler.toggleEntriesByClass('{$oReport->getId()}','tree',this); return false;">{$aLang.profiler_entries_show_tree}</a>
|
||||
<a href="#" class="profiler all {if $sAction=='all'}active{/if}" onclick="lsProfiler.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="lsProfiler.toggleEntriesByClass('{$oReport->getId()}','query',this); return false;">{$aLang.profiler_entries_show_query} ({$oReport->getStat('query')})</a>
|
||||
|
||||
{include file='plugins/profiler/actions/ActionProfiler/ajax/level.tpl'}
|
||||
{else}
|
||||
{$aLang.error}
|
||||
{/if}
|
|
@ -0,0 +1,35 @@
|
|||
{include file='header.tpl' noShowSystemMessage=false}
|
||||
<script type="text/javascript" src="{cfg name='path.static.skin'}/plugins/profiler/js/profiler.js"></script>
|
||||
|
||||
<div class="topic people top-blogs talk-table">
|
||||
<h1>{$aLang.profiler_reports_title}</h1>
|
||||
<form action="{router page='profiler'}" method="post" id="form_report_list">
|
||||
<input type="hidden" name="security_ls_key" value="{$LIVESTREET_SECURITY_KEY}" />
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<td width="20px"><input type="checkbox" name="" onclick="checkAllReport(this);"></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><img src="{cfg name='path.static.skin'}/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>
|
||||
</div>
|
||||
{include file='paging.tpl' aPaging=`$aPaging`}
|
||||
{include file='footer.tpl'}
|
|
@ -0,0 +1,99 @@
|
|||
<div class="profiler-highlight">{$aLang.profiler_filter_highlight}: <input type="text" name="profiler_filter_entries" id="profiler_filter_entries" onchange="lsProfiler.filterNode(this);" class="w50" /> {$aLang.profiler_filter_seconds}</div>
|
||||
<div class="block blogs">
|
||||
<div class="tl"><div class="tr"></div></div>
|
||||
<div class="cl"><div class="cr">
|
||||
|
||||
<h1>{$aLang.profiler_dbstat_title}</h1>
|
||||
|
||||
<form action="{router page='profiler'}" method="POST" name="profiler_import_form">
|
||||
<p>{$aLang.profiler_dbstat_count}: {$aDatabaseStat.count}<br />
|
||||
{$aLang.profiler_dbstat_max_date}: {$aDatabaseStat.max_date}</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="w100p" /><br />
|
||||
<span class="form_note">{$aLang.profiler_import_notice}</span>
|
||||
</p>
|
||||
<p class="buttons">
|
||||
<input type="submit" name="submit_profiler_import" value="{$aLang.profiler_import_submit}"/>
|
||||
</p>
|
||||
</form>
|
||||
<br/>
|
||||
</div></div>
|
||||
<div class="bl"><div class="br"></div></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="block blogs">
|
||||
<div class="tl"><div class="tr"></div></div>
|
||||
<div class="cl"><div class="cr">
|
||||
|
||||
<h1>{$aLang.profiler_filter_title}</h1>
|
||||
|
||||
{literal}
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
document.addEvent('domready', function() {
|
||||
new vlaDatePicker(
|
||||
$('profiler_filter_start'),
|
||||
{
|
||||
separator: '.',
|
||||
leadingZero: true,
|
||||
twoDigitYear: false,
|
||||
alignX: 'center',
|
||||
alignY: 'top',
|
||||
offset: { y: 3 },
|
||||
filePath: DIR_WEB_ROOT+'/engine/lib/external/MooTools_1.2/plugs/vlaCal-v2.1/inc/',
|
||||
prefillDate: false,
|
||||
startMonday: true
|
||||
}
|
||||
);
|
||||
new vlaDatePicker(
|
||||
$('profiler_filter_end'),
|
||||
{
|
||||
separator: '.',
|
||||
leadingZero: true,
|
||||
twoDigitYear: false,
|
||||
alignX: 'center',
|
||||
alignY: 'top',
|
||||
offset: { y: 3 },
|
||||
filePath: DIR_WEB_ROOT+'/engine/lib/external/MooTools_1.2/plugs/vlaCal-v2.1/inc/',
|
||||
prefillDate: false,
|
||||
startMonday: true
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
function eraseFilterForm() {
|
||||
$$("#profiler_filter_per_page, #profiler_filter_time, #profiler_filter_start, #profiler_filter_end").each(
|
||||
function(item,index){
|
||||
return item.set('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}" class="w100p" style="width: 44%" readonly="readonly" /> —
|
||||
<input type="text" id="profiler_filter_end" name="end" value="{$_aRequest.end}" class="w100p" style="width: 44%" readonly="readonly" /><br />
|
||||
<span class="form_note">{$aLang.profiler_filter_notice_date}</span>
|
||||
</p>
|
||||
|
||||
<p><label for="profiler_filter_time">{$aLang.profiler_filter_label_time}:</label>
|
||||
<input type="text" id="profiler_filter_time" name="time" value="{$_aRequest.time}" class="w100" /><br />
|
||||
<span class="form_note">{$aLang.profiler_filter_notice_time}</span>
|
||||
</p>
|
||||
|
||||
<p><label for="profiler_filter_per_page">{$aLang.profiler_filter_label_per_page}:</label>
|
||||
<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="w50" /><br />
|
||||
<span class="form_note">{$aLang.profiler_filter_notice_per_page}</span>
|
||||
</p>
|
||||
|
||||
<p class="buttons">
|
||||
<input type="submit" name="submit_profiler_filter" value="{$aLang.profiler_filter_submit}"/>
|
||||
</p>
|
||||
</form>
|
||||
<div class="right"><a href="#" onclick="return eraseFilterForm();">{$aLang.profiler_filter_erase_form}</a> | <a href="{router page='profiler'}">{$aLang.profiler_filter_erase}</a></div>
|
||||
</div></div>
|
||||
<div class="bl"><div class="br"></div></div>
|
||||
</div>
|
|
@ -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>{if $oEntry->getChildCount()!=0}<img src="{cfg name='path.static.skin'}/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="lsProfiler.toggleEntriesByClass('{$oReport->getId()}','tree',this); return false;">{$aLang.profiler_entries_show_tree}</a>
|
||||
<a href="#" class="profiler all {if $sAction=='all'}active{/if}" onclick="lsProfiler.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="lsProfiler.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,9 @@
|
|||
{if $oReport}
|
||||
<a href="#" class="profiler tree {if $sAction=='tree'}active{/if}" onclick="lsProfiler.toggleEntriesByClass('{$oReport->getId()}','tree',this); return false;">{$aLang.profiler_entries_show_tree}</a>
|
||||
<a href="#" class="profiler all {if $sAction=='all'}active{/if}" onclick="lsProfiler.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="lsProfiler.toggleEntriesByClass('{$oReport->getId()}','query',this); return false;">{$aLang.profiler_entries_show_query} ({$oReport->getStat('query')})</a>
|
||||
|
||||
{include file='plugins/profiler/actions/ActionProfiler/ajax/level.tpl'}
|
||||
{else}
|
||||
{$aLang.error}
|
||||
{/if}
|
|
@ -0,0 +1,35 @@
|
|||
{include file='header.tpl' noShowSystemMessage=false}
|
||||
<script type="text/javascript" src="{cfg name='path.static.skin'}/plugins/profiler/js/profiler.js"></script>
|
||||
|
||||
<div class="topic people top-blogs talk-table">
|
||||
<h1>{$aLang.profiler_reports_title}</h1>
|
||||
<form action="{router page='profiler'}" method="post" id="form_report_list">
|
||||
<input type="hidden" name="security_ls_key" value="{$LIVESTREET_SECURITY_KEY}" />
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<td width="20px"><input type="checkbox" name="" onclick="checkAllReport(this);"></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><img src="{cfg name='path.static.skin'}/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>
|
||||
</div>
|
||||
{include file='paging.tpl' aPaging=`$aPaging`}
|
||||
{include file='footer.tpl'}
|
|
@ -0,0 +1,99 @@
|
|||
<div class="profiler-highlight">{$aLang.profiler_filter_highlight}: <input type="text" name="profiler_filter_entries" id="profiler_filter_entries" onchange="lsProfiler.filterNode(this);" class="w50" /> {$aLang.profiler_filter_seconds}</div>
|
||||
<div class="block blogs">
|
||||
<div class="tl"><div class="tr"></div></div>
|
||||
<div class="cl"><div class="cr">
|
||||
|
||||
<h1>{$aLang.profiler_dbstat_title}</h1>
|
||||
|
||||
<form action="{router page='profiler'}" method="POST" name="profiler_import_form">
|
||||
<p>{$aLang.profiler_dbstat_count}: {$aDatabaseStat.count}<br />
|
||||
{$aLang.profiler_dbstat_max_date}: {$aDatabaseStat.max_date}</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="w100p" /><br />
|
||||
<span class="form_note">{$aLang.profiler_import_notice}</span>
|
||||
</p>
|
||||
<p class="buttons">
|
||||
<input type="submit" name="submit_profiler_import" value="{$aLang.profiler_import_submit}"/>
|
||||
</p>
|
||||
</form>
|
||||
<br/>
|
||||
</div></div>
|
||||
<div class="bl"><div class="br"></div></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="block blogs">
|
||||
<div class="tl"><div class="tr"></div></div>
|
||||
<div class="cl"><div class="cr">
|
||||
|
||||
<h1>{$aLang.profiler_filter_title}</h1>
|
||||
|
||||
{literal}
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
document.addEvent('domready', function() {
|
||||
new vlaDatePicker(
|
||||
$('profiler_filter_start'),
|
||||
{
|
||||
separator: '.',
|
||||
leadingZero: true,
|
||||
twoDigitYear: false,
|
||||
alignX: 'center',
|
||||
alignY: 'top',
|
||||
offset: { y: 3 },
|
||||
filePath: DIR_WEB_ROOT+'/engine/lib/external/MooTools_1.2/plugs/vlaCal-v2.1/inc/',
|
||||
prefillDate: false,
|
||||
startMonday: true
|
||||
}
|
||||
);
|
||||
new vlaDatePicker(
|
||||
$('profiler_filter_end'),
|
||||
{
|
||||
separator: '.',
|
||||
leadingZero: true,
|
||||
twoDigitYear: false,
|
||||
alignX: 'center',
|
||||
alignY: 'top',
|
||||
offset: { y: 3 },
|
||||
filePath: DIR_WEB_ROOT+'/engine/lib/external/MooTools_1.2/plugs/vlaCal-v2.1/inc/',
|
||||
prefillDate: false,
|
||||
startMonday: true
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
function eraseFilterForm() {
|
||||
$$("#profiler_filter_per_page, #profiler_filter_time, #profiler_filter_start, #profiler_filter_end").each(
|
||||
function(item,index){
|
||||
return item.set('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}" class="w100p" style="width: 44%" readonly="readonly" /> —
|
||||
<input type="text" id="profiler_filter_end" name="end" value="{$_aRequest.end}" class="w100p" style="width: 44%" readonly="readonly" /><br />
|
||||
<span class="form_note">{$aLang.profiler_filter_notice_date}</span>
|
||||
</p>
|
||||
|
||||
<p><label for="profiler_filter_time">{$aLang.profiler_filter_label_time}:</label>
|
||||
<input type="text" id="profiler_filter_time" name="time" value="{$_aRequest.time}" class="w100" /><br />
|
||||
<span class="form_note">{$aLang.profiler_filter_notice_time}</span>
|
||||
</p>
|
||||
|
||||
<p><label for="profiler_filter_per_page">{$aLang.profiler_filter_label_per_page}:</label>
|
||||
<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="w50" /><br />
|
||||
<span class="form_note">{$aLang.profiler_filter_notice_per_page}</span>
|
||||
</p>
|
||||
|
||||
<p class="buttons">
|
||||
<input type="submit" name="submit_profiler_filter" value="{$aLang.profiler_filter_submit}"/>
|
||||
</p>
|
||||
</form>
|
||||
<div class="right"><a href="#" onclick="return eraseFilterForm();">{$aLang.profiler_filter_erase_form}</a> | <a href="{router page='profiler'}">{$aLang.profiler_filter_erase}</a></div>
|
||||
</div></div>
|
||||
<div class="bl"><div class="br"></div></div>
|
||||
</div>
|
|
@ -224,9 +224,7 @@ abstract class Action extends Object {
|
|||
*/
|
||||
public function GetTemplate() {
|
||||
if (is_null($this->sActionTemplate)) {
|
||||
$this->sActionTemplate=preg_match('/^Plugin([\w]+)_Action([\w]+)$/i',$this->GetActionClass(),$aMatches)
|
||||
? 'plugins/'.strtolower($aMatches[1]).'/actions/Action'.ucfirst($aMatches[2]).'/'.$this->sCurrentEvent.'.tpl'
|
||||
: 'actions/'.$this->GetActionClass().'/'.$this->sCurrentEvent.'.tpl';
|
||||
$this->sActionTemplate='actions/'.$this->GetActionClass().'/'.$this->sCurrentEvent.'.tpl';
|
||||
}
|
||||
return $this->sActionTemplate;
|
||||
}
|
||||
|
|
75
engine/classes/ActionPlugin.class.php
Normal file
75
engine/classes/ActionPlugin.class.php
Normal file
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
/*-------------------------------------------------------
|
||||
*
|
||||
* LiveStreet Engine Social Networking
|
||||
* Copyright © 2008 Mzhelskiy Maxim
|
||||
*
|
||||
*--------------------------------------------------------
|
||||
*
|
||||
* Official site: www.livestreet.ru
|
||||
* Contact e-mail: rus.engine@gmail.com
|
||||
*
|
||||
* GNU General Public License, version 2:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
---------------------------------------------------------
|
||||
*/
|
||||
|
||||
require_once('Action.class.php');
|
||||
/**
|
||||
* Абстрактный класс экшена
|
||||
*
|
||||
*/
|
||||
abstract class ActionPlugin extends Action {
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const SKIN_NAME_KEY = '[skin_name]';
|
||||
|
||||
/**
|
||||
* Устанавливает какой шаблон выводить
|
||||
*
|
||||
* @param string $sTemplate Путь до шаблона относительно общего каталога шаблонов
|
||||
*/
|
||||
protected function SetTemplate($sTemplate) {
|
||||
$this->sActionTemplate=$sTemplate;
|
||||
if(preg_match('/^Plugin([\w]+)_Action([\w]+)$/i',$this->GetActionClass(),$aMatches)) {
|
||||
$this->sActionTemplate=$this->Viewer_ReplacePluginSkinName($this->sActionTemplate,$aMatches[1]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Устанавливает какой шаблон выводить
|
||||
*
|
||||
* @param string $sTemplate Путь до шаблона относительно каталога шаблонов экшена
|
||||
*/
|
||||
protected function SetTemplateAction($sTemplate) {
|
||||
$this->sActionTemplate==preg_match('/^Plugin([\w]+)_Action([\w]+)$/i',$this->GetActionClass(),$aMatches)
|
||||
? strtolower($aMatches[1]).'/templates/skin/'.self::SKIN_NAME_KEY.'/actions/Action'.ucfirst($aMatches[2]).'/'.$sTemplate.'.tpl'
|
||||
: null;
|
||||
|
||||
if(preg_match('/^Plugin([\w]+)_Action([\w]+)$/i',$this->GetActionClass(),$aMatches)) {
|
||||
$this->sActionTemplate=$this->Viewer_ReplacePluginSkinName($this->sActionTemplate,$aMatches[1]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Получить шаблон
|
||||
* Если шаблон не определен то возвращаем дефолтный шаблон евента: action/{Action}.{event}.tpl
|
||||
*
|
||||
* @return unknown
|
||||
*/
|
||||
public function GetTemplate() {
|
||||
if (is_null($this->sActionTemplate)) {
|
||||
$this->sActionTemplate=preg_match('/^Plugin([\w]+)_Action([\w]+)$/i',$this->GetActionClass(),$aMatches)
|
||||
? strtolower($aMatches[1]).'/templates/skin/'.self::SKIN_NAME_KEY.'/actions/Action'.ucfirst($aMatches[2]).'/'.$this->sCurrentEvent.'.tpl'
|
||||
: null;
|
||||
}
|
||||
|
||||
if(preg_match('/^Plugin([\w]+)_Action([\w]+)$/i',$this->GetActionClass(),$aMatches)) {
|
||||
$this->sActionTemplate=$this->Viewer_ReplacePluginSkinName($this->sActionTemplate,$aMatches[1]);
|
||||
}
|
||||
return $this->sActionTemplate;
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
|
||||
require_once("Action.class.php");
|
||||
require_once("ActionPlugin.class.php");
|
||||
|
||||
/**
|
||||
* Класс роутинга(контроллера)
|
||||
|
|
|
@ -171,7 +171,7 @@ class LsViewer extends Module {
|
|||
* Создаём объект Smarty и устанавливаем необходиму параметры
|
||||
*/
|
||||
$this->oSmarty = new Smarty();
|
||||
$this->oSmarty->template_dir=Config::Get('path.smarty.template');
|
||||
$this->oSmarty->template_dir=array(Config::Get('path.smarty.template'),Config::Get('path.root.server').'/classes/plugins/');
|
||||
/**
|
||||
* Для каждого скина устанавливаем свою директорию компиляции шаблонов
|
||||
*/
|
||||
|
@ -350,8 +350,14 @@ class LsViewer extends Module {
|
|||
* @param string $sTemplate
|
||||
* @return string
|
||||
*/
|
||||
public function Fetch($sTemplate) {
|
||||
return $this->oSmarty->fetch($sTemplate);
|
||||
public function Fetch($sTemplate,$sPlugin=null) {
|
||||
/**
|
||||
* Если указан шаблон плагина, то производим замену ключа [skin_name]
|
||||
*/
|
||||
if($sPlugin) {
|
||||
$sTemplate=$this->ReplacePluginSkinName($sTemplate);
|
||||
}
|
||||
return $this->oSmarty->fetch($sTemplate);
|
||||
}
|
||||
/**
|
||||
* Проверяет существование шаблона
|
||||
|
@ -383,13 +389,13 @@ class LsViewer extends Module {
|
|||
/**
|
||||
* Если смогли определить тип блока то добавляем его
|
||||
*/
|
||||
$sType=$this->DefineTypeBlock($sName);
|
||||
$sType=$this->DefineTypeBlock($sName,isset($aParams['plugin'])?$aParams['plugin']:null);
|
||||
if ($sType=='undefined') {
|
||||
return false;
|
||||
}
|
||||
$this->aBlocks[$sGroup][$sName]=array(
|
||||
'type' => $sType,
|
||||
'name' => $sName,
|
||||
'name' => ($sType=='template' and isset($aParams['plugin']))?$this->ReplacePluginSkinName($sName,$aParams['plugin']):$sName,
|
||||
'params' => $aParams,
|
||||
'priority' => $iPriority,
|
||||
);
|
||||
|
@ -435,13 +441,13 @@ class LsViewer extends Module {
|
|||
* @param string $sName
|
||||
* @return string('block','template','undefined')
|
||||
*/
|
||||
protected function DefineTypeBlock($sName) {
|
||||
if ($this->TemplateExists('block.'.$sName.'.tpl')) {
|
||||
protected function DefineTypeBlock($sName,$sPlugin=null) {
|
||||
if ($this->TemplateExists(($sPlugin)?$this->ReplacePluginSkinName($sPlugin.'/templates/skin/'.ActionPlugin::SKIN_NAME_KEY.'/block'.$sName.'.tpl',$sPlugin):'block.'.$sName.'.tpl')) {
|
||||
/**
|
||||
* Если найден шаблон вида block.name.tpl то считаем что тип 'block'
|
||||
*/
|
||||
return 'block';
|
||||
} elseif ($this->TemplateExists($sName)) {
|
||||
} elseif ($this->TemplateExists(($sPlugin)?$this->ReplacePluginSkinName($sName,$sPlugin):$sName)) {
|
||||
/**
|
||||
* Если найден шаблон по имени блока то считаем его простым шаблоном
|
||||
*/
|
||||
|
@ -450,7 +456,7 @@ class LsViewer extends Module {
|
|||
/**
|
||||
* Считаем что тип не определен
|
||||
*/
|
||||
throw new Exception('Can not find the block`s template: '.$sName);
|
||||
throw new Exception('Can not find the block`s template: '.($sPlugin)?$this->ReplacePluginSkinName($sName,$sPlugin):$sName);
|
||||
return 'undefined';
|
||||
}
|
||||
}
|
||||
|
@ -1112,6 +1118,27 @@ class LsViewer extends Module {
|
|||
);
|
||||
return $aPaging;
|
||||
}
|
||||
|
||||
/**
|
||||
* Заменяет [skin_name] в пути к шаблону путем анализа
|
||||
* наличия текущего скина в директории шаблонов плагина
|
||||
*
|
||||
* @param string $sTemplate
|
||||
* @return string
|
||||
*/
|
||||
public function ReplacePluginSkinName($sTemplate,$sPlugin) {
|
||||
if(substr_count($sTemplate,ActionPlugin::SKIN_NAME_KEY)==0) return $sTemplate;
|
||||
|
||||
/**
|
||||
* Проверяем в списке шаблонов
|
||||
*/
|
||||
$sReplaceName=in_array(Config::Get('view.skin'),array_map('basename',glob(Config::Get('path.root.server').'/classes/plugins/'.$sPlugin.'/templates/skin/*',GLOB_ONLYDIR)))
|
||||
? Config::Get('view.skin')
|
||||
: 'default';
|
||||
|
||||
return str_replace(ActionPlugin::SKIN_NAME_KEY,$sReplaceName,$sTemplate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Загружаем переменные в шаблон при завершении модуля
|
||||
*
|
||||
|
|
|
@ -24,19 +24,31 @@
|
|||
* @return string
|
||||
*/
|
||||
function smarty_insert_block($aParams,&$oSmarty) {
|
||||
/**
|
||||
* Проверяем наличие шаблона
|
||||
*/
|
||||
if (!isset($aParams['block']) or !$oSmarty->template_exists('block.'.$aParams['block'].'.tpl')) {
|
||||
$oSmarty->trigger_error("Not found template for block: ".$aParams['block']);
|
||||
return ;
|
||||
}
|
||||
/**
|
||||
* Устанавливаем шаблон
|
||||
*/
|
||||
$sTemplate=$aParams['block'];
|
||||
$aPath=pathinfo($sTemplate);
|
||||
$sBlock=ucfirst($aPath['basename']);
|
||||
$sBlock=ucfirst(basename($aParams['block']));
|
||||
/**
|
||||
* Проверяем наличие шаблона. Определяем значения параметров работы в зависимости от того,
|
||||
* принадлежит ли блок одному из плагинов, или является пользовательским классом движка
|
||||
*/
|
||||
if(isset($aParams['params']) and isset($aParams['params']['plugin'])) {
|
||||
require_once(Config::Get('path.root.server').'/engine/classes/ActionPlugin.class.php');
|
||||
|
||||
$sBlockTemplate = $aParams['params']['plugin'].'/plugins/templates/skin/'.ActionPlugin::SKIN_NAME_KEY.'/block.'.$aParams['block'].'.tpl';
|
||||
$sBlockTemplate = Engine::getInstance()->Viewer_ReplacePluginSkinName($sBlockTemplate,$aParams['params']['plugin']);
|
||||
$sBlockClass = Config::Get('path.root.server').'/classes/plugins/'.$aParams['params']['plugin'].'/blocks/Block'.$sBlock.'.class.php';
|
||||
$sCmd='$oBlock=new Plugin'.ucfirst($aParams['params']['plugin']).'_Block'.$sBlock.'($aParamsBlock);';
|
||||
} else {
|
||||
$sBlockTemplate = 'block.'.$aParams['block'].'.tpl';
|
||||
$sBlockClass = Config::Get('path.root.server').'/classes/blocks/Block'.$sBlock.'.class.php';
|
||||
$sCmd='$oBlock=new Block'.$sBlock.'($aParamsBlock);';
|
||||
}
|
||||
|
||||
if (!isset($aParams['block']) or !$oSmarty->template_exists($sBlockTemplate)) {
|
||||
$oSmarty->trigger_error("Not found template for block: ".$sBlockTemplate);
|
||||
return ;
|
||||
}
|
||||
/**
|
||||
* параметры
|
||||
*/
|
||||
|
@ -47,16 +59,15 @@ function smarty_insert_block($aParams,&$oSmarty) {
|
|||
/**
|
||||
* Подключаем необходимый обработчик
|
||||
*/
|
||||
$result=require_once(Config::Get('path.root.server').'/classes/blocks/Block'.$sBlock.'.class.php');
|
||||
$sCmd='$oBlock=new Block'.$sBlock.'($aParamsBlock);';
|
||||
require_once($sBlockClass);
|
||||
eval($sCmd);
|
||||
/**
|
||||
* Запускаем обработчик
|
||||
*/
|
||||
$oBlock->Exec();
|
||||
$oBlock->Exec();
|
||||
/**
|
||||
* Возвращаем результат в виде обработанного шаблона блока
|
||||
*/
|
||||
return $oSmarty->fetch('block.'.$sTemplate.'.tpl');
|
||||
return $oSmarty->fetch($sBlockTemplate);
|
||||
}
|
||||
?>
|
|
@ -2,13 +2,13 @@
|
|||
<div id="sidebar">
|
||||
|
||||
{if isset($aBlocks.right)}
|
||||
{foreach from=$aBlocks.right item=aBlock}
|
||||
{foreach from=$aBlocks.right item=aBlock}
|
||||
{if $aBlock.type=='block'}
|
||||
{insert name="block" block=`$aBlock.name` params=`$aBlock.params`}
|
||||
{/if}
|
||||
{if $aBlock.type=='template'}
|
||||
{include file=`$aBlock.name` params=`$aBlock.params`}
|
||||
{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
{/if}
|
||||
|
||||
|
|
Loading…
Reference in a new issue