Merge commit 'v7.10.15' into 8
Conflicts: docs/gotcha.txt docs/previousVersion.sql docs/templates.txt lib/WebGUI.pm lib/WebGUI/Asset.pm lib/WebGUI/Asset/Event.pm lib/WebGUI/Asset/File.pm lib/WebGUI/Asset/MapPoint.pm lib/WebGUI/Asset/RichEdit.pm lib/WebGUI/Asset/Sku/Product.pm lib/WebGUI/Asset/Snippet.pm lib/WebGUI/Asset/Story.pm lib/WebGUI/Asset/Template.pm lib/WebGUI/Asset/Template/TemplateToolkit.pm lib/WebGUI/Asset/Wobject/Calendar.pm lib/WebGUI/Asset/Wobject/Carousel.pm lib/WebGUI/Asset/Wobject/Collaboration.pm lib/WebGUI/Asset/Wobject/Dashboard.pm lib/WebGUI/Asset/Wobject/DataForm.pm lib/WebGUI/Asset/Wobject/Folder.pm lib/WebGUI/Asset/Wobject/Map.pm lib/WebGUI/Asset/Wobject/Search.pm lib/WebGUI/Asset/Wobject/Shelf.pm lib/WebGUI/Asset/Wobject/StockData.pm lib/WebGUI/Asset/Wobject/StoryTopic.pm lib/WebGUI/Asset/Wobject/SyndicatedContent.pm lib/WebGUI/Asset/Wobject/Thingy.pm lib/WebGUI/Asset/Wobject/WeatherData.pm lib/WebGUI/AssetClipboard.pm lib/WebGUI/AssetCollateral/DataForm/Entry.pm lib/WebGUI/AssetExportHtml.pm lib/WebGUI/AssetLineage.pm lib/WebGUI/AssetMetaData.pm lib/WebGUI/AssetTrash.pm lib/WebGUI/AssetVersioning.pm lib/WebGUI/Auth.pm lib/WebGUI/Cache/CHI.pm lib/WebGUI/Content/AssetManager.pm lib/WebGUI/Fork/ProgressBar.pm lib/WebGUI/Form/JsonTable.pm lib/WebGUI/Form/TimeField.pm lib/WebGUI/Form/Zipcode.pm lib/WebGUI/Group.pm lib/WebGUI/International.pm lib/WebGUI/Macro/AssetProxy.pm lib/WebGUI/Macro/FileUrl.pm lib/WebGUI/Operation/SSO.pm lib/WebGUI/Operation/User.pm lib/WebGUI/Role/Asset/Subscribable.pm lib/WebGUI/Shop/Cart.pm lib/WebGUI/Shop/Transaction.pm lib/WebGUI/Shop/TransactionItem.pm lib/WebGUI/Test.pm lib/WebGUI/URL/Content.pm lib/WebGUI/URL/Uploads.pm lib/WebGUI/User.pm lib/WebGUI/Workflow/Activity/ExtendCalendarRecurrences.pm lib/WebGUI/Workflow/Activity/SendNewsletters.pm lib/WebGUI/i18n/English/Asset.pm lib/WebGUI/i18n/English/WebGUI.pm sbin/installClass.pl sbin/rebuildLineage.pl sbin/search.pl sbin/testEnvironment.pl t/Asset/Asset.t t/Asset/AssetClipboard.t t/Asset/AssetLineage.t t/Asset/AssetMetaData.t t/Asset/Event.t t/Asset/File.t t/Asset/File/Image.t t/Asset/Post/notification.t t/Asset/Sku.t t/Asset/Story.t t/Asset/Template.t t/Asset/Wobject/Collaboration/templateVariables.t t/Asset/Wobject/Collaboration/unarchiveAll.t t/Asset/Wobject/Shelf.t t/Auth.t t/Macro/EditableToggle.t t/Macro/FilePump.t t/Shop/Cart.t t/Shop/Transaction.t t/Storage.t t/User.t t/Workflow.t
This commit is contained in:
commit
277faae8a1
783 changed files with 32041 additions and 25495 deletions
|
|
@ -100,4 +100,37 @@ sub getName {
|
|||
return WebGUI::International->new($session, 'WebGUI')->get('codearea');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 headTags
|
||||
|
||||
Includes script files for the code area
|
||||
|
||||
=cut
|
||||
|
||||
sub headTags {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
$self->SUPER::headTags(@_);
|
||||
$session->style->setScript(
|
||||
$session->url->extras('yui-webgui/build/codeArea/codeArea-min.js')
|
||||
);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 toHtml
|
||||
|
||||
Add some javascript to fix hitting the tab key.
|
||||
|
||||
=cut
|
||||
|
||||
sub toHtml {
|
||||
my $self = shift;
|
||||
$self->headTags;
|
||||
my $id = $self->get('id');
|
||||
return $self->SUPER::toHtml(@_)
|
||||
. qq{<script>new YAHOO.WebGUI.CodeArea('$id').render()</script>};
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -245,7 +245,10 @@ sub toHtml {
|
|||
my $originalValue = $self->getOriginalValue;
|
||||
my $dt = eval { WebGUI::DateTime->new($session, $originalValue); };
|
||||
$dt = WebGUI::DateTime->new($session,0) if ! (blessed $dt && $dt->isa('DateTime')); ##Parsing error
|
||||
$dt->set_time_zone($session->datetime->getTimeZone);
|
||||
if ($originalValue =~ $isaEpoch) {
|
||||
##Epoch date, correct for time zone;
|
||||
$dt->set_time_zone($session->datetime->getTimeZone);
|
||||
}
|
||||
$value = $dt->toMysqlDate;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -141,6 +141,37 @@ sub getValueAsHtml {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 headTags ( )
|
||||
|
||||
Set the head tags for this form plugin
|
||||
|
||||
=cut
|
||||
|
||||
sub headTags {
|
||||
my $self = shift;
|
||||
my $style = $self->session->style;
|
||||
my $url = $self->session->url;
|
||||
$style->setScript($url->extras('yui/build/yahoo/yahoo-min.js'), { type=>'text/javascript' });
|
||||
$style->setScript($url->extras('yui/build/dom/dom-min.js'), { type=>'text/javascript' });
|
||||
$style->setScript($url->extras('yui/build/event/event-min.js'), { type=>'text/javascript' });
|
||||
$style->setScript($url->extras("yui/build/datasource/datasource-min.js"), {type=>"text/javascript"});
|
||||
$style->setScript($url->extras('yui/build/connection/connection-min.js'), { type=>'text/javascript' });
|
||||
$style->setScript($url->extras('yui/build/element/element-min.js'), { type=>'text/javascript' });
|
||||
$style->setScript($url->extras('yui/build/button/button-min.js'), { type=>'text/javascript' });
|
||||
$style->setScript($url->extras('yui/build/container/container-min.js'), { type=>'text/javascript' });
|
||||
$style->setScript($url->extras("yui/build/autocomplete/autocomplete-min.js"), {type=>"text/javascript"});
|
||||
$style->setScript($url->extras('yui-webgui/build/form/form.js'), { type=>'text/javascript' });
|
||||
$style->setScript($url->extras('yui/build/json/json-min.js'), {type => 'text/javascript'});
|
||||
$style->setScript($url->extras('yui-webgui/build/i18n/i18n.js'), {type => 'text/javascript'} );
|
||||
$style->setScript($url->extras('yui-webgui/build/form/groupManager.js'), { type=>'text/javascript' });
|
||||
$style->setLink($url->extras('yui/build/autocomplete/assets/skins/sam/autocomplete.css'), { rel => 'stylesheet', type => 'text/css' });
|
||||
$style->setLink($url->extras('yui/build/container/assets/skins/sam/container.css'), { rel => 'stylesheet', type => 'text/css' });
|
||||
$style->setLink($url->extras('yui/build/button/assets/skins/sam/button.css'), { rel => 'stylesheet', type => 'text/css' });
|
||||
$style->setLink($url->extras('yui-webgui/build/form/groupManager.css'), { rel => 'stylesheet', type => 'text/css' });
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 isDynamicCompatible ( )
|
||||
|
|
@ -180,9 +211,9 @@ Creates a series of hidden fields representing the data in the list.
|
|||
=cut
|
||||
|
||||
sub toHtmlAsHidden {
|
||||
my $self = shift;
|
||||
$self->set("options", $self->session->db->buildHashRef("select groupId,groupName from groups"));
|
||||
return $self->SUPER::toHtmlAsHidden();
|
||||
my $self = shift;
|
||||
$self->set("options", $self->session->db->buildHashRef("select groupId,groupName from groups"));
|
||||
return $self->SUPER::toHtmlAsHidden();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -194,14 +225,187 @@ Renders the form field to HTML as a table row complete with labels, subtext, hov
|
|||
=cut
|
||||
|
||||
sub toHtmlWithWrapper {
|
||||
my $self = shift;
|
||||
if ($self->session->user->isAdmin) {
|
||||
my $subtext = $self->session->icon->manage("op=listGroups");
|
||||
$self->set("subtext",$subtext . $self->get("subtext"));
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $user = $session->user;
|
||||
if ($user->isAdmin) {
|
||||
my $subtext = $session->icon->manage("op=listGroups");
|
||||
$self->set("subtext", $subtext . $self->get("subtext"));
|
||||
}
|
||||
my $dialog = $self->get('name') . '_groupDialog';
|
||||
my $group_manager = $user->isInGroup($session->setting->get('groupIdAdminGroup'));
|
||||
my $form;
|
||||
if ($group_manager) {
|
||||
my $i18n = WebGUI::International->new($self->session,'Icon');
|
||||
my $name = $self->get('name');
|
||||
my $groupId = $self->getOriginalValue;
|
||||
my $extra_subtext = qq!<span class="toolbarIcon" style="vertical-align:middle;"><a href="#" onClick="WebGUI.Form.GroupManager.show_dialog('$name'); return false;"><img src="!. $session->icon->getBaseURL().qq!edit.gif" alt="!. $i18n->get('Edit') .qq!"style="vertical-align:middle;border: 0px;" /></a></span>!;
|
||||
$extra_subtext .= qq!<span class="toolbarIcon" style="vertical-align:middle;"><a href="#" onClick="WebGUI.Form.GroupManager.show_dialog('$name', 'new'); return false;"><img src="!. $session->icon->getBaseURL().qq!add.gif" alt="!. $i18n->get('Add') .qq!" style="vertical-align:middle;border: 0px;" /></a></span>!;
|
||||
$self->set("subtext", $self->get('subtext').$extra_subtext);
|
||||
}
|
||||
$self->headTags;
|
||||
$form .= $self->SUPER::toHtmlWithWrapper;
|
||||
return $form;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_groupMembers ($session)
|
||||
|
||||
Returns a list of users that are in the sub-group specified by the form variable
|
||||
variable C<groupId>. Data returned is in JSON format.
|
||||
|
||||
This is a class method.
|
||||
|
||||
=head3 $session
|
||||
|
||||
A WebGUI::Session object.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_groupMembers {
|
||||
my $session = shift;
|
||||
return '{}' unless $session->user->isInGroup($session->setting->get('groupIdAdminGroup'));
|
||||
my $groupId = $session->form->param('groupId');
|
||||
return '{}' unless $groupId;
|
||||
|
||||
my $group = WebGUI::Group->new($session, $groupId);
|
||||
return '{}' unless $group;
|
||||
|
||||
my $results = {
|
||||
groupName => $group->name,
|
||||
users => [],
|
||||
groups => [],
|
||||
};
|
||||
my $userIds = $group->getUsers('withoutExpired');
|
||||
USER: foreach my $userId (@{ $userIds }) {
|
||||
my $user = WebGUI::User->new($session, $userId);
|
||||
next USER unless $user;
|
||||
push @{$results->{users}},
|
||||
{
|
||||
username => $user->username,
|
||||
userId => $userId,
|
||||
};
|
||||
}
|
||||
my $groupIds = $group->getGroupsIn(0); ##Without recursion
|
||||
GROUP: foreach my $groupId (@{ $groupIds }) {
|
||||
my $group = WebGUI::Group->new($session, $groupId);
|
||||
next GROUP unless $group;
|
||||
push @{$results->{groups}},
|
||||
{
|
||||
groupName => $group->name,
|
||||
groupId => $groupId,
|
||||
};
|
||||
}
|
||||
|
||||
return JSON::to_json($results);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_saveGroup ($session)
|
||||
|
||||
Save new information about the membership of a group, which users have
|
||||
been added and deleted, and which groups have been added and deleted.
|
||||
|
||||
This is a subroutine, not a class method, not an object method.
|
||||
|
||||
=head3 $session
|
||||
|
||||
A WebGUI::Session object.
|
||||
|
||||
=head3 Expected form variables
|
||||
|
||||
=head4 groupId
|
||||
|
||||
The GUID for the group to modify.
|
||||
|
||||
=head4 groupName
|
||||
|
||||
The name of the group. This is always set, so it should always be included.
|
||||
|
||||
=head4 usersAdded
|
||||
|
||||
A list of userId's for users who were added.
|
||||
|
||||
=head4 usersDeleted
|
||||
|
||||
A list of userId's for users who were deleted. Deleting happens after adding.
|
||||
|
||||
=head4 groupsAdded
|
||||
|
||||
A list of groupId's for groups who were added.
|
||||
|
||||
=head4 groupsDeleted
|
||||
|
||||
A list of groupId's for groups who were deleted. Deleting happens after adding.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_saveGroup {
|
||||
my $session = shift;
|
||||
$session->log->warn("hit the group plugin");
|
||||
return '{}' unless $session->user->isInGroup($session->setting->get('groupIdAdminGroup'));
|
||||
my $form = $session->form;
|
||||
my $groupId = $form->get('groupId');
|
||||
my $group = WebGUI::Group->new($session, $groupId);
|
||||
$session->log->warn("got groupId: $groupId");
|
||||
return '{}' unless $group;
|
||||
|
||||
$session->log->warn("updating group data, name = ".$form->get('groupName'));
|
||||
$group->name($form->get('groupName'));
|
||||
my @usersAdded = $form->get('usersAdded');
|
||||
use Data::Dumper;
|
||||
$session->log->warn("users added ".Dumper(\@usersAdded));
|
||||
$group->addUsers(\@usersAdded);
|
||||
my @usersDeleted = $form->get('usersDeleted');
|
||||
$group->deleteUsers(\@usersDeleted);
|
||||
my @groupsAdded = $form->get('groupsAdded');
|
||||
$session->log->warn("groups added ".Dumper(\@groupsAdded));
|
||||
$group->addGroups(\@groupsAdded);
|
||||
my @groupsDeleted = $form->get('groupsDeleted');
|
||||
$group->deleteGroups(\@groupsDeleted);
|
||||
|
||||
return JSON::to_json({ groupId => $group->getId, groupName => $group->name, originalGroupId => $groupId });
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_searchGroups ($session)
|
||||
|
||||
Returns groups that match the supplied group name. Group name is specified via the form
|
||||
variable C<search>. A list of groups will be returned of up to 15 names and groupIds.
|
||||
|
||||
This is a subroutine, not a class method, not an object method.
|
||||
|
||||
=head3 $session
|
||||
|
||||
A WebGUI::Session object.
|
||||
|
||||
=head3 Sample JSON
|
||||
|
||||
{
|
||||
'results' : [
|
||||
{
|
||||
'groupId': 'someGroupId',
|
||||
'groupName' : 'Great Group'
|
||||
}
|
||||
return $self->SUPER::toHtmlWithWrapper;
|
||||
//Other hashes may be in the list, or it could be completely empty
|
||||
]
|
||||
}
|
||||
|
||||
=cut
|
||||
|
||||
sub www_searchGroups {
|
||||
my $session = shift;
|
||||
return '{"results":[]}' unless $session->user->isInGroup($session->setting->get('groupIdAdminGroup'));
|
||||
my $search = $session->form->param('query');
|
||||
|
||||
my $results = $session->db->buildArrayRefOfHashRefs(q|select groupId, groupName from groups where groupName like CONCAT(?, '%') and showInForms=1 LIMIT 15|, [ $search ]);
|
||||
|
||||
return JSON::to_json({ results => $results });
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
|
|
@ -139,6 +139,8 @@ sub headTags {
|
|||
my ( $url, $style ) = $self->session->quick(qw( url style ));
|
||||
$style->setScript( $url->extras('yui/build/yahoo-dom-event/yahoo-dom-event.js'));
|
||||
$style->setScript( $url->extras('yui/build/json/json-min.js'));
|
||||
$style->setScript( $url->extras('yui/build/connect/connect-min.js') );
|
||||
$style->setScript( $url->extras('yui-webgui/build/i18n/i18n.js') );
|
||||
$style->setScript( $url->extras('yui-webgui/build/form/jsontable.js'));
|
||||
}
|
||||
|
||||
|
|
@ -153,6 +155,7 @@ Renders an input tag of type text.
|
|||
sub toHtml {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $i18n = WebGUI::International->new($session, 'WebGUI');
|
||||
my ( $url, $style ) = $session->quick(qw( url style ));
|
||||
my $value = $self->fixMacros($self->fixQuotes($self->fixSpecialCharacters($self->getOriginalValue)));
|
||||
my $output = '';
|
||||
|
|
@ -167,7 +170,7 @@ sub toHtml {
|
|||
# Buttons to add rows in the table footer
|
||||
my $cols = scalar @{ $self->get('fields') } + 1; # Extra column for buttons
|
||||
$output .= '</thead><tfoot><tr><td colspan="' . $cols . '">'
|
||||
. '<button id="' . $self->get('id') . '_add">' . "Add" . '</button>'
|
||||
. '<button id="' . $self->get('id') . '_add">' . $i18n->get('Add') . '</button>'
|
||||
. '</td></tr></tfoot>'
|
||||
;
|
||||
|
||||
|
|
@ -194,7 +197,10 @@ sub toHtml {
|
|||
elsif ( $field->{type} eq "id" ) {
|
||||
$fieldHtml .= '<input type="hidden" class="jsontable_id" name="' . $fieldName . '" value="new" />';
|
||||
}
|
||||
else { # Readonly or unknown
|
||||
elsif ( $field->{type} eq "hidden" || $field->{type} eq "readonly" ) {
|
||||
$fieldHtml .= '<input type="hidden" name="' . $fieldName . '" value="new" />';
|
||||
}
|
||||
else { # Unknown
|
||||
$fieldHtml = ' ';
|
||||
}
|
||||
|
||||
|
|
|
|||
122
lib/WebGUI/Form/TemplateParser.pm
Normal file
122
lib/WebGUI/Form/TemplateParser.pm
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
package WebGUI::Form::TemplateParser;
|
||||
|
||||
=head1 LEGAL
|
||||
|
||||
-------------------------------------------------------------------
|
||||
WebGUI is Copyright 2001-2009 Plain Black Corporation.
|
||||
-------------------------------------------------------------------
|
||||
Please read the legal notices (docs/legal.txt) and the license
|
||||
(docs/license.txt) that came with this distribution before using
|
||||
this software.
|
||||
-------------------------------------------------------------------
|
||||
http://www.plainblack.com info@plainblack.com
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use base 'WebGUI::Form::SelectBox';
|
||||
use WebGUI::International;
|
||||
use Tie::IxHash;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Form::TemplateParser
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
A dropdown list for selecting a template parser.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
This is a subclass of WebGUI::Form::SelectBox.
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
The following methods are specifically available from this class. Check the superclass for additional methods.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 areOptionsSettable
|
||||
|
||||
No, they aren't.
|
||||
|
||||
=cut
|
||||
|
||||
sub areOptionsSettable { 0 }
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 definition ( [ additionalTerms ] )
|
||||
|
||||
See the super class for additional details.
|
||||
|
||||
=head3 additionalTerms
|
||||
|
||||
The following additional parameters have been added via this sub class.
|
||||
|
||||
=head3 allowNone
|
||||
|
||||
Set to true if "None" is an acceptable option for this dropdown. Defaults to
|
||||
false.
|
||||
|
||||
=head4 defaultValue
|
||||
|
||||
Defaults to the default parser selected in the config file
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
my ($class, $session, $definition) = @_;
|
||||
push @{$definition ||= []}, {
|
||||
allowNone => {
|
||||
defaultValue => 0,
|
||||
},
|
||||
defaultValue => {
|
||||
defaultValue => $session->config->get('defaultTemplateParser')
|
||||
}
|
||||
};
|
||||
return $class->SUPER::definition($session, $definition);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getName ( session )
|
||||
|
||||
Returns the human readable name of this control.
|
||||
|
||||
=cut
|
||||
|
||||
sub getName {
|
||||
my ($self, $session) = @_;
|
||||
return WebGUI::International->new($session, 'WebGUI')->get('Template Parser');
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getOptions
|
||||
|
||||
Called by the superclass to determine which options are presented.
|
||||
|
||||
=cut
|
||||
|
||||
sub getOptions {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
tie my %o, 'Tie::IxHash';
|
||||
if ($self->get('allowNone')) {
|
||||
$o{''} = WebGUI::International->new($session, 'WebGUI')->get('881');
|
||||
}
|
||||
return \%o unless my $parsers = $session->config->get('templateParsers');
|
||||
|
||||
for my $class (@$parsers) {
|
||||
my $parser = WebGUI::Asset::Template->getParser($session, $class);
|
||||
$o{$class} = $parser->getName;
|
||||
}
|
||||
|
||||
return \%o;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
@ -157,6 +157,32 @@ sub getValue {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getValueAsHtml ( )
|
||||
|
||||
Return the Form's value as a formatted time.
|
||||
|
||||
=cut
|
||||
|
||||
sub getValueAsHtml {
|
||||
my $self = shift;
|
||||
my $value = $self->getOriginalValue();
|
||||
my $mysqlTime = ($value =~ $mysqlFormattedDate);
|
||||
my $digits = ($value =~ /^\d+$/);
|
||||
##Format is fine
|
||||
if ( $mysqlTime ) {
|
||||
return $value;
|
||||
}
|
||||
##Convert to mysql format
|
||||
elsif ($digits) {
|
||||
return $self->session->datetime->secondsToTime($value);
|
||||
}
|
||||
else { ##Bad stuff, maynard
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 headTags ( )
|
||||
|
||||
Set the head tags for this form plugin
|
||||
|
|
@ -164,8 +190,15 @@ Set the head tags for this form plugin
|
|||
=cut
|
||||
|
||||
sub headTags {
|
||||
my $self = shift;
|
||||
$self->session->style->setScript($self->session->url->extras('inputCheck.js'));
|
||||
my $self = shift;
|
||||
my $style = $self->session->style;
|
||||
my $url = $self->session->url;
|
||||
$style->setScript($url->extras('inputCheck.js'), { type => 'text/javascript' });
|
||||
$style->setScript($url->extras('yui/build/connection/connection-min.js'), { type => 'text/javascript'});
|
||||
$style->setScript($url->extras('yui/build/event/event-min.js'), { type => 'text/javascript' });
|
||||
$style->setScript($url->extras('yui/build/json/json-min.js'), { type => 'text/javascript' });
|
||||
$style->setScript($url->extras('yui-webgui/build/i18n/i18n.js' ), { type => 'text/javascript' });
|
||||
$style->setScript($url->extras('form/timefield.js'), { type => 'text/javascript' });
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -190,15 +223,11 @@ Renders a time field.
|
|||
|
||||
sub toHtml {
|
||||
my $self = shift;
|
||||
my $value = $self->getOriginalValue;
|
||||
my $i18n = WebGUI::International->new($self->session);
|
||||
$self->set("extras", $self->get('extras') . ' onkeyup="doInputCheck(document.getElementById(\''.$self->get("id").'\'),\'0123456789:\')"');
|
||||
return $self->SUPER::toHtml
|
||||
.WebGUI::Form::Button->new($self->session,
|
||||
id=>$self->get('id'),
|
||||
extras=>'style="font-size: 8pt;" onclick="window.timeField = this.form.'.$self->get("name").';clockSet = window.open(\''.$self->session->url->extras('timeChooser.html').'\',\'timeChooser\',\'WIDTH=230,HEIGHT=100\');return false"',
|
||||
value=>$i18n->get(970)
|
||||
)->toHtml;
|
||||
##JS expects formatted time
|
||||
$self->set('value', $self->getValueAsHtml);
|
||||
#my $i18n = WebGUI::International->new($self->session);
|
||||
$self->set("extras", $self->get('extras') . ' onblur="WebGUI.TimeField.munge(document.getElementById(\''.$self->get("id").'\'))" onkeyup="WebGUI.TimeField.check(document.getElementById(\''.$self->get("id").'\'));"');
|
||||
return $self->SUPER::toHtml;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -170,5 +170,25 @@ sub toHtml {
|
|||
)->toHtml).$manage;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_searchUsers
|
||||
|
||||
Returns users that match the supplied username. Username is specified via the form
|
||||
variable C<search>. A list of usernames will be returned of up to 15 names and userIds.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_searchUsers {
|
||||
my $session = shift;
|
||||
return '{"results":[]}' unless $session->user->isInGroup($session->setting->get('groupIdAdminUser'));
|
||||
my $search = $session->form->param('query');
|
||||
|
||||
my $results = $session->db->buildArrayRefOfHashRefs(q|select userId, username from users where username like CONCAT(?, '%') LIMIT 15|, [ $search ]);
|
||||
|
||||
return JSON::to_json({ results => $results });
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
|
|
@ -92,9 +92,8 @@ An optional value to use instead of POST input.
|
|||
|
||||
sub getValue {
|
||||
my $self = shift;
|
||||
my $value = $self->SUPER::getValue(@_);
|
||||
my $value = uc $self->SUPER::getValue(@_);
|
||||
$value =~ tr/\r\n//d;
|
||||
$value =~ tr/a-z/A-Z/;
|
||||
if ($value =~ /^[A-Z\d\s\-]+$/) {
|
||||
return $value;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue