From c1f7aa6220836ab73a19b115c6d553e448b08ef4 Mon Sep 17 00:00:00 2001 From: shubham_meena Date: Sat, 26 Jul 2014 00:27:57 +0530 Subject: [PATCH] bug fix: added template path option in .info file --- .../ams_lib/autoload/plugincache.php | 39 ++++++++++--------- .../www/html/templates/layout_admin.tpl | 2 +- .../www/html/templates/layout_mod.tpl | 1 + .../www/html/templates/layout_plugin.tpl | 4 +- .../www/html/templates/layout_user.tpl | 2 +- 5 files changed, 26 insertions(+), 22 deletions(-) diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/plugincache.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/plugincache.php index ae8f1129c..c90665bc1 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/plugincache.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/plugincache.php @@ -1,8 +1,8 @@ - $value ) { $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 - include $plugin_path . '/' . strtolower( $pluginName ) . '.php'; + include $plugin_path . '/' . $plugin_name . '.php'; $arr = get_defined_functions(); 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; } - } + } diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout_admin.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout_admin.tpl index a0d1e49ef..db83dc8be 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout_admin.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout_admin.tpl @@ -10,7 +10,7 @@
  • Support Groups
  • Plugins
  • - {if isset($hook_info)} {foreach from=$hook_info item=element}
  • {$element.menu_display}
  • {/foreach}{/if} + {if isset($hook_info)} {foreach from=$hook_info key=arrkey item=element}
  • {$element.menu_display}
  • {/foreach}{/if}
  • Syncing
  • Logout
  • {/block} diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout_mod.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout_mod.tpl index e0a77d99a..cffdfdb5a 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout_mod.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout_mod.tpl @@ -6,6 +6,7 @@
  • Settings
  • Users
  • + {if isset($hook_info)} {foreach from=$hook_info key=arrkey item=element}
  • {$element.menu_display}
  • {/foreach}{/if}
  • Queues
  • Support Groups
  • diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout_plugin.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout_plugin.tpl index 5bc5938c4..9fb68400a 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout_plugin.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout_plugin.tpl @@ -1,8 +1,8 @@ {block name=content}
    {if isset($hook_info)} -{foreach from=$hook_info item=element} -{if $element.menu_display eq $smarty.get.name} +{foreach from=$hook_info key=arrkey item=element} +{if $arrkey eq $smarty.get.name} {include file=$element.template_path} {/if} {/foreach} diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout_user.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout_user.tpl index 4b452962a..57aad4c8b 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout_user.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout_user.tpl @@ -5,7 +5,7 @@
  • Settings
  • Create New Ticket
  • - {if isset($hook_info)} {foreach from=$hook_info item=element}
  • {$element.menu_display}
  • {/foreach}{/if} + {if isset($hook_info)} {foreach from=$hook_info key=arrkey item=element}
  • {$element.menu_display}
  • {/foreach}{/if}
  • Logout
  • {/block}