Skip to content

Commit

Permalink
Merge branch 'novikov-alexander-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
alterm4nn committed Jul 27, 2015
2 parents 8327bf6 + 281c9ff commit 97294cd
Show file tree
Hide file tree
Showing 27 changed files with 188 additions and 49 deletions.
49 changes: 49 additions & 0 deletions Source/Chronozoom.Entities/SuperCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,53 @@ public SuperCollection()
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification="Automatically implemented properties must define both get and set accessors.")]
public virtual Collection<Entities.Collection> Collections { get; set; }
}

/// <summary>
/// Represents a supercollection info.
/// </summary>
[DataContract]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix", Justification = "SuperCollection in an inherent ChronoZoom concept")]
public class SuperCollectionInfo
{
/// <summary>
///Create info based on real SuperCollection.
/// </summary>
public SuperCollectionInfo(SuperCollection coll)
{
Id = coll.Id;
Title = coll.Title;
User = coll.User;
CollectionsCount = coll.Collections.Count;
}

/// <summary>
/// The ID of the supercollection.
/// </summary>
[Key]
[DataMember]
public Guid Id { get; set; }

/// <summary>
/// The path from the web root to the the supercollection. Title must therefore have a globally unique value.
/// Is programmatically derived as a URL-sanitized version of user's display name using a-z, 0-9 and hyphen only.
/// </summary>
[DataMember]
[Required]
[MaxLength(50)]
[Column(TypeName = "varchar")]
public string Title { get; set; }

/// <summary>
/// The user who owns the supercollection.
/// </summary>
[DataMember]
[Required]
public User User { get; set; }

/// <summary>
/// A collection of collections that belong to the supercollection.
/// </summary>
[DataMember]
public int CollectionsCount { get; set; }
}
}
2 changes: 1 addition & 1 deletion Source/Chronozoom.UI/Chronozoom.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<AssemblyName>Chronozoom.UI</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<UseIISExpress>false</UseIISExpress>
<IISExpressSSLPort />
<IISExpressSSLPort>44300</IISExpressSSLPort>
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
Expand Down
9 changes: 8 additions & 1 deletion Source/Chronozoom.UI/Web.config
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
</endpointBehaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true"/>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="99999"/>
</behavior>
Expand All @@ -109,13 +109,20 @@
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
<services>
<service name="Chronozoom.UI.ChronozoomSVC">
<endpoint address="" contract="Chronozoom.UI.IChronozoomSVC" behaviorConfiguration="Chronozoom.UI.ChronozoomAspNetAjaxBehavior" binding="webHttpBinding" bindingConfiguration="SecureLargePUT"/>
<endpoint address="bing" contract="Chronozoom.UI.IBingSearchAPI" behaviorConfiguration="Chronozoom.UI.ChronozoomAspNetAjaxBehavior" binding="webHttpBinding" bindingConfiguration="SecureLargePUT"/>
<endpoint address="" contract="Chronozoom.UI.IChronozoomSVC" behaviorConfiguration="Chronozoom.UI.ChronozoomAspNetAjaxBehavior" binding="webHttpBinding" bindingConfiguration="LargePUT"/>
<endpoint address="bing" contract="Chronozoom.UI.IBingSearchAPI" behaviorConfiguration="Chronozoom.UI.ChronozoomAspNetAjaxBehavior" binding="webHttpBinding" bindingConfiguration="LargePUT"/>
</service>
</services>
<bindings>
<webHttpBinding>
<binding name="LargePUT" maxBufferPoolSize="999999" maxBufferSize="999999" maxReceivedMessageSize="999999"/>
<binding name="SecureLargePUT" maxBufferPoolSize="999999" maxBufferSize="999999" maxReceivedMessageSize="999999">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</webHttpBinding>
</bindings>
</system.serviceModel>
Expand Down
10 changes: 8 additions & 2 deletions Source/Chronozoom.UI/api/Chronozoom.svc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2748,15 +2748,21 @@ public string GetContentPath(string superCollection, string collection, string r
/// <summary>
/// Documentation under IChronozoomSVC
/// </summary>
public IEnumerable<SuperCollection> GetSuperCollections()
public IEnumerable<SuperCollectionInfo> GetSuperCollections()
{
return ApiOperation(delegate(User user, Storage storage)
{
return storage.SuperCollections
var list = storage.SuperCollections
.Where(s => s.Title != _sandboxSuperCollectionName) // skip the sandbox collection since it's currently a test-only collection
.Include("Collections")
.OrderBy(s => s.Title)
.ToList();

List<SuperCollectionInfo> infos = new List<SuperCollectionInfo>();

foreach (var sc in list)
infos.Add(new SuperCollectionInfo(sc));
return infos;
});
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Chronozoom.UI/api/IChronozoomSVC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ public interface IChronozoomSVC
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
[OperationContract]
[WebGet(UriTemplate = "/supercollections", ResponseFormat = WebMessageFormat.Json)]
IEnumerable<SuperCollection> GetSuperCollections();
IEnumerable<SuperCollectionInfo> GetSuperCollections();

/// <summary>
/// Retrieve the list of all collections.
Expand Down
6 changes: 4 additions & 2 deletions Source/Chronozoom.UI/css/cz.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Source/Chronozoom.UI/css/cz.min.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Source/Chronozoom.UI/cz.html
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
</head>
<body>
<header>
<div class="fleft navigation header-logo" title="View Home Screen"></div>
<div class="fleft navigation cz-logo header-logo" title="View Home Screen"></div>
<div class="fleft navigation header-regimes">
<ul>
<li class="fleft">
Expand Down Expand Up @@ -232,7 +232,7 @@
Embed
<ul>
<li>
Text to copy:
To embed ChronoZoom to your website copy the text:
<textarea id="mnuEmbedText" style="height:100px; width:100%; resize:none" readonly="readonly"></textarea>
</li>
</ul>
Expand Down
41 changes: 33 additions & 8 deletions Source/Chronozoom.UI/cz.merged.js
Original file line number Diff line number Diff line change
Expand Up @@ -2176,6 +2176,7 @@ var CZ;
return true;
};


/* Represents a base element that can be added to the VirtualCanvas.
@remarks CanvasElement has extension in virtual space, that enables to check visibility of an object and render it.
@param vc (jquery to virtual canvas) note that vc.element[0] is the virtual canvas object
Expand Down Expand Up @@ -3024,6 +3025,7 @@ var CZ;

// Initialize background image for the timeline.
if (self.backgroundUrl) {
self.backgroundUrl = CZ.Service.MakeSecureUri(self.backgroundUrl);
self.backgroundImg = new BackgroundImage(self.vc, layerid, id + "__background__", self.backgroundUrl, self.x, self.y, self.width, self.height);
self.settings.gradientOpacity = 0;
self.settings.fillStyle = undefined;
Expand Down Expand Up @@ -3849,7 +3851,6 @@ var CZ;
var img = new Image();
this.img = img;
this.img.isLoaded = false;

var self = this;
var onCanvasImageLoad = function (s) {
img['isLoading'] = false;
Expand Down Expand Up @@ -4172,7 +4173,6 @@ var CZ;
elem.setAttribute("src", videoSrc);
elem.setAttribute("visible", 'true');
elem.setAttribute("controls", 'true');

this.initializeContent(elem);

this.prototype = new CanvasDomItem(vc, layerid, id, vx, vy, vw, vh, z);
Expand Down Expand Up @@ -4495,6 +4495,8 @@ var CZ;
/*******************************************************************************************************/
/* Infodots & content items */
/*******************************************************************************************************/


/* Represents an image on a virtual canvas with support of dynamic level of detail.
@param layerid (any type) id of the layer for this element
@param id (any type) id of an element
Expand Down Expand Up @@ -4559,6 +4561,7 @@ var CZ;
};

var self = this;

this.changeZoomLevel = function (curZl, newZl) {
var vy = self.newY;
var mediaTop = vy + verticalMargin;
Expand All @@ -4573,6 +4576,10 @@ var CZ;

// Media
var mediaID = id + "__media__";

var uri = this.contentItem.uri;
this.contentItem.uri = CZ.Service.MakeSecureUri(uri);

var imageElem = null;
if (this.contentItem.mediaType.toLowerCase() === 'image' || this.contentItem.mediaType.toLowerCase() === 'picture') {
imageElem = VCContent.addImage(container, layerid, mediaID, vx + leftOffset, mediaTop, contentWidth, mediaHeight, this.contentItem.uri);
Expand Down Expand Up @@ -4692,7 +4699,7 @@ var CZ;
}
var sz = 1 << zl;
var thumbnailUri = CZ.Settings.contentItemThumbnailBaseUri + 'x' + sz + '/' + contentItem.guid + '.png';

thumbnailUri = CZ.Service.MakeSecureUri(thumbnailUri);
return {
zoomLevel: newZl,
content: new CanvasImage(vc, layerid, id + "@" + 1, thumbnailUri, vx, vy, vw, vh)
Expand Down Expand Up @@ -7285,10 +7292,13 @@ var CZ;
this.isTourPlayRequested = false;
this.isAudioLoaded = false;
this.isAudioEnabled = false;

if (!bookmarks || bookmarks.length == 0) {
throw "Tour has no bookmarks";
}

this.audio = CZ.Service.MakeSecureUri(audio);

var self = this;
this.thumbnailUrl = CZ.Settings.contentItemThumbnailBaseUri + id + '.jpg';

Expand Down Expand Up @@ -10065,6 +10075,18 @@ var CZ;
var _dumpTimelinesUrl = "/dumps/home/timelines.json";
var _testLogin = false;

/*In the case of https connection changes uri's protocol to https if it needed
* @param uri (string) any uri to change
* @returns (string) changed uri
*/
function makeSecureUri(uri) {
if (window.location.protocol == "https:")
uri = uri.replace(/^http:/, "https:");
return uri;
}

Service.MakeSecureUri = makeSecureUri;

function Request(urlBase) {
var _url = urlBase;
var _hasParameters = false;
Expand Down Expand Up @@ -13506,8 +13528,8 @@ var CZ;

$('#mnuEmbed').children("ul").children("li").clicktouchoff();

var addressArray = window.location.href.split('#');
$('#mnuEmbedText').val("<iframe src=\"" + addressArray[0] + "czmin/#" + addressArray[1] + "\" style=\"height:600px; width:1024px;\"></iframe>");
var address = window.location;
$('#mnuEmbedText').val("<iframe src=\"https://" + address.host + "/czmin" + address.pathname + "\" style=\"height:600px; width:1024px;\"></iframe>");

$('#mnuProfile').clicktouch(function (event)
{
Expand Down Expand Up @@ -19897,11 +19919,12 @@ var CZ;

$.each(json, function (index, item)
{
var year = CZ.Dates.convertCoordinateToYear(item.Year);
var year = CZ.Dates.convertCoordinateToYear(item.Year);
var image = CZ.Service.MakeSecureUri(item.CustomBackground);
var tile = $templateExhibit
.replace( '{{collectionTitle}}', simpleClean(item.CollectionName))
.replace( '{{collectionCurator}}', item.CuratorName)
.replace( '{{exhibitImage}}', item.CustomBackground)
.replace( '{{exhibitImage}}', image)
.replace(new RegExp('{{exhibitTitle}}', 'g'), simpleClean(item.Title))
.replace( '{{exhibitYear}}', year.year + '&nbsp;' + year.regime)
.replace( '{{exhibitURL}}', item.Link)
Expand Down Expand Up @@ -19945,12 +19968,13 @@ var CZ;
$.each(json, function (index, item)
{
var url = item.TimelineUrl || '';
var image = item.ImageUrl || '';
var image = item.ImageUrl || '';

if (hasDefaultBackground(image)) image = '';
if (image === '' && isInCosmos(url)) image = cosmosImage;
if (item.CurrentCollection) url = '';

image = CZ.Service.MakeSecureUri(image);
var tile = $templateCollection
.replace( '{{collectionURL}}', url)
.replace( '{{collectionBackground}}', image)
Expand Down Expand Up @@ -19996,6 +20020,7 @@ var CZ;
if (hasDefaultBackground(image)) image = '';
if (item.IsCosmosCollection) image = cosmosImage;

image = CZ.Service.MakeSecureUri(image);
var tile = $templateTimeline
.replace(new RegExp('{{timelineTitle}}', 'g'), simpleClean(item.Title) || '')
.replace( '{{timelineURL}}', item.Link || '')
Expand Down
2 changes: 1 addition & 1 deletion Source/Chronozoom.UI/czmin.html
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@
</footer>
<footer class="fright" style=" position:relative;margin:0; width:185px; height:42px; bottom:15px; ">
<ul id="miniMenu" style="margin:0">
<li class="fright header-logo active miniMenu-logo">
<li class="fright cz-logo active miniMenu-logo">
<ul id="miniMenuText" style="padding:2%;padding-bottom:0; border-top-left-radius: 6px;position:fixed;z-index:-1;">
ChronoZoom is an open source community project owned by the Outercurve Foundation and dedicated to visualizing the history of everything.
ChronoZoom bridges the gap between the humanities and sciences using a notion of “Big History” to easily understand all this information.
Expand Down
Loading

0 comments on commit 97294cd

Please sign in to comment.