bug fix: added template path option in .info file

--HG--
branch : Gsoc14-ryzomAppImprovements
hg/feature/cdb-packed
shubham_meena 10 years ago
parent 4c0d3e53fc
commit 3b3a595903

@ -1,4 +1,4 @@
<?php <?php
/** /**
* API for loading and interacting with plugins * API for loading and interacting with plugins
@ -163,7 +163,6 @@ class Plugincache {
/** /**
* some more plugin function that requires during plugin operations * some more plugin function that requires during plugin operations
*
*/ */
/** /**
@ -173,13 +172,13 @@ class Plugincache {
* @return boolean * @return boolean
*/ */
public static function rrmdir( $dir ) { public static function rrmdir( $dir ) {
$result=array_diff(scandir($dir),array('.','..')); $result = array_diff( scandir( $dir ), array( '.', '..' ) );
foreach($result as $item) foreach( $result as $item )
{ {
if(!@unlink($dir.'/'.$item)) if ( !@unlink( $dir . '/' . $item ) )
Plugincache::rrmdir($dir.'/'.$item); Plugincache :: rrmdir( $dir . '/' . $item );
} }
return rmdir($dir); return rmdir( $dir );
} }
/** /**
@ -247,20 +246,24 @@ class Plugincache {
foreach( $ac_arr as $key => $value ) foreach( $ac_arr as $key => $value )
{ {
$plugin_path = Plugincache :: pluginInfoUsingId( $value['Id'], 'FileName' ); $plugin_path = Plugincache :: pluginInfoUsingId( $value['Id'], 'FileName' );
$pluginName = Plugincache :: pluginInfoUsingId( $value['Id'], 'Name' ); $template_path = json_decode( Plugincache :: pluginInfoUsingId( $value['Id'], 'Info' ) ) -> TemplatePath;
$plugin_name = explode( '/', $plugin_path )[4];
// calling hooks in the $pluginName.php // calling hooks in the $pluginName.php
include $plugin_path . '/' . strtolower( $pluginName ) . '.php'; include $plugin_path . '/' . $plugin_name . '.php';
$arr = get_defined_functions(); $arr = get_defined_functions();
foreach( $arr['user'] as $key => $value ) foreach( $arr['user'] as $key => $value )
{ {
if ( stristr( $value, strtolower( $pluginName ) ) == true ) if ( stristr( $value, $plugin_name ) == true )
{ {
$content['hook_info'][$pluginName] = call_user_func( $value ); $content['hook_info'][$plugin_name] = call_user_func( $value );
} }
} }
// path for the template
$content['hook_info'][$plugin_name]['TemplatePath'] = $template_path;
} }
return $content; return $content;
} }
} }

@ -10,7 +10,7 @@
<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=sgroup_list"><i class="icon-briefcase"></i><span class="hidden-tablet"> Support Groups</span></a></li> <li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=sgroup_list"><i class="icon-briefcase"></i><span class="hidden-tablet"> Support Groups</span></a></li>
<li class="nav-header hidden-tablet">Actions</li> <li class="nav-header hidden-tablet">Actions</li>
<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=plugins"><i class="icon-th-list"></i><span class="hidden-tablet"> Plugins</span></a></li> <li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=plugins"><i class="icon-th-list"></i><span class="hidden-tablet"> Plugins</span></a></li>
{if isset($hook_info)} {foreach from=$hook_info item=element}<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=layout_plugin&&name={$element.menu_display}"><i class="icon-th-list"></i><span class="hidden-tablet"> {$element.menu_display}</span></a></li>{/foreach}{/if} {if isset($hook_info)} {foreach from=$hook_info key=arrkey item=element}<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=layout_plugin&&name={$arrkey}"><i class="icon-th-list"></i><span class="hidden-tablet"> {$element.menu_display}</span></a></li>{/foreach}{/if}
<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=syncing"><i class="icon-th-list"></i><span class="hidden-tablet"> Syncing</span></a></li> <li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=syncing"><i class="icon-th-list"></i><span class="hidden-tablet"> Syncing</span></a></li>
<li style="margin-left: -2px;"><a href="?page=logout"><i class="icon-off"></i><span class="hidden-tablet"> Logout </span></a></li> <li style="margin-left: -2px;"><a href="?page=logout"><i class="icon-off"></i><span class="hidden-tablet"> Logout </span></a></li>
{/block} {/block}

@ -6,6 +6,7 @@
<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=settings"><i class="icon-cog"></i><span class="hidden-tablet"> Settings</span></a></li> <li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=settings"><i class="icon-cog"></i><span class="hidden-tablet"> Settings</span></a></li>
<li class="nav-header hidden-tablet">Admin</li> <li class="nav-header hidden-tablet">Admin</li>
<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=userlist"><i class="icon-th-list"></i><span class="hidden-tablet"> Users</span></a></li> <li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=userlist"><i class="icon-th-list"></i><span class="hidden-tablet"> Users</span></a></li>
{if isset($hook_info)} {foreach from=$hook_info key=arrkey item=element}<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=layout_plugin&&name={$arrkey}"><i class="icon-th-list"></i><span class="hidden-tablet"> {$element.menu_display}</span></a></li>{/foreach}{/if}
<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=show_queue&get=todo"><i class="icon-th-list"></i><span class="hidden-tablet"> Queues</span></a></li> <li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=show_queue&get=todo"><i class="icon-th-list"></i><span class="hidden-tablet"> Queues</span></a></li>
<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=sgroup_list"><i class="icon-briefcase"></i><span class="hidden-tablet"> Support Groups</span></a></li> <li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=sgroup_list"><i class="icon-briefcase"></i><span class="hidden-tablet"> Support Groups</span></a></li>
<li class="nav-header hidden-tablet">Actions</li> <li class="nav-header hidden-tablet">Actions</li>

@ -1,8 +1,8 @@
{block name=content} {block name=content}
<div class="row-fluid"> <div class="row-fluid">
{if isset($hook_info)} {if isset($hook_info)}
{foreach from=$hook_info item=element} {foreach from=$hook_info key=arrkey item=element}
{if $element.menu_display eq $smarty.get.name} {if $arrkey eq $smarty.get.name}
{include file=$element.template_path} {include file=$element.template_path}
{/if} {/if}
{/foreach} {/foreach}

@ -5,7 +5,7 @@
<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=settings"><i class="icon-cog"></i><span class="hidden-tablet"> Settings</span></a></li> <li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=settings"><i class="icon-cog"></i><span class="hidden-tablet"> Settings</span></a></li>
<li class="nav-header hidden-tablet">Actions</li> <li class="nav-header hidden-tablet">Actions</li>
<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=createticket"><i class="icon-pencil"></i><span class="hidden-tablet">Create New Ticket</span></a></li> <li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=createticket"><i class="icon-pencil"></i><span class="hidden-tablet">Create New Ticket</span></a></li>
{if isset($hook_info)} {foreach from=$hook_info item=element}<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=layout_plugin&&name={$element.menu_display}"><i class="icon-th-list"></i><span class="hidden-tablet"> {$element.menu_display}</span></a></li>{/foreach}{/if} {if isset($hook_info)} {foreach from=$hook_info key=arrkey item=element}<li style="margin-left: -2px;"><a class="ajax-link" href="index.php?page=layout_plugin&&name={$arrkey}"><i class="icon-th-list"></i><span class="hidden-tablet"> {$element.menu_display}</span></a></li>{/foreach}{/if}
<li style="margin-left: -2px;"><a href="?page=logout"><i class="icon-off"></i><span class="hidden-tablet"> Logout </span></a></li> <li style="margin-left: -2px;"><a href="?page=logout"><i class="icon-off"></i><span class="hidden-tablet"> Logout </span></a></li>
{/block} {/block}

Loading…
Cancel
Save