55 $this->pages = Query::create(
ComponentPage,
"ORDER BY component, identifier")->execute();
58 $this->table =
new DataListView($this->pages,
"component_pages");
59 $this->table->selector();
61 $contextMenu = $this->table->commandMenu();
62 $contextMenu->command(
"component_enable",
"Enable Pages",
"new ComponentPageList().setEnabled(1)",
false)
63 ->command(
"component_disable",
"Disable Pages",
"new ComponentPageList().setEnabled(0)",
false);
73 $this->table->column(
"Page",
"<a href='/admin/component_page_form?component_page_id={component_page_id}'>{identifier}</a>",
true,
"width: 50%")
74 ->column(
"Page Title",
"{page_title}")
75 ->column(
"Enabled", array($this,
formatEnabled),
false,
"width: 10%; text-align: center");
76 $this->table->sortable =
true;
77 $this->table->filter =
true;
78 $this->table->pageSize = 20;
87 return "<a href='/admin/component_form?component_id={$component->component_id}'>{$component->name}</a>";
92 $img =
$page->enabled ?
"on.png" :
"off.png";
93 $alt =
$page->enabled ?
"Enabled" :
"Disabled";
95 return "<img src='/fakoli/images/$img' id='enable_{$page->component_page_id}' alt='$alt' style='display: inline-block; vertical-align: middle; border: none; cursor: pointer' onclick='new ComponentPageList().toggleEnabled(this, {$page->component_page_id})'/>";
100 $out =
"<select onchange='new ComponentPageList().changeTemplate(this.value, {$page->component_page_id})' id='template_{$page->component_page_id}'>\n";
101 $out .=
"<option value=''></option>\n";
102 foreach($this->templates as $template)
104 $out .=
"<option value='$template'";
105 if (
$page->template == $template)
109 $out .=
">$template</option>";
118 $out =
"<button onclick=\"new ComponentPageList().rolePopup('roles_{$page->component_page_id}', {$page->component_page_id}, this); return false\" class='button small' style='float: right'>...</button>";
119 $out .=
"<span id=\"roles_{$page->component_page_id}\">$page->role</span>";
132 <div
class=
"dialog" id=
"rolePopup" style=
"width: 200px">
133 <div
class=
"dialog_header" id=
"rolePopupHeader">
134 <div
style=
"padding: 4px;">
135 <div
style=
"float: right">&
nbsp;<a
id=
'closeRolePopup'">Close ×</a></div>
136 <span"style=
"font-weight: bold">Roles</span>
139 <div
class=
"dialog_body">
144 <input type=
"checkbox" id=
"role_<?echo $role?>" value=
"<?echo $role?>"/>&
nbsp;<?echo
$name?><br/>
148 <button
class=
'button' style=
'float: right; margin-bottom: 4px' onclick=
'new ComponentPageList().updateRoles()'>Update Roles</button>
151 <div
class=
"dialog" id=
"sitePopup" style=
"width: 200px">
152 <div
class=
"dialog_header" id=
"sitePopupHeader">
153 <div
style=
"padding: 4px;">
154 <div
style=
"float: right">&
nbsp;<a
id=
'closeSitePopup'">Close ×</a></div>
155 <span"style=
"font-weight: bold">Sites</span>
158 <div
class=
"dialog_body">
159 <label
for=
"site_id">Select
Site: </label>
160 <select
id=
"site_id" name=
"site_id">
164 option($s->site_id, $s->site_name, 0);
168 <button
class=
'button' style=
'float: right; margin-bottom: 4px' onclick=
'new ComponentPageList().updateSites()'>Update Templates</button>
171 <div
class=
"dialog" id=
"templatePopup" style=
"width: 200px">
172 <div
class=
"dialog_header" id=
"templatePopupHeader">
173 <div
style=
"padding: 4px;">
174 <div
style=
"float: right">&
nbsp;<a
id=
'closeTemplatePopup'">Close ×</a></div>
175 <span"style=
"font-weight: bold">Templates</span>
178 <div
class=
"dialog_body">
179 <label
for=
"template_id">Select Template: </label>
180 <select
id=
'template_id'>
181 <option value=
''></option>
184 foreach($this->templates as $template)
186 option($template, $template,
"");
190 <button
class=
'button' style=
'float: right; margin-bottom: 4px' onclick=
'new ComponentPageList().updateTemplates()'>Update Templates</button>
194 $dialogs .= ob_get_contents();
199 <script type=
'text/javascript' src=
"/components/component/js/component_page_list.js"></script>
203 $script .= $this->table->writeScript();
209 return $this->table->drawView();
216 $home =
$config[
"homedir"] . DIRECTORY_SEPARATOR .
"templates";
218 trace(
"Scanning Templates", 3);
222 $folders = array(
"$dir");
224 while((
$dir = array_shift($folders)) !==
null)
226 $path =
"$home/$dir";
228 trace(
"Reading $path", 3);
230 $handle = opendir(
$path);
233 trace(
"Directory read failed for $path", 3);
237 while(
false !== (
$file = readdir($handle)))
239 trace(
"Checking $file", 4);
247 $l = (
$dir !=
'') ?
"$dir/$file" :
$file;
251 array_push($folders, $l);
253 else if (preg_match(
'/.tpl$/i',
$file))
ComponentPageListView($component=null)
static usingFeature()
Uses the specified framework feature(s).
static getComponents()
Retrieve an array of all the currently enabled components, indexed by component name.
static using()
Import the datamodels, views and manifest for the specified component(s).
static getRolesArray()
Retrieves the array of roles and their names for the current site for use in a CMS form.
if(php_sapi_name() !="cli") $home