Class: MF_Widget_password extends MF_Widget
- Package: saf.MailForm
- Author: John Luxford <lux@simian.ca>
- Copyright: Copyright (C) 2001-2003, Simian Systems Inc.
- License: http://www.sitellite.org/index/license Simian Open Software License
- Version: 1.2, 2002-08-27, $Id: Password.php,v 1.3 2007/10/06 00:06:30 lux Exp $
- Access: public
Password widget. Displays an HTML <input type="password" /> form field.
New in 1.2:
- Added encrypt() and verify() methods.
New in 1.4:
- Added a makeStrong() method that automatically defines a series of recommended
rules for all passwords, such as minimum length and required characters to
reduce the odds of guessability.
- Added a generate() method that generates strong passwords for you.
- Added a $ignoreEmpty property.
Usage Example
<?php
$widget = new MF_Widget_password ('name');
$widget->validation ('is "foo"');
$widget->setValue ('foo');
$widget->error_message = 'Oops! This widget is being unruly!';
?>
Properties
$invalid_field = ''
- Access: public
Contains the name of the widget that did not validate during
the last call to the invalid () method.
$method
- Access: public
The value of the method attribute of the HTML form tag.
$method is actually an alias for $_attrs['method'].
$action
- Access: public
The value of the action attribute of the HTML form tag.
$action is actually an alias for $_attrs['action'].
$widgets = array ()
- Access: public
An array of form widgets.
$template
- Access: public
The optional template file or data used to customize the look
of the form.
$title = false
- Access: public
This is the name/title field from the list table.
$message
- Access: public
The initial message to be displayed at the top of the form.
$extra = ''
- Access: public
A way to pass extra parameters to the HTML form tag, for
example 'enctype="multipart/formdata"'.
$error_message
- Access: public
Contains the message from any internal errors.
$error_mode = 'single'
- Access: public
Determines the way in which error messages are displayed.
The default ('single') is to display the error message for the first
invalid field only. The other ('all') is to display a list of all
invalid fields with their corresponding error messages. Please note
that $error_mode 'all' assumes that a custom error message is provided
for every rule.
$invalid = array ()
- Access: public
A list of all invalid fields in the form, and their corresponding
error messages.
$submitted = false
- Access: private
Contains a true or false value as to whether the form has been
submitted successfully or not. An invalid form will contain false.
This value is used internally by the setValues() method.
$name
- Access: public
The name of the widget.
$_attrs = array ()
- Access: private
This contains a list of attributes of the HTML form tag.
$sendTo
- Access: public
The email address to send the form to in the default handler.
$sendFrom = ''
- Access: public
The email address to send the form from in the default handler.
$sendExtra = ''
- Access: public
Any extra parameters for the mail() function in the default handler.
$sendSubject = 'Mail Form'
- Access: public
The subject line of the email to send from the default handler.
$screenReply = 'Thank you. Your form has been sent.'
- Access: public
The response to return upon a successfully submitted form in the
default handler. Defaults to "Thank you. Your form has been sent."
$handler
- Access: public
The function or object method to use to handle the submitted form.
This function or method will be called by the run() method. Use the
setHandler() method to change this setting.
$uploadFiles = true
- Access: public
Whether to upload files automatically or to leave them for a custom
saving mechanism.
$verify_sender = false
- Access: public
Whether to verify the REQUEST_METHOD and HTTP_REFERER headers to make
it more difficult (although not impossible) for spammers to abuse your
form. Note that this can be enabled in a form's settings file under
the [Form] block via: verify_sender = yes
$clean_input = false
- Access: public
Whether to strip all HTML and PHP tags/code from all input parameters.
This is off by default because it would break forms with the Xed editor
by default, so it must be enabled as needed. Note that this can be
enabled in a form's settings file under the [Form] block via:
clean_input = yes
$blacklist = true
- Access: public
Whether to verify the remote address of the form submitter against
a list of invalid IP addresses in the database table
sitellite_form_blacklist so as to prevent repeated abuse from a single
source.
$verify_session = true
- Access: public
Whether to verify that the submitter can accept session data, which
helps ensure they are a legitimate human user. Passing session
verification requires cookies to be enabled for the submitter, which
may help prevent abuse in combination with the other abuse-prevention
techniques because a spambot may ignore the cookie, however this
restricts forms for legitimate visitors who have cookies disabled
in their browser (only a very small number of users disable cookies,
but some do). To disable for a single form, add verify_session = no
to its settings.php form.
$autosave = false
- Access: public
Whether this form should tie into Sitellite's autosave capabilities.
Please note that the autosave handler is only available to authenticated
users and not to anonymous forms.
$context = false
The context of the form. If this is set to 'action' then the title of
the form will be set by calling page_title() instead of outputting an
<h1> tag.
$rule
- Access: public
The original unmodified rule definition.
$msg
- Access: public
The error message for this rule.
$type = 'password'
- Access: public
This is the short name for this widget. The short name is
the class name minus the 'MF_Widget_' prefix.
$value
- Access: public
The rule value. This corresponds to the part of the rule
in double quotes (ie. type "value").
$negated = false
- Access: public
If a 'not' is present at the start of the rule, this will be
set to true, otherwise false.
$allowed = array ()
- Access: public
The access levels the user is allowed to access.
$nullable
- Access: public
Can this field contain a null value.
$tables = array ()
- Access: public
The list of elements that are to be displayed.
$allow_all_text = 'Allow All'
- Access: public
The text to display for the first element, which defaults to 'Allow All'.
$size
- Access: public
The height in rows of the select field. The constructor sets this
to default to 3.
$addLink = 'addAttachment.php'
- Access: public
This is the link to send the 'Add' button to. Defaults to
'addAttachment.php'.
$removeLink = 'removeAttachment.php'
- Access: public
This is the link to send the 'Remove' button to. Defaults to
'removeAttachment.php'.
$format = '%Y-%m-%d'
- Access: public
This determines the format of the date stored in the hidden
field, and also the format submitted by the form widget.
$displayFormat = '%a, %e %b, %Y'
- Access: public
This determines the format of the date displayed to the user.
$lang = 'en'
- Access: public
This determines the language file to load for the calendar
user interface. See the folder /js/calendar/lang for a list
of available languages.
$style = 'sitellite'
- Access: public
This determines the stylesheet to load for the calendar
user interface. See the CSS files in the folder /js/calendar
for a list of available stylesheets, or information on
writing your own.
$showsTime = false
- Access: public
Determines whether to show the time selection options under the
calendar.
$timeFormat = '12'
- Access: public
Sets the display time to 24 hours, or 12 hours with AM/PM option.
The default is 12 hours.
$fieldset = true
- Access: public
Set this to false if you don't want the fieldset and legend tags.
$align = 'vertical'
- Access: public
This determines the alignment of the buttons. The default is vertical,
which puts each button on its own row. Setting this to horizontal will put
the buttons all on the same row.
$columns = 1
This lets you change the number of columns used to display the checkboxes.
Default is 1 and up to 4 are supported. Alternately, if you specify the
name of a .spt file in this value, the form will use that template to
display the widget.
$_vertical_template = '{if obj.fieldset} <tr>
<td colspan="2" class="label">
<label for="{name}" id="{name}-label"{filter none}{invalid}{end filter}>{display_value}</label>
</td>
</tr>{end if}
<tr>
<td colspan="2" class="field">
{loop obj.value}
<input
type="checkbox"
{filter none}{attrstr}{end filter}
value="{loop/_key}"
id="{name}_{loop/_key}"
{if in_array (loop._key, obj.values)}checked="checked"{end if}
{filter none}{extra}{end filter}
/>
<label for="{name}_{loop/_key}">{loop/_value}</label><br />
{end loop}
</td>
</tr>
'
<td colspan="2" class="label">
<label for="{name}" id="{name}-label"{filter none}{invalid}{end filter}>{display_value}</label>
</td>
</tr>{end if}
<tr>
<td colspan="2" class="field">
{loop obj.value}
<input
type="checkbox"
{filter none}{attrstr}{end filter}
value="{loop/_key}"
id="{name}_{loop/_key}"
{if in_array (loop._key, obj.values)}checked="checked"{end if}
{filter none}{extra}{end filter}
/>
<label for="{name}_{loop/_key}">{loop/_value}</label><br />
{end loop}
</td>
</tr>
'
$_vertical_template2 = '{if obj.fieldset} <tr>
<td colspan="2" class="label">
<label for="{name}" id="{name}-label"{filter none}{invalid}{end filter}>{display_value}</label>
</td>
</tr>{end if}
<tr>
<td colspan="2" class="field">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="50%" valign="top">
{loop obj.value1}
<input
type="checkbox"
{filter none}{attrstr}{end filter}
value="{loop/_key}"
id="{name}_{loop/_key}"
{if in_array (loop._key, obj.values)}checked="checked"{end if}
{filter none}{extra}{end filter}
/>
<label for="{name}_{loop/_key}">{loop/_value}</label><br />
{end loop}
</td>
<td width="50%" valign="top">
{loop obj.value2}
<input
type="checkbox"
{filter none}{attrstr}{end filter}
value="{loop/_key}"
id="{name}_{loop/_key}"
{if in_array (loop._key, obj.values)}checked="checked"{end if}
{filter none}{extra}{end filter}
/>
<label for="{name}_{loop/_key}">{loop/_value}</label><br />
{end loop}
</td>
</tr>
</table>
</td>
</tr>
'
<td colspan="2" class="label">
<label for="{name}" id="{name}-label"{filter none}{invalid}{end filter}>{display_value}</label>
</td>
</tr>{end if}
<tr>
<td colspan="2" class="field">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="50%" valign="top">
{loop obj.value1}
<input
type="checkbox"
{filter none}{attrstr}{end filter}
value="{loop/_key}"
id="{name}_{loop/_key}"
{if in_array (loop._key, obj.values)}checked="checked"{end if}
{filter none}{extra}{end filter}
/>
<label for="{name}_{loop/_key}">{loop/_value}</label><br />
{end loop}
</td>
<td width="50%" valign="top">
{loop obj.value2}
<input
type="checkbox"
{filter none}{attrstr}{end filter}
value="{loop/_key}"
id="{name}_{loop/_key}"
{if in_array (loop._key, obj.values)}checked="checked"{end if}
{filter none}{extra}{end filter}
/>
<label for="{name}_{loop/_key}">{loop/_value}</label><br />
{end loop}
</td>
</tr>
</table>
</td>
</tr>
'
$_vertical_template3 = '{if obj.fieldset} <tr>
<td colspan="2" class="label">
<label for="{name}" id="{name}-label"{filter none}{invalid}{end filter}>{display_value}</label>
</td>
</tr>{end if}
<tr>
<td colspan="2" class="field">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="33%" valign="top">
{loop obj.value1}
<input
type="checkbox"
{filter none}{attrstr}{end filter}
value="{loop/_key}"
id="{name}_{loop/_key}"
{if in_array (loop._key, obj.values)}checked="checked"{end if}
{filter none}{extra}{end filter}
/>
<label for="{name}_{loop/_key}">{loop/_value}</label><br />
{end loop}
</td>
<td width="33%" valign="top">
{loop obj.value2}
<input
type="checkbox"
{filter none}{attrstr}{end filter}
value="{loop/_key}"
id="{name}_{loop/_key}"
{if in_array (loop._key, obj.values)}checked="checked"{end if}
{filter none}{extra}{end filter}
/>
<label for="{name}_{loop/_key}">{loop/_value}</label><br />
{end loop}
</td>
<td width="33%" valign="top">
{loop obj.value3}
<input
type="checkbox"
{filter none}{attrstr}{end filter}
value="{loop/_key}"
id="{name}_{loop/_key}"
{if in_array (loop._key, obj.values)}checked="checked"{end if}
{filter none}{extra}{end filter}
/>
<label for="{name}_{loop/_key}">{loop/_value}</label><br />
{end loop}
</td>
</tr>
</table>
</td>
</tr>
'
<td colspan="2" class="label">
<label for="{name}" id="{name}-label"{filter none}{invalid}{end filter}>{display_value}</label>
</td>
</tr>{end if}
<tr>
<td colspan="2" class="field">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="33%" valign="top">
{loop obj.value1}
<input
type="checkbox"
{filter none}{attrstr}{end filter}
value="{loop/_key}"
id="{name}_{loop/_key}"
{if in_array (loop._key, obj.values)}checked="checked"{end if}
{filter none}{extra}{end filter}
/>
<label for="{name}_{loop/_key}">{loop/_value}</label><br />
{end loop}
</td>
<td width="33%" valign="top">
{loop obj.value2}
<input
type="checkbox"
{filter none}{attrstr}{end filter}
value="{loop/_key}"
id="{name}_{loop/_key}"
{if in_array (loop._key, obj.values)}checked="checked"{end if}
{filter none}{extra}{end filter}
/>
<label for="{name}_{loop/_key}">{loop/_value}</label><br />
{end loop}
</td>
<td width="33%" valign="top">
{loop obj.value3}
<input
type="checkbox"
{filter none}{attrstr}{end filter}
value="{loop/_key}"
id="{name}_{loop/_key}"
{if in_array (loop._key, obj.values)}checked="checked"{end if}
{filter none}{extra}{end filter}
/>
<label for="{name}_{loop/_key}">{loop/_value}</label><br />
{end loop}
</td>
</tr>
</table>
</td>
</tr>
'
$_vertical_template4 = '{if obj.fieldset} <tr>
<td colspan="2" class="label">
<label for="{name}" id="{name}-label"{filter none}{invalid}{end filter}>{display_value}</label>
</td>
</tr>{end if}
<tr>
<td colspan="2" class="field">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="25%" valign="top">
{loop obj.value1}
<input
type="checkbox"
{filter none}{attrstr}{end filter}
value="{loop/_key}"
id="{name}_{loop/_key}"
{if in_array (loop._key, obj.values)}checked="checked"{end if}
{filter none}{extra}{end filter}
/>
<label for="{name}_{loop/_key}">{loop/_value}</label><br />
{end loop}
</td>
<td width="25%" valign="top">
{loop obj.value2}
<input
type="checkbox"
{filter none}{attrstr}{end filter}
value="{loop/_key}"
id="{name}_{loop/_key}"
{if in_array (loop._key, obj.values)}checked="checked"{end if}
{filter none}{extra}{end filter}
/>
<label for="{name}_{loop/_key}">{loop/_value}</label><br />
{end loop}
</td>
<td width="25%" valign="top">
{loop obj.value3}
<input
type="checkbox"
{filter none}{attrstr}{end filter}
value="{loop/_key}"
id="{name}_{loop/_key}"
{if in_array (loop._key, obj.values)}checked="checked"{end if}
{filter none}{extra}{end filter}
/>
<label for="{name}_{loop/_key}">{loop/_value}</label><br />
{end loop}
</td>
<td width="25%" valign="top">
{loop obj.value4}
<input
type="checkbox"
{filter none}{attrstr}{end filter}
value="{loop/_key}"
id="{name}_{loop/_key}"
{if in_array (loop._key, obj.values)}checked="checked"{end if}
{filter none}{extra}{end filter}
/>
<label for="{name}_{loop/_key}">{loop/_value}</label><br />
{end loop}
</td>
</tr>
</table>
</td>
</tr>
'
<td colspan="2" class="label">
<label for="{name}" id="{name}-label"{filter none}{invalid}{end filter}>{display_value}</label>
</td>
</tr>{end if}
<tr>
<td colspan="2" class="field">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="25%" valign="top">
{loop obj.value1}
<input
type="checkbox"
{filter none}{attrstr}{end filter}
value="{loop/_key}"
id="{name}_{loop/_key}"
{if in_array (loop._key, obj.values)}checked="checked"{end if}
{filter none}{extra}{end filter}
/>
<label for="{name}_{loop/_key}">{loop/_value}</label><br />
{end loop}
</td>
<td width="25%" valign="top">
{loop obj.value2}
<input
type="checkbox"
{filter none}{attrstr}{end filter}
value="{loop/_key}"
id="{name}_{loop/_key}"
{if in_array (loop._key, obj.values)}checked="checked"{end if}
{filter none}{extra}{end filter}
/>
<label for="{name}_{loop/_key}">{loop/_value}</label><br />
{end loop}
</td>
<td width="25%" valign="top">
{loop obj.value3}
<input
type="checkbox"
{filter none}{attrstr}{end filter}
value="{loop/_key}"
id="{name}_{loop/_key}"
{if in_array (loop._key, obj.values)}checked="checked"{end if}
{filter none}{extra}{end filter}
/>
<label for="{name}_{loop/_key}">{loop/_value}</label><br />
{end loop}
</td>
<td width="25%" valign="top">
{loop obj.value4}
<input
type="checkbox"
{filter none}{attrstr}{end filter}
value="{loop/_key}"
id="{name}_{loop/_key}"
{if in_array (loop._key, obj.values)}checked="checked"{end if}
{filter none}{extra}{end filter}
/>
<label for="{name}_{loop/_key}">{loop/_value}</label><br />
{end loop}
</td>
</tr>
</table>
</td>
</tr>
'
$_horizontal_template = ' <tr>
<td colspan="3" class="field">
<table width="100%"><tr><td width="60%" valign="top">
<span{filter none}{invalid}>{display_value}{end filter}</span>
</td>
{loop obj.value}
<td valign="top" align="center"><input
type="checkbox"
{filter none}{attrstr}{end filter}
value="{loop/_key}"
id="{name}_{loop/_key}"
{if in_array (loop._key, obj.values)}checked="checked"{end if}
{filter none}{extra}{end filter}
/>
<label for="{name}_{loop/_key}">{loop/_value}</label></td>
{end loop}
</tr></table>
</td>
</tr>
'
<td colspan="3" class="field">
<table width="100%"><tr><td width="60%" valign="top">
<span{filter none}{invalid}>{display_value}{end filter}</span>
</td>
{loop obj.value}
<td valign="top" align="center"><input
type="checkbox"
{filter none}{attrstr}{end filter}
value="{loop/_key}"
id="{name}_{loop/_key}"
{if in_array (loop._key, obj.values)}checked="checked"{end if}
{filter none}{extra}{end filter}
/>
<label for="{name}_{loop/_key}">{loop/_value}</label></td>
{end loop}
</tr></table>
</td>
</tr>
'
$year
- Access: private
Unused and deprecated.
$month
- Access: private
Unused and deprecated.
$day
- Access: private
Unused and deprecated.
$lowest_year
- Access: public
The lowest year to be displayed in the year select box. Set to a
default value of 25 years ago by the constructor method.
$highest_year
- Access: public
The highest year to be displayed in the year select box. Set to a
default value of one year into the future by the constructor method.
$date
- Access: private
Unused and deprecated.
$time
- Access: private
Unused and deprecated.
$extensions = array ()
- Access: public
Contains a list of valid file extensions to display from the
directory.
$directory
- Access: public
Contains the directory to read the list of files from.
$data_value_DIRLIST
- Access: private
Contains the data value of this widget.
$show_viewbutton
- Access: public
Determines whether or not to display a 'view' link next to
the select box, which will pop up a view of the item from the list.
$web_path = ''
- Access: public
The web path to the directory in which to place the uploaded file.
$formname
- Access: public
Contains the name property of the current form. Required only if
$show_viewbutton is true.
$recursive
- Access: public
Whether or not the list should display recursively into sub-directories.
$path = ''
- Access: public
The directory in which to place the uploaded file.
$mode = false
- Access: public
Specifies a mode to chmod() the newly uploaded file to during
the move() method. The mode is also known as the permissions of the
file. Must be set as a 4-digit octal value with the first digit on
the left being a zero (0), for example 0755. See the PHP documentation
for the chmod() function for more information.
$user = false
- Access: public
Specifies a user to chown() the newly uploaded file to during
the move() method. This is not likely to work on most systems, but
it exists for the few strange (and highly suspect) configurations
where it will. See the PHP documentation for the chown() function
for more information.
$group = false
- Access: public
Specifies a group to chgrp() the newly uploaded file to during
the move() method. Can only be changed to any group that the PHP user
belongs to. See the PHP documentation for the chgrp() function for
more information.
$clear = false
- Access: public
This determines whether to provide a "Clear" button when a file exists
in an edit form, so that the current value can be reset without being
replaced.
$hideInSearches = true
- Access: public
This allows you to specify whether or not you want this widget to
show in search results (used primarily in the Sitellite CMS database manager)
so that it can be hidden in the form, but not everywhere. Defaults to
true, as in "yes, hide it everywhere".
$field = ''
- Access: public
The field to use to determine the key in the key/value $set property.
$setPath = true
- Access: public
Tells imagechooser whether or not to set the session variable
"imagechooser_path" upon display() of this widget.
$filter = false
- Access: public
A filter function to apply to the value before displaying it. Note that
htmlentities_compat() is still called afterwards.
$filter_import = false
- Access: public
A library to import which contains the filter function.
$htmlentities = true
- Access: public
Set this to false to skip calling htmlentities_compat() on the displayed
data.
$id = 0
- Access: public
This is the primary key for the current item.
$table
- Access: public
Contains the table to read from.
$key = false
- Access: public
This is the primary key of the list table.
$join_table = false
- Access: public
This is the join table.
$join_main_key = false
- Access: public
This is the field referring to the main table in the join table.
$join_foreign_key = false
- Access: public
This is the field referring to the foreign table in the join table.
$editable = true
- Access: public
Set this to false for more complex tables to disable the add/remove actions
for adding/removing items from the foreign table.
$addAction = 'cms/joiner/add'
- Access: public
Name of the box that adds the new item or items to the database
table underlying the selector.
$removeAction = 'cms/joiner/remove'
- Access: public
Name of the box that removes the specified item or items from the
database table underlying the selector.
$_style = '<style type="text/css">
a.joiner-selected {
font-weight: bold;
color: #000;
}
a.joiner-unselected {
/* no special style */
}
</style>'
a.joiner-selected {
font-weight: bold;
color: #000;
}
a.joiner-unselected {
/* no special style */
}
</style>'
$_script = '<script language="javascript">
{if not obj.loaded}
var rpc = new rpc ();
{end if}
var {name}joiner = {
url: \'{site/prefix}/index/cms-joiner-rpc-action\',
action: rpc.action,
name: \'{name}\',
join_table: \'{join_table}\',
join_main_key: \'{join_main_key}\',
join_foreign_key: \'{join_foreign_key}\',
add: function (main_id, foreign_id) {
this._fid = foreign_id;
rpc.call (
this.action (\'add\', [this.name, main_id, foreign_id, this.join_table, this.join_main_key, this.join_foreign_key]),
function (request) {
res = eval (request.responseText);
// highlight item
document.getElementById (\'{name}\' + {name}joiner._fid).className = \'joiner-selected\';
document.getElementById (\'{name}\' + {name}joiner._fid).setAttribute (\'onclick\', \'return {name}joiner.remove ({id}, \' + {name}joiner._fid + \')\');
document.getElementById (\'{name}\' + {name}joiner._fid).setAttribute (\'title\', \'Click to de-select\');
return false;
}
);
return false;
},
remove: function (main_id, foreign_id) {
this._fid = foreign_id;
rpc.call (
this.action (\'remove\', [this.name, main_id, foreign_id, this.join_table, this.join_main_key, this.join_foreign_key]),
function (request) {
res = eval (request.responseText);
// un-highlight item
document.getElementById (\'{name}\' + {name}joiner._fid).className = \'joiner-unselected\';
document.getElementById (\'{name}\' + {name}joiner._fid).setAttribute (\'onclick\', \'return {name}joiner.add ({id}, \' + {name}joiner._fid + \')\');
document.getElementById (\'{name}\' + {name}joiner._fid).setAttribute (\'title\', \'Click to select\');
return false;
}
);
return false;
}
}
</script>'
{if not obj.loaded}
var rpc = new rpc ();
{end if}
var {name}joiner = {
url: \'{site/prefix}/index/cms-joiner-rpc-action\',
action: rpc.action,
name: \'{name}\',
join_table: \'{join_table}\',
join_main_key: \'{join_main_key}\',
join_foreign_key: \'{join_foreign_key}\',
add: function (main_id, foreign_id) {
this._fid = foreign_id;
rpc.call (
this.action (\'add\', [this.name, main_id, foreign_id, this.join_table, this.join_main_key, this.join_foreign_key]),
function (request) {
res = eval (request.responseText);
// highlight item
document.getElementById (\'{name}\' + {name}joiner._fid).className = \'joiner-selected\';
document.getElementById (\'{name}\' + {name}joiner._fid).setAttribute (\'onclick\', \'return {name}joiner.remove ({id}, \' + {name}joiner._fid + \')\');
document.getElementById (\'{name}\' + {name}joiner._fid).setAttribute (\'title\', \'Click to de-select\');
return false;
}
);
return false;
},
remove: function (main_id, foreign_id) {
this._fid = foreign_id;
rpc.call (
this.action (\'remove\', [this.name, main_id, foreign_id, this.join_table, this.join_main_key, this.join_foreign_key]),
function (request) {
res = eval (request.responseText);
// un-highlight item
document.getElementById (\'{name}\' + {name}joiner._fid).className = \'joiner-unselected\';
document.getElementById (\'{name}\' + {name}joiner._fid).setAttribute (\'onclick\', \'return {name}joiner.add ({id}, \' + {name}joiner._fid + \')\');
document.getElementById (\'{name}\' + {name}joiner._fid).setAttribute (\'title\', \'Click to select\');
return false;
}
);
return false;
}
}
</script>'
$_output = '
<tr>
<td class="label" valign="top" colspan="2"><label for="{name}" id="{name}-label"{invalid}>{display_value}</label></td>
</tr>
<tr>
<td class="field" valign="top" colspan="2">{intl Click to select}:<br />
{loop obj._list}
{if loop.selected}
{if loop._key ne 0}| {end if}<a href="#" onclick="return {name}joiner.remove ({id}, {loop/id})" class="joiner-selected" title="Click to de-select" id="{name}{loop/id}">{loop/title}</a>
{end if}
{if not loop.selected}
{if loop._key ne 0}| {end if}<a href="#" onclick="return {name}joiner.add ({id}, {loop/id})" class="joiner-unselected" title="Click to select" id="{name}{loop/id}">{loop/title}</a>
{end if}
{end loop}
{if obj.addAction}<br /><br />
<a href="{site/prefix}/index/cms-joiner-manage-action?table={table}&key={key}&title={title}" target="_blank">{intl Add/Remove Items}</a>
</td>
</tr>
'
<tr>
<td class="label" valign="top" colspan="2"><label for="{name}" id="{name}-label"{invalid}>{display_value}</label></td>
</tr>
<tr>
<td class="field" valign="top" colspan="2">{intl Click to select}:<br />
{loop obj._list}
{if loop.selected}
{if loop._key ne 0}| {end if}<a href="#" onclick="return {name}joiner.remove ({id}, {loop/id})" class="joiner-selected" title="Click to de-select" id="{name}{loop/id}">{loop/title}</a>
{end if}
{if not loop.selected}
{if loop._key ne 0}| {end if}<a href="#" onclick="return {name}joiner.add ({id}, {loop/id})" class="joiner-unselected" title="Click to select" id="{name}{loop/id}">{loop/title}</a>
{end if}
{end loop}
{if obj.addAction}<br /><br />
<a href="{site/prefix}/index/cms-joiner-manage-action?table={table}&key={key}&title={title}" target="_blank">{intl Add/Remove Items}</a>
</td>
</tr>
'
$self_ref
- Access: public
Whether or not this widget is self-referencial.
$primary_key
- Access: public
The column in the other table that is the primary key.
$display_column
- Access: public
The column in the other table that should be shown in the select box.
$ref_column
- Access: public
The column in the current table that refers to the other table.
$addblank
- Access: public
Whether or not to add a blank line to the list. $addblank is
useful in the Sitellite CMS because saf.App.Versioning returns the
column value as NULL if $nullable is set to true, and getData() is
called automatically by display(), so there's no chance to add a
blank array element at the bottom of the list.
$popup
- Access: public
If true, this will prompt a popup to occur at $popup_limit number of options
in the Ref, so that they all aren't loaded at once into the select box. This is true
by default. It is good for references to large tables. This feature is Sitellite
Content Manager specific.
$popup_limit
- Access: public
This determines the limit at which a popup occurs instead of a select box,
if $popup is set to true.
$buttons = array ()
- Access: public
A list of "inner" submit buttons, which are MF_Widget_submit
objects.
$ignoreEmpty = true
- Access: public
Determines whether or not this password field should be ignored
if left blank. This is useful for situations where a password change
field may be present in a form but is not required to be filled out to
change it since the current value cannot or should not be sent
back to the browser. Defaults to true.
Methods
encrypt ($value = '', $salt = '')
- Access: public
- Return: string
Encrypts the value given with the optional salt. If the
value is also missing, uses the $data_value property. Returns the
encrypted string.
verify ($input, $encrypted)
- Access: public
- Return: boolean
Verifies input agains an encrypted value to see if it
matches.
makeStrong ()
- Access: public
Creates a series of rules for the current widget that state the
minimum length of a valid password (8), and that it must contain at least
one of each of the following: a lowercase letter, an uppercase letter,
a number, a symbol.
generate ($length = 8)
- Access: public
- Return: string
Creates a "secure" password of the specified $length using a random
combination of lowercase and uppercase letters, numbers, and symbols
(containing one of each for every four characters of the password, not
necessarily in any order). This aims to help site administrators enforce
more secure password policies, in conjunction with the makeStrong() method
for verifying that user-created passwords meet certain security criteria.
validate ($value, $form, $cgi)
- Access: public
- Return: boolean
Validates the widget against its set of $rules. Returns false
on failure to pass any rule.
display ($generate_html = 0)
- Access: public
- Return: string
Returns the display HTML for this widget. The optional
parameter determines whether or not to automatically display the widget
nicely, or whether to simply return the widget (for use in a template).
