Jamroom Logo Jamroom 5 Core
is now Open Source!
User Support Forum Archive (Read Only)
Jamroom Developers:
Using the Upload Progress Meter in a Form Controller?
musiccreatures



Joined: 20 Jun 2009
Posts: 344
Location: Portland Oregon

Posted: 11/18/09 00:58 
When setting the $_args array for the jrProgressFormBegin function, the documents mention that you should add the modules form controller on the left side of the pipe and the mode to call in the form controller, once the file has been uploaded. Is there a way to post additional arguments to the right of the pipe? For example, how would I write the below url as the $_args array?


Code
mcClassifiedAds.php?mode=tools&task=createcat


Any help would be greatly appreciated.

Thanks,
Tim

Back to top
Brian
Jamroom Team


Joined: 09 Jul 2003
Posts: 37583
Location: Seattle, WA

Posted: 11/18/09 11:46 

musiccreatures:
When setting the $_args array for the jrProgressFormBegin function, the documents mention that you should add the modules form controller on the left side of the pipe and the mode to call in the form controller, once the file has been uploaded. Is there a way to post additional arguments to the right of the pipe? For example, how would I write the below url as the $_args array?


Code
mcClassifiedAds.php?mode=tools&task=createcat


Any help would be greatly appreciated.

Thanks,
Tim


You would include the task form value as a hidden parameter in your args - i.e.

Code

$_args = array(
  'task' => 'createcat'
);
jrProgressFormBegin("mcClassifiedAds.php?mode=mcClassifiedAds.php|tools",$_args);


Hope this helps!

- Brian


_________________
Make sure and check out:
* The Jamroom FAQ
* The Jamroom Documentation
Back to top
musiccreatures



Joined: 20 Jun 2009
Posts: 344
Location: Portland Oregon

Posted: 11/18/09 12:23 
awesome. Thanks so much.

Back to top
musiccreatures



Joined: 20 Jun 2009
Posts: 344
Location: Portland Oregon

Posted: 11/18/09 21:49 
So i rewrote my modules form controller so that it no longer uses task as a second argument.

It now soley relies on "mode", as most form controllers use. The issue is, that the mode isn't being included, when the file is done uploading. I believe the below code is right, but apparently it isn't:


Code
$GLOBALS['JR_PROGRESS_ENABLE'] = true;

The above "special global flag" is located at the top of the form controllers code, next to the $GLOBALS['JR_SCRIPT_NAME'].

Here is the main form for creating a category:

Code

jmHtmlBegin($language['mcClassifiedAds'][6]);
jmBodyBegin();
jmSpanCell($language['mcClassifiedAds'][6],'',30,'html_modify.png');
jrGetFormNotice();

$_args = array('mode' => 'mcClassifiedAds.php|savecat');
jrProgressFormBegin('mcClassifiedAds.php', $_args);

jmInput($language['mcClassifiedAds'][165], 'meter_file_1', 'file', $_forminfo['meter_file_1'], $language['mcClassifiedAds'][166]);
jrProgressBarHtml();
jrFormSubmit($language['mcClassifiedAds'][7],'undo changes', false,'admin.php?s=section_mcClassifiedAdsMenu', false, true, 'media');
jmEndForm();
jmBodyEnd();
jmHtmlEnd();


I have left out some of the other form elements, such as category_title & Category_description. But Im certain that they wouldn't cause this sort of behavior.

Once the form is submitted, I see that the page that is loaded(after file is uploaded is):
mcClassifiedAds.php

but querystring is not being passed. IE ?mode=savecat

Any Ideas?

Thanks,
Tim

Back to top
musiccreatures



Joined: 20 Jun 2009
Posts: 344
Location: Portland Oregon

Posted: 11/21/09 22:32 
So after trying to get this progress meter to work, I decided to try to copy and paste the sample code from the Developers guide to my modules form controller. I wanted to see how it works, but I am getting the same issue. After the image is uploaded(or I assume it is uploaded) the form is calling the form controller again, but the mode is not being sent.

So instead of: mcClassifiedAds.php?mode=savecat
I see: mcClassifiedAds.php


Code

// Set our progress flag so we know to include the proper js 
$GLOBALS['JR_PROGRESS_ENABLE'] = true; 

jmHtmlBegin('File Upload'); 
$_args = array( 
  'mode' => 'mcClassifiedAds.php|savecat' 
); 
jrProgressFormBegin('mcClassifiedAds.php',$_args); 
jmSpanCell('File Upload','This is the Help',30,'html_modify.png'); 
jmInput('Select a File',"meter_file_1",'file'); 
jrProgressBarHtml(); 
jrFormSubmit('Upload File','undo changes',false,'admin.php',false,true,'media'); 
jmEndForm(); 
jmBodyEnd(); 
jmHtmlEnd(); 


Any Ideas? One thing to note: my previous post mentioned that I had placed the JR_PROGRESS_ENABLE line, twards the top of the document. For this experiment, I commented out that line, so their is only 1 occurance of the line.


Thanks,
Tim

Back to top
musiccreatures



Joined: 20 Jun 2009
Posts: 344
Location: Portland Oregon

Posted: 11/22/09 00:17 
Ok. So I believe I figured a way around this issue. I noticed that If I passed the mode, as suggested in the developer docs, like so:

Code

$_args = array( 
  'mode' => 'mcClassifiedAds.php|save_files' 
); 
jrProgressFormBegin('mcClassifiedAds.php',$_args);


That I wasn't getting the mode passed with the form. I examined the browsers source code and noticed that the hidden form element for mode, had the pipe sign in it:

Code
<input type="hidden" value="mcClassifiedAds.php|upload_done" name="mode"/>


So basically what I did was:

Code

$_args = array(
'mode' => 'savecat'
);
jrProgressFormBegin('mcClassifiedAds.php',$_args);


It seems to be working just fine, but I'd be interested to know if I am going to run into some issues, down the road? Please let me know if I am way off base, with this approach.

Thanks,
Tim

Back to top
Display posts from previous:   
User Support Forum Archive (Read Only)
Jamroom Developers

 
Solutions
• Social Media Platform
• Social Networking Software
• Musician Website Manager
• Community Builder
Products
• Jamroom Core
• Jamroom Addons
• Jamroom Modules
• Jamroom Marketplace
Support
• Support Forum
• Documentation
• Support Center
• Contact Support
Community
• Community Forum
• Member Sites
• Developers
Company
• About Us
• Contact Us
• Privacy Policy
©2003 - 2010 Talldude Networks, LLC.