Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        module
5
 * @package         droplet
6
 * @author          Ruud Eisinga (Ruud) John (PCWacht)
7
 * @author          WebsiteBaker Project
8
 * @copyright       2004-2009, Ryan Djurovich
9
 * @copyright       2009-2010, Website Baker Org. e.V.
10
 * @link			http://www.websitebaker2.org/
11
 * @license         http://www.gnu.org/licenses/gpl.html
12
 * @platform        WebsiteBaker 2.8.x
13
 * @requirements    PHP 4.4.9 and higher
14
 * @version         $Id: modify_droplet.php 1296 2010-02-19 11:02:17Z Luisehahne $
15
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/modules/droplets/modify_droplet.php $
16
 * @lastmodified    $Date: 2010-02-19 12:02:17 +0100 (Fri, 19 Feb 2010) $
17
 *
18
 */
19

    
20
require('../../config.php');
21

    
22
// Get id
23
if(!isset($_GET['droplet_id']) OR !is_numeric($_GET['droplet_id'])) {
24
	header("Location: ".ADMIN_URL."/pages/index.php");
25
} else {
26
	$droplet_id = $_GET['droplet_id'];
27
}
28

    
29
require_once(WB_PATH.'/framework/class.admin.php');
30
require_once(WB_PATH.'/framework/functions.php');
31

    
32
$admintool_link = ADMIN_URL .'/admintools/index.php';
33
$module_edit_link = ADMIN_URL .'/admintools/tool.php?tool=droplets';
34
$admin = new admin('admintools', 'admintools');
35

    
36
// check if backend.css file needs to be included into the <body></body> of modify.php
37
if(!method_exists($admin, 'register_backend_modfiles') && file_exists(WB_PATH ."/modules/droplets/backend.css")) {
38
	echo '<style type="text/css">';
39
	include(WB_PATH .'/modules/droplets/backend.css');
40
	echo "n</style>n";
41
}
42

    
43
// Load Language file
44
if(LANGUAGE_LOADED) {
45
	if(!file_exists(WB_PATH.'/modules/droplets/languages/'.LANGUAGE.'.php')) {
46
		require_once(WB_PATH.'/modules/droplets/languages/EN.php');
47
	} else {
48
		require_once(WB_PATH.'/modules/droplets/languages/'.LANGUAGE.'.php');
49
	}
50
}
51
require_once(WB_PATH . '/include/editarea/wb_wrapper_edit_area.php');
52
echo registerEditArea ('contentedit','php',true,'both',true,true,600,450,'search, fullscreen, |, undo, redo, |, select_font,|, highlight, reset_highlight, |, help');
53
		
54

    
55
$modified_when = time();
56
$modified_by = $admin->get_user_id();
57

    
58
// Get header and footer
59
$query_content = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_droplets WHERE id = '$droplet_id'");
60
$fetch_content = $query_content->fetchRow();
61
$content = (htmlspecialchars($fetch_content['code']));
62
?>
63
<h4 style="margin: 0; border-bottom: 1px solid #DDD; padding-bottom: 5px;">
64
	<a href="<?php echo $admintool_link;?>"><?php echo $HEADING['ADMINISTRATION_TOOLS']; ?></a>
65
	->
66
	<a href="<?php echo $module_edit_link;?>">Droplet Edit</a>
67
</h4>
68
<br />
69
<form name="modify" action="<?php echo WB_URL; ?>/modules/droplets/save_droplet.php" method="post" style="margin: 0;">
70
<input type="hidden" name="data_codepress" value="" />
71
<input type="hidden" name="droplet_id" value="<?php echo $droplet_id; ?>" />
72
<input type="hidden" name="show_wysiwyg" value="<?php echo $fetch_content['show_wysiwyg']; ?>" />
73

    
74
<table class="row_a" cellpadding="4" cellspacing="0" border="0" width="100%">
75
		<tr>
76
		<td width="10%" class="setting_name">
77
			<?php echo $TEXT['NAME']; ?>:
78
		</td>
79
		<td width="90%">
80
			<input type="text" name="title" value="<?php echo stripslashes($fetch_content['name']); ?>" style="width: 38%;" maxlength="32" />
81
		</td>
82
	</tr>
83
	<tr>
84
		<td valign="top" class="setting_name" width="60px"><?php echo $TEXT['DESCRIPTION']; ?>:</td>
85
		<td>
86
			<input type="text" name="description" value="<?php echo stripslashes($fetch_content['description']); ?>" style="width: 98%;" />
87
		</td>
88
	</tr>
89
	<tr>
90
		<td class="setting_name" width="60px">
91
			<?php echo $TEXT['ACTIVE']; ?>:
92
		</td>
93
		<td>	
94
			<input type="radio" name="active" id="active_true" value="1" <?php if($fetch_content['active'] == 1) { echo ' checked="checked"'; } ?> />
95
			<a href="#" onclick="javascript: document.getElementById('active_true').checked = true;">
96
			<label><?php echo $TEXT['YES']; ?></label>
97
			</a>
98
			<input type="radio" name="active" id="active_false" value="0" <?php if($fetch_content['active'] == 0) { echo ' checked="checked"'; } ?> />
99
			<a href="#" onclick="javascript: document.getElementById('active_false').checked = true;">
100
			<label><?php echo $TEXT['NO']; ?></label>
101
			</a>
102
		</td>
103
	</tr>
104
<?php
105
// Next show only if admin is logged in, user_id = 1
106
if ($modified_by == 1) {
107
	?>
108
	<tr>
109
		<td class="setting_name" width="60px">
110
			<?php echo $TEXT['ADMIN']; ?>:
111
		</td>
112
		<td> 
113
			<?php echo $DR_TEXT['ADMIN_EDIT']; ?>&nbsp;   	
114
			<input type="radio" name="admin_edit" id="admin_edit_true" value="1" <?php if($fetch_content['admin_edit'] == 1) { echo ' checked="checked"'; } ?> />
115
			<a href="#" onclick="javascript: document.getElementById('admin_edit_true').checked = true;">
116
			<label><?php echo $TEXT['YES']; ?></label>
117
			</a>
118
			<input type="radio" name="admin_edit" id="admin_edit_false" value="0" <?php if($fetch_content['admin_edit'] == 0) { echo ' checked="checked"'; } ?> />
119
			<a href="#" onclick="javascript: document.getElementById('admin_edit_false').checked = true;">
120
			<label><?php echo $TEXT['NO']; ?></label>
121
			</a>
122
			&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
123
			<?php echo $DR_TEXT['ADMIN_VIEW']; ?>:
124
			<input type="radio" name="admin_view" id="admin_view_true" value="1" <?php if($fetch_content['admin_view'] == 1) { echo ' checked="checked"'; } ?> />
125
			<a href="#" onclick="javascript: document.getElementById('admin_view_true').checked = true;">
126
			<label><?php echo $TEXT['YES']; ?></label>
127
			</a>
128
			<input type="radio" name="admin_view" id="admin_view_false" value="0" <?php if($fetch_content['admin_view'] == 0) { echo ' checked="checked"'; } ?> />
129
			<a href="#" onclick="javascript: document.getElementById('admin_view_false').checked = true;">
130
			<label><?php echo $TEXT['NO']; ?></label>
131
			</a>
132
		</td>
133
	</tr>
134
	<?php
135
}
136
?>
137
	<tr>
138
		<td valign="top" class="setting_name" width="60px"><?php echo $TEXT['CODE']; ?>:</td>
139
		<td ><textarea name="savecontent" id ="contentedit" style="width: 98%; height: 450px;" rows="50" cols="120"><?php echo $content; ?></textarea>&nbsp;
140
		</td>
141
	</tr>
142
	<tr>
143
		<td colspan="2">					
144
		</td>
145
	</tr>
146
	<tr>
147
		<td valign="top" class="setting_name" width="60px"><?php echo $TEXT['COMMENTS']; ?>:</td>
148
		<td>
149
			<textarea name="comments" style="width: 98%; height: 100px;" rows="50" cols="120"><?php echo stripslashes($fetch_content['comments']); ?></textarea>
150
		</td>
151
	</tr>
152
	<tr>
153
		<td colspan="2">&nbsp;					
154
		</td>
155
	</tr>
156
</table>
157
<br />
158
<table cellpadding="0" cellspacing="0" border="0" width="100%">
159
	<tr>
160
		<td align="left">
161
<?php
162
// Show only save button if allowed....
163
if ($modified_by == 1 OR $fetch_content['admin_edit'] == 0 ) {
164
	?>
165
			<button  class="save" name="save" type="submit"><?php echo $TEXT['SAVE']; ?></button>
166
	<?php
167
}
168
?>
169

    
170
		</td>
171
		<td align="right">
172
			<button class="cancel" type="button" onclick="javascript: window.location = '<?php echo $module_edit_link; ?>';"><?php echo $TEXT['CANCEL']; ?></button>
173
		</td>
174
	</tr>
175
</table>
176
</form>
177
<?php
178

    
179
// Print admin footer
180
$admin->print_footer();
181

    
182
?>
(9-9/13)