[pLog-svn] r1889 - in plog/trunk: class/action/admin js/ui locale
templates/admin
oscar at devel.plogworld.net
oscar at devel.plogworld.net
Wed Apr 20 19:01:34 GMT 2005
Author: oscar
Date: 2005-04-20 19:01:34 +0000 (Wed, 20 Apr 2005)
New Revision: 1889
Modified:
plog/trunk/class/action/admin/adminaddresourceaction.class.php
plog/trunk/js/ui/common.js
plog/trunk/locale/locale_en_UK.php
plog/trunk/templates/admin/resourcelist.template
Log:
ad-hoc resource upload from the 'add resource' pop-up window implemented.
Modified: plog/trunk/class/action/admin/adminaddresourceaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddresourceaction.class.php 2005-04-20 18:20:03 UTC (rev 1888)
+++ plog/trunk/class/action/admin/adminaddresourceaction.class.php 2005-04-20 19:01:34 UTC (rev 1889)
@@ -8,6 +8,7 @@
include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryresources.class.php" );
include_once( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
include_once( PLOG_CLASS_PATH."class/data/validator/arrayvalidator.class.php" );
+ include_once( PLOG_CLASS_PATH."class/view/admin/adminsimpleresourceslistview.class.php" );
/**
* \ingroup Action
@@ -21,6 +22,7 @@
var $_description;
var $_albumId;
var $_resource;
+ var $_destView;
/**
* Constructor. If nothing else, it also has to call the constructor of the parent
@@ -31,9 +33,16 @@
$this->AdminAction( $actionInfo, $request );
$this->registerFieldValidator( "resourceFile_1", new ArrayValidator(), true);
- $this->registerFieldValidator( "albumId", new IntegerValidator());
+ $this->registerFieldValidator( "albumId", new IntegerValidator());
+ $this->_destView = $this->_request->getValue( "destView" );
$this->_form->registerField( "resourceDescription" );
- $view = new AdminNewResourceView( $this->_blogInfo );
+ $this->_form->registerField( "destination" );
+
+ if( $this->_destView == "resourceList" )
+ $view = new AdminSimpleResourcesListView( $this->_blogInfo, Array( "albumId" => 0 ));
+ else
+ $view = new AdminNewResourceView( $this->_blogInfo );
+
$view->setErrorMessage( $this->_locale->tr( "error_no_resource_uploaded" ));
$this->setValidationErrorView( $view );
@@ -48,6 +57,9 @@
$this->_description = $this->_request->getValue( "resourceDescription" );
$this->_albumId = $this->_request->getValue( "albumId" );
$this->_resource = $this->_request->getValue( "resourceFile" );
+ $this->_destination = $this->_request->getValue( "destination" );
+
+ print("destination is = ".$this->_destination);
// check if there is any file uploaded
$files = HttpVars::getFiles();
@@ -62,7 +74,12 @@
// let the gallery library do its work...
$resources = new GalleryResources();
- $this->_view = new AdminResourcesListView( $this->_blogInfo, Array( "albumId" => $this->_albumId ));
+ if( $this->_destView == "resourceList" ) {
+ $this->_view = new AdminSimpleResourcesListView( $this->_blogInfo, Array( "albumId" => $this->_albumId ));
+ $this->_view->setValue( "destination", $this->_destination );
+ }
+ else
+ $this->_view = new AdminResourcesListView( $this->_blogInfo, Array( "albumId" => $this->_albumId ));
$successMessage = "";
$errorMessage = "";
Modified: plog/trunk/js/ui/common.js
===================================================================
--- plog/trunk/js/ui/common.js 2005-04-20 18:20:03 UTC (rev 1888)
+++ plog/trunk/js/ui/common.js 2005-04-20 19:01:34 UTC (rev 1889)
@@ -173,7 +173,6 @@
element = document.getElementById( sectionId );
currentStatus = element.style.display;
- window.alert('sectionId = '+sectionId+' - current status ='+currentStatus);
// and toggle its visibility
if( element.style.display == 'none' )
Modified: plog/trunk/locale/locale_en_UK.php
===================================================================
--- plog/trunk/locale/locale_en_UK.php 2005-04-20 18:20:03 UTC (rev 1888)
+++ plog/trunk/locale/locale_en_UK.php 2005-04-20 19:01:34 UTC (rev 1889)
@@ -909,5 +909,5 @@
$messages['trackback_marked_as_spam_ok'] = 'The trackback was marked as successfully as spam';
$messages['error_marking_trackback_as_nonspam'] = 'There was an error marking the trackback as non-spam';
$messages['trackback_marked_as_nonspam_ok'] = 'The trackback was marked successfully as non-spam';
-
+$messages['upload_here'] = 'Upload here';
?>
\ No newline at end of file
Modified: plog/trunk/templates/admin/resourcelist.template
===================================================================
--- plog/trunk/templates/admin/resourcelist.template 2005-04-20 18:20:03 UTC (rev 1888)
+++ plog/trunk/templates/admin/resourcelist.template 2005-04-20 19:01:34 UTC (rev 1889)
@@ -33,6 +33,11 @@
width : 285px;
padding : 4px;
}
+#resource_list_upload
+{
+ border-bottom : 4px solid #DEDEDE;
+ border-collapse: collapse;
+}
{/literal}</style>
</head>
<body onLoad="resourceListWindowInit({if $htmlarea}true{else}false{/if});" style="">
@@ -66,6 +71,8 @@
<br style="clear:both">
</div>
<div id="container">
+ {include file="$admintemplatepath/successmessage.template"}
+ {include file="$admintemplatepath/errormessage.template"}
<table class="info">
<thead>
<th style="width:200px";>{$locale->tr("resource")}</th>
@@ -78,7 +85,7 @@
<a href="admin.php?op=resourceList&albumId={$album->getParentId()}&mode={$destination}&page=1">
<img src="imgs/admin/icon_folder-72.png" border="0" alt="Parent" /> <br/>..</a>
</td>
- <td> </td>
+ <td><a onclick="_toggle('resource_list_upload');" href="#upload">{$locale->tr("upload_here")}</a> </td>
</tr>
{/if}
{foreach from=$albums item=resalbum}
@@ -120,7 +127,6 @@
{else}
<a href="javascript:addResourceLink({$destination},{$blog->getId()},{$resource->getResourceType()},'{$resource->getFileName()|escape:"javascript"}','{$resource->getDescription()|escape:"javascript"}',false);">{$locale->tr("add_resource")}</a><br/>
{/if}
-
{if $resource->hasPreview()}
{if $htmlarea}
<a href="javascript:addHtmlareaLink({$destination},{$blog->getId()},{$resource->getResourceType()},'{$resource->getFileName()|escape:"javascript"}','{$resource->getDescription()|escape:"javascript"}',1);">{$locale->tr("add_resource_preview")}</a><br/>
@@ -134,14 +140,44 @@
{/foreach}
</tbody>
</table>
+{if $album}
+{** show this album only if we're not browsing the root album **}
+<div id="resource_list_upload" style="display:none">
+ <form name="uploadFile" method="post" action="admin.php" enctype="multipart/form-data">
+ <fieldset class="inputField">
+ <legend>{$locale->tr("upload_here")}</legend>
+ <div class="field">
+ <label for="resourceFile_1">{$locale->tr("file")}</label>
+ <span class="required">*</span>
+ <input type="file" name="resourceFile_1" value="" id="resourceFile_1" />
+ </div>
+ <div class="field">
+ <label for="resourceDescription">{$locale->tr("description")}</label>
+ <span class="required">*</span>
+ <textarea name="resourceDescription" id="resourceDescription" rows="5" style="width:100%"></textarea>
+ </div>
+ </fieldset>
+ <div class="buttons" style="padding-bottom:7px">
+ <input type="reset" name="reset" value="{$locale->tr("reset")}" />
+ <input type="submit" name="Upload" value="{$locale->tr("add")}" />
+ <input type="hidden" name="albumId" value="{$album->getId()}" />
+ <input type="hidden" name="op" value="addResource" /><br/>
+ <input type="hidden" name="destView" value="resourceList" />
+ <input type="hidden" name="destination" value="{$destination}"
+ </div>
+ </form>
+</div>
+{/if}
<div id="list_action_bar">
{include file="$admintemplatepath/adminpager.template" style=list}
+
{if $htmlarea}
- <a href="javascript:onCancel()">{$locale->tr("close")}</a>
+ <input type="button" onClick="javascript:onCancel()" value="{$locale->tr("close")}" />
{else}
- <a href="javascript:window.close()">{$locale->tr("close")}</a>
+ <input type="button" onClick="window.close()" value="{$locale->tr("close")}" />
{/if}
</div>
+<a name="upload"></a>
</div>
</body>
</html>
More information about the pLog-svn
mailing list