fixing lots of dashboard things.

This commit is contained in:
Matthew Wilson 2005-12-05 00:38:55 +00:00
parent 9722bad470
commit f6058c1b34
9 changed files with 104 additions and 29 deletions

View file

@ -162,6 +162,7 @@ sub page {
WebGUI::ErrorHandler::warn("The notFound page failed to be created!");
$output = "An error was encountered while processing your request.";
}
$output = "An error was encountered while processing your request." unless $output ne '';
}
return $output;
}

View file

@ -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 ( )

View file

@ -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);

View file

@ -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");
}

View file

@ -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'

View file

@ -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});

View file

@ -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,
},

View file

@ -143,9 +143,10 @@ div.dragTitle
span.headerTitle
{
overflow-x:visible;
height:22px;
display:block;
float:left;
line-height:18px;
z-index:999;
margin-right:10px;
padding-left:9px;
@ -180,12 +181,32 @@ div#availableDashlets * span.options:hover {
div#availableDashlets * span.options {
display:none;
opacity:0;
top:50px;
top:500px;
filter:alpha(opacity=0);
}
div#availableDashlets * div.dragTrigger {
background: none;
float:none;
height:auto;;
height:auto;
}
div#availableDashlets * div.dragTitle {
background:none;
height:100%;
height:auto;
float:none;
background-color: #eeeeee;
border: solid #bbbbbb 1px;
color: black;
}
div#availableDashlets * span.headerTitle {
display:block;
width:100%;
line-height:auto;
height:auto;
background: none;
}
#hideNewContentButton,#showNewContentButton {
/* position:absolute;*/
color: #465D94;

View file

@ -216,11 +216,9 @@ function dragable_dragStart(e){
//set the start td
startTD=document.getElementById(fObj.id.substr(0,fObj.id.indexOf("_div")));
// alert("hdr" + fObj.id.substr(0,fObj.id.indexOf("_div")) + "_span");
document.getElementById("hdr" + fObj.id.substr(0,fObj.id.indexOf("_div")) + "_span").style.overflowX="visible";
fObj.className="dragging";
// fObj.style.opacity = '0.6';
// fObj.style.filter = 'alpha(opacity=' + 60 + ')';
//set the page height and width in a var since IE changes them when scrolling
pageHeight = docElement.scrollHeight;
pageWidth = docElement.scrollWidth;
@ -326,7 +324,33 @@ function dragable_dragStop(e) {
if (z) {
if (endTD !=null && startTD!=null) {
dragable_moveContent(startTD,endTD,endTDPos);
fObj2 = dragable_getObjectByClass(startTD,"availableDashlet");
dragable_moveContent(startTD,endTD,endTDPos);
if (fObj2) {
var replId = startTD.id;
replId = replId.replace(/^td/gi,'');
// alert(replId);
var replUrl = available_dashlets[replId];
// alert(replUrl);
contentDiv = document.getElementById("ct" + replId + "_div");
var hoopla = AjaxRequest.get(
{
'url':replUrl
,'parameters':{
'func':"ajaxInlineView"
}
,'onSuccess':function(req){
var myArr528 = req.responseText.split(/beginDebug/mg,1);
contentDiv.innerHTML = myArr528[0];
}
}
);
// tdn6p_3ZAFRtB9WiyKnrwryg
// ctn6p_3ZAFRtB9WiyKnrwryg_div
}
startTD=null;
if (dragable_isBlank(endTD)) {
@ -338,6 +362,8 @@ function dragable_dragStop(e) {
// document.getElementById(divName).style.filter = null;
}
dragable_postNewContentMap();
}
for(i=0;i<dragableList.length;i++) {
@ -363,6 +389,7 @@ function dragable_dragStop(e) {
endTD.position = null;
endTD=null;
}
}
function dragable_postNewContentMap() {