Solved

searching directories from xml nodes click value

Posted on 2008-06-11
5
198 Views
Last Modified: 2013-12-13
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____________ddd____________25125425_62532512.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???
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

Open in new window

0
Comment
Question by:saad220
  • 3
5 Comments
 

Author Comment

by:saad220
ID: 21761237
I am really looking any idea Please???
0
 
LVL 49

Expert Comment

by:Roonaan
ID: 21773224
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.
0
 

Author Comment

by:saad220
ID: 21775778
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
0
 

Accepted Solution

by:
saad220 earned 0 total points
ID: 21811234
I finally found out from other developer, here around me. But i am not happy for the expert comments, it wasn't satisfactory to me at all.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Sort Multidimensional Array 11 33
XML XSLT If loop 4 19
PHP Undefined Index in HTML Form? 2 31
WordPress syntax 2 24
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now