Merge branch 'master' into WebGUI8
This commit is contained in:
commit
2400f19099
797 changed files with 33894 additions and 27196 deletions
|
|
@ -28,9 +28,9 @@ Macro for displaying the output of an Asset in another location.
|
|||
|
||||
=head3 url | assetId
|
||||
|
||||
My specify either the asset url or the asset id. If no Asset with that URL or id can be found, an internationalized error message will be returned instead.
|
||||
Specify either the asset url or the asset id. If no Asset with that URL or id can be found, an internationalized error message will be returned instead.
|
||||
|
||||
No editing controls (toolbar) will be displayed in the Asset output, even if Admin is turned on.
|
||||
Editing controls (toolbar) may or may not be displayed in the Asset output, even if Admin is turned on.
|
||||
|
||||
The Not Found Page may not be Asset Proxied.
|
||||
|
||||
|
|
|
|||
|
|
@ -60,46 +60,37 @@ time - time component formatted as HH:MM:SS
|
|||
sub process {
|
||||
my ( $session, $toTZ, $format, $date, $time ) = @_;
|
||||
|
||||
my $uTZ = 'UTC';
|
||||
my $uFormat = '%F %T';
|
||||
my $uTZ = $session->user->profileField("timeZone");
|
||||
my $uFormat = $session->user->profileField("dateFormat");
|
||||
|
||||
# Change defaults only if we have a user defined and they have these set.
|
||||
eval { $session->user };
|
||||
unless ($@) {
|
||||
$uTZ = $session->user->profileField("timeZone");
|
||||
$uFormat = $session->user->profileField("dateFormat");
|
||||
}
|
||||
|
||||
$toTZ ||= $uTZ;
|
||||
$format ||= $uFormat;
|
||||
|
||||
# remove all whitespace including newlines
|
||||
$date =~ s/\s//msg;
|
||||
|
||||
# Additional date delimiters accepted for edge cases
|
||||
my ( $year, $month, $day ) = split /[\/\-\.]/, $date;
|
||||
my ( $year, $month, $day );
|
||||
if ($date) {
|
||||
( $year, $month, $day ) = split /[\/\-\.]/, $date;
|
||||
$date =~ s/\s//msg; # remove all whitespace including newlines
|
||||
}
|
||||
|
||||
my $dt = WebGUI::DateTime->now;
|
||||
|
||||
unless ( length($year) ) {
|
||||
unless ( $year ) {
|
||||
$year = $dt->year;
|
||||
}
|
||||
|
||||
unless ( length($month) ) {
|
||||
unless ( $month ) {
|
||||
$month = $dt->month;
|
||||
}
|
||||
|
||||
unless ( length($day) ) {
|
||||
unless ( $day ) {
|
||||
$day = $dt->day;
|
||||
}
|
||||
|
||||
my $formatter = DateTime::Format::Strptime->new( pattern => $format );
|
||||
|
||||
# Macro calls also seem to include any spaces between commas
|
||||
$time =~ s/^\s+//msg;
|
||||
|
||||
my ( $hour, $minute, $second );
|
||||
if ( length($time) ) {
|
||||
if ( $time ) {
|
||||
$time =~ s/^\s+//msg; # remove all whitespace including newlines
|
||||
( $hour, $minute, $second ) = split /\:/, $time;
|
||||
}
|
||||
my $dtOut = DateTime->new(
|
||||
|
|
@ -114,7 +105,7 @@ sub process {
|
|||
|
||||
# If no time component, we use the date as provided with no conversion
|
||||
# Without a time to convert between, there is no point to altering the date
|
||||
if ( length($time) ) {
|
||||
if ( $time ) {
|
||||
$dtOut->set_time_zone($toTZ);
|
||||
}
|
||||
$dtOut->set_formatter($formatter);
|
||||
|
|
|
|||
|
|
@ -37,12 +37,13 @@ time is used instead.
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my $session = shift;
|
||||
my (@param, $temp, $time);
|
||||
@param = @_;
|
||||
$time = $param[1] ||$session->datetime->time();
|
||||
$temp =$session->datetime->epochToHuman($time,$param[0]);
|
||||
return $temp;
|
||||
my $session = shift;
|
||||
my $time = $_[1];
|
||||
if (! defined $time) {
|
||||
$time = time();
|
||||
}
|
||||
my $temp = $session->datetime->epochToHuman($time, $_[0]);
|
||||
return $temp;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ The text displayed to the user for this link. If this is blank an international
|
|||
|
||||
=head3 linkonly
|
||||
|
||||
The url for a template from the Macro/DeactivateAccount namespace to use for formatting the link.
|
||||
If true, it will return only the URL for deactivating a user account.
|
||||
|
||||
=cut
|
||||
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ sub process {
|
|||
elsif ($scheme eq 'http' or $scheme eq 'https') {
|
||||
$url = $uri->as_string;
|
||||
}
|
||||
$url =~ tr{/}{/}s;
|
||||
$url =~ s$(?<!:)/{2,}$/$g; ##Remove //, unless it's after a :, which is not a valid URL character
|
||||
$output .= $type eq 'js' ? scriptTag($session, $url, $extras) : linkTag($session, $url, $extras);
|
||||
}
|
||||
return $output;
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ package WebGUI::Macro::NewMail;
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Inbox;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
@ -48,15 +49,13 @@ optional css class to assign to the hyperlink
|
|||
|
||||
sub process {
|
||||
my $session = shift;
|
||||
my @param = @_;
|
||||
my $class = $param[0];
|
||||
my $class = $_[0];
|
||||
|
||||
my $db = $session->db;
|
||||
my $i18n = WebGUI::International->new($session);
|
||||
my $count = WebGUI::Inbox->new($session)->getUnreadMessageCount;
|
||||
my $output = "";
|
||||
|
||||
if($count > 0) {
|
||||
my $i18n = WebGUI::International->new($session);
|
||||
$output = sprintf($i18n->get("private message unread display message"),$count);
|
||||
$output = _createURL($session,$output,$class);
|
||||
}
|
||||
|
|
@ -64,6 +63,4 @@ sub process {
|
|||
return $output;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
72
lib/WebGUI/Macro/PickLanguage.pm
Normal file
72
lib/WebGUI/Macro/PickLanguage.pm
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
package WebGUI::Macro::PickLanguage; # edit this line to match your own macro name
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# 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
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use WebGUI::Asset::Template;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Macro::PickLanguage
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This macro makes a link for each installed language so when clicked the SetLanguage contetntHandler is called and sets the language in the scratch. The link text is the label from the language.
|
||||
|
||||
=head2 process( $session )
|
||||
|
||||
The main macro class, Macro.pm, will call this subroutine and pass it
|
||||
|
||||
=over 4
|
||||
|
||||
=item *
|
||||
|
||||
A session variable
|
||||
|
||||
=item templateId
|
||||
|
||||
This macro takes a templateId to show the links
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my $session = shift;
|
||||
my $templateId = shift || "_aE16Rr1-bXBf8SIaLZjCg";
|
||||
my $template = WebGUI::Asset::Template->new($session, $templateId);
|
||||
return "Could not instanciate template with id [$templateId]" unless $template;
|
||||
my $i18n = WebGUI::International->new($session);
|
||||
my $languages = $i18n->getLanguages();
|
||||
my @lang_loop = ();
|
||||
foreach my $language ( keys %$languages ) {
|
||||
push @lang_loop, {
|
||||
language_url => '?op=setLanguage;language=' . $language,
|
||||
language_lang => $i18n->getLanguage($language , 'label'),
|
||||
language_langAbbr => $i18n->getLanguage($language, 'languageAbbreviation'),
|
||||
language_langAbbrLoc => $i18n->getLanguage($language, 'locale'),
|
||||
language_langEng => $language,
|
||||
};
|
||||
}
|
||||
my %vars = (
|
||||
lang_loop => \@lang_loop,
|
||||
delete_url => '?op=setLanguage;language=delete;',
|
||||
delete_label => $i18n->get('delete',"Macro_PickLanguage"),
|
||||
);
|
||||
|
||||
return $template->process(\%vars);
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
#vim:ft=perl
|
||||
|
|
@ -35,8 +35,8 @@ sub process {
|
|||
my $i18n = WebGUI::International->new($session, "Macro_SpectreCheck");
|
||||
if (defined $status) {
|
||||
return $i18n->get('success') if($status eq 'success');
|
||||
return $i18n->get('subnet') if($status eq 'subnet');
|
||||
return $i18n->get('spectre') if($status eq 'spectre');
|
||||
return $i18n->get('subnet') if($status eq 'subnet');
|
||||
return $i18n->get('spectre');
|
||||
}
|
||||
else {
|
||||
return $i18n->get('spectre');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue