[pLog-svn] r3158 - in plog/trunk:
class/summary/actiontemplates/summary
Mark Wu
markplace at gmail.com
Wed Mar 29 18:16:08 GMT 2006
Do we need to adapt this function to blog search. I think it can add easily
...
Mark
> -----Original Message-----
> From: plog-svn-bounces at devel.lifetype.net
> [mailto:plog-svn-bounces at devel.lifetype.net] On Behalf Of
> mark at devel.lifetype.net
> Sent: Thursday, March 30, 2006 1:52 AM
> To: plog-svn at devel.lifetype.net
> Subject: [pLog-svn] r3158 - in plog/trunk:
> class/summary/actiontemplates/summary
>
> Author: mark
> Date: 2006-03-29 17:51:52 +0000 (Wed, 29 Mar 2006) New Revision: 3158
>
> Added:
> plog/trunk/templates/summary/blog.template
> plog/trunk/templates/summary/resource.template
> Modified:
> plog/trunk/class/summary/action/summarysearchaction.class.php
> plog/trunk/templates/summary/index.template
> plog/trunk/templates/summary/searchresults.template
> Log:
> Add the searcType capability to summary search. So, now our
> summary can search:
>
> 1. Article
> 2. blog
> 3. Resource
>
> Modified:
> plog/trunk/class/summary/action/summarysearchaction.class.php
> ===================================================================
> ---
> plog/trunk/class/summary/action/summarysearchaction.class.php
> 2006-03-29 17:31:00 UTC (rev 3157)
> +++
> plog/trunk/class/summary/action/summarysearchaction.class.php
> 2006-03-29 17:51:52 UTC (rev 3158)
> @@ -7,6 +7,7 @@
> class SummarySearchAction extends SummaryAction
> {
> var $_searchTerms;
> + var $_searchType;
>
> function SummarySearchAction( $actionInfo, $request )
> {
> @@ -16,6 +17,7 @@
> function validate()
> {
> $this->_searchTerms =
> $this->_request->getValue( "searchTerms" );
> + $this->_searchType =
> $this->_request->getValue( "searchType" );
>
> // if the search terms are not correct,
> let's return an error message
> $val = new StringValidator();
> @@ -36,7 +38,7 @@
> $search = new SearchEngine();
>
> // execute the search and check if
> there is any result
> - $results = $search->siteSearch(
> $this->_searchTerms );
> + $results = $search->siteSearch(
> $this->_searchTerms,
> +$this->_searchType );
> if( !$results || empty($results)) {
> // if not, then quit
> $this->_view = new SummaryView(
> "summaryerror" ); @@ -47,6 +49,7 @@
> // but if so, then continue...
> $this->_view = new SummaryView(
> "searchresults" );
> $this->_view->setValue(
> "searchresults", $results );
> + $this->_view->setValue( "searchtype",
> $this->_searchType );
>
> $this->setCommonData();
>
>
> Added: plog/trunk/templates/summary/blog.template
> ===================================================================
> --- plog/trunk/templates/summary/blog.template
> 2006-03-29 17:31:00 UTC (rev 3157)
> +++ plog/trunk/templates/summary/blog.template
> 2006-03-29 17:51:52 UTC (rev 3158)
> @@ -0,0 +1,25 @@
> + {assign var="updateDate" value=$blog->getUpdateDateObject()}
> + {assign var="owner" value=$blog->getOwnerInfo()}
> + {assign var="request" value=$blog->getBlogRequestGenerator()}
> + {assign var=category value=$blog->getBlogCategory()}
> +
> + <h3>
> + <a
> href="{$request->blogLink()}">{$blog->getBlog()|strip_tags}</a>
> + <a href="?op=BlogProfile&blogId={$blog->getId()}"> ? </a>
> + </h3>
> + <div class="subtitle">
> + {if $category}{$locale->tr("category")}:
> {$category->getName()}{/if}<br/>
> + {$locale->tr("updated")}
> {$locale->formatDate($updateDate,"%e %B %Y")}
> + </div>
> + <p>
> + {$blog->getAbout()|strip_tags}
> + </p>
> + <div class="bloginfo">
> + {$locale->tr("users")}
> + {assign var=blogUsers value=$blog->getUsersInfo()}
> + <a
> +
> href="?op=UserProfile&userId={$owner->getId()}">{$owner->g
> etUsername()|strip_tags}</a>{if $blogUsers},{/if}
> + {foreach from=$blogUsers item=blogUser
> name=blogUsersLoop}
> + <a
> href="?op=UserProfile&userId={$blogUser->getId()}">{$blogU
> ser->getUsername()}</a>{if !$smarty.foreach.blogUsersLoop.last}, {/if}
> + {/foreach}
> + </div>
>
> Modified: plog/trunk/templates/summary/index.template
> ===================================================================
> --- plog/trunk/templates/summary/index.template
> 2006-03-29 17:31:00 UTC (rev 3157)
> +++ plog/trunk/templates/summary/index.template
> 2006-03-29 17:51:52 UTC (rev 3158)
> @@ -53,6 +53,14 @@
> <label
> for="searchTerms">{$locale->tr("search_terms")}</label><br />
> <input type="text" tabindex="20"
> name="searchTerms" id="searchTerms" value="" />
> </div>
> + <div class="field">
> + <label
> for="searchType">{$locale->tr("search_type")}</label><br />
> + <select name="searchType" id="searchType"">
> + <option value="1">{$locale->tr("post")}</option>
> + <option value="2">{$locale->tr("blog")}</option>
> + <option
> value="3">{$locale->tr("resource")}</option>
> + </select>
> + </div>
> <input type="hidden" name="op" value="summarySearch"
> />
> <input type="submit" class="button"
> name="summarySearch" value="{$locale->tr("search")}" tabindex="21" />
> </fieldset>
>
> Added: plog/trunk/templates/summary/resource.template
> ===================================================================
> --- plog/trunk/templates/summary/resource.template
> 2006-03-29 17:31:00 UTC (rev 3157)
> +++ plog/trunk/templates/summary/resource.template
> 2006-03-29 17:51:52 UTC (rev 3158)
> @@ -0,0 +1,36 @@
> + {assign var="blog" value=$resource->getBlogInfo()}
> + {assign var="request" value=$blog->getBlogRequestGenerator()}
> + <div class="album">
> + {if $resource->hasPreview()}
> + {*<a target="_blank"
> href="resserver.php?blogId={$blog->getId()}&resource={$res
> ource->getFileName()}">*}
> + <a href="{$request->resourceLink($resource)}">
> + <img alt="{$resource->getDescription()}"
> src="{$request->resourcePreviewLink($resource)}" /></a>
> + <p>{$resource->getFileName()}</p>
> + {else}
> + <a href="{$request->resourceLink($resource)}">
> + {if $resource->isSound()}
> + <img alt="Sound"
> src="{$request->getTemplateFile("imgs/sound.gif")}" /></a>
> + {elseif $resource->isVideo()}
> + <img alt="Video"
> src="{$request->getTemplateFile("imgs/video.gif")}" /></a>
> + {elseif $resource->isZip()}
> + <img alt="Zip"
> src="{$request->getTemplateFile("imgs/compressed.gif")}" /></a>
> + {else}
> + <img alt="File"
> src="{$request->getTemplateFile("imgs/file.gif")}" /></a>
> + {/if}
> + <p>{$resource->getFileName()}</p>
> + {/if}
> + {assign var=metadata
> value=$resource->getMetadataReader()}
> + <p>{$metadata->getRoundedSize()}</p>
> + {if $resource->isImage()}
> + <p>{$metadata->getWidth()} x {$metadata->getHeight()}</p>
> + {elseif $resource->isSound()}
> + <p>{$metadata->getFormat()|upper}
> {$metadata->getSampleRate()} bps</p>
> + {elseif $resource->isVideo()}
> + <p>{$metadata->getFormat()|upper}
> {$metadata->getWidth()} x {$metadata->getHeight()},
> {$metadata->getLengthString()}</p>
> + {elseif $resource->isZip()}
> + <p>{$metadata->getTotalFiles()} {$locale->tr("files")}</p>
> + {/if}
> + {assign var="counter" value="`$counter+1`"}
> + {if $counter%3 == 0}
> + {/if}
> + </div>
> \ No newline at end of file
>
> Modified: plog/trunk/templates/summary/searchresults.template
> ===================================================================
> --- plog/trunk/templates/summary/searchresults.template
> 2006-03-29 17:31:00 UTC (rev 3157)
> +++ plog/trunk/templates/summary/searchresults.template
> 2006-03-29 17:51:52 UTC (rev 3158)
> @@ -1,11 +1,23 @@
> {include file="summary/header.template"
> section=$locale->tr("search_results")}
> <div id="onecolumn">
> - {foreach from=$searchresults item=result}
> - {assign var="post" value=$result->getArticle()}
> - {assign var="blog" value=$post->getBlogInfo()}
> - {assign var="request"
> value=$blog->getBlogRequestGenerator()}
> - {include file="summary/post.template"}
> - {/foreach}
> - {** bloglistpager links=$linkslist current=$currentPage **}
> + {if $searchtype == 1}
> + {foreach from=$searchresults item=result}
> + {assign var="post" value=$result->getArticle()}
> + {assign var="blog" value=$post->getBlogInfo()}
> + {assign var="request"
> value=$blog->getBlogRequestGenerator()}
> + {include file="summary/post.template"}
> + {/foreach}
> + {** bloglistpager links=$linkslist
> current=$currentPage **}
> + {elseif $searchtype == 2}
> + {foreach from=$searchresults item=result}
> + {assign var="blog" value=$result->getResult()}
> + {include file="summary/blog.template"}
> + {/foreach}
> + {else}
> + {foreach from=$searchresults item=result}
> + {assign var="resource" value=$result->getResult()}
> + {include file="summary/resource.template"}
> + {/foreach}
> + {/if}
> </div>
> {include file="summary/footer.template"}
>
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://devel.lifetype.net/mailman/listinfo/plog-svn
More information about the pLog-svn
mailing list