From f6058c1b34355869d6e0c9ca7b054aefdddf2950 Mon Sep 17 00:00:00 2001
From: Matthew Wilson
Date: Mon, 5 Dec 2005 00:38:55 +0000
Subject: [PATCH] fixing lots of dashboard things.
---
lib/WebGUI.pm | 1 +
lib/WebGUI/Asset.pm | 15 +++++++++
lib/WebGUI/Asset/Wobject/Dashboard.pm | 32 ++++++++++---------
lib/WebGUI/Asset/Wobject/EventsCalendar.pm | 3 +-
lib/WebGUI/Help/Asset_Shortcut.pm | 8 +++++
lib/WebGUI/Operation/User.pm | 4 +--
lib/WebGUI/i18n/English/Asset_Shortcut.pm | 8 ++---
www/extras/wobject/Dashboard/dashboard.css | 25 +++++++++++++--
www/extras/wobject/Dashboard/draggable.js | 37 +++++++++++++++++++---
9 files changed, 104 insertions(+), 29 deletions(-)
diff --git a/lib/WebGUI.pm b/lib/WebGUI.pm
index ff177c898..d71e243f4 100644
--- a/lib/WebGUI.pm
+++ b/lib/WebGUI.pm
@@ -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;
}
diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm
index d3ed68d59..e8a432a93 100644
--- a/lib/WebGUI/Asset.pm
+++ b/lib/WebGUI/Asset.pm
@@ -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 ( )
diff --git a/lib/WebGUI/Asset/Wobject/Dashboard.pm b/lib/WebGUI/Asset/Wobject/Dashboard.pm
index a973a9e98..89d4d1d23 100644
--- a/lib/WebGUI/Asset/Wobject/Dashboard.pm
+++ b/lib/WebGUI/Asset/Wobject/Dashboard.pm
@@ -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"} = '
';
return $self->processTemplate(\%vars, $templateId);
diff --git a/lib/WebGUI/Asset/Wobject/EventsCalendar.pm b/lib/WebGUI/Asset/Wobject/EventsCalendar.pm
index 34acf334e..2bfcff9a0 100644
--- a/lib/WebGUI/Asset/Wobject/EventsCalendar.pm
+++ b/lib/WebGUI/Asset/Wobject/EventsCalendar.pm
@@ -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");
}
diff --git a/lib/WebGUI/Help/Asset_Shortcut.pm b/lib/WebGUI/Help/Asset_Shortcut.pm
index 7d902b952..7eccc305d 100644
--- a/lib/WebGUI/Help/Asset_Shortcut.pm
+++ b/lib/WebGUI/Help/Asset_Shortcut.pm
@@ -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'
diff --git a/lib/WebGUI/Operation/User.pm b/lib/WebGUI/Operation/User.pm
index ea36e6598..20a561c3b 100644
--- a/lib/WebGUI/Operation/User.pm
+++ b/lib/WebGUI/Operation/User.pm
@@ -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});
diff --git a/lib/WebGUI/i18n/English/Asset_Shortcut.pm b/lib/WebGUI/i18n/English/Asset_Shortcut.pm
index 6bc320b03..e2b65077e 100644
--- a/lib/WebGUI/i18n/English/Asset_Shortcut.pm
+++ b/lib/WebGUI/i18n/English/Asset_Shortcut.pm
@@ -360,13 +360,13 @@ The word "Shortcut".
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|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).
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 ().
|,
lastUpdated => 1133619940,
},
diff --git a/www/extras/wobject/Dashboard/dashboard.css b/www/extras/wobject/Dashboard/dashboard.css
index 958e96b2c..27ad7005f 100644
--- a/www/extras/wobject/Dashboard/dashboard.css
+++ b/www/extras/wobject/Dashboard/dashboard.css
@@ -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;
diff --git a/www/extras/wobject/Dashboard/draggable.js b/www/extras/wobject/Dashboard/draggable.js
index ea14d09f7..9f829a4cd 100644
--- a/www/extras/wobject/Dashboard/draggable.js
+++ b/www/extras/wobject/Dashboard/draggable.js
@@ -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