Click here to register.
      
Sprechen Sie WebGUI? Parlez vous WebGUI? Se habla WebGUI? Spreekt u WebGUI?

Do you speak WebGUI? Please help us translate WebGUI into your language.



     Discuss > Etcetera

Resent news

User Vitkovsky
Date 3/16/2006 10:16 am
Views 3246
Rating 2    Rate [
|
]
Previous · Next
User Message
Vitkovsky

I made via SQLReport "resent news" with fields:
assetData.title
assetData.url
assetData.synopsis
Post.dateSubmitted

All work well, but I need else Thumbnails from posts attachments. I find only "Post.storageId" field.

Can anyone to say - how to get any information about attachments of post? At what fields I need looking for?


Vladimir Vitkovsky
http://www.webgui.uanet.biz/
http://www.transport.su/

 

--- (Edited on 16-March-2006 18:16 [GMT+0200] by Vitkovsky) ---



Back to Top
Rate [
|
]
 
 
petr999

JFYI: your English soo cooool.

It doesn't real matter with your "at list" but does with "news those are re-sent somewhere" :)

--- (Edited on 3/20/2006 12:32:00 [GMT+0400] by petr999) ---



Back to Top
Rate [
|
]
 
 
Vitkovsky

I agree about my English, but I have not absolutely understood sense of your message. You have tried to answer a question or have tried to prove yourself?

I shall try to describe a question in other words:
I use SQLReport and I need to take URL of Thumbnails of attachment of Post. There is a field Post.storageId. Is there others fields, which contain informaition about attachments of Post?

Or, probably, it is necessary for me to receive the information about URL of attachment only processing value of this field external additional a macro?


Vladimir Vitkovsky
http://www.webgui.uanet.biz/
http://www.transport.su/

 

--- (Edited on 20-March-2006 15:02 [GMT+0200] by Vitkovsky) ---



Back to Top
Rate [
|
]
 
 
petr999

Vladimir, JFYI means "just for your information"

Also, NP.

 just the Subject is not clear with "re-sent" You meant "recent", right? it's another kind of news.

concerning thumbnails, are your sure they exist somewhere right after you post an attachment?

--- (Edited on 3/21/2006 11:36:20 [GMT+0400] by petr999) ---



Back to Top
Rate [
|
]
 
 
Vitkovsky

OK, I agree. The message, probably, too short also does not give full representation about what there is a massage.

Very much widespread situation when Collaboration System it is used for the publication of news.

Thread is a news, Post is a discussion about news (if allow). In the Collaboration properties I can set "Attachments Per Post".
I need "thumbnail" - If this Post has attachments, the URL for the thumbnail of the first image attachment (As is in the WebGUI help).

There is "storageId" - The Asset ID of the storage node for the Post, where the attachments are kept. (As I understand: field "storageId" of table "Post")

I can not find any assetId like my Post.storageId (from SQL)

My SQL:

SELECT
assetData.url,
assetData.title,
assetData.assetId,
assetData.groupIdView,
assetData.synopsis,
Post.storageId,
Post.dateSubmitted,
assetData.status,
Post.assetId,
assetData.revisionDate,
asset.state,
asset.parentId,
p.title AS parent
FROM assetData
LEFT JOIN
Post ON assetData.assetId=Post.assetId
LEFT JOIN
asset ON assetData.assetId=asset.assetId
LEFT JOIN
assetData as p ON p.assetId = asset.parentId
WHERE assetData.status = 'approved'
AND asset.state = 'published'
AND asset.className = 'WebGUI::Asset::Post::Thread'
AND assetData.url LIKE 'news/%'
AND !(assetData.url LIKE 'photos/%')
AND assetData.groupIdView = 7
AND assetData.revisionDate=(SELECT MAX(assetData.revisionDate) FROM assetData WHERE assetData.assetId=asset.assetId)
GROUP BY assetData.assetId
ORDER BY Post.dateSubmitted DESC
LIMIT 3

Template:

<a name="<tmpl_var assetId>"></a>
<tmpl_if session.var.adminOn>
 <p><tmpl_var controls></p>
</tmpl_if> 
  <tmpl_if displayTitle>
    <h1><tmpl_var title></h1>
</tmpl_if>

<tmpl_if description>
    <tmpl_var description><p />
</tmpl_if>


<tmpl_if debugMode>
 <ul>
 <tmpl_loop debug_loop>
  <li><tmpl_var debug.output></li>
 </tmpl_loop>
 </ul>
</tmpl_if>


<table width="95%" cellpadding=2 cellspacing=1 border=0>

<tmpl_loop rows_loop>
<tr><td>

<a href="/<tmpl_var row.field.url.value>#<tmpl_var row.field.assetId.value>"><div class="tableHeader"><tmpl_var row.field.title.value></div></a>
 <tmpl_if row.field.storageId.value>
    <a href="/<tmpl_var row.field.url.value>#<tmpl_var row.field.assetId.value>"><img class="thumbnail" vspace="5" hspace="15"
 src="/uploads/<tmpl_var row.field.some_what_I_do_not_know.value>" align="left"/></a>

   </tmpl_if>
<div align="justify">
<font size=-1><tmpl_var row.field.synopsis.value></font>
</div><br>

<div align="left">
^D("%D.%m.%y %j:%m",<tmpl_var row.field.dateSubmitted.value>);</div>
(<b>Раздел:</b> <tmpl_var row.field.parent.value>)
<div align="right">  ( <a href="/<tmpl_var row.field.url.value>#<tmpl_var row.field.assetId.value>">Подробнее</a>
         )</div><p />
</td></tr>
</tmpl_loop>
</table>
<tmpl_if pagination.pageCount.isMultiple>
  <div class="pagination">
    <tmpl_var pagination.previousPage>   <tmpl_var pagination.pageList.upTo20>  <tmpl_var pagination.nextPage>
  </div>
</tmpl_if>

I did it in 6.2.11 and try to do it in 6.8.7...


Vladimir Vitkovsky
http://www.webgui.uanet.biz/
http://www.transport.su/

 

--- (Edited on 21-March-2006 18:39 [GMT+0200] by Vitkovsky) ---



Back to Top
Rate [
|
]
 
 
Vitkovsky

Looks so, that I have made it. Has or nearly so made...

<img src="^ThumbURL(<tmpl_var row.field.storageId.value>);" />

------------------------------------------------------------------

package WebGUI::Macro::ThumbURL;

#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2005 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
# this software.
#-------------------------------------------------------------------
# http://www.plainblack.com                     info@plainblack.com
#-------------------------------------------------------------------

use strict;
use WebGUI::Session;
use WebGUI::Storage;
use WebGUI::Storage::Image;

#-------------------------------------------------------------------
sub process {
 my $storageId = shift;

 my $storage = WebGUI::Storage::Image->get($storageId);

 my $url;
 foreach my $filename (@{$storage->getFiles}) {
  if ($storage->isImage($filename)) {
   $url = $storage->getThumbnailUrl($filename);
   last;
  }
 }
 return  $url;
}
1;

But from 24 messages 14 - OK, but in eight messages URL it turns out empty.

Any Ideas?


Vladimir Vitkovsky
http://www.webgui.uanet.biz/
http://www.transport.su/

 

--- (Edited on 22-March-2006 00:45 [GMT+0200] by Vitkovsky) ---



Back to Top
Rate [
|
]
 
 
petr999

> 24 messages 14 - OK, but in eight messages

what's about rest of two? 24-14-8=2 

--- (Edited on 3/22/2006 13:00:29 [GMT+0400] by petr999) ---



Back to Top
Rate [
|
]
 
 
Vitkovsky

That's easy: 2 of them have not attachmets.

"...in eight messages URL it turns out empty" - I resolved.

Do You have not ideas on this theme more?


Vladimir Vitkovsky
http://www.webgui.uanet.biz/
http://www.transport.su/

 

--- (Edited on 22-March-2006 12:30 [GMT+0200] by Vitkovsky) ---



Back to Top
Rate [
|
]
 
 
Vitkovsky

Now all works. Probably, it is useful to somebody else except for me.
It collects the latest news from several Collaboration and displays:

Title,
Synopsis,
Thumbnail,
Chapter name,
Date&Time,
Link to news body,

Marked by a bold font change by the necessity:

S Q L:

SELECT
assetData.url,
assetData.title,
assetData.assetId,
assetData.groupIdView,
assetData.synopsis,
Post.storageId,
Post.dateSubmitted,
assetData.status,
Post.assetId,
assetData.revisionDate,
asset.state,
asset.parentId,
p.title AS parent
FROM assetData
LEFT JOIN
Post ON assetData.assetId=Post.assetId
LEFT JOIN
asset ON assetData.assetId=asset.assetId
LEFT JOIN
assetData as p ON p.assetId = asset.parentId
WHERE assetData.status = 'approved'
AND asset.state = 'published'
AND asset.className = 'WebGUI::Asset::Post::Thread'
AND (assetData.url LIKE 'news/%'
OR assetData.url LIKE 'photos/%')
AND assetData.groupIdView = 7
AND assetData.revisionDate=(SELECT MAX(assetData.revisionDate) FROM assetData WHERE assetData.assetId=asset.assetId)
AND Post.revisionDate=assetData.revisionDate
GROUP BY assetData.assetId
ORDER BY Post.dateSubmitted DESC
LIMIT 5

T E M P L A T E:

<a name="<tmpl_var assetId>"></a>
<tmpl_if session.var.adminOn>
 <p><tmpl_var controls></p>
</tmpl_if> 
  <tmpl_if displayTitle>
    <h1><tmpl_var title></h1>
</tmpl_if>

<tmpl_if description>
    <tmpl_var description><p />
</tmpl_if>

<tmpl_if debugMode>
 <ul>
 <tmpl_loop debug_loop>
  <li><tmpl_var debug.output></li>
 </tmpl_loop>
 </ul>
</tmpl_if>

<table width="95%" cellpadding=2 cellspacing=1 border=0>

<tmpl_loop rows_loop>
<tr><td>
<a href="/<tmpl_var row.field.url.value>#<tmpl_var row.field.assetId.value>"><div class="tableHeader"><tmpl_var row.field.title.value></div></a>
<a href="/<tmpl_var row.field.url.value>#<tmpl_var row.field.assetId.value>"><img class="thumbnail" src="^ThumbURL(<tmpl_var row.field.storageId.value>);" border="0" align="left"/></a>
<div class="synopsis">
<tmpl_var row.field.synopsis.value>
</div><br>

<div align="left">
^D("%D.%m.%y %j:%m",<tmpl_var row.field.dateSubmitted.value>);</div>
(<b>Chapter:</b> <i><tmpl_var row.field.parent.value></i>)
<div align="right">  ( <a href="/<tmpl_var row.field.url.value>#<tmpl_var row.field.assetId.value>">More...</a>)</div><p />
</td></tr>
</tmpl_loop>
</table>
<tmpl_if pagination.pageCount.isMultiple>
  <div class="pagination">
    <tmpl_var pagination.previousPage>   <tmpl_var pagination.pageList.upTo20>  <tmpl_var pagination.nextPage>
  </div>
</tmpl_if>

M A C R O:

package WebGUI::Macro::ThumbURL;

#-------------------------------------------------------------------

use strict;
use WebGUI::Session;
use WebGUI::Storage;
use WebGUI::Storage::Image;

#-------------------------------------------------------------------
sub process {
 my $storageId = shift;

 my $storage = WebGUI::Storage::Image->get($storageId);

 my $url;
 foreach my $filename (@{$storage->getFiles}) {
  if ($storage->isImage($filename)) {
   $url = $storage->getThumbnailUrl($filename);
   last;
  }
 }
  if ($url eq '')  {$url = '/extras/spacer.gif';}
 return  $url;
}
1;
 

 


Vladimir Vitkovsky
http://www.webgui.uanet.biz/
http://www.transport.su/

 

 

--- (Edited on 22-March-2006 18:05 [GMT+0200] by Vitkovsky) ---



Back to Top
Rate [
|
]
 
 
     Discuss > Etcetera



Recent Discussions Color Key

Design:

Development:

Et Cetera:

Install/Upgrade:  

Smoketest:

Template Group:


Re: Best way to make files available to webgui comunity by bernd - Fri @ 02:50pm

Re: User event history by knowmad - Fri @ 02:02pm

Re: Best way to make files available to webgui comunity by lctn2 - Fri @ 01:55pm

Re: Strategic Roadmap by JT - Fri @ 01:55pm

Re: Navigation links by rogier - Fri @ 01:55pm

Re: 2009 Presidents Meeting by JT - Fri @ 01:10pm

Re: navigation new window by rogier - Fri @ 01:03pm

Re: navigation new window by rogier - Fri @ 12:53pm

Re: WUC 2009 by JT - Fri @ 12:50pm

Re: Best way to make files available to webgui comunity by preaction - Fri @ 12:35pm

Re: Pagination markup by rogier - Fri @ 12:35pm

Re: Best way to make files available to webgui comunity by kristi - Fri @ 12:29pm

Debian and Ubuntu Packaging Status by jmarsden - Fri @ 12:12pm

Best way to make files available to webgui comunity by lctn2 - Fri @ 12:12pm