homepage mockup
This commit is contained in:
parent
3ec2abdd6d
commit
35f4de8759
|
@ -1,3 +1,4 @@
|
|||
*.pyc
|
||||
local_settings.py
|
||||
univcloud.sqlite3
|
||||
/static
|
||||
|
|
|
@ -60,7 +60,7 @@ MEDIA_URL = ''
|
|||
# Don't put anything in this directory yourself; store your static files
|
||||
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
|
||||
# Example: "/home/media/media.lawrence.com/static/"
|
||||
STATIC_ROOT = ''
|
||||
STATIC_ROOT = os.path.join(PROJECT_PATH, 'static')
|
||||
|
||||
# URL prefix for static files.
|
||||
# Example: "http://media.lawrence.com/static/"
|
||||
|
@ -68,9 +68,7 @@ STATIC_URL = '/static/'
|
|||
|
||||
# Additional locations of static files
|
||||
STATICFILES_DIRS = (
|
||||
# Put strings here, like "/home/html/static" or "C:/www/django/static".
|
||||
# Always use forward slashes, even on Windows.
|
||||
# Don't forget to use absolute paths, not relative paths.
|
||||
os.path.join(PROJECT_PATH, 'univcloud', 'static'),
|
||||
)
|
||||
|
||||
# List of finder classes that know how to find static files in
|
||||
|
@ -107,9 +105,7 @@ ROOT_URLCONF = 'univcloud.urls'
|
|||
WSGI_APPLICATION = 'univcloud.wsgi.application'
|
||||
|
||||
TEMPLATE_DIRS = (
|
||||
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
|
||||
# Always use forward slashes, even on Windows.
|
||||
# Don't forget to use absolute paths, not relative paths.
|
||||
os.path.join(PROJECT_PATH, 'univcloud', 'templates'),
|
||||
)
|
||||
|
||||
INSTALLED_APPS = (
|
||||
|
@ -154,6 +150,8 @@ LOGGING = {
|
|||
}
|
||||
}
|
||||
|
||||
LOGIN_REDIRECT_URL = '/'
|
||||
|
||||
try:
|
||||
from local_settings import *
|
||||
except ImportError:
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
/*! gridster.js - v0.1.0 - 2012-10-20
|
||||
* http://gridster.net/
|
||||
* Copyright (c) 2012 ducksboard; Licensed MIT */
|
||||
|
||||
.gridster {
|
||||
position:relative;
|
||||
}
|
||||
|
||||
.gridster > * {
|
||||
margin: 0 auto;
|
||||
-webkit-transition: height .4s;
|
||||
-moz-transition: height .4s;
|
||||
-o-transition: height .4s;
|
||||
-ms-transition: height .4s;
|
||||
transition: height .4s;
|
||||
}
|
||||
|
||||
.gridster .gs_w{
|
||||
z-index: 2;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.ready .gs_w:not(.preview-holder) {
|
||||
-webkit-transition: opacity .3s, left .3s, top .3s;
|
||||
-moz-transition: opacity .3s, left .3s, top .3s;
|
||||
-o-transition: opacity .3s, left .3s, top .3s;
|
||||
transition: opacity .3s, left .3s, top .3s;
|
||||
}
|
||||
|
||||
.ready .gs_w:not(.preview-holder) {
|
||||
-webkit-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
|
||||
-moz-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
|
||||
-o-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
|
||||
transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
|
||||
}
|
||||
|
||||
.gridster .preview-holder {
|
||||
z-index: 1;
|
||||
position: absolute;
|
||||
background-color: #fff;
|
||||
border-color: #fff;
|
||||
opacity: 0.3;
|
||||
}
|
||||
|
||||
.gridster .player-revert {
|
||||
z-index: 10!important;
|
||||
-webkit-transition: left .3s, top .3s!important;
|
||||
-moz-transition: left .3s, top .3s!important;
|
||||
-o-transition: left .3s, top .3s!important;
|
||||
transition: left .3s, top .3s!important;
|
||||
}
|
||||
|
||||
.gridster .dragging {
|
||||
z-index: 10!important;
|
||||
-webkit-transition: all 0s !important;
|
||||
-moz-transition: all 0s !important;
|
||||
-o-transition: all 0s !important;
|
||||
transition: all 0s !important;
|
||||
}
|
||||
|
||||
/* Uncomment this if you set helper : "clone" in draggable options */
|
||||
/*.gridster .player {
|
||||
opacity:0;
|
||||
}*/
|
|
@ -0,0 +1,134 @@
|
|||
html, body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background: #4087b6 url(../img/noise-texture.png);
|
||||
height: 101%;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
#footer {
|
||||
display: none;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: white;
|
||||
text-shadow: 1px 1px black;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
div.gridster > ul > li {
|
||||
border: 1px solid gray;
|
||||
list-style: none;
|
||||
overflow: hidden;
|
||||
background: white;
|
||||
border-radius: 1em;
|
||||
box-shadow: 0 0 5px black;
|
||||
}
|
||||
|
||||
div.rssHeader a,
|
||||
ul li h2 {
|
||||
text-shadow: 1px 1px #888;
|
||||
font-size: 14px;
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#wrap {
|
||||
margin: 0 auto;
|
||||
width: 1000px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#portal {
|
||||
position: absolute;
|
||||
right: 100px;
|
||||
top: -16px;
|
||||
background: white;
|
||||
padding: 5px 10px;
|
||||
border-radius: 0 0 5px 5px;
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#portal:visited {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
|
||||
/* add app */
|
||||
#add-app {
|
||||
background: #ccf;
|
||||
}
|
||||
|
||||
#add-app div {
|
||||
padding: 10px;
|
||||
padding-top: 30px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* weather */
|
||||
#weather {
|
||||
background: #ffd;
|
||||
}
|
||||
|
||||
#weather div {
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#weather div img {
|
||||
position: absolute;
|
||||
left: 30px;
|
||||
}
|
||||
|
||||
#weather div p {
|
||||
font-size: 200%;
|
||||
margin: 0;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
/* rss */
|
||||
#feed > div {
|
||||
padding: 10px;
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
div.rssHeader a {
|
||||
}
|
||||
|
||||
div.rssMedia,
|
||||
li.rssRow div {
|
||||
display: none;
|
||||
}
|
||||
|
||||
div.rssBody ul,
|
||||
li.rssRow {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#help {
|
||||
background: white url(../img/help.png) 50% 50% no-repeat;
|
||||
}
|
||||
|
||||
.app div {
|
||||
font-size: 200%;
|
||||
text-align: center;
|
||||
padding-top: 40px;
|
||||
}
|
||||
|
||||
#iframe {
|
||||
display: none;
|
||||
}
|
||||
|
||||
iframe {
|
||||
width: 100%;
|
||||
height: 90%;
|
||||
border: 1px solid #888;
|
||||
}
|
||||
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 5.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 78 KiB |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,135 @@
|
|||
/*
|
||||
* simpleWeather
|
||||
* http://simpleweather.monkeecreate.com
|
||||
*
|
||||
* A simple jQuery plugin to display the current weather
|
||||
* information for any location using Yahoo! Weather.
|
||||
*
|
||||
* Developed by James Fleeting <@twofivethreetwo>
|
||||
* Another project from monkeeCreate <http://monkeecreate.com>
|
||||
*
|
||||
* Version 2.1.2 - Last updated: January 25 2013
|
||||
*/
|
||||
(function($) {
|
||||
"use strict";
|
||||
$.extend({
|
||||
simpleWeather: function(options){
|
||||
options = $.extend({
|
||||
zipcode: '',
|
||||
woeid: '2357536',
|
||||
location: '',
|
||||
unit: 'f',
|
||||
success: function(weather){},
|
||||
error: function(message){}
|
||||
}, options);
|
||||
|
||||
var now = new Date();
|
||||
|
||||
var weatherUrl = 'http://query.yahooapis.com/v1/public/yql?format=json&rnd='+now.getFullYear()+now.getMonth()+now.getDay()+now.getHours()+'&diagnostics=true&callback=?&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&q=';
|
||||
if(options.location !== '') {
|
||||
weatherUrl += 'select * from weather.forecast where location in (select id from weather.search where query="'+options.location+'") and u="'+options.unit+'"';
|
||||
} else if(options.zipcode !== '') {
|
||||
weatherUrl += 'select * from weather.forecast where location in ("'+options.zipcode+'") and u="'+options.unit+'"';
|
||||
} else if(options.woeid !== '') {
|
||||
weatherUrl += 'select * from weather.forecast where woeid='+options.woeid+' and u="'+options.unit+'"';
|
||||
} else {
|
||||
options.error("Could not retrieve weather due to an invalid WOEID or location.");
|
||||
return false;
|
||||
}
|
||||
|
||||
$.getJSON(
|
||||
weatherUrl,
|
||||
function(data) {
|
||||
if(data !== null && data.query.results !== null) {
|
||||
$.each(data.query.results, function(i, result) {
|
||||
if (result.constructor.toString().indexOf("Array") !== -1) {
|
||||
result = result[0];
|
||||
}
|
||||
|
||||
var currentDate = new Date();
|
||||
var sunRise = new Date(currentDate.toDateString() +' '+ result.astronomy.sunrise);
|
||||
var sunSet = new Date(currentDate.toDateString() +' '+ result.astronomy.sunset);
|
||||
|
||||
if(currentDate>sunRise && currentDate<sunSet) {
|
||||
var timeOfDay = 'd';
|
||||
} else {
|
||||
var timeOfDay = 'n';
|
||||
}
|
||||
|
||||
var compass = ['N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW', 'N'];
|
||||
var windDirection = compass[Math.round(result.wind.direction / 22.5)];
|
||||
|
||||
if(result.item.condition.temp < 80 && result.atmosphere.humidity < 40) {
|
||||
var heatIndex = -42.379+2.04901523*result.item.condition.temp+10.14333127*result.atmosphere.humidity-0.22475541*result.item.condition.temp*result.atmosphere.humidity-6.83783*(Math.pow(10, -3))*(Math.pow(result.item.condition.temp, 2))-5.481717*(Math.pow(10, -2))*(Math.pow(result.atmosphere.humidity, 2))+1.22874*(Math.pow(10, -3))*(Math.pow(result.item.condition.temp, 2))*result.atmosphere.humidity+8.5282*(Math.pow(10, -4))*result.item.condition.temp*(Math.pow(result.atmosphere.humidity, 2))-1.99*(Math.pow(10, -6))*(Math.pow(result.item.condition.temp, 2))*(Math.pow(result.atmosphere.humidity,2));
|
||||
} else {
|
||||
var heatIndex = result.item.condition.temp;
|
||||
}
|
||||
|
||||
if(options.unit === "f") {
|
||||
var tempAlt = Math.round((5.0/9.0)*(result.item.condition.temp-32.0));
|
||||
} else {
|
||||
var tempAlt = Math.round((9.0/5.0)*result.item.condition.temp+32.0);
|
||||
}
|
||||
|
||||
var weather = {
|
||||
title: result.item.title,
|
||||
temp: result.item.condition.temp,
|
||||
tempAlt: tempAlt,
|
||||
code: result.item.condition.code,
|
||||
todayCode: result.item.forecast[0].code,
|
||||
units:{
|
||||
temp: result.units.temperature,
|
||||
distance: result.units.distance,
|
||||
pressure: result.units.pressure,
|
||||
speed: result.units.speed
|
||||
},
|
||||
currently: result.item.condition.text,
|
||||
high: result.item.forecast[0].high,
|
||||
low: result.item.forecast[0].low,
|
||||
forecast: result.item.forecast[0].text,
|
||||
wind:{
|
||||
chill: result.wind.chill,
|
||||
direction: windDirection,
|
||||
speed: result.wind.speed
|
||||
},
|
||||
humidity: result.atmosphere.humidity,
|
||||
heatindex: heatIndex,
|
||||
pressure: result.atmosphere.pressure,
|
||||
rising: result.atmosphere.rising,
|
||||
visibility: result.atmosphere.visibility,
|
||||
sunrise: result.astronomy.sunrise,
|
||||
sunset: result.astronomy.sunset,
|
||||
description: result.item.description,
|
||||
thumbnail: "http://l.yimg.com/a/i/us/nws/weather/gr/"+result.item.condition.code+timeOfDay+"s.png",
|
||||
image: "http://l.yimg.com/a/i/us/nws/weather/gr/"+result.item.condition.code+timeOfDay+".png",
|
||||
tomorrow:{
|
||||
high: result.item.forecast[1].high,
|
||||
low: result.item.forecast[1].low,
|
||||
forecast: result.item.forecast[1].text,
|
||||
code: result.item.forecast[1].code,
|
||||
date: result.item.forecast[1].date,
|
||||
day: result.item.forecast[1].day,
|
||||
image: "http://l.yimg.com/a/i/us/nws/weather/gr/"+result.item.forecast[1].code+"d.png"
|
||||
},
|
||||
city: result.location.city,
|
||||
country: result.location.country,
|
||||
region: result.location.region,
|
||||
updated: result.item.pubDate,
|
||||
link: result.item.link
|
||||
};
|
||||
|
||||
options.success(weather);
|
||||
});
|
||||
} else {
|
||||
if (data.query.results === null) {
|
||||
options.error("An invalid WOEID or location was provided.");
|
||||
} else {
|
||||
options.error("There was an error retrieving the latest weather information. Please try again.");
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
return this;
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
|
@ -0,0 +1,349 @@
|
|||
/**
|
||||
* Plugin: jquery.zRSSFeed
|
||||
*
|
||||
* Version: 1.2.0
|
||||
* (c) Copyright 2010-2013, Zazar Ltd
|
||||
*
|
||||
* Description: jQuery plugin for display of RSS feeds via Google Feed API
|
||||
* (Based on original plugin jGFeed by jQuery HowTo. Filesize function by Cary Dunn.)
|
||||
*
|
||||
* History:
|
||||
* 1.2.0 - Added month names to date formats
|
||||
* 1.1.9 - New dateformat option to allow feed date formatting
|
||||
* 1.1.8 - Added historical option to enable scoring in the Google Feed API
|
||||
* 1.1.7 - Added feed offset, link redirect & link content options
|
||||
* 1.1.6 - Added sort options
|
||||
* 1.1.5 - Target option now applies to all feed links
|
||||
* 1.1.4 - Added option to hide media and now compressed with Google Closure
|
||||
* 1.1.3 - Check for valid published date
|
||||
* 1.1.2 - Added user callback function due to issue with ajaxStop after jQuery 1.4.2
|
||||
* 1.1.1 - Correction to null xml entries and support for media with jQuery < 1.5
|
||||
* 1.1.0 - Added support for media in enclosure tags
|
||||
* 1.0.3 - Added feed link target
|
||||
* 1.0.2 - Fixed issue with GET parameters (Seb Dangerfield) and SSL option
|
||||
* 1.0.1 - Corrected issue with multiple instances
|
||||
*
|
||||
**/
|
||||
|
||||
(function($){
|
||||
|
||||
$.fn.rssfeed = function(url, options, fn) {
|
||||
|
||||
// Set plugin defaults
|
||||
var defaults = {
|
||||
limit: 10,
|
||||
offset: 1,
|
||||
header: true,
|
||||
titletag: 'h4',
|
||||
date: true,
|
||||
dateformat: 'datetime',
|
||||
content: true,
|
||||
snippet: true,
|
||||
media: true,
|
||||
showerror: true,
|
||||
errormsg: '',
|
||||
key: null,
|
||||
ssl: false,
|
||||
linktarget: '_self',
|
||||
linkredirect: '',
|
||||
linkcontent: false,
|
||||
sort: '',
|
||||
sortasc: true,
|
||||
historical: false
|
||||
};
|
||||
var options = $.extend(defaults, options);
|
||||
|
||||
// Functions
|
||||
return this.each(function(i, e) {
|
||||
var $e = $(e);
|
||||
var s = '';
|
||||
|
||||
// Check for SSL protocol
|
||||
if (options.ssl) s = 's';
|
||||
|
||||
// Add feed class to user div
|
||||
if (!$e.hasClass('rssFeed')) $e.addClass('rssFeed');
|
||||
|
||||
// Check for valid url
|
||||
if(url == null) return false;
|
||||
|
||||
// Add start offset to feed length
|
||||
if (options.offset > 0) options.offset -= 1;
|
||||
options.limit += options.offset;
|
||||
|
||||
// Create Google Feed API address
|
||||
var api = "http"+ s +"://ajax.googleapis.com/ajax/services/feed/load?v=1.0&callback=?&q=" + encodeURIComponent(url);
|
||||
api += "&num=" + options.limit;
|
||||
if (options.historical) api += "&scoring=h";
|
||||
if (options.key != null) api += "&key=" + options.key;
|
||||
api += "&output=json_xml"
|
||||
|
||||
// Send request
|
||||
$.getJSON(api, function(data){
|
||||
|
||||
// Check for error
|
||||
if (data.responseStatus == 200) {
|
||||
|
||||
// Process the feeds
|
||||
_process(e, data.responseData, options);
|
||||
|
||||
// Optional user callback function
|
||||
if ($.isFunction(fn)) fn.call(this,$e);
|
||||
|
||||
} else {
|
||||
|
||||
// Handle error if required
|
||||
if (options.showerror)
|
||||
if (options.errormsg != '') {
|
||||
var msg = options.errormsg;
|
||||
} else {
|
||||
var msg = data.responseDetails;
|
||||
};
|
||||
$(e).html('<div class="rssError"><p>'+ msg +'</p></div>');
|
||||
};
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// Function to create HTML result
|
||||
var _process = function(e, data, options) {
|
||||
|
||||
// Get JSON feed data
|
||||
var feeds = data.feed;
|
||||
if (!feeds) {
|
||||
return false;
|
||||
}
|
||||
var rowArray = [];
|
||||
var rowIndex = 0;
|
||||
var html = '';
|
||||
var row = 'odd';
|
||||
|
||||
// Get XML data for media (parseXML not used as requires 1.5+)
|
||||
if (options.media) {
|
||||
var xml = _getXMLDocument(data.xmlString);
|
||||
var xmlEntries = xml.getElementsByTagName('item');
|
||||
}
|
||||
|
||||
// Add header if required
|
||||
if (options.header)
|
||||
html += '<div class="rssHeader">' +
|
||||
'<a href="'+feeds.link+'" title="'+ feeds.description +'">'+ feeds.title +'</a>' +
|
||||
'</div>';
|
||||
|
||||
// Add body
|
||||
html += '<div class="rssBody">' +
|
||||
'<ul>';
|
||||
|
||||
|
||||
// Add feeds
|
||||
for (var i=options.offset; i<feeds.entries.length; i++) {
|
||||
|
||||
rowIndex = i - options.offset;
|
||||
rowArray[rowIndex] = [];
|
||||
|
||||
// Get individual feed
|
||||
var entry = feeds.entries[i];
|
||||
var pubDate;
|
||||
var sort = '';
|
||||
var feedLink = entry.link;
|
||||
|
||||
// Apply sort column
|
||||
switch (options.sort) {
|
||||
case 'title':
|
||||
sort = entry.title;
|
||||
break;
|
||||
case 'date':
|
||||
sort = entry.publishedDate;
|
||||
break;
|
||||
}
|
||||
rowArray[rowIndex]['sort'] = sort;
|
||||
|
||||
// Format published date
|
||||
if (entry.publishedDate) {
|
||||
|
||||
var entryDate = new Date(entry.publishedDate);
|
||||
var pubDate = entryDate.toLocaleDateString() + ' ' + entryDate.toLocaleTimeString();
|
||||
|
||||
switch (options.dateformat) {
|
||||
case 'datetime':
|
||||
break;
|
||||
case 'date':
|
||||
pubDate = entryDate.toLocaleDateString();
|
||||
break;
|
||||
case 'time':
|
||||
pubDate = entryDate.toLocaleTimeString();
|
||||
break;
|
||||
case 'timeline':
|
||||
pubDate = _getLapsedTime(entryDate);
|
||||
break;
|
||||
default:
|
||||
pubDate = _formatDate(entryDate,options.dateformat);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Add feed row
|
||||
if (options.linkredirect) feedLink = encodeURIComponent(feedLink);
|
||||
rowArray[rowIndex]['html'] = '<'+ options.titletag +'><a href="'+ options.linkredirect + feedLink +'" title="View this feed at '+ feeds.title +'">'+ entry.title +'</a></'+ options.titletag +'>'
|
||||
|
||||
if (options.date && pubDate) rowArray[rowIndex]['html'] += '<div>'+ pubDate +'</div>'
|
||||
if (options.content) {
|
||||
|
||||
// Use feed snippet if available and optioned
|
||||
if (options.snippet && entry.contentSnippet != '') {
|
||||
var content = entry.contentSnippet;
|
||||
} else {
|
||||
var content = entry.content;
|
||||
}
|
||||
|
||||
if (options.linkcontent) {
|
||||
content = '<a href="'+ options.linkredirect + feedLink +'" title="View this feed at '+ feeds.title +'">'+ content +'</a>'
|
||||
}
|
||||
|
||||
rowArray[rowIndex]['html'] += '<p>'+ content +'</p>'
|
||||
}
|
||||
|
||||
// Add any media
|
||||
if (options.media && xmlEntries.length > 0) {
|
||||
var xmlMedia = xmlEntries[i].getElementsByTagName('enclosure');
|
||||
if (xmlMedia.length > 0) {
|
||||
|
||||
rowArray[rowIndex]['html'] += '<div class="rssMedia"><div>Media files</div><ul>'
|
||||
|
||||
for (var m=0; m<xmlMedia.length; m++) {
|
||||
var xmlUrl = xmlMedia[m].getAttribute("url");
|
||||
var xmlType = xmlMedia[m].getAttribute("type");
|
||||
var xmlSize = xmlMedia[m].getAttribute("length");
|
||||
rowArray[rowIndex]['html'] += '<li><a href="'+ xmlUrl +'" title="Download this media">'+ xmlUrl.split('/').pop() +'</a> ('+ xmlType +', '+ _formatFilesize(xmlSize) +')</li>';
|
||||
}
|
||||
rowArray[rowIndex]['html'] += '</ul></div>'
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Sort if required
|
||||
if (options.sort) {
|
||||
rowArray.sort(function(a,b) {
|
||||
|
||||
// Apply sort direction
|
||||
if (options.sortasc) {
|
||||
var c = a['sort'];
|
||||
var d = b['sort'];
|
||||
} else {
|
||||
var c = b['sort'];
|
||||
var d = a['sort'];
|
||||
}
|
||||
|
||||
if (options.sort == 'date') {
|
||||
return new Date(c) - new Date(d);
|
||||
} else {
|
||||
c = c.toLowerCase();
|
||||
d = d.toLowerCase();
|
||||
return (c < d) ? -1 : (c > d) ? 1 : 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Add rows to output
|
||||
$.each(rowArray, function(e) {
|
||||
|
||||
html += '<li class="rssRow '+row+'">' + rowArray[e]['html'] + '</li>';
|
||||
|
||||
// Alternate row classes
|
||||
if (row == 'odd') {
|
||||
row = 'even';
|
||||
} else {
|
||||
row = 'odd';
|
||||
}
|
||||
});
|
||||
|
||||
html += '</ul>' +
|
||||
'</div>'
|
||||
|
||||
$(e).html(html);
|
||||
|
||||
// Apply target to links
|
||||
$('a',e).attr('target',options.linktarget);
|
||||
};
|
||||
|
||||
var _formatFilesize = function(bytes) {
|
||||
var s = ['bytes', 'kb', 'MB', 'GB', 'TB', 'PB'];
|
||||
var e = Math.floor(Math.log(bytes)/Math.log(1024));
|
||||
return (bytes/Math.pow(1024, Math.floor(e))).toFixed(2)+" "+s[e];
|
||||
}
|
||||
|
||||
var _formatDate = function(date,mask) {
|
||||
|
||||
// Convert to date and set return to the mask
|
||||
var fmtDate = new Date(date);
|
||||
date = mask;
|
||||
|
||||
// Replace mask tokens
|
||||
date = date.replace('dd', _formatDigit(fmtDate.getDate()));
|
||||
date = date.replace('MMMM', _getMonthName(fmtDate.getMonth()));
|
||||
date = date.replace('MM', _formatDigit(fmtDate.getMonth()+1));
|
||||
date = date.replace('yyyy',fmtDate.getFullYear());
|
||||
date = date.replace('hh', _formatDigit(fmtDate.getHours()));
|
||||
date = date.replace('mm', _formatDigit(fmtDate.getMinutes()));
|
||||
date = date.replace('ss', _formatDigit(fmtDate.getSeconds()));
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
var _formatDigit = function(digit) {
|
||||
digit += '';
|
||||
if (digit.length < 2) digit = '0' + digit;
|
||||
return digit;
|
||||
}
|
||||
|
||||
var _getMonthName = function(month) {
|
||||
var name = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
|
||||
return name[month];
|
||||
}
|
||||
|
||||
var _getXMLDocument = function(string) {
|
||||
var browser = navigator.appName;
|
||||
var xml;
|
||||
if (browser == 'Microsoft Internet Explorer') {
|
||||
xml = new ActiveXObject('Microsoft.XMLDOM');
|
||||
xml.async = 'false';
|
||||
xml.loadXML(string);
|
||||
} else {
|
||||
xml = (new DOMParser()).parseFromString(string, 'text/xml');
|
||||
}
|
||||
return xml;
|
||||
}
|
||||
|
||||
var _getLapsedTime = function(date) {
|
||||
|
||||
// Get current date and format date parameter
|
||||
var todayDate = new Date();
|
||||
var pastDate = new Date(date);
|
||||
|
||||
// Get lasped time in seconds
|
||||
var lapsedTime = Math.round((todayDate.getTime() - pastDate.getTime())/1000)
|
||||
|
||||
// Return lasped time in seconds, minutes, hours, days and weeks
|
||||
if (lapsedTime < 60) {
|
||||
return '< 1 min';
|
||||
} else if (lapsedTime < (60*60)) {
|
||||
var t = Math.round(lapsedTime / 60) - 1;
|
||||
var u = 'min';
|
||||
} else if (lapsedTime < (24*60*60)) {
|
||||
var t = Math.round(lapsedTime / 3600) - 1;
|
||||
var u = 'hour';
|
||||
} else if (lapsedTime < (7*24*60*60)) {
|
||||
var t = Math.round(lapsedTime / 86400) - 1;
|
||||
var u = 'day';
|
||||
} else {
|
||||
var t = Math.round(lapsedTime / 604800) - 1;
|
||||
var u = 'week';
|
||||
}
|
||||
|
||||
// Check for plural units
|
||||
if (t > 1) u += 's';
|
||||
return t + ' ' + u;
|
||||
}
|
||||
|
||||
})(jQuery);
|
|
@ -0,0 +1,36 @@
|
|||
{% extends "univcloud/base.html" %}
|
||||
{% load i18n %}
|
||||
{% load url from future %}
|
||||
|
||||
{% block wrapper %}
|
||||
<div id="wrap">
|
||||
{% endblock %}
|
||||
|
||||
{% block user-links %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h2>{% trans 'Log In' %}</h2>
|
||||
|
||||
{% if form.errors %}
|
||||
<p>{% trans 'Incorrect password. Try again.' %}</p>
|
||||
{% endif %}
|
||||
|
||||
<form method="post" id="login-form" action="{% url 'django.contrib.auth.views.login' %}">
|
||||
{% csrf_token %}
|
||||
|
||||
<p>
|
||||
<label for="id_username">{{ form.username.label_tag }}</label>
|
||||
{{ form.username }}
|
||||
</p>
|
||||
<p>
|
||||
<label for="id_password">{{ form.password.label_tag }}</label>
|
||||
{{ form.password }}
|
||||
</p>
|
||||
|
||||
<input type="submit" value="{% trans 'Log In' %}" class="submit login" />
|
||||
<input type="hidden" name="next" value="{{ next }}" />
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
|
@ -0,0 +1,33 @@
|
|||
{% load url from future %}
|
||||
{% load i18n %}
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>{% block page-title %}Univcloud{% endblock %}</title>
|
||||
<script src="{{ STATIC_URL }}js/jquery.js"></script>
|
||||
{% block extrascripts %}
|
||||
{% endblock %}
|
||||
<link rel="stylesheet" type="text/css" media="all" href="{{ STATIC_URL }}css/style.css"/>
|
||||
</head>
|
||||
<body>
|
||||
{% block wrapper %}
|
||||
<div id="wrap">
|
||||
{% endblock %}
|
||||
{% if not popup %}
|
||||
<div id="header">
|
||||
<h1>Portail des services Univcloud</h1>
|
||||
<a href="#" id="portal">Afficher le portail</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div id="content">
|
||||
{% block beforecontent %}
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
{% block page-end %}
|
||||
{% endblock %}
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,112 @@
|
|||
{% extends "univcloud/base.html" %}
|
||||
{% load i18n %}
|
||||
{% load url from future %}
|
||||
|
||||
{% block extrascripts %}
|
||||
<script src="{{ STATIC_URL }}js/jquery.gridster.min.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/jquery.simpleWeather.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/jquery.zrssfeed.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/jquery-ui.js"></script>
|
||||
<link rel="stylesheet" type="text/css" media="all" href="{{ STATIC_URL }}css/jquery.gridster.css">
|
||||
{% endblock %}
|
||||
|
||||
{% block page-title %}
|
||||
Univcloud
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="gridster">
|
||||
<ul>
|
||||
<li data-row="1" data-col="1" data-sizex="1" data-sizey="1" id="add-app">
|
||||
<div>
|
||||
Ajouter une application :
|
||||
<br/><br/>
|
||||
<select>
|
||||
<option>---</option>
|
||||
<option>Lanceur</option>
|
||||
<option>Météo</option>
|
||||
<option>RSS</option>
|
||||
</select>
|
||||
</div>
|
||||
</li>
|
||||
<li data-row="2" data-col="1" data-sizex="1" data-sizey="1" id="weather"><div></div></li>
|
||||
<li data-row="3" data-col="1" data-sizex="1" data-sizey="1"><p>drag me, my friend</p></li>
|
||||
<li data-row="1" data-col="4" data-sizex="1" data-sizey="1" id="help"></li>
|
||||
|
||||
<li data-row="1" data-col="2" data-sizex="2" data-sizey="1" id="wcs" class="app">
|
||||
<div><a href="#">teleformulaires</a></div>
|
||||
</li>
|
||||
|
||||
<li data-row="2" data-col="4" data-sizex="2" data-sizey="1" class="app">
|
||||
<div><a href="#">nuxeo</a></div>
|
||||
</li>
|
||||
|
||||
|
||||
<li data-row="2" data-col="2" data-sizex="2" data-sizey="2" id="feed"><div/></li>
|
||||
<!--
|
||||
<li data-row="1" data-col="4" data-sizex="1" data-sizey="1"></li>
|
||||
<li data-row="2" data-col="4" data-sizex="2" data-sizey="1"></li>
|
||||
<li data-row="3" data-col="4" data-sizex="1" data-sizey="1"></li>
|
||||
|
||||
<li data-row="1" data-col="5" data-sizex="1" data-sizey="1"></li>
|
||||
<li data-row="3" data-col="5" data-sizex="1" data-sizey="1"></li>
|
||||
|
||||
<li data-row="1" data-col="6" data-sizex="1" data-sizey="1"></li>
|
||||
<li data-row="2" data-col="6" data-sizex="1" data-sizey="2"></li>
|
||||
-->
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="iframe">
|
||||
<iframe src="http://demo.au-quotidien.com" id="wcs-iframe">
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function(){ //DOM Ready
|
||||
var gridster = $(".gridster ul").gridster({
|
||||
widget_margins: [10, 10],
|
||||
widget_base_dimensions: [140, 140],
|
||||
min_cols: 5}
|
||||
).data('gridster');
|
||||
|
||||
$.simpleWeather({
|
||||
zipcode: '',
|
||||
woeid: '615702',
|
||||
location: '',
|
||||
unit: 'c',
|
||||
success: function(weather) {
|
||||
html = '<h2>'+weather.city+'</h2>';
|
||||
html += '<img width="125px" src="'+weather.image+'">';
|
||||
html += '<p>'+weather.temp+'° '+weather.units.temp+'</p>';
|
||||
$("#weather div").html(html);
|
||||
},
|
||||
error: function(error) {
|
||||
$("#weather div").html('<p>'+error+'</p>');
|
||||
}
|
||||
});
|
||||
|
||||
$('#feed div').rssfeed('http://www.lemonde.fr/rss/une.xml', {
|
||||
limit: 3,
|
||||
titletag: 'h3'
|
||||
});
|
||||
|
||||
$('#wcs a').click(function() {
|
||||
$('#iframe iframe').css('height', $(window).height()-100);
|
||||
$('#iframe').show();
|
||||
$('div.gridster').hide('blind', {duration: 800});
|
||||
$('#portal').show('fade');
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#portal').click(function() {
|
||||
$('div.gridster').show('blind', {duration: 800});
|
||||
$('#iframe').hide();
|
||||
$('#portal').hide('fade');
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
|
@ -4,9 +4,8 @@ from django.contrib import admin
|
|||
admin.autodiscover()
|
||||
|
||||
urlpatterns = patterns('',
|
||||
# Examples:
|
||||
# url(r'^$', 'univcloud.views.home', name='home'),
|
||||
# url(r'^univcloud/', include('univcloud.foo.urls')),
|
||||
|
||||
url(r'^$', 'univcloud.views.homepage', name='homepage'),
|
||||
url(r'^admin/', include(admin.site.urls)),
|
||||
url(r'^accounts/logout/', 'django.contrib.auth.views.logout_then_login'),
|
||||
url(r'^accounts/', include('django.contrib.auth.urls')),
|
||||
)
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
from django.views.generic.base import TemplateView
|
||||
|
||||
class Homepage(TemplateView):
|
||||
template_name = 'univcloud/homepage.html'
|
||||
|
||||
homepage = Homepage.as_view()
|
Reference in New Issue