17 $this->FieldRenderer(
$form);
36 $this->tree =
new TreeControl(
"items");
37 $this->tree->width =
"320";
38 $this->tree->height =
"150";
39 $this->tree->selectMode =
"navigation";
40 $this->tree->onSelect =
"{$this->parent->id}_{$field}_selectItem";
46 $sectionNode =
new TreeNode(
$section->section,
$section->section,
null,
false,
"tree_node_closed",
"tree_node_open");
49 $contentByIdentifier = reindexList(
$content,
"identifier");
53 $category =
new TreeNode(
"content_type_".codify(
$section->section).
"_".codify(
$type),
$type,
null,
false,
"tree_node_closed",
"tree_node_open");
55 $categories[
$type] =
new TreeNode(
"category_".codify(
$section->section).
"_".codify(
$type),
$type,
null,
false,
"tree_node_closed",
"tree_node_open");
59 if (!array_key_exists($item->identifier, $contentByIdentifier))
continue;
62 if (method_exists($item, enumerateContentLinks))
64 $child =
new TreeNode(
"available[{$item->identifier}]", $item->identifier, $this->getLink(
$section, $item->identifier),
false,
"tree_node_closed",
"tree_node_open");
66 $subItems = $item->enumerateContentLinks();
68 foreach($subItems as $subItemTitle => $subItemLink)
70 $grandchild =
new TreeNode(
"available[{$item->identifier}.{$count}]", $subItemTitle, $this->
getLink($section, $subItemLink),
false,
"plain_tree_closed",
"plain_tree_open");
71 $grandchild->leafStyle =
"file_node_leaf";
72 $child->add($grandchild);
78 $child =
new TreeNode(
"available[{$item->identifier}]", $item->identifier, $this->getLink(
$section, $item->identifier),
false,
"plain_tree_closed",
"plain_tree_open");
79 $child->leafStyle =
"file_node_leaf";
81 $category->add($child);
84 $sectionNode->add($category);
87 $this->tree->add($sectionNode);
110 $url =
"/$identifier";
112 $url =
"/{$section->section}/$identifier";
120 <script type=
"text/javascript">
121 function {$this->parent->id}_{
$field}_showTree(e)
123 new DOMEvent(e).stop();
124 var popup = document.id(
'{$this->parent->id}_{$field}_tree_popup');
125 var txt = document.id(
'{$this->parent->id}_{$field}');
126 var coords = txt.getCoordinates();
127 popup.setStyles({
'display':
'block'});
128 var doc = document.id(document.body ? document.body : document.documentElement);
129 doc.addEvent(
'click', {$this->parent->id}_{
$field}_hideTree);
132 function {$this->parent->id}_{
$field}_hideTree()
134 var popup = document.id(
'{$this->parent->id}_{$field}_tree_popup');
135 popup.setStyles({
'display':
'none'});
136 var doc = document.id(document.body ? document.body : document.documentElement);
137 doc.removeEvent(
'click', {$this->parent->id}_{
$field}_hideTree);
140 function {$this->parent->id}_{
$field}_selectItem(url)
142 var txt = document.id(
'{$this->parent->id}_{$field}');
143 txt.set(
'value', url);
144 {$this->parent->id}_{
$field}_hideTree();
147 window.addEvent(
'domready',
function()
149 var popup = document.id(
'{$this->parent->id}_{$field}_tree_popup');
150 popup.addEvent(
'click',
function(e) {
new DOMEvent(e).stop(); });
169 $this->_startField(
$field);
171 $autocomplete = (!$this->autocomplete) ?
"autocomplete='off' " :
"";
172 $onchange = ($this->onChange) ?
"onchange='$this->onChange(this)'" :
"";
173 $disable = ($this->disable) ?
"disabled='disabled'" :
"";
175 if ($this->editableValue)
177 echo
"<input id='{$this->parent->id}_{$field}' type='text' name='$field' $onchange $autocomplete value='".htmlspecialchars($this->parent->data->get(
$field), ENT_QUOTES,
'UTF-8').
"' size='{$this->size}' $disable/>";
178 echo
" <a class='button' href='#' onclick='{$this->parent->id}_{$field}_showTree(event); return false;'>Browse</a><br/><div id='{$this->parent->id}_{$field}_tree_popup' style='display: none;position:absolute;'>";
179 $this->tree->writeHTML();
184 echo
"<input id='{$this->parent->id}_{$field}' type='hidden' name='$field' value='".htmlspecialchars($this->parent->data->get(
$field), ENT_QUOTES,
'UTF-8').
"'/>";
185 $this->tree->writeHTML();
CMSLinkSelectFieldRenderer(&$form, $field, $label)
renderSearchField($field, $mode="")
getLink($section, $identifier)
categorizeItemTypes($itemsByType)
static fireEvent($event, $parameter=null, $mustBeConsumed=false)
Fire an event to all subscribers as detailed in their manifests.
static usingFeature()
Uses the specified framework feature(s).
static using()
Import the datamodels, views and manifest for the specified component(s).
Section DataItem, defining the data model for sections within a site.
if(array_key_exists("HTTP_IF_MODIFIED_SINCE", $_SERVER)) $content