* Makes the Preferences screen a proper Dragonfly view.

* Preference requests are now /user/$user/preferences/all/dragonfly.json.
* No more strange external CSS/JS files.
* Added another note about how nasty BongoCalendar.js is.
This commit is contained in:
halex
2007-07-04 11:30:46 +00:00
parent 103227e92b
commit 5d5b56acf1
9 changed files with 48 additions and 211 deletions
-3
View File
@@ -19,10 +19,8 @@ dist_css_DATA := \
src/www/css/interpreter.css \
src/www/css/layout.css \
src/www/css/login.css \
src/www/css/modal.css \
src/www/css/print.css \
src/www/css/summary.css \
src/www/css/tabs.css \
src/www/css/widgets.css
imgdir = $(htdocsdir)/img
@@ -231,7 +229,6 @@ dist_js_DATA := \
src/www/js/Mail.js \
src/www/js/MailListView.js \
src/www/js/MailWidgets.js \
src/www/js/Modal.js \
src/www/js/OccurrenceEditor.js \
src/www/js/Preferences.js \
src/www/js/Search.js \
+1 -1
View File
@@ -12,7 +12,7 @@ class ResourcePath:
_views = {"addressbook" : 1,
"calendar" : 1,
"mail" : 1,
"preferences" : 0,
"preferences" : 1,
"search" : 1,
"summary" : 1}
-25
View File
@@ -1,25 +0,0 @@
#overlay {
position: absolute;
z-index:80;
width: 100%;
height: 100%;
top: 0;
left: 0;
background-color:#000;
filter:alpha(opacity=40);
-moz-opacity: 0.4;
opacity: 0.4;
}
#box {
width: 50%;
background: #d3d2cf;
padding: 10px;
border: 2px solid #eee;
}
#close {
position: absolute;
top: -5px;
right: -5px;
cursor: pointer;
}
-108
View File
@@ -1,108 +0,0 @@
#main {
border: 1px solid #666;
clear: both;
background: #FFF3B3;
padding-top: 2px;
}
#contents {
padding: 1.5em;
background: #FFFDF3;
min-height: 300px;
}
#header {
position: relative;
width: 100%;
height: 3em;
width: 45em; /* a width is required for Opera, older Mozilla browsers, and Konqueror browsers */
}
#header ul#primary {
margin: 0;
padding: 0;
position: absolute;
bottom: -1px;
width: 45em; /* a width is required for Opera, older Mozilla browsers, and Konqueror browsers */
}
#header ul#primary li {
display: inline;
list-style: none;
}
#header ul#primary a,#header ul#primary span,#header ul#primary a.current {
width: 8em;
display: block;
float: left;
padding: 4px 0;
margin: 1px 2px 0 0;
text-align: center;
font-family: tahoma, verdana, sans-serif;
font-size: 85%;
text-decoration: none;
color: #333;
}
#header ul#primary span,#header ul#primary a.current,#header ul#primary a.current:hover {
border: 1px solid #666;
border-bottom: none;
background: #FFF3B3;
padding-bottom: 6px;
margin-top: 0;
}
#header ul#primary a {
background: #FFFAE1;
border: 1px solid #AAA;
border-bottom: none;
}
#header ul#primary a:hover {
margin-top: 0;
border-color: #666;
background: #FFF7CD;
padding-bottom: 5px;
}
#header ul#secondary {
position: absolute;
margin: 0;
padding: 0;
bottom: -1.4em;
left: 1px;
width: 50em; /* a width is required for Opera, older Mozilla browsers, and Konqueror browsers */
}
#header ul#secondary li a,#header ul#secondary li span {
width: auto;
display: block;
float: left;
padding: 0 10px;
margin: 0;
text-align: auto;
border: none;
border-right: 1px dotted #AAA;
background: none;
}
#header ul#secondary li a {
color: #06C;
text-decoration: underline;
}
#header ul#secondary li a:hover {
color: #333;
background: transparent;
padding: 0 10px;
border: none;
border-right: 1px dotted #AAA;
}
#header ul#secondary li a:active {
color: #000;
background: transparent;
}
#header ul#secondary li:last-child a { border: none; }
+3 -4
View File
@@ -199,7 +199,7 @@
<tr><td width="100%">
<span id="user-name"></span>
<ul id="section-user">
<li><a href="javascript:void(showBox());" id="settings-text">Settings</a></li>
<li><a href="#preferences" id="settings-text">Settings</a></li>
<li id="admin-link"><a href="admin" target="_blank" id="admin-text">Administration</a></li>
<li><a href="javascript:void(Dragonfly.logout());" id="logout-text">Log Out</a></li>
<!--
@@ -273,13 +273,12 @@
<div id="contents">
<div id="aboutme">
<h3>About Me</h3>
<p>Curabitur vel urna vitae nunc bibendum porttitor. Nam tortor quam, luctus id, convallis sed, rutrum ac, ante. Proin euismod lacus vitae elit. Nullam vel diam in metus consectetuer facilisis.</p>
<label for="fname">Full Name: </label><input type="text" id="fname" name="fname" />
<br />
</div>
<div id="display">
<div id="display" style="display:none;">
</div>
<div id="timezone">
<div id="timezone" style="display:none;">
<span id="tzselect"></span>
</div>
</div>
+2 -1
View File
@@ -64,7 +64,8 @@ Dragonfly.Calendar.BongoCalendar.prototype.setShared = function (isPublic)
Dragonfly.Calendar.BongoCalendar.prototype.parseJSON = function (jsob)
{
var d = Dragonfly;
// TODO: This is really nasty.
function calColor (calname)
{
return {
+5 -1
View File
@@ -912,6 +912,7 @@ Dragonfly.translateElements = function ()
Element.setHTML ('new-event-href', _('composeEventLabel'));
}
Dragonfly.start = function ()
{
var d = Dragonfly;
@@ -922,7 +923,10 @@ Dragonfly.start = function ()
d.translateElements();
d.setLoginMessage (_('loadingData'));
// setup the preferences dialog tabs
//d.setupPrefs();
// set current timezone to default and build timezone selector
d.curTzid = c.Preferences.getDefaultTimezone();
d.tzselector = new d.TzSelector (d.curTzid, 'tzselect', true);
-65
View File
@@ -1,65 +0,0 @@
function showBox(){
$('overlay').show();
center('box');
return false;
}
function hideBox(){
$('box').hide();
$('overlay').hide();
return false;
}
function center(element){
try{
element = $(element);
}catch(e){
return;
}
var my_width = 0;
var my_height = 0;
if ( typeof( window.innerWidth ) == 'number' ){
my_width = window.innerWidth;
my_height = window.innerHeight;
}else if ( document.documentElement &&
( document.documentElement.clientWidth ||
document.documentElement.clientHeight ) ){
my_width = document.documentElement.clientWidth;
my_height = document.documentElement.clientHeight;
}
else if ( document.body &&
( document.body.clientWidth || document.body.clientHeight ) ){
my_width = document.body.clientWidth;
my_height = document.body.clientHeight;
}
element.style.position = 'absolute';
element.style.zIndex = 99;
var scrollY = 0;
if ( document.documentElement && document.documentElement.scrollTop ){
scrollY = document.documentElement.scrollTop;
}else if ( document.body && document.body.scrollTop ){
scrollY = document.body.scrollTop;
}else if ( window.pageYOffset ){
scrollY = window.pageYOffset;
}else if ( window.scrollY ){
scrollY = window.scrollY;
}
var elementDimensions = Element.getDimensions(element);
var setX = ( my_width - elementDimensions.width ) / 2;
var setY = ( my_height - elementDimensions.height ) / 2 + scrollY;
setX = ( setX < 0 ) ? 0 : setX;
setY = ( setY < 0 ) ? 0 : setY;
element.style.left = setX + "px";
element.style.top = setY + "px";
element.style.display = 'block';
}
+37 -3
View File
@@ -1,4 +1,14 @@
Dragonfly.Preferences = { };
Dragonfly.Preferences = {
defaultSet: 'all',
defaultHandler: 'dragonfly'
};
Dragonfly.tabs['preferences'] = Dragonfly.Preferences;
Dragonfly.Preferences.handlers = { };
Dragonfly.Preferences.sets = [ 'all' ];
Dragonfly.Preferences.setLabels = { all: 'All' };
Dragonfly.Preferences.prefs = { };
Dragonfly.Preferences.defaultPrefs = {
@@ -45,7 +55,7 @@ Dragonfly.Preferences.load = function ()
}
}
return d.requestJSON ('GET', '/user/' + d.userName + '/preferences/dragonfly.json').addCallbacks (
return d.requestJSON ('GET', '/user/' + d.userName + '/preferences/all/dragonfly.json').addCallbacks (
function (jsob) {
if (!jsob.addressbook) {
logDebug ('Empty preferences, loading defaults.');
@@ -70,7 +80,7 @@ Dragonfly.Preferences.save = function ()
if (!d.Preferences.prefs) {
throw new Error ('preferences object is invalid');
}
return d.request ('PUT', '/user/' + d.userName + '/preferences/dragonfly.json',
return d.request ('PUT', '/user/' + d.userName + '/preferences/all/dragonfly.json',
d.Preferences.prefs);
} catch (e) {
logError ('Error serializing preferences: ' + d.reprError (e));
@@ -130,3 +140,27 @@ Dragonfly.Preferences.set = function (key, value)
throw new Error ('Invalid Preference Key ' + key);
}
Dragonfly.Preferences.Editor = { };
Dragonfly.Preferences.handlers['dragonfly'] = Dragonfly.Preferences.Editor;
Dragonfly.Preferences.Editor.parsePath = function (loc, path)
{
loc.valid = true;
return loc;
};
Dragonfly.Preferences.Editor.build = function (loc)
{
var d = Dragonfly;
Element.setHTML ('toolbar', '');
Element.hide ('toolbar');
var html = new d.HtmlBuilder ('<div id="search-no-results" class="scrollv">');
html.push ('<table style="margin: auto;"><tr>',
'<td><img src="img/big-info.png" style="float: left;" /></td>',
'<td style="vertical-align:middle;"><h3>The Preferences editor goes here! <code>:)</code></h3></td>',
'</tr></table></div>');
html.set ('content-iframe');
}