Skip to content
Snippets Groups Projects
Commit b88d7abf authored by rhaag's avatar rhaag
Browse files

OO-94 remove macartney #time 20min #resolve

parent 461e3efc
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 350 deletions
......@@ -179,12 +179,6 @@ YAML layout framework (Creative Commons Attribution 2.0 Lizenz,
see http://creativecommons.org/licenses/by/2.0/de) [http://www.yaml.de]
Please read the licensing terms of YAML if you plan to use OLAT in a commercial setup.
-----------------------------------------------------------------------
The OpenOLAT comic portlet uses comic strips produces by Alex Macartney
Please not that these comics are not public domain and must not be used for any
other purpose than beeing displayed in the OpenOLAT home portal
[http://www.macartney.ch]
-----------------------------------------------------------------------
EXTJS javascript framework [http://www.sencha.com]
......
/**
* OLAT - Online Learning and Training<br>
* http://www.olat.org
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Copyright (c) since 2004 at Multimedia- & E-Learning Services (MELS),<br>
* University of Zurich, Switzerland.
* <hr>
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* This file has been modified by the OpenOLAT community. Changes are licensed
* under the Apache 2.0 license as the original file.
*/
package org.olat.portal.macartney;
import java.util.Map;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.Component;
import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.generic.portal.AbstractPortlet;
import org.olat.core.gui.control.generic.portal.Portlet;
import org.olat.core.gui.translator.PackageTranslator;
import org.olat.core.util.Util;
/**
* Description:<br>
* Displays the the macartney of the day comic strip
* <P>
* Initial Date: 24.08.2005 <br>
* @author gnaegi
*/
public class MacartneyPortlet extends AbstractPortlet {
private Controller runCtr;
/**
* @see org.olat.gui.control.generic.portal.AbstractPortlet#createInstance(org.olat.core.gui.control.WindowControl, org.olat.core.gui.UserRequest, java.util.Map)
*/
public Portlet createInstance(WindowControl wControl, UserRequest ureq, Map configuration) {
Portlet p = new MacartneyPortlet();
p.setName(this.getName());
p.setConfiguration(configuration);
p.setTranslator(new PackageTranslator(Util.getPackageName(MacartneyPortlet.class), ureq.getLocale()));
return p;
}
/**
* @see org.olat.gui.control.generic.portal.Portlet#getTitle()
*/
public String getTitle() {
return getTranslator().translate("macartney.title");
}
/**
* @see org.olat.gui.control.generic.portal.Portlet#getDescription()
*/
public String getDescription() {
return getTranslator().translate("macartney.description");
}
/**
* @see org.olat.gui.control.generic.portal.Portlet#getInitialRunComponent(org.olat.core.gui.control.WindowControl, org.olat.core.gui.UserRequest)
*/
public Component getInitialRunComponent(WindowControl wControl, UserRequest ureq) {
if(this.runCtr != null) runCtr.dispose();
this.runCtr = new MacartneyPortletRunController(ureq, wControl, getConfiguration());
return this.runCtr.getInitialComponent();
}
/**
* @see org.olat.core.gui.control.Disposable#dispose(boolean)
*/
public void dispose() {
disposeRunComponent();
}
/**
* @see org.olat.gui.control.generic.portal.Portlet#getCssClass()
*/
public String getCssClass() {
return "o_portlet_macartney";
}
/**
* @see org.olat.gui.control.generic.portal.Portlet#disposeRunComponent(boolean)
*/
public void disposeRunComponent() {
if (this.runCtr != null) {
this.runCtr.dispose();
this.runCtr = null;
}
}
}
/**
* OLAT - Online Learning and Training<br>
* http://www.olat.org
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Copyright (c) since 2004 at Multimedia- & E-Learning Services (MELS),<br>
* University of Zurich, Switzerland.
* <hr>
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* This file has been modified by the OpenOLAT community. Changes are licensed
* under the Apache 2.0 license as the original file.
*/
package org.olat.portal.macartney;
import java.text.DecimalFormat;
import java.util.Map;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.Component;
import org.olat.core.gui.components.velocity.VelocityContainer;
import org.olat.core.gui.control.DefaultController;
import org.olat.core.gui.control.Event;
import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.translator.PackageTranslator;
import org.olat.core.gui.translator.Translator;
import org.olat.core.helpers.Settings;
import org.olat.core.util.Util;
import org.olat.core.util.coordinate.CoordinatorManager;
import org.olat.core.util.coordinate.SyncerExecutor;
import org.olat.core.util.resource.OresHelper;
import org.olat.properties.Property;
import org.olat.properties.PropertyManager;
/**
* Description:<br>
* Run view controller of macartney portlet
* <P>
* Initial Date: 11.07.2005 <br>
*
* @author gnaegi
*/
public class MacartneyPortletRunController extends DefaultController {
private static final String VELOCITY_ROOT = Util.getPackageVelocityRoot(MacartneyPortlet.class);
private Translator trans;
private VelocityContainer macartneyVC;
private static final String PROPERTY_NAME = "comicStart";
private static final String PROPERTY_CATEGORY = "macartneyPortal";
private static final int maxEpisodes = 468;
private static final long updateInterval = 86400000; // one day in milliseconds
private static long comicStartDate = 0;
/**
* Constructor
*
* @param ureq
* @param imageBaseUri
*/
//o_clusterOK by:se synchronized on MacartneyPortlet class as olatresourceable
protected MacartneyPortletRunController(UserRequest ureq, WindowControl wControl, Map configuration) {
super(wControl);
this.trans = new PackageTranslator(Util.getPackageName(MacartneyPortlet.class), ureq.getLocale());
this.macartneyVC = new VelocityContainer("macartneyVC", VELOCITY_ROOT + "/macartneyPortlet.html", trans, this);
if (comicStartDate == 0) {
CoordinatorManager.getInstance().getCoordinator().getSyncer().doInSync(
OresHelper.createOLATResourceableType(MacartneyPortletRunController.class.getSimpleName()),
new SyncerExecutor() {
@SuppressWarnings("synthetic-access")
public void execute() {
if (comicStartDate!=0) {
// then we shouldn't have gotten here in the first place, but we were
// racing with another userrequest in the same VM!
// let's quit quickly ;)
return;
}
// load comic start date only once
PropertyManager pm = PropertyManager.getInstance();
Property p = pm.findProperty(null, null, null, PROPERTY_CATEGORY, PROPERTY_NAME);
if (p == null) {
// wow first time ever, save current date
p = pm.createPropertyInstance(null, null, null, PROPERTY_CATEGORY, PROPERTY_NAME, null, null, null, null);
pm.saveProperty(p);
}
comicStartDate = p.getCreationDate().getTime();
}
});
}
// time between comic start and now
long timeDelta = (System.currentTimeMillis() - comicStartDate);
// number of increments since comic start
long incrementNumber = (timeDelta / updateInterval);
// module with max episodes to start over again when finished
// + 1 since comic starts at position 1 and not 0
long imageNumber = (incrementNumber % maxEpisodes) + 1;
// calculate current episode url and push to velocity
DecimalFormat df = new DecimalFormat("0000");
String currentEpisodeImage = "loge_" + df.format(imageNumber) + ".jpg";
final String configuredImageBaseUri = (String) configuration.get("imageBaseUri");
if (configuredImageBaseUri.startsWith("http://") || configuredImageBaseUri.startsWith("https://")) {
// feature: if the configured imageBaseUri contains http: or https: already, don't do
// magic "trying-to-detect-the-correct-protocol-via-olat.properties" but use it right away
this.macartneyVC.contextPut("imageBaseUri", configuredImageBaseUri);
} else {
// otherwise do the old magic
this.macartneyVC.contextPut("imageBaseUri", Settings.getURIScheme() + configuredImageBaseUri);
}
this.macartneyVC.contextPut("currentEpisodeImage", currentEpisodeImage);
setInitialComponent(this.macartneyVC);
}
public void event(UserRequest ureq, Component source, Event event) {
// no events to catch
}
protected void doDispose() {
// nothing to dispose
}
}
<!-- Copyright by Alex Macartney, www.macartney.ch - Thanks Alex for supporting OLAT with you comic -->
<a href="http://www.macartney.ch" target="_blank">
<img src="${imageBaseUri}klein/${currentEpisodeImage}" id="o_macartney" border="0" width="100%" alt="Macartney Comic" />
</a>
<br />
<div id="o_macartney_open" class="b_float_right"></div>
<i><a class="b_link_extern" href="http://www.macartney.ch" target="_blank">$r.translate("macartney.copyright")</a></i>
<script type="text/javascript">
/* <![CDATA[ */
Ext.onReady(function(){
## Add large image version at the top of the page. Uses the Prototype library
new Insertion.Top($('b_page_margins'), "<div id='o_macartney_large' style='display: none;'><img src='${imageBaseUri}gross/${currentEpisodeImage}' border='0' alt='Macartney Comic'/><div id='o_macartney_close'></div></div>");
## Add event handlers to slide large image in and out. Uses the Extjs library
## show image when user has mouse over loop tool
Ext.get('o_macartney_open').hover(
function(){ Ext.get('o_macartney_large').fadeIn(); },
function(){ Ext.get('o_macartney_large').fadeOut(); }
);
## close fallback:
## close when user hovers over close icon
Ext.get('o_macartney_close').on('mouseover', function(e){
Ext.get('o_macartney_large').slideOut();
});
## close when user clicks on large image
Ext.get('o_macartney_large').on('click', function(e){
Ext.get('o_macartney_large').slideOut();
});
});
/* ]]> */
</script>
\ No newline at end of file
#Fri Feb 19 23:40:50 CET 2010
macartney.copyright=macartney.ch \u062D\u0642\u0648\u0642 \u0627\u0644\u062A\u0623\u0644\u064A\u0641 \u0648\u0627\u0644\u0646\u0634\u0631 \u0645\u062D\u0641\u0648\u0638\u0629 \u0644\u0640
macartney.description=\u0643\u0644 \u064A\u0648\u0645 \u0647\u0632\u0644\u064A\u0629 \u062C\u062F\u064A\u062F\u0629 \u0644\u0645\u0627\u0643\u0627\u0631\u062A\u0646\u0649
macartney.title="Die Loge" \:\u0647\u0632\u0644\u064A\u0629 \u0645\u0643\u0627\u0631\u062A\u0646\u0649
#Sun May 24 21:10:48 CEST 2009
macartney.copyright=\u0410\u0432\u0442\u043E\u0440\u0441\u043A\u043E \u043F\u0440\u0430\u0432\u043E\: macartney.ch
macartney.description=\u0414\u043D\u0435\u0432\u043D\u0438\u044F\u0442 \u043A\u043E\u043C\u0438\u043A\u0441 \u043E\u0442 Macartney
macartney.title=Macartney \u043A\u043E\u043C\u0438\u043A\u0441\: "Die Loge"
#Mon Mar 02 09:54:14 CET 2009
macartney.copyright=Copyright by macartney.ch
macartney.description=Denn\u011B comics od Macartneyho
macartney.title=Macartney Comic\: "Die Loge"
#Mon Mar 02 09:54:09 CET 2009
macartney.copyright=Copyright macartney.ch
macartney.description=En daglig Macartney tegneseriestribe
macartney.title=Macartney Comic\: "Die Loge"
#Mon Mar 02 09:54:04 CET 2009
macartney.copyright=Eigentum von macartney.ch
macartney.description=T\u00E4glich ein neuer Macartney Comic
macartney.title=Macartney Comic\: Die Loge
#Mon Mar 02 09:54:16 CET 2009
macartney.copyright=Copyright by macartney.ch
macartney.description=\u039A\u03B1\u03B8\u03B7\u03BC\u03B5\u03C1\u03B9\u03BD\u03CC \u03C3\u03C4\u03B9\u03B3\u03BC\u03C5\u03CC\u03C4\u03C5\u03C0\u03BF \u03BA\u03B1\u03C1\u03C4\u03BF\u03CD\u03BD Macartney
macartney.title=\u039A\u03B1\u03C1\u03C4\u03BF\u03CD\u03BD Macartney \: "Die Loge"
#Mon Mar 02 09:54:18 CET 2009
macartney.copyright=Copyright by macartney.ch
macartney.description=A daily Macartney comic strip
macartney.title=Macartney Comic\: "Die Loge"
#Mon Mar 02 09:54:21 CET 2009
macartney.copyright=Copyright by macartney.ch
macartney.description=Cada d\u00EDa un nuevo comic de Macartney
macartney.title=Macartney Comic\: Die Loge
#Mon Mar 02 09:54:13 CET 2009
macartney.copyright=macartney.ch \u062D\u0642 \u0686\u0627\u067E
macartney.description=\u06CC\u06A9 \u06A9\u0627\u0631\u062A\u0648\u0646 \u06A9\u0645\u062F\u06CC \u0631\u0648\u0632\u0627\u0646\u0647 \u0627\u0632 \u0645\u06A9\u0627\u0631\u062A\u0646\u06CC
macartney.title=Macartney Comic\: "Die Loge"/\u06A9\u0645\u062F\u06CC \u0645\u06A9\u0627\u0631\u062A\u0646\u06CC
#Mon Mar 02 09:54:08 CET 2009
macartney.copyright=Propri\u00E9t\u00E9 de macartney.ch
macartney.description=Tous les jours une nouvelle B.D. de Macartney
macartney.title=B.D. Macartney\: Die Loge
#Mon Mar 02 09:54:10 CET 2009
macartney.copyright=Propriet\u00E0 di macartney.ch
macartney.description=Tutti i giorni una nuova vignetta Macartney
macartney.title=Vignetta Macartney
#Thu Apr 16 22:42:13 CEST 2009
macartney.copyright=macartney.ch\u306E\u8457\u4F5C\u6A29
macartney.description=\u30C7\u30A4\u30EA\u30FCMacartney\u30B3\u30DF\u30C3\u30AF\u30B9\u30C8\u30EA\u30C3\u30D7
macartney.title=Macartney\u30B3\u30DF\u30C3\u30AF\: "Die Loge"
#Mon Mar 02 09:54:02 CET 2009
macartney.copyright=Autoriaus teis\u0117s priklauso macartney.ch
macartney.description=Kasdieninei Macartney komiksai
macartney.title=Macartney Comic\: "Die Loge"
#Mon May 31 14:05:55 CEST 2010
macartney.copyright=Copyright by macartney.ch
macartney.description=Dagelijks een nieuw Macartney stripverhaal
macartney.title=Macartney Stripverhaal\: "De Loge"
#Mon Mar 02 09:54:17 CET 2009
macartney.copyright=Prawa autorskie macartney.ch
macartney.description=Komiks Macartney'a
macartney.title=Komiks Macartney'a\: Die Loge
#Mon Mar 02 09:54:00 CET 2009
macartney.copyright=Direitos Reservados por macartney.ch
macartney.description=Tira di\u00E1ria dos quadrinhos Macartney
macartney.title=Quadrinhos Macartney\: "Die Loge"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment