Skip to content

Commit

Permalink
Updates to dock, collaboration
Browse files Browse the repository at this point in the history
  • Loading branch information
mattpardee committed Feb 7, 2011
1 parent 5bbba0b commit 6f80f4a
Show file tree
Hide file tree
Showing 5 changed files with 207 additions and 36 deletions.
92 changes: 86 additions & 6 deletions client/ext/collaborate/collaborate.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,18 @@ return ext.register("ext/collaborate/collaborate", {
var chatUserID = listItem.getAttribute("user_id");
var chatIdent = this.name + chatUserID;

// Check to see if window exists already. If so, select it
// Check to see if window exists already. If so, select it (2nd arg)
if(dock.windowExists(chatIdent, true)) {
return false;
}

tempChatWindow = new apf.modalwindow({
htmlNode : document.body,
id : "chatUser" + chatUserID,
onhide : "require('ext/collaborate/collaborate').onChatHide("
+ chatUserID + ")",
onshow : "require('ext/collaborate/collaborate').onChatShow("
+ chatUserID + ")",
title : listItem.getAttribute("user_name"),
visible : false,
right : "42",
Expand Down Expand Up @@ -64,7 +68,8 @@ return ext.register("ext/collaborate/collaborate", {
flex : "1",
childNodes : [
new apf.hbox({
height : "230",
height : "243",
edge : "3 0 5 7",
childNodes : [
new apf.text({
id : "txtChat" + chatUserID,
Expand All @@ -79,6 +84,7 @@ return ext.register("ext/collaborate/collaborate", {

new apf.scrollbar({
'for' : "txtChat" + chatUserID,
id : "sbChat" + chatUserID,
height : "*",
margin : "0",
skin : "sbcollaborators",
Expand All @@ -87,13 +93,14 @@ return ext.register("ext/collaborate/collaborate", {
]
}),
new apf.hbox({
height : "54",
height : "41",
edge : "8 7 7 7",
'class' : "hboxchatinput",
childNodes : [
new apf.textbox({
flex : "1",
height : "37"
flex : "1",
height : "20",
onkeydown : "return require('ext/collaborate/collaborate').chatkeyHandler(event, this, " + chatUserID + ")"
})
]
})
Expand All @@ -112,8 +119,81 @@ return ext.register("ext/collaborate/collaborate", {
chatIdent, // Window identifer
true // Force this chat window to show right away
);

eval("chatUser" + chatUserID).selectSingleNode("panel/hbox[2]/textbox").focus();
},

closeChat: function(ev, anchorEl){
ev.preventDefault();
},

/**
* Get the scrollbar position when the window hides so we can reset it
* when it is re-shown. For WebKit-based browsers.
*/
onChatHide: function(userID){
if(apf.isWebkit) {
tUserSB = eval("sbChat" + userID);
// Store this somewhere...
collaborators.queryNode("item[@user_id="
+ userID + "]").setAttribute("sb_pos", tUserSB.getPosition());
}
},

onChatShow: function(userID){
if(apf.isWebkit) {
sb_pos = collaborators.queryNode("item[@user_id=" + userID
+ "]").getAttribute("sb_pos");
eval("sbChat" + userID).setPosition(sb_pos);
}

eval("chatUser" + userID).selectSingleNode("panel/hbox[2]/textbox").focus();
},

chatkeyHandler: function(ev, txtObj, userID){
if(ev.keyCode == 13) {
var chatInput = txtObj.getValue();
if(chatInput != "") {
require("ext/collaborate/collaborate").appendToChatWin(
userID,
'chatmessage',
{
message: chatInput,
fromMe: true
}
);

eval("sbChat" + userID).setPosition(1);
}

txtObj.clear();
return false;
}

return true;
},

appendToChatWin: function(userID, type, messageDetails){
txtOutputWin = eval("txtChat" + userID);

switch(type){
case 'chatmessage':
var outStr = '<div class="chat_message_block">';
if(messageDetails.fromMe == true) {
outStr += '<div class="chat_me_header">\
<span class="chat_msg_name">You</span>\
<span class="chat_msg_timestamp">12:01 AM</span></div>\
<div class="chat_message">'
+ messageDetails.message + '</div>'
}

outStr += '</div>';

txtOutputWin.addValue(outStr);
break;
}
},

init : function(amlNode){
this.panel = winCollaborators;
dock.registerWindow(winCollaborators, {
Expand Down
28 changes: 14 additions & 14 deletions client/ext/collaborate/collaborate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@
<a:hbox edge="3 0 3 0">
<a:model id="collaborators">
<data>
<item online="1" status="" user_id="3" color="FF0000" user_name="Matt Pardee" />
<item online="0" status="" user_id="5" color="FF0000" user_name="Rik Arends" />
<item online="1" status="" user_id="4" color="FF0000" user_name="Ruben Daniels" />
<item online="1" status="" user_id="6" color="FF0000" user_name="Fabian Jakobs" />
<item online="1" status="" user_id="7" color="FF0000" user_name="David" />
<item online="1" status="" user_id="8" color="FF0000" user_name="Lukasz Lipinski" />
<item online="1" status="" user_id="9" color="FF0000" user_name="Mike De Boer" />
<item online="0" status="" user_id="10" color="FF0000" user_name="Sergi" />
<item online="1" status="" user_id="11" color="FF0000" user_name="Linh Nguyen" />
<item online="1" status="" user_id="12" color="FF0000" user_name="Eddy Bruel" />
<item online="1" status="" user_id="13" color="FF0000" user_name="Gabor Krizsanits" />
<item online="0" status="" user_id="14" color="FF0000" user_name="Giannis Panagiotou" />
<item online="1" status="" user_id="15" color="FF0000" user_name="Jos Uijterwaal" />
<item online="1" status="" user_id="16" color="FF0000" user_name="Lieke Arends" />
<item online="1" status="" user_id="3" sb_pos="0" color="FF0000" user_name="Matt Pardee" />
<item online="0" status="" user_id="5" sb_pos="0" color="FF0000" user_name="Rik Arends" />
<item online="1" status="" user_id="4" sb_pos="0" color="FF0000" user_name="Ruben Daniels" />
<item online="1" status="" user_id="6" sb_pos="0" color="FF0000" user_name="Fabian Jakobs" />
<item online="1" status="" user_id="7" sb_pos="0" color="FF0000" user_name="David" />
<item online="1" status="" user_id="8" sb_pos="0" color="FF0000" user_name="Lukasz Lipinski" />
<item online="1" status="" user_id="9" sb_pos="0" color="FF0000" user_name="Mike De Boer" />
<item online="0" status="" user_id="10" sb_pos="0" color="FF0000" user_name="Sergi" />
<item online="1" status="" user_id="11" sb_pos="0" color="FF0000" user_name="Linh Nguyen" />
<item online="1" status="" user_id="12" sb_pos="0" color="FF0000" user_name="Eddy Bruel" />
<item online="1" status="" user_id="13" sb_pos="0" color="FF0000" user_name="Gabor Krizsanits" />
<item online="0" status="" user_id="14" sb_pos="0" color="FF0000" user_name="Giannis Panagiotou" />
<item online="1" status="" user_id="15" sb_pos="0" color="FF0000" user_name="Jos Uijterwaal" />
<item online="1" status="" user_id="16" sb_pos="0" color="FF0000" user_name="Lieke Arends" />
</data>
</a:model>
<a:list
Expand Down
8 changes: 5 additions & 3 deletions client/ext/console/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,15 @@ return ext.register("ext/console/console", {
},

keyupHandler: function(e) {
if (e.keyCode != 9 || e.keyCode != 13)
if (e.keyCode != 9 && e.keyCode != 13) {
return this.commandTextHandler(e);
}
},

keydownHandler: function(e) {
//if (e.keyCode == 9 || e.keyCode == 13)
// return this.commandTextHandler(e);
if (e.keyCode == 9 || e.keyCode == 13) {
return this.commandTextHandler(e);
}
},

commandTextHandler: function(e) {
Expand Down
57 changes: 54 additions & 3 deletions client/ext/dockpanel/dockpanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,10 @@ return ext.register("ext/dockpanel/dockpanel", {

this.nodes.push(appendedDockBtn);
this.dockObjects.push({
win : windowObj,
btn : appendedDockBtn,
ident : -1
win : windowObj,
btn : appendedDockBtn,
ident : -1,
objhidden : false
});

if(typeof windowIdent !== "undefined") {
Expand Down Expand Up @@ -163,6 +164,50 @@ return ext.register("ext/dockpanel/dockpanel", {
return false;
},

/**
* Hides a dock button + associated window
*
* You would do this if you wanted to "close" a window but keep its
* contents intact
*
* @windowIdent identifier passed during registerWindow() call
*/
hideDockObject: function(windowIdent){
for(var doi = 0; doi < this.dockObjects.length; doi++) {
if(this.dockObjects[doi].ident == windowIdent) {
this.dockObjects[doi].win.hide();
this.dockObjects[doi].btn.setValue(false);
this.dockObjects[doi].btn.hide();

this.repositionWindows();

this.dockObjects[doi].objhidden = true;
return true;
}
}

return false;
},

showDockObject: function(windowIdent, showWindow){
for(var doi = 0; doi < this.dockObjects.length; doi++) {
if(this.dockObjects[doi].ident == windowIdent) {
this.dockObjects[doi].btn.show();

if(typeof showWindow !== "undefined" && showWindow == true) {
this.dockObjects[doi].win.show();
}

this.repositionWindows();

this.dockObjects[doi].objhidden = false;
return true;
}
}

return false;
},

/**
* Re-positions windows associated with buttons
* This happens for example when a window is unregistered, or when a
Expand Down Expand Up @@ -216,14 +261,20 @@ return ext.register("ext/dockpanel/dockpanel", {
* Checks to see if a window has already been registered with the
* supplied identifier
*
* @windowIdent identifier passed during registerWindow() call
* @showWindow if true, toggles the window's visibility
*/
windowExists: function(windowIdent, showWindow){
for(var doi = 0; doi < this.dockObjects.length; doi++) {
if(this.dockObjects[doi].ident == windowIdent) {
if(typeof showWindow !== "undefined" && showWindow == true) {
if(this.dockObjects[doi].objhidden == true) {
this.showDockObject(windowIdent, false);
}

this.toggleWindow(this.dockObjects[doi].btn);
}

return true;
}
}
Expand Down
58 changes: 48 additions & 10 deletions client/style/skins.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17929,12 +17929,12 @@
font-size : 10pt;
}

.todowin .todowinhead span.title {
.todowin .todowinhead .title {
display : inline-block;
background : #f6f6f6;
background : -moz-linear-gradient(top, #eee, #f6f6f6 );
background-image : -webkit-gradient(linear, 0% 0%, 0% 100%, from(#eee), to(#f6f6f6));
padding : 0 15px 0 13px;
padding : 0 5px 0 13px;
height : 24px;
line-height : 24px;
border-right : 1px solid #8c8c8c;
Expand Down Expand Up @@ -17994,7 +17994,7 @@
position : relative;*/
}

.todowin .todowinhead div{
/*.todowin .todowinhead div{
float : right;
width : 14px;
height : 14px;
Expand All @@ -18014,6 +18014,21 @@
}
.todowin .todowinhead div.down{
background-color : white;
}*/

.todowin .todowinhead .close {
margin-left: 5px;
}

.todowin .todowinhead .close a {
display : inline-block;
width : 14px;
height : 14px;
background : url(images/close_tab_btn.png) 0px 0px no-repeat;
}

.todowin .todowinhead .close a:hover {
background-position: -14px 0px;
}

.todowin .todowincontainer .list{
Expand All @@ -18039,13 +18054,16 @@
min-height = "80"
container = "div[1]/div[2]"
drag = "div[1]/div[1]"
title = "div[1]/div[1]/span[1]/text()"
icon = "div[1]/div[1]/span[2]">
title = "div[1]/div[1]/div[1]/text()">
<div class="todowin_container">
<div class="todowin">
<div class="todowinhead">
<span class="title">-</span>
<span></span>
<div class="title">-
<span class="close">
<a href="#"
onclick="require('ext/collaborate/collaborate').closeChat(event, this)"></a>
</span>
</div>
</div>
<div class="todowincontainer"></div>
</div>
Expand Down Expand Up @@ -18159,15 +18177,35 @@
}

.todopanel .hbox.hboxchatinput .tb_textbox .sbtb_middle {
height : 33px;
height : 20px;
border : none;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
}

.todopanel .hbox.hboxchatinput .tb_textbox .sbtb_middle input {
height: 32px;
line-height: 32px;
height: 20px;
line-height: 20px;
}

.todopanel .hbox .chat_text {
overflow: hidden;
word-wrap: break-word;
padding-right: 7px;
padding-bottom: 5px;
}

.todopanel .hbox .chat_text .chat_message_block {
padding: 5px 0;
}

.chat_message_block .chat_me_header {
color: #ababab;
padding-bottom: 5px;
}

.chat_message_block .chat_msg_timestamp {
float: right;
}
]]></a:style>
<a:presentation>
Expand Down

0 comments on commit 6f80f4a

Please sign in to comment.