-
☆ A M B ☆
- 24,524 Posts
This block of code will handle plain document IDs, [~...~] tags, an regular URLs being entered into the weblink field.
It’s at line 1071 in the original document.parser.class.inc.php file from 0.9.2.1
// check whether it's a reference
if($this->documentObject['type']=="reference") {
if(is_numeric($this->documentObject['content'])) {
// if it's a bare document id
$this->documentObject['content'] = $this->makeUrl($this->documentObject['content']);
} elseif(strpos($this->documentObject['content'],'[~') !== false) {
// if it's an internal docid tag, process it
$this->documentObject['content'] = $this->rewriteUrls($this->documentObject['content']);
}
$this->sendRedirect($this->documentObject['content']);
}
I am trying to duplicate the functionality of the parent setting javascript so all you have to do is to click on the document you want the weblink to point to, but so far I haven’t been able to figure out the connector between the mutate_content frame and the document tree frame. For the javascript function in the tree to call the setParent function in the mutate_content frame (line 257 of 3.php), there is a variable "if(ca=="parent")" and I can’t figure out where that ca is coming from. I copied and renamed the relevant folder image trigger and the javascript functions involved(Link instead of Parent), so that part is OK.
-
☆ A M B ☆
- 24,524 Posts
Ok, I got that figured out. I moved the parent.menu.ca = "parent" into the enableParentSelection function, and put parent.menu.ca = "link" in the corresponding enableLinkSelection function.
I have it to the point now where I get the "unable to set link" alert message (I added that to the lang file). So progress is being made.
-
☆ A M B ☆
- 24,524 Posts
Well, I’ll be darned... I did it! OK, I don’t have my svn set up on this machine and really don’t feel like doing that right now, so here’s the files that were changed.
-
MODX Staff
- 12,272 Posts
Very nice Susan... Great job!
Ryan Thrash, MODX Co-Founder
Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
-
☆ A M B ☆
- 24,524 Posts
And thanks to your nagging (in such a nice way!), I’ve set up svn and commited the changes to my branch.
-
☆ A M B ☆
- 24,524 Posts
Ok, did a bit more to add features to the weblinks; actually to all the documents’ links.
There is a new field in the document editing page, "Link Attributes". This will get saved to a new field in the site_content table, link_attributes. Now a menu snippet can get that value and plug it in to the link just as it does the href and title attributes.
Just put in the full attribute for the links to that document, rel=’blah’, target=’blah’, id=’blah’, style=’blah’, whatever you want. You can even have more than one attribute; the field is 255 characters.
Being able to add an id or a style attribute to arbitrary links will make life much easier for designers to make up fancy menus.
Commited it to my svn branch.
-
MODX Staff
- 12,272 Posts
Thanks Susan and great job!
Ryan Thrash, MODX Co-Founder
Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
that looks very cool, nice addition.
-
☆ A M B ☆
- 24,524 Posts
An interesting bug in the mutate_content file was causing the menutitle and the link_attributes fields to lose anything in double-quotes. The problem was the lack of htmlspecialchars() around the values being loaded in to the input fields.
Line 578 (patched version) should have:
value="<?php echo htmlspecialchars(stripslashes($content['link_attributes']));?>"
Likewise, line 621 should have:
value="<?php echo htmlspecialchars(stripslashes($content['menutitle']));?>"
Patched and re-patched version of mutate_content.dynamic.php attached (remove the .txt part)