HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

caerostris - some changes - diff didn't display too well for me.

peregrineperegrine MVP
edited June 2014 in Feedback

if it formats properly (which it didn't :)

class.van2shout.plugin.php

add this


         $Position = (C('Plugin.Van2Shout.ContentAsset', "Content"));  
         define('VAN2SHOUT_ASSETTARGET', $Position);


remove this

         if(C('Plugin.Van2Shout.ContentAsset', true))
         {
            define('VAN2SHOUT_ASSETTARGET', 'Content');
         }
         else
         {
            define('VAN2SHOUT_ASSETTARGET', 'Panel');
         }



 // add this to the Plugininfo array

          'SettingsUrl' =>'/dashboard/settings/van2shout',

replaced functions and additional

        public function Base_Render_Before($Sender) {

               if (C('Plugins.Van2Shout.Page', TRUE))   {   
               $Sender->Menu->AddLink(T('Shoutpage'), T('Shoutpage'), 'van2shoutpage');
               } 
               $Controller = $Sender->ControllerName;
               $ShowOnController = array(
                'profilecontroller',
                'discussionscontroller'
               );
               if (!InArrayI($Controller, $ShowOnController))
                 return;

               if(VAN2SHOUT_ASSETTARGET == 'Panel')
        {
            $this->includev2s($Sender);
        }


    }

public function VanillaController_Van2ShoutPage_Create($Sender) {
        $Sender->ClearCssFiles();
        $Sender->AddCssFile('style.css');
        // render a normal vanilla page
        $Sender->MasterView = 'default';

        // get the view to show
        $this->includev2s($Sender);

        $Sender->Render($this->GetView('van2shoutpage.php'));
    }




    public function DiscussionsController_Render_Before($Sender) {
        if(VAN2SHOUT_ASSETTARGET != 'Content')
            return;

        $this->includev2s($Sender);
    }



    public function Setup() {
               // add routing
                 $matchroute = '^van2shoutpage(/.*)?$';
                 $target = 'vanilla/Van2ShoutPage$1';
                 if(!Gdn::Router()->MatchRoute($matchroute))
                      Gdn::Router()->SetRoute($matchroute,$target,'Internal'); 


                    $Construct = GDN::Structure();
            $Construct->Table('Shoutbox');

            if(!$Construct->TableExists())
            {
                $Construct->PrimaryKey('ID')
                    ->Column('UserName', 'varchar(50)')
                    ->Column('PM', 'varchar(50)')
                    ->Column('Content', 'varchar(150)')
                    ->Column('Timestamp', 'int(11)')
                    ->Set(FALSE, FALSE);
            }
        }

settings.php

from

    <tr><td>Display on the discussions page</td><td><?php echo $this->Form->CheckBox('Plugin.Van2Shout.ContentAsset', ''); ?></t
        d></tr>

to

          <tr>
             <td class="Alt">
                 <?php echo Gdn::Translate('Display position'); ?>
             </td> 
             <td>
                 <?php
                 $Options = array('Panel' => 'Side', 'Content' => 'Center');
                 $Fields = array('TextField' => 'Code', 'ValueField' => 'Code');
                 echo $this->Form->DropDown('Plugin.Van2Shout.ContentAsset', $Options, $Fields);
                 ?>
             </td>
            </tr> 

after the changes disable plugin, enable plugin and goto settings and re-save.

I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Comments

  • peregrineperegrine MVP
    edited June 2014

    another change I use Plugins for config statements rather than Plugin

    so I added this as well for the Separate Shout Page option in the settings.

    $Schema['Plugins.Van2Shout.Page'] = array('LabelCode' => 'ShoutPage', 'Control' => 'Checkbox', 'Default' => C('Plugin.Van2Shout.Page', true));

    and to settings

    <tr>
     <td>
    
        <?php echo Gdn::Translate("Display A Separate Shout Page"); ?>
    
        </td>
        <td><?php echo $this->Form->CheckBox('Plugins.Van2Shout.Page', ''); ?>
        </td>
       </tr>
    

    if you decide to go with Plugin.Van2Shout.Page instead of 'Plugins.Van2Shout.Page

    obviously you need to change it everywhere in default.php and settings.php

    all of the above changes.

    • should give you a settings button on the enable plugin part of dashboard.
    • a separate shout page option available form settings page.
    • prevention of shoutbox from appearing in dashboard and just in 'profilecontroller',
      'discussionscontroller' and the shoutbox page controllers. You could add others if you see fit.

    I would zip it all and post, but i don't like to post whole files unless it is vanilla-made or the author is gone for over a year or two without logging, or I get permission from author (you). To me this is the proper way. So, careostris let me know if you want me to post zip.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • @peregrine is this about v1.053 (master)? It's not working for me.

  • peregrineperegrine MVP
    edited June 2014

    @r0obert said:
    peregrine is this about v1.053 (master)? It's not working for me.

    maybe when caeorostis has time, he will test and add it to plugin if he sees fit.

    Yes, and

    its working for me :) since i tested before posting.

    As always, I will gladly cut and paste and make edit for you 0@r0obert. Just send me a round-trip plane ticket with 1 day lodging at a luxury hotel at your server donation with a password and login name.

    • or if you give me your word that you have already sent caerostris a donation,
      • as well as mention your vanilla version number, I will pm you with more help.

    as noted here: http://vanillaforums.org/discussion/comment/210930/#Comment_210930

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrineperegrine MVP
    edited July 2014

    @careostris - since you said ok to post zip - here is a zip of the changed files.

    after the changes are made the plugin must be enabled via the dashboard for routing to take place. and also some of the settings changed, so the dashboard settings for plugins would need to be selected and save for plugin as well.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrineperegrine MVP
    edited July 2014

    @karenr‌

    If you pursue van2shout, as you mentioned in another thread.

    if you disable the van2shout plugin via dashboard.

    • 1 disable the van2shout plugin via dashboard.
    • 2 copy the extracted files from the van2shoutchanges.zip (see above) to the respective places in the van2shout plugin.
    • 3 enable the plugin
    • 4 adjust your settings and permissions via dashboard.

    you theoretically should have the option to show the shoutbox in its own distinct page without it displaying on any other pages. (after you give the proper role permissions).

    if it works for you, your feedback might be helpful.

    if it doesn't work as expected, let me know.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • karenrkarenr Vanilla 2.1 stable New

    Thanks! I need to do some stuff away from the screen for a while but I will most definitely pursue this soon and report back. I am so pleased with 2.1 that I am going to create one for my personal use and dump coppermine for personal shares with my family. Single sign on rules. :smiley: As do you.

  • I just started working on a major code clean up.
    The first bit of your changes has been implemented :)
    Once I finished de-craping my old code I'll add stuff like the separate page.

Sign In or Register to comment.