Smart Files v1.0.0

Release Notes

Version 1.0.0, released 27th October, 2010* Inital release

  • @Canterburry: As I said in  the manual, this plugin will conflict with any other plugin that overrides the object/file view. Westors download counter is guilty as charged, just as Smart Files, they both do that. Luckily, I've made a special effort to make the merging of two conflicting object/file views easier, and I marked all my changes to the original view with comments. Open the smartfiles/views/default/object/file.php file and look for the

    /* BEGIN - Original file changed to support smartfiles extension */

    and

    /* END - Original file changed to support smartfiles extension */

    comments, these mark the boundaries of my modifications. If you feel like taking a stab at this, you'd want to copy these segments of code in between the comments to the other plugin's object/file.php code, providing you can find the right place for that. It needs a bit of php experience but can be figured out, I think. After you did the copying, rename the smartfiles/views/default/object/file.php file to something else and unique, like __not_used_file_view.php

    Also hit http://your-site-url/upgrade.php if you use views cache.

    If you've done everything correctly, you should have both plugins working now. Sorry if it was a bit technical, but there is really no other way around for this issue at the moment.

  • great plugin, great manual , reflect a lot of postive aspect of you, thanx.

  • one thing I notice.. like a lot of plugins here on elgg.. the flash content does not contain a reference to set the wmode to opaque or transparent.. without this variable being set any page elements that are meant to be 'above' (in z-range) the flash object will be rendered underneath.

    i'd appreciate it a lot if you would include the wmode variable into the next iteration of this plugin. :)

    thanks

  • @tunist: The only part of the flash content I have control over is how I embed it into the page. I do that via a Javascript library called swfobject. I think the wmode you're referring to is something that has to be set in the flash file itself, but the whole flash content is created and delivered by embedit.in. So I'm afraid I can't do too much about that, except to contact embedit.in and relay your request. Flash is a very grey area for me, let me know if I have some other options setting the wmode (like embed time).

  • i cant access the admistration link, i install elgg in subdirectory, when i press the link it gave me 404 error page ? how to fix that ?

  • alysami: Ooops, absolutely valid question, missed that one.

    Edit your smartfiles/start.php file. In line 44 replace:

    add_submenu_item(elgg_echo('smartfiles:admin:title'), "/mod/smartfiles/admin/menu.php");

    with

    add_submenu_item(elgg_echo('smartfiles:admin:title'), $CONFIG->wwwroot . "mod/smartfiles/admin/menu.php");

    Also, where the smartfiles_adminmenu() function starts, insert (just before line 43):

    global $CONFIG;

    Hope this will fix the issue. Will upload a patched version soon. Thanks for reporting this!

  • well . i did Andras, thank you, but again the rigesterd actions is not working for add or delete ( MIME type ) !! is that related to the same issue ??

  • @alysami: I just installed Elgg 1.7.4 in a subdirectory of a site to test this kind of setup. The only modification I needed to do was the one line change in start.php I described above. Both add and delete actions for MIME types worked for me fine. Can you tell me some more details about this error? Do you see any error message on screen, or anything in the php error log file?

  • ok Andras .. i found it , on the mime_types.php file on ( mod/smartfiles/views/default/smartfiles/admin ) on line 12: an extra backslash on the url exist on the add Action and not on delete action

    i just remove the backslash like this

    (         <form id="add_mime_type" name="create_category_type" action="<?php echo $CONFIG->wwwroot; ?>action/smartfiles/admin/mime_types/add" method="post"> )

     

    everything works fine for me now

     

  • @alysami: You're absolutely right, there is an extra slash in the form target URL. Thanks for reporting both the problem and the solution! Will include your changes in the next version.

  • @Andras:

    Thanks for the instructions. I finally got a free moment to give it a try: Works perfectly.

     

     

  •  

    Here is the code for the file.php in Westors Download counter if you want it to function with Smart Files.

    Instructions:

    1. Open the file.php in /mod/westorDownloadCounter/views/default/object
    2. Replace all the code with the code below
    3. Rename file.php in /mod/smartfiles/views/default/object to _not_used_file_view.php
    4. Hit http://your-site-url/upgrade.php if you use views cache.

     

    <?php
        /**
         * Elgg file browser.
         * File renderer.
         *
         * @package ElggFile
         * @author Curverider Ltd
         * @copyright Curverider Ltd 2008-2009
         * @link http://elgg.com/
         */

        global $CONFIG;

        $file = $vars['entity'];

        $file_guid = $file->getGUID();
        $tags = $file->tags;
        $title = $file->title;
        $desc = $file->description;
        $owner = $vars['entity']->getOwnerEntity();
        $friendlytime = friendly_time($vars['entity']->time_created);

        $mime = $file->mimetype;

        /* BEGIN - Original file changed to support smartfiles extension */
        $plugin = find_plugin_settings('smartfiles');
        $mime_types = unserialize($plugin->mime_types);
        /* END - Original file changed to support smartfiles extension */



        if (get_context() == "search") {     // Start search listing version

            if (get_input('search_viewtype') == "gallery") {
                echo "<div class=\"filerepo_gallery_item\">";
                if ($vars['entity']->smallthumb) {
                    echo "<p class=\"filerepo_title\">" . $file->title . "</p>";
                    echo "<p><a href=\"{$file->getURL()}\"><img src=\"{$vars['url']}mod/file/thumbnail.php?size=small&file_guid={$vars['entity']->getGUID()}\" border=\"0\" /></a></p>";
                    echo "<p class=\"filerepo_timestamp\"><small><a href=\"{$vars['url']}pg/file/{$owner->username}\">{$owner->username}</a> {$friendlytime}</small></p>";

                    //get the number of comments
                    $numcomments = elgg_count_comments($vars['entity']);
                    if ($numcomments)
                        echo "<p class=\"filerepo_comments\"><a href=\"{$file->getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a></p>";


                    //if the user can edit, display edit and delete links
                    if ($file->canEdit()) {
                        echo "<div class=\"filerepo_controls\"><p>";
                        echo "<a href=\"{$vars['url']}mod/file/edit.php?file_guid={$file->getGUID()}\">" . elgg_echo('edit') . "</a>&nbsp;";
                        echo elgg_view('output/confirmlink',array(

                                'href' => $vars['url'] . "action/file/delete?file=" . $file->getGUID(),
                                'text' => elgg_echo("delete"),
                                'confirm' => elgg_echo("file:delete:confirm"),

                            ));
                        echo "</p></div>";
                    }


                } else {
                    echo "<p class=\"filerepo_title\">{$title}</p>";

                    /* BEGIN - Original file changed to support smartfiles extension */
                    $use_embedit = (($plugin->gallery_thumbs == 'yes') && (array_key_exists($mime, $mime_types)));
                    $use_embedit = ($use_embedit && (($file->access_id == ACCESS_PUBLIC) || ($plugin->ignore_access == 'yes')));
                    if ($use_embedit && isset($plugin->force_thumbs) && $plugin->force_thumbs == 'yes') {
                        get_embedit_id($file, true);
                    }
                    if ($use_embedit &&    isset($file->embedit_id)) {
                        echo "<p><a href=\"{$file->getURL()}\"><img src=\"http://embedit.in/{$file->embedit_id}.png\" border=\"0\" /></a></p>";
                    } else {
                        echo "<a href=\"{$file->getURL()}\">" . elgg_view("file/icon", array("mimetype" => $mime, 'thumbnail' => $file->thumbnail, 'file_guid' => $file_guid, 'size' => 'large')) . "</a>";
                    }
                    /* END - Original file changed to support smartfiles extension */

                    echo "<a href=\"{$file->getURL()}\">" . elgg_view("file/icon", array("mimetype" => $mime, 'thumbnail' => $file->thumbnail, 'file_guid' => $file_guid, 'size' => 'large')) . "</a>";
                    echo "<p class=\"filerepo_timestamp\"><small><a href=\"{$vars['url']}pg/file/{$owner->username}\">{$owner->name}</a> {$friendlytime}</small></p>";
                    //get the number of comments
                    $numcomments = elgg_count_comments($file);
                    if ($numcomments)
                        echo "<p class=\"filerepo_comments\"><a href=\"{$file->getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a></p>";


                }
                echo "</div>";
                // echo elgg_view("search/gallery",array('info' => $info, 'icon' => $icon));

            } else {

                $info = "<p> <a href=\"{$file->getURL()}\">{$title}</a></p>";
                $info .= "<p class=\"owner_timestamp\"><a href=\"{$vars['url']}pg/file/{$owner->username}\">{$owner->name}</a> {$friendlytime}";
                $info .= ' <small>(' . ($file->downloadCounter ? $file->downloadCounter : 0 ) . ' ' . (($file->downloadCounter == 1) ? ' Download' : ' Downloads') . ')</small>';
                $numcomments = elgg_count_comments($file);
                if ($numcomments)
                    $info .= ", <a href=\"{$file->getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a>";
                $info .= "</p>";

                // $icon = elgg_view("profile/icon",array('entity' => $owner, 'size' => 'small'));
                $icon = "<a href=\"{$file->getURL()}\">" . elgg_view("file/icon", array("mimetype" => $mime, 'thumbnail' => $file->thumbnail, 'file_guid' => $file_guid, 'size' => 'small')) . "</a>";

                echo elgg_view_listing($icon, $info);

            }

        } else {                            // Start main version

    ?>
        <div class="filerepo_file">
            <div class="filerepo_icon">
                        <a href="<?php echo $vars['url'] . "mod/westorDownloadCounter/download.php?file_guid=$file_guid" ?>"><?php

                            echo elgg_view("file/icon", array("mimetype" => $mime, 'thumbnail' => $file->thumbnail, 'file_guid' => $file_guid));

                        ?></a>
            </div>

            <div class="filerepo_title_owner_wrapper">
            <?php
                //get the user and a link to their gallery
                $user_gallery = $vars['url'] . "mod/file/search.php?md_type=simpletype&subtype=file&tag=image&owner_guid=" . $owner->guid . "&search_viewtype=gallery";
            ?>
            <div class="filerepo_user_gallery_link"><a href="<?php echo $user_gallery; ?>"><?php echo sprintf(elgg_echo("file:user:gallery"),''); ?></a></div>
            <div class="filerepo_title"><h2><a href="<?php echo $file->getURL(); ?>"><?php echo $title; ?></a></h2></div>
            <div class="filerepo_owner">
                    <?php

                        echo elgg_view("profile/icon",array('entity' => $owner, 'size' => 'tiny'));

                    ?>
                    <p class="filerepo_owner_details"><b><a href="<?php echo $vars['url']; ?>pg/file/<?php echo $owner->username; ?>"><?php echo $owner->name; ?></a></b><br />
                    <small><?php echo $friendlytime; ?></small></p>
            </div>
            </div>


            <div class="filerepo_maincontent">

                    <div class="filerepo_description"><?php echo elgg_view('output/longtext', array('value' => $desc)); ?></div>
                    <div class="filerepo_tags">
    <?php

            if (!empty($tags)) {

    ?>
            <div class="object_tag_string"><?php

                        echo elgg_view('output/tags',array('value' => $tags));

                    ?></div>
    <?php
            }

            $categories = elgg_view('categories/view',$vars);
            if (!empty($categories)) {
    ?>
            <div class="filerepo_categories">
                <?php

                    echo $categories;

                ?>
            </div>
    <?php
            }

    ?>
                    </div>
            <?php
                if (elgg_view_exists('file/specialcontent/' . $mime)) {
                    echo "<div class=\"filerepo_specialcontent\">".elgg_view('file/specialcontent/' . $mime, $vars)."</div>";
                } else if (elgg_view_exists("file/specialcontent/" . substr($mime,0,strpos($mime,'/')) . "/default")) {
                    echo "<div class=\"filerepo_specialcontent\">".elgg_view("file/specialcontent/" . substr($mime,0,strpos($mime,'/')) . "/default", $vars)."</div>";
                }

                /* BEGIN - Original file changed to support smartfiles extension */
                $use_embedit = (array_key_exists($mime, $mime_types) && (($file->access_id == ACCESS_PUBLIC) || ($plugin->ignore_access == 'yes')));
                if ($use_embedit) {
                    echo "<div class=\"filerepo_specialcontent\">".elgg_view('smartfiles/smartfiles-content', $vars)."</div>";
                } else if (elgg_view_exists('file/specialcontent/' . $mime)) {
                    echo "<div class=\"filerepo_specialcontent\">".elgg_view('file/specialcontent/' . $mime, $vars)."</div>";
                } else if (elgg_view_exists("file/specialcontent/" . substr($mime,0,strpos($mime,'/')) . "/default")) {
                    echo "<div class=\"filerepo_specialcontent\">".elgg_view("file/specialcontent/" . substr($mime,0,strpos($mime,'/')) . "/default", $vars)."</div>";
                }
                /* END - Original file changed to support smartfiles extension */



            ?>

            <div class="filerepo_download"><p><a href="<?php echo $vars['url'] . "mod/westorDownloadCounter/download.php?file_guid=$file_guid" ?>"><?php echo elgg_echo("file:download"); ?></a> (<?php echo ($file->downloadCounter ? $file->downloadCounter : 0 ); echo ($file->downloadCounter == 1) ? ' Download' : ' Downloads'; ?>)</p></div>

    <?php

        if ($file->canEdit()) {
    ?>

        <div class="filerepo_controls">
                    <p>
                        <a href="<?php echo $vars['url']; ?>mod/file/edit.php?file_guid=<?php echo $file->getGUID(); ?>"><?php echo elgg_echo('edit'); ?></a>&nbsp;
                        <?php
                            echo elgg_view('output/confirmlink',array(

                                'href' => $vars['url'] . "action/file/delete?file=" . $file->getGUID(),
                                'text' => elgg_echo("delete"),
                                'confirm' => elgg_echo("file:delete:confirm"),

                            ));
                        ?>
                    </p>
        </div>

    <?php
        }

    ?>
        </div>
    </div>

    <?php

        if ($vars['full']) {

            echo elgg_view_comments($file);

        }

    ?>

    <?php

        }

    ?>

  • @Canterbury: Great, thanks for sharing with everyone! Glad it worked out.

  • Can I make this only work in groups?

  • @TahoeBilly: Theoretically yes, you'd need to tweek the mod/smartfiles/views/default/object/file.php file and add some additional statements where I check if all conditions are met to display the embedded file.

    So you'll have to search first for my modifications in that file, they are enclosed by the following remarks:

    /* BEGIN - Original file changed to support smartfiles extension */

    and

    /* END - Original file changed to support smartfiles extension */

    Then, within each block, search for this code

    $use_embedit = ...

    After the last line that starts like that, you'll have to add the following two lines:

    $container_entity = get_entity($file->container_guid);

    $use_embedit = $use_embedit && ($container_entity instanceof ElggGroup);

    This is untested, but points you to the right direction. You'll have to do this modification at two places in the file.php

    Of course the proper way would be to make an admin interface for that, but I doubt that this would be a feature requested by many users.

  • No puedo ver SmartFiles Administration. Como puedo hacer? Necesito este plugin... Saludos...

  • @Hugo Javier Fernandez: I'm sorry, but you'll have to use english, if you have a support question or other comment.

  • @Andras Hi Andras!!! He is asking this: "I can't see the SmartFiles Admin, What can I do? I need this plugin... cheers!"

  • @rjcalifornia: Thanks for the translation ;)

    @Hugo Javier Fernandez: Have you installed your Elgg site in a subdirectory of your domain, like http://www.yourdomain.com/site/ ? If so, there is a known issue with the admin link not working properly. Please read the comments above for a solution.

  • Andras I see box.net branding on the viewer. Can you explain how box is involved with this?

     

  • @TahoeBilly: they were recently acquired by box.net. Here is the announcement: http://www.box.net/increo

  • greetings again andras,

    i have installed this plugin to my site now that it is online and am finding that the files are not being displayed with the embed.it window at all. on my local site (where the config and files are the same with regards to your plugin) the embed.it windows do show (and the files are not present because the local site is not accessible from the web)..

    i've read your documentation and the thread here, so far i haven't found any change that i can make to get it to work. an example pdf file is here: http://www.infiniteeureka.com/community/pg/file/read/223/test

    as you can see, the site is in a subfolder, not the root.. and i have made the changes that are in the thread, though they don't really apply to the basic functionality of the plugin, so are unlikely to make any difference here anyway.

    any idea what i might be missing?

    thanks

     

     

  • @tunist: The Smart Files embed code is completely missing from your page source.  It means that either:

    a) you forgot to enable and configure the plugin

    b) there is another enabled plugin on your site that overrides the object/file view, and it comes later in plugin order than the Smart Files plugin.

    I would guess it is case b), so you'd need to search your mod directories for "file.php" files to find the conflicting plugin.

    Let me know how it goes.

  • hey andras,

    i have the smartfiles plugin last in the list of activated ones on my site, it is enabled.. 

    also, the version of the site i have locally, where smartfiles does display in the page source, has pretty much the same plugins activated (although in a different order).

    maybe i'll install that plugin that saves the plugin list order and migrate the list order to the new site.. other than that i'm out of ideas.

    i searched for 'file.php' in the mod folder, didn't find any hits.

    hmm..

     

  • oh, also, when i log in to embed.it i am only seeing the files from my test site.. not from the public site..

    so the files aren't being registered either.

Stats

  • Category: Media
  • License: GNU General Public License (GPL) version 2
  • Updated: 2014-11-17
  • Downloads: 3256
  • Recommendations: 5

Other Projects

View Andras Szepeshazi's plugins