Jumi - an universal multipurpose module

Discuss the development and implementation of Joomla! modules here.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
iceregent
Joomla! Apprentice
Joomla! Apprentice
Posts: 44
Joined: Tue Jan 30, 2007 5:23 am

Re: Jumi - an universal multipurpose module

Post by iceregent » Thu Mar 29, 2007 8:06 pm

When I go to that website link that you posted, all I can see if a foreign language. How is that supposed to be of any help to me? >:(

User avatar
MarHaj
Joomla! Ace
Joomla! Ace
Posts: 1168
Joined: Fri Jun 30, 2006 5:24 pm
Location: CZ
Contact:

Re: Jumi - an universal multipurpose module

Post by MarHaj » Thu Mar 29, 2007 8:50 pm

Hm....
Jumi pages are in English only. There is an English banner on the frontpage - big and visible - leading there:

http://www.vedeme.cz/index.php?option=c ... Itemid=123

Sorry you have not found it.
MarHaj

iceregent
Joomla! Apprentice
Joomla! Apprentice
Posts: 44
Joined: Tue Jan 30, 2007 5:23 am

Re: Jumi - an universal multipurpose module

Post by iceregent » Thu Mar 29, 2007 9:15 pm

Well, I did manage to find the section that you pointed me to, I installed the module, and pointed the include to my php script, and loaded a content item with a user7 position which I assigned the module to. Ok, I get the same output as when I created my original module. But your documentation that you provide online is very sparse. And there is nothing that tells me how the plugin is used. And I dont see any difference between how this operates and when I create my own module from php. I am willing to try and learn how to use jumi, but I need to be able to pass parameters from one script to the next. I am sure your module can do that, but I havent found the correct information yet. I will keep looking I guess.

Thanks;
Ice

User avatar
MarHaj
Joomla! Ace
Joomla! Ace
Posts: 1168
Joined: Fri Jun 30, 2006 5:24 pm
Location: CZ
Contact:

Jumi plugin release 1.01

Post by MarHaj » Fri Mar 30, 2007 12:56 pm

New version 1.01 of Jumi plugin is available at http://www.vedeme.cz/index.php?option=c ... Itemid=123

Joomla! bug - stripping out the dollar signs $ from the bufferred output - was resolved. See the similar problem resolution on  http://forum.joomla.org/index.php/topic,113850.0.html

Thanks to KatGirl for the bug report.
MarHaj

iceregent
Joomla! Apprentice
Joomla! Apprentice
Posts: 44
Joined: Tue Jan 30, 2007 5:23 am

Re: Jumi - an universal multipurpose module

Post by iceregent » Fri Mar 30, 2007 5:31 pm

Ok, I have a question of you. I have a php script that reads and displays information from a joomla table I added. I use one of the fields to create a clickable link, that I need to send that one single variable on to the next script, so that it can pull more specific data and display it from the joomla table. Can your method of two jumi's communicating with each other, do this? I need to have them both displaying in user7 position.

EDIT* - I noticed that having two jumi moduled assigned to user7 position tries to display them both at the same time. This is not what I need to do. Here is the script that works, notice that the parameter I need to pass on, is depenedant upon which link the user clicks on. The code loops thru and displays the rows from the joomla table one at a time, and loads the passthru link into the code of the display as it goes. This method works in a normal php envirionment, but, how do I get this to work in jumi?

Code: Select all

$query = 'SELECT u.username, p.ProjID ,p.UserID , p.OrigUserID , p.Proj_Name , p.Proj_Original , p.Proj_Type , p.Proj_Desc , p.Proj_File , p.Proj_Date FROM #__projects p , #__users u WHERE p.Proj_Name = p.Proj_Original AND p.UserID = u.id LIMIT 0, 30 ';

// prepare the query in the database connector
$database->setQuery( $query );

// retrieve the rows as objects
$row = $database->loadObjectList();

foreach ($row as $row) {
	$passproj = urlencode($row->Proj_Name);	
     	echo '<table width="100%" border="2" cellspacing="2" cellpadding="2" bgcolor="#84BBD9" bordercolor="#400000">';
    	echo '		<tr>';
    	echo '			<td width="33%"><font face="Arial" color="#000000"> ' . $row->Proj_Name . ' <a href="mod_projdetail.php?passproj=' . $passproj . '" target ="_self">View</a></td>';
    	echo '			<td width="33%"><font face="Arial" color="#000000"> ' . $row->username . ' </td>';
    	echo '			<td width="33%"><font face="Arial" color="#000000"> ' . $row->Proj_Date . ' </td>';
    	echo '    </tr>';
    	echo '</table>' ;  
	 }   	    
?>
The line that sets up the parameter I need to pass on to the next script is this:

Code: Select all

$passproj = urlencode($row->Proj_Name);	
The line that allows the user to click on the link is this one:

Code: Select all

cho '			<td width="33%"><font face="Arial" color="#000000"> ' . $row->Proj_Name . ' <a href="mod_projdetail.php?passproj=' . $passproj . '" target ="_self">View</a></td>';
I hope this is clear enough. As I said, this would normally work in a regular php envirionment, but when I try to pass the variable on and run the next script, it gives me results of:
http://iceregent.com/mstudio/index.php? ... &Itemid=58 66.196.212.243 /mstudio/mod_projdetail.php?passproj=Reality_Dream.mp3 iceregent.com Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; InfoPath.1; .NET CLR 2.0.50727)
So, what is the method to pass on the selected variable parameter and run the next script?

Thanks;
Ice



Thanks
Ice
???
Last edited by iceregent on Fri Mar 30, 2007 6:05 pm, edited 1 time in total.

User avatar
MarHaj
Joomla! Ace
Joomla! Ace
Posts: 1168
Joined: Fri Jun 30, 2006 5:24 pm
Location: CZ
Contact:

Re: Jumi - an universal multipurpose module

Post by MarHaj » Fri Mar 30, 2007 7:19 pm

Wow!
Ice, you seem a much better coder then me.

I can tell you the trick that I have used for two communicating modules. The rest is, I am affraid, on you.

The first module: it is a form that that sends The form sends via POST method data into itself and stores variables into $_SESSION global variables.
The second module: just reads Data from those global variables.
The method works independently on the positions of modules: they can be on the same position as well as different positions.

Because you have no form but clickable links the method won't work unless you change your links into submit buttons formatted as links. And there are tricks how to do that: the easiest one is by css formatting or by some javascript code. You can find them via Google "submit button link" e.g. here: http://www.thesitewizard.com/archive/textsubmit.shtml

Sorry that I di not give you the definite answer. But, as I said, your problem is rather behind my limits.
MarHaj

KatGirl
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Mon Mar 26, 2007 6:03 pm

Re: Jumi plugin release 1.01

Post by KatGirl » Wed Apr 04, 2007 3:29 pm

MarHaj wrote: New version 1.01 of Jumi plugin is available at http://www.vedeme.cz/index.php?option=c ... Itemid=123

Joomla! bug - stripping out the dollar signs $ from the bufferred output - was resolved. See the similar problem resolution on  http://forum.joomla.org/index.php/topic,113850.0.html

Thanks to KatGirl for the bug report.
MarHaj,

Thank you so much for the bug fix!  Sorry I have not replied before now.  I am in the middle of moving and preparing to go back to school so I have been away from my work and my computer for awhile.  I appreciate your quick response and the bug fix.  This will make my development when I get back to my work much quicker.

You have a great plugin it really saved the day for me and your timely bug fix was superb.  I will go leave you some excellent feedback.

Thanks again!

KatGirl

f100tool
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Tue Apr 11, 2006 10:33 pm

Re: Jumi - an universal multipurpose module

Post by f100tool » Thu Apr 05, 2007 8:51 am

Hi MarHaj,

Very cool stuff.  Have been playing around with the demo code from the Jumi site. (My_form.php, My_output.php)
And the below works. . . .
--------------------------------------------------------------
The first module: it is a form that that sends The form sends via POST method data into itself and stores variables into $_SESSION global variables.
The second module: just reads Data from those global variables.
The method works independently on the positions of modules: they can be on the same position as well as different positions.
-------------------------------------------------------------
except. . it seems that the output is delayed by one click.  I will select "Leisure," click and get no output.  I will then select "Money" and get "Leisure" as the output. . 

Am I missing something. .

Thanks.

b

User avatar
MarHaj
Joomla! Ace
Joomla! Ace
Posts: 1168
Joined: Fri Jun 30, 2006 5:24 pm
Location: CZ
Contact:

Re: Jumi - an universal multipurpose module

Post by MarHaj » Thu Apr 05, 2007 5:35 pm

...it seems that the output is delayed by one click...
Hm, it's interesting. I have not succeeded in simulating incorrect behaviour.
I tested with Firefox, IE, Opera, Netscape. Tested on PHP 4 and 5. It still works fine for me.

I am very sorry I have no idea. It could be elsewhere. E.g. in php.ini, a mouse, etc...

For each case I will try to find some clever articles about buggy behaviour of $_SESSION on Internet...
MarHaj

f100tool
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Tue Apr 11, 2006 10:33 pm

Re: Jumi - an universal multipurpose module

Post by f100tool » Thu Apr 05, 2007 6:34 pm

Thanks for checking this out. . .I have a clue. .

In my setup, I had My_Output_module in the left position above the my_form_module.  When i switched their orders. . . the send seemed to function as designed. . .

I suspect that the screen was being redrawn before the $_Session var was set in the My_Form.php code, so the "session_start();" in the My_output.php was picking up whatever was saved previously. . . .appearing 1 step behind.  .

Does this make sense?  (I see that the demo site at vedeme.cz is set up the way I claim creates the problem .. .so I don't think that this is it. . .but hopefully will lead you somewhere.)

b

User avatar
MarHaj
Joomla! Ace
Joomla! Ace
Posts: 1168
Joined: Fri Jun 30, 2006 5:24 pm
Location: CZ
Contact:

Re: Jumi - an universal multipurpose module

Post by MarHaj » Fri Apr 06, 2007 8:24 pm

Dear f100tool,
Your explanation makes sense. Even if the opposite works too. Maybe it depends on the responce time of the whole system. It could be really anywhere. I am still looking for the answer on Internet.
MarHaj

muckluckcanuck
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Sun Feb 04, 2007 9:37 pm

GET LOGGED IN USERNAME

Post by muckluckcanuck » Tue Apr 10, 2007 6:41 pm

Hello,

How can I make my custom PHP script display the current logged in username?

I've tried printing $my->username and $_SESSION['session_username'] and $_SESSION['username'] and none of them displayed the current login username. I tried the session variables with and without session_start();.

Thanks!

User avatar
MarHaj
Joomla! Ace
Joomla! Ace
Posts: 1168
Joined: Fri Jun 30, 2006 5:24 pm
Location: CZ
Contact:

Re: Jumi - an universal multipurpose module

Post by MarHaj » Tue Apr 10, 2007 8:02 pm

Try this piece of code
id) {
  if ( $name ) {
      $name = $my->name;
      } else {
      $name = $my->username;
      }
    echo $name;
?>
MarHaj

muckluckcanuck
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Sun Feb 04, 2007 9:37 pm

Re: Jumi - an universal multipurpose module

Post by muckluckcanuck » Tue Apr 10, 2007 8:08 pm

Thanks MarHaj,

I figured it out... in my php script, I forgot to put "global $my;"

That unleased all the variables that I've been trying...

Awesome script!

mixxing
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Wed Apr 11, 2007 10:40 pm
Contact:

Re: Jumi - an universal multipurpose module

Post by mixxing » Wed Apr 11, 2007 11:17 pm

id) {
  if ( $name ) {
      $name = $my->name;
      } else {
      $name = $my->username;
      }
    echo $name;
?>
I'm having a hard time doing this can you show me an example of the code and complete process to use the plugin to desplay the username in a content item? Sorry if this is lame question I'm a total N00B

f100tool
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Tue Apr 11, 2006 10:33 pm

Re: Jumi - an universal multipurpose module

Post by f100tool » Thu Apr 12, 2007 5:28 am

The concept of "Race Condition" seems relevant. .

http://thwartedefforts.org/2006/11/11/r ... -sessions/

Beyond me however. . .is this where we need to look.

Thanks,

b

User avatar
MarHaj
Joomla! Ace
Joomla! Ace
Posts: 1168
Joined: Fri Jun 30, 2006 5:24 pm
Location: CZ
Contact:

Re: Jumi - an universal multipurpose module

Post by MarHaj » Thu Apr 12, 2007 8:36 am

Mixxing,
the whole code for displaying names in content should look like this:

Code: Select all

<?php
	defined( '_VALID_MOS' ) or die( 'Restricted access' );
	global $my;

	if ($my->id) {
		if ( $name ) {
			$name = $my->name;
		} else {
			$name = $my->username;
		}
	echo "Hello $name!";
	}
?> 
Save the code into the file, e.g. name.php and upload it into your server somewhere under your Joomla directory. For example into includes/mixxing.
Open your content article and write into the appropriate place

Code: Select all

{jumi [includes/mixxing/name.php]}
Save.
And enjoy thhe result: if a user is not logged, he/she sees nothing. If logged, he/she sees Hello cccc!!

Thats all.
MarHaj

User avatar
MarHaj
Joomla! Ace
Joomla! Ace
Posts: 1168
Joined: Fri Jun 30, 2006 5:24 pm
Location: CZ
Contact:

Re: Jumi - an universal multipurpose module

Post by MarHaj » Thu Apr 12, 2007 8:44 am

f100tool!
You are absolutely right!
Ajax technologies are dedicated to problems like this. There are good deal of examples of Ajax modules for Joomla too. Fantastic!

I am affraid I know nothing about Ajax. Sorry.
MarHaj

mixxing
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Wed Apr 11, 2007 10:40 pm
Contact:

Re: Jumi - an universal multipurpose module

Post by mixxing » Thu Apr 12, 2007 5:43 pm

HEy thank you for the response I had tryed that and was pulling all my hair out as it would not work would only show guest when I logged in under any of the user names present in the user list provided by my company. Then I realized from looking a little deeper that Jumi  is working great and I am not losing my mind lol. The programmer for our company that set this up actully has it set up to pull the users from a mssql database so that the user names match up with usernames of other applications. Its actully pretty neat how he did it. Stinks a bit for me though as I I have to start all over trying to solve the problem of displaying the user name...might be hard to do as it seems like this setup is waaaaaaayyyyyyyyy off the reservation - and may be hard to get input on ... Anyone seen these types of setups out there.

Oh but he does have it pulling the actual backend user names and passwords from the standard mysql database. Ie super user and the like. its nucken futs

LordR
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 107
Joined: Tue Jan 10, 2006 3:12 am

Re: Jumi - an universal multipurpose module

Post by LordR » Fri Apr 13, 2007 10:47 pm

Hello!

I have one question:
I want to import a file from another domain. How do I do it?
I have tried to use http://www.domain.com/text.htm.

Then I got the message:
The file  /home/domain/public_html/http://www.domain/text.htm doesn't exist!
Set correct pathname in the admin section of Jumi module, please.

What is the correct pathname?

BR LordR
Mvh LordR

User avatar
MarHaj
Joomla! Ace
Joomla! Ace
Posts: 1168
Joined: Fri Jun 30, 2006 5:24 pm
Location: CZ
Contact:

Re: Jumi - an universal multipurpose module

Post by MarHaj » Sat Apr 14, 2007 5:17 pm

I want to import a file from another domain. How do I do it?
Oh,
I did not expect including files outside Joomla. There are some precoutions in the code. You can easily change it and meet your needs:

In the module there is a line 10:

Code: Select all

$incl_file = $mosConfig_absolute_path . '/' . $params->get( 'file_pathname' );
Change it to

Code: Select all

$incl_file = $params->get( 'file_pathname' );
If you are using pluging change line 58 in the exactly same manner.
Hope this helps!
MarHaj

LordR
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 107
Joined: Tue Jan 10, 2006 3:12 am

Re: Jumi - an universal multipurpose module

Post by LordR » Sat Apr 14, 2007 11:04 pm

Thanks, but it didn´t work

Now I¨w got the message:
The file  http://www.domain/text.htm doesn't exist!
Set correct pathname in the admin section of Jumi module, please.

A litle change, but not enought...
Mvh LordR

User avatar
MarHaj
Joomla! Ace
Joomla! Ace
Posts: 1168
Joined: Fri Jun 30, 2006 5:24 pm
Location: CZ
Contact:

Re: Jumi - an universal multipurpose module

Post by MarHaj » Mon Apr 16, 2007 11:59 am

The file  http://www.domain/text.htm doesn't exist!
Sorry for the delay. I was trying to figure out what happens.
It looks like that PHP function file_exists() that Jumi uses does not work with URL. It works only for PHP 5.x and allow_url_fopen configuration directive. Evidently this is not your case.

So let us delete the exist precations in the Jumi

The easiest quick and dirty way is to substitute line containing

Code: Select all

if (file_exists($incl_file)) {
by this line

Code: Select all

if (1==1) {
Preserve the last change of the code 

Code: Select all

$incl_file = $params->get( 'file_pathname' );
too.
Try it now!
If it works let me know please I can send you a php snippet for URL file existence verification even for PHP4. OK?
MarHaj

LordR
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 107
Joined: Tue Jan 10, 2006 3:12 am

Re: Jumi - an universal multipurpose module

Post by LordR » Mon Apr 16, 2007 2:38 pm

Hello again.

I tried to do what you said, and now I´ve got a blank modul..

The file looks like this now:
get( 'file_pathname' );
if (1==1) {
$dummy = $params->get( 'php_args' );
preg_match_all('/\[.*?\]/', $dummy, $matches);
if ($matches) {
foreach ($matches as $i=>$match) {
$jumi = preg_replace("/\[|]/", "", $match);
}
}
$incl_file = $params->get( 'file_pathname' );
}
else {
echo "The file ".$incl_file." doesn't exist!
Set correct pathname in the admin section of Jumi module, please.";
}
?>

You can see the site I´m working on on www.tingvollfjordhotell.no
The modul is under the picture in the right module.
Mvh LordR

User avatar
MarHaj
Joomla! Ace
Joomla! Ace
Posts: 1168
Joined: Fri Jun 30, 2006 5:24 pm
Location: CZ
Contact:

Re: Jumi - an universal multipurpose module

Post by MarHaj » Mon Apr 16, 2007 5:47 pm

Almost correcty. But you forgot implement previous changes and still have 

Code: Select all

$incl_file = $mosConfig_absolute_path . '/' . $params->get( 'file_pathname' );
that prevents from including site from another URL.

I am sending you the whole and the most simple code.
The whole mod_jumi.php looks as follows:

Code: Select all

<?php
	defined( '_VALID_MOS' ) or die( 'Restricted access' );
	$incl_file = $params->get( 'file_pathname' );
	$dummy = $params->get( 'php_args' );
	preg_match_all('/\[.*?\]/', $dummy, $matches);
	if ($matches) {
		foreach ($matches as $i=>$match) {
			$jumi = preg_replace("/\[|]/", "", $match);
		}
	}
	include($incl_file);
?>
If the file does not exist (or does provide no output) you will see blank module.

I hope that this will work.
MarHaj

LordR
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 107
Joined: Tue Jan 10, 2006 3:12 am

Re: Jumi - an universal multipurpose module

Post by LordR » Mon Apr 16, 2007 5:58 pm

Thanks for trying.. Maybee I do something wrong, but now i got this message:

Warning: main() [function.main]: URL file-access is disabled in the server configuration in /home/fjordno/public_html/modules/mod_jumi.php on line 11

Warning: main(http://www.tingvoll.net/ny/varet.htm) [function.main]: failed to open stream: no suitable wrapper could be found in /home/fjordno/public_html/modules/mod_jumi.php on line 11

Warning: main() [function.main]: URL file-access is disabled in the server configuration in /home/fjordno/public_html/modules/mod_jumi.php on line 11

Warning: main(http://www.tingvoll.net/ny/varet.htm) [function.main]: failed to open stream: no suitable wrapper could be found in /home/fjordno/public_html/modules/mod_jumi.php on line 11

Warning: main() [function.include]: Failed opening 'http://www.tingvoll.net/ny/varet.htm' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php:/usr/safebin') in /home/fjordno/public_html/modules/mod_jumi.php on line 11

Can you find out whats wrong now?
Mvh LordR

User avatar
MarHaj
Joomla! Ace
Joomla! Ace
Posts: 1168
Joined: Fri Jun 30, 2006 5:24 pm
Location: CZ
Contact:

Re: Jumi - an universal multipurpose module

Post by MarHaj » Mon Apr 16, 2007 6:28 pm

So the result of Jumi is good. But your server configuration is not: URL file-access is disabled. Consult server administrator.

But if your problem is just to show external html files in a module postion there is more elegant solution of the problem. It is about using Jumi without any modifications. Hint: your custom php file should use standard html tag for showing the content of external .html pages. It is very esy.
MarHaj

LordR
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 107
Joined: Tue Jan 10, 2006 3:12 am

Re: Jumi - an universal multipurpose module

Post by LordR » Mon Apr 16, 2007 6:42 pm

Thanks again. I´ll contact my server admin...
Mvh LordR

geolaw
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Thu Apr 19, 2007 7:03 pm

Jumi - Include file and DB Queries

Post by geolaw » Thu Apr 19, 2007 7:29 pm

**UPDATE** - I wrapped my code within a function so that all my variables where scoped locally and that did the trick.

Apparently some other module used the $rows or $row variable and that was polluting my jumi code.

IT WORKS!


Jumi seems to be great... but can someone post examples of doing custom queries to other tables and then using the output in a news item?


I have tried  doing something like:

$query = 'SELECT value1,value2 from mytable';
global $database;
// prepare the query in the database connector
$database->setQuery( $query );

if ($database->getErrorNum()) {
  echo $database->stderr();
  exit;
}
// retrieve the rows as objects
$rows = $database->loadObjectList();
if ( count($rows) > 0) {

  foreach ($rows as $row) {
      //output the table...
    echo $row->value1;
    echo $row->value2;
  }
} else {
  echo "no requests";
}

?>


If I end this snippet of code with an exit;  I see my output (but nothing from joomla)

but if I do not include the exit, joomla renders normally except my echo'd output above doesnt appear anywhere..

any ideas?
Last edited by geolaw on Thu Apr 19, 2007 8:43 pm, edited 1 time in total.

DogTags
Joomla! Intern
Joomla! Intern
Posts: 68
Joined: Fri Aug 19, 2005 11:12 pm

Re: Jumi - an universal multipurpose module

Post by DogTags » Sat Apr 21, 2007 2:47 pm

Would love to use JUMI to offer a secure SSL order form

1. The form must be SSL

2. Would like to call a javascript file instead of inserting the javascript in the page

3. Also need to call a CSS file, too

4. Would be great, as well, if JUMI could work with ARTIO Sef

Can JUMI do all of the above using Joomla 1.0.12 ?

Many thanks  :)
Last edited by DogTags on Sat Apr 21, 2007 3:05 pm, edited 1 time in total.


Locked

Return to “Modules”