AutoHotkey Community

It is currently May 26th, 2012, 9:09 pm

All times are UTC [ DST ]




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 215 posts ]  Go to page Previous  1 ... 9, 10, 11, 12, 13, 14, 15  Next

Do you find this group pf wrapper functions for IE Automation Usefull
no you suck 8%  8%  [ 3 ]
need better Documentation 28%  28%  [ 10 ]
What is DHTML i dont understand how this helps 11%  11%  [ 4 ]
I use Firefox this is a stupid idea 28%  28%  [ 10 ]
I know DHTML this is a reasonably good AHK adaption 6%  6%  [ 2 ]
This is the best DHTML too in the AHK Forum 19%  19%  [ 7 ]
Total votes : 36
Author Message
 Post subject:
PostPosted: July 2nd, 2009, 11:21 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
smikkelsen(not logged in) wrote:
.... I just have no idea how to go about this.

Looks like your navigating a table
you could do something like this
Code:
com_invoke(pwb,"document.getElementsByTag[table].item[0].rows.item[1].cols.item[2].innerText")
the above would for example read the text of the 3rd cell of the second row of the first table in the document. remember all indexes are 0 based.
I think with a little experimentation you could test each row in one column for what your seeking and then take action in another column that same row.

I wont do it for you for free but i think you get the idea and can figure the rest out

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 3rd, 2009, 2:05 am 
Offline

Joined: June 24th, 2008, 8:30 am
Posts: 126
I think I get the concept. I would do some sort of loop to find the one i'm looking for, and then once i've captured the id or name of that dom object, I would then be able to use the iweb functions the same as before.

I am however having a problem getting the example to do anything, it is giving me the "unknown name" error.

Quote:
Function Name: "getElementsByTag"
ERROR: Unknown name.
(0x80020006)

Will Continue?


So I tried doing getElementsByName, and getElementsByID, and the ID finally did not give me that error, but instead gave me a different error.

From what it looks like, the Name and ID are both not what I'm looking for anyway, but gave it a shot.

It looks like the getElementsByTag is looking for the actual <table> tag right? will it make a difference if there are other properties in that tag? for example: "<table cellpadding="0" cellspacing="0" border="0" width="100%">" Will that effect it?

Anyway, I understand the concept, but am not sure at what i'm doing wrong with the example you gave me.

Thanks again for all the direction you've given me.

Quote:
I wont do it for you for free but i think you get the idea and can figure the rest out

I don't expect that at all, and I really do appreciate all of the help you've given me. I tend to learn better when I am pointed in the right direction (as you have been doing) and I figure the details out on my own.

thanks again.

_________________
“Whenever I'm about to do something, I think, 'Would an idiot do that?' And if they would, I do not do that thing.”

-Dwight


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 3rd, 2009, 2:12 am 
Offline

Joined: June 24th, 2008, 8:30 am
Posts: 126
Ok, I actually figured out a portion of it.

w3Schools says "getElementsByTagName" so it was missing the name on there. One thing I can't find however, is the cols. it does not show that in the syntax, and I am getting an unrecognized name error.

the rows seems to be fine, but it doesn't recognize cols. Anyone know what this should be instead?


EDIT:

Sorry, i did find the syntax for it. It is cells, rather than cols.

Sorry, i spoke too soon, i couldn't find it the first time i looked.

Anyway, I am able to find the text "products" as mentioned in my original post on this question, using your example like this:

Code:
test:=com_invoke(pwb,"document.getElementsByTagname[table].item[4].rows.item[1].cells.item[0].innerText")
 msgbox, %test%


Now all I have left is to figure out how to find the id, or the name of that specific row ( I think).

Any pointers anyone?

_________________
“Whenever I'm about to do something, I think, 'Would an idiot do that?' And if they would, I do not do that thing.”

-Dwight


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 3rd, 2009, 2:44 am 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
sorry for typing that wrong :oops:
and yes its cells not cols i get my applications mixxed up i use cols in attatchmate :roll:
but there really isnt much need to get the element id or name attribute
lets say for instance your cell holds a hyperlink and you wish to click it lets also say that the cell looks something similar to this
Code:
<td id="thecell"><p> <a href="somelink" id="thelink"> click here </a> this is some paragraph text</p></td>
in that event your example
Code:
test:=com_invoke(pwb,"document.getElementsByTagname[table].item[4].rows.item[1].cells.item[0].innerText")
 msgbox, %test%
would show
Code:
click here  this is some paragraph text
. if however your goal is to click the link then you could go a step further
Code:
com_invoke(pwb,"document.getElementsByTagname[table].item[4].rows.item[1].cells.item[0].childNodes.item[0].childNodes.item[0].click")

I know its a little daunting to get used to but there are dom methods such as previoussibling nextsibling parentnode etc that can let you go from the identified cell straight to your desired content
http://www.w3schools.com/htmldom/dom_methods.asp

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 3rd, 2009, 3:00 am 
Offline

Joined: June 24th, 2008, 8:30 am
Posts: 126
unfortunately, its much more complicated than an a href within the cell. (it does't have a url that it is going to like a conventional link would) I actually can't even get it to click using the id that I looked up in the page source. It uses some weird onclick method that doesn't tell me where it is going with the onclick. Is there a way I can post a screenshot? and maybe I should post the source of the page?

I really have no idea what else to try. I have been trying all kinds of things to get it to "click" the row and enter edit mode.

Thanks again tank for consistantly helping.

Things have really started clicking with the dom since you have been helping me, and now things have gone from REALLY over my head, to a little over my head. So I am making progress!

_________________
“Whenever I'm about to do something, I think, 'Would an idiot do that?' And if they would, I do not do that thing.”

-Dwight


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 3rd, 2009, 3:32 am 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
you may also reference the element and use fireevent

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 3rd, 2009, 4:39 am 
Offline

Joined: June 24th, 2008, 8:30 am
Posts: 126
Wow, that fireevent thing is pretty cool. I can use that on some other things i've been doing. I couldn't get it to work on this, because I can't find a specific event associated with the element i'm trying to click. I'm missing something small I think, because one of these methods should work.

I know its a lot to ask, but if anyone is willing to take a look at my source code, and see if they can find whatever i'm missing, I would be eternally greatful.

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Pages</title>
<style type="text/css">
.text         { font-family:Arial; font-size:11px; color:#3A3A3A; line-height:normal }
.helpbutton   { font-family:Arial; font-size:11px; color:#3A3A3A; line-height:normal }
.tablehilite  { background-color:#E0EAF4 }
.button       { font-family:Arial; font-size:11px; color:#3A3A3A; line-height:normal }
.submitbutton { font-family:Arial; font-size:11px; color:#3A3A3A; line-height:normal }
.checkbox     { vertical-align:top }
.border       { border-width:1px; border-style:solid; border-color:#A6A780; background-color:#EDEDE6 }
.shadow       { width:100%; height:6px; background:#DBDBCC url(/server/images/shadow.png?version=1246045570000) repeat-x; font-size:1px; line-height:1px }
.label        { font-family:Arial; font-size:11px; color:#3A3A3A; line-height:normal }
.form         { margin-top:0; margin-bottom:0 }
a:active      { color:#365FE4; text-decoration:none }
a:hover       { color:#365FE4; text-decoration:none }
a:visited     { color:#365FE4; text-decoration:none }
a:link        { color:#365FE4; text-decoration:none }
</style>
<script type="text/javascript" src="/server/js/prototype.js?version=1246341912277"></script>
<script type="text/javascript" src="/server/js/server.js?version=1246341912277"></script>
<script type="text/javascript" src="/server/js/form.js?version=1246341912277"></script>
<script type="text/javascript" src="/account/js/account.js?version=1246045600000"></script>
<script type="text/javascript" src="/server/js/table.js?version=1246341912277"></script>
<script type="text/javascript" src="/help/js/helpbutton.js?version=1246045582000"></script>
<script type="text/javascript">
Event.observe(document, 'dom:loaded', function()
{
   new TreeTable('pages', {onPosition: function() {Forms.submit('account')}, listeners: ['delete'], collapsedURL: '/server/images/collapsed.gif', expandedURL: '/server/images/expanded.gif', expanded: [], onDblClick: function() {$('edit').click()}, singleListeners: ['edit']});
});
</script>
</head>

<body onunload="resetClickOnce()" onload="setTimeout('showHelpTip()', 90000);">
<form class="changed form" method="post" action="/account" name="account" id="account">
<input name="source" id="source" value="Page_Menu" type="hidden" />
<input name="destination" id="destination" type="hidden" />
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td onclick="Forms.submitDestination('Account_Main')" style="padding:6px; cursor:pointer; background-color:#DBDBCC; background-image:url(/account/images/downtab.jpg); background-repeat:repeat-x; border-bottom:1px solid white"><span class="label" style="color:#3A3A3A; white-space:nowrap">Account</span></td><td><div style="width:1px; height:1px; line-height:1px; font-size:1px; display:block"></div></td>
<td onclick="Forms.submitDestination('Site_Design')" style="padding:6px; cursor:pointer; background-color:#DBDBCC; background-image:url(/account/images/downtab.jpg); background-repeat:repeat-x; border-bottom:1px solid white"><span class="label" style="color:#3A3A3A; white-space:nowrap">Site</span></td><td><div style="width:1px; height:1px; line-height:1px; font-size:1px; display:block"></div></td>
<td onclick="Forms.submitDestination('Page_Menu')" style="background-color:#6699CC; background-image:URL(/account/images/uptab.jpg); background-repeat:repeat-x; padding:6px; cursor:pointer; border-left:1px solid #6699CC; border-right:1px solid #6699CC"><span class="label" style="color:#FFFFFF; white-space:nowrap">Pages</span></td><td><div style="width:1px; height:1px; line-height:1px; font-size:1px; display:block"></div></td>
<td onclick="Forms.submitDestination('Product_Menu')" style="padding:6px; cursor:pointer; background-color:#DBDBCC; background-image:url(/account/images/downtab.jpg); background-repeat:repeat-x; border-bottom:1px solid white"><span class="label" style="color:#3A3A3A; white-space:nowrap">Products</span></td><td><div style="width:1px; height:1px; line-height:1px; font-size:1px; display:block"></div></td>
<td onclick="Forms.submitDestination('Customer_Menu')" style="padding:6px; cursor:pointer; background-color:#DBDBCC; background-image:url(/account/images/downtab.jpg); background-repeat:repeat-x; border-bottom:1px solid white"><span class="label" style="color:#3A3A3A; white-space:nowrap">Customers</span></td><td><div style="width:1px; height:1px; line-height:1px; font-size:1px; display:block"></div></td>
<td onclick="Forms.submitDestination('Order_Menu')" style="padding:6px; cursor:pointer; background-color:#DBDBCC; background-image:url(/account/images/downtab.jpg); background-repeat:repeat-x; border-bottom:1px solid white"><span class="label" style="color:#3A3A3A; white-space:nowrap">Orders</span></td><td><div style="width:1px; height:1px; line-height:1px; font-size:1px; display:block"></div></td>
<td onclick="Forms.submitDestination('Stats_Visitors')" style="padding:6px; cursor:pointer; background-color:#DBDBCC; background-image:url(/account/images/downtab.jpg); background-repeat:repeat-x; border-bottom:1px solid white"><span class="label" style="color:#3A3A3A; white-space:nowrap">Stats</span></td><td><div style="width:1px; height:1px; line-height:1px; font-size:1px; display:block"></div></td>
<td onclick="Forms.submitDestination('Publish_Menu')" style="padding:6px; cursor:pointer; background-color:#DBDBCC; background-image:url(/account/images/downtab.jpg); background-repeat:repeat-x; border-bottom:1px solid white"><span class="label" style="color:#3A3A3A; white-space:nowrap">Publish</span></td><td><div style="width:1px; height:1px; line-height:1px; font-size:1px; display:block"></div></td>
<td align="right" width="100%" style="padding:4px 6px; white-space:nowrap"><br />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%" style="background-color:#6699CC; padding:6px">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr style="vertical-align:top">
<td style="white-space:nowrap"><span class="label" style="color:#FFFFFF; font-weight:bold; font-family:arial; font-size:80%">Pages</span></td>
<td style="width:100%"><br /></td>
<td style="white-space:nowrap"><span class="label" onclick="Forms.submitDestination('Account_Logout')" style="font-family:arial,helvetica; font-size:80%; color:#FFFFFF; cursor:pointer">Logout</span></td>
</tr>
</table>
</td>
</tr>
</table>
<div class="shadow png"></div>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr valign="top">
<td width="100%" style="background-color:#DBDBCC; padding:6px">
<div class="border" style="padding-left:0px; padding-right:0px; padding-top:0px; padding-bottom:0px"><table cellspacing="1" cellpadding="2" border="1" bordercolor="#EDEDE6" id="pages" style="font-family:arial; width:100%; font-size:11px; background-color:#ffffff; border-collapse:collapse; border-width:1px; border-color:#EDEDE6">
<thead style="background-color:#DBDBCC; text-align:left">
<tr>
<th><span class="label" style="font-weight:bold; margin-left:46px">Name</span></th>
<th>Background</th>
<th>URL</th>
<th align="center"><img src="/account/images/visible.gif" border="0" title="Visible in site navigation" /></th>
</tr>
</thead>
<tbody>
<tr id="pages_2">
<td><div hspace="0" style="width:0px; height:1px; float:left; line-height:1px; font-size:1px; display:block"></div><img src="/server/images/leaf.gif" border="0" style="float:left" /><span class="position"><span class="label"><img class="png" src="/account/icons/home.png" style="margin-left:1px; margin-right:3px; vertical-align:middle" />Home</span></span></td>
<td>Default Background</td>
<td>http://testeroni.com/page/2</td>
<td align="center"><input class="checkbox" name="visible_2" id="visible_2" value="2" type="checkbox" checked="checked" /></td>
</tr>
<tr id="pages_189">
<td><div hspace="0" style="width:0px; height:1px; float:left; line-height:1px; font-size:1px; display:block"></div><img src="/server/images/leaf.gif" border="0" style="float:left" /><span class="position"><span class="label"><img src="/account/icons/page.gif" style="margin-left:1px; margin-right:3px; vertical-align:middle" />Products</span></span></td>
<td>Default Background</td>
<td>http://testeroni.com/products</td>
<td align="center"><input class="checkbox" name="visible_189" id="visible_189" value="189" type="checkbox" checked="checked" /></td>
</tr>
<tr id="pages_240">
<td><div hspace="0" style="width:0px; height:1px; float:left; line-height:1px; font-size:1px; display:block"></div><img src="/server/images/leaf.gif" border="0" style="float:left" /><span class="position"><span class="label"><img src="/account/icons/page.gif" style="margin-left:1px; margin-right:3px; vertical-align:middle" />About Us</span></span></td>
<td>Default Background</td>
<td>http://testeroni.com/about</td>
<td align="center"><input class="checkbox" name="visible_240" id="visible_240" value="240" type="checkbox" /></td>
</tr>
<tr id="pages_188">
<td><div hspace="0" style="width:0px; height:1px; float:left; line-height:1px; font-size:1px; display:block"></div><img src="/server/images/leaf.gif" border="0" style="float:left" /><span class="position"><span class="label"><img src="/account/icons/page.gif" style="margin-left:1px; margin-right:3px; vertical-align:middle" />Contact Us</span></span></td>
<td>Default Background</td>
<td>http://testeroni.com/contact</td>
<td align="center"><input class="checkbox" name="visible_188" id="visible_188" value="188" type="checkbox" checked="checked" /></td>
</tr>
<tr id="pages_191">
<td><div hspace="0" style="width:0px; height:1px; float:left; line-height:1px; font-size:1px; display:block"></div><img src="/server/images/leaf.gif" border="0" style="float:left" /><span class="position"><span class="label"><img src="/account/icons/page.gif" style="margin-left:1px; margin-right:3px; vertical-align:middle" />Shipping</span></span></td>
<td>Default Background</td>
<td>http://testeroni.com/policies</td>
<td align="center"><input class="checkbox" name="visible_191" id="visible_191" value="191" type="checkbox" /></td>
</tr>
<tr id="pages_394">
<td><div hspace="0" style="width:0px; height:1px; float:left; line-height:1px; font-size:1px; display:block"></div><img src="/server/images/leaf.gif" border="0" style="float:left" /><span class="position"><span class="label"><img src="/account/icons/page.gif" style="margin-left:1px; margin-right:3px; vertical-align:middle" />Privacy Policy</span></span></td>
<td>Default Background</td>
<td>http://testeroni.com/privacy</td>
<td align="center"><input class="checkbox" name="visible_394" id="visible_394" value="394" type="checkbox" checked="checked" /></td>
</tr>
<tr id="pages_190">
<td><div hspace="0" style="width:0px; height:1px; float:left; line-height:1px; font-size:1px; display:block"></div><img src="/server/images/leaf.gif" border="0" style="float:left" /><span class="position"><span class="label"><img src="/account/icons/page.gif" style="margin-left:1px; margin-right:3px; vertical-align:middle" />Links</span></span></td>
<td>Default Background</td>
<td>http://testeroni.com/links</td>
<td align="center"><input class="checkbox" name="visible_190" id="visible_190" value="190" type="checkbox" checked="checked" /></td>
</tr>
<tr id="pages_198">
<td><div hspace="0" style="width:0px; height:1px; float:left; line-height:1px; font-size:1px; display:block"></div><img src="/server/images/leaf.gif" border="0" style="float:left" /><span class="position"><span class="label"><img class="png" src="/account/icons/shopping_bag.png" style="margin-left:1px; margin-right:3px; vertical-align:middle" />Cart Review</span></span></td>
<td>Default Background</td>
<td>http://testeroni.com/cart</td>
<td align="center"><input class="checkbox" name="visible_198" id="visible_198" value="198" type="checkbox" /></td>
</tr>
<tr id="pages_244">
<td><div hspace="0" style="width:0px; height:1px; float:left; line-height:1px; font-size:1px; display:block"></div><img src="/server/images/leaf.gif" border="0" style="float:left" /><span class="position"><span class="label"><img class="png" src="/account/icons/search_results.png" style="margin-left:1px; margin-right:3px; vertical-align:middle" />Search</span></span></td>
<td>Default Background</td>
<td>http://testeroni.com/search</td>
<td align="center"><input class="checkbox" name="visible_244" id="visible_244" value="244" type="checkbox" /></td>
</tr>
<tr id="pages_287">
<td><div hspace="0" style="width:0px; height:1px; float:left; line-height:1px; font-size:1px; display:block"></div><img src="/server/images/leaf.gif" border="0" style="float:left" /><span class="position"><span class="label"><img class="png" src="/account/icons/categories.png" style="margin-left:1px; margin-right:3px; vertical-align:middle" />Category</span></span></td>
<td>Default Background</td>
<td>http://testeroni.com/category</td>
<td align="center"><input class="checkbox" name="visible_287" id="visible_287" value="287" type="checkbox" /></td>
</tr>
<tr id="pages_152430214">
<td><div hspace="0" style="width:0px; height:1px; float:left; line-height:1px; font-size:1px; display:block"></div><img src="/server/images/leaf.gif" border="0" style="float:left" /><span class="position"><span class="label"><img src="/account/icons/page.gif" style="margin-left:1px; margin-right:3px; vertical-align:middle" />FAQ</span></span></td>
<td>Default Background</td>
<td>http://testeroni.com/faq</td>
<td align="center"><input class="checkbox" name="visible_152430214" id="visible_152430214" value="152430214" type="checkbox" /></td>
</tr>
<tr id="pages_368300211">
<td><div hspace="0" style="width:0px; height:1px; float:left; line-height:1px; font-size:1px; display:block"></div><img src="/server/images/leaf.gif" border="0" style="float:left" /><span class="position"><span class="label"><img src="/account/icons/page.gif" style="margin-left:1px; margin-right:3px; vertical-align:middle" />Unknown</span></span></td>
<td>Default Background</td>
<td>http://testeroni.com/page/368300211</td>
<td align="center"><input class="checkbox" name="visible_368300211" id="visible_368300211" value="368300211" type="checkbox" checked="checked" /></td>
</tr>
</tbody>
</table>
<div style="padding:4px; background-color:#EDEDE6">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr style="vertical-align:top">
<td style="white-space:nowrap"><input class="submitbutton" name="add" id="add" value="Add" type="submit" onclick="return clickOnce(this)" /></td>
<td><div style="width:4px; height:4px; line-height:1px; font-size:1px; display:block"></div></td>
<td style="white-space:nowrap"><input class="button" name="" id="analyze" value="Analyze" type="button" onclick="openAnalysisWindow('/account?destination=SiteResearch_Analysis&amp;location=', 'pages');" /></td>
<td style="width:100%"><br /></td>
<td style="white-space:nowrap"><input class="submitbutton" name="delete" id="delete" value="Delete" type="submit" onclick="return verify('Are you sure you want to delete?'); return clickOnce(this)" /></td>
<td><div style="width:4px; height:4px; line-height:1px; font-size:1px; display:block"></div></td>
<td style="white-space:nowrap"><input class="submitbutton" name="duplicate" id="duplicate" value="Duplicate" type="submit" onclick="return clickOnce(this)" /></td>
<td><div style="width:4px; height:4px; line-height:1px; font-size:1px; display:block"></div></td>
<td style="white-space:nowrap"><input class="submitbutton" name="edit" id="edit" value="Edit" type="submit" onclick="return clickOnce(this)" /></td>
</tr>
</table>
</div>
</div>
<div class="gap" style="line-height:1px; font-size:1px; width:100%; height:8px"></div>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr style="vertical-align:top">
<td style="white-space:nowrap"><input class="helpbutton" name="" id="account_help" value="Help..." type="button" onclick="openHelpWindow('account','en','page','Page_Menu','')" /></td>
<td><div style="width:4px; height:4px; line-height:1px; font-size:1px; display:block"></div></td>
<td style="white-space:nowrap"><input class="submitbutton" name="preview" id="preview" value="Preview" type="submit" onclick="return openPreview(event, '2062204');; return clickOnce(this)" /></td>
<td style="width:100%"><br /></td>
</tr>
</table>
</td>
<td>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="background-color:#DBDBCC"><div style="width:6px; height:6px; line-height:1px; font-size:1px; display:block"></div></td>
<td onclick="Forms.submitDestination('Page_Menu')" style="background-color:#DBDBCC; padding:4px; cursor:pointer"><span class="label" style="white-space:nowrap; color:#3A3A3A">Pages</span></td>
</tr>
<tr>
<td colspan="2"><div style="width:1px; height:1px; line-height:1px; font-size:1px; display:block"></div></td>
</tr>
<tr>
<td style="background-color:#A6A780; border-left:1px solid white"><div style="width:5px; height:5px; line-height:1px; font-size:1px; display:block"></div></td>
<td onclick="Forms.submitDestination('Page_Backgrounds')" style="padding:4px; cursor:pointer; background-color:#F4F4EF"><span class="label" style="white-space:nowrap; color:#3A3A3A">Backgrounds</span></td>
</tr>
<tr>
<td colspan="2"><div style="width:1px; height:1px; line-height:1px; font-size:1px; display:block"></div></td>
</tr>
<tr>
<td style="background-color:#A6A780; border-left:1px solid white"><div style="width:5px; height:5px; line-height:1px; font-size:1px; display:block"></div></td>
<td onclick="Forms.submitDestination('Page_PageTypes')" style="padding:4px; cursor:pointer; background-color:#F4F4EF"><span class="label" style="white-space:nowrap; color:#3A3A3A">Page Types</span></td>
</tr>
<tr>
<td colspan="2"><div style="width:1px; height:1px; line-height:1px; font-size:1px; display:block"></div></td>
</tr>
<tr>
<td style="background-color:#A6A780; border-left:1px solid white"><div style="width:5px; height:5px; line-height:1px; font-size:1px; display:block"></div></td>
<td onclick="Forms.submitDestination('Form_Menu')" style="padding:4px; cursor:pointer; background-color:#F4F4EF"><span class="label" style="white-space:nowrap; color:#3A3A3A">Forms</span></td>
</tr>
<tr>
<td colspan="2"><div style="width:1px; height:1px; line-height:1px; font-size:1px; display:block"></div></td>
</tr>
<tr>
<td style="background-color:#A6A780; border-left:1px solid white"><div style="width:5px; height:5px; line-height:1px; font-size:1px; display:block"></div></td>
<td onclick="Forms.submitDestination('Link_Menu')" style="padding:4px; cursor:pointer; background-color:#F4F4EF"><span class="label" style="white-space:nowrap; color:#3A3A3A">Links</span></td>
</tr>
<tr>
<td colspan="2"><div style="width:1px; height:1px; line-height:1px; font-size:1px; display:block"></div></td>
</tr>
<tr>
<td style="background-color:#A6A780; border-left:1px solid white"><div style="width:5px; height:5px; line-height:1px; font-size:1px; display:block"></div></td>
<td onclick="Forms.submitDestination('Forum_Menu')" style="padding:4px; cursor:pointer; background-color:#F4F4EF"><span class="label" style="white-space:nowrap; color:#3A3A3A">Forums</span></td>
</tr>
<tr>
<td colspan="2"><div style="width:1px; height:1px; line-height:1px; font-size:1px; display:block"></div></td>
</tr>
<tr>
<td style="background-color:#A6A780; border-left:1px solid white"><div style="width:5px; height:5px; line-height:1px; font-size:1px; display:block"></div></td>
<td onclick="Forms.submitDestination('Page_Redirects')" style="padding:4px; cursor:pointer; background-color:#F4F4EF"><span class="label" style="white-space:nowrap; color:#3A3A3A">Redirects</span></td>
</tr>
<tr>
<td colspan="2"><div style="width:1px; height:1px; line-height:1px; font-size:1px; display:block"></div></td>
</tr>
<tr>
<td style="background-color:#A6A780; border-left:1px solid white"><div style="width:5px; height:5px; line-height:1px; font-size:1px; display:block"></div></td>
<td onclick="Forms.submitDestination('Calendar_Calendars')" style="padding:4px; cursor:pointer; background-color:#F4F4EF"><span class="label" style="white-space:nowrap; color:#3A3A3A">Calendars</span></td>
</tr>
<tr>

<td colspan="2"><div style="width:1px; height:1px; line-height:1px; font-size:1px; display:block"></div></td>
</tr>
<tr>
<td style="background-color:#A6A780; border-left:1px solid white"><div style="width:5px; height:5px; line-height:1px; font-size:1px; display:block"></div></td>
<td onclick="Forms.submitDestination('Survey_Menu')" style="padding:4px; cursor:pointer; background-color:#F4F4EF"><span class="label" style="white-space:nowrap; color:#3A3A3A">Surveys</span></td>
</tr>
<tr>
<td colspan="2"><div style="width:1px; height:1px; line-height:1px; font-size:1px; display:block"></div></td>
</tr>
</table>
</td>
</tr>
</table>
<span class="text" style="font-family:arial,helvetica; font-size:60%; padding-top:5px">Copyright &copy; 1998-2009 Imergent Inc. All rights reserved.</span><div style='display:none; background-color: #fcfdc9; width: 350; padding: 5px; border: 1px solid #777777;' id='help_prompt'><table style='font-family: arial; font-size: 11;' cellpadding=3 cellspacing=0>
<tr>
<td valign='top'><img src="/server/images/info.gif" border="0" /></td><td valign='top'>You can view help for any page using the Knowledge Base by clicking the Help button in the lower left-hand corner of the page.<br /><br />Do you want to view the help now?<br /><br /><input class="checkbox" name="dont_show" id="dont_show" value="" type="checkbox" onclick="disableHelpPrompt(this.checked);" /><label for="dont_show">&nbsp;<span class="label">Don't ask again</span></label><br /><br /></td></tr><tr>
<td></td><td align='right'><input class="button" name="" id="" value="Yes" type="button" onclick="document.getElementById('account_help').click(); hideHelpPrompt();" style="width:60px" /> <input class="button" name="" id="" value="No" type="button" onclick="hideHelpPrompt();" style="width:60px" /></td></tr></table></div><input name="account_id" id="account_id" value="2062204" type="hidden" />
</form>

<script type="text/javascript">document.title = '2062204 - ' + document.title;</script>
</body>
</html>


If anyone has Dreamweaver, you can pop this in, and get a good idea of what the page looks like. (the few images will be missing of course)

And here is the first row which I am trying to click. There are no event handlers in there, so I'm not seeing how it works.. its not making sense to me.
Code:
<tr id="pages_2">
<td><div hspace="0" style="width:0px; height:1px; float:left; line-height:1px; font-size:1px; display:block"></div><img src="/server/images/leaf.gif" border="0" style="float:left" /><span class="position"><span class="label"><img class="png" src="/account/icons/home.png" style="margin-left:1px; margin-right:3px; vertical-align:middle" />Home</span></span></td>
<td>Default Background</td>
<td>http://testeroni.com/page/2</td>
<td align="center"><input class="checkbox" name="visible_2" id="visible_2" value="2" type="checkbox" checked="checked" /></td>
</tr>


Thanks for the help

_________________
“Whenever I'm about to do something, I think, 'Would an idiot do that?' And if they would, I do not do that thing.”

-Dwight


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 3rd, 2009, 5:55 am 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
so the click method doesnt seem to work?

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 3rd, 2009, 6:04 am 
Offline

Joined: June 24th, 2008, 8:30 am
Posts: 126
It might, but I am trying something like this:

Code:
 iWeb_execScript(pwb,pages_2.fireevent("onclick"))


I have tried a thousand other ways with com_invoke, etc. I even found a couple posts you put on other threads from a long time ago talking about fireevent, but couldn't get ANYTHING to work. I am so ready to give up.

Do you know what i'm doing wrong?

Does that source code look like the fireevent will work?

Oh, I just realized you might be talking about the iweb_Click functions and yes I tried every one of them with no luck.

_________________
“Whenever I'm about to do something, I think, 'Would an idiot do that?' And if they would, I do not do that thing.”

-Dwight


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 3rd, 2009, 6:16 am 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
Wouldn't this be the right way to do it via COM_Invoke?

Code:
COM_Invoke(pwb,"document.all.item[pages2].fireEvents","onclick")

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 3rd, 2009, 6:25 am 
Offline

Joined: June 24th, 2008, 8:30 am
Posts: 126
When I try that example, I get the following error:

Quote:
The COM Object may not be a valid Dispatch Object!
First ensure that COM Library has been initialized through COM_Init().

_________________
“Whenever I'm about to do something, I think, 'Would an idiot do that?' And if they would, I do not do that thing.”

-Dwight


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 3rd, 2009, 6:38 am 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
Oops:

Code:
COM_Invoke(pwb,"document.all.item[pages2].fireEvent","onclick") ; not fireEvents

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 3rd, 2009, 6:47 am 
Offline

Joined: June 24th, 2008, 8:30 am
Posts: 126
Yeah, i should have caught that too.

I got this to work IF the item was already selected:
Code:
COM_Invoke(pwb,"document.all.item[pages_2].fireEvent","ondblclick")



But if I don't have the item selected, nothing I try will work..

Edit:
I can select any of the elements, and running that code will open that page. It doesn't seem to care that I am specifying "pages_2". This is really driving me nuts...


Thanks for your help by the way!

_________________
“Whenever I'm about to do something, I think, 'Would an idiot do that?' And if they would, I do not do that thing.”

-Dwight


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 3rd, 2009, 7:26 am 
Offline

Joined: June 24th, 2008, 8:30 am
Posts: 126
Its got to have something to do with this right here:

Code:
Event.observe(document, 'dom:loaded', function()
{
   new TreeTable('pages', {onPosition: function() {Forms.submit('account')}, listeners: ['delete'], collapsedURL: '/server/images/collapsed.gif', expandedURL: '/server/images/expanded.gif', expanded: [], onDblClick: function() {$('edit').click()}, singleListeners: ['edit']});
});



Thats where I got the ondblclick from, but i'm still missing something...


Here is another list of functions that I found specifically for this table:
Code:
if (!window.Selectables) var Selectables = { };

Object.extend(Selectables,
{
   hash: new Hash(),
   
   add: function(id, value)
   {
      this.hash.set(id, value);
   },
   
   toggleAll: function(id)
   {
      var select = this.hash.get(id);
      
      if(select)
      {
         select.toggleAll();
      }
   },
   
   get: function(id)
   {
      return this.hash.get(id);
   }
});

Element.addMethods('TABLE',
{
   toggleAll: function(element)
   {
      Selectables.toggleAll(element.identify());
      
      return element;
   }
});

var positioning = false;

var SelectNode = Class.create(
{
   initialize: function(number, element, id)
   {
      this.element         = element;
      this.positionElement   = element;
      this.number            = number;
      this.selected         = false;
      this.id               = id;
      this.left            = -1;
      this.right            = -1;
      this.top            = -1;
      this.bottom            = -1;
   }
});

var TreeNode = Class.create(
{
   initialize: function(element, id)
   {
      this.element = element;
      this.childrenElement = element;
      this.children = [];
      this.opener;
      this.id = id;
   },
   
   addChild: function(child)
   {
      this.children.push(child);
      
      if(this.element == null)
      {
         child.element.show();
      }
      else if(!this.element.visible())
      {
         child.element.hide();
      }
      
      if(!child.element.visible())
      {
         child.opener = this;
      }
   },
   
   getDescendants: function()
   {
      var collected = [];
      
      this.findDescendants(collected);
      
      return collected;
   },
   
   findDescendants: function(collected)
   {
      for(var i = 0; i < this.children.length; i++)
      {
         collected.push(this.children[i]);
         
         this.children[i].findDescendants(collected);
      }
   },
   
   findDescendant: function(id)
   {
      if(id == this.id)
      {
         return this;
      }
      
      for(var i = 0; i < this.children.length; i++)
      {
         var node = this.children[i].findDescendant(id);
         
         if(node)
         {
            return node;
         }
      }
   }
});

var Select = Class.create(
{
   initialize: function(element, options)
   {
      this.element         = $(element);
      this.name            = this.element.identify();
      this.selectors         = [];
      this.lastSelection      = null;
      this.lastState         = true;
      this.selected         = null;
      this.position         = null;
      this.positionable      = false;
      this.positionBegin      = false;
      this.positionStartX;
      this.positionStartY;
      this.positionSource;
      this.positionTarget;
      this.positionType;
      this.positionArrow      = null;
      this.positionCursor      = null;
      this.options = {
         multiple:           true,
         onDblClick:         null,
         onSelect:         null,
         onPosition:       null,
         isTree:            false,
         isLarge:         false,
         singleListeners:   [],
         listeners:         [],
         selected:         [],
         expanded:         []
      };

      Object.extend(this.options, options || { });
      
      // --------
      
      this.element.setStyle({cursor : 'default'});
      
      this.element.observe('mousedown',   this.mouseDown.bindAsEventListener(this));
      this.element.observe('mousemove',   this.mouseMove.bindAsEventListener(this));
      this.element.observe('dblclick',      this.dblClick.bindAsEventListener(this));
      $$('html').first().observe('mouseup',   this.mouseUp.bindAsEventListener(this));
      
      // --------
      
      var descendants = this.element.descendants();
      
      var currentNode = null;
      
      var number = 0;
      
      for(var i = 0; i < descendants.length; i++)
      {
         if(descendants[i].identify().startsWith(this.name + '_'))
         {
            var id = descendants[i].identify().substring(this.name.length + 1);
         
            currentNode = new SelectNode(number, descendants[i], id);
            
            this.selectors.push(currentNode);
            
            number++;
         }
         
         if(descendants[i].hasClassName('position') && currentNode)
         {
            currentNode.positionElement = descendants[i];
         }
      }
      
      // ----------
      
      this.element.insert({after: "<input type='hidden' id='" + this.name + "_selected' name='" + this.name + "_selected' />"});
         
      this.selected = $(this.name + "_selected");
      
      var selectedIDs = this.options.selected;
      
      for(var i = 0; i < selectedIDs.length ; i++)
      {
         var selector = this.getSelector(selectedIDs[i]);
         
         if(selector)
         {
            selector.selected = true;
         }
      }
      
      this.updateSelection();
      
      // ---------
      
      if(this.options.onPosition)
      {
         this.positionable = true;
         
         this.positionArrow = $('positionarrow');
         
         if(!this.positionArrow)
         {
            $$('body').first().insert("<img id='positionarrow' src='/server/images/arrow.gif' style='display:none; z-index:99; position:absolute;' />");
            
            this.positionArrow = $('positionarrow');
         }
         
         this.positionCursor = $('positioncursor');
         
         if(!this.positionCursor)
         {
            $$('body').first().insert("<div id='positioncursor' class='tablehilite' style='font-size:1px; display:none; z-index:99; position:absolute;'></div>");
            
            this.positionCursor = $('positioncursor');
         }
         
         this.element.insert({after: "<input type='hidden' id='" + this.name + "_position' name='" + this.name + "_position' />"});
         
         this.position = $(this.name + "_position");
      }
      
      Selectables.add(this.name, this);
   },
   
   mouseDown: function(event)
   {
      var element = Event.element(event);
   
      if(element.name)
      {
         return;
      }

      var selected = this.getSelector(element);
      
      var stopEvent = true;
      
      if(selected)
      {
         if(this.options.multiple && (event.shiftKey || event.ctrlKey || event.altKey || event.metaKey))
         {
            this.selectMultiple(event, selected);
            
            stopEvent = false;
         }
         else
         {
            this.selectSingle(event, selected);

            if(this.positionable)
            {
               stopEvent = true;
            }
         }
         
         if(this.options.onPosition)
         {
            this.startPositioning(event);
         }
         else
         {
            stopEvent = false;
         }
      }
      
       if(stopEvent)
      {
         Event.stop(event);
      }
   },
   
   mouseMove: function(event)
   {
      if(this.options.onPosition)
      {
         this.movePositioning(event);
         
         Event.stop(event);
      }
   },
   
   mouseUp: function(event)
   {
      if(this.options.onPosition)
      {
         this.endPositioning(event);
      }
   },
   
   dblClick: function(event)
   {
      if(this.options.onDblClick && this.getSelector(Event.element(event)))
      {
         this.options.onDblClick();
      }
   },

   getSelector: function(object)
   {
      if(Object.isElement(object))
      {
         var element = this.getSelectorElement(object);
         
         for(var i = 0; i < this.selectors.length; i++)
         {
            if(this.selectors[i].element == element)
            {
               return this.selectors[i];
            }
         }
      }

      for(var i = 0; i < this.selectors.length; i++)
      {
         if(this.selectors[i].element.identify() == object)
         {
            return this.selectors[i];
         }
         else if(this.selectors[i].id == object)
         {
            return this.selectors[i];
         }
      }
   },
   
   getSelectorElement: function(element)
   {
      if(element.identify().startsWith(this.name + '_'))
      {
         return element;
      }
      
      var ancestors = element.ancestors();
         
      for(var i = 0; i < ancestors.length; i++)
      {
         var item = ancestors[i];
      
         if(item.identify().startsWith(this.name + '_'))
         {
            return item;
         }
      }
   },
   
   selectSingle: function(event, selected)
   {
      for(var i = 0; i < this.selectors.length; i++)
      {
         if(this.selectors[i] == selected)
         {
            this.selectors[i].selected = true;
            
            this.lastSelection = selected;
            
            this.lastState = true;
         }
         else
         {
            this.selectors[i].selected = false;
         }
      }
      
      this.updateSelection();
   },
   
   selectMultiple: function(event, selected)
   {
      if(event.ctrlKey || event.altKey || event.metaKey)
      {
         for(var i = 0; i < this.selectors.length; i++)
         {
            if(this.selectors[i] == selected)
            {
               this.selectors[i].selected = !this.selectors[i].selected;
               
               this.lastState = this.selectors[i].selected;
               
               break;
            }
         }
         
         this.lastSelection = selected;
      }
      
      if(event.shiftKey && this.lastSelection)
      {
         var start = this.lastSelection.number;
         
         var end = selected.number;
         
         if(start > end)
         {
            start = selected.number;
            
            end = this.lastSelection.number;
         }
         
         for(var i = 0; i < this.selectors.length; i++)
         {
            if(this.selectors[i].number >= start && this.selectors[i].number <= end)
            {
               this.selectors[i].selected = this.lastState;
            }
         }
      }

      this.updateSelection();
   },
   
   updateSelection: function()
   {
      var ids = [];

      for(var i = 0; i < this.selectors.length; i++)
      {
         if(this.selectors[i] && this.selectors[i].element)
         {
            if(this.selectors[i].selected)
            {
               ids.push(this.selectors[i].id);

               this.selectors[i].element.addClassName('tablehilite');
            }
            else
            {
               this.selectors[i].element.removeClassName('tablehilite');
            }
         }
      }

      this.selected.value = ids.join(",");

      var listeners = this.options.listeners;

      for(var i = 0; i < listeners.length; i++)
      {
         var listener = $(listeners[i]);

         if(listener)
         {
            listener.disabled = (ids.length < 1);
         }
      }

      listeners = this.options.singleListeners;

      for(var i = 0; i < listeners.length; i++)
      {
         listener = $(listeners[i]);

         if(listener)
         {
            listener.disabled = (ids.length != 1);
         }
      }
      
      if(this.options.onSelect)
      {
         this.options.onSelect(ids);
      }
   },
   
   toggleAll: function()
   {
      var state = false;
      
      for(var i = 0; i < this.selectors.length; i++)
      {
         if(!this.selectors[i].selected)
         {
            state = true;
            
            break;
         }
      }
      
      for(var i = 0; i < this.selectors.length; i++)
      {
         this.selectors[i].selected = state;
      }
      
      this.updateSelection();
   },
   
   selectedIDs: function()
   {
      var ids = [];

      for(var i = 0; i < this.selectors.length; i++)
      {
         if(this.selectors[i])
         {
            if(this.selectors[i].selected)
            {
               ids.push(this.selectors[i].id);
            }
         }
      }
      
      return ids;
   },
   
   resetPositioning: function()
   {
      this.positionStartX   = -1;
      this.positionStartY   = -1;
      this.positionBegin   = false;
      this.positionSource   = null;
      this.positionTarget   = null;
      this.positionType   = null;
      
      positioning = false;
   },
   
   updatePositions: function()
   {
      var lastSelector = null;
      
      for(var i = 0; i < this.selectors.length; i++)
      {
         if(this.selectors[i].element.visible())
         {
            var left = 0;
            var top = 0;

            var node = this.selectors[i].positionElement;

            while(node)
            {
               if(node.nodeName == "TR")
               {
                  left += node.cells[0].offsetLeft;
                  top  += node.cells[0].offsetTop;
               }
               else
               {
                  left += node.offsetLeft;
                  top  += node.offsetTop;
               }

               node = node.offsetParent;
            }

            var dimensions   = this.selectors[i].positionElement.getDimensions();
   
            this.selectors[i].left      = left;
            this.selectors[i].right      = left + dimensions.width;
            this.selectors[i].top      = top;
            this.selectors[i].bottom   = top + dimensions.height;
            
            if(lastSelector)
            {
               if((this.selectors[i].top - lastSelector.bottom) < 16)
               {
                  var average = Math.round((this.selectors[i].top + lastSelector.bottom) / 2);
            
                  this.selectors[i].top = average;
                  
                  lastSelector.bottom = average;
               }
            }
            
            lastSelector = this.selectors[i];
         }
      }
   },
   
   startPositioning: function(event)
   {
      this.resetPositioning();
      
      this.hideCursor();
      
      this.updatePositions();

      this.positionSource = this.getSelector(Event.element(event));
      
      this.positionStartX = Event.pointerX(event);
      
      this.positionStartY = Event.pointerY(event);
      
      positioning = true;
   },
   
   movePositioning: function(event)
   {
      var x = Event.pointerX(event);
   
      var y = Event.pointerY(event);
               
      if(this.positionBegin)
      {
         if(this.positionSource)
         {
            var position = this.getSelector(Event.element(event));
   
            if(position)
            {
               this.positionTarget   = position;

               if(this.options.isTree)
               {
                  var topQuarter = position.top + (position.bottom - position.top) / 4;
   
                  var bottomQuarter = position.top + (position.bottom - position.top) * 3 / 4;
   
                  if(y < topQuarter)
                  {
                     this.positionType = "before";
                  }
                  else if(y >= bottomQuarter)
                  {
                     this.positionType = "after";
                  }
                  else
                  {
                     this.positionType = "in";
                  }
               }
               else
               {
                  var middle = (position.top + position.bottom) / 2;
   
                  if(y < middle)
                  {
                     this.positionType = "before";
                  }
                  else
                  {
                     this.positionType = "after";
                  }
               }
   
               this.hideCursor();
               
               this.updateCursor();
            }
         }
         else
         {
            this.resetPositioning();
         }
      }
      else
      {
         if(this.positionSource)
         {
            if(Math.abs(x - this.positionStartX) > 1 || Math.abs(y - this.positionStartY) > 4)
            {
               this.positionBegin = true;
            }
         }
      }
   },
   
   endPositioning: function(event)
   {
      this.hideCursor();
      
      if(this.positionTarget && this.positionTarget != this.positionSource)
      {
         this.position.value = this.positionSource.id + " " + this.positionType + " " + this.positionTarget.id;
         
         this.options.onPosition();
      }

      this.resetPositioning();
   },
   
   hideCursor: function()
   {
      this.positionArrow.hide();
      
      this.positionCursor.hide();
      
      for(var i = 0; i < this.selectors.length; i++)
      {   
         if(this.options.isTree)
         {
            this.selectors[i].positionElement.removeClassName('tablehilite');
         }
      }
   },
   
   updateCursor: function()
   {
      var hoffset = 12;
      var voffset = 5;
      var size = 3;

      if(this.positionType == "before")
      {
         this.positionArrow.setStyle(
         {
            left:   this.positionTarget.left - hoffset,
            top:   this.positionTarget.top - voffset
         });
         
         this.positionCursor.setStyle(
         {
            left:   this.positionTarget.left,
            width:   this.positionTarget.right - this.positionTarget.left,
            top:   this.positionTarget.top - 1,
            height:   size
         });
         
         this.positionArrow.show();
         this.positionCursor.show();
      }
      else if(this.positionType == "after")
      {
         this.positionArrow.setStyle(
         {
            left:   this.positionTarget.left - hoffset,
            top:   this.positionTarget.bottom - voffset
         });
         
         this.positionCursor.setStyle(
         {
            left:   this.positionTarget.left,
            width:   this.positionTarget.right - this.positionTarget.left,
            top:   this.positionTarget.bottom - 1,
            height:   size
         });
         
         this.positionArrow.show();
         this.positionCursor.show();
      }
      else if(this.positionType == "in")
      {
         this.positionTarget.positionElement.addClassName('tablehilite');
         
         this.positionArrow.setStyle(
         {
            left:   this.positionTarget.left - hoffset,
            top:   ((this.positionTarget.top + this.positionTarget.bottom) / 2) - voffset
         });
         
         this.positionArrow.show();
      }
   }
});

var Table = Class.create(Select,
{
   initialize: function($super, element, options)
   {   
      $super(element, options);
   }
});

var ToggleTable = Class.create(Select,
{
   initialize: function($super, element, options)
   {
      if(!options)
      {
         options = {};   
      }
      
      if(!options.expandedURL)
      {
         options.expandedURL = '../images/expanded.gif';
      }
      
      if(!options.collapsedURL)
      {
         options.collapsedURL = '../images/collapsed.gif';
      }

      $super(element, options);
      
      // ---------
      
      this.element.observe('click', this.click.bindAsEventListener(this));
      
      // --------
      
      var descendants = this.element.descendants();
            
      for(var i = 0; i < descendants.length; i++)
      {
         if(descendants[i].identify().startsWith('parent_' + this.name + '_'))
         {
            var toggle = $('toggle_' + descendants[i].identify().substring(7));
            
            if(toggle)
            {
               if(descendants[i].visible())
               {
                  toggle.src = this.options.expandedURL;
               }
               else
               {
                  toggle.src = this.options.collapsedURL;
               }
            }
         }
      }
   },
   
   mouseDown: function($super, event)
   {
      var toggle = Event.element(event);

      if(toggle.identify().startsWith('toggle_' + this.name + '_'))
      {
         return;
      }
      
      $super(event);
   },
   
   click: function(event)
   {
      var toggle = Event.element(event);

      if(toggle.identify().startsWith('toggle_' + this.name + '_'))
      {
         var element = $('parent_' + toggle.identify().substring(7));
         
         if(element)
         {
            element.toggle();
            
            if(element.visible())
            {
               toggle.src = this.options.expandedURL;
               
               if(this.options.onExpand)
               {
                  this.options.onExpand();
               }
            }
            else
            {
               toggle.src = this.options.collapsedURL;
               
               if(this.options.onCollapse)
               {
                  this.options.onCollapse();
               }
            }
         }
      }
   },
   
   getSelectorElement: function($super, element)
   {
      var result = $super(element);
      
      if(result)
      {
         return result;
      }
      
      if(element.identify().startsWith('parent_' + this.name + '_'))
      {
         return $(element.identify().substring(7));
      }
      
      var ancestors = element.ancestors();
         
      for(var i = 0; i < ancestors.length; i++)
      {
         var item = ancestors[i];
      
         if(item.identify().startsWith('parent_' + this.name + '_'))
         {
            return $(item.identify().substring(7));
         }
      }
   },
   
   updateSelection: function($super)
   {
      $super();
      
      var ids = [];

      for(var i = 0; i < this.selectors.length; i++)
      {
         if(this.selectors[i])
         {
            var element = $('parent_' + this.name + '_' + this.selectors[i].id)
         
            if(element)
            {
               if(this.selectors[i].selected)
               {
                  element.addClassName('tablehilite');
               }
               else
               {
                  element.removeClassName('tablehilite');
               }
            }
         }
      }
   }
});

var Tree = Class.create(Select,
{
   nodes: new Hash(),
   
   initialize: function($super, element, options)
   {
      if(!options)
      {
         options = {};   
      }
      
      if(!options.expandedURL)
      {
         options.expandedURL = '../images/expanded.gif';
      }
      
      if(!options.collapsedURL)
      {
         options.collapsedURL = '../images/collapsed.gif';
      }
      
      options.isTree = true;
      
      $super(element, options);

      this.root = new TreeNode(null);
      
      // --------
      
      this.element.observe('click', this.click.bindAsEventListener(this));
      
      // --------
      
      this.nodes = new Hash();   
      
      var currentNode = null;
      
      var descendants = this.element.descendants();
      
      for(var i = 0; i < descendants.length; i++)
      {
         if(descendants[i].identify().startsWith(this.name + '_'))
         {
            var id = descendants[i].identify().substring(this.name.length + 1);
      
            var parentid = '';
      
            var classNames = $w(descendants[i].className);

            for(var j = 0; j < classNames.length; j++)
            {
               if(classNames[j].startsWith('parent_' + this.name + '_'))
               {
                  parentid = classNames[j].substring(this.name.length + 8);
               }
            }

            var parent = this.nodes.get(parentid);
               
            if(parent == null)
            {
               parent = this.root;
            }
            
            currentNode = new TreeNode(descendants[i], id);

            this.nodes.set(id, currentNode);
            
             parent.addChild(currentNode);
         }
         
         if(descendants[i].hasClassName('children') && currentNode)
         {
            currentNode.childrenElement = descendants[i];
         }
      }
      
      // ---------
      
      var nodes = this.root.getDescendants();
      
      for(var i = 0; i < nodes.length; i++)
      {
         var toggle = $('toggle_' + nodes[i].element.identify())
            
         if(toggle)
         {
            if(this.isExpanded(nodes[i]))
            {
               toggle.src = this.options.expandedURL;
            }
            else
            {
               toggle.src = this.options.collapsedURL;
            }
         }
      }
      
      // -------
      
      this.element.insert({after: "<input type='hidden' id='" + this.name + "_expanded' name='" + this.name + "_expanded' />"});
         
      this.expanded = $(this.name + "_expanded");
      
      // -------
      
      this.updateExpansions();
   },
   
   mouseDown: function($super, event)
   {
      var toggle = Event.element(event);

      if(toggle.identify().startsWith('toggle_' + this.name + '_'))
      {
         return;
      }
      
      $super(event);
   },
   
   click: function(event)
   {

      var toggle = Event.element(event);

      if(toggle.identify().startsWith('toggle_' + this.name + '_'))
      {
         var element = $(toggle.identify().substring(7));
   
         if(element)
         {
            var id = element.identify().substring(this.name.length + 1);

            if(this.options.isLarge)
            {
               var expansions = [];
               
               var collapsed = false;
               
               for(var i = 0; i < this.options.expanded.length; i++)
               {
                  if(this.options.expanded[i] == id)
                  {
                     collapsed = true;
                     
                     continue;
                  }
                  
                  expansions.push(this.options.expanded[i]);
               }
               
               if(!collapsed)
               {
                  expansions.push(id);
               }
               
               this.expanded.value = expansions.join(",");

               if(this.options.persistant)
               {
                  setCookie(this.options.persistant, this.expanded.value, 0, "/");
               }

               var ancestors = this.element.ancestors();
         
               var submittedForm = false;
         
               for(var i = 0; i < ancestors.length; i++)
               {
                  var item = ancestors[i];
               
                  if(item.tagName == "FORM")
                  {
                     submittedForm = Forms.submit(item.id);
                  }
               }
               
               if(!submittedForm)
               {
                  window.location.reload(true);
               }
            }
            else
            {
               var node = this.nodes.get(id);

               if(this.options.isTable)
               {
                  var descendants = node.getDescendants();
                  
                  for(var i = 0; i < descendants.length; i++)
                  {
                     if(descendants[i].opener == null)
                     {
                        descendants[i].opener = node;
                        
                        descendants[i].element.hide();
                     }
                     else if(descendants[i].opener == node)
                     {
                        descendants[i].opener = null;
                        
                        descendants[i].element.show();
                     }
                  }
               }
               else
               {
                  node.childrenElement.toggle();
               }
               
               if(this.isExpanded(node))
               {
                  toggle.src = this.options.expandedURL;
                  if(this.options.onExpanded)
                  {
                     this.options.onExpanded();
                  }
               }
               else
               {
                  toggle.src = this.options.collapsedURL;
                  
                  var descendants = node.getDescendants();
                  
                  for(var i = 0; i < descendants.length; i++)
                  {
                     var selector = this.getSelector(descendants[i].id);
                     
                     if(selector)
                     {
                        selector.selected = false;
                     }
                  }
                     
                  this.updateSelection();
                  
                  if(this.options.onCollapssd)
                  {
                     this.options.onCollapssd();
                  }
               }
               
               this.updateExpansions();
            }
         }
      }
   },
   
   isExpanded: function(node)
   {
      if(this.options.isTable)
      {
         return(node.children.length > 0 && node.children[0].element.visible());
      }
      else
      {
         return node.childrenElement.visible();
      }
   },
   
   updateExpansions: function(id, isExpanding)
   {
      var expansions   = [];
      
      var nodes = this.root.getDescendants();
      
      for(var i = 0; i < nodes.length; i++)
      {
         if(nodes[i].id && nodes[i].children.length > 0 && this.isExpanded(nodes[i]))
         {
            expansions.push(nodes[i].id);
         }
      }
      
      this.expanded.value = expansions.join(",");

      if(this.options.persistant)
      {
         setCookie(this.options.persistant, this.expanded.value, 0, "/");
      }
   }
});

var TreeTable = Class.create(Tree,
{
   initialize: function($super, element, options)
   {
      if(!options)
      {
         options = {};   
      }
      
      options.isTable = true;
      
      $super(element, options);
   }
});


function disableSelect()
{
   if(positioning)
   {
      return false;
   }
}

function restoreSelect()
{
   return true;
}

document.onselectstart = disableSelect;

document.onmousedown = disableSelect;

document.onclick = restoreSelect;

_________________
“Whenever I'm about to do something, I think, 'Would an idiot do that?' And if they would, I do not do that thing.”

-Dwight


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 5th, 2009, 7:07 am 
Does anyone that knows Javascript well know how I can simulate double clicking the id?

I know there javascript function in there that will allow me to do it based on the item id, but nothing I try seems to work. I have been reading up on javascript all day, and haven't seemed to make any progress.

sinkfaze, you know a lot of javascript i believe. (you helped me in the past with it - thanks) Do you know what I might try on this?

This is a pretty big killer on a big project i'm working on, so if I can't figure it out, all i've done will be kind of worthless. Otherwise I would have given up by now... :(

I appreciate all the help thus far.


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 215 posts ]  Go to page Previous  1 ... 9, 10, 11, 12, 13, 14, 15  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: iBob35555VR and 12 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group