Revision 1839
Added by darkviper almost 12 years ago
branches/2.8.x/CHANGELOG | ||
---|---|---|
12 | 12 |
=============================================================================== |
13 | 13 |
|
14 | 14 |
|
15 |
|
|
15 |
21 Dez-2012 Build 1839 Werner v.d.Decken(DarkViper) |
|
16 |
! the second optimization of runtime by recoding /admin/pages/index.php |
|
17 |
+ new class a_pages_PageTree() for use with /admin/pages/index.php |
|
16 | 18 |
13 Dez-2012 Build 1838 Dietmar Woellbrink (Luisehahne) |
17 | 19 |
! groups management now completely html valide |
18 | 20 |
13 Dez-2012 Build 1837 Dietmar Woellbrink (Luisehahne) |
branches/2.8.x/wb/admin/skel/themes/htt/pages.htt | ||
---|---|---|
1 | 1 |
<!-- BEGIN main_block --> |
2 | 2 |
<div class="{DISPLAY_ADD} left"> |
3 |
<h2>{HEADING_ADD_PAGE}</h2> |
|
4 |
<form name="add" action="add.php" method="post"> |
|
5 |
{FTAN} |
|
6 |
<table summary="" cellpadding="2" cellspacing="0" border="0" width="100%" align="center"> |
|
7 |
<tr>
|
|
8 |
<td width="70" height="20">{TEXT_TITLE}:</td> |
|
9 |
<td width="240" height="20"><input type="text" name="title" style="width: 232px;" /></td> |
|
10 |
<td rowspan="6" valign="top" style="padding-left: 20px; padding-top: 8px;">{TEXT_ADMINISTRATORS}: |
|
11 |
<ul style="list-style-type: none; margin: 0; padding: 0;"> |
|
12 |
<!-- BEGIN group_list_block -->
|
|
13 |
<li> |
|
14 |
<input type="checkbox" name="admin_groups[]" id="admin_group_{ID}" value="{ID}"{CHECKED}{DISABLED} /> |
|
15 |
<label for="admin_group_{TOGGLE}">{NAME}</label>
|
|
16 |
</li> |
|
17 |
<!-- END group_list_block -->
|
|
18 |
</ul> |
|
19 |
</td> |
|
20 |
<td rowspan="6" valign="top" style="padding-left: 20px; padding-top: 8px;"> |
|
21 |
<div id="viewers" style="display: none;">{TEXT_REGISTERED_VIEWERS}: |
|
22 |
<ul style="list-style-type: none; margin: 0; padding: 0;"> |
|
23 |
<!-- BEGIN group_list_block2 -->
|
|
24 |
<li> |
|
25 |
<input type="checkbox" name="viewing_groups[]" id="viewing_group_{ID}" value="{ID}"{CHECKED}{DISABLED} /> |
|
26 |
<label for="viewing_group_{TOGGLE}">{NAME}</label>
|
|
27 |
</li> |
|
28 |
<!-- END group_list_block2 -->
|
|
29 |
</ul> |
|
30 |
</div> |
|
31 |
</td> |
|
32 |
</tr>
|
|
33 |
<tr>
|
|
34 |
<td width="70">{TEXT_TYPE}:</td> |
|
35 |
<td width="240"> |
|
36 |
<select name="type" style="width: 240px;"> |
|
37 |
<!-- BEGIN module_list_block --> |
|
38 |
<option value="{VALUE}"{SELECTED}>{NAME}</option>
|
|
39 |
<!-- END module_list_block --> |
|
40 |
</select> |
|
41 |
</td> |
|
42 |
</tr>
|
|
43 |
<tr>
|
|
44 |
<td width="70">{TEXT_PARENT}:</td> |
|
45 |
<td width="240"> |
|
46 |
<select name="parent" style="width: 240px;" onchange="return disabled_hack_for_ie(this);">
|
|
47 |
<!-- BEGIN page_list_block2 -->
|
|
48 |
<option value="{ID}"{DISABLED} style="background: {FLAG_ROOT_ICON} no-repeat center left; padding-left: 20px;">{TITLE}</option>
|
|
49 |
<!-- END page_list_block2 -->
|
|
50 |
</select> |
|
51 |
</td> |
|
52 |
</tr>
|
|
53 |
<tr>
|
|
54 |
<td width="70">{TEXT_VISIBILITY}:</td> |
|
55 |
<td width="240"> |
|
56 |
<select name="visibility" onchange="javascript: toggle_viewers();" style="width: 240px;"> |
|
57 |
<option value="public"{SELECTED}>{TEXT_PUBLIC}</option> |
|
58 |
<option value="private">{TEXT_PRIVATE}</option> |
|
59 |
<option value="registered">{TEXT_REGISTERED}</option> |
|
60 |
<option value="hidden">{TEXT_HIDDEN}</option> |
|
61 |
<option value="none">{TEXT_NONE}</option> |
|
62 |
</select> |
|
63 |
</td> |
|
64 |
</tr>
|
|
65 |
<tr>
|
|
66 |
<td width="70"> </td> |
|
67 |
<td colspan="4"> |
|
68 |
<input type="submit" name="submit" value="{TEXT_ADD}" style="width: 117px;" /> |
|
69 |
<input type="reset" name="reset" value="{TEXT_RESET}" style="width: 117px;" /> |
|
70 |
</td> |
|
71 |
</tr>
|
|
72 |
<tr>
|
|
73 |
<td> </td> |
|
74 |
<td> </td> |
|
75 |
</tr>
|
|
76 |
</table> |
|
77 |
</form> |
|
3 |
<h2>{HEADING_ADD_PAGE}</h2>
|
|
4 |
<form name="add" action="add.php" method="post">
|
|
5 |
{FTAN}
|
|
6 |
<table summary="" cellpadding="2" cellspacing="0" border="0" width="100%" align="center">
|
|
7 |
<tr>
|
|
8 |
<td width="70" height="20">{TEXT_TITLE}:</td>
|
|
9 |
<td width="240" height="20"><input type="text" name="title" style="width: 232px;" /></td>
|
|
10 |
<td rowspan="6" valign="top" style="padding-left: 20px; padding-top: 8px;">{TEXT_ADMINISTRATORS}:
|
|
11 |
<ul style="list-style-type: none; margin: 0; padding: 0;">
|
|
12 |
<!-- BEGIN admingroups_list_block -->
|
|
13 |
<li>
|
|
14 |
<input type="checkbox" name="admin_groups[]" id="admin_group_{ID}" value="{ID}"{CHECKED}{DISABLED} />
|
|
15 |
<label for="admin_group_{ID}">{NAME}</label>
|
|
16 |
</li>
|
|
17 |
<!-- END admingroups_list_block -->
|
|
18 |
</ul>
|
|
19 |
</td>
|
|
20 |
<td rowspan="6" valign="top" style="padding-left: 20px; padding-top: 8px;">
|
|
21 |
<div id="viewers" style="display: none;">{TEXT_REGISTERED_VIEWERS}:
|
|
22 |
<ul style="list-style-type: none; margin: 0; padding: 0;">
|
|
23 |
<!-- BEGIN viewergroups_list_block -->
|
|
24 |
<li>
|
|
25 |
<input type="checkbox" name="viewing_groups[]" id="viewing_group_{ID}" value="{ID}"{CHECKED}{DISABLED} />
|
|
26 |
<label for="viewing_group_{ID}">{NAME}</label>
|
|
27 |
</li>
|
|
28 |
<!-- END viewergroups_list_block -->
|
|
29 |
</ul>
|
|
30 |
</div>
|
|
31 |
</td>
|
|
32 |
</tr>
|
|
33 |
<tr>
|
|
34 |
<td width="70">{TEXT_TYPE}:</td>
|
|
35 |
<td width="240">
|
|
36 |
<select name="type" style="width: 240px;">
|
|
37 |
<!-- BEGIN module_list_block -->
|
|
38 |
<option value="{DIRECTORY}"{SELECTED}>{NAME}</option>
|
|
39 |
<!-- END module_list_block -->
|
|
40 |
</select>
|
|
41 |
</td>
|
|
42 |
</tr>
|
|
43 |
<tr>
|
|
44 |
<td width="70">{TEXT_PARENT}:</td>
|
|
45 |
<td width="240">
|
|
46 |
<select name="parent" class="pages-parent-list" style="width: 240px;" onchange="return disabled_hack_for_ie(this);">
|
|
47 |
<!-- BEGIN parents_list_block -->
|
|
48 |
<option value="{ID}"{DISABLED}{FLAG_ROOT_ICON}>{TITLE}</option>
|
|
49 |
<!-- END parents_list_block -->
|
|
50 |
</select>
|
|
51 |
</td>
|
|
52 |
</tr>
|
|
53 |
<tr>
|
|
54 |
<td width="70">{TEXT_VISIBILITY}:</td>
|
|
55 |
<td width="240">
|
|
56 |
<select name="visibility" onchange="javascript: toggle_viewers();" style="width: 240px;">
|
|
57 |
<option value="public"{SELECTED}>{TEXT_PUBLIC}</option>
|
|
58 |
<option value="private">{TEXT_PRIVATE}</option>
|
|
59 |
<option value="registered">{TEXT_REGISTERED}</option>
|
|
60 |
<option value="hidden">{TEXT_HIDDEN}</option>
|
|
61 |
<option value="none">{TEXT_NONE}</option>
|
|
62 |
</select>
|
|
63 |
</td>
|
|
64 |
</tr>
|
|
65 |
<tr>
|
|
66 |
<td width="70"> </td>
|
|
67 |
<td colspan="4">
|
|
68 |
<input type="submit" name="submit" value="{TEXT_ADD}" style="width: 117px;" />
|
|
69 |
<input type="reset" name="reset" value="{TEXT_RESET}" style="width: 117px;" />
|
|
70 |
</td>
|
|
71 |
</tr>
|
|
72 |
<tr>
|
|
73 |
<td> </td>
|
|
74 |
<td> </td>
|
|
75 |
</tr>
|
|
76 |
</table>
|
|
77 |
</form>
|
|
78 | 78 |
</div> |
79 | 79 |
<div class="{DISPLAY_INTRO}" style="padding-top: 10px;"> |
80 |
<br /> |
|
81 |
<h2>{HEADING_MODIFY_INTRO_PAGE}</h2> |
|
82 |
<a href="intro.php">{INTRO_LINK}</a>
|
|
80 |
<br />
|
|
81 |
<h2>{HEADING_MODIFY_INTRO_PAGE}</h2>
|
|
82 |
<a href="intro.php" title="{INTRO_LINK}">{INTRO_LINK}</a>
|
|
83 | 83 |
</div> |
84 | 84 |
<!-- Addition for remembering expanded state of pages --> |
85 |
<script type="text/javascript"> |
|
86 |
var THEME_URL = '{THEME_URL}'; |
|
87 |
var WB_URL = '{WB_URL}'; |
|
88 |
</script> |
|
89 | 85 |
<script src="{ADMIN_URL}/pages/page_index.js" type="text/javascript"></script> |
90 | 86 |
<!-- END main_block --> |
branches/2.8.x/wb/admin/pages/PageTree.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
/** |
|
4 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
|
5 |
* |
|
6 |
* This program is free software: you can redistribute it and/or modify |
|
7 |
* it under the terms of the GNU General Public License as published by |
|
8 |
* the Free Software Foundation, either version 3 of the License, or |
|
9 |
* (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
18 |
*/ |
|
19 |
/** |
|
20 |
* Description of PageTree |
|
21 |
* |
|
22 |
* @category WbACP |
|
23 |
* @package WbACP_Pages |
|
24 |
* @author Werner v.d. Decken <wkl@isteam.de> |
|
25 |
* @copyright Werner v.d. Decken <wkl@isteam.de> |
|
26 |
* @license http://www.gnu.org/licenses/gpl.html GPL License |
|
27 |
* @version 1.0.0 |
|
28 |
* @revision $Revision$ |
|
29 |
* @link $HeadURL$ |
|
30 |
* @lastmodified $Date$ |
|
31 |
* @since file added on 2012-12-21 |
|
32 |
*/ |
|
33 |
|
|
34 |
class a_pages_PageTree |
|
35 |
{ |
|
36 |
/** @var array language definitions */ |
|
37 |
private $_TEXT = null; |
|
38 |
/** @var array language definitions */ |
|
39 |
private $_MESSAGE = null; |
|
40 |
/** @var array language definitions */ |
|
41 |
private $_HEADING = null; |
|
42 |
/** @var object instance of the application object */ |
|
43 |
private $_oApp = null; |
|
44 |
/** @var object instance of the database object */ |
|
45 |
private $_oDb = null; |
|
46 |
/** @var array holds several values from the application global scope */ |
|
47 |
private $_aReg = array(); |
|
48 |
/** @var string full HTML formattet list of pages */ |
|
49 |
private $_sOutput = ''; |
|
50 |
/** @var integer number of all reachable pages */ |
|
51 |
private $_iPagesTotal = 0; |
|
52 |
/** @var integer number of all writeable pages */ |
|
53 |
private $_iPagesWriteable = 0; |
|
54 |
/** @var integer index for toggle background color of the list */ |
|
55 |
private $_iLineColor = 0; |
|
56 |
/** @var array entries to build a select list for parents */ |
|
57 |
private $_aParentList = array(); |
|
58 |
/** @var integer count all executed database requests passing all iterations. */ |
|
59 |
private $_queries = 0; |
|
60 |
/** |
|
61 |
* constructor used to import some application constants and objects |
|
62 |
*/ |
|
63 |
public function __construct() |
|
64 |
{ |
|
65 |
// import global vars and objects |
|
66 |
$this->_wbAdaptor(); |
|
67 |
} |
|
68 |
/** |
|
69 |
* parse the page tree and return |
|
70 |
* @return type |
|
71 |
*/ |
|
72 |
public function parseTree() { |
|
73 |
return $this->_createTree(); |
|
74 |
} |
|
75 |
/** |
|
76 |
* parse the page tree and print it out |
|
77 |
*/ |
|
78 |
public function displayTree() { |
|
79 |
echo $this->parseTree(); |
|
80 |
} |
|
81 |
/** |
|
82 |
* total number of found pages which are visible for actual user |
|
83 |
* @return integer |
|
84 |
*/ |
|
85 |
public function getTotalPages() { |
|
86 |
return $this->_iPagesTotal; |
|
87 |
} |
|
88 |
/** |
|
89 |
* number of found pages which are writable for actual user |
|
90 |
* @return integer |
|
91 |
*/ |
|
92 |
public function getWriteablePages() { |
|
93 |
return $this->_iPagesWriteable; |
|
94 |
} |
|
95 |
/** |
|
96 |
* a list with all possible parent pages |
|
97 |
* @return array |
|
98 |
*/ |
|
99 |
public function getParentList() { |
|
100 |
if(!$this->_sOutput) { |
|
101 |
$this->parseTree(); |
|
102 |
} |
|
103 |
return $this->_aParentList; |
|
104 |
} |
|
105 |
/** |
|
106 |
* used to import some WB-constants and objects |
|
107 |
*/ |
|
108 |
private function _wbAdaptor() |
|
109 |
{ |
|
110 |
$this->_TEXT = $GLOBALS['TEXT']; |
|
111 |
$this->_MESSAGE = $GLOBALS['MESSAGE']; |
|
112 |
$this->_HEADING = $GLOBALS['HEADING']; |
|
113 |
$this->_oApp = $GLOBALS['admin']; |
|
114 |
$this->_oDb = WbDatabase::getInstance(); |
|
115 |
$this->_aReg['PAGE_TRASH'] = PAGE_TRASH; |
|
116 |
$this->_aReg['PAGE_LEVEL_LIMIT'] = PAGE_LEVEL_LIMIT; |
|
117 |
$this->_aReg['MANAGE_SECTIONS'] = MANAGE_SECTIONS; |
|
118 |
$this->_aReg['WB_URL'] = WB_URL; |
|
119 |
$this->_aReg['WB_REL'] = WB_REL; |
|
120 |
$this->_aReg['ACP_REL'] = ADMIN_REL; |
|
121 |
$this->_aReg['THEME_REL'] = THEME_REL; |
|
122 |
$this->_aReg['TABLE_PREFIX'] = TABLE_PREFIX; |
|
123 |
} |
|
124 |
/** |
|
125 |
* create a page tree as a well formatted, unordered list |
|
126 |
* @return string the whoole list |
|
127 |
*/ |
|
128 |
private function _createTree() |
|
129 |
{ |
|
130 |
// compose the complete list |
|
131 |
$sOutput = '' |
|
132 |
// build the head |
|
133 |
. $this->_Tabs(0 , true).'<div class="pages_list">'.PHP_EOL |
|
134 |
. $this->_Tabs(1).'<table>'.PHP_EOL |
|
135 |
. $this->_Tabs(1).'<tbody>'.PHP_EOL |
|
136 |
. $this->_Tabs(1).'<tr class="pages_list_header">'.PHP_EOL |
|
137 |
. $this->_Tabs(1).'<th class="header_list_menu_title">'.$this->_TEXT['VISIBILITY']. |
|
138 |
' / '.$this->_TEXT['MENU_TITLE'].':</th>'.PHP_EOL |
|
139 |
. $this->_Tabs(0).'<th class="header_list_page_title">'.$this->_TEXT['PAGE_TITLE']. |
|
140 |
'</th>'.PHP_EOL |
|
141 |
. $this->_Tabs(0).'<th class="header_list_page_id">PID</th>'.PHP_EOL |
|
142 |
. $this->_Tabs(0).'<th class="header_list_actions">'.$this->_TEXT['ACTIONS']. |
|
143 |
':</th>'.PHP_EOL |
|
144 |
. $this->_Tabs(0).'<th class="list_page_id"> </th>'.PHP_EOL |
|
145 |
. $this->_Tabs(-1).'</tr>'.PHP_EOL |
|
146 |
. $this->_Tabs(-1).'</tbody>'.PHP_EOL |
|
147 |
. $this->_Tabs(-1).'</table>'.PHP_EOL |
|
148 |
// generate the page lines |
|
149 |
. $this->_IterateTree() |
|
150 |
// build the footer |
|
151 |
. $this->_Tabs(-1).'</div>'.PHP_EOL; |
|
152 |
; |
|
153 |
$this->_sOutput = $sOutput; |
|
154 |
return $sOutput; |
|
155 |
} |
|
156 |
/** |
|
157 |
* Create a string of multiple TABs to prettify the HTML-output |
|
158 |
* ingrease the number of TABs with a positive and degrease with an negative Value. |
|
159 |
* '0' means: do not change the value. Or set an absolute number using $bRelative=false |
|
160 |
* @staticvar int $iTabLevel |
|
161 |
* @param integer $iTabsDiv number of TABs to add/sub |
|
162 |
* @param bool $bRelative false if should be set to absolute value |
|
163 |
* @return string |
|
164 |
*/ |
|
165 |
private function _Tabs($iTabsDiv = 0, $bRelative = true) |
|
166 |
{ |
|
167 |
static $iTabLevel = 0; |
|
168 |
$iTabLevel = ($bRelative ? $iTabLevel + $iTabsDiv : $iTabsDiv); |
|
169 |
$iTabLevel += ($iTabLevel < 0 ? 0 - $iTabLevel : $iTabsDiv); |
|
170 |
return str_repeat("\t", $iTabLevel); |
|
171 |
} |
|
172 |
/** |
|
173 |
* compose the needed SQL statement |
|
174 |
* @param integer $iParentKey |
|
175 |
* @return string SQL statement |
|
176 |
*/ |
|
177 |
private function _makeSql($iParentKey = 0) |
|
178 |
{ |
|
179 |
if($this->_aReg['PAGE_TRASH'] != 'inline') { |
|
180 |
$sUseTrash = ' AND `visibility`!=\'deleted\''; |
|
181 |
}else { $sUseTrash = ''; } |
|
182 |
$sql = 'SELECT ( SELECT COUNT(*) ' |
|
183 |
. 'FROM `'.$this->_aReg['TABLE_PREFIX'].'pages` `x` ' |
|
184 |
. 'WHERE x.`parent`=p.`page_id`' |
|
185 |
. ') `children`, ' |
|
186 |
. 's.`module`, MAX(s.`publ_start` + s.`publ_end`) published, p.`link`, ' |
|
187 |
. '(SELECT MAX(`position`) FROM `'.$this->_aReg['TABLE_PREFIX'].'pages` ' |
|
188 |
. 'WHERE `parent`='.$iParentKey.') max_position, ' |
|
189 |
. '0 min_position, ' |
|
190 |
. 'p.`position`, ' |
|
191 |
. 'p.`page_id`, p.`parent`, p.`level`, p.`language`, p.`admin_groups`, ' |
|
192 |
. 'p.`admin_users`, p.`viewing_groups`, p.`viewing_users`, p.`visibility`, ' |
|
193 |
. 'p.`menu_title`, p.`page_title`, p.`page_trail` ' |
|
194 |
. 'FROM `'.$this->_aReg['TABLE_PREFIX'].'pages` p ' |
|
195 |
. 'INNER JOIN `'.$this->_aReg['TABLE_PREFIX'].'sections` s ' |
|
196 |
. 'ON p.`page_id`=s.`page_id` ' |
|
197 |
. 'WHERE `parent`='.$iParentKey.$sUseTrash.' ' |
|
198 |
. 'GROUP BY p.`page_id` ' |
|
199 |
. 'ORDER BY p.`position` ASC'; |
|
200 |
return $sql; |
|
201 |
} |
|
202 |
/** |
|
203 |
* iterate through all nodes which having subnodes |
|
204 |
* @param integer $iParent |
|
205 |
* @return string all of the item lines |
|
206 |
*/ |
|
207 |
private function _IterateTree($iParent = 0) |
|
208 |
{ |
|
209 |
$sOutput = ''; |
|
210 |
// Get page list from database |
|
211 |
if(($oPages = $this->_oDb->query($this->_makeSql($iParent)))) |
|
212 |
{ |
|
213 |
$this->_queries++; |
|
214 |
// output block-header |
|
215 |
$sOutput .= $this->_Tabs(0).'<ul id="p'.$iParent.'" class="page_list"'; |
|
216 |
if(!$iParent) { |
|
217 |
$sOutput .= ' style="display: block;"'; |
|
218 |
}else { |
|
219 |
// show block depending from Cookies |
|
220 |
if (isset ($_COOKIE['p'.$iParent]) && $_COOKIE['p'.$iParent] == '1') { |
|
221 |
$sOutput .= ' style="display: block;"'; |
|
222 |
} |
|
223 |
} |
|
224 |
$sOutput .= '>'.PHP_EOL; |
|
225 |
$iMinPosition = 1; |
|
226 |
while($aPage = $oPages->fetchRow(MYSQL_ASSOC)) |
|
227 |
{ // iterate through the current branch |
|
228 |
$aPage['min_position'] = ($aPage['position'] < $iMinPosition ? $aPage['position'] : $iMinPosition); |
|
229 |
$this->_iLineColor = $this->_iPagesTotal++ % 2; |
|
230 |
$aPage['iswriteable'] = false; |
|
231 |
if( $this->_oApp->ami_group_member($aPage['admin_users']) || |
|
232 |
$this->_oApp->is_group_match($this->_oApp->get_groups_id(), $aPage['admin_groups'])) |
|
233 |
{ |
|
234 |
if(($aPage['visibility'] == 'deleted' && $this->_aReg['PAGE_TRASH'] == 'inline') || |
|
235 |
($aPage['visibility'] != 'deleted')) |
|
236 |
{ |
|
237 |
$aPage['iswriteable'] = true; |
|
238 |
$this->_iPagesWriteable++; |
|
239 |
} |
|
240 |
} else { |
|
241 |
if($aPage['visibility'] == 'private') { continue; } |
|
242 |
} |
|
243 |
// add this item to the secondary list of parents |
|
244 |
$this->_addToParentList($aPage); |
|
245 |
$sOutput .= $this->_createListItem($aPage); |
|
246 |
} |
|
247 |
$sOutput .= $this->_Tabs(-1).'</ul>'.PHP_EOL; |
|
248 |
} |
|
249 |
return $sOutput; |
|
250 |
} |
|
251 |
/** |
|
252 |
* formating the given page object for output |
|
253 |
* @param type $aPage |
|
254 |
* @return string |
|
255 |
*/ |
|
256 |
private function _createListItem($aPage) |
|
257 |
{ |
|
258 |
// output the current item |
|
259 |
// --- HEADER ------------------------------------------------------------------------ |
|
260 |
$sOutput = $this->_Tabs(0).'<li class="p'.$aPage['parent'].'">'.PHP_EOL |
|
261 |
. $this->_Tabs(1).'<table class="pages_view">'.PHP_EOL |
|
262 |
. $this->_Tabs(1).'<tbody>'.PHP_EOL |
|
263 |
. $this->_Tabs(1).'<tr class="row_'.$this->_iLineColor.'">'.PHP_EOL; |
|
264 |
// --- TAB 1 --- (expand/collapse) --------------------------------------------------- |
|
265 |
$sOutput .= $this->_Tabs(1).'<td valign="middle" width="20" style="padding-left: ' |
|
266 |
. (int)($aPage['level']*20).'px;">'; |
|
267 |
if((bool)$aPage['children']) { |
|
268 |
$sOutput .= '<a href="javascript:toggle_visibility(\'p'.$aPage['page_id'].'\');" ' |
|
269 |
. 'title="'.$this->_TEXT['EXPAND'].'/'.$this->_TEXT['COLLAPSE'].'">' |
|
270 |
. '<span><img src="'.$this->_aReg['THEME_REL'].'/images/' |
|
271 |
. ( ((isset($_COOKIE['p'.$aPage['page_id']]) |
|
272 |
&& $_COOKIE['p'.$aPage['page_id']] == '1') ? 'minus' : 'plus') |
|
273 |
) |
|
274 |
. '_16.png" onclick="toggle_plus_minus(\''.$aPage['page_id'].'\');" ' |
|
275 |
. 'name="plus_minus_'.$aPage['page_id'].'" alt="+" /></span></a>'; |
|
276 |
}else { |
|
277 |
$sOutput .= ' '; |
|
278 |
} |
|
279 |
$sOutput .= '</td>'.PHP_EOL; |
|
280 |
// --- TAB 2 --- (menu title) -------------------------------------------------------- |
|
281 |
switch($aPage['visibility']): |
|
282 |
case 'private': |
|
283 |
$sIcon = 'private_16.png'; |
|
284 |
$sText = $this->_TEXT['PRIVATE']; |
|
285 |
break; |
|
286 |
case 'registered': |
|
287 |
$sIcon = 'keys_16.png'; |
|
288 |
$sText = $this->_TEXT['REGISTERED']; |
|
289 |
break; |
|
290 |
case 'hidden': |
|
291 |
$sIcon = 'hidden_16.png'; |
|
292 |
$sText = $this->_TEXT['HIDDEN']; |
|
293 |
break; |
|
294 |
case 'none': |
|
295 |
$sIcon = 'none_16.png'; |
|
296 |
$sText = $this->_TEXT['NONE']; |
|
297 |
break; |
|
298 |
case 'deleted': |
|
299 |
$sIcon = 'deleted_16.png'; |
|
300 |
$sText = $this->_TEXT['DELETED']; |
|
301 |
break; |
|
302 |
default: // public |
|
303 |
$sIcon = 'visible_16.png'; |
|
304 |
$sText = $this->_TEXT['PUBLIC']; |
|
305 |
break; |
|
306 |
endswitch; |
|
307 |
$sOutput .= $this->_Tabs(0).'<td class="list_menu_title">'; |
|
308 |
if($this->_oApp->get_permission('pages_modify') && $aPage['iswriteable']) { |
|
309 |
$sOutput .= '<a href="'.$this->_aReg['ACP_REL'].'/pages/modify.php?page_id=' |
|
310 |
. $aPage['page_id'].'" title="'.$this->_TEXT['MODIFY'].'">'; |
|
311 |
} |
|
312 |
$sOutput .= '<img src="'.$this->_aReg['THEME_REL'].'/images/'.$sIcon.'" ' |
|
313 |
. 'alt="'.$this->_TEXT['VISIBILITY'].': '.$sText.'" class="page_list_rights" />'; |
|
314 |
if($this->_oApp->get_permission('pages_modify') && $aPage['iswriteable']) { |
|
315 |
$sOutput .= '<span class="modify_link">'.$aPage['menu_title'].'</span></a>'; |
|
316 |
}else { |
|
317 |
$sOutput .= '<span class="bold grey">'.$aPage['menu_title'].'</span>'; |
|
318 |
} |
|
319 |
$sOutput .= '</td>'.PHP_EOL; |
|
320 |
// --- TAB 3 --- (page title) -------------------------------------------------------- |
|
321 |
$sOutput .= $this->_Tabs(0).'<td class="list_page_title">'.$aPage['page_title'].'</td>'.PHP_EOL; |
|
322 |
// --- TAB 4 --- (page ID) ----------------------------------------------------------- |
|
323 |
$sOutput .= $this->_Tabs(0).'<td class="list_page_id right">'.$aPage['page_id'].'</td>'.PHP_EOL; |
|
324 |
// --- TAB 5 --- (show this page in new window) -------------------------------------- |
|
325 |
$sOutput .= $this->_Tabs(0).'<td class="list_actions">'; |
|
326 |
if($aPage['visibility'] != 'deleted' && $aPage['visibility'] != 'none') { |
|
327 |
$sPageLink = $this->_aReg['WB_REL'].preg_replace( |
|
328 |
'/^'.preg_quote($this->_aReg['WB_URL'], '/').'/siU', |
|
329 |
'', |
|
330 |
$this->_oApp->page_link($aPage['link']) |
|
331 |
); |
|
332 |
$sOutput .= '<a href="'.$sPageLink.'" target="_blank" title="'.$this->_TEXT['VIEW'] |
|
333 |
. '"><img src="'.$this->_aReg['THEME_REL'].'/images/view_16.png" alt="' |
|
334 |
. $this->_TEXT['VIEW'].'" /></a>'; |
|
335 |
}else { |
|
336 |
$sOutput .= '<img src="'.$this->_aReg['THEME_REL'].'/images/blank_16.gif" alt=" " />'; |
|
337 |
} |
|
338 |
$sOutput .= '</td>'.PHP_EOL; |
|
339 |
|
|
340 |
// --- TAB 6 --- (edit settings) ----------------------------------------------------- |
|
341 |
$sOutput .= $this->_Tabs(0).'<td class="list_actions">'; |
|
342 |
if($aPage['visibility'] != 'deleted') { |
|
343 |
if($this->_oApp->get_permission('pages_settings') && $aPage['iswriteable']) { |
|
344 |
$sOutput .= '<a href="'.$this->_aReg['ACP_REL'].'/pages/settings.php?page_id=' |
|
345 |
. $aPage['page_id'].'" title="'.$this->_TEXT['SETTINGS'].'">' |
|
346 |
. '<img src="'.$this->_aReg['THEME_REL'].'/images/modify_16.png" alt="' |
|
347 |
. $this->_TEXT['SETTINGS'].'" /></a>'; |
|
348 |
} |
|
349 |
}else { |
|
350 |
$sOutput .= '<a href="'.$this->_aReg['ACP_REL'].'/pages/restore.php?page_id='.$aPage['page_id'].'" ' |
|
351 |
. 'title="'.$this->_TEXT['RESTORE'].'"><img src="'.$this->_aReg['THEME_REL'] |
|
352 |
. '/images/restore_16.png" alt="'.$this->_TEXT['RESTORE'].'" /></a>'; |
|
353 |
} |
|
354 |
$sOutput .= '</td>'.PHP_EOL; |
|
355 |
|
|
356 |
// --- TAB 7 --- (edit sections) ----------------------------------------------------- |
|
357 |
$sOutput .= $this->_Tabs(0).'<td class="list_actions">'; |
|
358 |
if( $this->_aReg['MANAGE_SECTIONS'] && $this->_oApp->get_permission('pages_add') && $aPage['iswriteable'] ) { |
|
359 |
$file = $this->_oApp->page_is_active($aPage) ? "clock_16.png" : "clock_red_16.png"; |
|
360 |
$file = ($aPage['published'] && $aPage['module'] != 'menu_link') ? $file : 'noclock_16.png'; |
|
361 |
$sOutput .= '<a href="'.$this->_aReg['ACP_REL'].'/pages/sections.php?page_id=' |
|
362 |
. $aPage['page_id'].'" title="'.$this->_HEADING['MANAGE_SECTIONS'].'">' |
|
363 |
. '<img src="'.$this->_aReg['THEME_REL'].'/images/'.$file.'" alt="' |
|
364 |
. $this->_HEADING['MANAGE_SECTIONS'].'" /></a>'; |
|
365 |
}else { |
|
366 |
$sOutput .= '<img src="'.$this->_aReg['THEME_REL'].'/images/blank_16.gif" alt=" " />'; |
|
367 |
} |
|
368 |
$sOutput .= '</td>'.PHP_EOL; |
|
369 |
|
|
370 |
// --- TAB 8 --- (move up) ----------------------------------------------------------- |
|
371 |
$sOutput .= $this->_Tabs(0).'<td class="list_actions">'; |
|
372 |
if($aPage['position'] > $aPage['min_position']) { |
|
373 |
if($aPage['visibility'] != 'deleted') { |
|
374 |
if($this->_oApp->get_permission('pages_settings') && $aPage['iswriteable']) { |
|
375 |
$sOutput .= '<a href="'.$this->_aReg['ACP_REL'].'/pages/move_up.php?page_id=' |
|
376 |
. $aPage['page_id'].'" title="'.$this->_TEXT['MOVE_UP'] |
|
377 |
. '"><img src="'.$this->_aReg['THEME_REL'].'/images/up_16.png" alt="' |
|
378 |
. $this->_TEXT['MOVE_UP'].'" /></a>'; |
|
379 |
} |
|
380 |
} |
|
381 |
} |
|
382 |
$sOutput .= '</td>'.PHP_EOL; |
|
383 |
|
|
384 |
// --- TAB 9 --- (move down) --------------------------------------------------------- |
|
385 |
$sOutput .= $this->_Tabs(0).'<td class="list_actions">'; |
|
386 |
if($aPage['position'] < $aPage['max_position']) { |
|
387 |
if($aPage['visibility'] != 'deleted') { |
|
388 |
if($this->_oApp->get_permission('pages_settings') && $aPage['iswriteable']) { |
|
389 |
$sOutput .= '<a href="'.$this->_aReg['ACP_REL'].'/pages/move_down.php?page_id=' |
|
390 |
. $aPage['page_id'].'" title="'.$this->_TEXT['MOVE_DOWN'] |
|
391 |
. '"><img src="'.$this->_aReg['THEME_REL'].'/images/down_16.png" alt="' |
|
392 |
. $this->_TEXT['MOVE_DOWN'].'" /></a>'; |
|
393 |
} |
|
394 |
} |
|
395 |
} |
|
396 |
$sOutput .= '</td>'.PHP_EOL; |
|
397 |
|
|
398 |
// --- TAB 10 --- (delete page) ------------------------------------------------------ |
|
399 |
$sOutput .= $this->_Tabs(0).'<td class="list_actions">'; |
|
400 |
if($this->_oApp->get_permission('pages_delete') && $aPage['iswriteable']) { |
|
401 |
$sOutput .= '<a href="javascript:confirm_link(pages_delete_confirm+\'?\',\'' |
|
402 |
. $this->_aReg['ACP_REL'].'/pages/delete.php?page_id=' |
|
403 |
. $this->_oApp->getIDKEY($aPage['page_id']).'\');" title="' |
|
404 |
. $this->_TEXT['DELETE'].'"><img src="'.$this->_aReg['THEME_REL'] |
|
405 |
. '/images/delete_16.png" alt="'.$this->_TEXT['DELETE'].'" /></a>'; |
|
406 |
}else { |
|
407 |
$sOutput .= '<img src="'.$this->_aReg['THEME_REL'].'/images/blank_16.gif" alt=" " />'; |
|
408 |
} |
|
409 |
$sOutput .= '</td>'.PHP_EOL; |
|
410 |
|
|
411 |
// --- TAB 11 --- (add child page) --------------------------------------------------- |
|
412 |
$sOutput .= $this->_Tabs(0).'<td class="list_actions">'; |
|
413 |
if( |
|
414 |
$this->_oApp->get_permission('pages_add') |
|
415 |
&& $aPage['iswriteable'] |
|
416 |
&& ($aPage['visibility'] != 'deleted') |
|
417 |
&& $aPage['level'] < ($this->_aReg['PAGE_LEVEL_LIMIT'] - 1) |
|
418 |
) |
|
419 |
{ |
|
420 |
$sOutput .= '<a href="javascript:add_child_page(\''.$aPage['page_id'].'\');" ' |
|
421 |
. 'title="'.$this->_HEADING['ADD_CHILD_PAGE'].'"><img src="' |
|
422 |
. $this->_aReg['THEME_REL'].'/images/siteadd.png" name="addpage_'.$aPage['page_id'] |
|
423 |
. '" alt="'.$this->_HEADING['ADD_CHILD_PAGE'].'" /></a>'; |
|
424 |
}else { |
|
425 |
$sOutput .= ' '; |
|
426 |
} |
|
427 |
$sOutput .= '</td>'.PHP_EOL; |
|
428 |
// --- TAB 12 --- (show language) ---------------------------------------------------- |
|
429 |
$sOutput .= $this->_Tabs(0).'<td class="list_page_id center">'.$aPage['language'].'</td>'.PHP_EOL; |
|
430 |
// --- FOOTER ------------------------------------------------------------------------ |
|
431 |
$sOutput .= $this->_Tabs(-1).'</tr>'.PHP_EOL |
|
432 |
. $this->_Tabs(-1).'</tbody>'.PHP_EOL |
|
433 |
. $this->_Tabs(-1).'</table>'.PHP_EOL; |
|
434 |
// if there children, iterate through this children now |
|
435 |
if((bool)$aPage['children']) { |
|
436 |
$sOutput .= $this->_IterateTree($aPage['page_id']); |
|
437 |
} |
|
438 |
$sOutput .= $this->_Tabs(-1).'</li>'.PHP_EOL; |
|
439 |
return $sOutput; |
|
440 |
} // end of method _createListItem |
|
441 |
/** |
|
442 |
* build a list of possible parent pages |
|
443 |
* @param array $aPage |
|
444 |
*/ |
|
445 |
private function _addToParentList(array $aPage) |
|
446 |
{ |
|
447 |
if( ($aPage['level'] < ($this->_aReg['PAGE_LEVEL_LIMIT'] - 1)) |
|
448 |
&& $aPage['iswriteable'] |
|
449 |
&& ($aPage['visibility'] != 'deleted') |
|
450 |
&& $this->_oApp->get_permission('pages_add') ) |
|
451 |
{ |
|
452 |
$aNewEntry = array(); |
|
453 |
$aNewEntry['ID'] = $aPage['page_id']; |
|
454 |
$aNewEntry['TITLE'] = $aPage['menu_title']; |
|
455 |
$aNewEntry['DISABLED'] = ($aPage['iswriteable'] ? 0 : 1); |
|
456 |
$aNewEntry['PARENT'] = $aPage['parent']; |
|
457 |
$aNewEntry['FLAG_ROOT_ICON'] = ''; |
|
458 |
$aNewEntry['LEVEL'] = $aPage['level']; |
|
459 |
$aNewEntry['LANGUAGE'] = $aPage['language']; |
|
460 |
$this->_aParentList[] = $aNewEntry; |
|
461 |
} |
|
462 |
} |
|
463 |
|
|
464 |
} // end of class PageTree |
|
0 | 465 |
branches/2.8.x/wb/admin/pages/index.php | ||
---|---|---|
1 | 1 |
<?php |
2 |
/** |
|
2 |
|
|
3 |
/** |
|
4 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
|
3 | 5 |
* |
4 |
* @category admin |
|
5 |
* @package pages |
|
6 |
* @author Ryan Djurovich, WebsiteBaker Project |
|
7 |
* @copyright 2009-2012, Website Baker Org. e.V. |
|
8 |
* @link http://www.websitebaker2.org/ |
|
9 |
* @license http://www.gnu.org/licenses/gpl.html |
|
10 |
* @platform WebsiteBaker 2.8.x |
|
11 |
* @requirements PHP 5.2.2 and higher and higher |
|
12 |
* @version $Id$ |
|
13 |
* @filesource $HeadURL$ |
|
14 |
* @lastmodified $Date$ |
|
6 |
* This program is free software: you can redistribute it and/or modify |
|
7 |
* it under the terms of the GNU General Public License as published by |
|
8 |
* the Free Software Foundation, either version 3 of the License, or |
|
9 |
* (at your option) any later version. |
|
15 | 10 |
* |
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
16 | 18 |
*/ |
19 |
/** |
|
20 |
* calling file to create ACP-Pagetree |
|
21 |
* |
|
22 |
* @category WbACP |
|
23 |
* @package WbACP_Pages |
|
24 |
* @author Werner v.d. Decken <wkl@isteam.de> |
|
25 |
* @copyright Werner v.d. Decken <wkl@isteam.de> |
|
26 |
* @license http://www.gnu.org/licenses/gpl.html GPL License |
|
27 |
* @version 1.0.0 |
|
28 |
* @revision $Revision$ |
|
29 |
* @link $HeadURL$ |
|
30 |
* @lastmodified $Date$ |
|
31 |
* @since file added on 2012-12-21 |
|
32 |
* @todo rebuild this file to go into coding standards (sideeffects!!!) |
|
33 |
*/ |
|
17 | 34 |
|
18 |
require('../../config.php'); |
|
19 |
require_once(WB_PATH.'/framework/class.admin.php'); |
|
20 |
$admin = new admin('Pages', 'pages'); |
|
21 |
$admin->clearIDKEY(); |
|
22 |
// Include the WB functions file |
|
23 |
require_once(WB_PATH.'/framework/functions.php'); |
|
24 |
// eggsurplus: add child pages for a specific page |
|
25 |
/**/ |
|
26 |
|
|
27 |
echo '<script type="text/javascript" src="'.ADMIN_URL.'/pages/eggsurplus.js"></script>'.PHP_EOL; |
|
28 |
// fixes A URI contains impermissible characters or quotes around the URI are not closed. |
|
29 |
$MESSAGE['PAGES_DELETE_CONFIRM'] = url_encode( $MESSAGE['PAGES_DELETE_CONFIRM'] ); |
|
30 |
|
|
31 |
function set_node ($parent,& $par) |
|
32 |
{ |
|
33 |
$retval = ''; |
|
34 |
if ($par['num_subs']) { |
|
35 |
$retval .= "\n".'<ul id="p'.$parent.'"'; |
|
36 |
if ($parent != 0) { |
|
37 |
$retval .= ' class="page_list"'; |
|
38 |
if (isset ($_COOKIE['p'.$parent]) && $_COOKIE['p'.$parent] == '1') { |
|
39 |
$retval .= ' style="display:block"'; |
|
35 |
// --- start helper functions ------------------------------------------------------------ |
|
36 |
/** |
|
37 |
* create a list of groups |
|
38 |
* @param type $sPermission which permission the groups should have |
|
39 |
* @return array |
|
40 |
*/ |
|
41 |
function admin_pages_makeGroupList($sPermission) |
|
42 |
{ |
|
43 |
$aNewGroups = array(); |
|
44 |
$sql = 'SELECT `group_id` ID, `name` NAME, \'\' CHECKED, \'\' DISABLED ' |
|
45 |
. 'FROM `'.TABLE_PREFIX.'groups` ' |
|
46 |
. 'WHERE FIND_IN_SET(\'pages_'.$sPermission.'\', `system_permissions`) ' |
|
47 |
. 'ORDER BY `NAME` ASC' |
|
48 |
; |
|
49 |
if(($oGroups = WbDatabase::getInstance()->query($sql))) { |
|
50 |
while($aGroup = $oGroups->fetchRow(MYSQL_ASSOC)) { |
|
51 |
if($aGroup['ID'] == 1) { |
|
52 |
$aGroup['CHECKED'] = ' checked="checked"'; |
|
53 |
$aGroup['DISABLED'] = ' disabled="disabled"'; |
|
54 |
// move it to topmost position of list |
|
55 |
array_unshift($aNewGroups, $aGroup); |
|
56 |
}else { |
|
57 |
if(in_array($aGroup['ID'], $GLOBALS['admin']->get_groups_id())) { |
|
58 |
$aGroup['CHECKED'] = ' checked="checked"'; |
|
59 |
} |
|
60 |
// move it at the end of list |
|
61 |
$aNewGroups[] = $aGroup; |
|
62 |
} |
|
40 | 63 |
} |
41 | 64 |
} |
42 |
$retval .= ">\n"; |
|
43 |
} |
|
44 |
return $retval; |
|
45 |
} |
|
65 |
return $aNewGroups; |
|
66 |
} // end of admin_pages_makeGroupList() |
|
67 |
// --- end helper functions -------------------------------------------------------------- |
|
68 |
// ####################################################################################### |
|
69 |
// --- start script ---------------------------------------------------------------------- |
|
46 | 70 |
|
47 |
function make_list($parent = 0, $editable_pages = 0) { |
|
48 |
// Get objects and vars from outside this function |
|
49 |
global $admin, $template, $TEXT, $MESSAGE, $HEADING, $par; |
|
71 |
// read configuration and initialize the system |
|
72 |
if(!defined('WB_URL')) { |
|
73 |
$sCfgFile = realpath(dirname(__FILE__).'/../../config.php'); |
|
74 |
if(is_readable($sCfgFile)) { |
|
75 |
include($sCfgFile); |
|
76 |
}else { |
|
77 |
throw new RuntimeException('unable to read configuration file!!!'); |
|
78 |
} |
|
79 |
} |
|
80 |
// import languange translations |
|
81 |
global $TEXT, $MESSAGE, $HEADING; |
|
82 |
// define additional constants |
|
83 |
if(!defined('ADMIN_REL')) { define('ADMIN_REL', WB_REL.'/'.ADMIN_DIRECTORY); } |
|
84 |
if(!defined('THEME_REL')) { |
|
85 |
$sTmp = preg_replace('/^'.preg_quote(WB_URL, '/').'/siU', '', THEME_URL); |
|
86 |
define('THEME_REL', WB_REL.$sTmp); |
|
87 |
} |
|
88 |
// create the needed admin object |
|
50 | 89 |
$database = WbDatabase::getInstance(); |
51 |
static $row = 0; |
|
52 |
// static $iLevel = 0; |
|
53 |
// static $iOldLevel = 0; |
|
54 |
// static $aRowLevel = array(); |
|
90 |
if(!class_exists('admin', false)) { include(WB_PATH.'/framework/class.admin.php'); } |
|
91 |
$admin = new admin('Pages', 'pages'); |
|
92 |
$admin->clearIDKEY(); |
|
93 |
// include the WB functions file |
|
94 |
if(!function_exists('get_page_title')) { include(WB_PATH.'/framework/functions.php'); } |
|
95 |
// add module depending Javascript (eggsurplus: add child pages for a specific page) |
|
96 |
$sOutput = '<script type="text/javascript" src="'.ADMIN_REL.'/pages/eggsurplus.js" ' |
|
97 |
. 'charset="utf-8"></script>'.PHP_EOL |
|
98 |
. '<script type="text/javascript" charset="utf-8">'.PHP_EOL |
|
99 |
. "\t".'var pages_delete_confirm =\''.$MESSAGE['PAGES_DELETE_CONFIRM'].'\';'.PHP_EOL |
|
100 |
. "\t".'var THEME_URL = \''.THEME_REL.'\';'.PHP_EOL |
|
101 |
. "\t".'var WB_URL = \''.WB_REL.'\';'.PHP_EOL |
|
102 |
. '</script>'.PHP_EOL; |
|
103 |
echo $sOutput; |
|
104 |
// create page tree and display it ------------------------------------------------------- |
|
105 |
$oPageTree = new a_pages_PageTree(); |
|
106 |
$oPageTree->displayTree(); |
|
55 | 107 |
|
56 |
print set_node ($parent, $par); |
|
57 |
// Get page list from database |
|
58 |
$sql = 'SELECT `module`, MAX(s.`publ_start` + s.`publ_end`) published, p.* ' |
|
59 |
. 'FROM `'.TABLE_PREFIX.'pages` p ' |
|
60 |
. 'INNER JOIN `'.TABLE_PREFIX.'sections` s ON p.`page_id` = s.`page_id` ' |
|
61 |
. 'WHERE `parent`='.$parent.((PAGE_TRASH != 'inline') ? ' AND `visibility`!=\'deleted\' ' : ' ') |
|
62 |
. 'GROUP BY p.`page_id` ' |
|
63 |
. 'ORDER BY p.`position` ASC'; |
|
64 |
|
|
65 |
if($get_pages = $database->query($sql)) { |
|
66 |
// Work out how many pages there are for this parent |
|
67 |
$num_pages = $get_pages->numRows(); |
|
68 |
// Insert values into main page list |
|
69 |
if($num_pages > 0) |
|
70 |
{ |
|
71 |
while($page = $get_pages->fetchRow(MYSQL_ASSOC)) |
|
72 |
{ |
|
73 |
//echo implode('-',$page); |
|
74 |
$sLineOut = ''; |
|
75 |
$row = $row++ % 2; // toggle row colors between 0<->1 |
|
76 |
// Get user permissions |
|
77 |
$can_modify = false; |
|
78 |
if( $admin->ami_group_member($page['admin_users']) || |
|
79 |
$admin->is_group_match($admin->get_groups_id(), $page['admin_groups'])) |
|
80 |
{ |
|
81 |
if(($page['visibility'] == 'deleted' && PAGE_TRASH == 'inline') || |
|
82 |
($page['visibility'] != 'deleted')) |
|
83 |
{ |
|
84 |
$can_modify = true; |
|
85 |
$editable_pages++; |
|
86 |
} |
|
87 |
} else { |
|
88 |
if($page['visibility'] == 'private') { continue; } |
|
89 |
} |
|
90 |
// check if the page has children |
|
91 |
// $sql = 'SELECT COUNT(*) FROM `'.TABLE_PREFIX.'pages` '; |
|
92 |
// $sql .= 'WHERE `parent`='.$page['page_id']; |
|
93 |
// $sql .= (PAGE_TRASH != 'inline') ? ' AND `visibility`!=\'deleted\'' : ''; |
|
94 |
$sql = 'SELECT COUNT(*) FROM `'.TABLE_PREFIX.'pages` ' |
|
95 |
. 'WHERE `parent`='.$page['page_id'].((PAGE_TRASH != 'inline') ? ' AND `visibility`!=\'deleted\'' : ''); |
|
96 |
$par['num_subs'] = intval($database->get_one($sql)); |
|
97 |
$display_plus = (bool)$par['num_subs']; |
|
98 |
$sLineOut .= '<li class="p'.$page['parent'].'">'; |
|
99 |
// --------------------------------------------------------------------------------------- |
|
100 |
$sLineOut .= '<table class="pages_view">'; |
|
101 |
$sLineOut .= "\t".'<tbody>'; |
|
102 |
$sLineOut .= "\t\t".'<tr class="row_'.$row.'">'; |
|
103 |
// --- Tab 1 --- |
|
104 |
$sLineOut .= "\t\t\t".'<td valign="middle" width="20" style="padding-left: '. |
|
105 |
(($page['level'] == 0) ? 0 : ($page['level']*25)-pow($page['level'],2)).'px;">'; |
|
106 |
if($display_plus == true) { |
|
107 |
$sLineOut .= '<a href="javascript:toggle_visibility(\'p'.$page['page_id'].'\');" '. |
|
108 |
'title="'.$TEXT['EXPAND'].'/'.$TEXT['COLLAPSE'].'">'; |
|
109 |
$sLineOut .= '<span>'; |
|
110 |
$sLineOut .= '<img src="'.THEME_URL.'/images/'. |
|
111 |
( ((isset($_COOKIE['p'.$page['page_id']]) && $_COOKIE['p'.$page['page_id']] == '1') ? 'minus' : 'plus'). |
|
112 |
'_16.png" onclick="toggle_plus_minus(\''.$page['page_id'].'\');" '. |
|
113 |
'name="plus_minus_'.$page['page_id'] ).'" alt="+" />'; |
|
114 |
$sLineOut .= '</span>'; |
|
115 |
$sLineOut .= '</a>'; |
|
116 |
} |
|
117 |
$sLineOut .= '</td>'.PHP_EOL; |
|
118 |
// --- Tab 2 --- |
|
119 |
$sLineOut .= "\t\t\t".'<td class="list_menu_title">'; |
|
120 |
$sClassMenutitle = ''; |
|
121 |
if($admin->get_permission('pages_modify') && $can_modify) { |
|
122 |
$sLineOut .= '<a href="'.ADMIN_URL.'/pages/modify.php?page_id='.$page['page_id'].'" title="'.$TEXT['MODIFY'].'">'; |
|
123 |
$sClassMenutitle = 'bold grey'; |
|
124 |
} |
|
125 |
$sLineOut .= '<span>'; |
|
126 |
switch($page['visibility']): |
|
127 |
case 'private': |
|
128 |
$sIcon = 'private_16.png'; |
|
129 |
$sText = $TEXT['PRIVATE']; |
|
130 |
break; |
|
131 |
case 'registered': |
|
132 |
$sIcon = 'keys_16.png'; |
|
133 |
$sText = $TEXT['REGISTERED']; |
|
134 |
break; |
|
135 |
case 'hidden': |
|
136 |
$sIcon = 'hidden_16.png'; |
|
137 |
$sText = $TEXT['HIDDEN']; |
|
138 |
break; |
|
139 |
case 'none': |
|
140 |
$sIcon = 'none_16.png'; |
|
141 |
$sText = $TEXT['NONE']; |
|
142 |
break; |
|
143 |
case 'deleted': |
|
144 |
$sIcon = 'deleted_16.png'; |
|
145 |
$sText = $TEXT['DELETED']; |
|
146 |
break; |
|
147 |
default: // public |
|
148 |
$sIcon = 'visible_16.png'; |
|
149 |
$sText = $TEXT['PUBLIC']; |
|
150 |
break; |
|
151 |
endswitch; |
|
152 |
$sLineOut .= '<img src="'.THEME_URL.'/images/'.$sIcon.'" '; |
|
153 |
$sLineOut .= 'alt="'.$TEXT['VISIBILITY'].': '.$sText.'" class="page_list_rights" />'; |
|
154 |
if($admin->get_permission('pages_modify') && $can_modify) { |
|
155 |
$sLineOut .= '<span class="modify_link">'.$page['menu_title'].'</span></a>'; |
|
156 |
}else { |
|
157 |
$sLineOut .= '<span class="bold grey">'.$page['menu_title'].'</span>'; |
|
158 |
} |
|
159 |
$sLineOut .= '</td>'.PHP_EOL; |
|
160 |
// --- Tab 3 --- |
|
161 |
$sLineOut .= "\t\t\t".'<td class="list_page_title">'.$page['page_title'].'</td>'.PHP_EOL; |
|
162 |
// --- Tab 4 --- |
|
163 |
$sLineOut .= "\t\t\t".'<td class="list_page_id right">'.$page['page_id'].'</td>'.PHP_EOL; |
|
164 |
// --- Tab 5 --- |
|
165 |
$sLineOut .= "\t\t\t".'<td class="list_actions">'; |
|
166 |
if($page['visibility'] != 'deleted' && $page['visibility'] != 'none') { |
|
167 |
$sLineOut .= '<a href="'.$admin->page_link($page['link']).'" target="_blank" '. |
|
168 |
'title="'.$TEXT['VIEW'].'">'; |
|
169 |
$sLineOut .= '<img src="'.THEME_URL.'/images/view_16.png" alt="'.$TEXT['VIEW'].'" />'; |
|
170 |
$sLineOut .= '</a>'; |
|
171 |
} |
|
172 |
$sLineOut .= '</td>'.PHP_EOL; |
|
173 |
// --- Tab 6 --- |
|
174 |
$sLineOut .= "\t\t\t".'<td class="list_actions">'; |
|
175 |
if($page['visibility'] != 'deleted') { |
|
176 |
if($admin->get_permission('pages_settings') && $can_modify) { |
|
177 |
$sLineOut .= '<a href="'.ADMIN_URL.'/pages/settings.php?page_id='.$page['page_id'].'" '. |
|
178 |
'title="'.$TEXT['SETTINGS'].'">'; |
|
179 |
$sLineOut .= '<img src="'.THEME_URL.'/images/modify_16.png" alt="'.$TEXT['SETTINGS'].'" />'; |
|
180 |
$sLineOut .= '</a>'; |
|
181 |
} |
|
182 |
}else { |
|
183 |
$sLineOut .= '<a href="'.ADMIN_URL.'/pages/restore.php?page_id='.$page['page_id'].'" '. |
|
184 |
'title="'.$TEXT['RESTORE'].'">'; |
|
185 |
$sLineOut .= '<img src="'.THEME_URL.'/images/restore_16.png" alt="'.$TEXT['RESTORE'].'" />'; |
|
186 |
$sLineOut .= '</a>'; |
|
187 |
} |
|
188 |
$sLineOut .= '</td>'.PHP_EOL; |
|
189 |
// --- Tab 7 --- MANAGE SECTIONS AND DATES BUTTONS --- |
|
190 |
$sLineOut .= "\t\t\t".'<td class="list_actions">'; |
|
191 |
// Work-out if we should show the "manage dates" link |
|
192 |
if( MANAGE_SECTIONS && $admin->get_permission('pages_add') && $can_modify ) { |
|
193 |
$sLineOut .= '<a href="'.ADMIN_URL.'/pages/sections.php?page_id='.$page['page_id'].'"'. |
|
194 |
' title="'.$HEADING['MANAGE_SECTIONS'].'">'; |
|
195 |
$file = $admin->page_is_active($page) ? "clock_16.png" : "clock_red_16.png"; |
|
196 |
$file = ($page['published'] && $page['module'] != 'menu_link') ? $file : 'noclock_16.png'; |
|
197 |
$sLineOut .= '<img src="'.THEME_URL.'/images/'.$file.'" alt="'.$HEADING['MANAGE_SECTIONS'].'" />'; |
|
198 |
$sLineOut .= '</a>'; |
|
199 |
} |
|
200 |
$sLineOut .= '</td>'.PHP_EOL; |
|
201 |
// --- Tab 8 --- |
|
202 |
$sLineOut .= "\t\t\t".'<td class="list_actions">'; |
|
203 |
if($page['position'] != 1) { |
|
204 |
if($page['visibility'] != 'deleted') { |
|
205 |
if($admin->get_permission('pages_settings') && $can_modify) { |
|
206 |
$sLineOut .= '<a href="'.ADMIN_URL.'/pages/move_up.php?page_id='.$page['page_id'].'" '. |
|
207 |
'title="'.$TEXT['MOVE_UP'].'"><img src="'.THEME_URL. |
|
208 |
'/images/up_16.png" alt="'.$TEXT['MOVE_UP'].'" /></a>'; |
|
209 |
} |
|
210 |
} |
|
211 |
} |
|
212 |
$sLineOut .= '</td>'.PHP_EOL; |
|
213 |
// --- Tab 9 --- |
|
214 |
$sLineOut .= "\t\t\t".'<td class="list_actions">'; |
|
215 |
if($page['position'] != $num_pages) { |
|
216 |
if($page['visibility'] != 'deleted') { |
|
217 |
if($admin->get_permission('pages_settings') && $can_modify) { |
|
218 |
$sLineOut .= '<a href="'.ADMIN_URL.'/pages/move_down.php?page_id='.$page['page_id'].'" '. |
|
219 |
'title="'.$TEXT['MOVE_DOWN'].'"><img src="'.THEME_URL. |
|
220 |
'/images/down_16.png" alt="'.$TEXT['MOVE_DOWN'].'" /></a>'; |
|
221 |
} |
|
222 |
} |
|
223 |
}else { $sLineOut .= ' '; } |
|
224 |
$sLineOut .= '</td>'.PHP_EOL; |
|
225 |
// --- Tab 10 --- |
|
226 |
$sLineOut .= "\t\t\t".'<td class="list_actions">'; |
|
227 |
if($admin->get_permission('pages_delete') && $can_modify) { |
|
228 |
$sLineOut .= '<a href="javascript:confirm_link(\''.$MESSAGE['PAGES_DELETE_CONFIRM']. |
|
229 |
'?,'.ADMIN_URL.'/pages/delete.php?page_id='.$admin->getIDKEY($page['page_id']).'\');" '. |
|
230 |
'title="'.$TEXT['DELETE'].'">'; |
|
231 |
$sLineOut .= '<img src="'.THEME_URL.'/images/delete_16.png" alt="'.$TEXT['DELETE'].'" />'; |
|
232 |
$sLineOut .= '</a>'; |
|
233 |
}else { $sLineOut .= ' '; } |
|
234 |
$sLineOut .= '</td>'.PHP_EOL; |
|
235 |
// --- Tab 11 --- Add action to add a page as a child --- |
|
236 |
$sLineOut .= "\t\t\t".'<td class="list_actions">'; |
|
237 |
if($admin->get_permission('pages_add') && $can_modify && ($page['visibility'] != 'deleted')) { |
|
238 |
$sLineOut .= '<a href="javascript:add_child_page(\''.$page['page_id'].'\');" ' |
|
239 |
.'title="'.$HEADING['ADD_CHILD_PAGE'].'">'; |
|
240 |
$sLineOut .= '<img src="'.THEME_URL.'/images/siteadd.png" name="addpage_'.$page['page_id'].'" ' |
|
241 |
.'alt="Add Child Page" />'; |
|
242 |
$sLineOut .= '</a>'; |
|
243 |
}else { $sLineOut .= ' '; } |
|
244 |
$sLineOut .= '</td>'.PHP_EOL; |
|
245 |
// --- Tab 12 --- |
|
246 |
$sLineOut .= "\t\t\t".'<td class="list_page_id center">'.$page['language'].'</td>'.PHP_EOL; |
|
247 |
// --- End TR / TBODY / TABLE |
|
248 |
$sLineOut .= "\t\t".'</tr>'.PHP_EOL; |
|
249 |
$sLineOut .= "\t".'</tbody>'.PHP_EOL; |
|
250 |
$sLineOut .= '</table>'.PHP_EOL; |
|
251 |
// --------------------------------------------------------------------------------------- |
|
252 |
echo $sLineOut; |
|
253 |
if ( $page['parent'] == 0) { |
|
254 |
$page_tmp_id = $page['page_id']; |
|
255 |
} |
|
256 |
// Get subs |
|
257 |
$editable_pages = make_list($page['page_id'], $editable_pages); |
|
258 |
echo '</li>'.PHP_EOL; |
|
259 |
} // end of WHILE |
|
260 |
} // end of $num_pages > 0 |
|
261 |
} // end of $get_pages = $database->query($sql) |
|
262 |
|
|
263 |
$output = ($par['num_subs'] )? '</ul>'.PHP_EOL : ''; |
|
264 |
$par['num_subs'] = (empty($output) ) ? 1 : $par['num_subs']; |
|
265 |
echo $output; |
|
266 |
return $editable_pages; |
|
267 |
} |
|
268 |
// Generate pages list |
|
269 |
if($admin->get_permission('pages_view') == true) |
|
270 |
{ |
|
271 |
$sListHeader = <<<LHEAD |
|
272 |
<div class="jsadmin hide"></div> |
|
273 |
<table> |
|
274 |
<tbody> |
|
275 |
<tr> |
|
276 |
<td><h2 class="left">{$HEADING['MODIFY_DELETE_PAGE']}</h2></td> |
|
277 |
<td align="right"></td> |
|
278 |
</tr> |
|
279 |
</tbody> |
|
280 |
</table> |
|
281 |
<div class="pages_list"> |
|
282 |
<table> |
|
283 |
<tbody> |
|
284 |
<tr class="pages_list_header"> |
|
285 |
<td class="header_list_menu_title">{$TEXT['VISIBILITY']} / {$TEXT['MENU_TITLE']}:</td> |
|
286 |
<td class="header_list_page_title">{$TEXT['PAGE_TITLE']}:</td> |
|
287 |
<td class="header_list_page_id">PID</td> |
|
288 |
<td class="header_list_actions">{$TEXT['ACTIONS']}:</td> |
|
289 |
<td class="list_page_id"> </td> |
|
290 |
</tr> |
|
291 |
</tbody> |
|
292 |
</table> |
|
293 |
LHEAD; |
|
294 |
echo $sListHeader; |
|
295 |
// Work-out if we should check for existing page_code |
|
296 |
$field_set = $database->field_exists(TABLE_PREFIX.'pages', 'page_code'); |
|
297 |
$par = array(); |
|
298 |
$par['num_subs'] = 1; |
|
299 |
$editable_pages = make_list(0, 0); |
|
300 |
}else { |
|
301 |
$editable_pages = 0; |
|
302 |
} |
|
303 |
echo "\t\t".'</div>'.PHP_EOL; |
|
304 |
if(!intval($editable_pages)) { |
|
305 |
echo "\t\t".'<div class="empty_list">'.$TEXT['NONE_FOUND'].'</div>'.PHP_EOL; |
|
306 |
} |
|
307 |
// Setup template object, parse vars to it, then parse it |
|
308 |
// Create new template object |
|
309 |
$template = new Template(dirname($admin->correct_theme_source('pages.htt')),'keep'); |
|
310 |
// $template->debug = true; |
|
311 |
$template->set_file('page', 'pages.htt'); |
|
312 |
$template->set_block('page', 'main_block', 'main'); |
|
313 |
// Insert values into the add page form |
|
314 |
$template->set_var('FTAN', $admin->getFTAN()); |
|
315 |
// Group list 1 |
|
316 |
$query = "SELECT * FROM ".TABLE_PREFIX."groups"; |
|
317 |
$get_groups = $database->query($query); |
|
318 |
|
|
319 |
$template->set_block('main_block', 'group_list_block', 'group_list'); |
|
320 |
// Insert admin group and current group first |
|
321 |
$admin_group_name = $get_groups->fetchRow(MYSQL_ASSOC); |
|
322 |
$template->set_var(array( |
|
323 |
'ID' => 1, |
|
324 |
'TOGGLE' => '1', |
|
325 |
'DISABLED' => ' disabled="disabled"', |
|
326 |
'LINK_COLOR' => '000000', |
|
327 |
'CURSOR' => 'default', |
|
328 |
'NAME' => $admin_group_name['name'], |
|
329 |
'CHECKED' => ' checked="checked"' |
|
330 |
) |
|
331 |
); |
|
332 |
$template->parse('group_list', 'group_list_block', true); |
|
333 |
while($group = $get_groups->fetchRow(MYSQL_ASSOC)) { |
|
334 |
// check if the user is a member of this group |
|
335 |
$flag_disabled = ''; |
|
336 |
$flag_checked = ''; |
|
337 |
$flag_cursor = 'pointer'; |
|
338 |
$flag_color = ''; |
|
339 |
if (in_array($group["group_id"], $admin->get_groups_id())) { |
|
340 |
$flag_disabled = ''; //' disabled'; |
|
341 |
$flag_checked = ' checked="checked"'; |
|
342 |
$flag_cursor = 'default'; |
|
343 |
$flag_color = '000000'; |
|
108 |
// Setup template object, parse vars to it, then parse it -------------------------------- |
|
109 |
$oTpl = new Template(dirname($admin->correct_theme_source('pages.htt')),'keep'); |
|
110 |
// $oTpl->debug = true; |
|
111 |
$oTpl->set_file('page', 'pages.htt'); |
|
112 |
$oTpl->set_block('page', 'main_block', 'main'); |
|
113 |
// Insert values into the add page form |
|
114 |
$oTpl->set_var('FTAN', $admin->getFTAN()); |
|
115 |
|
|
116 |
// --- admin groups list ----------------------------------------------------------------- |
|
117 |
$aAdminGroups = admin_pages_makeGroupList('modify'); |
|
118 |
// write block into template |
|
119 |
$oTpl->set_block('main_block', 'admingroups_list_block', 'admingroups_list'); |
|
120 |
foreach($aAdminGroups as $aValue) { |
|
121 |
$oTpl->set_var($aValue); |
|
122 |
$oTpl->parse('admingroups_list', 'admingroups_list_block', true); |
|
344 | 123 |
} |
345 |
// Check if the group is allowed to edit pages |
|
346 |
$system_permissions = explode(',', $group['system_permissions']); |
|
347 |
if(is_numeric(array_search('pages_modify', $system_permissions))) { |
|
348 |
$template->set_var(array( |
|
349 |
'ID' => $group['group_id'], |
|
350 |
'TOGGLE' => $group['group_id'], |
|
351 |
'CHECKED' => $flag_checked, |
|
352 |
'DISABLED' => $flag_disabled, |
|
353 |
'LINK_COLOR' => $flag_color, |
|
354 |
'CURSOR' => $flag_checked, |
|
355 |
'NAME' => $group['name'], |
|
356 |
) |
|
357 |
); |
|
358 |
$template->parse('group_list', 'group_list_block', true); |
|
124 |
unset($aAdminGroups); |
|
125 |
|
|
126 |
// --- viewer groups list ---------------------------------------------------------------- |
|
127 |
$aViewerGroups = admin_pages_makeGroupList('view'); |
|
128 |
// write block into template |
|
129 |
$oTpl->set_block('main_block', 'viewergroups_list_block', 'viewergroups_list'); |
|
130 |
foreach($aViewerGroups as $aValue) { |
|
131 |
$oTpl->set_var($aValue); |
|
132 |
$oTpl->parse('viewergroups_list', 'viewergroups_list_block', true); |
|
359 | 133 |
} |
360 |
} |
|
361 |
// Group list 2 |
|
362 |
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'groups`'; |
|
363 |
$get_groups = $database->query($sql); |
|
364 |
$template->set_block('main_block', 'group_list_block2', 'group_list2'); |
|
365 |
// Insert admin group and current group first |
|
366 |
$admin_group_name = $get_groups->fetchRow(MYSQL_ASSOC); |
|
367 |
$template->set_var(array( |
|
368 |
'ID' => 1, |
|
369 |
'TOGGLE' => '1', |
|
370 |
'DISABLED' => ' disabled="disabled"', |
|
371 |
'LINK_COLOR' => '000000', |
|
372 |
'CURSOR' => 'default', |
|
373 |
'NAME' => $admin_group_name['name'], |
|
374 |
'CHECKED' => ' checked="checked"' |
|
375 |
) |
|
376 |
); |
|
377 |
$template->parse('group_list2', 'group_list_block2', true); |
|
378 |
while($group = $get_groups->fetchRow(MYSQL_ASSOC)) { |
|
379 |
// check if the user is a member of this group |
|
380 |
$flag_disabled = ''; |
|
381 |
$flag_checked = ''; |
|
382 |
$flag_cursor = 'pointer'; |
|
383 |
$flag_color = ''; |
|
384 |
if (in_array($group["group_id"], $admin->get_groups_id())) { |
|
385 |
$flag_disabled = ''; //' disabled'; |
|
386 |
$flag_checked = ' checked="checked"'; |
|
387 |
$flag_cursor = 'default'; |
|
388 |
$flag_color = '000000'; |
|
389 |
} |
|
390 |
$template->set_var(array( |
|
391 |
'ID' => $group['group_id'], |
|
392 |
'TOGGLE' => $group['group_id'], |
|
393 |
'CHECKED' => $flag_checked, |
|
394 |
'DISABLED' => $flag_disabled, |
|
395 |
'LINK_COLOR' => $flag_color, |
|
396 |
'CURSOR' => $flag_cursor, |
|
397 |
'NAME' => $group['name'], |
|
398 |
) |
|
399 |
); |
|
400 |
$template->parse('group_list2', 'group_list_block2', true); |
|
401 |
} |
|
402 |
// Parent page list |
|
403 |
// $database = new database(); |
|
404 |
function parent_list($parent) |
|
405 |
{ |
|
406 |
global $admin, $template, $field_set; |
|
407 |
$database = WbDatabase::getInstance(); |
|
408 |
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'pages` '. |
|
409 |
'WHERE `parent`='.$parent.' AND `visibility`!=\'deleted\' '. |
|
410 |
'ORDER BY `position` ASC'; |
|
411 |
$get_pages = $database->query($sql); |
|
412 |
|
|
413 |
while($page = $get_pages->fetchRow(MYSQL_ASSOC)) { |
|
414 |
if(!$admin->page_is_visible($page)) { continue; } |
|
415 |
// if parent = 0 set flag_icon |
|
416 |
$template->set_var('FLAG_ROOT_ICON', ' none '); |
|
417 |
if( $page['parent'] == 0 && $field_set) { |
|
418 |
$template->set_var('FLAG_ROOT_ICON','url('.THEME_URL.'/images/flags/'.strtolower($page['language']).'.png)'); |
|
134 |
unset($aViewerGroups); |
|
135 |
|
|
136 |
// --- build parent pages list ----------------------------------------------------------- |
|
137 |
$aParents = $oPageTree->getParentList(); |
|
138 |
$aFirstEntry = array(); |
|
139 |
$aFirstEntry['ID'] = 0; |
|
140 |
$aFirstEntry['TITLE'] = $TEXT['NONE']; |
|
141 |
$aFirstEntry['DISABLED'] = 0; |
|
142 |
$aFirstEntry['PARENT'] = 99; |
|
143 |
$aFirstEntry['FLAG_ROOT_ICON'] = ''; |
|
144 |
$aFirstEntry['LEVEL'] = 0; |
|
145 |
$aFirstEntry['LANGUAGE'] = ''; |
|
146 |
array_unshift($aParents, $aFirstEntry); |
|
147 |
reset($aParents); |
|
148 |
$oTpl->set_block('main_block', 'parents_list_block', 'parents_list'); |
|
149 |
// walk through all items |
|
150 |
while (list(, $aItem) = each($aParents)) { |
|
151 |
if($admin->get_permission('pages_add')) { |
|
152 |
// modify item |
|
153 |
$aItem['DISABLED'] = ($aItem['DISABLED'] ? ' disabled="disabled" class="disabled"' : ''); |
|
154 |
if(!$aItem['PARENT']) { |
|
155 |
$aItem['FLAG_ROOT_ICON'] = ' style="background-image: url('.THEME_REL.'/images/flags/' |
|
156 |
. strtolower($aItem['LANGUAGE']).'.png);"'; |
|
157 |
} |
|
158 |
$aItem['TITLE'] = str_repeat('- ', $aItem['LEVEL']).$aItem['TITLE']; |
|
159 |
// write block into template |
|
160 |
$oTpl->set_var($aItem); |
|
161 |
$oTpl->parse('parents_list', 'parents_list_block', true); |
|
419 | 162 |
} |
420 |
// Stop users from adding pages with a level of more than the set page level limit |
|
421 |
if($page['level']+1 < PAGE_LEVEL_LIMIT) { |
|
422 |
// Get user permissions |
|
423 |
$can_modify = ($admin->ami_group_member($page['admin_groups']) || |
|
424 |
$admin->is_group_match($admin->get_groups_id(), $page['admin_users'])); |
|
425 |
// Title -'s prefix |
|
426 |
$title_prefix = ''; |
|
427 |
for($i = 1; $i <= $page['level']; $i++) { $title_prefix .= ' - - '; } |
|
428 |
$template->set_var(array( |
|
429 |
'ID' => $page['page_id'], |
|
430 |
'TITLE' => ($title_prefix.$page['menu_title']), |
|
431 |
'MENU-TITLE' => ($title_prefix.$page['menu_title']), |
|
432 |
'PAGE-TITLE' => ($title_prefix.$page['page_title']) |
|
433 |
)); |
|
434 |
if($can_modify == true) { |
|
435 |
$template->set_var('DISABLED', ''); |
|
436 |
} else { |
|
437 |
$template->set_var('DISABLED', ' disabled="disabled" class="disabled"'); |
|
438 |
} |
|
439 |
$template->parse('page_list2', 'page_list_block2', true); |
|
440 |
} |
|
441 |
parent_list($page['page_id']); |
|
442 | 163 |
} |
443 |
} |
|
444 |
$template->set_block('main_block', 'page_list_block2', 'page_list2'); |
|
445 |
if($admin->get_permission('pages_add_l0') == true) { |
|
446 |
$template->set_var(array( |
|
447 |
'ID' => '0', |
|
448 |
'TITLE' => $TEXT['NONE'], |
|
449 |
'SELECTED' => ' selected="selected"', |
|
450 |
'DISABLED' => '' |
|
451 |
) |
|
452 |
); |
|
453 |
$template->parse('page_list2', 'page_list_block2', true); |
|
454 |
} |
|
455 |
parent_list(0); |
|
456 |
// Explode module permissions |
|
457 |
$module_permissions = $_SESSION['MODULE_PERMISSIONS']; |
|
458 |
// Modules list |
|
459 |
$template->set_block('main_block', 'module_list_block', 'module_list'); |
|
460 |
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'page' order by name"); |
|
461 |
if($result->numRows() > 0) { |
|
462 |
while ($module = $result->fetchRow(MYSQL_ASSOC)) { |
|
463 |
// Check if user is allowed to use this module |
|
464 |
if(!is_numeric(array_search($module['directory'], $module_permissions))) { |
|
465 |
$template->set_var('VALUE', $module['directory']); |
|
466 |
$template->set_var('NAME', $module['name']); |
|
467 |
if($module['directory'] == 'wysiwyg') { |
|
468 |
$template->set_var('SELECTED', ' selected="selected"'); |
|
469 |
} else { |
|
470 |
$template->set_var('SELECTED', ''); |
|
471 |
} |
|
472 |
$template->parse('module_list', 'module_list_block', true); |
|
164 |
unset($aParents); |
|
165 |
|
|
166 |
// --- build modules list ---------------------------------------------------------------- |
|
167 |
$bMatch = false; |
|
168 |
$aModulePermissions = '\''.implode(',', $_SESSION['MODULE_PERMISSIONS']).'\''; |
|
169 |
$sql = 'SELECT `directory` DIRECTORY, `name` NAME, \'\' SELECTED FROM `'.TABLE_PREFIX.'addons` ' |
|
170 |
. 'WHERE `type`=\'module\' AND `function`=\'page\' '; |
|
171 |
if($admin->get_user_id() != 1) { |
|
172 |
$sql .= 'AND NOT FIND_IN_SET(`DIRECTORY`, '.$aModulePermissions.') '; |
|
173 |
} |
|
174 |
$sql .= 'ORDER BY `name` ASC'; |
|
175 |
if(($oModules = $database->query($sql))) { |
|
176 |
$oTpl->set_block('main_block', 'module_list_block', 'module_list'); |
|
177 |
while ($aModule = $oModules->fetchRow(MYSQL_ASSOC)) { |
|
178 |
$bMatch = true; |
|
179 |
// Check if user is allowed to use this module |
|
180 |
$aModule['SELECTED'] = ($aModule['DIRECTORY'] == 'wysiwyg' ? ' selected="selected"' : ''); |
|
181 |
$oTpl->set_var($aModule); |
|
182 |
$oTpl->parse('module_list', 'module_list_block', true); |
|
473 | 183 |
} |
474 | 184 |
} |
475 |
} |
|
185 |
if(!$bMatch) { |
|
186 |
$aModule = array('DIRECTORY' => '', |
|
187 |
'NAME' => $TEXT['NONE'], |
|
188 |
'SELECTED' => '' |
|
189 |
); |
|
190 |
$oTpl->set_var($aModule); |
|
191 |
$oTpl->parse('module_list', 'module_list_block', true); |
|
192 |
} |
|
193 |
|
|
194 |
// --- Insert global replacements -------------------------------------------------------- |
|
476 | 195 |
// Insert urls |
477 |
$template->set_var(array( |
|
478 |
'THEME_URL' => THEME_URL, |
|
479 |
'WB_URL' => WB_URL, |
|
480 |
'ADMIN_URL' => ADMIN_URL, |
|
481 |
) |
|
482 |
); |
|
483 |
// Insert language headings |
|
484 |
$template->set_var(array( |
|
485 |
'HEADING_ADD_PAGE' => $HEADING['ADD_PAGE'], |
|
486 |
'HEADING_MODIFY_INTRO_PAGE' => $HEADING['MODIFY_INTRO_PAGE'] |
|
487 |
) |
|
488 |
); |
|
196 |
$oTpl->set_var(array( |
|
197 |
'WB_URL' => WB_REL, |
|
198 |
'ADMIN_URL' => ADMIN_REL, |
|
199 |
'THEME_URL' => THEME_REL, |
|
200 |
'WB_REL' => WB_REL, |
|
201 |
'ADMIN_REL' => ADMIN_REL, |
|
202 |
'THEME_REL' => THEME_REL |
|
203 |
) |
|
204 |
); |
|
489 | 205 |
// Insert language text and messages |
490 |
$template->set_var(array( |
|
491 |
'TEXT_TITLE' => $TEXT['TITLE'], |
|
492 |
'TEXT_TYPE' => $TEXT['TYPE'], |
|
493 |
'TEXT_PARENT' => $TEXT['PARENT'], |
|
494 |
'TEXT_VISIBILITY' => $TEXT['VISIBILITY'], |
|
495 |
'TEXT_PUBLIC' => $TEXT['PUBLIC'], |
|
496 |
'TEXT_PRIVATE' => $TEXT['PRIVATE'], |
|
497 |
'TEXT_REGISTERED' => $TEXT['REGISTERED'], |
|
498 |
'TEXT_HIDDEN' => $TEXT['HIDDEN'], |
|
499 |
'TEXT_NONE' => $TEXT['NONE'], |
|
500 |
'TEXT_NONE_FOUND' => $TEXT['NONE_FOUND'], |
|
501 |
'TEXT_ADD' => $TEXT['ADD'], |
|
502 |
'TEXT_RESET' => $TEXT['RESET'], |
|
503 |
'TEXT_ADMINISTRATORS' => $TEXT['ADMINISTRATORS'], |
|
504 |
'TEXT_PRIVATE_VIEWERS' => $TEXT['PRIVATE_VIEWERS'], |
|
505 |
'TEXT_REGISTERED_VIEWERS' => $TEXT['REGISTERED_VIEWERS'], |
|
506 |
'INTRO_LINK' => $MESSAGE['PAGES_INTRO_LINK'], |
|
507 |
) |
|
508 |
); |
|
206 |
$oTpl->set_var(array( |
|
207 |
'HEADING_ADD_PAGE' => $HEADING['ADD_PAGE'], |
|
208 |
'HEADING_MODIFY_INTRO_PAGE' => $HEADING['MODIFY_INTRO_PAGE'], |
|
209 |
'TEXT_TITLE' => $TEXT['TITLE'], |
|
210 |
'TEXT_TYPE' => $TEXT['TYPE'], |
|
211 |
'TEXT_PARENT' => $TEXT['PARENT'], |
|
212 |
'TEXT_VISIBILITY' => $TEXT['VISIBILITY'], |
|
213 |
'TEXT_PUBLIC' => $TEXT['PUBLIC'], |
|
214 |
'TEXT_PRIVATE' => $TEXT['PRIVATE'], |
|
215 |
'TEXT_REGISTERED' => $TEXT['REGISTERED'], |
|
216 |
'TEXT_HIDDEN' => $TEXT['HIDDEN'], |
|
217 |
'TEXT_NONE' => $TEXT['NONE'], |
|
218 |
'TEXT_NONE_FOUND' => $TEXT['NONE_FOUND'], |
|
219 |
'TEXT_ADD' => $TEXT['ADD'], |
|
220 |
'TEXT_RESET' => $TEXT['RESET'], |
|
221 |
'TEXT_ADMINISTRATORS' => $TEXT['ADMINISTRATORS'], |
|
222 |
'TEXT_PRIVATE_VIEWERS' => $TEXT['PRIVATE_VIEWERS'], |
|
223 |
'TEXT_REGISTERED_VIEWERS' => $TEXT['REGISTERED_VIEWERS'], |
|
224 |
'INTRO_LINK' => $MESSAGE['PAGES_INTRO_LINK'], |
|
225 |
) |
|
226 |
); |
|
509 | 227 |
// Insert permissions values |
510 |
if($admin->get_permission('pages_add') != true) { |
|
511 |
$template->set_var('DISPLAY_ADD', 'hide');
|
|
512 |
} elseif($admin->get_permission('pages_add_l0') != true && $editable_pages == 0) {
|
|
513 |
$template->set_var('DISPLAY_ADD', 'hide');
|
|
514 |
} |
|
515 |
if($admin->get_permission('pages_intro') != true || INTRO_PAGE != 'enabled') { |
|
516 |
$template->set_var('DISPLAY_INTRO', 'hide');
|
|
517 |
} |
|
228 |
if($admin->get_permission('pages_add') != true) {
|
|
229 |
$oTpl->set_var('DISPLAY_ADD', 'hide');
|
|
230 |
} elseif($admin->get_permission('pages_add_l0') != true && !$oPageTree->getWriteablePages()) {
|
|
231 |
$oTpl->set_var('DISPLAY_ADD', 'hide');
|
|
232 |
}
|
|
233 |
if($admin->get_permission('pages_intro') != true || INTRO_PAGE != 'enabled') {
|
|
234 |
$oTpl->set_var('DISPLAY_INTRO', 'hide');
|
|
235 |
}
|
|
518 | 236 |
// Parse template object |
519 |
$template->parse('main', 'main_block', false); |
|
520 |
$template->pparse('output', 'page'); |
|
521 |
// include the required file for Javascript admin |
|
522 |
if(file_exists(WB_PATH.'/modules/jsadmin/jsadmin_backend_include.php')) { |
|
523 |
include(WB_PATH.'/modules/jsadmin/jsadmin_backend_include.php'); |
|
524 |
} |
|
525 |
// Print admin |
|
526 |
$admin->print_footer(); |
|
237 |
$oTpl->parse('main', 'main_block', false); |
|
238 |
$oTpl->pparse('output', 'page'); |
|
239 |
// include the required file for Javascript admin |
|
240 |
if(file_exists(WB_PATH.'/modules/jsadmin/jsadmin_backend_include.php')) { |
|
241 |
include(WB_PATH.'/modules/jsadmin/jsadmin_backend_include.php'); |
|
242 |
} |
|
243 |
// Print admin |
|
244 |
$admin->print_footer(); |
|
245 |
|
branches/2.8.x/wb/admin/interface/version.php | ||
---|---|---|
51 | 51 |
|
52 | 52 |
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled) |
53 | 53 |
if(!defined('VERSION')) define('VERSION', '2.8.3'); |
54 |
if(!defined('REVISION')) define('REVISION', '1838');
|
|
54 |
if(!defined('REVISION')) define('REVISION', '1839');
|
|
55 | 55 |
if(!defined('SP')) define('SP', ''); |
branches/2.8.x/wb/templates/wb_theme/css/screen.css | ||
---|---|---|
330 | 330 |
div.acess-main a:hover { color :#6699ff; text-decoration :underline; } |
331 | 331 |
div.acess-main div.content { overflow :hidden; padding :1px; text-align :left; } |
332 | 332 |
div.acess-main div.bottomdiv h3 { font-weight :bold; color :#ff0000; } |
333 |
|
|
334 |
.pages_list table td, table.pages_view td { |
|
335 |
padding :3px; |
|
336 |
font-size :150%; |
|
337 |
} |
|
338 |
select.pages-parent-list { |
|
339 |
width: 240px; |
|
340 |
} |
|
341 |
select.pages-parent-list option { |
|
342 |
background: none no-repeat center left; |
|
343 |
padding-left: 20px; |
|
344 |
} |
branches/2.8.x/wb/templates/argos_theme/css/screen.css | ||
---|---|---|
340 | 340 |
div.admintools span.title { font-size :1.1em; } |
341 | 341 |
/* */ |
342 | 342 |
.access h2,.access h3,.access h4,.access h6 { font-weight :bold; } |
343 |
|
|
344 |
.pages_list table td, table.pages_view td { |
|
345 |
padding :3px; |
|
346 |
font-size :150%; |
|
347 |
} |
|
348 |
select.pages-parent-list { |
|
349 |
width: 240px; |
|
350 |
} |
|
351 |
select.pages-parent-list option { |
|
352 |
background: none no-repeat center left; |
|
353 |
padding-left: 20px; |
|
354 |
} |
branches/2.8.x/wb/languages/DE.php | ||
---|---|---|
563 | 563 |
$MESSAGE['PAGES_CANNOT_DELETE_ACCESS_FILE'] = 'Beim Löschen der Zugangsdatei im Verzeichnis /pages ist ein Fehler aufgetreten (Ungenügende Zugangsrechte)'; |
564 | 564 |
$MESSAGE['PAGES_CANNOT_REORDER'] = 'Bei der Zusammenstellung der Seite ist ein Fehler aufgetreten'; |
565 | 565 |
$MESSAGE['PAGES_DELETED'] = 'Die Seite wurde erfolgreich gelöscht'; |
566 |
$MESSAGE['PAGES_DELETE_CONFIRM'] = 'Sind Sie sicher, dass Sie die ausgewählte Seite löschen möchten ( und deren Unterseiten )';
|
|
566 |
$MESSAGE['PAGES_DELETE_CONFIRM'] = 'Sind Sie sicher, dass Sie die ausgewählte Seite und deren Unterseiten löschen möchten?';
|
|
567 | 567 |
$MESSAGE['PAGES_INSUFFICIENT_PERMISSIONS'] = 'Sie haben keine Berechtigung, diese Seite zu ändern'; |
568 | 568 |
$MESSAGE['PAGES_INTRO_LINK'] = 'Bitte klicken Sie HIER um die Eingangsseite zu ändern'; |
569 | 569 |
$MESSAGE['PAGES_INTRO_NOT_WRITABLE'] = 'Es konnte nicht in die Datei /pages/intro.php geschrieben werden (ungenügende Zugangsrechte)'; |
Also available in: Unified diff
The second runtime optimization of PageTree by recoding /admin/pages/index.php
Added new class a_pages_PageTree() for use with /admin/pages/index.php