Hooks Manager: Newshttp://projects.andriylesyuk.com/http://projects.andriylesyuk.com/plugin_assets/andriy_lesyuk/images/s-andy.ico2014-06-16T20:13:41ZProjects
Redmine Two new hooks in Hooks Manager 1.0.1http://projects.andriylesyuk.com/news/932014-06-16T20:13:41ZAndriy Lesyuks-andy@andriylesyuk.com
<p><div class="flash error">Error executing the <strong>download</strong> macro (Missing partial download/_button with {:locale=>[:en], :formats=>[:atom], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :rsb]}. Searched in:
* "/usr/share/redmine/plugins/wiking/app/views"
* "/usr/share/redmine/plugins/subscription/app/views"
* "/usr/share/redmine/plugins/sidebar/app/views"
* "/usr/share/redmine/plugins/scm_checkouts/app/views"
* "/usr/share/redmine/plugins/role_shift/app/views"
* "/usr/share/redmine/plugins/reklama/app/views"
* "/usr/share/redmine/plugins/redpress/app/views"
* "/usr/share/redmine/plugins/redmine_tweetbook/app/views"
* "/usr/share/redmine/plugins/redmine_scm/app/views"
* "/usr/share/redmine/plugins/redmine_omniauth_google/app/views"
* "/usr/share/redmine/plugins/redmine_exception_handler/app/views"
* "/usr/share/redmine/plugins/project_section/app/views"
* "/usr/share/redmine/plugins/project_alias/app/views"
* "/usr/share/redmine/plugins/meta/app/views"
* "/usr/share/redmine/plugins/mastering_redmine/app/views"
* "/usr/share/redmine/plugins/like/app/views"
* "/usr/share/redmine/plugins/issue_id/app/views"
* "/usr/share/redmine/plugins/hooks_manager/app/views"
* "/usr/share/redmine/plugins/extended_profile/app/views"
* "/usr/share/redmine/plugins/extended_fields/app/views"
* "/usr/share/redmine/plugins/download/app/views"
* "/usr/share/redmine/plugins/contact_form/app/views"
* "/usr/share/redmine/plugins/andriy_lesyuk/app/views"
* "/usr/share/redmine/app/views"
)</div></p>
<p>Since the release of Hooks Manager <a class="version" href="http://projects.andriylesyuk.com/versions/55">1.0.0</a> Redmine got two new hooks – <code>view_my_account_right_bottom</code> and <code>view_users_form_right_bottom</code> – both are related to the user profile. One of these hooks adds content below preferences in the user’s own profile (better known as “My account”), another one – below preferences on the user edit page (in Administration → Users). Both these hooks are now supported by Hooks Manager.</p>
<p><span style="float:right"><img src="http://projects.andriylesyuk.com/attachments/download/608/New-hooks.png" title="The location of one of the hooks" alt="The location of one of the hooks" /></span></p>
<p style="padding-left:3em;">These hooks were suggested for Redmine by <a class="user active" href="http://projects.andriylesyuk.com/users/941">Johnny Tide</a>. How do I know this?.. Cause <a class="user active" href="http://projects.andriylesyuk.com/users/941">Johnny</a> also suggestes to use them in my <a class="project" href="http://projects.andriylesyuk.com/project/redmine/contact-form">Contact Form</a> plugin. Moreover, he did updated the Contact Form plugin and shared the patch (see <a class="issue tracker-1 status-5 priority-5 priority-default closed" title="Enable contact form button on wrong tab (Closed)" href="http://projects.andriylesyuk.com/issues/2208">#2208</a>) with me. It’s astonishing, how such an active contributor to Redmine can also be a contributor to my plugin and suggest changes to Redmine, that get also reflected in my other plugin... By the way, as far as I know, he needed these hooks for some other plugin, he developed or contributed to (check also <a href="https://github.com/Tide" class="external">his Github page</a>).</p>
<p>But these hooks are not the only change in Hooks Manager <a class="version" href="http://projects.andriylesyuk.com/versions/62">1.0.1</a>. Thus, they were added in Redmine 2.4.x and the version <a class="version" href="http://projects.andriylesyuk.com/versions/62">1.0.1</a> of Hooks Manager will also run under Redmine 1.4.x... So, displaying these two hooks for this older version of Redmine would be, at least, incorrect (as users could get confused, why they did not work). So, exactly for such cases I planned to implement support for the <code>require</code> property of the <a class="wiki-page" href="http://projects.andriylesyuk.com/projects/hooks-manager/wiki/Adding-new-placeholder-hook">placeholder</a> (see <a class="issue tracker-2 status-5 priority-5 priority-default closed" title="Support Redmine/ChiliProject version (Closed)" href="http://projects.andriylesyuk.com/issues/2211">#2211</a>). And I did it in <a class="version" href="http://projects.andriylesyuk.com/versions/62">1.0.1</a>! This way under Redmine 1.4.x you just won’t see new <em>(not-yet-available)</em> hooks...</p>
<p>But the version <a class="version" href="http://projects.andriylesyuk.com/versions/62">1.0.1</a> also comes with bug fixes.</p>
<p>The <code>view_layouts_base_html_head</code> hook of Redmine, which is known as the only “HTML header” hook (“All pages”) in the Hooks Manager plugin, can be used for loading some additional CSS styles, JavaScript functions, and so on. At the same time Hooks Manager also used it for adding styles! But, while developing it I forgot that a plugin can add only one handler for the hook. So, custom HTML content, that was specified for this hook in Administration → Hooks, did not work...</p>
<p>This issues was noticed by <a class="user active" href="http://projects.andriylesyuk.com/users/407">Fabien Crespel</a>. He also investigated this issues, found the reason, fixed it and shared the patch (see <a class="issue tracker-1 status-9 priority-5 priority-default overdue" title="view_layouts_base_html_head hook not working (Reopened)" href="http://projects.andriylesyuk.com/issues/2295">#2295</a>)! So, in version <a class="version" href="http://projects.andriylesyuk.com/versions/62">1.0.1</a> I applied his patch <em>(with some modifications)</em>. In other words, this issue is now resolved! Thanks, <a class="user active" href="http://projects.andriylesyuk.com/users/407">Fabien</a>!</p>
<p>Another weird issue was found by <a class="user active" href="http://projects.andriylesyuk.com/users/carukc">Christopher Caruk</a> – due to wrong (my) code and Christopher’s specific environment the plugin loaded jQuery functions, but tried to use prototype (older) ones... Now it loads and uses same functions (which exactly – depends on the actual environment and application versions).</p> Meet the reborn Google Ads plugin named Hooks Managerhttp://projects.andriylesyuk.com/news/692013-08-25T23:09:46ZAndriy Lesyuks-andy@andriylesyuk.com
<p><div class="flash error">Error executing the <strong>download</strong> macro (Missing partial download/_button with {:locale=>[:en], :formats=>[:atom], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :rsb]}. Searched in:
* "/usr/share/redmine/plugins/wiking/app/views"
* "/usr/share/redmine/plugins/subscription/app/views"
* "/usr/share/redmine/plugins/sidebar/app/views"
* "/usr/share/redmine/plugins/scm_checkouts/app/views"
* "/usr/share/redmine/plugins/role_shift/app/views"
* "/usr/share/redmine/plugins/reklama/app/views"
* "/usr/share/redmine/plugins/redpress/app/views"
* "/usr/share/redmine/plugins/redmine_tweetbook/app/views"
* "/usr/share/redmine/plugins/redmine_scm/app/views"
* "/usr/share/redmine/plugins/redmine_omniauth_google/app/views"
* "/usr/share/redmine/plugins/redmine_exception_handler/app/views"
* "/usr/share/redmine/plugins/project_section/app/views"
* "/usr/share/redmine/plugins/project_alias/app/views"
* "/usr/share/redmine/plugins/meta/app/views"
* "/usr/share/redmine/plugins/mastering_redmine/app/views"
* "/usr/share/redmine/plugins/like/app/views"
* "/usr/share/redmine/plugins/issue_id/app/views"
* "/usr/share/redmine/plugins/hooks_manager/app/views"
* "/usr/share/redmine/plugins/extended_profile/app/views"
* "/usr/share/redmine/plugins/extended_fields/app/views"
* "/usr/share/redmine/plugins/download/app/views"
* "/usr/share/redmine/plugins/contact_form/app/views"
* "/usr/share/redmine/plugins/andriy_lesyuk/app/views"
* "/usr/share/redmine/app/views"
)</div></p>
<p>To be honest, actually this plugin never was just about Google ads... The name was completely wrong, very confusing and limiting – I understood this soon after the release of the version <a class="version" href="http://projects.andriylesyuk.com/versions/54">0.0.1</a> of the plugin. In fact the plugin allows much more than just adding ads – using it you can largely customize your Redmine. So I planned to rename this plugin a long time ago. And finally I did this!</p>
<p>Unfortunately the rename implies some minor troubles for users of the previous version of the plugin... Thus, in order to update the plugin you need to remove the folder with its previous version (but, please, <ins>don’t</ins> run the uninstallation migration) and install the new one as a completely new plugin! Largely this is required because the internal plugin name (which was <code>sense</code>) has also changed (to <code>hooks_manager</code>). Luckily the new version comes with the migration script intended for moving data from the previous version to the new one. Check also <a class="wiki-page" href="http://projects.andriylesyuk.com/projects/hooks-manager/wiki/Wiki#Installation-and-upgrade">this section</a> for more details...</p>
<p style="text-align:center;"><img src="/attachments/468/new-vs-old-ui.png" class="wiki-class-wiking wiki-class-shadow" alt="" /></p>
<p><script type="text/javascript">
//<![CDATA[
google_ad_slot = 6038760372;
//]]>
</script><script type="text/javascript">
//<![CDATA[
google_ad_width = 160;
//]]>
</script><script type="text/javascript">
//<![CDATA[
google_ad_height = 90;
//]]>
</script><div style="background-color: white; padding: 0.5em 0 0.5em 1em; float: right;">
<script type="text/javascript">
<!--
google_ad_client = "ca-pub-2013328300146844";
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></p>
<p>Another problem of the previous version was its UI, which displayed the list of hooks as a static drop down list. Adding all available hooks would make this list large and, therefore, less readable. So new version comes with an improved and friendly UI allowing to change the way hooks are displayed (first by pages, then by location, or vice verse) and to hide extra hooks (ones, which are unlikely to be used commonly).</p>
<p>Certainly due to UI improvements the version <a class="version" href="http://projects.andriylesyuk.com/versions/55">1.0.0</a> comes with all native hooks of Redmine <em>(ones, which can be used to add custom HTML)</em>. In total the plugin currently comes with support for 41 <span class="wiking smiley smiley-exclamation" title="(!)"></span> hooks (however by default most such hooks are not visible and should be made available by clicking on the “Show all hooks” checkbox).</p>
<p>In addition the plugin can now load hook definitions from other plugins. So, if an other plugin supports the Hooks Manager, its hooks will be available in the list as well.</p>
<p><em>If you are developer of a Redmine plugin, check <a class="wiki-page" href="http://projects.andriylesyuk.com/projects/hooks-manager/wiki/Adding-new-placeholder-hook">this page</a> on how to register your custom hooks in the Hooks Manager.</em></p>
<p>Version <a class="version" href="http://projects.andriylesyuk.com/versions/55">1.0.0</a> also comes with its own special hook <code>:view_wiki_inline_content</code> intended to be used in the Wiki content (e.g., Wiki page) with help of the <code>!{{inline_hook}}</code> Wiki macro. The design of this hook (and the macro) was greatly influenced by Google ads. Thus, the Wiki macro supports optional arguments in the format <code>name=value</code>. If specified, such arguments get transparently converted into JavaScript variables and, therefore, become available in the HTML/JS content. See <a class="wiki-page" href="http://projects.andriylesyuk.com/projects/hooks-manager/wiki/Wiki-content-inline-hook">the following page</a> for a sample and <ins>cautions</ins>.</p>
<div class="wiking flash warning">I have a feeling, that this way the macro can be exploited... So to disable the feature just do not define any HTML content for the hook! <em>Currently no issues related to the feature are known though...</em></div>
<div class="wiking flash notice"><strong>A note for ChiliProject users:</strong><br />This version is not yet fully ChiliProject ready while it works fine under it. Thus, the plugin does not check, if the hook can be used by ChiliProject, and the <code>!{{inline_hook}}</code> Wiki macro is not compatible with ChiliProject’s <a href="http://wiki.shopify.com/Liquid" class="external">Liquid</a>.</div>
<hr />
<p>The above mentioned change of the name introduces another trouble for those of you, who uses the SVN repository of the project, as the repository name has also changed! Anyway you will probably prefer to check it out to a new directory, as the plugin’s directory name also changed. If not, you will need to execute the following command to fix the repository URL:</p>
<pre>
$ svn switch --relocate http://svn.s-andy.com/redmine-google-ads http://svn.s-andy.com/hooks-manager
</pre> Google Ads for Redminehttp://projects.andriylesyuk.com/news/142011-07-14T10:46:04ZAndriy Lesyuks-andy@andriylesyuk.com
<p>Some time ago I was looking for a way to place <a href="https://www.google.com/adsense" class="external">Google Ads</a> on this site... I found that many users use sidebar plugins. Others just modify core RHTML files. I like none of these ways! Why? <a href="https://www.google.com/adsense" class="external">Google Ads</a> should be placed not only on sidebar to “work”. And changing core files means issues on upgrade...</p>
<p>For things like <a href="https://www.google.com/adsense" class="external">Google Ads</a> Redmine has... <a href="http://www.redmine.org/projects/redmine/wiki/Hooks_List" class="external">hooks</a>. What is this?.. These are “functions” which you can define in your plugins. These functions can return HTML code and this HTML code will be placed in the certain places on Redmine pages. That’s what any sidebar plugin uses! In addition to sidebar hooks allow adding custom HTML to many other places. Besides theoretically you can suggest your hooks by submitting patches to Redmine<sup><a href="#fn1">1</a></sup>.</p>
<p>That’s how I decided to write this plugin. This plugins provides a nice interface to Redmine hooks (well... some of them). With this interface any user can define his/her own HTML code to be placed on Redmine pages. The interface contains a nice thumbnails showing where the content is to be placed.</p>
<p id="fn1" class="footnote"><sup>1</sup> However seems none of my hooks were included into Redmine...</p>