-
Notifications
You must be signed in to change notification settings - Fork 1
/
panel.stream.php_old
246 lines (199 loc) · 8.48 KB
/
panel.stream.php_old
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
<?php
//ini_set("dispaly_errors", true);
//error_reporting(E_ALL);
//print "mode($mode) pagemode({$page->getMode()})<br>";// exit;
$content = new HTMLPlaceholder();
$content->load($page->getGUID(), 'panelcontent');
$referer = read($_REQUEST,'referer','/treeline/');
$page->loadByGUID($pageGUID);
$pageTitle = $page->drawTitle();
$panelStyle = $page->getStyle();
if ($page->getMode() == 'inline') {
// If we've put the panel in 'list' mode -- ie, we've included the panel in a page we're editing -- we don't want to actively edit the content:
$content->setMode('view');
}
else {
$content->setMode($page->getMode());
}
if ($_SERVER['REQUEST_METHOD'] == "POST") {
if (strpos($referer,'?') > 0) {
// If we've already got a querystring in the referring URL, we need to append the message onto it
$referer .= '&';
}
else {
// Otherwise, create a new querystring
$referer .= '?';
}
if (read($_POST,'treeline','') == 'Save changes') {
$content->save();
$page->save(true);
// Content is saved so redirect the user
$feedback .= createFeedbackURL('success',"Changes saved to panel '<strong>". $page->drawTitle() ."</strong>'");
$referer .= $feedback;
$publish_redirect = '/treeline/panels/?action=saved&guid='.$page->getGUID();
$publish_redirect .= '&'.$feedback;
include($_SERVER['DOCUMENT_ROOT'] . "/treeline/includes/treeline.class.php");
if($user->drawGroup() == 'Superuser' || $user->drawGroup() == 'Publisher'){ // can this user publish pages?
redirect($publish_redirect); // show them the publish option
} else{
redirect($referer); // otherwise take the user back to the edit pages page
}
} else if (read($_POST,'treeline','') == 'Discard changes') {
$referer .= createFeedbackURL('error','Your changes were not saved');
redirect ($referer);
}
}
// END DATABASE INTERACTION
//print "show panel in mode(".$page->getMode()." - $mode)<br>";
// START PREVIEW/EDIT/VIEW MODE
if ($page->getMode() != 'view' && $mode=="preview"){ // PREVIEW MODE: SHOW PROPER HTML
//$page->loadByGUID($pageGUID);
$pageClass = 'panel'; // used for CSS usually
//$panelStyle = $page->getStyle();
$css = array('page','3col','editMode'); // all attached stylesheets
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Panel - <?=$page->drawTitle()?></title>
<style type="text/css">
@import url("/style/reset.css");
@import url("/style/yui_fonts.css");
@import url("/style/global.css");
@import url("/style/page.css");
@import url("/style/3col.css");
@import url("/style/scheme/palate01.css");
<?php
if (file_exists($_SERVER['DOCUMENT_ROOT']."/style/microsite/scheme".$site->id.".css") && !$_SESSION['palate']) echo '@import url("/style/microsite/scheme'.$site->id.'.css");';
else if ($palateNumber>1) echo '@import url("/style/scheme/palate'.(($palateNumber<10?"0":"").$palateNumber).'.css");';
if ($_GET['palate']>0) echo '@import url("/style/scheme/palate'.(($_GET['palate']<10?"0":"").$_GET['palate']).'.css");';
?>
body{background: #FFF;}
</style>
<?php //include($_SERVER['DOCUMENT_ROOT'].'/includes/templates/commonCSS.inc.php'); ?>
<script type="text/javascript" src="/behaviour/jquery.js"></script>
<script type="text/javascript" src="/behaviour/jquery.corner.js"></script>
<script type="text/javascript">
$(window).load(function()
{
// -------------------- Keep large images within the design --------------------
$("#secondarycontent div.rounded").each(function()
{
$(this).corner("7px");
});
});
</script>
</head>
<body>
<div id="breadcrumb">Breadcrumb trail</div>
<?php
}
if ($page->getMode() == 'edit') { // EDIT MODE: BASIC HTML
require_once ($_SERVER['DOCUMENT_ROOT']."/treeline/includes/help.class.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Panel - <?=$page->drawTitle()?></title>
<style type="text/css">
@import url("/style/global.css");
@import url("/treeline/style/editMode.css");
body{background: #FFF;}
</style>
</head>
<body>
<?php
// EDIT MODE: SHOW EDIT FORM
// Should this be part of the treeline class?
echo $page->drawWorkPanelTinyMCE();
// Now add the 'edit' form -- is there a neater way to do this, rathr than sandwiching the panel in form tags like this?
// $dbqs = ($DEBUG)?'?debug':'';
$dbqs = '';
$action = $_SERVER['REQUEST_URI'].$dbqs;
//$referer = read($_SERVER,'HTTP_REFERER','');
// If we're debugging, apend ?debug to the form post
echo '<form id="treeline_edit" action="'.$action.'" method="post">'."\n";
// Add the panel toolbar:
//echo $page->drawPanelToolbar();
$currentStyle = ($_POST['style']) ? $_POST['style'] : $page->style_id;
echo $page->drawToolbar($currentStyle, false, 'panel');
//include($_SERVER['DOCUMENT_ROOT'] . "/treeline/includes/functions/pages.php");
//echo drawStyleSwitcherMenu($currentStyle, 6); // The six means draw the styles availble for panels (which have a template id of 6)
echo '<input type="hidden" name="action" value="save" />'."\n";
echo '<input type="hidden" name="mode" value="'.$page->getMode().'" />'."\n";
echo '<input type="hidden" name="referer" value="'.$referer.'" />'."\n";
echo '<input type="hidden" name="title" value="'.$page->drawTitle().'" />'."\n";
echo '<div style="width: 300px; margin:0 auto;">'."\n"; /* This should inherit from a stylesheet somewhere, I think */
}
// PREVIEW MODE: SHOW DUMMY CONTENT
if ($page->getMode() != 'view' && $mode == 'preview'){
?>
<div id="sidebar">
<ul class="submemu">
<li><a class="level-1" href="#">Sub-section</a></li>
<li><a class="level-1" href="#">Sub-section</a></li>
<li class="subon"><a class="level-2" href="#">Sub-section</a>
<li><a class="level-1" href="#">Sub-section</a></li>
<li><a class="level-1" href="#">Sub-section</a></li>
<li><a class="level-1" href="#">Sub-section</a></li>
<li><a class="level-1" href="#">Sub-section</a></li>
</ul>
</div>
<div id="contentholder">
<h1 class="pagetitle">Dummy content</h1>
<div id="primarycontent">
<p>This page doesn't have any content, its purpose is to highlight what the panel (left panels also appear on right - just for preview) will look like in context.</p>
<p>By seeing this so-called 'Dummy content' next to your new panel you should get a better feeling as to how the panel will look on your website.</p>
</div>
<div id="secondarycontent">
<?php
}
?>
<div class="workpanel panel rounded <?=$panelStyle?>">
<?php if ($page->getMode()=="edit") { ?>
<p style="text-align:center;">Please enter a list of links to pages within your workstream below.</p>
<p style="text-align:center;">You can enter any content required below but only links will appear on the published panel.</p>
<h3><?=$pageTitle?></h3>
<?=$content->draw()?>
<?php } else { ?>
<h3><?= $pageTitle?></h3>
<?php
// Need to strip out all links and reject anything that is not a link.
if (preg_match_all("/<a href=\"(.*?)\"(.*?)>(.*?)<\/a>/", $content->draw(), $reg, PREG_SET_ORDER)) {
//print_r($reg);
$level=1;
foreach ($reg as $alink) {
echo '
<p class="level-'.($level<6?$level:"6up").($level==count($reg)?" last":"").'">
<a class="level-'.($level<6?$level:"6up").($level==count($reg)?" last":"").'" href="'.$alink[1].'" '.$alink[2].'>'.$alink[3].'</a>
</p>';
$level++;
}
}
?>
<?php } ?>
</div>
<?php
// EDIT MODE: CLOSE FORM AND BASIC HTML
// Close the form [and containing div] we opened above:
if ($page->getMode() == 'edit') {
?>
</div>
</form>
</body>
</html>
<?php
}
?>
<?php
// PREVIEW MODE: CLOSE PROPER HTML
// Close containing div we opened above:
if ($page->getMode() != 'view' && $mode=="preview") {
?>
</div>
</body>
</html>
<?php
}
?>