fixing lots of dashboard things.
This commit is contained in:
parent
9722bad470
commit
f6058c1b34
9 changed files with 104 additions and 29 deletions
|
|
@ -1412,6 +1412,21 @@ sub www_add {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_ajaxInlineView ( )
|
||||
|
||||
Returns the view() method of the asset object if the requestor canView.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_ajaxInlineView {
|
||||
my $self = shift;
|
||||
return WebGUI::Privilege::noAccess() unless $self->canView;
|
||||
return $self->view;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_edit ( )
|
||||
|
|
|
|||
|
|
@ -61,7 +61,8 @@ sub definition {
|
|||
},
|
||||
mapFieldId =>{
|
||||
fieldType=>"text",
|
||||
defaultValue=>''
|
||||
defaultValue=>'',
|
||||
noFormPost=>1,
|
||||
}
|
||||
);
|
||||
push(@{$definition}, {
|
||||
|
|
@ -87,6 +88,7 @@ sub getEditForm {
|
|||
my $tabform = $self->SUPER::getEditForm;
|
||||
my $i18n = WebGUI::International->new("Asset_Dashboard");
|
||||
$tabform->getTab("display")->template(
|
||||
-name=>"templateId",
|
||||
-value=>$self->getValue('templateId'),
|
||||
-namespace=>"Dashboard",
|
||||
-label=>$i18n->get('dashboard template field label'),
|
||||
|
|
@ -177,6 +179,7 @@ sub view {
|
|||
}
|
||||
|
||||
my @found;
|
||||
my $newStuff;
|
||||
my $showPerformance = WebGUI::ErrorHandler::canShowPerformanceIndicators();
|
||||
foreach my $position (@positions) {
|
||||
my @assets = split(",",$position);
|
||||
|
|
@ -185,24 +188,24 @@ sub view {
|
|||
if ($asset eq $child->getId) {
|
||||
unless (isIn($asset,@hidden) || !($child->canView)) {
|
||||
WebGUI::Style::setRawHeadTags($child->getExtraHeadTags);
|
||||
my $t = [Time::HiRes::gettimeofday()] if ($showPerformance);
|
||||
my $view = $child->view;
|
||||
$view .= "Asset:".Time::HiRes::tv_interval($t) if ($showPerformance);
|
||||
$child->{_properties}{title} = $child->getShortcut->get("title") if (ref $child eq 'WebGUI::Asset::Shortcut');
|
||||
if ($i > $numPositions) {
|
||||
$child->{_properties}{title} = $child->getTitle;
|
||||
$child->{_properties}{title} = $child->getShortcut->getTitle if (ref $child eq 'WebGUI::Asset::Shortcut');
|
||||
if ($i == 1 || $i > $numPositions) {
|
||||
push(@{$vars{"position1_loop"}},{
|
||||
id=>$child->getId,
|
||||
content=>$view,
|
||||
dashletTitle=>$child->get("title"),
|
||||
content=>'', #so things in the New Content bar don't display.
|
||||
dashletTitle=>$child->{_properties}{title},
|
||||
shortcutUrl=>$child->getUrl,
|
||||
canPersonalize=>$self->canPersonalize,
|
||||
canEditUserPrefs=>(($session{user}{userId} ne '1') && (ref $child eq 'WebGUI::Asset::Shortcut') && (scalar($child->getUserPrefs) > 0))
|
||||
});
|
||||
$newStuff .= 'available_dashlets["'.$child->getId.'"]=\''.$child->getUrl.'\';';
|
||||
|
||||
} else {
|
||||
push(@{$vars{"position".$i."_loop"}},{
|
||||
id=>$child->getId,
|
||||
content=>$view,
|
||||
dashletTitle=>$child->get("title"),
|
||||
content=>$child->view,
|
||||
dashletTitle=>$child->{_properties}{title},
|
||||
shortcutUrl=>$child->getUrl,
|
||||
canPersonalize=>$self->canPersonalize,
|
||||
canEditUserPrefs=>(($session{user}{userId} ne '1') && (ref $child eq 'WebGUI::Asset::Shortcut') && (scalar($child->getUserPrefs) > 0))
|
||||
|
|
@ -219,14 +222,11 @@ sub view {
|
|||
foreach my $child (@{$children}) {
|
||||
unless (isIn($child->getId, @found)||isIn($child->getId,@hidden)) {
|
||||
if ($child->canView) {
|
||||
my $t = [Time::HiRes::gettimeofday()] if ($showPerformance);
|
||||
my $view = $child->view;
|
||||
$view .= "Asset:".Time::HiRes::tv_interval($t) if ($showPerformance);
|
||||
$child->{_properties}{title} = $child->getShortcut->get("title") if (ref $child eq 'WebGUI::Asset::Shortcut');
|
||||
push(@{$vars{"position1_loop"}},{
|
||||
id=>$child->getId,
|
||||
content=>$view,
|
||||
dashletTitle=>$child->get("title"),
|
||||
content=>'',
|
||||
dashletTitle=>$child->getTitle,
|
||||
shortcutUrl=>$child->getUrl,
|
||||
canPersonalize=>$self->canPersonalize,
|
||||
canEditUserPrefs=>(($session{user}{userId} ne '1') && (ref $child eq 'WebGUI::Asset::Shortcut') && (scalar($child->getUserPrefs) > 0))
|
||||
|
|
@ -238,6 +238,8 @@ sub view {
|
|||
$vars{"dragger.init"} = '
|
||||
<script type="text/javascript">
|
||||
dragable_init("'.$self->getUrl.'");
|
||||
var available_dashlets= new Array();
|
||||
'.$newStuff.'
|
||||
</script>
|
||||
';
|
||||
return $self->processTemplate(\%vars, $templateId);
|
||||
|
|
|
|||
|
|
@ -96,8 +96,9 @@ The number of seconds since January 1, 1970.
|
|||
=cut
|
||||
|
||||
sub epochToArray {
|
||||
my $timeZone = $session{user}{timeZone} || "America/Chicago";
|
||||
use DateTime;
|
||||
return split / /, DateTime->from_epoch( epoch =>shift, time_zone=>{$session{user}{timeZone} || "America/Chicago"})->strftime("%Y %m %d %H %M %S");
|
||||
return map {$_ += 0} split / /, DateTime->from_epoch( epoch =>shift, time_zone=>$timeZone)->strftime("%Y %m %d %H %M %S");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,10 @@ our $HELP = {
|
|||
},
|
||||
],
|
||||
related => [
|
||||
{
|
||||
tag => 'field add/edit',
|
||||
namespace => 'Asset_Shortcut'
|
||||
},
|
||||
{
|
||||
tag => 'wobjects using',
|
||||
namespace => 'Wobject'
|
||||
|
|
@ -68,6 +72,10 @@ our $HELP = {
|
|||
tag => 'wobjects using',
|
||||
namespace => 'Wobject'
|
||||
},
|
||||
{
|
||||
tag => 'shortcut add/edit',
|
||||
namespace => 'Asset_Shortcut'
|
||||
},
|
||||
{
|
||||
tag => 'template language',
|
||||
namespace => 'Asset_Template'
|
||||
|
|
|
|||
|
|
@ -296,8 +296,8 @@ sub www_editUser {
|
|||
if ($session{form}{$data->{fieldName}}) {
|
||||
$default = $session{form}{$data->{fieldName}};
|
||||
}
|
||||
elsif ($session{user}{$data->{fieldName}}) {
|
||||
$default = $session{user}{$data->{fieldName}};
|
||||
elsif ($u->profileField($data->{fieldName})) {
|
||||
$default = $u->profileField($data->{fieldName});
|
||||
}
|
||||
else {
|
||||
$default = WebGUI::Operation::Shared::secureEval($data->{dataDefault});
|
||||
|
|
|
|||
|
|
@ -360,13 +360,13 @@ The word "Shortcut".</p>
|
|||
lastUpdated => 1133619940,
|
||||
},
|
||||
|
||||
'Label for This Field' => {
|
||||
message => q|Label for This Field|,
|
||||
'field add/edit title' => {
|
||||
message => q|Add/Edit User Preference|,
|
||||
lastUpdated => 1133619940,
|
||||
},
|
||||
|
||||
'Label for This Field' => {
|
||||
message => q|Label for This Field|,
|
||||
'field add/edit body' => {
|
||||
message => q|<p>User Preferences are the key to personalization of a Shortcut, and the key to creating a personalized dashboard. You can create a user preference field of one of four types: text, textArea, checkList, and selectList. If yours is a list type, you can put the possible choices in the Possible Choices box, and each one will be its own entry in a list of that type (select: choose one, or check: choose none or any or all). </p><p>You can use a user preference field to generate a list of templates from which the user can pick, a choice of some kind of other preference, such as US or metric units format, or any other kind of user preference. User Preference fields are asset-(shortcut-)specific, whereas user profile fields are site-wide. The user preference fields will be exposed to your override fields in the format ##userPref:myUserPrefField##, and will be exposed everywhere else as normal template variables (<tmpl_var myUserPrefField>).</p>|,
|
||||
lastUpdated => 1133619940,
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue