// Add a new main menu item for management and display of customer
// prototypes.
- add_menu_page('Site Prototypes', 'Prototypes', 'manage_options',
+ add_menu_page('Site Prototypes', 'Prototypes', 'read',
'glm-proto-admin-menu-prototypes',
array(
$this,
// Add sub-menu for adding a new prototype under the Prototypes main
// menu item.
- add_submenu_page('glm-proto-admin-menu-prototypes', 'Site Prototypes',
- 'Add', 'manage_options', 'glm-proto-admin-menu-add',
- array(
- $this,
- 'glmProtoAdminMenuAdd'
- ));
+ // See if user is permitted to add, edit, and delete prototypes
+ $canEdit = current_user_can('glm_proto_edit');
+ $user_ID = get_current_user_id();
+ if ($canEdit) {
+ add_submenu_page('glm-proto-admin-menu-prototypes',
+ 'Site Prototypes', 'Add', 'manage_options',
+ 'glm-proto-admin-menu-add',
+ array(
+ $this,
+ 'glmProtoAdminMenuAdd'
+ ));
+ }
}
/*
*
* Controller parameters
*
- * @menuItem string Name of the menu item that is being processed
+ * @param string $menuItem
+ * Name of the menu item that is being processed
*
* @return void
* @access public
$smarty = new smartyTemplateSupport();
// Add some standard parameters
- $smarty->templateAssign(
- array(
- 'request_uri' => $_SERVER['REQUEST_URI']
- ));
+ $smarty->templateAssign('request_uri', $_SERVER['REQUEST_URI']);
// Add data from model to Smarty template
$haveData = false;
if (is_array($results['data']) && count($results['data']) > 0) {
- $haveData = true;
- $smarty->templateAssign('data', $results['data']);
+ foreach ($results['data'] as $k => $d) {
+ $haveData = true;
+ $smarty->templateAssign($k, $d);
+ }
}
$smarty->templateAssign('haveData', $haveData);
{
global $wpdb;
require_once (GLM_PROTO_PLUGIN_DIR . '/models/deactivate.php');
- new glmProtoPluginDectivate($wpdb);
+ new glmProtoPluginDeactivate($wpdb);
}
-register_deactivation_hook(__FILE__, 'glmProtoPluginDeativate');
+register_deactivation_hook(__FILE__, 'glmProtoPluginDeactivate');
// Uninstall
function glmProtoPluginUninstall ()
* Assign parameters to the template
*
* This method assigns either one parameter to the template object in this
- * class
- * or an array of parameters.
+ * class or an array of parameters.
*
* Submit an array of parameters to the template.
*
- * @param array Array of arrays with parameter name (key), value pairs
+ * @name array Array of arrays with parameter name (key), value pairs
*
* or
*
// If this is a single assignment
if ($value !== null) {
-
$this->template->assign($param, $value);
// Otherwise it's an array of parameter/value pairs
/*
* This class performs all necessary additional work when this
* plugin is activated.
+ *
+ * Currently the only actions are to add role capability to display and modify
+ * prototypes.
*/
class glmProtoPluginActivate
{
// Save WordPress Database object
$this->wpdb = $wpdb;
- // Perform any activation tasks here
+ /*
+ * Perform any activation tasks here
+ */
+
+ // Add user capabilties
+ $this->addRoleCapability('glm_proto_edit', false);
+ }
+
+ /*
+ * Add a role capability to all current roles
+ *
+ * @param string $capability Name of capability to add
+ * @param string $default Whether capability should be on by default
+ *
+ * @return void
+ * @access public
+ */
+ public function addRoleCapability ($capability, $default)
+ {
+ // Get list of role objects
+ $roleObjects = $GLOBALS['wp_roles']->role_objects;
+
+ // Get list of roles we can edit
+ $roles = get_editable_roles();
+
+ // For each role object
+ foreach ($roleObjects as $key => $role) {
+
+ // Check if the role exists in list of editable roles and capability
+ // does not exist
+ if (isset($roles[$key]) && ! isset($role->capabilities[$capability])) {
+
+ // Add the role
+ $role->add_cap($capability, $default);
+ }
+ }
}
}
*/
public function modelAction ()
{
- $data = array(
+ $content = array(
'glm_proto_title' => '',
'glm_proto_title_error' => '',
'glm_proto_width' => '1500',
if (isset($_REQUEST['glm_proto_title'])) {
// Clean up all input
- $data['glm_proto_title'] = sanitize_text_field(
+ $content['glm_proto_title'] = sanitize_text_field(
$_REQUEST['glm_proto_title']);
- $data['glm_proto_width'] = sanitize_text_field(
+ $content['glm_proto_width'] = sanitize_text_field(
$_REQUEST['glm_proto_width']);
- $data['glm_proto_height'] = sanitize_text_field(
+ $content['glm_proto_height'] = sanitize_text_field(
$_REQUEST['glm_proto_height']);
- $data['glm_proto_background'] = sanitize_text_field(
+ $content['glm_proto_background'] = sanitize_text_field(
$_REQUEST['glm_proto_background']);
- $data['glm_proto_prototype'] = sanitize_text_field(
+ $content['glm_proto_prototype'] = sanitize_text_field(
$_REQUEST['glm_proto_prototype']);
// Check title field
- if ($data['glm_proto_title'] == '') {
- $data['glm_proto_title_error'] = 'Required title not supplied';
+ if ($content['glm_proto_title'] == '') {
+ $content['glm_proto_title_error'] = 'Required title not supplied';
$submitError = true;
}
// Check width field
- if ($data['glm_proto_width'] == '') {
- $data['glm_proto_width_error'] = 'Required width not supplied';
+ if ($content['glm_proto_width'] == '') {
+ $content['glm_proto_width_error'] = 'Required width not supplied';
$submitError = true;
}
// Check height field
- if ($data['glm_proto_height'] == '') {
- $data['glm_proto_height_error'] = 'Required height not supplied';
+ if ($content['glm_proto_height'] == '') {
+ $content['glm_proto_height_error'] = 'Required height not supplied';
$submitError = true;
}
// Check background image - Not required but must exist if provided
- if ($data['glm_proto_background'] != '' && ! $this->glmProtoIsUploaded(
- $data['glm_proto_background'])) {
- $data['glm_proto_background_error'] = 'Supplied background image does not exists';
+ if ($content['glm_proto_background'] != '' && ! $this->glmProtoIsUploaded(
+ $content['glm_proto_background'])) {
+ $content['glm_proto_background_error'] = 'Supplied background image does not exists';
$submitError = true;
}
// Check prototype image
- if ($data['glm_proto_prototype'] == '') {
- $data['glm_proto_prototype_error'] = 'Required prototype image not supplied ';
+ if ($content['glm_proto_prototype'] == '') {
+ $content['glm_proto_prototype_error'] = 'Required prototype image not supplied ';
$submitError = true;
} else {
$exists = $this->glmProtoIsUploaded(
- $data['glm_proto_prototype']);
+ $content['glm_proto_prototype']);
if (! $exists) {
- $data['glm_proto_prototype_error'] .= 'Supplied prototype image does not exists';
+ $content['glm_proto_prototype_error'] .= 'Supplied prototype image does not exists';
$submitError = true;
}
}
$gmtDate = date('Y-m-d', time());
date_default_timezone_set($timezoneBackup);
- $content = serialize(
+ $contentSerialized = serialize(
array(
- 'title' => $data['glm_proto_title'],
- 'width' => $data['glm_proto_width'],
- 'height' => $data['glm_proto_height'],
- 'background' => $data['glm_proto_background'],
- 'prototype' => $data['glm_proto_prototype']
+ 'title' => $content['glm_proto_title'],
+ 'width' => $content['glm_proto_width'],
+ 'height' => $content['glm_proto_height'],
+ 'background' => $content['glm_proto_background'],
+ 'prototype' => $content['glm_proto_prototype']
));
// Store into wp_posts table
array(
'post_date' => $date,
'post_date_gmt' => $gmtDate,
- 'post_content' => $content,
- 'post_title' => $data['glm_proto_title'],
+ 'post_content' => $contentSerialized,
+ 'post_title' => $content['glm_proto_title'],
'post_type' => 'glm_proto'
));
// If there was a problem storing the prototype, pass that to
// the template
if (! $result) {
- $data['glm_proto_title_error'] = 'There was an unknown problem storing this prototype.';
+ $content['glm_proto_title_error'] = 'There was an unknown problem storing this prototype.';
}
$prototypeSubmitted = true;
'menuItemRedirect' => false,
'modelRedirect' => false,
'view' => $view,
- 'data' => $data
+ 'data' => array(
+ 'content' => $content
+ )
);
}
$d = unserialize($res['post_content']);
$res['content'] = $d;
}
-
}
// Return status, any suggested view, and any data to controller
'menuItemRedirect' => false,
'modelRedirect' => false,
'view' => 'admin/prototypes/display.html',
- 'data' => $res['content']
+ 'data' => array(
+ 'content' => $res['content']
+ )
);
}
}
}
// Setup input data array
- $data = array(
+ $content = array(
'glm_proto_title' => $content['title'],
'glm_proto_title_error' => '',
'glm_proto_width' => $content['width'],
if (isset($_REQUEST['glm_proto_title'])) {
// Clean up all input
- $data['glm_proto_title'] = sanitize_text_field(
+ $content['glm_proto_title'] = sanitize_text_field(
$_REQUEST['glm_proto_title']);
- $data['glm_proto_width'] = sanitize_text_field(
+ $content['glm_proto_width'] = sanitize_text_field(
$_REQUEST['glm_proto_width']);
- $data['glm_proto_height'] = sanitize_text_field(
+ $content['glm_proto_height'] = sanitize_text_field(
$_REQUEST['glm_proto_height']);
- $data['glm_proto_background'] = sanitize_text_field(
+ $content['glm_proto_background'] = sanitize_text_field(
$_REQUEST['glm_proto_background']);
- $data['glm_proto_prototype'] = sanitize_text_field(
+ $content['glm_proto_prototype'] = sanitize_text_field(
$_REQUEST['glm_proto_prototype']);
// Check title field
- if ($data['glm_proto_title'] == '') {
- $data['glm_proto_title_error'] = 'Required title not supplied';
+ if ($content['glm_proto_title'] == '') {
+ $content['glm_proto_title_error'] = 'Required title not supplied';
$submitError = true;
}
// Check width field
- if ($data['glm_proto_width'] == '') {
- $data['glm_proto_width_error'] = 'Required width not supplied';
+ if ($content['glm_proto_width'] == '') {
+ $content['glm_proto_width_error'] = 'Required width not supplied';
$submitError = true;
}
// Check height field
- if ($data['glm_proto_height'] == '') {
- $data['glm_proto_height_error'] = 'Required height not supplied';
+ if ($content['glm_proto_height'] == '') {
+ $content['glm_proto_height_error'] = 'Required height not supplied';
$submitError = true;
}
// Check background image - Not required but must exist if provided
- if ($data['glm_proto_background'] != '' && ! $this->glmProtoIsUploaded(
- $data['glm_proto_background'])) {
- $data['glm_proto_background_error'] = 'Supplied background image does not exists';
+ if ($content['glm_proto_background'] != '' && ! $this->glmProtoIsUploaded(
+ $content['glm_proto_background'])) {
+ $content['glm_proto_background_error'] = 'Supplied background image does not exists';
$submitError = true;
}
// Check prototype image
- if ($data['glm_proto_prototype'] == '') {
- $data['glm_proto_prototype_error'] = 'Required prototype image not supplied ';
+ if ($content['glm_proto_prototype'] == '') {
+ $content['glm_proto_prototype_error'] = 'Required prototype image not supplied ';
$submitError = true;
} else {
$exists = $this->glmProtoIsUploaded(
- $data['glm_proto_prototype']);
+ $content['glm_proto_prototype']);
if (! $exists) {
- $data['glm_proto_prototype_error'] .= 'Supplied prototype image does not exists';
+ $content['glm_proto_prototype_error'] .= 'Supplied prototype image does not exists';
$submitError = true;
}
}
$gmtDate = date('Y-m-d', time());
date_default_timezone_set($timezoneBackup);
- $content = serialize(
+ $contentSerialized = serialize(
array(
- 'title' => $data['glm_proto_title'],
- 'width' => $data['glm_proto_width'],
- 'height' => $data['glm_proto_height'],
- 'background' => $data['glm_proto_background'],
- 'prototype' => $data['glm_proto_prototype']
+ 'title' => $content['glm_proto_title'],
+ 'width' => $content['glm_proto_width'],
+ 'height' => $content['glm_proto_height'],
+ 'background' => $content['glm_proto_background'],
+ 'prototype' => $content['glm_proto_prototype']
));
// Store into wp_posts table
array(
'post_date' => $date,
'post_date_gmt' => $gmtDate,
- 'post_content' => $content,
- 'post_title' => $data['glm_proto_title'],
+ 'post_content' => $contentSerialized,
+ 'post_title' => $content['glm_proto_title'],
'post_type' => 'glm_proto'
),
array(
// If there was a problem storing the prototype, pass that to
// the template
if (! $result) {
- $data['glm_proto_title_error'] = 'There was an unknown problem updating this prototype.';
+ $content['glm_proto_title_error'] = 'There was an unknown problem updating this prototype.';
}
$prototypeSubmitted = true;
'menuItemRedirect' => false,
'modelRedirect' => false,
'view' => $view,
- 'data' => $data
+ 'data' => array(
+ 'content' => $content
+ )
);
}
}
}
+ // Determine if current user can add, edit, delete prototypes
+ $canEdit = current_user_can('glm_proto_edit');
+
// Return status, suggested view, and data to controller
return array(
'status' => $success,
'menuItemRedirect' => false,
'modelRedirect' => false,
'view' => 'admin/prototypes/index.html',
- 'data' => $list
+ 'data' => array(
+ 'prototypes' => $list,
+ 'canEdit' => $canEdit
+ )
);
}
// Save WordPress Database object
$this->wpdb = $wpdb;
- // Perform any deactivation tasks here
+ // Add user capabilties
+ $this->removeRoleCapability('glm_proto_edit');
+ }
+
+ /*
+ * Remove a role capability from all current roles
+ *
+ * @param string $capability
+ *
+ * @return void
+ * @access public
+ */
+ public function removeRoleCapability ($capability)
+ {
+ // Get list of role objects
+ $roleObjects = $GLOBALS['wp_roles']->role_objects;
+
+ // Get list of roles we can edit
+ $roles = get_editable_roles();
+
+ // For each role object
+ foreach ($roleObjects as $key => $role) {
+ // Check if the role exists in list of editable roles and capability
+ // does not exist
+ if (isset($roles[$key]) && isset($role->capabilities[$capability])) {
+
+ // Remove role
+ $role->remove_cap($capability);
+ }
+ }
}
}
<h2>Add a New Prototype</h2>
- <form action="{$data.request_uri}" method="post" enctype="multipart/form-data">
+ <form action="{$content.request_uri}" method="post" enctype="multipart/form-data">
<input type="hidden" name="glm_proto_action" value="add_submit">
<table class="form-table">
<tr>
<th scope="row"><label for="glm_proto_title">Title for this Prototype <span class="glm-proto-required">*</span></label></th>
<td>
- <input name="glm_proto_title" type="text" id="glm_proto_title" value="{$data.glm_proto_title}" class="regular-text" />
- {if $data.glm_proto_title_error != ''}<br><span class="glm-proto-error">{$data.glm_proto_title_error}</span>{/if}
+ <input name="glm_proto_title" type="text" id="glm_proto_title" value="{$content.glm_proto_title}" class="regular-text" />
+ {if $content.glm_proto_title_error != ''}<br><span class="glm-proto-error">{$content.glm_proto_title_error}</span>{/if}
</td>
</tr>
<tr>
<th scope="row"><label for="glm_proto_width">Desired initial display width<span class="glm-proto-required">*</span></label></th>
<td>
- <input name="glm_proto_width" type="text" id="glm_proto_width" value="{$data.glm_proto_width}" class="regular-text" style="width: 4em;" />
- {if $data.glm_proto_width_error != ''}<br><span class="glm-proto-error">{$data.glm_proto_width_error}</span>{/if}
+ <input name="glm_proto_width" type="text" id="glm_proto_width" value="{$content.glm_proto_width}" class="regular-text" style="width: 4em;" />
+ {if $content.glm_proto_width_error != ''}<br><span class="glm-proto-error">{$content.glm_proto_width_error}</span>{/if}
</td>
</tr>
<tr>
<th scope="row"><label for="glm_proto_height">Desired initial display height<span class="glm-proto-required">*</span></label></th>
<td>
- <input name="glm_proto_height" type="text" id="glm_proto_height" value="{$data.glm_proto_height}" class="regular-text" style="width: 4em;" />
- {if $data.glm_proto_height_error != ''}<br><span class="glm-proto-error">{$data.glm_proto_height_error}</span>{/if}
+ <input name="glm_proto_height" type="text" id="glm_proto_height" value="{$content.glm_proto_height}" class="regular-text" style="width: 4em;" />
+ {if $content.glm_proto_height_error != ''}<br><span class="glm-proto-error">{$content.glm_proto_height_error}</span>{/if}
</td>
</tr>
<tr>
<th scope="row"><label for="glm_proto_background">Prototype Background</label></th>
<td>
- <input id="glm-proto-background" class="glm-proto-media-uploader" type="text" size="36" name="glm_proto_background" value="{$data.glm_proto_background}" />
+ <input id="glm-proto-background" class="glm-proto-media-uploader" type="text" size="36" name="glm_proto_background" value="{$content.glm_proto_background}" />
<input class="glm-protp-upload-button button" data-id="glm-proto-background" type="button" value="Upload Image" />
- {if $data.glm_proto_background_error != ''}<br><span class="glm-proto-error">{$data.glm_proto_background_error}</span>{/if}
+ {if $content.glm_proto_background_error != ''}<br><span class="glm-proto-error">{$content.glm_proto_background_error}</span>{/if}
</td>
</tr>
<tr>
<th scope="row"><label for="glm_proto_prototype">Prototype Image <span class="glm-proto-required">*</span></label></th>
<td>
- <input id="glm-proto-prototype" class="glm-proto-media-uploader" type="text" size="36" name="glm_proto_prototype" value="{$data.glm_proto_prototype}" />
+ <input id="glm-proto-prototype" class="glm-proto-media-uploader" type="text" size="36" name="glm_proto_prototype" value="{$content.glm_proto_prototype}" />
<input class="glm-protp-upload-button button" data-id="glm-proto-prototype" type="button" value="Upload Image" />
- {if $data.glm_proto_prototype_error != ''}<br><span class="glm-proto-error">{$data.glm_proto_prototype_error}</span>{/if}
+ {if $content.glm_proto_prototype_error != ''}<br><span class="glm-proto-error">{$content.glm_proto_prototype_error}</span>{/if}
</td>
</tr>
<tr>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
- <title>Prototype: {$data.title}</title>
+ <title>Prototype: {$content.title}</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body style="margin:0;padding:0; background: #e7e7df;">
- <div style="min-width:1400px;min-height:2500px; background: url({$data.prototype}) top center no-repeat; z-index: 10;"></div>
- <div style="min-width:100%;min-height:784px; background: url({$data.background}) top left repeat-x; position: absolute; top: 0; z-index: -1;"></div>
+ <div style="min-width:1400px;min-height:2500px; background: url({$content.prototype}) top center no-repeat; z-index: 10;"></div>
+ <div style="min-width:100%;min-height:784px; background: url({$content.background}) top left repeat-x; position: absolute; top: 0; z-index: -1;"></div>
</body>
</html>
<h2>Edit a Prototype</h2>
- <form action="{$data.request_uri}" method="post" enctype="multipart/form-data">
+ <form action="{$content.request_uri}" method="post" enctype="multipart/form-data">
<input type="hidden" name="glm_action" value="edit">
<table class="form-table">
<tr>
<th scope="row"><label for="glm_proto_title">Title for this Prototype <span class="glm-proto-required">*</span></label></th>
<td>
- <input name="glm_proto_title" type="text" id="glm_proto_title" value="{$data.glm_proto_title}" class="regular-text" />
- {if $data.glm_proto_title_error != ''}<br><span class="glm-proto-error">{$data.glm_proto_title_error}</span>{/if}
+ <input name="glm_proto_title" type="text" id="glm_proto_title" value="{$content.glm_proto_title}" class="regular-text" />
+ {if $content.glm_proto_title_error != ''}<br><span class="glm-proto-error">{$content.glm_proto_title_error}</span>{/if}
</td>
</tr>
<tr>
<th scope="row"><label for="glm_proto_width">Desired initial display width<span class="glm-proto-required">*</span></label></th>
<td>
- <input name="glm_proto_width" type="text" id="glm_proto_width" value="{$data.glm_proto_width}" class="regular-text" style="width: 4em;" />
- {if $data.glm_proto_width_error != ''}<br><span class="glm-proto-error">{$data.glm_proto_width_error}</span>{/if}
+ <input name="glm_proto_width" type="text" id="glm_proto_width" value="{$content.glm_proto_width}" class="regular-text" style="width: 4em;" />
+ {if $content.glm_proto_width_error != ''}<br><span class="glm-proto-error">{$content.glm_proto_width_error}</span>{/if}
</td>
</tr>
<tr>
<th scope="row"><label for="glm_proto_height">Desired initial display height<span class="glm-proto-required">*</span></label></th>
<td>
- <input name="glm_proto_height" type="text" id="glm_proto_height" value="{$data.glm_proto_height}" class="regular-text" style="width: 4em;" />
- {if $data.glm_proto_height_error != ''}<br><span class="glm-proto-error">{$data.glm_proto_height_error}</span>{/if}
+ <input name="glm_proto_height" type="text" id="glm_proto_height" value="{$content.glm_proto_height}" class="regular-text" style="width: 4em;" />
+ {if $content.glm_proto_height_error != ''}<br><span class="glm-proto-error">{$content.glm_proto_height_error}</span>{/if}
</td>
</tr>
<tr>
<th scope="row"><label for="glm_proto_background">Prototype Background</label></th>
<td>
- <input id="glm-proto-background" class="glm-proto-media-uploader" type="text" size="36" name="glm_proto_background" value="{$data.glm_proto_background}" />
+ <input id="glm-proto-background" class="glm-proto-media-uploader" type="text" size="36" name="glm_proto_background" value="{$content.glm_proto_background}" />
<input class="glm-protp-upload-button button" data-id="glm-proto-background" type="button" value="Upload Image" />
- {if $data.glm_proto_background_error != ''}<br><span class="glm-proto-error">{$data.glm_proto_background_error}</span>{/if}
+ {if $content.glm_proto_background_error != ''}<br><span class="glm-proto-error">{$content.glm_proto_background_error}</span>{/if}
</td>
</tr>
<tr>
<th scope="row"><label for="glm_proto_prototype">Prototype Image <span class="glm-proto-required">*</span></label></th>
<td>
- <input id="glm-proto-prototype" class="glm-proto-media-uploader" type="text" size="36" name="glm_proto_prototype" value="{$data.glm_proto_prototype}" />
+ <input id="glm-proto-prototype" class="glm-proto-media-uploader" type="text" size="36" name="glm_proto_prototype" value="{$content.glm_proto_prototype}" />
<input class="glm-protp-upload-button button" data-id="glm-proto-prototype" type="button" value="Upload Image" />
- {if $data.glm_proto_prototype_error != ''}<br><span class="glm-proto-error">{$data.glm_proto_prototype_error}</span>{/if}
+ {if $content.glm_proto_prototype_error != ''}<br><span class="glm-proto-error">{$content.glm_proto_prototype_error}</span>{/if}
</td>
</tr>
<tr>
</tr>
</thead>
<tbody>
+
{if $haveData}
- {foreach $data as $d}
+ {foreach $prototypes as $p}
<tr>
- <td>{$d.p_date}</td>
- <td>{$d.post_title}</td>
+ <td>{$p.p_date}</td>
+ <td>{$p.post_title}</td>
<td>
- <a href="{$request_uri}&glm_action=display&proto_id={$d.id}&glm_display_direct=true&glm_menu_item=prototypes" name="Edit" class="button-primary"
- onClick="dispProtoWindow('{$request_uri}&glm_action=display&proto_id={$d.id}&glm_display_direct=true&glm_menu_item=prototypes', {$d.content.width}, {$d.content.height}); return false;"
+ <a href="{$request_uri}&glm_action=display&proto_id={$p.id}&glm_display_direct=true&glm_menu_item=prototypes" name="Edit" class="button-primary"
+ onClick="dispProtoWindow('{$request_uri}&glm_action=display&proto_id={$p.id}&glm_display_direct=true&glm_menu_item=prototypes', {$p.content.width}, {$p.content.height}); return false;"
>View</a>
- <a href="{$request_uri}&glm_action=edit&proto_id={$d.id}" name="Edit" class="button-primary">Edit</a>
- <a href="{$request_uri}&glm_action=delete&proto_id={$d.id}" name="Edit" class="button-primary">Delete</a>
+ {if $canEdit}
+ <a href="{$request_uri}&glm_action=edit&proto_id={$p.id}" name="Edit" class="button-primary">Edit</a>
+ <a href="{$request_uri}&glm_action=delete&proto_id={$p.id}" name="Edit" class="button-primary">Delete</a>
+ {/if}
</td>
</tr>
{/foreach}