[pLog-svn] r6600 - in plog/branches/lifetype-1.2: class/action/admin js/editor js/ui templates/admin/chooser
mark at devel.lifetype.net
mark at devel.lifetype.net
Fri Jun 20 14:19:03 EDT 2008
Author: mark
Date: 2008-06-20 14:19:01 -0400 (Fri, 20 Jun 2008)
New Revision: 6600
Modified:
plog/branches/lifetype-1.2/class/action/admin/adminaddresourceaction.class.php
plog/branches/lifetype-1.2/js/editor/lifetypeeditor.js
plog/branches/lifetype-1.2/js/ui/common.js
plog/branches/lifetype-1.2/templates/admin/chooser/userpictureselect.template
Log:
1. We don't need "destination" here, it is for old lifetype version 1.1. At that time we still have postText and postExtendedText, so we need it to distinguish where the request come from.
2. We don't need to validate "resourceFile", "resourceFile_X" or "resource", The files information does not exit in $this->_request.
We always get them from HttpVars::getFiles(), and they will be validated by our upload validator inside fileUpload.
Modified: plog/branches/lifetype-1.2/class/action/admin/adminaddresourceaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminaddresourceaction.class.php 2008-06-19 18:17:02 UTC (rev 6599)
+++ plog/branches/lifetype-1.2/class/action/admin/adminaddresourceaction.class.php 2008-06-20 18:19:01 UTC (rev 6600)
@@ -6,10 +6,11 @@
lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryalbums.class.php" );
lt_include( PLOG_CLASS_PATH."class/net/http/httpvars.class.php" );
lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryresources.class.php" );
- lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
- lt_include( PLOG_CLASS_PATH."class/data/validator/arrayvalidator.class.php" );
- lt_include( PLOG_CLASS_PATH."class/view/admin/chooser/adminsimpleresourceslistview.class.php" );
- lt_include( PLOG_CLASS_PATH."class/view/admin/chooser/adminuserpictureselectview.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/data/filter/htmlfilter.class.php" );
+
+
lt_include( PLOG_CLASS_PATH."class/view/admin/adminresourceslistview.class.php" );
lt_include( PLOG_CLASS_PATH."class/file/fileupload.class.php" );
@@ -35,21 +36,17 @@
{
$this->AdminAction( $actionInfo, $request );
- // TODO: what is the _1 is that right? if so, we need to add an additional
- // validator for resourceFile, otherwise, rename this one
- $this->registerFieldValidator( "resourceFile_1", new ArrayValidator(), true);
$this->registerFieldValidator( "albumId", new IntegerValidator());
- // TODO: validate for later (stringValidator?, on the paranoid side of things)
- $this->_destView = $this->_request->getValue( "destView" );
- // TODO: validate both of these
- $this->_form->registerField( "resourceDescription" );
- $this->_form->registerField( "destination" );
+ $this->registerFieldValidator( "resourceDescription", new StringValidator(), true );
- if( $this->_destView == "resourceList" )
+ $this->_destView = $this->_request->getFilteredValue( "destView", new HtmlFilter() );
+ if( $this->_destView == "resourceList" ) {
+ lt_include( PLOG_CLASS_PATH."class/view/admin/chooser/adminsimpleresourceslistview.class.php" );
$view = new AdminSimpleResourcesListView( $this->_blogInfo, Array( "albumId" => 0 ));
- elseif ($this->_destView == "userPictureSelect" )
- $view = new AdminUserPictureSelectView( $this->_blogInfo, Array( "albumId" => 0 ));
- else
+ } elseif ($this->_destView == "userPictureSelect" ) {
+ lt_include( PLOG_CLASS_PATH."class/view/admin/chooser/adminuserpictureselectview.class.php" );
+ $view = new AdminUserPictureSelectView( $this->_blogInfo, Array( "albumId" => 0 ));
+ } else
$view = new AdminNewResourceView( $this->_blogInfo );
$view->setErrorMessage( $this->_locale->tr( "error_no_resource_uploaded" ));
@@ -77,8 +74,6 @@
// fetch the information coming from the resource
$this->_description = Textfilter::filterAllHTML($this->_request->getValue( "resourceDescription" ));
$this->_albumId = $this->_request->getValue( "albumId" );
- $this->_resource = $this->_request->getValue( "resourceFile" );
- $this->_destination = $this->_request->getValue( "destination" );
// check if there is any file uploaded
$files = HttpVars::getFiles();
@@ -93,14 +88,10 @@
// let the gallery library do its work...
$resources = new GalleryResources();
- if( $this->_destView == "resourceList" ) {
+ if( $this->_destView == "resourceList" )
$this->_view = new AdminSimpleResourcesListView( $this->_blogInfo, Array( "albumId" => $this->_albumId, "gotoLastPage" => true ));
- $this->_view->setValue( "destination", $this->_destination );
- }
- elseif ($this->_destView == "userPictureSelect" ) {
+ elseif ($this->_destView == "userPictureSelect" )
$this->_view = new AdminUserPictureSelectView( $this->_blogInfo, Array( "albumId" => 0 ));
- $this->_view->setValue( "destination", $this->_destination );
- }
else
$this->_view = new AdminResourcesListView( $this->_blogInfo, Array( "albumId" => $this->_albumId, "gotoLastPage" => true ));
Modified: plog/branches/lifetype-1.2/js/editor/lifetypeeditor.js
===================================================================
--- plog/branches/lifetype-1.2/js/editor/lifetypeeditor.js 2008-06-19 18:17:02 UTC (rev 6599)
+++ plog/branches/lifetype-1.2/js/editor/lifetypeeditor.js 2008-06-20 18:19:01 UTC (rev 6600)
@@ -712,10 +712,8 @@
*/
this.execute = function( txtId, param )
{
- if ( txtId == 'postText' )
- resource_list_window(1);
- else
- resource_list_window(2);
+ resource_list_window();
+
return '';
}
}
Modified: plog/branches/lifetype-1.2/js/ui/common.js
===================================================================
--- plog/branches/lifetype-1.2/js/ui/common.js 2008-06-19 18:17:02 UTC (rev 6599)
+++ plog/branches/lifetype-1.2/js/ui/common.js 2008-06-20 18:19:01 UTC (rev 6600)
@@ -16,16 +16,14 @@
* @param type
* @return nothing
*/
-function resource_list_window( type ) {
+function resource_list_window() {
width = 500;
height = 450;
x = parseInt(screen.width / 2.0) - (width / 2.0);
y = parseInt(screen.height / 2.0) - (height / 2.0);
- // type == 1 => intro text
- // type == 2 => extended text
- HelpWin = window.open( '?op=resourceList&mode='+type,'ResourceListWindow','top='+y+',left='+x+',scrollbars=yes,resizable=yes,toolbar=no,height='+height+',width='+width);
+ HelpWin = window.open( '?op=resourceList','ResourceListWindow','top='+y+',left='+x+',scrollbars=yes,resizable=yes,toolbar=no,height='+height+',width='+width);
}
Modified: plog/branches/lifetype-1.2/templates/admin/chooser/userpictureselect.template
===================================================================
--- plog/branches/lifetype-1.2/templates/admin/chooser/userpictureselect.template 2008-06-19 18:17:02 UTC (rev 6599)
+++ plog/branches/lifetype-1.2/templates/admin/chooser/userpictureselect.template 2008-06-20 18:19:01 UTC (rev 6600)
@@ -61,7 +61,7 @@
{if $album && $pager->getCurrentPage()==1}
<tr>
<td>
- <a href="admin.php?op=userPictureSelect&albumId={$album->getParentId()}&mode={$destination}&page=1">
+ <a href="admin.php?op=userPictureSelect&albumId={$album->getParentId()}&page=1">
<img src="imgs/admin/icon_folder-72.png" border="0" alt="Parent" /> <br/>..</a>
</td>
<td><a onclick="_toggle('resource_list_upload');" href="#upload">{$locale->tr("upload_here")}</a></td>
@@ -70,7 +70,7 @@
{foreach from=$albums item=resalbum}
<tr>
<td>
- <a href="admin.php?op=userPictureSelect&albumId={$resalbum->getId()}&mode={$destination}&page=1">
+ <a href="admin.php?op=userPictureSelect&albumId={$resalbum->getId()}&page=1">
<img src="imgs/admin/icon_folder-72.png" border="0" alt="folder" /><br/>{$resalbum->getName()}</a><br/>
</td>
<td>
@@ -116,7 +116,6 @@
<input type="hidden" name="albumId" value="{$album->getId()}" />
<input type="hidden" name="op" value="addResource" /><br/>
<input type="hidden" name="destView" value="userPictureSelect" />
- <input type="hidden" name="destination" value="{$destination}" />
</div>
<div class="status_bar" id="status_bar" style="display: none;">
{$locale->tr("upload_in_progress")}
More information about the pLog-svn
mailing list