saad220
asked on
searching directories from xml nodes click value
Hello every one
i am trying to create some function which does the following, it maight be a bit tricky i think so please any idea or help please????
The Question is
i have created tree from xml file using java script and php, the name of the nodes are the (string that i want to search) same as to the search string, so, when some one click the node, how can i be able to search the clicked string against some other folder which contains subfolders and files which (it is so important)the file names is so long and include the path of the tree and include the nodes name???
example
i have tree like AAA
¦
bbb
¦
ccc
and all the files in the folder are by the name like
AAA____________bbb________ ____ccc___ _________d dd________ ____251254 25_6253251 2.txt or other extension like .bin or .log...... And this file is kept under the folder called (ddd).
so if some one click on the node ccc how could i able to search from some folder which include many subfolders to match the name AAA____________bbb________ ____ccc and if the file has this name show the file.???
Please i really need help, i am just stake and preparing to through my self to sea; Help???
i am trying to create some function which does the following, it maight be a bit tricky i think so please any idea or help please????
The Question is
i have created tree from xml file using java script and php, the name of the nodes are the (string that i want to search) same as to the search string, so, when some one click the node, how can i be able to search the clicked string against some other folder which contains subfolders and files which (it is so important)the file names is so long and include the path of the tree and include the nodes name???
example
i have tree like AAA
¦
bbb
¦
ccc
and all the files in the folder are by the name like
AAA____________bbb________
so if some one click on the node ccc how could i able to search from some folder which include many subfolders to match the name AAA____________bbb________
Please i really need help, i am just stake and preparing to through my self to sea; Help???
to clarify it more..I have the following code. some XML File ..and i got the tree using php. the xml file and the tree menu are
<?xml version='1.0' encoding='UTF-8'?>
<cstSta xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<cfgVersion>
<major>1</major>
<release>0</release>
<update>0</update>
<evolution>0</evolution>
</cfgVersion>
<uicCstData>
<uicCstLbl>testCst</uicCstLbl>
<operator>0</operator>
<owner>0</owner>
<nationalAppl>0</nationalAppl>
<nationalVers>0</nationalVers>
<properties>00000000000000000000000000000000000000000000</properties>
</uicCstData>
<vlan>
<id>1</id>
<gateway>10.0.0.1</gateway>
<uniCast>
<netAddr>10.0.0.0</netAddr>
<subNetMsk>255.255.240.0</subNetMsk>
</uniCast>
<multiCast>
<netAddr>239.0.0.0</netAddr>
<subNetMsk>255.255.240.0</subNetMsk>
</multiCast>
<broadcastAddr>10.0.15.255</broadcastAddr>
</vlan>
<switchCfgEntry>
<switchCfgIndex>1</switchCfgIndex>
<dhcpRelay>true</dhcpRelay>
<igmp>
<mCastStop>false</mCastStop>
<autoMode>true</autoMode>
<querier>false</querier>
</igmp>
<rstp>
<rstpRoot>false</rstpRoot>
</rstp>
</switchCfgEntry>
<portCfgEntry>
<static>
<index>1</index>
<vlanMemberId>1</vlanMemberId>
<vlanTagged>false</vlanTagged>
<portQoS>false</portQoS>
<priority>0</priority>
<speed>AUTO</speed>
<portIsolation>false</portIsolation>
<rstpTrunk>false</rstpTrunk>
<igmpTrunk>false</igmpTrunk>
<wanPort>false</wanPort>
</static>
<dynamic>
<index>2</index>
<portQoS>false</portQoS>
<priority>0</priority>
</dynamic>
</portCfgEntry>
<dhcp>
<active>true</active>
<globalConfig>
<vlanMemberId>1</vlanMemberId>
<leaderDevNo>0.0.0.1</leaderDevNo>
<configUnknownClients>
<dynamicCfgIdx>2</dynamicCfgIdx>
<vlanMemberId>1</vlanMemberId>
<leaderRange>
<firstDevNo>0.0.0.201</firstDevNo>
<lastDevNo>0.0.0.210</lastDevNo>
</leaderRange>
<followerRange>
<firstDevNo>0.0.0.211</firstDevNo>
<lastDevNo>0.0.0.220</lastDevNo>
</followerRange>
<defaultLeaseTimeSec>300</defaultLeaseTimeSec>
<maxLeaseTimeSec>600</maxLeaseTimeSec>
<minLeaseTimeSec>60</minLeaseTimeSec>
</configUnknownClients>
<defaultLeaseTimeSec>259200</defaultLeaseTimeSec>
<maxLeaseTimeSec>259200</maxLeaseTimeSec>
<minLeaseTimeSec>60</minLeaseTimeSec>
<declineTimeSec>10</declineTimeSec>
<conflictTimeSec>30</conflictTimeSec>
<offerTimeSec>30</offerTimeSec>
<ping>
<alwaysCheck>false</alwaysCheck>
<timeoutSec>1</timeoutSec>
</ping>
<loggingLevel>DEBUG</loggingLevel>
<logConsole>true</logConsole>
<logFile>false</logFile>
</globalConfig>
<options>
<vlanMemberId>1</vlanMemberId>
<domainNameSvr>0.0.0.1</domainNameSvr>
<ipDefaultTimeToLive>30</ipDefaultTimeToLive>
<interfaceMTU>1500</interfaceMTU>
</options>
</dhcp>
<carSta>
<uicCarData>
<uicIdentifier>0</uicIdentifier>
<properties>000000000000</properties>
</uicCarData>
<iptCarData>
<cstCarNo>1</cstCarNo>
<carId>car01</carId>
<hasCstOrientation>true</hasCstOrientation>
<carType>V1</carType>
</iptCarData>
<groups>
<grpNo>0.0.1.0</grpNo>
<grpLbl>grpAll</grpLbl>
</groups>
<switch>
<type>DR</type>
<hostLbl>RS1</hostLbl>
<devNo>0.0.0.1</devNo>
<vlanMemberId>1</vlanMemberId>
<switchCfgIdx>1</switchCfgIdx>
<port>
<portNo>X2</portNo>
<staticCfgIdx>1</staticCfgIdx>
</port>
<port>
<portNo>X3</portNo>
<staticCfgIdx>1</staticCfgIdx>
</port>
<port>
<portNo>X4</portNo>
<staticCfgIdx>1</staticCfgIdx>
</port>
<port>
<portNo>X5</portNo>
<staticCfgIdx>1</staticCfgIdx>
</port>
<port>
<portNo>X6</portNo>
<staticCfgIdx>1</staticCfgIdx>
</port>
<port>
<portNo>X7</portNo>
<staticCfgIdx>1</staticCfgIdx>
</port>
<port>
<portNo>X31</portNo>
<staticCfgIdx>1</staticCfgIdx>
</port>
<port>
<portNo>X32</portNo>
<staticCfgIdx>1</staticCfgIdx>
</port>
<deviceGroup>
<dynamicCfgIdx>2</dynamicCfgIdx>
<device>
<devNo>0.0.1.10</devNo>
<vlanMemberId>1</vlanMemberId>
<devLbl>MCG_1</devLbl>
<dhcpLbl>MCG_1</dhcpLbl>
<leaseTime>259200</leaseTime>
</device>
</deviceGroup>
<deviceGroup>
<dynamicCfgIdx>2</dynamicCfgIdx>
<device>
<devNo>0.0.1.11</devNo>
<vlanMemberId>1</vlanMemberId>
<devLbl>EDSERVICE_1</devLbl>
<dhcpLbl>EDSERVICE_1</dhcpLbl>
<leaseTime>259200</leaseTime>
</device>
</deviceGroup>
<deviceGroup>
<dynamicCfgIdx>2</dynamicCfgIdx>
<device>
<devNo>0.0.1.12</devNo>
<vlanMemberId>1</vlanMemberId>
<devLbl>CLIENT_1</devLbl>
<dhcpLbl>CLIENT_1</dhcpLbl>
<leaseTime>259200</leaseTime>
</device>
</deviceGroup>
</switch>
</carSta>
<carSta>
<uicCarData>
<uicIdentifier>0</uicIdentifier>
<properties>000000000000</properties>
</uicCarData>
<iptCarData>
<cstCarNo>1</cstCarNo>
<carId>car02</carId>
<hasCstOrientation>true</hasCstOrientation>
<carType>V1</carType>
</iptCarData>
<groups>
<grpNo>0.0.1.0</grpNo>
<grpLbl>grpAll</grpLbl>
</groups>
<switch>
<type>DR</type>
<hostLbl>RS1</hostLbl>
<devNo>0.0.0.1</devNo>
<vlanMemberId>1</vlanMemberId>
<switchCfgIdx>1</switchCfgIdx>
<port>
<portNo>X2</portNo>
<staticCfgIdx>1</staticCfgIdx>
</port>
<port>
<portNo>X3</portNo>
<staticCfgIdx>1</staticCfgIdx>
</port>
<port>
<portNo>X4</portNo>
<staticCfgIdx>1</staticCfgIdx>
</port>
<port>
<portNo>X5</portNo>
<staticCfgIdx>1</staticCfgIdx>
</port>
<port>
<portNo>X6</portNo>
<staticCfgIdx>1</staticCfgIdx>
</port>
<port>
<portNo>X7</portNo>
<staticCfgIdx>1</staticCfgIdx>
</port>
<port>
<portNo>X31</portNo>
<staticCfgIdx>1</staticCfgIdx>
</port>
<port>
<portNo>X32</portNo>
<staticCfgIdx>1</staticCfgIdx>
</port>
<deviceGroup>
<dynamicCfgIdx>2</dynamicCfgIdx>
<device>
<devNo>0.0.1.10</devNo>
<vlanMemberId>1</vlanMemberId>
<devLbl>MCG_2</devLbl>
<dhcpLbl>MCG_2</dhcpLbl>
<leaseTime>259200</leaseTime>
</device>
</deviceGroup>
<deviceGroup>
<dynamicCfgIdx>2</dynamicCfgIdx>
<device>
<devNo>0.0.1.11</devNo>
<vlanMemberId>1</vlanMemberId>
<devLbl>EDSERVICE_2</devLbl>
<dhcpLbl>EDSERVICE_2</dhcpLbl>
<leaseTime>259200</leaseTime>
</device>
</deviceGroup>
<deviceGroup>
<dynamicCfgIdx>2</dynamicCfgIdx>
<device>
<devNo>0.0.1.12</devNo>
<vlanMemberId>1</vlanMemberId>
<devLbl>CLIENT_2</devLbl>
<dhcpLbl>CLIENT_2</dhcpLbl>
<leaseTime>259200</leaseTime>
</device>
</deviceGroup>
</switch>
</carSta>
<carSta>
<uicCarData>
<uicIdentifier>0</uicIdentifier>
<properties>000000000000</properties>
</uicCarData>
<iptCarData>
<cstCarNo>1</cstCarNo>
<carId>car03</carId>
<hasCstOrientation>true</hasCstOrientation>
<carType>V1</carType>
</iptCarData>
<groups>
<grpNo>0.0.1.0</grpNo>
<grpLbl>grpAll</grpLbl>
</groups>
<switch>
<type>DR</type>
<hostLbl>RS1</hostLbl>
<devNo>0.0.0.1</devNo>
<vlanMemberId>1</vlanMemberId>
<switchCfgIdx>1</switchCfgIdx>
<port>
<portNo>X2</portNo>
<staticCfgIdx>1</staticCfgIdx>
</port>
<port>
<portNo>X3</portNo>
<staticCfgIdx>1</staticCfgIdx>
</port>
<port>
<portNo>X4</portNo>
<staticCfgIdx>1</staticCfgIdx>
</port>
<port>
<portNo>X5</portNo>
<staticCfgIdx>1</staticCfgIdx>
</port>
<port>
<portNo>X6</portNo>
<staticCfgIdx>1</staticCfgIdx>
</port>
<port>
<portNo>X7</portNo>
<staticCfgIdx>1</staticCfgIdx>
</port>
<port>
<portNo>X31</portNo>
<staticCfgIdx>1</staticCfgIdx>
</port>
<port>
<portNo>X32</portNo>
<staticCfgIdx>1</staticCfgIdx>
</port>
<deviceGroup>
<dynamicCfgIdx>2</dynamicCfgIdx>
<device>
<devNo>0.0.1.10</devNo>
<vlanMemberId>1</vlanMemberId>
<devLbl>MCG_3</devLbl>
<dhcpLbl>MCG_3</dhcpLbl>
<leaseTime>259200</leaseTime>
</device>
</deviceGroup>
<deviceGroup>
<dynamicCfgIdx>2</dynamicCfgIdx>
<device>
<devNo>0.0.1.11</devNo>
<vlanMemberId>1</vlanMemberId>
<devLbl>EDSERVICE_3</devLbl>
<dhcpLbl>EDSERVICE_3</dhcpLbl>
<leaseTime>259200</leaseTime>
</device>
</deviceGroup>
<deviceGroup>
<dynamicCfgIdx>2</dynamicCfgIdx>
<device>
<devNo>0.0.1.12</devNo>
<vlanMemberId>1</vlanMemberId>
<devLbl>CLIENT_3</devLbl>
<dhcpLbl>CLIENT_3</dhcpLbl>
<leaseTime>259200</leaseTime>
</device>
</deviceGroup>
</switch>
</carSta>
</cstSta>
___________________________________________________________
<?php
echo "<br />";
echo "<a href=\"javascript:Tmenu.flatten('Menu', 'expand')\">Expand All</a> |
<a href=\"javascript:Tmenu.flatten('Menu', 'contact')\">Collaps All</a>";
$Bws = simplexml_load_file('bws.xml');
foreach($Bws->uicCstData as $uicCstData) {
echo "<ul id=\"Menu\" class=\"Tshow\">";
echo "<li>".$uicCstData->uicCstLbl;
echo "<ul rel =\"open\">";
foreach($Bws->carSta as $carSta) {
echo "<li>".$carSta->iptCarData->carId;
echo "<ul>";
foreach($carSta->switch->deviceGroup as $deviceGroup) {
echo "<li><a href=\"files.php\" target=\"frame1\">".$deviceGroup->device->devLbl."</a></li>";
}
echo "</li>";
echo "</ul>";
}
echo "</ul>";
echo "</li>";
echo "</ul>";
}
echo "<script type=\"text/javascript\">Tmenu.buildMenu(\"Menu\", false)</script>";
?>
so know when i get the tree i try to make clickable link linke this line
echo "<li><a href=\"files.php\" target=\"frame1\">".$deviceGroup->device->devLbl."</a></li>";
but the thing which i need to do is when i click the link it take the value of ($deviceGroup->device->devLbl) and search the file which include the string that i click in its name against some directory on the server and dispay only the folder not the files it self.
the file structure look like directory/subdirectory , that means i need to list the subdirectories if they contain file which its name contain the string that i click on the menu tree.
the file name look like this..
z5067__________car03__________CLIENT_2_______cccM___________098874_065210.txt
the file has more than 73 character and the first node which is always one on the tree is z5067__________, but the next may be more than one car, like car03__________ the next CLIENT_2_______ and the folder which the file reside is cccM___________ the numbers are just generated time,
So, please can i ahve some idea how can i be able to identify which node is clicked and check its path to the name of the file in the subdirectopry, and if found show the subfolder as clickable link. is that makes sense???? ohhhhh Please
Doesn't it make your life easier to not use the unusual amounts of underscores in your filenames, but just use a directory structure on your filesystem as well? Besides the structuring impact it will increase your search performance heavily.
ASKER
the problem is i can't change it the file name, because it is some how generated file names, not i give them like this difficult name. so how can i solve it programaticall, any idea coding, or let me if there is some similar tutorial out there
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER