Displaying assigned tags

rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Thu, 2009-07-16 01:33

If anyone's interested I've uploaded a module to my github called "displaytags" which should display whatever tags the album/photo you're looking at has been tagged with. It's a fairly simple module that I've created so I can see which photo's I've already tagged. If you need more functionally then that you're probably going to have to wait for the gallery3 people to implement it themselves :)

It can be downloaded from:
http://github.com/rWatcher/gallery3-contrib/tree/master

---
Report Problems/Suggestions Here | Get latest version | Documentation | Coffee Fund | My Library | My GitHub

AttachmentSize
displaytags.zip3.81 KB
 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Thu, 2009-07-16 02:29

I've pulled this into the gallery3-contrib repository. thanks! We're going to be writing functionality like this for the official release, but it's good to see there's something in the interim.
---
Problems? Check gallery3/var/logs
bugs/feature req's | upgrade to the latest code | use git | help! vote!

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2009-07-16 04:10

rWatcher ...the module machine!

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
pinn8

Joined: 2009-02-19
Posts: 74
Posted: Sun, 2009-07-19 01:45

Another nice addition.

This module gave me the idea to remove the tag cloud, because I don't particularly care for them. When I disabled the tags module, your module stopped working -- were you intending to depend on the tags module in some way?

Undaunted, I figured out how to keep the tags module running, but still hide the tag cloud. It was a simple task to comment out a few lines of code. To the core team -- do you think you would be interested in a modified version of the tags module that makes this an option configured by a check box? If so, I am willing to give ti a try and send you the updated code. Let me know.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sun, 2009-07-19 03:02
Quote:
To the core team -- do you think you would be interested in a modified version of the tags module that makes this an option configured by a check box? If so, I am willing to give ti a try and send you the updated code. Let me know.

Please create a fork on git hub:
http://codex.gallery2.org/Gallery:Using_Git

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Sun, 2009-07-19 17:59
pinn8 wrote:
Another nice addition.

This module gave me the idea to remove the tag cloud, because I don't particularly care for them. When I disabled the tags module, your module stopped working -- were you intending to depend on the tags module in some way?

I wrote my module to run in addition to the tags module. I figured that, as you need the tags module to actually assign tags, it would be a pretty safe assumption that it was installed :) . That said, you could probably modify it easily enough to work without tags installed, if you so choose (although it sounds like you've already solved your problem by simply modifying tags).

 
griffinmt
griffinmt's picture

Joined: 2009-09-06
Posts: 128
Posted: Fri, 2009-10-02 00:36

This is something I wanted to do myself, so thanks for saving me the trouble.
Copied the module etc and activated it. Just what needs to be placed in the view to
make this appear?

Martyn T. Griffin

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2009-10-02 03:25
Quote:
his module gave me the idea to remove the tag cloud, because I don't particularly care for them.

Add to the css:

#gTag {
display: none;
}

that should the tag cloud.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
allnight

Joined: 2006-02-21
Posts: 11
Posted: Fri, 2009-10-02 04:35

Thank you very much! Displaytags-new did in fact give me most of what I was looking for!

Only thing now, is that I want it to be above the random image, rather than below it...I want it to follow the Tags module. I'll do some reading, to see if there's a way to configure that though.

Thanks again!

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2009-10-02 05:20

There has been a new change to the modules blocks:
http://github.com/gallery/gallery3/commit/60d35b89929d9029c794f72d6a9c38b676e282f6
it adds a UI to sort/rearranges item in the sidebar.
3rd party modules like this one will have to be udated to take advantage of this new feature.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
SemanticVoid

Joined: 2009-09-17
Posts: 10
Posted: Mon, 2009-10-05 18:51

So, I take it that this module no longer works with the current experimental version?

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Wed, 2009-12-30 06:17

I've created an updated version of DisplayTags:
- Merged in ckieffer's CSS changes for Gallery 3 Git
- Updated for the new sidebar code in Gallery 3 Git
- Tested everything against current git (as of commit b6c1ba7ea6416630b2a44b3df8400a2d48460b0a)

It is attached here, and has been uploaded to my github account.

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Sun, 2010-01-10 06:55

The attached version of DisplayTags includes the changes bharat recently made on github. Otherwise it's the same as the previous zip file. I've tested this against the current version of Gallery 3 on github (as of commit 38f2784fbbb0661dc57627d2878cb640bbffe271), and everything worked fine for me.

 
MarkRH

Joined: 2007-05-25
Posts: 241
Posted: Sat, 2010-01-09 07:29

Does your module now require the latest experimental code to work properly? I happen to be on the base beta 3 at the moment. Suppose I should upgrade to the latest experimental code anyway.

Thanks,
Mark H.

 
MarkRH

Joined: 2007-05-25
Posts: 241
Posted: Sat, 2010-01-09 10:47

I'm using version that came out of gallery-gallery3-58620c5.zip from git. I installed the displaytags.zip that you just attached. I added a tag to a photo and it does show the tag I added "Snow". However, if I click on the link it makes for the tag: (test gallery)/tags/Snow it generates a 404 error. The normal link that it seems to use in the tag cloud (test gallery)/tags/show/1 which works. My current .htaccess rewrite is the default:

<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteBase /
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php?kohana_uri=$1 [QSA,PT,L]
   RewriteRule ^$ index.php?kohana_uri=$1 [QSA,PT,L]
</IfModule>

Is there something I need to adjust in it?

My test gallery is at gallery3.markheadrick.com

Thanks,
Mark H.

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Sun, 2010-01-10 06:56
MarkRH wrote:
I'm using version that came out of gallery-gallery3-58620c5.zip from git. I installed the displaytags.zip that you just attached. I added a tag to a photo and it does show the tag I added "Snow". However, if I click on the link it makes for the tag: (test gallery)/tags/Snow it generates a 404 error. The normal link that it seems to use in the tag cloud (test gallery)/tags/show/1 which works.

It should work properly now.

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Sun, 2010-01-10 18:16

I've pulled this into the gallery3-contrib repo. Thanks, rWatcher!
---
Problems? Check gallery3/var/logs
bugs/feature req's | upgrade to the latest code | use git

 
MarkRH

Joined: 2007-05-25
Posts: 241
Posted: Mon, 2010-01-11 01:46

Well, the change does work, thanks. Personally, I would actually like for URLs like (gallery)/tag/(tag word) to work as that would match the URLs that WordPress uses for tags. I guess wherever in the code that it deciphers the URLs it could be modified to decipher the URL and look up the word in the tags table using the name field to then get the numerical ID.

Thanks,
Mark H.

Using Gallery 2.2.6 - gallery.markheadrick.com

 
moonrock

Joined: 2010-01-18
Posts: 7
Posted: Wed, 2010-01-20 07:12

I installed the version attached above and it does not seem to be working. The tags are simply not being displayed on any of the tagged images.

Is there something I need to do other than installing the module and activating it? I just feel like I must be missing something here. :)

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Wed, 2010-01-20 07:27
moonrock wrote:
I installed the version attached above and it does not seem to be working. The tags are simply not being displayed on any of the tagged images.

Is there something I need to do other than installing the module and activating it? I just feel like I must be missing something here. :)

What version of Gallery 3 are you using? The module is only compatible with the newer git builds, not the older beta 3 version.

 
moonrock

Joined: 2010-01-18
Posts: 7
Posted: Wed, 2010-01-20 17:12

I'm using the beta3 version. I tried to install the git build (copying /var to the new directory to ensure it was a fresh install, correct? note: the beta3 is installed to the root directory, the git build is installed to /gal3 -- both still exist.) only to come to this page:

Hey wait, you're an admin! We can tell you stuff.
Kohana_Exception [ Framework Error ]: The requested views, page.html, could not be found

1.
SYSPATH/core/Kohana.php[ 812 ]
807 if ($found === NULL) 808 { 809 if ($required === TRUE) 810 { 811 // If the file is required, throw an exception 812 throw new Kohana_Exception('The requested :resource:, :file:, could not be found', array(':resource:' => __($directory), ':file:' =>$filename)); 813 } 814 else 815 { 816 // Nothing was found, return FALSE 817 $found = FALSE;
2.
SYSPATH/libraries/View.php[ 83 ] » Kohana_Core::find_file( arguments )
3.
SYSPATH/libraries/View.php[ 49 ] » View_Core->set_filename( arguments )
4.
MODPATH/gallery/libraries/MY_View.php[ 56 ] » View_Core->__construct( arguments )
5.
MODPATH/gallery/libraries/Theme_View.php[ 32 ] » View->__construct( arguments )
6.
MODPATH/gallery/controllers/albums.php[ 73 ] » Theme_View_Core->__construct( arguments )
7.
MODPATH/gallery/controllers/albums.php[ 22 ] » Albums_Controller->show( arguments )
8.
{PHP internal call} » Albums_Controller->index()
9.
SYSPATH/core/Kohana.php[ 330 ] » ReflectionMethod->invokeArgs( arguments )
10.
SYSPATH/core/Event.php[ 208 ] » Kohana_Core::instance( arguments )
11.
APPPATH/Bootstrap.php[ 67 ] » Event_Core::run( arguments )
12.
DOCROOT/index.php[ 90 ] » require( arguments )

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Wed, 2010-01-20 22:18
moonrock wrote:
Kohana_Exception [ Framework Error ]: The requested views, page.html, could not be found

Sounds like you're missing a file. I believe this is the /gal3/themes/THEMENAME/views/page.html.php that it's complaining about.

 
moonrock

Joined: 2010-01-18
Posts: 7
Posted: Wed, 2010-01-20 23:10

Interesting.

I got too frustrated and went back to 2!

 
mamouneyya

Joined: 2009-11-02
Posts: 337
Posted: Mon, 2010-03-01 00:13

Is there a way to merge the ability of adding new tags with this module? I want my users to be able to add tags to the items as well as see the assigned ones, but I don't want to depend on two sidebar blocks (PopularTags + DisplayTags). I don't care about the popular tags, I just want to see the assigned tags of the items as well as have the ability to add a one.

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Mon, 2010-03-01 05:19
mamouneyya wrote:
Is there a way to merge the ability of adding new tags with this module? I want my users to be able to add tags to the items as well as see the assigned ones, but I don't want to depend on two sidebar blocks (PopularTags + DisplayTags). I don't care about the popular tags, I just want to see the assigned tags of the items as well as have the ability to add a one.

You can assign tags using the Photo Options -> Edit Photo screen instead of the tags sidebar.

You could probably "hack" a tag prompt into the displaytag module, although I don't know how reliable that would be. Try inserting some code like this into the bottom of the modules\displaytags\views\displaytags_block.html.php:

<script type="text/javascript">
  $("#g-add-tag-form").ready(function() {
    var url = $("#g-tag-cloud").attr("ref") + "/autocomplete";
    $("#g-add-tag-form input:text").autocomplete(
      url, {
        max: 30,
        multiple: true,
        multipleSeparator: ',',
        cacheLength: 1
      }
    );
    $("#g-add-tag-form").ajaxForm({
      dataType: "json",
      success: function(data) {
        if (data.result == "success") {
          $("#g-tag-cloud").html(data.cloud);
        }
        $("#g-add-tag-form").resetForm();
      }
    });
  });
</script>

<?=tag::get_add_form($theme->item()); ?>
 
mamouneyya

Joined: 2009-11-02
Posts: 337
Posted: Mon, 2010-03-01 11:46

Many thanks. That did it!
The only problem was there, is that the block doesn't appear if there is no tags assigned to the item, but I could override this by removing that if statement from: "displaytags/helpers/displaytags_block.php":

      // If the current item has at least one tag, display it/them.
      if (count($tagsItem) >= 0) {
        $block = new Block();
        $block->css_id = "g-display-tags";
        $block->title = t("Tags");
        $block->content = new View("displaytags_block.html");
        $block->content->tags = $tagsItem;
      }

As an improvement, is it easy to add an Ajax code to display the tag(s) after adding them without reload the page?

Thanks again :)

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Mon, 2010-03-01 20:02
mamouneyya wrote:
As an improvement, is it easy to add an Ajax code to display the tag(s) after adding them without reload the page?

Thanks again :)

Well, you could do something like this to add the new tag name to the end, but it won't be clickable (that would be a lot more complicated):

<?php defined("SYSPATH") or die("No direct script access.") ?>
<div class="g-display-tags-block" id="g-display-tags-block">
  <? $not_first = 0; ?>
  <? foreach ($tags as $tag): ?>
  <?= ($not_first++) ? "," : "" ?>
    <a href="<?= $tag->url() ?>"><?= html::clean($tag->name) ?></a>
  <? endforeach ?>
</div>
<script type="text/javascript">
  $("#g-add-tag-form").ready(function() {
    var url = $("#g-tag-cloud").attr("ref") + "/autocomplete";
    $("#g-add-tag-form input:text").autocomplete(
      url, {
        max: 30,
        multiple: true,
        multipleSeparator: ',',
        cacheLength: 1
      }
    );
    $("#g-add-tag-form").ajaxForm({
      dataType: "json",
      success: function(data) {
        if (data.result == "success") {
          var originalhtml = document.getElementById('g-display-tags-block').innerHTML;
          $("#g-display-tags-block").html(originalhtml + ", " + document.getElementById('g-add-tag-form').name.value);
        }
        $("#g-add-tag-form").resetForm();
      }
    });
  });
</script>

<?=tag::get_add_form($theme->item()); ?>
 
mamouneyya

Joined: 2009-11-02
Posts: 337
Posted: Mon, 2010-03-01 20:16

Many many thanks :)!

 
hebhansen
hebhansen's picture

Joined: 2009-02-10
Posts: 573
Posted: Wed, 2010-03-10 08:52

My Dang! is sorted out - thanks

all the best
HB - http://www.image.agentura.dk

 
Shemo725

Joined: 2008-04-18
Posts: 424
Posted: Tue, 2010-06-15 20:21

the display tags module does not seem to want to display in my sidebar!

http://gallery.andrewshemo.com/index.php/

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Wed, 2010-06-16 05:33
Shemo725 wrote:
the display tags module does not seem to want to display in my sidebar!

http://gallery.andrewshemo.com/index.php/

Looks fine to me.

 
Shemo725

Joined: 2008-04-18
Posts: 424
Posted: Wed, 2010-06-16 06:26
rWatcher wrote:
Shemo725 wrote:
the display tags module does not seem to want to display in my sidebar!

http://gallery.andrewshemo.com/index.php/

Looks fine to me.

doesn't work in google chrome.

edit- it works..it wasn't showing up because I don't have album tags.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2010-06-17 02:55
Quote:
doesn't work in google chrome.

Looks good to me. I am surprised that it looks so similar.
[img]http://gallery.menalto.com/files/side-by-side-tags.png[/img]

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
reinoutsmit
reinoutsmit's picture

Joined: 2009-09-16
Posts: 3
Posted: Mon, 2010-06-28 09:24

any idea how to get this module right under the photo, instead of the sidebar?
been playing around for a while now but i don't get it

 
reinoutsmit
reinoutsmit's picture

Joined: 2009-09-16
Posts: 3
Posted: Mon, 2010-06-28 09:29

Never mind, found the solution here: how to show tags for an album

 
wearwolfie

Joined: 2010-07-23
Posts: 6
Posted: Fri, 2010-07-30 13:19

This is a great module and works fine for my set up.

I would like to tailor it though to only show in Admin mode to help me set up my gallery by seeing which photos i have already tagged, but not allow guests to see this module.

Being a php novice, what would i need to change to just getit to display in Admin mode only?
Any clues greatly appreciated.

Cheers
WW