autocompletion for authorized services

This commit is contained in:
Roland Gruber 2012-08-13 17:44:42 +00:00
parent 78e54bb324
commit 6b4f70dccf
8 changed files with 89 additions and 2 deletions

View File

@ -11,6 +11,7 @@
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-15"><title>Upgrade notes</title> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-15"><title>Upgrade notes</title>
@ -34,6 +35,11 @@ This is a list of API changes for all LAM releases.
<li><span style="font-weight: bold;">supportsAdminInterface()</span>: Can be used mark modules that only support the self service.<br> <li><span style="font-weight: bold;">supportsAdminInterface()</span>: Can be used mark modules that only support the self service.<br>
</li> </li>
</ul> </ul>
Meta HTML:<br>
<ul>
<li>Input fields support autocompletion<br>
</li>
</ul>
<br> <br>
<h2>3.7 -&gt; 3.8<br> <h2>3.7 -&gt; 3.8<br>
</h2> </h2>

View File

@ -2186,6 +2186,30 @@ Have fun!
</imageobject> </imageobject>
</mediaobject> </mediaobject>
</screenshot> </screenshot>
<para>You can define a list of services in your LAM server profile
that is used for autocompletion.</para>
<screenshot>
<mediaobject>
<imageobject>
<imagedata fileref="images/mod_authorizedServices3.png" />
</imageobject>
</mediaobject>
</screenshot>
<para>The autocompletion will show all values that contains the
entered text. To display the whole list you can press backspace in the
empty input field. Of course, you can also insert a service name that
is not in the list.</para>
<screenshot>
<mediaobject>
<imageobject>
<imagedata fileref="images/mod_authorizedServices2.png" />
</imageobject>
</mediaobject>
</screenshot>
</section> </section>
<section> <section>
@ -3059,7 +3083,7 @@ Run slapindex to rebuild the index.
<para>LAM Pro allows you to manage automount entries. Please activate <para>LAM Pro allows you to manage automount entries. Please activate
the account type "Automount objects" in your LAM Pro server the account type "Automount objects" in your LAM Pro server
profile:</para> profile.</para>
<screenshot> <screenshot>
<mediaobject> <mediaobject>
@ -3069,6 +3093,18 @@ Run slapindex to rebuild the index.
</mediaobject> </mediaobject>
</screenshot> </screenshot>
<para>Then add the correct automount module. Usually, this is "Automount
entry (automount)". If you use Suse Linux with RFC2307bis schema please
select "Automount entry (rfc2307bisAutomount)".</para>
<screenshot>
<mediaobject>
<imageobject>
<imagedata fileref="images/automount3.png" />
</imageobject>
</mediaobject>
</screenshot>
<para>This will add a new tab to LAM Pro's main screen which includes a <para>This will add a new tab to LAM Pro's main screen which includes a
list of all automount entries. Here you can easily create new list of all automount entries. Here you can easily create new
entries.</para> entries.</para>
@ -4988,7 +5024,7 @@ Run slapindex to rebuild the index.
<entry>automount</entry> <entry>automount</entry>
<entry>autofs.schema</entry> <entry>autofs.schema, rfc2307bis.schema</entry>
<entry>Autofs LDAP</entry> <entry>Autofs LDAP</entry>

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@ -364,6 +364,12 @@ class htmlInputField extends htmlElement {
protected $required = false; protected $required = false;
/** validation rule */ /** validation rule */
private $validationRule = null; private $validationRule = null;
/** enable autocomplete */
private $autocomplete = false;
/** autocompletion suggestions */
private $autocompleteValues = array();
/** autocomplete start at this input length */
private $autocompleteMinLength = 1;
/** /**
* Constructor * Constructor
@ -437,6 +443,15 @@ class htmlInputField extends htmlElement {
$disabled = ' disabled'; $disabled = ' disabled';
} }
echo '<input type="' . $inputType . '"' . $class . $name . $id . $value . $maxLength . $size . $fieldTabIndex . $disabled . '>'; echo '<input type="' . $inputType . '"' . $class . $name . $id . $value . $maxLength . $size . $fieldTabIndex . $disabled . '>';
// autocompletion
if ($this->autocomplete) {
echo "<script type=\"text/javascript\">\n";
echo 'jQuery(function() {';
echo 'var availableTags = [' . implode(',', $this->autocompleteValues) . '];';
echo 'jQuery( "#' . $this->fieldName . '" ).autocomplete({ source: availableTags, minLength: ' . $this->autocompleteMinLength . '});';
echo '});';
echo "</script\n>";
}
if ($this->transient) { if ($this->transient) {
return array(); return array();
} }
@ -520,6 +535,21 @@ class htmlInputField extends htmlElement {
public function setValidationRule($rule) { public function setValidationRule($rule) {
$this->validationRule = $rule; $this->validationRule = $rule;
} }
/**
* Enables autocompletion for this input field.
*
* @param array $values list of values to suggest
* @param int $minLength autocompletion starts after this number of caracters entered (default 1; 0 means immediate start)
*/
public function enableAutocompletion($values, $minLength = 1) {
for ($i = 0; $i < sizeof($values); $i++) {
$values[$i] = '"' . htmlspecialchars($values[$i]) . '"';
}
$this->autocomplete = true;
$this->autocompleteValues = $values;
$this->autocompleteMinLength = $minLength;
}
} }

View File

@ -81,8 +81,16 @@ class authorizedServiceObject extends baseModule {
'autoAdd' => array( 'autoAdd' => array(
"Headline" => _("Automatically add this extension"), "Headline" => _("Automatically add this extension"),
"Text" => _("This will enable the extension automatically if this profile is loaded.") "Text" => _("This will enable the extension automatically if this profile is loaded.")
),
'predefinedServices' => array(
"Headline" => _("Predefined services"),
"Text" => _("These services will show up as hint if you enter a new service.")
) )
); );
// config options
$configContainer = new htmlTable();
$configContainer->addElement(new htmlTableExtendedInputTextarea('authorizedServiceObject_services', "sshd\r\nimap", 30, 5, _('Predefined services'), 'predefinedServices'));
$return['config_options']['all'] = $configContainer;
// upload fields // upload fields
$return['upload_columns'] = array( $return['upload_columns'] = array(
array( array(
@ -146,6 +154,10 @@ class authorizedServiceObject extends baseModule {
} }
$return = new htmlTable(); $return = new htmlTable();
if (in_array('authorizedServiceObject', $this->attributes['objectClass'])) { if (in_array('authorizedServiceObject', $this->attributes['objectClass'])) {
$autocompleteValues = array();
if (isset($this->moduleSettings['authorizedServiceObject_services'])) {
$autocompleteValues = $this->moduleSettings['authorizedServiceObject_services'];
}
$ASCount = 0; $ASCount = 0;
// list current authorizedService's // list current authorizedService's
if (isset($this->attributes['authorizedService'])) { if (isset($this->attributes['authorizedService'])) {
@ -158,6 +170,7 @@ class authorizedServiceObject extends baseModule {
$return->addElement(new htmlOutputText('')); $return->addElement(new htmlOutputText(''));
} }
$ASInput = new htmlInputField('authorizedService' . $i, $this->attributes['authorizedService'][$i]); $ASInput = new htmlInputField('authorizedService' . $i, $this->attributes['authorizedService'][$i]);
$ASInput->enableAutocompletion($autocompleteValues, 0);
$return->addElement($ASInput); $return->addElement($ASInput);
$return->addElement(new htmlButton('delAS' . $i, 'del.png', true)); $return->addElement(new htmlButton('delAS' . $i, 'del.png', true));
$return->addElement(new htmlHelpLink('authorizedService'), true); $return->addElement(new htmlHelpLink('authorizedService'), true);
@ -166,6 +179,7 @@ class authorizedServiceObject extends baseModule {
// input box for new Service // input box for new Service
$return->addElement(new htmlOutputText(_('New Authorized Service'))); $return->addElement(new htmlOutputText(_('New Authorized Service')));
$newASInput = new htmlInputField('authorizedService', ''); $newASInput = new htmlInputField('authorizedService', '');
$newASInput->enableAutocompletion($autocompleteValues, 0);
$return->addElement($newASInput); $return->addElement($newASInput);
$return->addElement(new htmlButton('addAS', 'add.png', true)); $return->addElement(new htmlButton('addAS', 'add.png', true));
$return->addElement(new htmlHelpLink('authorizedService')); $return->addElement(new htmlHelpLink('authorizedService'));

View File

@ -334,6 +334,7 @@
float: left; float: left;
clear: left; clear: left;
width: 100%; width: 100%;
background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x;
} }
.ui-menu .ui-menu-item a { .ui-menu .ui-menu-item a {
text-decoration:none; text-decoration:none;