Project

General

Profile

1
<?php
2
/*
3
*	@version	1.0
4
*	@author		Ruud Eisinga (Ruud) John (PCWacht)
5
*	@date		June 2009
6
*
7
*	droplets are small codeblocks that are called from anywhere in the template. 
8
* 	To call a droplet just use [[dropletname]]. optional parameters for a droplet can be used like [[dropletname?parameter=value&parameter2=value]]
9
*/
10

    
11
require('../../config.php');
12

    
13
// Get id
14
if(!isset($_GET['droplet_id']) OR !is_numeric($_GET['droplet_id'])) {
15
	header("Location: ".ADMIN_URL."/pages/index.php");
16
} else {
17
	$droplet_id = $_GET['droplet_id'];
18
}
19

    
20
require_once(WB_PATH.'/framework/class.admin.php');
21
require_once(WB_PATH.'/framework/functions.php');
22

    
23
$admintool_link = ADMIN_URL .'/admintools/index.php';
24
$module_edit_link = ADMIN_URL .'/admintools/tool.php?tool=droplets';
25
$admin = new admin('admintools', 'admintools');
26

    
27
// check if backend.css file needs to be included into the <body></body> of modify.php
28
if(!method_exists($admin, 'register_backend_modfiles') && file_exists(WB_PATH ."/modules/droplets/backend.css")) {
29
	echo '<style type="text/css">';
30
	include(WB_PATH .'/modules/droplets/backend.css');
31
	echo "n</style>n";
32
}
33

    
34
// Load Language file
35
if(LANGUAGE_LOADED) {
36
	if(!file_exists(WB_PATH.'/modules/droplets/languages/'.LANGUAGE.'.php')) {
37
		require_once(WB_PATH.'/modules/droplets/languages/EN.php');
38
	} else {
39
		require_once(WB_PATH.'/modules/droplets/languages/'.LANGUAGE.'.php');
40
	}
41
}
42
require_once(WB_PATH . '/include/editarea/wb_wrapper_edit_area.php');
43
echo registerEditArea ('contentedit','php',true,'both',true,true,600,450,'search, fullscreen, |, undo, redo, |, select_font,|, highlight, reset_highlight, |, help');
44
		
45

    
46
$modified_when = mktime();
47
$modified_by = $admin->get_user_id();
48

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

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

    
168
<?php
169

    
170
// Print admin footer
171
$admin->print_footer();
172

    
173
?>
(9-9/13)