cvs: pear /HTML_Progress2/examples/ajax scriptaculous1.php
| From: | Laurent Laville | Date: | Mon, 22 Jan 2007 18:22:18 +0000 |
| Subject: | cvs: pear /HTML_Progress2/examples/ajax scriptaculous1.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-44341@lists.php.net to get a copy of this message | ||
farell Mon Jan 22 18:22:18 2007 UTC
Added files:
/pear/HTML_Progress2/examples/ajax scriptaculous1.php
Log:
custom example of HTML_AJAX usage with Scriptaculous effect
http://cvs.php.net/viewvc.cgi/pear/HTML_Progress2/examples/ajax/scriptaculous1.php?view=markup&rev=1.1
Index: pear/HTML_Progress2/examples/ajax/scriptaculous1.php
+++ pear/HTML_Progress2/examples/ajax/scriptaculous1.php
<?php
/**
* Custom AJAX example that used Scriptaculous effect at end of user-task process.
*
* @version $Id: scriptaculous1.php,v 1.1 2007/01/22 18:22:18 farell Exp $
* @author Laurent Laville <pear@laurent-laville.org>
* @package HTML_Progress2
* @subpackage Examples
* @access public
*/
if (isset($_GET['reload'])) {
session_start();
unset($_SESSION['progressPercentage']);
session_destroy();
die('Job is over !');
}
require_once 'PEAR.php';
require_once 'HTML/Progress2.php';
PEAR::setErrorHandling(PEAR_ERROR_DIE);
// set this flag to true if you want to reuse a pre-set external style sheet
$reuseCSS = false;
//$reuseCSS = true;
$pb = new HTML_Progress2();
$pb->addLabel(HTML_PROGRESS2_LABEL_TEXT, 'txt1', 'Scriptaculous AJAX Progress2
example 1');
$pb->addLabel(HTML_PROGRESS2_LABEL_TEXT, 'txt2', 'caption ...');
$pb->setLabelAttributes('txt2', array('valign' => 'bottom'));
if ($reuseCSS) {
$pb->setIdent('PB1');
$pb->setBorderAttributes('class=progressBorder');
$pb->setCellAttributes('class=cell');
$pb->setLabelAttributes('pct1', array(
'class' => 'progressPercentLabel',
'align' => 'center'
));
$pb->importStyle('bluesand2.css');
} else {
$pb->setCellCount(20);
$pb->setCellAttributes(array(
'active-color' => '#000084',
'inactive-color' => '#3A6EA5',
'width' => 25,
'spacing' => 0,
'background-image' => 'download.gif'
));
$pb->setBorderPainted(true);
$pb->setBorderAttributes('width=1 style=inset color=white');
$pb->setLabelAttributes('pct1', array(
'width' => 60,
'font-size' => 10,
'align' => 'center',
'valign' => 'left'
));
}
$pb->registerAJAX('auto_server.php', array('RequestStatusAndFx'),
array('all', 'scriptaculous'));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="en">
<head>
<title>Scriptaculous Ajax Progress2 example 1</title>
<?php
if ($reuseCSS) {
echo '<link rel="stylesheet" type="text/css"
href="bluesand2.css" />'."\n";
}
?>
<style type="text/css">
<!--
<?php
if (!$reuseCSS) {
echo $pb->getStyle();
}
?>
body {background-color: #EEEEEE; }
-->
</style>
<script type="text/javascript" src="HTML_Progress2.js"></script>
<?php
echo $pb->setupAJAX();
?>
<script type="text/javascript">
//<![CDATA[
HTML_Progress2.serverClassName = 'RequestStatusAndFx';
HTML_Progress2.serverMethodName = 'updateTask';
HTML_Progress2.onComplete = 'fadeIn';
function fadeIn()
{
new Effect.Opacity(HTML_Progress2.widgetId, {duration:0.5, from:1.0, to:0.4});
}
//]]>
</script>
</head>
<body>
<a href="javascript:HTML_Progress2.start('<?php echo $pb->getIdent();
?>');">Start</a>
<?php $pb->display(); ?>
</body>
</html>