Skip to content

Commit

Permalink
Added a menu on left top for session operations
Browse files Browse the repository at this point in the history
  • Loading branch information
Amit Ambardekar committed Aug 17, 2010
1 parent 5071902 commit 853a1ff
Show file tree
Hide file tree
Showing 16 changed files with 2,345 additions and 10 deletions.
9 changes: 8 additions & 1 deletion web/src/refrrr/collections/MongoCollectionBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ protected static function ensureIndex($keys, $collectionName)

return $collection->ensureIndex($keys);
}

protected static function ensureIndexUnique($keys, $collectionName)
{
$collection = MongoCollectionBase::getCollection($collectionName);

return $collection->ensureIndex($keys, array("unique" => true, "dropDups" => true));
}
}

?>
?>
36 changes: 36 additions & 0 deletions web/src/refrrr/collections/Subscriber.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

require_once("framework/request.php");
require_once("collections/MongoCollectionBase.php");

define('ID', '_id');
define('EMAIL', 'email');

define('SUBSCRIBER', 'subscriber');

class Subscriber extends MongoCollectionBase
{
public static function createSubscriberFromRequest()
{
$newSubscriber = array(EMAIL=>requestParam(EMAIL));

return $newSubscriber;
}

public static function add()
{
$retval = Subscriber::createSubscriberFromRequest();
$status = MongoCollectionBase::executeSave($retval, SUBSCRIBER);

return $retval;
}

public static function ensureIndex()
{
MongoCollectionBase::ensureIndexUnique(array(EMAIL=>1),SUBSCRIBER);
}
}

Subscriber::ensureIndex();

?>
6 changes: 6 additions & 0 deletions web/src/refrrr/css/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#addSearchBox{display:none;}

#subscribeDiv{font-size:20px;width:100%;border:1px solid #888;padding:25px;margin-top:20px;}
#subscribeDiv input,button{height:30px;}
#subscribeDiv #o{width:400px;}
#subscribeDiv button{width:70px;}
2 changes: 1 addition & 1 deletion web/src/refrrr/css/sessin-general.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ h2{font-size:23px;padding:0px;margin:10px;}
#mainTip #exampleLink{color:#999;font-size:90%;}
#dragDemo{float:right;display:none;border:1px solid;background-color:red;position:relative;top:-20px;}

#startSessionNavig{font-size:20px;width:100%;border:1px solid #888;padding:30px;}
#startSessionNavig{font-size:20px;width:100%;border:1px solid #888;padding:25px;}
#startSessionNavig input,button{height:30px;}
#startSessionNavig #o{width:400px;}
#startSessionNavig button{width:70px;}
Expand Down
37 changes: 37 additions & 0 deletions web/src/refrrr/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,30 @@
<link rel="stylesheet" type="text/css" href="css/reset-fonts-grids.css">
<link rel="stylesheet" type="text/css" href="css/base.css">
<link rel="stylesheet" type="text/css" href="css/sessin-general.css">
<link rel="stylesheet" type="text/css" href="css/index.css">

<link rel="search" type="application/opensearchdescription+xml" title="Sess.in" href="plugin/SessinSearchPlugin.xml">

<script>
function installSearchEngine() {
alert('sd');
if (window.external && ("AddSearchProvider" in window.external)) {
// Firefox 2 and IE 7, OpenSearch
window.external.AddSearchProvider("http://sess.in/plugin/SessinSearchPlugin.xml");
} else if (window.sidebar && ("addSearchEngine" in window.sidebar)) {
// Firefox <= 1.5, Sherlock
//window.sidebar.addSearchEngine("http://example.com/search-plugin.src",
//"http://example.com/search-icon.png",
//"Search Plugin", "");
alert("No search engine support");
} else {
// No search engine support (IE 6, Opera, etc).
alert("No search engine support");
}
}
</script>

</head>
<body>
<div id="doc4" class="yui-t7">
Expand Down Expand Up @@ -36,6 +60,19 @@
<span style="font-size:70%;"><i>This session will be stored in this browser.</i></span>
</form>
</div>
<div id="addSearchBox">
<a href="#" onclick="installSearchEngine(); return false;">Add Sess.in with Google</a>
</div>
<div id="subscribeDiv">
Get informed when there is bigger release
<form action="subscribe.php">
Email: <input type="text" value="" name="email" id="email"></input>
<button>Submit</button>
<br />
<span style="font-size:70%;"><i>Your email is safe with us.</i></span>
<br />
</form>
</div>
</div>
</div>
<div class="yui-b">
Expand Down
28 changes: 28 additions & 0 deletions web/src/refrrr/js/Communicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,27 @@ function Communicator()
);
}

this.getDataSync = function(path, data)
{
var targetPath = path;

var ajaxReturnVal = null;

$.ajax(
{
async : false,
url : targetPath,
data : data,
success : function(data)
{
ajaxReturnVal = data;
}
}
);

return ajaxReturnVal;
}

this.sendNOCallBack = function(path, data)
{
var targetPath = path;
Expand Down Expand Up @@ -50,4 +71,11 @@ function Communicator()
"url" : linkurl};
this.sendNOCallBack("removeLink.php", data, function(){});
}

this.getDialogHtml = function(path)
{
alert("Return something");

return this.getDataSync(path);
}
}
8 changes: 8 additions & 0 deletions web/src/refrrr/js/SessionData.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ function initAll(offlineMode, session)
showTabLinks(session);

setShareLink(session);
setViewLink(session);

// set view link
$("#viewSessionLink").attr("href", "view.php?_id="+session._id);
Expand All @@ -106,6 +107,13 @@ function setShareLink(session)
$("#sharelink").attr("target", "_blank");
}


function setViewLink(session)
{
$("#viewlink").attr("href", "view.php?_id="+session._id);
$("#viewlink").attr("target", "_blank");
}

function showTabLinks(session)
{
var tabLinks = session.tabLinks;
Expand Down
37 changes: 37 additions & 0 deletions web/src/refrrr/js/menu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
var hideDialogFn = function(){}

function showBackgroundForDialog()
{
$("#backgroundForDialog").css("display", "block");
}

function hideBackgroundForDialog()
{
$("#backgroundForDialog").css("display", "none");;
}

function showSessionMenu(sourceElement, eventData)
{
showBackgroundForDialog();

// get sourceElement 's bottom and left
// that is menu's top and left
var offset = $(sourceElement).offset();
var height = $(sourceElement).height();
var left = offset.left;
var top = offset.top + height + 4;

$("#sessionMenu").css("display", "block");
$("#sessionMenu").css("left", left+"px");
$("#sessionMenu").css("top", top+"px");

$("#sessionMenu a").click(function(){
hideDialogFn();
hideBackgroundForDialog()
});

hideDialogFn = function()
{
$("#sessionMenu").css("display", "none");
};
}
Loading

0 comments on commit 853a1ff

Please sign in to comment.