PDA

View Full Version : mydemo



alien3d
20 Jan 2007, 3:50 AM
http://members.lycos.co.uk/alien3d/ajax2/login.php
password are nazilah
The language maybe not english when login .But the consept of yui-ext on real application.Help testing are it quite slow or not
The program only 2 mb only and when compressed only 755kb.Quite marvelous from my older project file size and not to mention even vb compile hello world cost around 10 mb installation file

Animal
20 Jan 2007, 6:49 AM
OK, thanks for sharing.

Couple of things.

The User name is the longer "Hafiz" username.

Give your "west" and "south" regions an initialsize. When you expand them, they expands to zero pixels wide/high!

Add fitToFrame to your center ContentPanel so that we don't get a scrollbar.

I like the "Lihat Mesyuarat". Very cool use of a Grid! The mouseover class of the toolbar buttons disturbs the layout though!

The Excel output. Did you know about XML format Excel? You can create a properly formatted sheet with dates and times and numbers having their correct datatypes and formats.

http://blogs.msdn.com/brian_jones/archive/2005/06/27/433152.aspx

I have the same button on my grid, and I use SAX + XSL to go from a JDBC ResultSet to a fully functional Excel spreadsheet.

And for Word output, you could try FOP: http://xmlgraphics.apache.org/fop/

That would enable you to generate PDF too. It does PDF very well.

Interesting that the tree node "Bahagian Keselamatan Dalam Negeri" wraps when the "west" Region is too small. But it's height is fixed, so it overlays the next node.

I think that could be a yui-ext bug. The CSS should specifiy white-space:nowrap. Perhaps you could report that in the "Bugs" forum?

Very nice looking app! :D

Animal
20 Jan 2007, 7:12 AM
Are you running it on Firefox?

Because I'm up to 50 javascript errors in the console running your app! Not fatal, but there are definitely some errors!

Also, when you have Grid, and selection of a row goes to a new page which shows the details.....

DON'T DO THAT!!! :shock: It's an Ajax application!

Show the details in a pane below the grid so that the Grid doesn't have to be reloaded to go back to it! You'll have to have a BorderLayout with the Grid in the north Region and the details in the center Region.

alien3d
20 Jan 2007, 7:40 AM
1)First of all it's not ajax.It just iframe
2)I used the same content header for excel.
3)For date and time parsing.I had my own special class which can convert mysql date or time to a
proper format
4)I newbie javascript.Still cannot understand the javascript class same as actionscript 1.0 Flash Mx.To weird for me to understand.Other language okay for me .
I show the code


** Maybe the lycos iframe making it more worse.On My computer cool.
For Yun Ham password are irma :)
** I used dreamweaver 8 for debugging

alien3d
20 Jan 2007, 7:48 AM
<?
include("connections.php");
include("./class/class.ezpdf.php");
include("./class/class_mysql_function.php");
include("./class/class_date.php");
include("./class/class_form.php");
$form=new personelClass;
$pdf = new Cezpdf();
$mini=new miniClass;
$dateClass=new dateClass;

// better using push on type
// offset are needed at each page
//before wrong location
$array1[]="offset";
$array2[]=$_GET['offset'];
if(isset($_GET['type']) && !empty($_GET['type']) && (strlen($_GET['type']==0))) { $array1[]="type"; $array2[]=$_GET['type']; }
else { unset($_GET['value']); unset($_GET['type']); }
// unset variable of $_GET['value'] and $_GET['type'] before entering the page
if(isset($_GET['type']) && !empty($_GET['type']) && (strlen($_GET['type']==0))) { $array1[]="value"; $array2[]=$_GET['value']; }

if(isset($_GET['mode'])) { if($_GET['mode']==3) {
$sql="delete from `meeting` where `meetingId`='".$_GET['meetingId']."'";
mysql_query($sql) or die(mysql_error());
$form->redirect("meetings.php?message=terminate");
} }
$limit=15;
if(empty($_GET['date'])) { $_GET['date']=date("Ymd"); }
if(empty($_GET['offset'])) { $_GET['offset']=0; }
$tablename="meeting";
$rowid="meetingId";
if(empty($_GET['order'])) { $_GET['order']="`".$tablename."`.`".$rowid."` desc"; }
$sql="SELECT
*
FROM
`".$tablename."`
where
`".$tablename."`.`departmentId`='".$_SESSION['MM_UserDepartment']."'";

if(empty($_GET['date'])) { $_GET['date']=date("Ymd"); }
if(isset($_GET['calendar'])) { $sql=$mysqlDb->date_query($sql,"meeting","date",$_GET['date'],$_GET['calendar']); }
if(isset($_GET['type'])) {

$rowsort[]="meeting_title";
$rowsort[]="meeting_description";

$sql=$mysqlDb->sort_query($sql,$rowid,$rowsort,$_GET['type']);

}
$result_meeting=$mysqlDb->query_page($sql,$_GET['offset'],$limit,$mysql_version);
$countRecord=$mysqlDb->record();

// plugin pdf,excel and word plugin for idcms module
$array_header=array('No','Tajuk','Masa Mula','Masa Berhenti','Tarikh','Penerangan','Hapus');
if(isset($_GET['request']) && !empty($_GET['request'])) {

// this is portable digital file plugin.

if($_GET['request']=="pdf") {

$pdf->selectFont('./class/fonts/Helvetica.afm');
$pdf->ezText('Interactive Digital Content Management System(IDCMS) For E-Mukim',14);

$pdf->ezText('',12);


$i=0;
// had to do query normal
//$result_pdf=mysql_query($sql) or die(mysql_error()."herer");
// better fetch same as the browser wanted
while( $row=mysql_fetch_array($result_meeting) )
{
$j++;
$data[$i]=array('No'=>$j++,'Tajuk'=>$row['meeting_title'],'Masa Mula'=>$row['starttime'],'Masa Berhenti'=>$row['endtime'],'Tarikh'=>$dateClass->convertDateMysql($row['date']),'Penerangan'=>$row['meeting_description']);
$i++;
}

$pdf->ezTable($data,"","Module Meeting",array('width'=>550,'showHeadings' => 1,'shaded'=> 1));
$pdf->ezText('',12);
$pdf->ezText('© 2007,Interative Digital Content Management System(IDCMS)',10);
$pdf->ezStream();
exit;
}
elseif($_GET['request']=='word') {

// this is word plugin.Using header are more faster then building new active x which sometimes memory leak
header("Content-Type: application/msword");
header("Content-Disposition: attachment; filename=mesyuarat.doc");
header("Pragma: no-cache");
header("Expires: 0");

//recreate back all into simple table without the color property
print"<table border=1 bordercolor=000000 cellpadding=0 cellspacing=0>
<tr>";

for($i=0;$i<(count($array_header) -1);$i++) {
print"<th bgcolor=000000><font color=ffffff>".$array_header[$i]."</font></th>
";
}
print"</tr>";
$q=1;
while($row_word=mysql_fetch_array($result_meeting)) {
print"<tr>
<td>".$q++."</td>
<td>".$row_word['meeting_title']."</td>
<td>".$row_word['starttime']."</td>
<td>".$row_word['endtime']."</td>
<td>".$dateClass->convertDateMysql($row_word['date'])."</td>
<td>".$row_word['meeting_description']."<td>
</tr>";
}
print"</table>";
exit();

}
elseif($_GET['request']=="excel") {

// this is excel plugin.
header("Content-Type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=mesyuarat.xls");
header("Pragma: no-cache");
header("Expires: 0");

//recreate back all into simple table without the color property
print"<table border=1 bordercolor=000000 cellpadding=0 cellspacing=0>
<tr>";

for($i=0;$i<(count($array_header) -1);$i++) {
print"<th bgcolor=000000><font color=ffffff>".$array_header[$i]."</font> </th>";
}
print"</tr>";
$q=1;
while($row_excel=mysql_fetch_array($result_meeting)) {
print"<tr>
<td>".$q++."</td>
<td>".$row_excel['meeting_title']."</td>
<td>".$row_excel['starttime']."</td>
<td>".$row_excel['endtime']."</td>
<td>".$dateClass->convertDateMysql($row_excel['date'])."</td>
<td>".$row_excel['meeting_description']."<td>
</tr>";
}
print"</table>";

exit();

}
}
include("language/".$_SESSION['MM_UserLanguage']."/text.php");
include("./class/class_navigation.php");
include("./class/class_miscellaneous.php");
$miscellaneous=new miscellaneous;
$starttime=$miscellaneous-> excute_time_start();
$ng = new navigation;
// functionize to better close
function meeting_user($meetingId) {
$sql_user_meeting="select * from `meeting_user`,`human` where `meeting_user`.`meetingId`='".$meetingId."' and `meeting_user`.`humanId`=`human`.`humanId`";
$result_user_meeting=mysql_query($sql_user_meeting) or die(mysql_error());
while($row_user_meeting=mysql_fetch_array($result_user_meeting)) {
$text=$row_user_meeting['name'].$text."
";
}
return($text);
}
?>
<html>
<head>
<title>Meeting Management Module</title>
</head>
<link rel="stylesheet" type="text/css" href="css/reset-min.css">
<link rel="stylesheet" type="text/css" href="css/grid.css">
<link rel="stylesheet" type="text/css" href="css/welcome.css">
<script type="text/javascript" language="javascript">
//<![CDATA[
function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}else{ var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}
//]]>
</script>
<script type="text/javascript" src="jscripts/test.js"></script>
<script type="text/javascript" src="jscripts/fat.js"></script>
<script type="text/javascript" src="jscripts/yui-ext.js"></script>
<script language="javascript" type="text/javascript">
/*
* yui-ext
* Copyright(c) 2006, Jack Slocum.
*/

var Example = {
init : function(){
// get the data from web and parse into the yui-ext grid
<? $total_row=@mysql_num_rows($result_meeting); ?>
var myData = [
<? $loop=0; if ($countRecord > 0) { while($row_meeting=@mysql_fetch_array($result_meeting)) {
$loop++;



// here you have to loop data
echo "[

'".$loop."',

'<a href=mmeeting.php?mode=2&meetingId=".$row_meeting['meetingId']." style=\'text-decoration:none;\'><font color=000000>".$miscellaneous->stripparagraph($row_meeting['meeting_title'])."</font></a>',

'<a href=mmeeting.php?mode=2&meetingId=".$row_meeting['meetingId']." style=\'text-decoration:none;\'><font color=000000>".$row_meeting['starttime']."</font></a>','<a href=mmeeting.php?mode=2&meetingId=".$row_meeting['meetingId']." style=\'text-decoration:none;\'><font color=000000>".$row_meeting['endtime']."</font></a>',

'<a href=mmeeting.php?mode=2&meetingId=".$row_meeting['meetingId']." style=\'text-decoration:none;\'><font color=000000>".$dateClass->convertDateMysql($row_meeting['date'])."</font></a>',

'<a href=mmeeting.php?mode=2&meetingId=".$row_meeting['meetingId']." style=\'text-decoration:none;\'><font color=000000>".addslashes($row_meeting['meeting_description'])."</font></a>',

";
// making the code more complex then ever if pull searching style
if(($_SESSION['MM_UserGroup']=="manager") or ($_SESSION['MM_UserGroup']=="hr")) {
echo "'<a href=javascript:deletepage(".$row_meeting['meetingId'].")><font color=000000>". $language[$_SESSION['MM_UserLanguage']]['data']['delete']."</font></a>']";
} else { echo '\'You don\'t have exclusive right to delete\']'; }
if($total_row==$loop) { } else { echo ","; }
// just to make sure code not faiil
} }
echo "];"; ?>

var dataModel = new YAHOO.ext.grid.DefaultDataModel(myData);
// the DefaultColumnModel expects this blob to define columns. It can be extended to provide // custom or reusable ColumnModels
var colModel = new YAHOO.ext.grid.DefaultColumnModel([
<?
//using array to shorten code
$array_header=array('No','Tajuk','Masa Mula','Masa Berhenti','Tarikh','Penerangan','Hapus');
$total=count($array_header);
for($i=0;$i<$total;$i++) {
print "{header: '".$array_header[$i]."', width: 110, sortable: true}";
if(($total -1)== $i) { } else { echo ","; }
} ?>
]);
// create the Grid
var grid = new YAHOO.ext.grid.Grid('example-grid', dataModel, colModel);
grid.render();

}
}
YAHOO.ext.EventManager.onDocumentReady(Example.init, Example, true);
</script>

Animal
20 Jan 2007, 9:44 AM
1)First of all it's not ajax.It just iframe
2)I used the same content header for excel.
3)For date and time parsing.I had my own special class which can convert mysql date or time to a
proper format
4)I newbie javascript.Still cannot understand the javascript class same as actionscript 1.0 Flash Mx.To weird for me to understand.Other language okay for me .
I show the code


** Maybe the lycos iframe making it more worse.On My computer cool.
For Yun Ham password are irma :)
** I used dreamweaver 8 for debugging

OK, you can still do a similar thing with Iframes. Put the detail view page in an iframe in another Region, and target that from your Grid's links. It's just that building a Grid is expensive both on the server (doing a query) and the client, and going back from detail to grid gets tedious.

I see you are using PHP, so nice tools like SAX and XSLT and FOP aren't available to you!

You could still generate Excel XML though - it's not hard to do programatically from tabular data.

alien3d
21 Jan 2007, 3:43 AM
Try before ajax but it more hunger memory process.This software only on local intranet.Just testing to make sure if the program expand more client if host at the internet.The requirement for this technology quite high.Something need to be done on css file such as saparete the theme as
yahoo.ext.blue.layout.css
yahoo.ext.vista.layout.css
to much include file

tryanDLS
21 Jan 2007, 8:45 AM
Your post doesn't make a whole lot of sense, but if you're saying that you want separate themes in css, look at the .40 code in SVN - multiple themes have bee created in separate css files. If you're concerned about the number/size of the includes, there are a number of threads discussing compressing the files and the pros/cons of multiple small includes vs fewer large includes.