2011-10-06 15:39:28 +00:00
|
|
|
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
2011-11-05 17:04:10 +00:00
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
2011-08-24 21:21:25 +00:00
|
|
|
pandora.ui.siteDialog = function(section) {
|
|
|
|
|
2012-02-18 13:58:49 +00:00
|
|
|
var dialogWidth = Math.round(window.innerWidth * 0.75),
|
|
|
|
isEditable = pandora.site.capabilities.canEditSitePages[pandora.user.level],
|
|
|
|
tabs = Ox.merge(
|
|
|
|
Ox.clone(pandora.site.sitePages, true),
|
|
|
|
[{id: 'software', title: 'Software'}]
|
|
|
|
);
|
2011-11-09 17:37:44 +00:00
|
|
|
Ox.getObjectById(tabs, section).selected = true;
|
2011-08-24 21:21:25 +00:00
|
|
|
var $tabPanel = Ox.TabPanel({
|
|
|
|
content: function(id) {
|
2011-10-27 08:47:57 +00:00
|
|
|
var $content = Ox.Element().css({padding: '16px', overflowY: 'auto'});
|
2012-02-18 13:58:49 +00:00
|
|
|
if (id == 'contact') {
|
|
|
|
pandora.$ui.contactForm = pandora.ui.contactForm().appendTo($content);
|
|
|
|
} else if (id == 'news') {
|
|
|
|
pandora.$ui.news = pandora.ui.news(dialogWidth).appendTo($content);
|
|
|
|
} else if (id == 'software') {
|
2011-11-08 13:09:21 +00:00
|
|
|
Ox.Element()
|
|
|
|
.html(
|
|
|
|
'<h1><b>Pan.do/ra</b></h1>'
|
|
|
|
+ '<sub>open media archive</sub>'
|
|
|
|
+ '<p><b>' + pandora.site.site.name + '</b> is based on <b>Pan.do/ra</b>, '
|
|
|
|
+ 'a free open source framework for media archives.</p>'
|
|
|
|
+ '<b>Pan.do/ra</b> includes <b>OxJS</b>, a new JavaScript library for web applications.</p>'
|
|
|
|
+ '<p><b>Pan.do/ra</b> and <b>OxJS</b> will be released in 2012. More soon...</p>'
|
|
|
|
)
|
|
|
|
.appendTo($content);
|
2011-10-06 15:39:28 +00:00
|
|
|
} else {
|
2011-10-27 08:47:57 +00:00
|
|
|
pandora.api.getPage({name: id}, function(result) {
|
2012-02-18 13:58:49 +00:00
|
|
|
var $right, risk;
|
2011-10-27 08:47:57 +00:00
|
|
|
Ox.Editable({
|
2011-10-27 18:47:52 +00:00
|
|
|
clickLink: pandora.clickLink,
|
2012-02-18 13:58:49 +00:00
|
|
|
editable: isEditable,
|
|
|
|
tooltip: isEditable ? 'Doubleclick to edit' : '',
|
2011-10-27 08:47:57 +00:00
|
|
|
type: 'textarea',
|
2012-02-18 13:58:49 +00:00
|
|
|
value: result.data.text
|
2011-10-27 08:47:57 +00:00
|
|
|
})
|
2011-11-08 17:22:07 +00:00
|
|
|
.css(id == 'rights' ? {
|
|
|
|
// this will get applied twice,
|
|
|
|
// total is 144px
|
|
|
|
marginRight: '72px'
|
|
|
|
} : {
|
|
|
|
width: '100%'
|
|
|
|
})
|
2011-10-27 08:47:57 +00:00
|
|
|
.bindEvent({
|
|
|
|
submit: function(data) {
|
|
|
|
Ox.Request.clearCache('getPage');
|
|
|
|
pandora.api.editPage({
|
|
|
|
name: id,
|
2012-02-18 13:58:49 +00:00
|
|
|
text: data.value
|
2011-10-27 08:47:57 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
})
|
2011-11-08 17:22:07 +00:00
|
|
|
.appendTo($content);
|
|
|
|
if (id == 'rights') {
|
2012-02-18 13:58:49 +00:00
|
|
|
$right = $('<div>')
|
2011-11-08 17:22:07 +00:00
|
|
|
.css({position: 'absolute', top: '16px', right: '16px', width: '128px'})
|
|
|
|
.appendTo($content);
|
|
|
|
$('<img>')
|
|
|
|
.attr({src: '/static/png/rights.png'})
|
|
|
|
.css({width: '128px', height: '128px', marginBottom: '8px'})
|
2012-02-18 13:58:49 +00:00
|
|
|
.appendTo($right);
|
2011-11-08 17:22:07 +00:00
|
|
|
risk = ['Unknown', 'Severe', 'High', 'Significant', 'General', 'Low'];
|
|
|
|
Ox.merge(
|
|
|
|
['Unknown'],
|
|
|
|
pandora.site.rightsLevels.map(function(rightsLevel) {
|
|
|
|
return rightsLevel.name;
|
|
|
|
}).reverse()
|
|
|
|
).forEach(function(name, i) {
|
|
|
|
Ox.Theme.formatColor(330 + 30 * i, 'gradient')
|
|
|
|
.css({
|
|
|
|
padding: '4px',
|
|
|
|
marginTop: '8px',
|
|
|
|
})
|
|
|
|
.html(
|
|
|
|
'<b>' + name + '</b><br/><div style="padding-top: 2px; font-size: 9px; opacity: 0.75">'
|
|
|
|
+ risk[i] + ' Risk'
|
2011-11-09 14:46:06 +00:00
|
|
|
+ (risk[i].length > 6 ? '<br/> of ' : ' of<br/>')
|
2011-11-08 17:22:07 +00:00
|
|
|
+ 'Legal Action</div>'
|
|
|
|
)
|
2012-02-18 13:58:49 +00:00
|
|
|
.appendTo($right);
|
2011-11-08 17:22:07 +00:00
|
|
|
});
|
|
|
|
}
|
2011-10-06 15:39:28 +00:00
|
|
|
});
|
|
|
|
}
|
2011-08-24 21:21:25 +00:00
|
|
|
return Ox.SplitPanel({
|
|
|
|
elements: [
|
|
|
|
{
|
|
|
|
element: Ox.Element()
|
|
|
|
.css({padding: '16px'})
|
|
|
|
.append(
|
|
|
|
$('<img>')
|
2011-08-26 00:22:26 +00:00
|
|
|
.attr({src: '/static/png/' + (
|
2011-10-27 22:17:28 +00:00
|
|
|
id == 'software' ? 'pandora/icon' : 'logo'
|
2011-08-26 00:22:26 +00:00
|
|
|
) + '256.png'})
|
2011-08-28 06:24:01 +00:00
|
|
|
.css({width: '256px'})
|
2011-08-24 21:21:25 +00:00
|
|
|
),
|
2011-08-28 06:24:01 +00:00
|
|
|
size: 272
|
2011-08-24 21:21:25 +00:00
|
|
|
},
|
|
|
|
{
|
2011-10-27 08:47:57 +00:00
|
|
|
element: $content
|
2011-08-24 21:21:25 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
orientation: 'horizontal'
|
|
|
|
});
|
|
|
|
},
|
|
|
|
tabs: tabs
|
|
|
|
})
|
|
|
|
.bindEvent({
|
|
|
|
change: function(data) {
|
2011-11-09 17:37:44 +00:00
|
|
|
that.options({
|
2011-08-24 21:21:25 +00:00
|
|
|
title: Ox.getObjectById(tabs, data.selected).title
|
|
|
|
});
|
2011-11-09 22:32:54 +00:00
|
|
|
pandora.UI.set({page: data.selected});
|
2011-08-24 21:21:25 +00:00
|
|
|
}
|
|
|
|
});
|
2011-11-09 17:37:44 +00:00
|
|
|
|
|
|
|
var that = Ox.Dialog({
|
2011-11-02 10:22:19 +00:00
|
|
|
buttons: [
|
|
|
|
Ox.Button({
|
|
|
|
id: 'close',
|
|
|
|
title: 'Close'
|
|
|
|
}).bindEvent({
|
|
|
|
click: function() {
|
2011-11-09 17:37:44 +00:00
|
|
|
that.close();
|
2011-11-02 10:22:19 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
],
|
2011-11-09 17:37:44 +00:00
|
|
|
closeButton: true,
|
2011-11-02 10:22:19 +00:00
|
|
|
content: $tabPanel,
|
|
|
|
height: Math.round((window.innerHeight - 24) * 0.75),
|
2011-11-09 17:37:44 +00:00
|
|
|
maximizeButton: true,
|
2011-11-02 10:22:19 +00:00
|
|
|
minHeight: 256,
|
|
|
|
minWidth: 688, // 16 + 256 + 16 + 384 + 16
|
2011-11-09 17:37:44 +00:00
|
|
|
removeOnClose: true,
|
|
|
|
title: Ox.getObjectById(tabs, section).title,
|
2012-02-18 13:58:49 +00:00
|
|
|
width: dialogWidth
|
2011-11-02 10:22:19 +00:00
|
|
|
})
|
|
|
|
.bindEvent({
|
2011-11-09 22:32:54 +00:00
|
|
|
close: function(data) {
|
|
|
|
pandora.UI.set({page: ''});
|
|
|
|
},
|
2011-11-02 10:22:19 +00:00
|
|
|
resize: function(data) {
|
2012-02-18 13:58:49 +00:00
|
|
|
var selected = $tabPanel.selected();
|
|
|
|
if (selected == 'contact') {
|
2011-11-02 10:22:19 +00:00
|
|
|
pandora.$ui.contactForm.resize();
|
2012-02-18 13:58:49 +00:00
|
|
|
} else if (selected == 'news') {
|
|
|
|
|
2011-08-24 21:21:25 +00:00
|
|
|
}
|
2011-11-02 10:22:19 +00:00
|
|
|
}
|
|
|
|
});
|
2011-08-24 21:21:25 +00:00
|
|
|
|
2011-11-09 17:37:44 +00:00
|
|
|
that.select = function(id) {
|
2011-11-09 09:49:59 +00:00
|
|
|
$tabPanel.select(id);
|
2011-11-09 17:37:44 +00:00
|
|
|
return that;
|
2011-11-09 09:49:59 +00:00
|
|
|
};
|
|
|
|
|
2011-11-09 17:37:44 +00:00
|
|
|
return that;
|
2011-10-29 17:46:46 +00:00
|
|
|
|
2011-09-24 23:09:48 +00:00
|
|
|
};
|