Skip to content

Commit

Permalink
updated to v.01.08.01
Browse files Browse the repository at this point in the history
  • Loading branch information
iJungleboy committed Sep 18, 2016
1 parent a93b6ff commit 138808f
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 65 deletions.
7 changes: 5 additions & 2 deletions .data/app.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<SexyContent FileVersion="07.00.00" MinimumRequiredVersion="07.00.00" ModuleVersion="08.05.02" ExportDate="2016-09-18T17:58:48.3267007+02:00">
<SexyContent FileVersion="07.00.00" MinimumRequiredVersion="07.00.00" ModuleVersion="08.05.02" ExportDate="2016-09-18T21:50:30.4577707+02:00">
<Header>
<App Guid="58c02a22-9e89-42c0-a2d7-7cd8db105de5" />
<Language Default="en-US" />
Expand Down Expand Up @@ -161,12 +161,15 @@
<Entity AssignmentObjectType="App" AttributeSetStaticName="2SexyContent-App" AttributeSetName="2SexyContent-App" EntityGUID="df41031f-c359-40ed-9cad-fe0f85a1f546" KeyNumber="24">
<Value Key="DisplayName" Value="TimelineJS" Type="String" />
<Value Key="Description" Value="A timeline App for creating nice timelines. It's basically a DNN-wrapper for the awesome TimelineJS" Type="String" />
<Value Key="Version" Value="00.01.02" Type="String" />
<Value Key="Version" Value="01.08.01" Type="String" />
<Value Key="Folder" Value="TimelineJS" Type="String" />
<Value Key="AllowTokenTemplates" Value="False" Type="Boolean" />
<Value Key="AllowRazorTemplates" Value="True" Type="Boolean" />
<Value Key="Hidden" Value="False" Type="Boolean" />
<Value Key="OriginalId" Value="58c02a22-9e89-42c0-a2d7-7cd8db105de5" Type="String" />
<Value Key="RequiredVersion" Value="08.03.00" Type="String" />
<Value Key="RequiredDnnVersion" Value="07.02.00" Type="String" />
<Value Key="SupportsAjaxReload" Value="False" Type="Boolean" />
</Entity>
<Entity AssignmentObjectType="App" AttributeSetStaticName="App-Settings" AttributeSetName="App-Settings" EntityGUID="c45c4651-96d9-4717-9f2b-5892994a6279" KeyNumber="24" />
<Entity AssignmentObjectType="App" AttributeSetStaticName="App-Resources" AttributeSetName="App-Resources" EntityGUID="d4798585-e2bd-4f54-960f-7ce4b8057298" KeyNumber="24" />
Expand Down
2 changes: 1 addition & 1 deletion Timeline.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script type="text/javascript" src="/DesktopModules/ToSIC_SexyContent/Js/2sxc.api.js" data-enableoptimizations="true"></script>
<script type="text/javascript" src="/DesktopModules/ToSIC_SexyContent/Js/2sxc.api.min.js" data-enableoptimizations="true"></script>
<script type="text/javascript" src="[App:Path]/assets/TimelineJS/js/storyjs-embed.js"></script>
<script type="text/javascript" src="[App:Path]/assets/scripts.js" data-enableoptimizations="true"></script>
<link rel="stylesheet" type="text/css" href="[App:Path]/assets/styles.css" data-enableoptimizations="true" />
Expand Down
Binary file added app-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
138 changes: 76 additions & 62 deletions assets/scripts.js
Original file line number Diff line number Diff line change
@@ -1,80 +1,94 @@

$(document).ready(function () {
$(function () {

// Process each Timeline element on the page
// Process each Timeline DOM-element on the page
$(".timeline-embed").each(function() {

// Define our timeline element, get moduleId
var timeLineElement = $(this);
var moduleId = timeLineElement.attr("data-moduleid");

// Load the data from the 2SexyContent module and define a callback
$2sxc(moduleId).data.on("load", function (source, data) {

// Re-format streams that are contained in data
var content = data.in.Default.List;
var listContent = data.in.ListContent.List[0];
var timelineData = getTimelineData(moduleId, content, listContent);

// Create the timeline
createStoryJS({
type: 'timeline',
width: '' + timeLineElement.width(),
height: timeLineElement.height(),
source: timelineData,
embed_id: timeLineElement.attr("id"),
start_at_slide: listContent.StartAtSlide,
start_zoom_adjust: listContent.StartZoomAdjust
});
// old sxc-initalizer, before 2sxc 8; included for reference if you have an older 2sxc
// var moduleId = timeLineElement.attr("data-moduleid");
// var sxc = $2sxc(moduleId);

// new method since 2sxc 8, using the simpler DOM initializer - see https://github.com/2sic/2sxc/wiki/JavaScript-%242sxc
var sxc = $2sxc(this);

// Load the data from the 2SexyContent module and define a callback
sxc.data.on("load", function (source, data) {
processDataAndCreateTimeline(source, data, sxc.id, timeLineElement)
}).load();

});

});
// what should happen on loading of the data:
function processDataAndCreateTimeline (source, data, moduleId, timeLineElement) {

// Reformat data from 2sxcContent, so TimelineJS can work with it
function getTimelineData(moduleId, content, listContent) {
// Re-format streams that are contained in data
var content = data.in.Default.List;
var listContent = data.in.ListContent.List[0];
var timelineData = getTimelineData(moduleId, content, listContent);

var isEditMode = $2sxc(moduleId).isEditMode();
// Create the timeline
createStoryJS({
type: 'timeline',
width: '' + timeLineElement.width(),
height: timeLineElement.height(),
source: timelineData,
embed_id: timeLineElement.attr("id"),
start_at_slide: listContent.StartAtSlide,
start_zoom_adjust: listContent.StartZoomAdjust
});

if (isEditMode) {
var listToolbar = $2sxc(moduleId).manage.getToolbar({ "entity": listContent, "action": "edit" });
listContent.Text += listToolbar;
}

var timelineData = {
"timeline": {
"headline": listContent.Headline,
"type": "default",
"text": listContent.Text,
"startDate": FormatDate(listContent.StartDate),
"date": $.map(content, function (entry) {

if (isEditMode) {
var toolbar = $2sxc(moduleId).manage.getToolbar([{ "entity": entry, "action": "edit" }, { "entity": entry, "action": "new" }]);
entry.Body += toolbar;
}

return {
"startDate": FormatDate(entry.StartDate),
"endDate": FormatDate(entry.EndDate),
"headline": entry.Headline,
"text": entry.Body,
"classname": "sc-element",
"asset": {
"media": entry.Media,
"credit": entry.MediaCredit,
"caption": entry.MediaCaption
}
};
})

// Reformat data from 2sxcContent, so TimelineJS can work with it
function getTimelineData(moduleId, content, listContent) {

var isEditMode = $2sxc(moduleId).isEditMode();

if (isEditMode) {
var listToolbar = $2sxc(moduleId).manage.getToolbar({ "entity": listContent, "action": "edit" });
listContent.Text += listToolbar;
}
};
return timelineData;
}

function FormatDate(dateString) {
var date = new Date(dateString);
return date.getFullYear() + "," + (date.getMonth() + 1) + "," + date.getDate() + ",";
}

var timelineData = {
"timeline": {
"headline": listContent.Headline,
"type": "default",
"text": listContent.Text,
"startDate": FormatDate(listContent.StartDate),
"date": $.map(content, function (entry) {

if (isEditMode) {
var toolbar = $2sxc(moduleId).manage.getToolbar([{ "entity": entry, "action": "edit" }, { "entity": entry, "action": "new" }]);
entry.Body += toolbar;
}

return {
"startDate": FormatDate(entry.StartDate),
"endDate": FormatDate(entry.EndDate),
"headline": entry.Headline,
"text": entry.Body,
"classname": "sc-element",
"asset": {
"media": entry.Media,
"credit": entry.MediaCredit,
"caption": entry.MediaCaption
}
};
})
}
};
return timelineData;
}

function FormatDate(dateString) {
var date = new Date(dateString);
return date.getFullYear() + "," + (date.getMonth() + 1) + "," + date.getDate() + ",";
}



});

0 comments on commit 138808f

Please sign in to comment.