tierra / topicsolved

phpBB Topic Solved extension: Allows posting questions, and accepting answers as solved.
https://www.phpbb.com/customise/db/extension/topic_solved/
GNU General Public License v2.0
23 stars 19 forks source link

phpBB 3.2 compatible adjustment #56

Closed Mickroz closed 7 years ago

Mickroz commented 7 years ago

in phpBB 3.2 the icons aren't showing because of the fontawesome inplementation. change viewtopic_body_post_buttons_after.html to: `

  • class="button icon-button topicsolved-icon unsolve-icon">class="button icon-button-only"> {L_SET_TOPIC_NOT_SOLVED} class="button icon-button topicsolved-icon solve-icon">class="button icon-button-only"> {L_SET_TOPIC_SOLVED}
  • `
    Galixte commented 7 years ago

    Hi @tierra,

    could you take a look, please ?

    Hartenheer commented 7 years ago

    sorry for my bad English.

    I tested this solution in 3.2 This solution does not work. It also gives interference to other icons

    Mickroz commented 7 years ago

    The switch isn't phpbb standard like I thought, check dmzx/mchat on how to create the switch.

    Mickroz commented 7 years ago

    to get back on this:

    if you add this:

        public $is_phpbb31;
        /** @var bool */
        public $is_phpbb32;

    in __construct

            $this->is_phpbb32 = phpbb_version_compare(PHPBB_VERSION, '3.2.0@dev', '>=') && phpbb_version_compare(PHPBB_VERSION, '3.3.0@dev', '<');
    $this->template->assign_vars(array(
                'IS_PHPBB31' => $this->settings->is_phpbb31,
                'IS_PHPBB32' => $this->settings->is_phpbb32,
            ));

    then you can use this in your template files.

        <li>
        <!-- IF postrow.S_TOPIC_SOLVED -->
            <a href="{postrow.U_SET_SOLVED}" title="{L_SET_TOPIC_NOT_SOLVED}"
               <!-- IF IS_PHPBB31 -->class="button icon-button topicsolved-icon unsolve-icon"><!-- ELSEIF IS_PHPBB32 -->class="button icon-button-only"><i class="icon fa fa-times fa-fw"  style="color: #D9534F;" aria-hidden="true"></i><!-- ENDIF -->
                <span>{L_SET_TOPIC_NOT_SOLVED}</span>
            </a>
        <!-- ELSE -->
            <a href="{postrow.U_SET_SOLVED}" title="{L_SET_TOPIC_SOLVED}"
               <!-- IF IS_PHPBB31 -->class="button icon-button topicsolved-icon solve-icon"><!-- ELSEIF IS_PHPBB32 -->class="button icon-button-only"><i class="icon fa fa-check fa-fw" aria-hidden="true"></i><!-- ENDIF -->
                <span>{L_SET_TOPIC_SOLVED}</span>
            </a>
        <!-- ENDIF -->
        </li>
    <!-- ENDIF -->

    too bad github screws the codeblocks up. *edit fixed codeblocks.

    Hartenheer commented 7 years ago

    Where can I find

    
        public $is_phpbb31;
        /** @var bool */
        public $is_phpbb32;
    Mickroz commented 7 years ago

    you have to add those yourself @Hartenheer in controller/main_controller.php after protected $topicsolved; then add after $this->topicsolved = $topicsolved;

    $this->is_phpbb31 = phpbb_version_compare(PHPBB_VERSION, '3.1.0@dev', '>=') && phpbb_version_compare(PHPBB_VERSION, '3.2.0@dev', '<');
            $this->is_phpbb32 = phpbb_version_compare(PHPBB_VERSION, '3.2.0@dev', '>=') && phpbb_version_compare(PHPBB_VERSION, '3.3.0@dev', '<');
        }
    $this->template->assign_vars(array(
                'IS_PHPBB31' => $this->is_phpbb31,
                'IS_PHPBB32' => $this->is_phpbb32,
            ));

    then change styles/all/template/event/viewtopic_body_post_buttons_after.html to

    <!-- IF postrow.U_SET_SOLVED -->
        <li>
        <!-- IF postrow.S_TOPIC_SOLVED -->
            <a href="{postrow.U_SET_SOLVED}" title="{L_SET_TOPIC_NOT_SOLVED}"
               <!-- IF IS_PHPBB31 -->class="button icon-button topicsolved-icon unsolve-icon"><!-- ELSEIF IS_PHPBB32 -->class="button icon-button-only"><i class="icon fa fa-times fa-fw"  style="color: #D9534F;" aria-hidden="true"></i><!-- ENDIF -->
                <span>{L_SET_TOPIC_NOT_SOLVED}</span>
            </a>
        <!-- ELSE -->
            <a href="{postrow.U_SET_SOLVED}" title="{L_SET_TOPIC_SOLVED}"
               <!-- IF IS_PHPBB31 -->class="button icon-button topicsolved-icon solve-icon"><!-- ELSEIF IS_PHPBB32 -->class="button icon-button-only"><i class="icon fa fa-check fa-fw" aria-hidden="true"></i><!-- ENDIF -->
                <span>{L_SET_TOPIC_SOLVED}</span>
            </a>
        <!-- ENDIF -->
        </li>
    <!-- ENDIF -->
    Hartenheer commented 7 years ago

    Thanks

    Mickroz commented 7 years ago

    a bit hackish, but untill this extension will be 3.2 compatible, it will work.

    Hartenheer commented 7 years ago

    Sorry, I tried. Can not get working Get no icon, and does not work when clicked.

    Better download customize as works 3.2

    Mickroz commented 7 years ago

    Sorry, can't help you further, i'm not using this extension anymore, this is how i did it then.

    janusbenissa commented 7 years ago

    Indeed, your solution is not working and gives a blank page.

    This is working for me on a 3.2 board.

    change styles/all/template/event/viewtopic_body_post_buttons_after.html to

    `<!-- IF postrow.U_SET_SOLVED -->
        <li>
        <!-- IF postrow.S_TOPIC_SOLVED -->
            <a href="{postrow.U_SET_SOLVED}" title="{L_SET_TOPIC_NOT_SOLVED}"
               class="button icon-button-only"><i class="icon fa fa-times fa-fw"  style="color: #D9534F;" aria-hidden="true"></i>
                <span>{L_SET_TOPIC_NOT_SOLVED}</span>
            </a>
        <!-- ELSE -->
            <a href="{postrow.U_SET_SOLVED}" title="{L_SET_TOPIC_SOLVED}"
               class="button icon-button-only"><i class="fa fa-check fa-fw"  aria-hidden="true"></i>
                <span>{L_SET_TOPIC_SOLVED}</span>
            </a>
        <!-- ENDIF -->
        </li>
    <!-- ENDIF -->
    `

    Change the button.css in

    `/* Post Buttons */
    
    .topicsolved-icon.icon-button:before,
    .topicsolved-icon.dropdown-select:after {
        background-image: url("images/topicsolved_icons_button.png");
    }
    
    .solve-icon:before          { background-position: -0px 0; }
    .solve-icon:hover:before    { background-position: -0px -12px; }
    .unsolve-icon:before        { background-position: -12px 0; }
    .unsolve-icon:hover:before  { background-position: -12px -12px; }
    
    /* Topic Solved Image Indicators */
    
    .imageset.icon_solved_head {
        background-image: url("./images/icon_topic_solved_head.png");
        padding-left: 20px;
        background-repeat: no-repeat;
    }
    .imageset.icon_solved_list {
        background-image: url("./images/icon_topic_solved_list.png");
        padding-left: 12px;
        background-repeat: no-repeat;
    }
    .imageset.icon_solved_post {
        background-image: url("./images/icon_topic_solved_post.png");
        padding-left: 16px;
        background-repeat: no-repeat;
    }
    
    `

    And remove "alt" in this line /ext/tierra/topicsolved/topicsolved.php $markup = $this->user->img('iconsolved' . $type, $alt);

    Hopefully you can use it to update your extension to 3.2

    Thanks

    tierra commented 7 years ago

    Just FYI, I am looking into this, and I think there's a decent chance that this change will mean that I release a new version of the extension that requires phpBB 3.2+, just so I don't need to worry about maintaining 3.1.x compatibility in template files and CSS.

    scoony commented 7 years ago

    Tried all the previous fix but the button is still empty... any ETA on the official update?

    janusbenissa commented 7 years ago

    Tried all the previous fix but the button is still empty... any ETA on the official update?

    Did you purge the Cache?

    scoony commented 7 years ago

    I did, even used a new browser...

    Gonna try again your fix, if you can make a zip I could also try it

    scoony commented 7 years ago

    The last change is "$markup = $this->user->img('iconsolved' . $type);" right?

    janusbenissa commented 7 years ago

    www.zonstraal.be/tierra.zip

    scoony commented 7 years ago

    Damn your file is working perfectly, thanks so much.

    Dunno why it wasn't working before...

    janusbenissa commented 7 years ago

    De nada , glad it works for you.

    mvldebian commented 7 years ago

    Not work on 3.2 @janusbenissa thanks 4 files but it did not work for me. Waiting for new version...

    scoony commented 7 years ago

    Explain what's not working... i've used @janusbenissa file and it's working properly (i use text instead of icons for the topics)

    mvldebian commented 7 years ago

    In my case, the icon does not appear

    capturar

    scoony commented 7 years ago

    Have you used this zip file: http://www.zonstraal.be/tierra.zip

    mvldebian commented 7 years ago

    Yes. I used the files contained in the zip. But at least it did not work out for me.

    scoony commented 7 years ago

    What I did...

    scoony commented 7 years ago

    Once done...

    screenshot_20170126-130845

    mvldebian commented 7 years ago

    I insisted a little more and it worked. But all the old topics that were marked are gone. I also had a problem with the language, but this solves translating the new files ..

    janusbenissa commented 7 years ago

    But all the old topics that were marked are gone.

    Did you remove the data from the extension?

    mvldebian commented 7 years ago

    I did not do anything in the database I just removed the folder and put the new files in it again I realized that this time I did not change the version of the plugin in the panel But anyway installed, enabled again for the forums that use However, the old markings disappeared

    janusbenissa commented 7 years ago

    I just removed the folder and put the new files in it again

    You have to disable the extension first. Than remove the files upload the new files and enable the extension.

    mvldebian commented 7 years ago

    I did exactly that order

    janusbenissa commented 7 years ago

    Then it is not possible that the data is lost.

    tierra commented 7 years ago

    Just in case anyone thought I had forgotten about this, I've now pushed up a new docker-based development environment for testing changes with both phpBB 3.1 and 3.2 simultaneously.

    I wanted to make sure I had a reliable way to test changes between both versions to ensure we didn't break 3.1 compatibility with changes needed for 3.2 to work.

    tierra commented 7 years ago

    Hi @Mickroz, thanks for the version check suggestion, I'm pretty surprised there's not already a builtin template variable for it, and was struggling with the best way to check it in the templates. I've taken you're suggestion, and used it in my latest commit on the phpbb-3.2 branch.

    I believe I have a fully functional patch that works with both 3.1 and 3.2 now. I've even added a new event hook for customizing the topic solved icon when using 3.2, which style authors should find helpful for customizing the icon style in their own styles, rather than submitting changes to this plugin (if they would prefer to do so).

    I haven't merged this yet because I still haven't updated the unit tests to cover these changes and new functionality. But I would appreciate if anyone here would check out this new branch, and test it out.

    Mickroz commented 7 years ago

    Hi @tierra, haven't tested it yet, but from what I can see it looks pretty good coding wise! They should make such a variable to check on which version a user is, rather then let extension writers struggle with it.

    Collector001 commented 7 years ago

    Tried the files of janusbenissa but nothing is working. I do not even have directory like styles/all/template/event/ I am missing "event".

    What is going wrong!?

    tierra commented 7 years ago

    The changes listed here are no longer required as long as you use the latest development version of this extension, which you can download here: https://github.com/tierra/topicsolved/archive/master.zip

    This contains support for phpBB 3.2