[pLog-svn] r6195 - in plog/trunk: js/ui templates/admin
mark at devel.lifetype.net
mark at devel.lifetype.net
Fri Feb 29 05:40:28 EST 2008
Author: mark
Date: 2008-02-29 05:40:28 -0500 (Fri, 29 Feb 2008)
New Revision: 6195
Modified:
plog/trunk/js/ui/upload.js
plog/trunk/templates/admin/newtemplatefile_form.template
Log:
Okay, I add two new parameters for lifetype uploader:
postParams: ['albumId','description'], it indicates the post parameters that we want to use in each file upload. Our uploader will search the DOM and assign the key/value automatically.
cookieParams: ['sessionId'], it indicates the cookies that we want to use in each file upload. Our uploader will get the cookie from the browser and assign the key value automatically.
These two parameters can make our post_url looks more simple and clean.
** Remember, when we use flash file upload, the firefox will not attatch the session id automatically, so we need to use the cookieParams to pass the session id to lifetype, or lifetype will treat you as an un-authenticate user.
Modified: plog/trunk/js/ui/upload.js
===================================================================
--- plog/trunk/js/ui/upload.js 2008-02-29 08:40:55 UTC (rev 6194)
+++ plog/trunk/js/ui/upload.js 2008-02-29 10:40:28 UTC (rev 6195)
@@ -151,6 +151,30 @@
*/
Lifetype.UI.Upload.startUpload = function()
{
+ // Add post parameters
+ var post_params = Lifetype.UI.Upload.swfu.getSetting("post_params");
+
+ if( Lifetype.UI.Upload.params.postParams != null )
+ {
+ var posts = Lifetype.UI.Upload.params.postParams;
+ for( i=0; i < posts.length; i++ ) {
+ if( Lifetype.Dom.$(posts[i]) != null )
+ post_params[posts[i]] = Lifetype.Dom.$(posts[i]).value;
+ }
+ }
+
+ if( Lifetype.UI.Upload.params.cookieParams != null )
+ {
+ var cookies = Lifetype.UI.Upload.params.cookieParams;
+ for( i=0; i < cookies.length; i++ ) {
+ if( getCookie(cookies[i]) != null )
+ post_params[cookies[i]] = getCookie(cookies[i]);
+ }
+ }
+
+ Lifetype.UI.Upload.swfu.setPostParams(post_params);
+
+ // start upload
Lifetype.UI.Upload.swfu.startUpload();
}
Modified: plog/trunk/templates/admin/newtemplatefile_form.template
===================================================================
--- plog/trunk/templates/admin/newtemplatefile_form.template 2008-02-29 08:40:55 UTC (rev 6194)
+++ plog/trunk/templates/admin/newtemplatefile_form.template 2008-02-29 10:40:28 UTC (rev 6195)
@@ -20,7 +20,10 @@
uploadButton:'addFile',
fileSizeLimit: {$config->getValue("maximum_file_upload_size")},
validFiles: '{$config->getValue("template_editor_editable_extensions")}',
- url:'{$url->getAdminUrl()}?op=uploadTemplateFile&path='+Lifetype.Dom.$('currentPath').value+'&output=flash&templateId='+Lifetype.Dom.$('templateId').value+'&{$session}={$sessionId}'{literal}}{/literal});
+ url:'{$url->getAdminUrl()}?op=uploadTemplateFile&output=flash',
+ postParams: ['currentPath','templateId'],
+ cookieParams: ['{$session}']
+ {literal}}{/literal});
</script>
</div>
</div>
More information about the pLog-svn
mailing list