Added: incubator/wookie/trunk/widgets/forum/forumutils.js
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/forum/forumutils.js?rev=884068&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/forum/forumutils.js (added)
+++ incubator/wookie/trunk/widgets/forum/forumutils.js Wed Nov 25 12:29:11 2009
@@ -0,0 +1,303 @@
+/*
+**************** DEFAULT FORUM WIDGET **************
+******************************************************
+*/
+var isDebug = false;
+var instanceid_key;
+var username="";
+var forumText="";
+var currentPost=null;
+var isLocked = false;
+var sharedDataKey = null;
+var isAdmin = false;
+var isdActive=false;
+
+
+// on start up set some values & init with the server
+function init() {
+if (isDebug) DebugHelper.debug("<function init start>");
+ instanceid_key = Widget.getInstanceKey();
+ if (isDebug) DebugHelper.debug("<function init start 2>");
+ Widget.preferenceForKey("username", setLocalUsername);
+}
+
+
+function isAdminUser(){
+ return isAdmin;
+}
+
+// set the local username
+function setLocalUsername(p){
+ if (isDebug) DebugHelper.debug("<function setLocalUsername start>|
param="+p);
+ if(username == ""){
+ if(p == "null"){
+ username = "User "+ Math.floor((Math.random() * 900) +
100);
+ }
+ else {
+ username = p;
+ }
+ }
+ Widget.preferenceForKey("conference-manager", getConferenceManagerRole);
+}
+
+function getConferenceManagerRole(p){
+ if (isDebug) DebugHelper.debug("<function setConferenceManagerRole
start>| param="+p);
+ if(p == "true") isAdmin = true;
+ Widget.preferenceForKey("moderator", getModeratorRole);
+}
+
+function getModeratorRole(p){
+ if (isDebug) DebugHelper.debug("<function setModeratorRole start>|
param="+p);
+ if(p == "true") isAdmin = true;
+ Widget.preferenceForKey("sharedDataKey", initSharedKey);
+}
+
+function initSharedKey(sharedKey){
+ if (isDebug) DebugHelper.debug("<function initsharedkey start>|
param="+sharedKey);
+ sharedDataKey = sharedKey;
+ Widget.sharedDataForKey("isLocked", setupInput);
+}
+
+function setupInput(isLockedValue){
+ if (isDebug) DebugHelper.debug("<function setupinput start>|
param="+isLockedValue);
+ if(isLockedValue!="true"){
+ handleUnlocked(sharedDataKey);
+ }
+ else{
+ handleLocked(sharedDataKey);
+ }
+}
+
+function getAdminInactiveToolsStr(){
+ var adminInactiveToolsStr = "<a href=\"#\"
onclick=\"unlockforum()\"><img border=\"0\"
src=\"/wookie/shared/images/unlock.gif\" alt=\"" +
LanguageHelper.getLocalizedString('Unlock this widget') + "\"></a>";
+ return adminInactiveToolsStr;
+}
+
+function getAdminActiveToolsStr(){
+ var adminActiveToolsStr = " ";
+ adminActiveToolsStr += "<a href=\"#\" onclick=\"lockforum()\"><img
border=\"0\" src=\"/wookie/shared/images/lock.gif\" alt=\"" +
LanguageHelper.getLocalizedString('Lock this widget') + "\"> " +
LanguageHelper.getLocalizedString('Lock this widget') + "</a>";
+ return adminActiveToolsStr;
+}
+
+function getInactiveToolsStr(){
+ var inactiveToolsStr = " <b>" +
LanguageHelper.getLocalizedString('This widget has been locked') + "</b> ";
+ if(isAdminUser()){
+ inactiveToolsStr += getAdminInactiveToolsStr();
+ }
+ return inactiveToolsStr;
+}
+
+function getActiveToolsStr(){
+ var activeToolsStr = " " +
LanguageHelper.getLangOpts(getActiveToolsStrUpdated);
+ activeToolsStr += "<a href=\"#\" onclick=\"postNewTopic(-1)\"><img
border=\"0\" src=\"/wookie/shared/images/plus.gif\"> " +
LanguageHelper.getLocalizedString('Post new topic') + "</a>";
+ activeToolsStr += " <a href=\"#\"
onclick=\"forum.getNodeTree('"+instanceid_key+"', getTreeData);\"><img
border=\"0\" src=\"/wookie/shared/images/refresh.gif\"> " +
LanguageHelper.getLocalizedString('Refresh') + "</a>";
+ if(isAdminUser()){
+ activeToolsStr += getAdminActiveToolsStr();
+ }
+ return activeToolsStr;
+}
+
+function getActiveToolsStrUpdated(){
+ var resStr = getActiveToolsStr();
+ dwr.util.setValue("foot", resStr, { escapeHtml:false });
+}
+
+function getTreeData(param){
+
+// wipe the current list before rebuilding it
+ forumText="";
+ buildTree(param);
+ dwr.util.setValue("content", forumText, { escapeHtml:false });
+
+ var toolsStr = "";
+ if (isLocked){
+ toolsStr = getInactiveToolsStr();
+ }
+ else{
+ toolsStr = getActiveToolsStr();
+ }
+ dwr.util.setValue("foot", toolsStr, { escapeHtml:false });
+}
+
+function buildTree(postlist){
+ forumText+="<ul>";
+ for (var data in postlist) {
+ forumText+= "<li><b><a href=\"#\"
onclick=\"forum.getPost('"+instanceid_key+"','"+postlist[data].id+"',
openPost)\";>" +
+ dwr.util.escapeHtml(postlist[data].title) +
"</a></b><i> " +
+ dwr.util.escapeHtml("added
"+formatDate(postlist[data].publishDate)) +" by " +
+ dwr.util.escapeHtml(postlist[data].userId) + " " +
+ "</i></li>";
+ buildTree(postlist[data].posts);
+ }
+ forumText+="</ul>";
+}
+
+// we ask the server for this in case its been deleted & we try to add a child.
+function openPost(openPost){
+ if(openPost==null){
+ alert(LanguageHelper.getLocalizedString('Record no longer
exists in Database, probably deleted by another user'));
+ forum.getNodeTree(instanceid_key, getTreeData);
+ }
+ else{
+ var toolsStr="";
+ var viewPostStr = getViewPostLayout(openPost);
+ dwr.util.setValue("content", viewPostStr, { escapeHtml:false });
+ currentPost = openPost;
+ toolsStr +="& ";
+ if(!isLocked){
+ toolsStr +="<a href=\"#\"
onclick=\"getReplyToPostLayout()\"><img border=\"0\"
src=\"/wookie/shared/images/go.gif\"> " +
LanguageHelper.getLocalizedString('Reply') + "</a> ";
+ }
+ toolsStr +="<a href=\"#\"
onclick=\"forum.getNodeTree('"+instanceid_key+"', getTreeData);\"><img
border=\"0\" src=\"/wookie/shared/images/cancel.gif\"> " +
LanguageHelper.getLocalizedString('Cancel') + "</a>";
+ dwr.util.setValue("foot", toolsStr, { escapeHtml:false });
+ }
+}
+
+function getReplyToPostLayout(){
+ var replyStr="";
+ replyStr+=getViewPostLayout(currentPost)
+ replyStr+=getNewPostLayout(currentPost.id);
+ dwr.util.setValue("content", replyStr, { escapeHtml:false });
+
+ var postNewTopicContent="";
+ postNewTopicContent+=" ";
+ postNewTopicContent+="<a href=\"#\"
onclick=\"postIt("+currentPost.id+")\"><img border=\"0\"
src=\"/wookie/shared/images/go.gif\"> " +
LanguageHelper.getLocalizedString('Post') + "</a>";
+ postNewTopicContent+=" <a href=\"#\"
onclick=\"forum.getNodeTree('"+instanceid_key+"',getTreeData);\"><img
border=\"0\" src=\"/wookie/shared/images/cancel.gif\"> " +
LanguageHelper.getLocalizedString('Cancel') + "</a>";
+ dwr.util.setValue("foot", postNewTopicContent, { escapeHtml:false });
+}
+
+function postNewTopic(parentPostId){
+ var newPostStr = getNewPostLayout(parentPostId);
+ dwr.util.setValue("content", newPostStr, { escapeHtml:false });
+ var postNewTopicContent="";
+ postNewTopicContent+=" ";
+ postNewTopicContent+="<a href=\"#\"
onclick=\"postIt("+parentPostId+")\"><img border=\"0\"
src=\"/wookie/shared/images/go.gif\"> " +
LanguageHelper.getLocalizedString('Post') + "</a>";
+ postNewTopicContent+=" <a href=\"#\"
onclick=\"forum.getNodeTree('"+instanceid_key+"',getTreeData);\"><img
border=\"0\" src=\"/wookie/shared/images/cancel.gif\"> " +
LanguageHelper.getLocalizedString('Cancel') + "</a>";
+ dwr.util.setValue("foot", postNewTopicContent, { escapeHtml:false });
+}
+
+function getViewPostLayout(openPost){
+ var openPostStr="";
+ openPostStr+="<fieldset id=\"wf_ParticipantInform-sessur\"
class=\"repeat\">";
+ openPostStr+=" <legend>"+openPost.userId+" " +
LanguageHelper.getLocalizedString('wrote on') + " " +
formatDate(openPost.publishDate)+"</legend>";
+ openPostStr+=" <span class=\"oneField\">";
+ openPostStr+=" <span>" + openPost.content + "</span>";
+ openPostStr+=" </span>";
+ openPostStr+="</fieldset>";
+ return openPostStr;
+}
+
+function getNewPostLayout(parentPostId){
+
+ var titleText;
+ var reText="";
+ if(parentPostId==-1){
+ titleText = LanguageHelper.getLocalizedString('Post');
+ }
+ else{
+ titleText = LanguageHelper.getLocalizedString('Reply');
+ if(currentPost.title.substr(0,3)!="Re:"){
+ reText = "Re:" + currentPost.title;
+ }
+ else{
+ reText = currentPost.title;
+ }
+ }
+ var compoText = LanguageHelper.getLocalizedString('Compose');
+ var postNewTopicContent="";
+ postNewTopicContent+="<fieldset id=\"wf_GuardianInformati\"
class=\"\">";
+ postNewTopicContent+=" <legend>" + compoText + " " + titleText +
"</legend>";
+ postNewTopicContent+=" <span class=\"oneField\">";
+ postNewTopicContent+=" <label for=\"wf_Email\"
class=\"preField\">"+LanguageHelper.getLocalizedString('Title')+"</label>";
+ postNewTopicContent+=" <input type=\"text\"
id=\"title\" name=\"title\" value=\""+reText+"\" size=\"50\"
class=\"validate-email\">";
+ postNewTopicContent+=" <br>";
+ postNewTopicContent+=" </span>";
+ postNewTopicContent+=" <span class=\"oneField\">";
+ postNewTopicContent+=" <label for=\"wf_Address\"
class=\"preField\">"+LanguageHelper.getLocalizedString('Message')+"</label>";
+ postNewTopicContent+=" <textarea id=\"textcontent\"
name=\"textcontent\" class=\"required\" cols=\"38\" rows=\"5\"></textarea>";
+ postNewTopicContent+=" <br>";
+ postNewTopicContent+=" </span>";
+ postNewTopicContent+="</fieldset>";
+ return postNewTopicContent;
+}
+
+function postIt(param){
+ var title = document.getElementById("title").value;
+ var content = document.getElementById("textcontent").value;
+ if(title.length<1){
+ alert(LanguageHelper.getLocalizedString('You must specify a
Title for this post'));
+ return;
+ }
+ if(content.length<1){
+ alert(LanguageHelper.getLocalizedString('Empty posts are not
allowed'));
+ return;
+ }
+ forum.newPost(instanceid_key, param, username, title, content,
outcomeOfPost);
+}
+
+function outcomeOfPost(param){
+ var outcomeContent="";
+ var toolsContent="";
+ var linkText = " <a href=\"#\"
onclick=\"forum.getNodeTree('"+instanceid_key+"',getTreeData);\">" +
LanguageHelper.getLocalizedString('Click here to continue') + "</a>"
+ outcomeContent+="<div>"
+ if (param==true){
+ outcomeContent+="<p>" + LanguageHelper.getLocalizedString('Post
was successfully added')+ linkText+"</p>"
+
+ }
+ else{
+ outcomeContent+="<p>" +
LanguageHelper.getLocalizedString('Unable to add new post')+ linkText+"</p>"
+ }
+ outcomeContent+="</div>"
+ dwr.util.setValue("content", outcomeContent, { escapeHtml:false });
+ dwr.util.setValue("foot", toolsContent, { escapeHtml:false });
+}
+
+function formatDate(d){
+ var t_date = d.getDate(); // Returns the day of the month
+ var t_mon = d.getMonth(); // Returns the month as a digit
+ var t_year = d.getFullYear(); // Returns 4 digit year
+ var t_hour = d.getHours(); // Returns hours
+ var curr_min = d.getMinutes();
+ curr_min = curr_min + "";
+ if (curr_min.length == 1){curr_min = "0" + curr_min;}
+ var curr_sec = d.getSeconds();
+ curr_sec = curr_sec + "";
+ if (curr_sec.length == 1){curr_sec = "0" + curr_sec;}
+ return t_date+"/"+t_mon+"/"+t_year+" "+ t_hour + ":" + curr_min + ":" +
curr_sec
+}
+
+function handleLocked(sdkey){
+ if(sdkey == sharedDataKey){
+ isdActive = false;
+ var resStr = getInactiveToolsStr();
+ dwr.util.setValue("foot", resStr, { escapeHtml:false });
+ isLocked = true;
+ forum.getNodeTree(instanceid_key, getTreeData);
+ }
+}
+
+function handleUnlocked(sdkey){
+ if(sdkey == sharedDataKey){
+ if (isDebug) DebugHelper.debug("<start handle unlocked> ");
+ isdActive = true;
+ isLocked = false;
+ var resStr = getActiveToolsStr();
+ dwr.util.setValue("foot", resStr, { escapeHtml:false });
+ forum.getNodeTree(instanceid_key, getTreeData);
+ if (isDebug) DebugHelper.debug("<end handle unlocked> ");
+ }
+}
+
+function lockforum(){
+ if(isdActive){
+ isdActive = false;
+ }
+ Widget.lock();
+}
+
+function unlockforum(){
+ isdActive = true;
+ Widget.unlock();
+}
+
+Widget.onLocked = handleLocked;
+Widget.onUnlocked = handleUnlocked;
\ No newline at end of file
Propchange: incubator/wookie/trunk/widgets/forum/forumutils.js
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/wookie/trunk/widgets/forum/index.htm
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/forum/index.htm?rev=884068&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/forum/index.htm (added)
+++ incubator/wookie/trunk/widgets/forum/index.htm Wed Nov 25 12:29:11 2009
@@ -0,0 +1,22 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <title>Default Forum Widget</title>
+ <script type='text/javascript' src='/wookie/dwr/interface/forum.js'>
</script>
+ <script type='text/javascript' src='/wookie/dwr/util.js'> </script>
+ <script type='text/javascript' src='/wookie/dwr/engine.js'> </script>
+ <script type='text/javascript' src='/wookie/dwr/interface/WidgetImpl.js'>
</script>
+ <script type='text/javascript' src='/wookie/shared/js/wookie-wrapper.js'>
</script>
+ <script type="text/javascript"
src="/wookie/shared/js/wookie-polling-feature.js"></script>
+ <script type='text/javascript' src='forumutils.js'> </script>
+
+ <script type='text/javascript' src='locales/en/localizedStrings.js'>
</script>
+ <script type='text/javascript' src='locales/bu/localizedStrings.js'>
</script>
+ <link rel="stylesheet" href="forum.css" type="text/css"/>
+</head>
+<body onload="init()">
+ <div id="content"></div>
+ <div id="foot"></div>
+</body>
+</html>
Propchange: incubator/wookie/trunk/widgets/forum/index.htm
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/wookie/trunk/widgets/forum/locales/bu/localizedStrings.js
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/forum/locales/bu/localizedStrings.js?rev=884068&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/forum/locales/bu/localizedStrings.js (added)
+++ incubator/wookie/trunk/widgets/forum/locales/bu/localizedStrings.js Wed Nov
25 12:29:11 2009
@@ -0,0 +1,63 @@
+/*
+* forum widget strings
+*/
+
+
+var bu_localizedStrings = new Array;
+
+bu_localizedStrings["en"]
+= "bu";
+
+bu_localizedStrings["Post new topic"]
+= "ÐÑбликÑвай нова Ñема";
+
+bu_localizedStrings["Refresh"]
+= "Ðбнови екÑана";
+
+bu_localizedStrings["Lock this widget"]
+= "ÐаклÑÑи Ñази опÑиÑ";
+
+bu_localizedStrings["Unlock this widget"]
+= "ÐÑклÑÑи Ñази опÑиÑ";
+
+bu_localizedStrings["This widget has been locked"]
+= "Тази опÑÐ¸Ñ Ðµ заклÑÑена";
+
+bu_localizedStrings["Record no longer exists in Database, probably deleted by
another user"]
+= "ÐанниÑе не ÑÑÑеÑÑвÑÐ²Ð°Ñ Ð² базаÑа,
веÑоÑÑно Ñа изÑÑиÑи Ð¾Ñ Ð´ÑÑг поÑÑебиÑел";
+
+bu_localizedStrings["Reply"]
+= "ÐÑговоÑи";
+
+bu_localizedStrings["Cancel"]
+= "ÐÑкажи";
+
+bu_localizedStrings["Post"]
+= "ÐÑбликÑвай";
+
+bu_localizedStrings["wrote on"]
+= "пÑбликÑван на";
+
+bu_localizedStrings["Title"]
+= "Ðаглавие";
+
+bu_localizedStrings["Compose"]
+= "Ðово ÑÑобÑение";
+
+bu_localizedStrings["Message"]
+= "СÑобÑение";
+
+bu_localizedStrings["You must specify a Title for this post"]
+= "ÐолÑ, задайÑе Ñема";
+
+bu_localizedStrings["Empty posts are not allowed"]
+= "Ðе можеÑе да пÑбликÑваÑе пÑазни
ÑÑобÑениÑ";
+
+bu_localizedStrings["Click here to continue"]
+= "ЩÑакнеÑе ÑÑк,за да пÑодÑлжиÑе";
+
+bu_localizedStrings["Post was successfully added"]
+= "СÑобÑениеÑо е пÑбликÑвано ÑÑпеÑно";
+
+bu_localizedStrings["Unable to add new post"]
+= "ÐобавÑнеÑо на нова Ñема е невÑзможно";
\ No newline at end of file
Propchange: incubator/wookie/trunk/widgets/forum/locales/bu/localizedStrings.js
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/wookie/trunk/widgets/forum/locales/en/localizedStrings.js
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/forum/locales/en/localizedStrings.js?rev=884068&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/forum/locales/en/localizedStrings.js (added)
+++ incubator/wookie/trunk/widgets/forum/locales/en/localizedStrings.js Wed Nov
25 12:29:11 2009
@@ -0,0 +1,52 @@
+/*
+* English
+* Translated by: Paul Sharples
+*/
+
+
+var en_localizedStrings = new Array;
+
+en_localizedStrings["en"]
+= "en";
+
+en_localizedStrings["online users"]
+= "online users";
+
+en_localizedStrings["Send"]
+="Send";
+
+en_localizedStrings["Lock this widget"]
+="Lock this widget";
+
+en_localizedStrings["Unlock this widget"]
+="Unlock this widget";
+
+en_localizedStrings["Clear chat log"]
+= "Clear chat log";
+
+en_localizedStrings["This widget has been locked"]
+= "This widget has been locked";
+
+en_localizedStrings["Are you sure you want to clear the chat log?"]
+= "Are you sure you want to clear the chat log?";
+
+en_localizedStrings["By choosing OK, you will be removing all of the current
chat log data"]
+= "By choosing OK, you will be removing all of the current chat log data";
+
+en_localizedStrings["This operation is irreversible once you click OK"]
+= "This operation is irreversible once you click OK";
+
+en_localizedStrings["has joined the chatroom"]
+= "has joined the chatroom";
+
+en_localizedStrings["has left the chatroom"]
+= "has left the chatroom";
+
+en_localizedStrings["has cleared the chat log"]
+= "has cleared the chat log";
+
+en_localizedStrings["has locked the chatroom"]
+= "has locked the chatroom";
+
+en_localizedStrings["has unlocked the chatroom"]
+= "has unlocked the chatroom";
\ No newline at end of file
Propchange: incubator/wookie/trunk/widgets/forum/locales/en/localizedStrings.js
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/wookie/trunk/widgets/forum/transparent.gif
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/forum/transparent.gif?rev=884068&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/wookie/trunk/widgets/forum/transparent.gif
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/wookie/trunk/widgets/forum/transparent.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/wookie/trunk/widgets/natter/Images/bar.png
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/natter/Images/bar.png?rev=884068&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/wookie/trunk/widgets/natter/Images/bar.png
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/wookie/trunk/widgets/natter/Images/bar.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/wookie/trunk/widgets/natter/Images/bg-reverse.png
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/natter/Images/bg-reverse.png?rev=884068&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/wookie/trunk/widgets/natter/Images/bg-reverse.png
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/wookie/trunk/widgets/natter/Images/bg-reverse.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/wookie/trunk/widgets/natter/Images/bg.png
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/natter/Images/bg.png?rev=884068&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/wookie/trunk/widgets/natter/Images/bg.png
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/wookie/trunk/widgets/natter/Images/bg.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/wookie/trunk/widgets/natter/Images/default_thumbnail.png
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/natter/Images/default_thumbnail.png?rev=884068&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/wookie/trunk/widgets/natter/Images/default_thumbnail.png
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/wookie/trunk/widgets/natter/Images/default_thumbnail.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/wookie/trunk/widgets/natter/Images/ibutton/black_i.png
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/natter/Images/ibutton/black_i.png?rev=884068&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/wookie/trunk/widgets/natter/Images/ibutton/black_i.png
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/wookie/trunk/widgets/natter/Images/ibutton/black_i.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/wookie/trunk/widgets/natter/Images/ibutton/black_rollie.png
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/natter/Images/ibutton/black_rollie.png?rev=884068&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
incubator/wookie/trunk/widgets/natter/Images/ibutton/black_rollie.png
------------------------------------------------------------------------------
svn:executable = *
Propchange:
incubator/wookie/trunk/widgets/natter/Images/ibutton/black_rollie.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/wookie/trunk/widgets/natter/Images/ibutton/white_i.png
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/natter/Images/ibutton/white_i.png?rev=884068&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/wookie/trunk/widgets/natter/Images/ibutton/white_i.png
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/wookie/trunk/widgets/natter/Images/ibutton/white_i.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/wookie/trunk/widgets/natter/Images/ibutton/white_rollie.png
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/natter/Images/ibutton/white_rollie.png?rev=884068&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
incubator/wookie/trunk/widgets/natter/Images/ibutton/white_rollie.png
------------------------------------------------------------------------------
svn:executable = *
Propchange:
incubator/wookie/trunk/widgets/natter/Images/ibutton/white_rollie.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/wookie/trunk/widgets/natter/Images/lock.png
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/natter/Images/lock.png?rev=884068&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/wookie/trunk/widgets/natter/Images/lock.png
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/wookie/trunk/widgets/natter/Images/lock.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/wookie/trunk/widgets/natter/Images/trash.png
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/natter/Images/trash.png?rev=884068&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/wookie/trunk/widgets/natter/Images/trash.png
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/wookie/trunk/widgets/natter/Images/trash.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/wookie/trunk/widgets/natter/build.xml
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/natter/build.xml?rev=884068&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/natter/build.xml (added)
+++ incubator/wookie/trunk/widgets/natter/build.xml Wed Nov 25 12:29:11 2009
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project default="build-widget" basedir="." name="widget build file">
+ <property name="wookie.widgets.dir" location="../"/>
+ <property name="widget.shortname" value="natter"/>
+
+ <import file="../build.xml"/>
+</project>
\ No newline at end of file
Added: incubator/wookie/trunk/widgets/natter/chat.css
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/natter/chat.css?rev=884068&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/natter/chat.css (added)
+++ incubator/wookie/trunk/widgets/natter/chat.css Wed Nov 25 12:29:11 2009
@@ -0,0 +1,153 @@
+html {
+height:100%;
+max-height:100%;
+padding:0;
+margin:0;
+border:0;
+font-size:80%;
+font-family: "trebuchet ms", tahoma, verdana, arial, sans-serif;
+/* hide overflow:hidden from IE5/Mac */
+/* \*/
+overflow: hidden;
+/* */
+}
+
+body{
+ margin-top:0px;
+ margin-left:0px;
+ color: #000000;
+}
+
+div#front
+{
+ background:url('Images/bg.png') no-repeat;
+ height:383px;
+ width:255px;
+}
+
+div#back
+{
+ background:url('Images/bg-reverse.png') no-repeat;
+ display:none;
+ height:383px;
+ width:255px;
+}
+
+div#chatroom
+{
+ position:absolute;
+ margin-top:34px;
+ margin-left: 14px;
+ width: 224px;
+ height: 276px;
+ padding: 2px;
+}
+
+div#chatlog
+{
+ float: left;
+ margin-top: 0px;
+ margin-left: 0px;
+ width: 206px;
+ height: 100%;
+ padding: 2px;
+ overflow: auto;
+}
+
+div#members
+{
+ float:left;
+ margin-top: 0px;
+ margin-left: 0px;
+ width: 206px;
+ height: 100%;
+ display: none;
+ padding: 2px;
+ background-color: #f3f3ff;
+ overflow: auto;
+}
+
+div#flip
+{
+ float: left;
+ margin-top: 0px;
+ margin-left: 0px;
+ width: 12px;
+ height: 100%;
+ padding-bottom: 2px;
+ border-right:1px solid;
+}
+
+div#input
+{
+ position:absolute;
+ margin-top: 324px;
+ margin-left:16px;
+ padding: 2px;
+ height: 28px;
+ width: 216px;
+}
+
+input#text
+{
+ width:212px;
+ background-color: #e0f0f0;
+}
+
+input#username
+{
+ width:14px;
+ background-color: #e0f0f0;
+}
+
+div.hidden
+{
+ display: none;
+}
+
+span.from
+{
+ font-weight: bold;
+}
+
+span.alert
+{
+ font-style: italic;
+}
+
+#infobutton {
+ position: absolute;
+ width: 13px;
+ height: 13px;
+ top: 355px;
+ left: 228px;
+ cursor: pointer;
+}
+
+#lock {
+ position: absolute;
+ top: 30px;
+ left: 0px;
+}
+
+#done {
+ position: absolute;
+ top: 340px;
+ left: 190px;
+ cursor: pointer;
+}
+
+#about{
+ position: absolute;
+ color: white;
+ top: 90px;
+ left: 24px;
+}
+
+#langopts{
+ position: absolute;
+ color: white;
+ top: 140px;
+ left: 24px;
+}
+
Propchange: incubator/wookie/trunk/widgets/natter/chat.css
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/wookie/trunk/widgets/natter/chat.js
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/natter/chat.js?rev=884068&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/natter/chat.js (added)
+++ incubator/wookie/trunk/widgets/natter/chat.js Wed Nov 25 12:29:11 2009
@@ -0,0 +1,227 @@
+/*
+**************** DEFAULT CHAT WIDGET **************
+The presence list is appended to the shareddata by using tags
+Each online member is appended to the list by using the following syntax...
+
+<member>Fred Bloggs<member>
+
+The chat log is done the same way...
+
+<chat>Hi there!<chat>
+******************************************************
+*/
+var isActive=false;
+var username="";
+var usercolor="";
+var chatSeparator = "<chat>";
+var dataSeparator = "<data>";
+var memberSeparator = "<member>";
+var thumbnail="";
+var userList="";
+var thisUserUnlocked = false;
+var thisUserClearedLog = false;
+var isAdmin = false;
+var sharedDataKey = null;
+var showMembers = false;
+var localizedStrings = null;
+
+function rnd_no(max){
+ return Math.floor(Math.random()*max);
+};
+
+function flip(){
+ if (showMembers){
+ showMembers = false;
+ $("#members").hide();
+ $("#chatlog").show();
+ var objDiv = document.getElementById("chatlog");
+ objDiv.scrollTop = objDiv.scrollHeight;
+ } else {
+ showMembers = true;
+ $("#members").show();
+ $("#chatlog").hide();
+ }
+}
+
+// on start up set some values & init with the server
+function init() {
+ localize();
+ wave.setStateCallback(refreshChatLog);
+ wave.setParticipantCallback(refreshMemberList);
+ Widget.onLocked = handleLocked;
+ Widget.onUnlocked = handleUnlocked;
+ wave.getState().submitDelta({"test":"testvalue"});
+ if(!isActive){
+ isActive = true;
+ if (wave.getViewer() != null){
+ username = wave.getViewer().getDisplayName();
+ thumbnail = wave.getViewer().getThumbnailUrl();
+ }
+ if (thumbnail == "" || thumbnail == null) thumbnail =
"Images/default_thumbnail.png";
+ if (username == null || username == ""){
+ username = "natterer" + rnd_no(9999);
+ }
+ if (Widget.preferences.getItem("conference-manager") == "true" ||
Widget.preferences.getItem("moderator") == "true"){
+ isAdmin = true;
+ }
+ if (wave.getState().get("isLocked") == "true"){
+ handleLocked();
+ } else {
+ handleUnlocked();
+ }
+ }
+}
+
+////// Localization
+function localize(){
+ jQuery.getScript( "locales/"+Widget.locale+"/localizedStrings.js");
+}
+
+function getLocalizedString(str){
+ if (localizedStrings == null) return str;
+ var locstr = localizedStrings[str];
+ if (locstr == null || locstr == "") locstr = str;
+ return locstr;
+}
+
+///////
+
+function isAdminUser(){
+ return isAdmin;
+}
+
+function getAdminUnlockText(){
+ var adminUnlockText = "<a href=\"#\" onclick=\"unlockchat()\"><img
border=\"0\" src=\"/wookie/shared/images/unlock.gif\"
alt=\""+getLocalizedString('Unlock this widget')+"\"></a>";
+ return adminUnlockText;
+}
+
+function getAdminLockText(){
+ var adminLockText = "<div id=\"lock\"><a href=\"#\"
onclick=\"lockchat()\"><img border=\"0\" src=\"Images/lock.png\"
alt=\""+getLocalizedString('Lock this widget')+"\"></a>";
+ adminLockText += "<a href=\"#\" onclick=\"confirmClearChat()\"><img
border=\"0\" src=\"Images/trash.png\" alt=\"";
+ adminLockText += "Clear chat log";
+ adminLockText += "\"></a></div>";
+ return adminLockText;
+}
+
+function getInputInactiveDiv() {
+ var inputinactivediv = "<b>"+getLocalizedString('This widget has been
locked')+"</b> ";
+ if(isAdminUser()){
+ inputinactivediv += getAdminUnlockText();
+ }
+ return inputinactivediv;
+}
+
+function getInputActiveDiv(){
+ var inputactivediv = "<input id=\"text\"
onkeypress=\"dwr.util.onReturn(event, sendMessage)\"/>";
+ if(isAdminUser()){
+ inputactivediv += getAdminLockText();
+ }
+ return inputactivediv;
+}
+
+function confirmClearChat(){
+ var confirmText = getLocalizedString('Are you sure you want to clear
the chat log?');
+ confirmText+="\n\n";
+ confirmText+=getLocalizedString('By choosing OK, you will be removing
all of the current chat log data');
+ confirmText+=getLocalizedString('This operation is irreversible once
you click OK');
+ var answer = confirm(confirmText);
+ if (answer){
+ thisUserClearedLog = true;
+ var clear = {};
+ clear["chatLog"] = chatSeparator+username+dataSeparator+"
"+getLocalizedString("has cleared the chat log") + dataSeparator + thumbnail
+chatSeparator;
+ wave.getState().submitDelta(clear);
+ }
+ else{}
+}
+
+///// Send a new message
+
+function sendMessage() {
+ if (isActive){
+ var text = dwr.util.getValue("text");
+ dwr.util.setValue("text", "");
+ post(username, text, thumbnail);
+ }
+}
+
+function post(user,text,url){
+ text = dwr.util.escapeHtml(text);
+ text = replaceTextSmileys(text);
+ Widget.appendSharedDataForKey("chatLog", chatSeparator + user +
dataSeparator + text + dataSeparator + url + chatSeparator);
+}
+
+
+///// Presence List
+
+function refreshMemberList(){
+ participants = wave.getParticipants();
+ viewer = wave.getViewer();
+ var memberList = "";
+ var viewerId = "";
+ if (viewer!=null) viewerId=viewer.getId();
+ for (participant in participants) {
+ if(participants[participant].getId() == viewerId){
+ // this users entry
+ memberList = "<div><img height=\"32\" width=\"32\"
style=\"vertical-align: text-top; float:left;padding:2px;\"
src=\""+participants[participant].getThumbnailUrl()+"\"/><i>" +
dwr.util.escapeHtml(participants[participant].getDisplayName()) + "</i><br
clear=\"both\"/></div>" + memberList;
+ }
+ else{
+ memberList = "<div><img height=\"32\" width=\"32\"
style=\"vertical-align: text-top; float:left;padding:2px;\"
src=\""+participants[participant].getThumbnailUrl()+"\"/>" +
dwr.util.escapeHtml(participants[participant].getDisplayName()) + "<br
clear=\"both\"/></div>" + memberList;
+ }
+ }
+ // add current non-member viewer
+ if (viewer == null){
+ memberList = "<div><img height=\"32\" width=\"32\"
style=\"vertical-align: text-top; float:left;padding:2px;\"
src=\"Images/default_thumbnail.png\"/>" + username + "<br
clear=\"both\"/></div>" + memberList;
+ }
+ // now set the presence list
+ dwr.util.setValue("members", memberList, { escapeHtml:false });
+}
+
+///// Chat List
+
+function refreshChatLog(){
+ var messages = wave.getState().get("chatLog");
+ if (messages && messages != null){
+ var chatlog = "";
+ var messageArray = messages.split(chatSeparator);
+ messageArray.reverse();
+ for (var data in messageArray) {
+ message = messageArray[data].split(dataSeparator);
+ // put each message in a new div
+ if (message.length == 3) chatlog = "<div style=\"padding:2px\">
<img height=\"32\" width=\"32\" style=\"vertical-align: text-top;
float:left;padding:2px;\" src=\""+message[2]+"\"><span
style='font-weight:bold;color:blue;'>" + message[0] + "</span> " + message[1] +
"<br clear=\"both\"/></div>" + chatlog;
+ }
+ }
+ dwr.util.setValue("chatlog", chatlog, { escapeHtml:false });
+ var objDiv = document.getElementById("chatlog");
+ objDiv.scrollTop = objDiv.scrollHeight;
+}
+
+////// Locking
+
+function handleLocked(){
+ isActive = false;
+ dwr.util.setValue("joined", getInputInactiveDiv(), { escapeHtml:false });
+ refreshChatLog();
+}
+
+function handleUnlocked(sdkey){
+ isActive = true;
+ if(thisUserUnlocked){
+ thisUserUnlocked = false;
+ post(username,getLocalizedString('has unlocked the chatroom'),
thumbnail);
+ }
+ dwr.util.setValue("joined", getInputActiveDiv(), { escapeHtml:false });
+}
+
+function lockchat(){
+ if(isActive){
+ isActive = false;
+ post(username,getLocalizedString('has locked the chatroom'),
thumbnail);
+ }
+ Widget.lock();
+}
+
+function unlockchat(){
+ isActive = true;
+ thisUserUnlocked = true;
+ Widget.unlock();
+}
\ No newline at end of file
Propchange: incubator/wookie/trunk/widgets/natter/chat.js
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/wookie/trunk/widgets/natter/config.xml
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/natter/config.xml?rev=884068&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/natter/config.xml (added)
+++ incubator/wookie/trunk/widgets/natter/config.xml Wed Nov 25 12:29:11 2009
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<widget xmlns="http://www.w3.org/ns/widgets"
id="http://www.getwookie.org/widgets/natter" height="383" width="255">
+ <name>Natter</name>
+ <description>basic chat widget</description>
+ <icon src="icon.png"/>
+ <content src="index.htm"/>
+ <author>Scott Wilson</author>
+ <license>Licensed under the Apache 2.0 License (see
http://www.apache.org/licenses/LICENSE-2.0). Smileys created by macpoupou and
licensed under Creative Commons Attribution License 3.0. See
http://ismileys.free.fr/smileys/ for more information. </license>
+ <feature name="http://wave.google.com" required="true"/>
+</widget>
\ No newline at end of file
Propchange: incubator/wookie/trunk/widgets/natter/config.xml
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/wookie/trunk/widgets/natter/icon.png
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/natter/icon.png?rev=884068&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/wookie/trunk/widgets/natter/icon.png
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/wookie/trunk/widgets/natter/icon.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/wookie/trunk/widgets/natter/index.htm
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/natter/index.htm?rev=884068&view=auto
==============================================================================
--- incubator/wookie/trunk/widgets/natter/index.htm (added)
+++ incubator/wookie/trunk/widgets/natter/index.htm Wed Nov 25 12:29:11 2009
@@ -0,0 +1,37 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <title>Default Chat Widget</title>
+ <!-- injected scripts - note - these must come first! -->
+ <script type='text/javascript' src='/wookie/dwr/util.js'> </script>
+ <script type='text/javascript' src='/wookie/dwr/engine.js'> </script>
+ <script type='text/javascript' src='/wookie/dwr/interface/WidgetImpl.js'>
</script>
+ <script type='text/javascript' src='/wookie/shared/js/wookie-wrapper.js'>
</script>
+ <script type='text/javascript' src='/wookie/dwr/interface/WaveImpl.js'>
</script>
+ <script type='text/javascript' src='/wookie/shared/js/wave.js'> </script>
+ <!-- end injected scripts -->
+ <script type='text/javascript' src='chat.js'> </script>
+ <script type='text/javascript' src='smileys.js'> </script>
+ <script type='text/javascript' src='jquery.js'> </script>
+
+ <link rel="stylesheet" href="chat.css" type="text/css"/>
+</head>
+<body onload="init()">
+ <div id="front">
+ <div id="chatroom">
+ <div id="chatlog"></div>
+ <div id="flip"><img src="Images/bar.png" alt="click to hide or
show members" onclick="javascript:flip()"/></div>
+ <div id="members"></div>
+ </div>
+ <div id="input">
+ <div id="joined"></div>
+ </div>
+ </div>
+</body>
+<!-- fix forIE cashing - must go here even though its in the wrong place
+<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
+</HEAD>
+-->
+</html>
Propchange: incubator/wookie/trunk/widgets/natter/index.htm
------------------------------------------------------------------------------
svn:executable = *