Block Plugin only showing on Step 5 of journal setup

Hello all,

I’m working on a custom block plugin to toggle visibility of sidebars.
I copied most of the code from my own customnavbar plugin, which is also a block plugin.
After running php tools/upgrade upgrade, plugin is available for placing on sidebars, but I can’t get it to show on any other page except for journal Setup Step 5 .

Any ideas?

Hi @ramon,

See…
http://forum.pkp.sfu.ca/t/move-main-menu-to-sidebar

Regards,
Alec Smecher
Public Knowledge Project Team

Hello @asmecher,

I did run php tools/upgrade.php upgrade…
It ran ok, but the plugin doesn’t show up.

Hi @ramon,

Double-check your version.xml file to make sure everything is accurate. If not, correct it and re-register the plugin.

Regards,
Alec Smecher
Public Knowledge Project Team

Hello @asmecher,

Hmpff… really silly typo error on my part…
The name was wrong…
Thanks again…

Hello @asmecher!!

GREAT NEWS!!
I pulled it off faster than I thought.

Combining CSS and JQuery, I was able to create a block plugin that hides sidebars. It’s not as generic as I’d like it to be, but does the job.

I would like the image used for the icon to use a “template” varialbe, using the OJS url instead of a static url…

This is part of the plugins/hidesidebars/block.tpl:
>


>
>

How to I add the default OJS installation URL?

Hello all,

Again, jumping in happiness too quickly…
The code works on a static HTML saved from OJS.
When working OJS code itself, on the development server, there’s a javascript error I can’t seem to understand why…

This is the current JQuery code inserted in the block.tpl:

<script type="text/javascript" language="javascript">
//<![CDATA[
if(!window.jQuery || (typeof google == 'undefined'))  {
    alert("not loaded");
    var protocol = location.protocol;
    if (protocol !== "http:" && protocol !== "https:") {
        protocol = "http:";
    }
    var script = document.createElement("script");
    script.onload = foo;
    script.src = protocol + "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
    document.head.appendChild(script);
}else if($(document).ready()){
    $(document).ready(function(){
        var leftSidebarClass = (!$("#leftSidebar").className) ? 'on':'off';
        var rightSidebarClass = (!$("#rightSidebar").className) ? 'on':'off';
        var leftKids = $("#leftSidebar").children();
        var rightKids = $("#rightSidebar").children();
                $("#toggleSidebars").click(function(){
                        $("#hidesidebars").siblings().toggleClass('hidden');
                        $("#leftSidebar").toggleClass("off");
                        $("#leftSidebar").toggleClass("on");
                        $("#rightSidebar").children().toggleClass('hidden');
                        $("#rightSidebar").toggleClass("off");
                        $("#rightSidebar").toggleClass("on");
                        $("#hidesidebars").toggleClass("visible");
                        $("#main").toggleClass("on");
                });
        });
}
//]]>
</script>

Any one?
PS: I already tried without the typeof check, without parenthesis… nothing works…
PS 2: If I should open a new post for this, please let me know, as it no longer fits the subject…

Hi @ramon,

If you’re using { and } in Smarty templates, you’ll need to escape them by using {ldelim} and {rdelim} (or use the Smarty {literal} block). See the Smarty documentation for details.

Regards,
Alec Smecher
Public Knowledge Project Team

Hello @asmecher,

THANKS ALOT!!!
I used the {literal} to enclose the <script> tag…
Now it works on FF and Chrome… IE, script doesn’t work if I leave the standard HTML comment tags… Removing them makes the code work on IE 11.

Hello all,

Sorry to bump this post, but the problem has popped up again.
I only noticed recently that the hidesidebars plugin wasn’t present for a while. Since I don’t really use it, I just didn’t see it gone.
I tried installing it again, manually with the php tools/upgrade.php upgrade and uploading the tar.gz file (current status).
Plugin only shows on Plugins management page.
Anywhere eles it’s gone.
Also, I’d like for it to be installed on the center column (not placed anywhere).

I’ll try to create the enable/disable buttons for it as well…

Any ideas are welcome…

Hi @ramon,

I’d suggest checking the versions table to see whether there’s an entry for your plugin there. If there is, ensure that its entry’s product column matches the directory name in which the plugin has been installed.

Regards,
Alec Smecher
Public Knowledge Project Team