Recent Updates Module: How to only show updates for the current month

manderly

Joined: 2008-04-04
Posts: 71
Posted: Fri, 2011-07-08 00:40

Hi,

I installed a module written by Steven N. Severinghaus and Alan Harder (Date: 2006-05-15, Version: 0.3.8) which displays recent updates to a gallery.

...was wondering if it would be possible to only show the updates made to my gallery (version 2.2.4) during the current month. Right now it's showing all the updates which were ever made...and the number of update pages is almost up to 5,000 pages now...

I'm unfamiliar with php, but if someone can tell me what lines to put in, I would deeply appreciative...thank you for your kindness!

manderly

 
Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Fri, 2011-07-08 06:59

What you should be focusing on is updating your gallery to v2.3.1.

See: http://gallery.menalto.com/node/102835#comment-377342

Refer to this link for specific instructions on your case.

Backup before each step

--
dakanji.com

 
manderly

Joined: 2008-04-04
Posts: 71
Posted: Fri, 2011-07-08 12:49

Hi,

Thank you for the quick reply!

Yes, you're right...I should upgrade...this is a basic question but will all my template modifications carry over with the upgrade or will I lose all my changes?

many thanks,
manderly

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Fri, 2011-07-08 20:07
Quote:
will all my template modifications carry over with the upgrade or will I lose all my changes?

if you saved your templates to your theme/templates/local then you won't overwrite anything during an upgrade.
there are also embedding options to create your special look as well.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
manderly

Joined: 2008-04-04
Posts: 71
Posted: Sat, 2011-07-09 00:04

Thank you for your help!

I'll keep the "embedding options" in mind...thanks!

manderly

 
Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Sat, 2011-07-09 06:50

Of course you will backup before starting so that you can recover files and edits you may have done outside the "local" folder.

I have never used the "local" system (because I had some issues early on) but have managed several upgrades without hitch.

On your original issue, Doesn't the module have settings to adjust the range of the updates?

--
dakanji.com

 
manderly

Joined: 2008-04-04
Posts: 71
Posted: Sat, 2011-07-09 19:46

Thank you for your help!

It probably does have the capability but since I don't understand php, I really don't know what the command line would be for specifying a range of dates...there was nothing about date ranges in the readme file...

Here is the Update module's code:

<h2> {g->text text="Gallery Updates"} </h2>
{if $uNavigator.pageCount > 1}
{g->block type="core.Navigator" class="updatesNavigator"
navigator=$uNavigator
currentPage=$uNavigator.page
totalPages=$uNavigator.pageCount}
{/if}
</div>

<div id="updates" class="gbBlock">
{foreach from=$updates item=item}
{capture assign="theLink"}{g->url arg1="view=core.ShowItem" arg2="itemId=`$item.id`"}{/capture}
<div class="updates-item">
<div class="updates-thumb">
<a href="{$theLink}">
{if isset($item.thumbnail)}
{g->image item=$item image=$item.thumbnail class="giThumbnail"}
{else}
{$item.title|default:$item.pathComponent|markup:strip}
{/if}
</a>
</div>
{if $params.showCaptions}
<div class="updates-caption">
{if $params.showTitles}
<div class="updates-link">
<a href="{$theLink}">{$item.title|markup:strip}</a>
</div>
{/if}
{if $params.showAlbumLinks}
<div class="updates-album">
<label> {g->text text="Album:"} </label>
<a href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$item.parentId`"}">
{$item.parentTitle|markup:strip}
</a>
</div>
{/if}
{if $params.showDateCreated}
<div class="updates-date">
<label> {g->text text="Added:"} </label>
{g->date timestamp=$item.creationTimestamp}
</div>
{/if}
{if $params.showSummaries}
<div class="updates-summary">
{$item.summary|markup}
</div>
{/if}
{if $params.showDescriptions}
<div class="updates-description">
{$item.description|markup}
</div>
{/if}
{foreach from=$params.blocks item=block}
{g->block type=$block.0 params=$block.1}
{/foreach}
</div>
{/if}
</div>
{/foreach}
<p style="clear:both"/>
</div>
</div>

------------------------------------------------------
And here is the updatesiteadmin code:

<div class="gbBlock gcBackground1">
<h2>{g->text text="Updates Settings"}</h2>
</div>

{if isset($status.saved)}
<div class="gbBlock">
<h2 class="giSuccess">{g->text text="Settings have been saved!"}</h2>
</div>
{/if}

<div class="gbBlock">
<table class="gbDataTable">
<tr>
<th><label for="ItemCount">{g->text text="Items To Show:"}</label></th>
<td>
<input type="text" id="ItemCount" style="font-size: smaller;" maxlength="4" size="4"
name="{g->formVar var="form[itemCount]"}" value="{$form.itemCount}"/>
{if isset($form.error.itemCount)}
<div class="giError"> {g->text text="Invalid integer value"} </div>
{/if}
</td>
</tr>
<tr>
<th><label for="cbLatest">{g->text text="Show Link for Latest Updates:"}</label></th>
<td>
<input type="checkbox" id="cbLatest"{if $form.latest} checked="checked"{/if}
name="{g->formVar var="form[latest]"}" value="1"/>
</td>
</tr>
<tr>
<th><label for="ShowTitles">{g->text text="Show Titles:"}</label></th>
<td>
<input type="checkbox" id="ShowTitles"{if $form.showTitles} checked="checked"{/if}
name="{g->formVar var="form[showTitles]"}" value="1"/>
</td>
</tr>
<tr>
<th><label for="ShowAlbumLinks">{g->text text="Show Album Links:"}</label></th>
<td>
<input type="checkbox" id="ShowAlbumLinks"{if $form.showAlbumLinks} checked="checked"{/if}
name="{g->formVar var="form[showAlbumLinks]"}" value="1"/>
</td>
</tr>
<tr>
<th><label for="ShowDateCreated">{g->text text="Show Date Created:"}</label></th>
<td>
<input type="checkbox" id="ShowDateCreated"{if $form.showDateCreated} checked="checked"{/if}
name="{g->formVar var="form[showDateCreated]"}" value="1"/>
</td>
</tr>
<tr>
<th><label for="ShowSummaries">{g->text text="Show Item Summaries:"}</label></th>
<td>
<input type="checkbox" id="ShowSummaries"{if $form.showSummaries} checked="checked"{/if}
name="{g->formVar var="form[showSummaries]"}" value="1"/>
</td>
</tr>
<tr>
<th><label for="ShowDescriptions">{g->text text="Show Item Descriptions:"}</label></th>
<td>
<input type="checkbox" id="ShowDescriptions"{if $form.showDescriptions}
checked="checked"{/if} name="{g->formVar var="form[showDescriptions]"}" value="1"/>
</td>
</tr>
<tr>
<th valign="top"><label for="Blocks">{g->text text="Blocks"}:</label></th>
<td>
<table>
<tr>
<td style="text-align: right;">
{g->text text="Available"}
</td>
<td>
<select id="blocksAvailableList_blocks"
onchange="bsw_selectToUse('blocks');">
<option value="">{g->text text="Choose a block"}</option>
</select>
</td>
<td class="bsw_BlockCommands">
<span id="bsw_AddButton_blocks" onclick="bsw_addBlock('blocks');"
class="bsw_ButtonDisabled">
{g->text text="Add"}
</span>
</td>
</tr>
<tr>
<td style="text-align: right; vertical-align: top;">
{g->text text="Selected"}
</td>
<td id="bsw_UsedBlockList_blocks">
<select id="blocksUsedList_blocks" size="10"
onchange="bsw_selectToChange('blocks');">
<option value=""></option> {* Dummy option so xhtml validates *}
</select>
</td>
<td class="bsw_BlockCommands">
<span style="display: block"
id="bsw_RemoveButton_blocks"
onclick="bsw_removeBlock('blocks');"
class="bsw_ButtonDisabled">
{g->text text="Remove"}
</span>

<span style="display: block"
id="bsw_MoveUpButton_blocks"
onclick="bsw_moveUp('blocks');"
class="bsw_ButtonDisabled">
{g->text text="Move Up"}
</span>

<span style="display: block"
id="bsw_MoveDownButton_blocks"
onclick="bsw_moveDown('blocks');"
class="bsw_ButtonDisabled">
{g->text text="Move Down"}
</span>
</td>
</tr>
<tr>
<td id="bsw_BlockOptions_blocks" colspan="3">
</td>
</tr>
</table>
<input type="hidden" onchange="bsw_reInitAdminForm('blocks');"
id="albumBlockValue_blocks" size="60"
name="{g->formVar var="form[blocks]"}" value="{$form.blocks}"/>

<script type="text/javascript">
// <![CDATA[
var block;
var tmp;
{foreach from=$UpdatesSiteAdmin.availableBlocks key=moduleId item=blocks}
{foreach from=$blocks key=blockName item=block}
block = bsw_addAvailableBlock("blocks", "{$moduleId}.{$blockName}",
"{g->text text=$block.description l10Domain="modules_$moduleId"}");
{if !empty($block.vars)}
{foreach from=$block.vars key=varKey item=varInfo}
tmp = new Array();
{if ($varInfo.type == 'choice')}
{foreach from=$varInfo.choices key=choiceKey item=choiceValue}
tmp["{$choiceKey}"] = "{g->text text=$choiceValue
l10Domain="modules_$moduleId"}";
{/foreach}
{/if}
block.addVariable("{$varKey}", "{$varInfo.default}",
"{g->text text=$varInfo.description l10Domain="modules_$moduleId"}",
"{$varInfo.type}", tmp);
{if !empty($varInfo.overrides)}
{foreach from=$varInfo.overrides item=override}
block.addVariableOverride("{$varKey}", "{$override}");
{/foreach}
{/if}
{/foreach}
{/if}
{/foreach}
{/foreach}
{* Now initialize the form with the block values *}
bsw_initAdminForm("blocks", "{g->text text="Parameter"}", "{g->text text="Value"}");
// ]]>
</script>
</td>
</tr>
<tr>
<th valign="top"><label for="CustomStyles">{g->text text="Custom CSS"}:</label></th>
<td>
<textarea name="{g->formVar var="form[customStyles]"}" rows="10" cols="60">{$form.customStyles}</textarea>
<div>
{g->text text="The CSS classes are prefixed by \"updates-\" and end with item, thumb, caption, link, date, summary, or description. For example, <code>div.updates-date</code> will select the date field."}
</div>
</td>
</tr>
</table>
</div>

<div class="gbBlock gcBackground1">
<input type="submit" class="inputTypeSubmit"
name="{g->formVar var="form[action][save]"}" value="{g->text text="Save"}"/>
<input type="submit" class="inputTypeSubmit"
name="{g->formVar var="form[action][reset]"}" value="{g->text text="Reset"}"/>
</div>

I'd be grateful for any help,
manderly

 
Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Sun, 2011-07-10 10:06

What I meant was that doesn't the admin interface of the module have the ability to specify the number of days to consider? I vaguely remember using this module and thought that it had this feature since it doesn't make much sense otherwise.

Anyway. Do update your installation and perhaps there would be an updated version of the module available to you.

--
dakanji.com

 
manderly

Joined: 2008-04-04
Posts: 71
Posted: Sun, 2011-07-10 14:35

The light bulb finally went on...I see what you mean now...

I found the admin interface...thank you so much for helping me!

I'll try to find someone to do my upgrade for me...I'm not comfortable doing it by myself...sad to say...

heartfelt thanks,
manderly

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sun, 2011-07-10 15:17

You'll need to change the $query in gallery2/modules/dynamicalbums/UpdatesAlbum.inc to something like:

$query = 'UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 30 day)) <= [GalleryEntity::creationTimestamp]';

working example

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
manderly

Joined: 2008-04-04
Posts: 71
Posted: Sun, 2011-07-10 16:06

Thank you very much suprsidr!

Where would I insert the code into the Updatesalbum.inc file? I know absolutely nothing about php...sorry...

many thanks,
manderly

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sun, 2011-07-10 17:17

please don't post that much code to any forum - paste it to a txt file and attach it. (scrolled forever on my phone)

find attached the modified result.

Note: this will alter the normal functionality of the UpdatesAlbum to always produce this result.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
manderly

Joined: 2008-04-04
Posts: 71
Posted: Sun, 2011-07-10 19:49

Thank you so much for working on this problem for me!

I inserted the modified inc file...I assume the code pulls the last 30 days worth of updates...not sure...

When I ran it again, I couldn't tell if it worked because the number of updates I had were more than 3,000.

When I tried to put in a value over 3,000 in the siteadmin box asking for number of items to show, it wouldn't work at all. 3,000 seems the maximum I can show in my raw report....so I could only go back as far as July 4th.

Interesting situation...

Thanks again for your help...sure appreciate the time and effort you've put into this!

I'm sorry about putting in all that code...I didn't realize I could attach files.

sincere thanks,
manderly

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sun, 2011-07-10 20:27
Quote:
When I ran it again, I couldn't tell if it worked because the number of updates I had were more than 3,000

Do you have 3000+ new items in the last 30 days?
Such a large result would likely eat any memory you have.
I always limit my dynamic album results to ~40

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
manderly

Joined: 2008-04-04
Posts: 71
Posted: Sun, 2011-07-10 23:52

Good point! I'm hoping that running this report once every 2 weeks for my private record-keeping will not affect the performance of the gallery too much...but perhaps I'm wrong...

I am having performance problems but I didn't think this would causing it...hmmm...

thanks again,
manderly