River Controls v0.2.2

Release Notes

Included The relevant JQuery API that you can link to if nothing happens when you hover over the black "x".

If you're using a theme then you should have the following file in that plugin folder: views/default/page_elements/header.php

Open that and look for the line (about 60) that defines the JQuery location. If it is below 1.4 change to the following:

<script type="text/javascript" src="<?php echo $vars['url']; ?>mod/river_controls/lib/jquery.1.4.4.min.js"></script>

For those that are having no problems with this plugin this update is not necessarily required. Nothing else was added.

  • still cant get it to work i have done evrythn possible but in vain cant see any menu after hoverin on the x button...

  • If the plugin "likes" is below "river controls" than "river controls" doesn't work (and viceversa). I really like both of these plugins. Is there anyway I can run both?

  • There may be a way to attend to such conflicts between PlugIns. http://yaexgen.ensci.us/ChkElggVers.php is aimed towards verifying which Elgg Versions a PlugIn will support, potential conflicts between PlugIns which may be over-riding the same views, actions, etc. The code built on standard complier-writing, lexical anaylysis snd parsing tecnology is now somewhat in beta, but will improve and mature as time goes by. And hopefully we'll have a means to ensure some Q&A for PlugIns.

  • Note to self, see how Private River plays with River Controls. 

  • @stuartsloan: This can be solved in the same way that eComments override was solved. I'll take a look at it a bit later.

    @Steve: This won't affect your Private River plugin (unless you override the core wrapper.php file for river items views/default/river/item/wrapper.php)

  • @Trajan I just tested it with Private_River and it works. I placed River Controls below Private_River. I do use wrapper.php to control the tabs and objects. Give it a go and let me know how it performs for you.

  • @Trajan How is masked the stacking problem is override mod/riverdashboard/index.php increasing the default of 20 to 50. Now the missing items don't seem as noticable. 

    changing this line

    $river = elgg_view_river_items($subject_guid, 0, $relationship_type, $type, $subtype, '');

     

    to:

    $river = elgg_view_river_items($subject_guid, 0, $relationship_type, $type, $subtype, '', $limit = 50);

  • Rats I was wrong. River Controls overides Private_river. back to the drawing board

  • You may notice that in the latest version of River_Controls the wrapper.php file has an if statement for the eComments plugin. If you can manage to do the same thing for your plugin then send me the new file and I will upload a new version.

  • As soon as I find a free minute or two I am going to add my wrapper.php you your wrapper code and kick it around. I will send you the code if it works. :)

  • @Tumuti: I'm sorry I can't think of any possible reason why it's not showing up for you. On the off chance... what browser are you using, and have you tried other ones. I develop using Google Chrome which tends to let a lot of things work where other browsers would stop them from happening.

  • que opinas de agregarle un poco mas de AJAX

  • WRAPPER.PHP

     

    <?php

    $avatar_icon = get_plugin_setting("avatar_icon","riverdashboard");

    if(!$avatar_icon) {

    $avatar_icon = "icon";

    }

     

    $hide = "<img style='vertical-align:text-bottom;float:right;' src='{$vars['url']}mod/river_controls/graphics/closelabel.png'>";

     

    $user_id = get_loggedin_userid();

    $user = get_entity($user_id);

    if($avatar_icon == "icon"){

    ?>

    <div class="river_item">

    <div class="river_<?php echo $vars['item']->type; ?>">

    <div class="river_<?php echo $vars['item']->subtype; ?>">

    <div class="river_<?php echo $vars['item']->action_type; ?>">

    <div class="river_<?php echo $vars['item']->type; ?>_<?php if($vars['item']->subtype) echo $vars['item']->subtype . "_"; ?><?php echo $vars['item']->action_type; ?>">

    <p>

    <?php

    echo $vars['body'];

    ?>

    <span class="river_item_time">

    (<?php

    echo elgg_view_friendly_time($vars['item']->posted);

    ?>)

    </span>

    </p>

    </div>

    </div>

    </div>

    </div>

    </div>

     

    <?php

    } else {

    $ts = time();

    $token = generate_action_token($ts);

    $the_type = $vars['item']->subtype;

    ?>

     

    <div class="river_item" id="river_item_<?php echo $vars['item']->id;?>" >

    <?php

    if(($user->guid == $vars['item']->subject_guid)|| (isadminloggedin())){

    ?>

    <div class="river_item_controls" id="river_item_controls_<?php echo $vars['item']->id;?>"><?php echo $hide; ?>

    <div class="controls_box" id="controls_box_<?php echo $vars['item']->id;?>">

    <?php

    if($user_id == $vars['item']->subject_guid){

    if($vars['item']->access_id == 0){

    echo "|<a style='cursor:pointer;' title='compartir' onclick=\"compartir(".$vars['item']->object_guid.")\">Compartir</a> |";

    }elseif(($vars['item']->access_id == -2) || ($vars['item']->access_id == 2) || ($vars['item']->access_id == 1)){

    echo "|<a style='cursor:pointer;' title='ocultar' onclick=\"hide(".$vars['item']->object_guid.")\">0cultar</a> |";

    }else{}

    echo "<a style='cursor:pointer;' title='Eliminar' onclick=\"AjaxDe(".$vars['item']->id.")\">Eliminar</a> |";

    }elseif(($user_id !== $vars['item']->subject_guid) && (isadminloggedin())){

    echo "| <a style='cursor:pointer;' title='Eliminar' onclick=\"AjaxDe(".$vars['item']->id.")\">Eliminar</a> |";

    }

    ?>

    </div>

    </div>

    <?php 

    }

    ?> 

    <span class="river_item_useravatar">

    <?php

    echo elgg_view("profile/icon",array('entity' => get_entity($vars['item']->subject_guid), 'size' => 'small'));

    ?>

    </span>

      <div class="river_item_body_wrapper">

            <p class="river_item_body">

                <?php

                echo $vars['body'];

                ?>

            </p>

     

            <div id="<?php echo $vars['item']->object_guid ?>" class="ecomments_item_extras_bar">

                <div class="ecomments_item_time left">

                    <?php

                    echo friendly_time($vars['item']->posted);

                    ?>

                </div>

                <?php echo elgg_view('eComments/river/bar', $vars); ?>

            </div>

     

        </div>

        <div class="clearfloat"></div>

    </div>

     

    <?php

     

    }//Display type end

    ?>

     

    <script>

    $('#river_item_<?php echo $vars['item']->id;?>').mouseenter(function() {

    if ($('#river_item_controls_<?php echo $vars['item']->id;?>').css('display','none')) {

    $("#river_item_controls_<?php echo $vars['item']->id;?>").css('display','block');

    }else{

    $("#river_item_controls_<?php echo $vars['item']->id;?>").css('display','none');

    }

    });

    $('#river_item_<?php echo $vars['item']->id;?>').mouseleave(function() {

    $("#river_item_controls_<?php echo $vars['item']->id;?>").css('display','none');

    });

    $('#river_item_controls_<?php echo $vars['item']->id;?>').mouseenter(function() {

    if ($('#controls_box_<?php echo $vars['item']->id;?>').css('display','none')) {

    $("#controls_box_<?php echo $vars['item']->id;?>").css('display','block');

    }else{

    $("#controls_box_<?php echo $vars['item']->id;?>").css('display','none');

    }

    });

    $('#river_item_controls_<?php echo $vars['item']->id;?>').mouseleave(function() {

    $("#controls_box_<?php echo $vars['item']->id;?>").css('display','none');

    });

    </script>

  • AJAX 

    <script>

    function AjaxDe(id)

    {

    var answer = confirm("Delete the item?");

    if(answer)

    {

    var token = "<?php echo $token; ?>";

    var ts = "<?php echo $ts; ?>";

    datastr = "&item_id=" + id;

    datastr += "&__elgg_token=" + token;

    datastr += "&__elgg_ts=" + ts;

    $.ajax({

    type: "POST",

    url: "<?php echo $vars['url']; ?>action/river_control/delete_item",

    data: datastr,

    success: function(msg){

    $('#river_container').load('?callback=false');

     

    }

    });

    }

    }

    function hide(id)

    {

    var answer = confirm("Hide the item ?");

    if(answer)

    {

    var token = "<?php echo $token; ?>";

    var ts = "<?php echo $ts; ?>";

    datastr = "&object_guid=" + id;

    datastr += "&direction=cloak";

    datastr += "&__elgg_token=" + token;

    datastr += "&__elgg_ts=" + ts;

    $.ajax({

    type: "POST",

    url: "<?php echo $vars['url']; ?>action/river_controls/hide_from_others",

    data: datastr,

    success: function(msg){

    $('#river_container').load('?callback=false');

    alert("Bien se a ocultado tu elemento.");

    }

    });

    }

    }

    function compartir(id)

    {

    var answer = confirm("Share item ?");

    if(answer)

    {

    var token = "<?php echo $token; ?>";

    var ts = "<?php echo $ts; ?>";

    datastr = "&object_guid=" + id;

    datastr += "&direction=share";

    datastr += "&__elgg_token=" + token;

    datastr += "&__elgg_ts=" + ts;

    $.ajax({

    type: "POST",

    url: "<?php echo $vars['url']; ?>action/river_controls/hide_from_others",

    data: datastr,

    success: function(msg){

    $('#river_container').load('?callback=false');

    alert("share tis item.");

    }

    });

    }

    }

    </script>

  • @mariano: very nice work, I was just getting around to thinking about this. I will add it in to the next release, much obliged!

    EDIT: You've got a typo in your first Ajax function. Should be:

    url: "<?php echo $vars['url']; ?>action/river_controls/delete_item",

  • @mariano: Also, for some reason (don't know why), the delete function doesn't get called properly. The river item is not deleted using the new Ajax call. 

    Hide and Share work fine. I've also redesigned the options box a little bit to show current access rights. If you can solve the delete not working (at least not for me), then I will upload a new version. 

  • $('#river_container').load('?callback=false'); 

    fijate el id de el div correspondiente 

  • It works wonderfully for me. Elgg 1.7.10. I copied your <script type="text/javascript" src="<?php echo $vars['url']; ?>mod/river_controls/lib/jquery.1.4.4.min.js"></script> into the views/default/page_elements/header.php file. The both delete and cloak works.

    Can't wait to write a post in my site to tell the users what wonderful control they have with their river items now. Without this feature, the River Dashboard is just flawed to the extent of being not usable.

    Thank you, Trajan!

  • @Jeff Hao: thanks for your reply that it works. There is a newer version coming which will have a few more controls as well as showing what the current access status of each river item is as well as making use of mariano's ajaxed actions. All in all a much cleaner tool. I'll try to get it up sometime soon.

  • @Trajan: I look forward to upgrading. It would be neat to have a Settings panel to control what kind of activities to exclude, as site rules. E.g. editing of a blog, is usually minor, and perhaps should not occupy the river space. Things like that. Different sites may have different reasons to include or exclude different things.

  • It worked perfectly on my elgg 1.7.8 installation, However I am facing a little problem, River controls plugin overrides the river dashboard funtionsality, It was saves for showing icons only not the members icons in my site, But after enabling your plugin, Only memebrs icons are shown, and normal icons are not showing. However, it actually made my dashboard to look more beautiful, but I just reporting this problem. 

    Thanks Trajan for the pluin, Really recommended, 

    I am also waiting for the new release with more control and compatibitly with likes plugin. 

  • Yes, looking forward to bringing the "Likes" back into the river !

  • Glad to know that it works for 1.7.8 Yes, I took out the switch option for icons vs. user avatars. Just used avatars because it's what I'm using. I'll try and put that back in for the next release coming soon (Tuesday).

Trajan

Building the dream and living the life

Stats

  • Category: Tools
  • License: GNU Lesser General Public License (LGPL) version 2.1
  • Updated: 2014-11-17
  • Downloads: 9394
  • Recommendations: 8

Other Projects

View Trajan's plugins