Populating MX:Tree with Directory Structure using PHP
Hello,
I have written the following php function to return the directory structure :
public function get_dir_iterative()
$dir = 'data';
$exclude = array( 'cgi-bin', '.', '..' );
$folders = '<?xml version="1.0"?>';
$folders .= "<node label='Root' path=\"data\">";
//$folders .= $this->getFolderRecuring("data");
$exclude = array_flip($exclude);
$dh = opendir($dir);
//$stack = array($dh);
//$level = 0;
//closedir(array_shift($stack));
while(count($stack))
if(false !== ( $file = readdir( $stack[0] ) ) )
if(!isset($exclude[$file]))
if(is_dir($dir . '/' . $file))
$dh = opendir($dir . '/' . $file);
if($dh)
$folders .= "<node label=\"$file\" path=\"$dir/\" isBranch=\"true\" />";
array_unshift($stack, $dh);
++$level;
else
$folders .= "<node label=\"$file\" path=\"$dir/\">";
else
closedir(array_shift($stack));
--$level;
$folders .= "</node>";
return $folders;
When I test this function manually it returns the proper structure.
But when I call it with help of ZendAMF there is nothing returned and the sandclock is spinning infinite ?!
here is the flex part:
private var fms:RemoteObject = new RemoteObject();
protected function initFileManagerService():void
fms.destination ='zend';
fms.source='FileManagerService';
fms.showBusyCursor=true;
fms.addEventListener( FaultEvent.FAULT, faultListener);
fms.get_dir_iterative.addEventListener( ResultEvent.RESULT, load_result );
trace('FileManagerService initialized');
public function load():void
fms.get_dir_iterative();
trace('Service / load');
private function load_result( e:ResultEvent ):void
trace('result:'+e.result)
My zend setup is working, any idea what could be wrong ?
>if you comment out the php and just return "hello" do you get it back in flex?
Jip, thats working
>is this line right?>fms.get_dir_iterative.addEventListener( ResultEvent.RESULT, load_result );
Yes it is correct, thats the way you listen for a result of a specific function when using the zend framework.
I have other projects running very good like this.
Similar Messages
-
Copying complete directory structure using java.io.File
Is there a solution to problem when you want to copy a complete directory structure using java.io.File class as you can copy when using FTP connection.
Is there a solution to problem when you want to copy
a complete directory structure using java.io.File
class as you can copy when using FTP connection.FTP does not have a command to transfer all the files in a directory. FTP clients implement this by invoking single file transfer for each file in a directory. -
Help me out with Directory structure for JSF+SPRING+HIBERNATE Project
Hi frnds ,
My name is Walter working for a startup software company . We are working on Hospital Management System (HMS) project .. MVC Architecture ...using Hibernate Spring and JSF ..we need to design Directory Structure for our project..
plzz help me friends in suggesting MVC Directory structure ...? also plzz help me by directing me with the navigation flow?
Thnxx in advance
Regards
WalterThank you so much .. friends ..for your kind replies..thanks to Illu, anguquga and special thanks to BalusC for giving me the advice for hiring EE Artitech ..
Anyways I have discussed with my teammates designing the directory structure
anguquga your directory structure is close to what I have designed ..referiing to a sample application on web..
Hospital Management system MVC architecture Directory structure
This is the way the structure goes on ..
model --> for Hibernate as well as Spring
View --> for JSF
src(-)
|
------(-) java
|
-------(-) model
|
------(+) businessobject
|
------(-) dao
|
------(+) hibernate
|
------(+) exception
|
------(-) service
|
------ (+) impl
|
------(+) util
(-) view
|
------(+) bean
|
------(+) builder
|
------(+) bundle
|
------(+) servicelocator
|
------(+) util
|
------(+) validator
(-) Web or WebRoot
|
----- (-) JSP Files�etc.,
|
----- (-) META-INF
|
------ (+) Images
|
------ (+) Scripts ==== CSS (cascading style sheets, JavaScript files etc.,)
|
----- (-) WEB-INF =========xml files web.xml, faces-config.xml etc.,
|
-----(-) Classes
|
-----(-) HMS
|
----- (+) model
|
----- (+) view
|
----- (+) lib
I am sure you may notice few errors .. if u find any plzz reply me back.... thnxx in advance for replies...and thnxx for giving your valuable replies...
Walter (Kaleem) -
Compressing directory structure using lzma sdk (7z)
Hi everyone!
I'm a beginner in things like this, but I need to call some compression method to compress some directory structure. I considered using lzma sdk but I don't have any idea how to do this work with directories. Do I have to copy directory structure and compress files in these directories? How to make one archive file then?
Oh. I'm using package SevenZip and its main method from LzmaAlone.
Does anyone knows the idea?
Thanks in advance...lzma sdk is written in java and can be used in java applications. Maybe there is someone who did something like this in the past - called methods from SevenZip package from his own project to compress directory structure, not only single file.
-
Populating a table with two columns using a custom bean
hello,
Can someone provide me or give me a link to an example of populating a table (with two columns) with a custom bean?
thank you
fwu1)create a java class
2)have a list as a class variable
3) populate the list in the constructor..
4) map the values in the af:table
//Employee pojo
public class Employee {
public Employee() {
super();
private String empName;
private String empManager;
private String job;
public void setEmpName(String empName) {
this.empName = empName;
public String getEmpName() {
return empName;
public void setEmpManager(String empManager) {
this.empManager = empManager;
public String getEmpManager() {
return empManager;
public void setJob(String job) {
this.job = job;
public String getJob() {
return job;
//maanged bean
public class Bean {
private List<Employee> employee;
public Bean() {
super();
employee = new ArrayList<Employee>();
Employee e1 = new Employee();
e1.setEmpName("xxxxx");
e1.setEmpManager("xxxxxxxx");
e1.setJob("xxxxxxx");
Employee e2 = new Employee();
e2.setEmpName("yyyyyyy");
e2.setEmpManager("yyyyyyy");
e2.setJob("yyyyyyt");
Employee e3 = new Employee();
e3.setEmpName("zzzzzz");
e3.setEmpManager("zzzzzzz");
e3.setJob("zzzzzzzz");
employee.add(e1);
employee.add(e2);
employee.add(e3);
employee.add(e4);
public void setEmployee(List<Employee> employee) {
this.employee = employee;
public List<Employee> getEmployee() {
return employee;
}in the table map like
<af:table value="#{Bean.employee}" var="row" rowBandingInterval="0"
id="t1">
<af:column headerText="Employee Name" id="c1">
<af:inputText value="#{row.empName}" id="it5"/>
</af:column>
<af:column headerText="Employee Manager" id="c2">
<af:inputText value="#{row.empManager}" id="it2"/>
</af:column>
</af:table> -
Problem with Join Queries using PHP and an Orcale Database
Ok, I am trying to build a simple php querying tool for my oracle database and for the most part it is working however I am having a problem getting data from my join queries. If I run the following query :
QUERY:
SELECT lastfirst,EnteredBy,Debit FROM students sts JOIN GLDetail gl ON gl.studentid=sts.id
RESULT SET:
Lastfirst EnteredBy Debit
caiu, test 204 1
But when I run the query correctly I get no results
QUERY:
SELECT sts.lastfirst,gl.EnteredBy,gl.Debit FROM students sts JOIN GLDetail gl ON gl.studentid=sts.id
RESULT SET:
sts.lastfirst gl.EnteredBy gl.Debit
and if I run the query combining the two above methods and adding a field (schoolid) that has the same name on both table I get the following result sets
QUERY:
SELECT lastfirst,EnteredBy,Debit,sts.schoolid FROM students sts JOIN GLDetail gl ON gl.studentid=sts.id
RESULT SET:
lastfirst EnteredBy Debit sts.schoolid
caiu, test 204 1
QUERY:
SELECT lastfirst,EnteredBy,Debit,schoolid FROM students sts JOIN GLDetail gl ON gl.studentid=sts.id
RESULT SET:
NONE
Therefore, I have to have something written incorrectly in my php code and I just can not figure it out. My entire code is pasted below please provide me with an assistance you might have to offer. I have change the odbc_connec line so I could post it to this forum. In addition, I had to phrase out the column headers there for when you write the column headers you have to use ~ instead of , as the separator and then I turn back into the correct format for sql.
//These scripts just open help windows if somone clicks on the icon
<script>
function submit()
{document.sqlform.submit();}
</script>
<script>
function colwin(){
window.open("colnames.php",null,"height=300,width=400,scrollbars=1");}
</script>
<script>
function tabwin(){
window.open("tablenames.php",null,"height=300,width=400,scrollbars=1");}
</script>
<script>
function help(){
window.open("http://www.w3schools.com/sql/default.asp",null,"height=500,width=700,scrollbars=1");}
</script>
<form method="post" action="<?php echo $PHP_SELF;?>" name="sqlform">
<?php
//Cookie to check for authorization to the site
if($_COOKIE['cookie']=="CheckCookieForAuth")
//These get the values of the textareas after the form has been submitted
$sqlSELECT = $_POST["SELECT"];
$sqlFROM = $_POST["FROM"];
$sqlJOIN = $_POST["JOIN"];
$sqlWHERE = $_POST["WHERE"];
$sqlOTHER = $_POST["OTHER"];
$sqlSELECTTYPE = $_POST["SELECTTYPE"];
//This is the variable used to parse out my headers the user entered
$sqlColNames = split('~',$sqlSELECT);
//This converts the ~ separator to , so I can actually use it as part of my sql string
$search = array('~');
$replace = array(',');
$mystring = $sqlSELECT;
$sqlString = str_replace($search, $replace, $mystring);
//These are the textareas and the drop down options that the end users has to create queries
echo "<table border=0>";
echo "<tr><td valign='top'>";
echo "<B>SELECT TYPE</B> <BR><SELECT NAME=SELECTTYPE>
<OPTION VALUE='SELECT' SELECTED>SELECT</OPTION>
<OPTION VALUE='SELECT DISTINCT'>SELECT DISTINCT</OPTION>
<OPTION VALUE='INSERT'>INSERT</OPTION>
<OPTION VALUE='UPDATE'>UPDATE</OPTION>
<OPTION VALUE='DELETE'>DELETE</OPTION>
</SELECT>";
echo "</td><td>";
echo "<textarea rows=2 cols=75 name=SELECT wrap=physical>$sqlSELECT</textarea>";
echo "</td><td valign='top'>";
echo "<img src='images/sqlC.jpg' width='25' height='25' onclick='colwin()'>";
echo "</td></tr>";
echo "<tr><td valign='top'>";
echo "<b>FROM</b>";
echo "</td><td>";
echo "<textarea rows=2 cols=75 name=FROM wrap=physical>$sqlFROM</textarea>";
echo "</td><td valign='top'>";
echo "<img src='images/sqlT.jpg' width='25' height='25' border=0 onclick='tabwin()'>";
echo "</td></tr>";
echo "<tr><td valign='top'>";
echo "<b>JOIN</b>";
echo "</td><td>";
echo "<textarea rows=2 cols=75 name=JOIN wrap=physical>$sqlJOIN</textarea>";
echo "</td></tr>";
echo "<tr><td valign='top'>";
echo "<b>WHERE</b>";
echo "</td><td>";
echo "<textarea rows=2 cols=75 name=WHERE wrap=physical>$sqlWHERE</textarea>";
echo "</td></tr>";
//This is where the end user would enter group by, having, order by, etc..
echo "<tr><td valign='top'>";
echo "<b>OTHER</b>";
echo "</td><td>";
echo "<textarea rows=2 cols=75 name=OTHER wrap=physical>$sqlOTHER</textarea>";
echo "</td></tr>";
This is a run query icon and a help icon
echo "<tr><td colspan=2 align=right>";
echo "<img src='images/RunQuery.jpg' width='30' height='28' onclick='submit()'> <img src='images/qm.jpg' border=0 width='25' height='25' onclick='help()'>";
echo "</td></tr></table>";
echo "<br>";
echo "<br>";
//This is where I connect to my remote oracle database
$conn=odbc_connect('ODBC_ConnectionName','USERNAME','PASSWORD');
//This is the sql string created by the end users
$sql="$sqlSELECTTYPE $sqlString FROM $sqlFROM $sqlJOIN $sqlWHERE $sqlOTHER";
//This executes the connection string and the sql string
$rs=odbc_exec($conn,$sql);
//This will display the query or a message if the query is empty
if($rs!=NULL){
echo "<table border=1>";
echo "<tr>";
//This loops through the string array the end user enter the field name text area to get column headers
for($i=0; $i<count($sqlColNames); $i++)
echo "<td>";
print_r($sqlColNames[$i]);
echo "</td>";
echo "</tr><tr>";
//This actually fetchs the rows from the statement and then display the data based on the column names the end user speificed
while (odbc_fetch_row($rs))
for($i=0; $i<count($sqlColNames); $i++)
$results=odbc_result($rs,$sqlColNames[$i]);
echo "<td>$results</td>";
echo "</tr>";
odbc_close($conn);
echo "</table>";}else{echo "Results will be displayed here";}
echo "<br><br>";
echo $sql;
else
echo "Not logged in";
?>
</form>This looks more like a SQL question than a PHP issue. There are a couple of JOIN examples at http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_10002.htm#i2066611 that might you work through the problem.
-
DW CS5, Sending contact form results to email with page redirection using php script
I am currently building a site from scratch with Dreamweaver, with the intent of replacing my current website layout that was designed using Intuit's website builder. My dreamweaver site is not online, but i have setup a local test server on my computer, using XAMPP, and i have an apache server with a MySQL database and a mercury mailserver running. I mention that in case it makes a difference in your answers. If necessary, I can include those settings, but that may be asking too much.
I have an html contact form for users to schedule service appointments. I need the resulting actioned php file to do the following after submit is clicked: verify certain fields have been entered; prevent spammers or verify human visitors; send the form results to a (hidden from public view of any kind) email address; redirect user to a confirmation page, or an error page.
I found the following code but being less than a newbie im not sure what needs to be changed, or if its even the right script i should be using:
5 <?php
6 $email = $_POST['email'];
7 $mailto = '[email protected]';
8 $mailsubj = 'You Have a Service Request';
9 $url = '/MyLandingPage.html';
10 $req = '0';
11 $mailbody = "Results from form:\r\n";
12 $space = ' ';
13 $line = '
14 ';
15 foreach ($_POST as $key => $value)
16 {
17 if ($req == '1')
18 {
19 if ($value == '')
20 {echo "$key is empty";die;}
21 }
22 $j = strlen($key);
23 if ($j >= 20)
24 {echo "Name of form element $key cannot be longer than 20 characters";die;}
25 $j = 20 - $j;
26 for ($i = 1; $i <= $j; $i++)
27 {$space .= ' ';}
28 $value = str_replace('\r\n', "$line", $value);
29 $conc = "{$key}:$space{$value}$line";
30 $text .= $conc;
31 $space = ' ';
32 }
33 mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
34 echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
35 ?>
Can anyone please illuminate me on what I need?
Thank You in advanceTake a read here, this might enlighten you a little.
http://www.paulgdesigns.com/learncontactform.php
You are doing this with your local testing server, is it set up to email?
Gary -
How can I deploy a jar with directory entries using deploy profiles?
Hi,
I'm trying to deploy a jar file using deloy profiles, but the jar file deployed contains no directory entry. Why?
Is it possible to do that using deploy profiles?my project looks like this:
src +
- test
+- Main.java
+- Test.java
when I create a jar with 'jar -cf‘, I get something like this (with flat folders view):
META-INF
test
Main.class
MANIFEST.MF
Test.class
but when I use deploy profile to deploy a jar, I get this:
Main.class
MANIFEST.MF
Test.class
The directory entries are missing in the jar file.
How can I fix this?
Edited by: zeta on 2013-3-29 上午11:15
Edited by: zeta on 2013-3-29 上午11:24
Edited by: zeta on 2013-3-29 上午11:24
Edited by: zeta on 2013-3-29 上午11:25
Edited by: zeta on 2013-3-29 上午11:26 -
Browse directory structure using JSF
Hello again....
I am facing a problem with my program. I am trying to open a browse directory window when i click on a button in a jsp page.... Is there any way to do it in JSF?????
regards
JunaidWe use the myfaces tag x:inputFileUpload. Check it out...you'll need to do so by example, though. Their documentation sucks, and they know it. They just point you to the examples.
-
How to build a BIG TREE with Tree-Form layout
Hi,
I do have a self-referenced table with our org structure - 15 000 positions.
I do want to create a tree with this structure.
Requirements :
a, to have a tree-form layout
b, to have search capabilities
I have tried to use several combinations (maybe all)
- from using only one View object and create recursive tree - doesn't even run
- to use two View objects, first as top level nodes, the other as the rest - it runs
but I can search only top level, and what is worse, by clicking on the node for showing additional information (tree-form layout) I'm waiting for ages for seeing the info
(it seems that all records are loaded one by one into AS)
Could you provide some ideas how to deal with this ?
Thanks.I am sorry, this is beyond the scope of this forum.
As with any functionality not directly provided by JHeadstart, you can build it yourself using the ADF design time tools in JDeveloper. Please use the JDeveloper forum for help on this first step.
Then, to keep your pages generatable you can move these customizations to custom templates. We are happy to help you with this last step, should you have problems there.
Steven Davelaar,
JHeadstart Team. -
Directory structure support and sluggish touch screen
I bought a Zen X Fi2. My expectations were high since I already had a creative some years ago. (I was quite pleased with the performance and sound quality etc)
However I am a bit dissapointed with Zen XFi2- The touch screen is not very successful. The scroll function does not work at a satisfactory level and sometimes (when I want to scroll), it makes a "selection" rather than "scrolling".
Also it does not support browsing with directory structure. For those people (like me) who are quite used to drag and drop type of copying for mp3 files, it is really a pain to re arrange all the songs for ID3 tag information.
I believe these two issues are software issues and can be improved by new firmware upgrade.
I also want to take this opportunity to tell that the software (interface software) that comes with the device is totally crap- I have never seen a software that tries to control the user rather than the user controlling the software. An ideal interface software for such a device should be the one which allows user to choose the songs from any directory, drag and drop into the device.
I was going to return my Zen however after playing around for a few days, I somewhat get used to its sluggish touch screen behaviour and accepted ID3 tag browsing (which still gives me a lot of problem) so right now I am gonna keep it.
May be software developpers can work on touch screen improvement, adding the support for directory structure browsing (as well as ID3 tag browser) and work on interface software a bit more ?
Thanks
Best RegardsThis is indeed interesting because when you say "I don't have the problems you mentioned" I believe you also refer to the sensitivity of the touch screen. This makes me ask the question if my item has some problems. Since I do not have any means of cross checking this (apparently there is no other Zen XFi2 around me) may be I should ask you this question: "When you want to browse among albums for example, you wipe your finger across the screen so the screen rolls down; can you have it fluently like in an IPOD touch?- or does it not recognize immediately and you have to do it again sometimes?"
As for the volume button- I do indeed agree. For devices like this one; having physical buttons for at least volume, mute, stop/pause is a "must"! Choosing, browsing or starting a song is not a big deal however muting, stopping or changing the volume may be needed instantly from time to time. It is very unpractical to browse for volume, find it and adjust it!
Also may I add that for such a nice device, there should be a remote control on the headphone/earphone cable and should employ at least stop/play/mute/volume/forward/reverse buttons. I mean think about it for a while- why would you want to take use this device- apparently not to watch movies at home! You take it with you and listen to music, while cycling, jogging, skiing, roller blading etc. It is so difficult taking out the device from your pocket, browsing for volume button and turning up and down the volume (while cycling for example!) or skipping to next song with one touch!
Cheers -
Directory structure and files in Oracle Application server 10g and 11g
Hi all,
I am doing a lab migration from 10g to 11g based on the use of JAXB. There were some directory structures used in 10g to store the JAXB jar files and some other custom jar files. I want to know the equivalent folder structures in SOA 11g server. The 10g server directories are mentioned below:-
1.<OracleAS_Home>\webservices\lib.
2. server.xml located at <OracleAS_Home>\j2ee\home\config in 10g. Where can I find the equivalent file to "server.xml" in 11g server?
3. <OracleAS_Home>\bpel\system\classes\com\oracle\bpel\xml\util.
4. <OracleAS_Home> \bpel\system\classes.Here are the equivalents as per best of my knowledge:
1. <WebLogic Home>\server\lib
For example, D:\Middleware\wls1036\wlserver_10.3\server\lib
2. config,xml located at <Domain_Home>\config\
For example, D:\Middleware\wls1036\user_projects\domains\ArunBaseDomain1036\config\config.xml
3. It should be the same as 10g (instead of OracleAS_Home, it will be ORACLE_Home) if you install the BPEL product. Since, I have not installed BPEL/SOA, I am not very sure.
4. It should be the same as 10g (instead of OracleAS_Home, it will be ORACLE_Home) if you installed the BPEL product.
Also, I would recommend that you consider using ORACLE Smart Upgrade (JDeveloper component) to help you with the upgrade process. It exactly points out these mappings of file/directory structures AND the necessary configuration changes as well.
If you are requirement, is only about making the library jars available to your application, then consider reading the below discussion.
Re: XIncludeAwareParserConfiguration cannot be cast to XMLParserConfiguration
Arun -
How get SharePoint Library Folders and Files directory structure in to my custom web site.
Hi,
Actually my requirement is, I would like to pass site name and document library name as a parameter and get a folders and files from the document library and form the directory structure by using Treeview control in my web site.
How should i get? Using Web service / object model?
Web service would return the dataset as a result so from that how could i form the directory structure using Treeview control.
I will select specified files and folders then i ll update sharepoint document library columns for corresponding selected files.
Can anyone help over this, that would be great appreciate.
Thanks in Advance.
Poomani SankaranHello,
Here is the code to iterate through sites and lists:
//iterate through sites and lists
SPSecurity.RunWithElevatedPrivileges(delegate()
using (SPSite site = new SPSite(webUrl)) {
using (SPWeb oWebsite = site.OpenWeb())
SPListCollection collList = oWebsite.Lists;
foreach (SPList oList in collList)
{//your code goes here }
Then use RecursiveAll to get all files and folders.
http://www.codeproject.com/Articles/116138/Programatically-Copy-and-Check-In-a-Full-Directory
http://sharepoint.stackexchange.com/questions/48959/get-all-documents-from-a-sharepoint-document-library
Here is the full code:
http://antoniolanaro.blogspot.in/2011/04/show-document-library-hierarchy-in-tree.html
Hope it could help
Hemendra:Yesterday is just a memory,Tomorrow we may never see
Please remember to mark the replies as answers if they help and unmark them if they provide no help -
A question regarding Directory Structure
hi....
can ne one tell me how to display a directory structures using JTree....
how can i get or retrieve a directory information from a disk
BYETake a look at this. This is a complete example.
http://manning.com/sbe/files/uts2/Chapter17html/Chapter17.htm
You can even download the book for free. http://manning.com/sbe -
Working with large data and PHP
Using a backend MySQL database, I'd like to interact with
this data using PHP. I got information from one link:
http://www.sephiroth.it/tutorials/flashPHP/pageable_recordset/
Which is exactly what I need. Page the Mysql server every
time you need to grab data and also have a listener that will
automatically update the client. However I can't seem to get it
work. Does anyone know how to make this happen using a repeater and
a panel?Read Developper's Guide at
http://www.adobe.com/support/documentation/en/flex/.
You'll find everything there !
Maybe you are looking for
-
Magic Mouse need view all open applications....
is it possible to have the same option to view the open applications in the new magic mouse, im a programer and always in need to haver several applications and run between them ... just bought the magic mouse its great loving it , but please insert
-
Error: No Receiver could determined
Hi all: I am setting up one scenario about ' XML to IDOC '. When I send XML from one R3 system to XI , I meet with the following errors. "No receiver could be determined" Anybody could help? Thank you, Mohamed.
-
Hi, How to post an article in SDN..can any one let me know. I want to post one article which is a step by step guide for handling outbound IDOC errors through workflow and sending notification to outlook mail box. Regards, Krishnakumar
-
Hi Is there any way to make a trial time for a Java programm ?
-
ITunes has stopped responding .. CD Import. ITunes 9
itunes has stopped working. Every time i place a music cd in the dvd rom and it starts to load itunes stops working. i remove the cd and launch itunes again and it works fine as soon as i insert a cd it stops again, and its any cd this has only happe