Regards: Suggestions

Forum dedicated to Mods for HESK created by Mike Koch

Moderator: mkoch227

Post Reply
alcazar
Posts: 81
Joined: Mon May 27, 2013 6:36 pm

Regards: Suggestions

Post by alcazar »

Yes, there is a page for suggestions, but its more commenting there.
Its about the "Category Manager" and "group permission" from me.

First, me thought, using group permissions might be to much code change in Hesk and Hesk-Mods by MKoch.
Since its only affecting user management and you dont add users every day, using "templates" could be easier, while doing the same.
Image
You just have to create a new table, add a bit of code to "manage_users.php" and it should work.
Idea is, that if you enter a name in the box, the current options set on "permissions tab" will be saved as a "template" in the DB and can be loaded when adding another user if necessary.

Table could look like

Code: Select all

CREATE TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."templates` (
  `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `categories` varchar(500) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `heskprivileges` varchar(1000) COLLATE utf8_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
Code for screen above:

Code: Select all

Language:
$hesklang['add_template']='Permissions-Template:';
$hesklang['template_name']='Name of Template';
$hesklang['max_chars2']='max 50 chars';
$hesklang['load']='Load';
$hesklang['template_intro']='Allows to save current permissions as a template for later use, so you dont have to set them manually.';

manage_users:
<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr>
			<td width="7" height="7"><img src="../img/roundcornerslt.jpg" width="7" height="7" alt="" /></td>
			<td class="roundcornerstop"></td>
			<td><img src="../img/roundcornersrt.jpg" width="7" height="7" alt="" /></td>
		</tr>
		<tr>
		<td class="roundcornersleft">&nbsp;</td>
		<td>
        <!-- CONTENT -->

<form action="manage_users.php" method="post">
<h3><?php echo $hesklang['add_template']; ?> [<a href="javascript:void(0)" onclick="javascript:alert('<?php echo hesk_makeJsString($hesklang['template_intro']); ?>')">?</a>]</h3>

<p><b><?php echo $hesklang['template_name']; ?></b> (<?php echo $hesklang['max_chars2']; ?>)<b>:</b><br /><input type="text" name="tempname" size="50" maxlength="50"/></p>

<input type="hidden" name="token" value="<?php hesk_token_echo(); ?>" />
<input type="submit" value="<?php echo $hesklang['save']; ?>" class="orangebutton" onmouseover="hesk_btn(this,'orangebuttonover');" onmouseout="hesk_btn(this,'orangebutton');" />
<input type="submit" value="<?php echo $hesklang['load']; ?>" class="orangebutton" onmouseover="hesk_btn(this,'orangebuttonover');" onmouseout="hesk_btn(this,'orangebutton');" /></p>
</form>

		<!-- END CONTENT -->
        </td>
		<td class="roundcornersright">&nbsp;</td>
		</tr>
		<tr>
		<td><img src="../img/roundcornerslb.jpg" width="7" height="7" alt="" /></td>
		<td class="roundcornersbottom"></td>
		<td width="7" height="7"><img src="../img/roundcornersrb.jpg" width="7" height="7" alt="" /></td>
		</tr>
	</table>
The code is added after (around line 390-400)

Code: Select all

<form name="form1" method="post" action="manage_users.php">
<?php hesk_profile_tab('userdata', false); ?>

<!-- Submit -->
<p align="center"><input type="hidden" name="a" value="new" />
<input type="hidden" name="token" value="<?php hesk_token_echo(); ?>" />
<input type="submit" value="<?php echo $hesklang['create_user']; ?>" class="orangebutton" onmouseover="hesk_btn(this,'orangebuttonover');" onmouseout="hesk_btn(this,'orangebutton');" />
|
<a href="manage_users.php?a=reset_form"><?php echo $hesklang['refi']; ?></a></p>
</form>
ToDo: Add real code to save/load template in/from DB.

Thanks.
Alcazar
(nach Diktat spazierengegangen)
alcazar
Posts: 81
Joined: Mon May 27, 2013 6:36 pm

Re: Regards: Suggestions

Post by alcazar »

Many thanks for adding the "permission templates" and "category manager".
Me thinks, users will like them.
Could also be an inspiration for the Boss for the upcoming Hesk 3 *hint hint* :roll:

Have a nice weekend.
Alcazar
(nach Diktat spazierengegangen)
Post Reply