Dienstag, 27. Dezember 2005
Antville (Weiter)entwicklungen
philipp, 00:44h
Nachdem sich ja auf der antville Liste nichts seit einem Jahr getan hat, werde ich hier beginnen Erweiterungen zu posten:
Die kann sicher wer brauchen.
Nachdem es jetzt auch twoday_open gibt hier ein "kleines" update script das die Datenbank von antville auf den Stand von twoday_open bringt und die Datensätze modifiziert.
!!!Achtung!!! zuerst ein Datenbank-Backup machen bevor man das sql drüberlaufen läßt! Ich übernehme keine Garantie für irgendwelche Schäden oder Datenverluste.
update (sql, 5 KB)
Das Script funktioniert nur auf mysql wenn mich nicht alles täuscht.
Ein Problem hab ich noch. Im StoryMgr werden jetzt auf einmal sämtliche Beiträge die eigentlich online sein sollten als offline angezeigt, weil das switch macro nicht richtig funktioniert.
- tag_module (zip, 64 KB)
- antirefspam_module (zip, 9 KB): trappes referrer spam. In HopObject/onRequest() muß man als erste Instruction "root.refspam.track();" eintragen.
- css_module (zip, 10 KB)
- rss2_module (zip, 15 KB): enthält eine neue rss2 und rss2.xml action die einen validierenden rss2 Feed enthält.
![[Valid RSS] [Valid RSS]](http://static.brandnews.at/pm/images/valid-rss.png)
- capture_module.tar (gz, 10 KB): enthält eine action auf Site Ebene die ein Bild mit einem zufälligen Text generiert. Die Technologie dahinter benutzt SVG-XML Files und batik.
Ich habe batik und svg gewählt, weil man damit eine hohe Flexibilität, wie das Bild, die Schrift usw auszusehen hat, bekommt.
Performance Tests Zeigen das es beim ersten Aufruf 4 Sekunden auf helma Seite vergehen. Folge Aufrufe brauchen dann nur mehr 40-60 millis (Quelle: Logfiles :).
Damit mein Modul funktioniert braucht man batik und xerces. - action_export (js, 10 KB): Exportiert eine Antville Installation in eine neue Datenbank
Die kann sicher wer brauchen.
Nachdem es jetzt auch twoday_open gibt hier ein "kleines" update script das die Datenbank von antville auf den Stand von twoday_open bringt und die Datensätze modifiziert.
!!!Achtung!!! zuerst ein Datenbank-Backup machen bevor man das sql drüberlaufen läßt! Ich übernehme keine Garantie für irgendwelche Schäden oder Datenverluste.
update (sql, 5 KB)
Das Script funktioniert nur auf mysql wenn mich nicht alles täuscht.
Ein Problem hab ich noch. Im StoryMgr werden jetzt auf einmal sämtliche Beiträge die eigentlich online sein sollten als offline angezeigt, weil das switch macro nicht richtig funktioniert.
philipp,
Mittwoch, 4. Jänner 2006, 18:35
[Update] RSS2 Modul
Die rss2_action und die rss2_xml_action produzieren jetzt einen leeren (ohne items) rss2 feed der valide ist, wenn die Site offline ist.
Falls der Benutzer eingelogged ist und er viewer Rechte für die Site hat, wird ein Feed mit items produziert.
Falls der Benutzer eingelogged ist und er viewer Rechte für die Site hat, wird ein Feed mit items produziert.
... link
... kommentieren
philipp,
Samstag, 14. Jänner 2006, 12:38
[Update] Capture Modul
Jetzt mit eigenem Capture Object. Eine action für das generieren des Bildes auf Site und Root Ebene. Die zwei actions gibt es deshalb weil Leute mit eigener Domain können nur bis auf Ihr Site Objekt zugreifen, wegen des hrefRootPrototype = Site.
Globales macro und Skins für Root und Site für Generierung des Image Tags mit Link zum Bild austauschen.
Grafik mit mehr Zufalls Objekten und Linien.
Zu bewundern unter:
http://weblogs.brandnews.at/pm/members/register
oder
http://weblogs.brandnews.at/members/register
Dort wurde das Ganze mit aspects an die register_action und an die evalRegistration angehängt und zwar mit folgendem Code:
Die Funktionen evalCaptureCode und createCaptureImage wurden natürlich erst von mir geschrieben und über ein Security Modul eingebunden.
Globales macro und Skins für Root und Site für Generierung des Image Tags mit Link zum Bild austauschen.
Grafik mit mehr Zufalls Objekten und Linien.
Zu bewundern unter:
http://weblogs.brandnews.at/pm/members/register
oder
http://weblogs.brandnews.at/members/register
Dort wurde das Ganze mit aspects an die register_action und an die evalRegistration angehängt und zwar mit folgendem Code:
app.modules.modSecurity.onMemberMgrCodeUpdate = function() {
Helma.Aspects.addBefore(MemberMgr.prototype, "evalRegistration", MemberMgr.prototype.evalCaptureCode);
Helma.Aspects.addBefore(MemberMgr.prototype, "register_action", MemberMgr.prototype.createCaptureImage);
return;
}
Die Funktionen evalCaptureCode und createCaptureImage wurden natürlich erst von mir geschrieben und über ein Security Modul eingebunden.
... link
... kommentieren
philipp,
Samstag, 25. Februar 2006, 11:34
Kleines Helferlein
Hier ein kleines Globales macro das sehr hilfreich ist wenn man css Klassen oder Überschriften rausrendern will:
/**
* Renders a specialpagename (like imagetopics, topics) or topicname or a storyid
* depending on what is
*
* the default behavior is to render topicname or storyid
* if no topicname or storyid is found look for "special" page (imageTopics, topics)
* if found render the navigationname
* if NOT found render noClass
*
* the default behavior can be overwriten by params
*
* @param what topic or storyid
*
* @param empty (optional) if set nothing is rendered if no story, no topic or no special page found
* @param nospecialpages (optional) if set special pages are ignored if no topic or storyid found
* @param removewhitespace (optional) if set removes whitespaces from returned string
* should be used for use in CSS files
* @param imagetopicmgrname (optional) name to return for ImageTopicMgr
* @param topicmgrname (optional) name to return for TopicMgr
*
* @return the topicname, the storyid or a special page name
**/
function currentObjectSelector_macro(param) {
var returnString = "";
// what to render
var what = param.what && param.what == "topic" ? "topic" : "storyid";
if (what == "topic") {
// check if in topic
if (path.Topic) {
returnString = path.Topic.getNavigationName();
}
// check if story with topic
if (path.Story && path.Story.topic) {
returnString = path.Story.topic;
}
} else if (path.Story) {
returnString = path.Story._id;
}
// only look for special page if topic or storyid not found
if (returnString.length == 0 && !param.nospecialpages) {
// look if we are in Special Pages
// "ImageTopicMgr"
if (path.ImageMgr && path.TopicMgr) {
returnString = (param.imagetopicmgrname || path.TopicMgr.getNavigationName());
// TopicMgr without ImageMgr
} else if (path.TopicMgr) {
returnString = (param.topicmgrname || path.TopicMgr.getNavigationName());
}
}
// if we have something to return remove whitespaces!
if (returnString.length > 0) {
return param.removewhitespace ? returnString.replace(/\s/g, "") : returnString;
}
if (param.empty) {
return "";
} else {
return "noClass";
}
}
... link
philipp,
Samstag, 25. Februar 2006, 11:55
skin rendern wenn topic gefunden
/**
* Renders a topic prototype skin depending on a topicname
*
* @param skin the name of the skin to render
* @param topicname the name of the topic. if current topic matches topicname, skin is rendered
* if set to _auto renders the skin prefixed by topicname whitespaces removed
* if set to _allways renders the skin everytime a topic is present
* @param ignoreCase the case of the topic is ignored (transformed to lowercase)
*
**/
function skinTopicSelector_macro(param) {
var theTopicName = param.topicname;
theTopicName = param.ignoreCase ? theTopicName.toLowerCase() : theTopicName;
var skin = param.skin;
if (!theTopicName || !skin) {
return;
}
var theTopic = null;
// check if in topic
if (path.Topic) {
theTopic = path.Topic;
} else if (path.Story && path.Story.topic) {
theTopic = res.handlers.site.topics.get(path.Story.topic);
}
// no topic found
if (!theTopic) {
return;
}
var currentTopicName = param.ignoreCase ? theTopic.groupname.toLowerCase() : theTopic.groupname;
if (theTopicName == "_auto") {
// should check if skin exists
// remove whitespaces
theTopic.renderSkin(currentTopicName.replace(/\s/g, "") + skin);
// needed to render skin if topic present
} else if (theTopicName == "_allways") {
theTopic.renderSkin(skin);
// a topic selector
} else if (theTopicName == currentTopicName) {
theTopic.renderSkin(skin);
}
return;
}
... link
... kommentieren
philipp,
Samstag, 27. Mai 2006, 13:39
[Update] Tag Modul
Hatte einige security holes wie das anzeigen von tags von Beiträgen die offline sind.
RootTagMgr funktioniert jetzt auch ebenfalls mit abfrage ob Site online und show on front page.
Performance Tuning, SQL Abfrage generiert für mehr als 25 Tags.
RootTagMgr funktioniert jetzt auch ebenfalls mit abfrage ob Site online und show on front page.
Performance Tuning, SQL Abfrage generiert für mehr als 25 Tags.
... link
... kommentieren

... 



