You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rave.apache.org by er...@apache.org on 2013/06/21 17:02:16 UTC
svn commit: r1495467 [2/2] - in /rave/branches/require:
rave-components/rave-web/src/main/java/org/apache/rave/portal/web/controller/
rave-components/rave-web/src/main/java/org/apache/rave/portal/web/tag/
rave-portal-resources/ rave-portal-resources/sr...
Modified: rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_models.js
URL: http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_models.js?rev=1495467&r1=1495466&r2=1495467&view=diff
==============================================================================
--- rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_models.js (original)
+++ rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_models.js Fri Jun 21 15:02:16 2013
@@ -298,295 +298,3 @@ define(["underscore", "./rave_backbone",
users: new Users()
}
})
-
-/*
-var rave = rave || {};
-
-rave.models = (function () {
-
- */
-/*
- User model. Further implementation pending.
- *//*
-
- var User = rave.Model.extend({
-
- });
-
- */
-/*
- Collection of users. Currently used for the share page users search.
- *//*
-
- var Users = rave.Collection.extend({
- model: User,
- pageSize: 10,
-
- //empty pagination data, is filled in on requests
- paginationData: {
- start:0,
- finish: 0,
- total: 0,
- prevLink: {},
- nextLink: {},
- pages: []
- },
-
- initialize: function(){
- //ensure that parse is always invoked in the context of this object
- _.bindAll(this, 'parse');
- },
-
- //filter collection with a search term
- filter: function (term) {
- this.searchTerm = term;
-
- if (this.searchTerm) {
- rave.api.rpc.searchUsers({searchTerm: this.searchTerm, offset: 0, successCallback: this.parse });
- }
- else {
- rave.api.rpc.getUsers({offset: 0, successCallback: this.parse });
- }
- },
-
- //used for pagination
- fetchPage: function (page) {
- var self = this;
-
- var offset = page?(page-1):0;
- offset *= this.pageSize;
-
- if (this.searchTerm) {
- rave.api.rpc.searchUsers({searchTerm: this.searchTerm, offset: offset, successCallback: this.parse });
- }
- else {
- rave.api.rpc.getUsers({offset: offset, successCallback: this.parse });
- }
- },
-
- //parse return data from the rpc call into a usable data model
- parse: function (data) {
- var result = data.result;
- this.pageSize = result.pageSize || 10;
-
- this.paginationData = {
- start: result.offset + 1,
- finish: result.resultSet.length + result.offset,
- total: result.totalResults,
- pageSize: result.pageSize,
- prevLink: {
- show: result.currentPage > 1 ? true : false,
- pageNumber: result.currentPage - 1
- },
- nextLink: {
- show: result.currentPage < result.numberOfPages ? true : false,
- pageNumber: result.currentPage + 1
- },
- //pages will be an array of objects from 1 to number of pages
- pages: _.map(_.range(1, result.numberOfPages + 1), function (pageNumber) {
- return {
- pageNumber: pageNumber,
- current: pageNumber == result.currentPage
- }
- })
- }
-
- this.reset(result.resultSet);
- },
-
- //When toViewModel is invoked, also provide pagination and filter data
- toViewModel: function () {
- return {
- searchTerm: this.searchTerm,
- pagination: this.paginationData,
- users: this.constructor.__super__.toViewModel.apply(this)
- }
- }
- });
-
- */
-/*
- Page model. Used for managing most of the sharing functionality.
- *//*
-
- var Page = rave.Model.extend({
-
- defaults: {
- members: {}
- },
-
- */
-/*
- TODO: currently this is used to silently bootstrap the page model from the page view. Once
- the jsp views are lightened up we should be able to provide a full representation of the page
- model to pass to .set() and this should not be needed.
- *//*
-
- addInitData: function (userId, isEditor) {
- var members = this.get('members');
-
- members[userId] = {
- userId: userId,
- editor: isEditor
- }
-
- this.set('members', members, {silent:true});
- },
-
- isUserOwner: function (userId) {
- return userId == this.get('ownerId');
- },
-
- isUserView: function(userId) {
- return userId == this.get('viewerId');
- },
-
- isUserMember: function (userId) {
- return this.get('members')[userId] ? true : false;
- },
-
- isUserEditor: function (userId) {
- var member = this.get('members')[userId];
- return member && member.editor;
- },
-
- addMember: function (userId) {
- var self = this;
-
- rave.api.rpc.addMemberToPage({pageId: self.get('id'), userId: userId,
- successCallback: function (result) {
- var members = self.get('members');
-
- members[userId] = {
- userId: userId,
- editor: false
- }
-
- self.set('members', members);
- */
-/*
- The model does not manage or care about views. Instead it fires events
- that views can subscribe to for ui representation.
- TODO: solidify and document eventing model
- *//*
-
- self.trigger('share', 'member:add', userId);
- }
- });
-
- },
-
- removeMember: function (userId) {
- var self = this;
-
- rave.api.rpc.removeMemberFromPage({pageId: self.get('id'), userId: userId,
- successCallback: function (result) {
- var members = self.get('members');
-
- delete members[userId];
-
- self.set('members', members);
- self.trigger('share', 'member:remove', userId);
- }
- });
- },
-
- removeForSelf: function(){
- var self = this;
-
- rave.api.rpc.removeMemberFromPage({pageId: self.get('id'), userId: self.get('viewerId'),
- successCallback: function () {
- self.trigger('declineShare', self.get('id'));
- }
- });
- },
-
- addEditor: function (userId) {
- var self = this;
- //updatePageEditingStatus
- rave.api.rpc.updatePageEditingStatus({pageId: self.get('id'), userId: userId, isEditor: true,
- successCallback: function () {
- var members = self.get('members');
-
- members[userId] = {
- userId: userId,
- editor: true
- }
-
- self.set('members', members);
- self.trigger('share', 'editor:add', userId);
- }
- });
- },
-
- removeEditor: function (userId) {
- var self = this;
- rave.api.rpc.updatePageEditingStatus({pageId: self.get('id'), userId: userId, isEditor: false,
- successCallback: function () {
-
- var members = self.get('members');
-
- members[userId] = {
- userId: userId,
- editor: false
- }
-
- self.set('members', members);
- self.trigger('share', 'editor:remove', userId);
- }
- });
- },
-
- cloneForUser: function (userId, pageName) {
- pageName = pageName || null;
- var self =this;
- rave.api.rpc.clonePageForUser({pageId: this.get('id'), userId: userId, pageName: pageName,
- successCallback: function(result){
- if(result.error) {
- */
-/*
- TODO: this is a weird error handling condition used by clone to catch duplicate
- named pages. Firing an event and letting the view handle for now, but the api
- should be managing errors better.
- *//*
-
- return self.trigger('error', result.errorCode, userId);
- }
- self.trigger('share', 'clone', userId);
- }
- });
- },
-
- acceptShare: function(){
- var self = this;
- rave.api.rpc.updateSharedPageStatus({pageId: this.get('id'), shareStatus: 'accepted',
- successCallback: function (result) {
- self.trigger('acceptShare', self.get('id'));
- }
- });
- },
-
- declineShare: function(){
- var self = this;
-
- rave.api.rpc.updateSharedPageStatus({pageId: this.get('id'), shareStatus: 'refused',
- successCallback: function (result) {
- rave.api.rpc.removeMemberFromPage({pageId: self.get('id'), userId: self.get('viewerId'),
- successCallback: function (result) {
- self.trigger('declineShare', self.get('id'));
- }
- });
- }
- })
- }
- });
-
- return {
- currentPage: new Page(),
- users: new Users()
- }
-
-})();
-
-*/
-
Modified: rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_person_profile.js
URL: http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_person_profile.js?rev=1495467&r1=1495466&r2=1495467&view=diff
==============================================================================
--- rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_person_profile.js (original)
+++ rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_person_profile.js Fri Jun 21 15:02:16 2013
@@ -17,8 +17,6 @@
* under the License.
*/
-// All set!!
-
define(["jquery", "./rave_portal", "core/rave_api"], function($, ravePortal, api){
// map of {subpage name, boolean} tracking whether or not a sub page has been viewed at least once
var subPagesViewedStatus = {};
@@ -535,525 +533,4 @@ define(["jquery", "./rave_portal", "core
acceptFriendRequest : acceptFriendRequest,
declineFriendRequest : declineFriendRequest
};
-})
-
-/*
-var rave = rave || {};
-rave.personprofile = rave.personprofile || (function() {
- // map of {subpage name, boolean} tracking whether or not a sub page has been viewed at least once
- var subPagesViewedStatus = {};
- function initSubPages() {
- var $tabs = $('#personProfileSubPages a[data-toggle="tab"]');
- //If the implementation does not use bootstrap tabs / subpages, skip this method
- if($tabs.length == 0){
- return;
- }
-
- //Make the tab identified by hash url active, defaulting to the first tab (Twitter Bootstrap)
- var activeSubPage = decodeURIComponent(location.hash).slice(1);
- activeSubPage = activeSubPageExists(activeSubPage, $tabs) ? activeSubPage : "";
- if (activeSubPage===''){
- activeSubPage = $tabs.first().text();
- location.hash = encodeURIComponent(activeSubPage);
- }
-
- $tabs.on('shown', function(event, ui) {
- //on tab click, change the url hash
- var page = $(this).text();
- var target = $(this).attr('href');
- var regionId = target.split('-')[1];
- location.hash = encodeURIComponent(page);
-
- // refresh the widgets on the sub page when selected to ensure proper sizing
- if (subPagesViewedStatus[page] == false) {
- // mark that this sub page has been viewed at least once and there is no need to refresh
- // the widgets in future views
- subPagesViewedStatus[page] = true;
- }
- });
-
- // build the subPageViewedStatus map to track if a given sub page has been viewed yet to determine if we need
- // to refresh the widgets upon first viewing to ensure they are sized properly. Set the default active tab to
- // true since it will be rendered and sized properly as part of the initial page load
- $.each($tabs, function(i, el){
- var $tab = $(el);
- var page = $tab.text();
- var isActive = (page == activeSubPage);
- subPagesViewedStatus[page] = false;
- //show the initial tab
- if(isActive){
- $tab.tab('show');
- }
- });
- }
-
- function activeSubPageExists(activeSubPage, tabs){
- var exists = false;
- $.each(tabs, function(i, el){
- if(el.innerHTML === activeSubPage){
- exists = true;
- }
- });
-
- return exists;
- }
-
- function updateParamsInString(i18nStr, itemsToReplace){
- for(var i=0;i<itemsToReplace.length;i++){
- var token = '{'+i+'}';
- i18nStr = i18nStr.replace(token, itemsToReplace[i]);
- }
- return i18nStr;
- }
-
- function dealWithUserResults(userResults){
- var currentUser = $("#addRemoveFriend").get(0).value;
- var searchTerm = $('#searchTerm').get(0).value;
- if(searchTerm == undefined || searchTerm == ""){
- $('#clearSearchButton').hide();
- }else{
- $('#clearSearchButton').show();
- }
- var legend;
- if(userResults.result.resultSet.length < 1){
- legend = rave.getClientMessage("no.results.found");
- }else{
- legend = updateParamsInString(rave.getClientMessage("search.list.result.x.to.y"),
- new Array(userResults.result.offset + 1, userResults.result.resultSet.length
- + userResults.result.offset, userResults.result.totalResults));
- }
- // show the listheader
- $('#userSearchListHeader').text(legend);
- var $targetDiv = $('#userSearchResults');
- $targetDiv.empty();
- // show the paginator
- paginate(userResults);
- //now build the content
- $targetDiv
- .append(
- $("<table/>")
- .addClass("searchdialogcontent")
- .append(
- $("<tr/>")
- .append(
- $("<td/>")
- .addClass("textcell")
- .append(
- $("<b/>")
- .text(rave.getClientMessage("common.username"))
- )
- )
- .append(
- $("<td/>")
- .addClass("booleancell")
- .append(
- $("<b/>")
- .text(rave.getClientMessage("common.friend.status"))
- )
- )
- )
- .append(
- $("<tbody/>")
- .attr("id", "searchResultsBody")
- )
- );
-
- jQuery.each(userResults.result.resultSet, function() {
- $('#searchResultsBody')
- .append(
- $("<tr/>")
- .attr("id", "searchResultRecord")
- .append(
- $("<td/>")
- .text(this.username)
- )
- .append(
- $("<td/>")
- .attr("id", "friendStatusButtonHolder" + this.id)
- )
- );
-
- if(this.username != currentUser){
- // check if already added
- if(rave.personprofile.isUserAlreadyFriend(this.username)){
- $('#friendStatusButtonHolder'+this.id)
- .append(
- $("<a/>")
- .attr("href", "#")
- .attr("id", this.entityId)
- .attr("onclick", "rave.personprofile.removeFriend("+this.id+", '"+this.username+"');")
- .text(rave.getClientMessage("common.remove"))
- );
- // check if already sent friend request
- }else if(rave.personprofile.isFriendRequestSent(this.username)){
- $('#friendStatusButtonHolder'+this.id)
- .append(
- $("<a/>")
- .attr("href", "#")
- .attr("id", this.entityId)
- .attr("onclick", "rave.personprofile.removeFriendRequestSent("+this.id+", '"+this.username+"');")
- .text(rave.getClientMessage("common.cancel.request"))
- );
- }else if(rave.personprofile.isFriendRequestReceived(this.username)){
- $('#friendStatusButtonHolder'+this.id)
- .append(
- $("<a/>")
- .attr("href", "#")
- .attr("id", this.entityId)
- .attr("onclick", "rave.personprofile.acceptFriendRequest("+this.entityId+", '"+this.username+"');")
- .text(rave.getClientMessage("common.accept")),
- ' / ',
- $("<a/>")
- .attr("href", "#")
- .attr("id", this.id)
- .attr("onclick", "rave.personprofile.declineFriendRequest("+this.id+", '"+this.username+"');")
- .text(rave.getClientMessage("common.decline"))
- );
- }else {
- $('#friendStatusButtonHolder'+this.id)
- .append(
- $("<a/>")
- .attr("href", "#")
- .attr("id", this.id)
- .attr("onclick", "rave.personprofile.addFriend("+this.id+", '"+this.username+"');")
- .text(rave.getClientMessage("common.add"))
- );
- }
- }
-
- });
- }
-
- function paginate(userResults){
- var $pagingDiv = $('#userSearchListPaging');
- $pagingDiv.empty();
- if(userResults.result.pageSize < userResults.result.totalResults){
- $pagingDiv.append('<div class="pagination"><ul id="pagingul" >');
- if(userResults.result.currentPage > 1){
- offset = (userResults.result.currentPage - 2) * userResults.result.pageSize;
- $('#pagingul').append('<li><a href="#" onclick="rave.api.rpc.getUsers({offset: ' +
- offset+', successCallback: function(result)' +
- ' {rave.personprofile.dealWithUserResults(result);}});"><</a></li>');
- }
- for(var i=1;i<=userResults.result.numberOfPages;i++){
- if(i == userResults.result.currentPage){
- $('#pagingul').append('<li class="active"><a href="#">'+i+'</a></li>');
- }else{
- offset = (i - 1) * userResults.result.pageSize;
- $('#pagingul').append('<li><a href="#" onclick="rave.api.rpc.getUsers({offset: ' +
- offset + ', successCallback: function(result)' +
- ' {rave.personprofile.dealWithUserResults(result);}});">' + i + '</a></li>');
- }
- }
- if (userResults.result.currentPage < userResults.result.numberOfPages){
- offset = (userResults.result.currentPage) * userResults.result.pageSize;
- $('#pagingul').append('<li><a href="#" onclick="rave.api.rpc.getUsers({offset: ' +
- offset + ', successCallback: function(result)' +
- ' {rave.personprofile.dealWithUserResults(result);}});">></a></li>');
- }
- $pagingDiv.append('</ul></div>');
- }
- }
-
- // Add a friend to the current user
- function addFriend(userId, username){
- $('#friendStatusButtonHolder'+userId).hide();
- rave.api.rpc.addFriend({friendUsername : username,
- successCallback: function(result) {
- rave.personprofile.addFriendRequestUI(username);
- $('#friendStatusButtonHolder'+userId).empty();
- $('#friendStatusButtonHolder'+userId)
- .append(
- $("<a/>")
- .attr("href", "#")
- .attr("id", userId)
- .attr("onclick", "rave.personprofile.removeFriendRequestSent(" +
- userId+", '" + username+"');")
- .text(rave.getClientMessage("common.cancel.request"))
- );
- $('#friendStatusButtonHolder'+userId).show();
- }
- });
- }
-
- // Remove a friend of the current user
- function removeFriend(userId, username){
- var message = updateParamsInString(rave.getClientMessage("remove.friend.confirm"),
- new Array(username));
- if(confirm(message)){
- $('#friendStatusButtonHolder'+userId).hide();
- rave.api.rpc.removeFriend({friendUsername : username,
- successCallback: function(result) {
- rave.personprofile.removeFriendUI(username);
- $('#friendStatusButtonHolder'+userId).empty();
- $('#friendStatusButtonHolder'+userId)
- .append(
- $("<a/>")
- .attr("href", "#")
- .attr("id", userId)
- .attr("onclick", "rave.personprofile.addFriend(" +
- userId+", '" + username+"');")
- .text(rave.getClientMessage("common.add"))
- );
- $('#friendStatusButtonHolder'+userId).show();
- }
- });
- }
- }
-
- // Cancel the friend request already sent to a user
- function removeFriendRequestSent(userId, username){
- var message = updateParamsInString(rave.getClientMessage("remove.friend.request.confirm"),
- new Array(username));
- if(confirm(message)){
- $('#friendStatusButtonHolder'+userId).hide();
- rave.api.rpc.removeFriend({friendUsername : username,
- successCallback: function(result) {
- rave.personprofile.removeFriendRequestSentUI(username);
- $('#friendStatusButtonHolder'+userId).empty();
- $('#friendStatusButtonHolder'+userId)
- .append(
- $("<a/>")
- .attr("href", "#")
- .attr("id", userId)
- .attr("onclick", "rave.personprofile.addFriend(" +
- userId+", '" + username+"');")
- .text(rave.getClientMessage("common.add"))
- );
- $('#friendStatusButtonHolder'+userId).show();
- }
- });
- }
- }
-
- // Accept the friend request received by user
- function acceptFriendRequest(userId, username){
- $('#friendStatusButtonHolder'+userId).hide();
- rave.api.rpc.acceptFriendRequest({friendUsername : username,
- successCallback: function(result) {
- rave.personprofile.removeFriendRequestReceivedUI(username);
- $('#friendStatusButtonHolder'+userId).empty();
- $('#friendStatusButtonHolder'+userId)
- .append(
- $("<a/>")
- .attr("href", "#")
- .attr("id", userId)
- .attr("onclick", "rave.personprofile.removeFriend(" +
- userId+", '" + username+"');")
- .text(rave.getClientMessage("common.remove"))
- );
- $('#friendStatusButtonHolder'+userId).show();
- }
- });
- }
-
- // Decline the friend request received by user
- function declineFriendRequest(userId, username){
- $('#friendStatusButtonHolder'+userId).hide();
- rave.api.rpc.removeFriend({friendUsername : username,
- successCallback: function(result) {
- rave.personprofile.removeFriendRequestReceivedUI(username);
- $('#friendStatusButtonHolder'+userId).empty();
- $('#friendStatusButtonHolder'+userId)
- .append(
- $("<a/>")
- .attr("href", "#")
- .attr("id", userId)
- .attr("onclick", "rave.personprofile.addFriend(" +
- userId+", '" + username+"');")
- .text(rave.getClientMessage("common.add"))
- );
- $('#friendStatusButtonHolder'+userId).show();
- }
- });
- }
- // Add an item to the List of friend requests sent(maintained for the UI)
- function addFriendRequestUI(username){
- rave.personprofile.requestsSent.push(username);
- }
-
- // Remove a friend from the list of friends(maintained for the UI)
- function removeFriendUI(friendUsername){
- rave.personprofile.friends.splice(rave.personprofile.friends.indexOf(friendUsername),1);
- }
-
- // Remove a friend request from the list of friend requests sent(maintained for the UI)
- function removeFriendRequestSentUI(friendUsername){
- rave.personprofile.requestsSent.splice(rave.personprofile.requestsSent.indexOf(friendUsername),1);
- }
-
- // Remove a friend request from the list of friend requests received(maintained for the UI)
- function removeFriendRequestReceivedUI(friendUsername){
- rave.personprofile.friendRequestsReceived.splice(rave.personprofile.friendRequestsReceived.indexOf(friendUsername),1);
- }
-
- // Check if the user is already a friend
- function isUserAlreadyFriend(username){
- if(rave.personprofile.friends.indexOf(username)>=0){
- return true;
- } else {
- return false;
- }
- }
-
- // Check if a friend request is already sent to a particular user
- function isFriendRequestSent(username){
- if(rave.personprofile.requestsSent.indexOf(username)>=0){
- return true;
- } else {
- return false;
- }
- }
-
- // Check if a friend request is received from a particular user
- function isFriendRequestReceived(username){
- if(rave.personprofile.friendRequestsReceived.indexOf(username)>=0){
- return true;
- } else {
- return false;
- }
- }
-
- function initButtons() {
- // setup the edit button if it exists
- var $editButton = $("#profileEdit");
- if ($editButton) {
- $editButton.click(function() {
- rave.api.handler.userProfileEditHandler(true);
- });
- }
- //user clicks add/remove friend button in the profile page
- var $friendButton = $("#addRemoveFriend");
- if ($friendButton) {
- $friendButton.click(function() {
- rave.personprofile.getFriends({successCallback : function() {
- rave.api.rpc.getUsers({offset: 0,
- successCallback: function(result) {
- dealWithUserResults(result);
- $("#userDialog").modal('show');
- }
- });
- }});
- });
- }
-
- // user clicks "search" in the find users dialog
- $("#userSearchButton").click(function() {
- $('#userSearchResults').empty();
- rave.api.rpc.searchUsers({searchTerm: $('#searchTerm').get(0).value, offset: 0,
- successCallback: function(result) {
- rave.personprofile.dealWithUserResults(result);
- }
- });
- });
-
- // user clicks "clear search" in the find users dialog
- $("#clearSearchButton").click(function() {
- $('#searchTerm').get(0).value = "";
- $('#userSearchResults').empty();
- rave.api.rpc.getUsers({offset: 0,
- successCallback: function(result) {
- rave.personprofile.dealWithUserResults(result);
- }
- });
- });
-
- // setup the cancel button if it exists
- var $cancelButton = $("#cancelEdit");
- if ($cancelButton) {
- $cancelButton.click(function() {
- rave.api.handler.userProfileEditHandler(false);
- });
- }
-
- // When the user accepts a friend request
- var $acceptFriend = $(".acceptFriendRequest");
- if($acceptFriend) {
- $acceptFriend.click(function(e) {
- rave.api.rpc.acceptFriendRequest({friendUsername : this.id});
- var listRequestItem = $(this).parents('.requestItem');
- var friendRequestMenu = $(listRequestItem).parent();
- $(listRequestItem).remove();
- $('.friendRequestDropdown').append('<li class="message">'+rave.getClientMessage("common.accepted")+'</li>');
- $('.message').fadeOut(2000, function() {
- $('.message').remove();
- var childItems = $(friendRequestMenu).children('li');
- $('.friendRequestDropdownLink').html(''+rave.getClientMessage("person.profile.friend.requests")+' ('+childItems.size()+')');
- if(childItems.size()==0)
- $('.friendRequestDropdown').append('<li>'+rave.getClientMessage("person.profile.friend.requests.none")+'</li>');
- });
- e.stopPropagation();
- });
- }
-
- // When the user declines a friend request
- var $declineFriend = $(".declineFriendRequest");
- if($declineFriend) {
- $declineFriend.click(function(e) {
- rave.api.rpc.removeFriend({friendUsername : this.id});
- var listRequestItem = $(this).parents('.requestItem');
- var friendRequestMenu = $(listRequestItem).parent();
- $(listRequestItem).remove();
- $('.friendRequestDropdown').append('<li class="message">'+rave.getClientMessage("common.declined")+'</li>');
- $('.message').fadeOut(2000, function() {
- $('.message').remove();
- var childItems = $(friendRequestMenu).children('li');
- $('.friendRequestDropdownLink').html(''+rave.getClientMessage("person.profile.friend.requests")+' ('+childItems.size()+')');
- if(childItems.size()==0)
- $('.friendRequestDropdown').append('<li>'+rave.getClientMessage("person.profile.friend.requests.none")+'</li>');
- });
- e.stopPropagation();
- });
- }
- }
-
- // Gets the list of friends from the DB
- function getFriends(args) {
- rave.personprofile.friends = new Array();
- rave.personprofile.requestsSent = new Array();
- rave.personprofile.friendRequestsReceived = new Array();
- rave.api.rpc.getFriends({
- successCallback: function(result) {
- jQuery.each(result.result.accepted, function() {
- if(!rave.personprofile.isUserAlreadyFriend(this.username))
- rave.personprofile.friends.push(this.username);
- });
- jQuery.each(result.result.sent, function() {
- if(!rave.personprofile.isFriendRequestSent(this.username))
- rave.personprofile.requestsSent.push(this.username);
- });
- jQuery.each(result.result.received, function() {
- if(!rave.personprofile.isFriendRequestReceived(this.username))
- rave.personprofile.friendRequestsReceived.push(this.username);
- });
- if(result !=null && typeof args.successCallback == 'function') {
- args.successCallback();
- }
- }
- });
- }
-
- function init() {
- initSubPages();
- initButtons();
- }
-
- return {
- init : init,
- dealWithUserResults : dealWithUserResults,
- addFriend : addFriend,
- removeFriend : removeFriend,
- removeFriendUI : removeFriendUI,
- removeFriendRequestSent : removeFriendRequestSent,
- addFriendRequestUI : addFriendRequestUI,
- removeFriendRequestSentUI : removeFriendRequestSentUI,
- isUserAlreadyFriend : isUserAlreadyFriend,
- isFriendRequestSent : isFriendRequestSent,
- isFriendRequestReceived : isFriendRequestReceived,
- removeFriendRequestReceivedUI : removeFriendRequestReceivedUI,
- getFriends : getFriends,
- acceptFriendRequest : acceptFriendRequest,
- declineFriendRequest : declineFriendRequest
- };
-}());
-*/
+})
\ No newline at end of file
Modified: rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_portal.js
URL: http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_portal.js?rev=1495467&r1=1495466&r2=1495467&view=diff
==============================================================================
--- rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_portal.js (original)
+++ rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_portal.js Fri Jun 21 15:02:16 2013
@@ -17,8 +17,6 @@
* under the License.
*/
-//All set!
-
define(["jquery", "underscore", "core/rave_api", "./rave_templates"], function($, _, api, raveTemplates){
var clientMessages = {};
var context="";
@@ -303,4 +301,4 @@ define(["jquery", "underscore", "core/ra
registerOnPageInitizalizedHandler: registerOnPageInitizalizedHandler,
runOnPageInitializedHandlers: runOnPageInitializedHandlers
}
-})
\ No newline at end of file
+})
Modified: rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_store.js
URL: http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_store.js?rev=1495467&r1=1495466&r2=1495467&view=diff
==============================================================================
--- rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_store.js (original)
+++ rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_store.js Fri Jun 21 15:02:16 2013
@@ -17,8 +17,6 @@
* under the License.
*/
-//All set!
-
define(["jquery", "core/rave_api", "./rave_portal", "./rave_context"], function($, api, ravePortal, raveContext){
function initRatings() {
$('.ratingButtons').button();
@@ -247,238 +245,4 @@ define(["jquery", "core/rave_api", "./ra
initTags: initTags,
confirmAddFromMarketplace : confirmAddFromMarketplace
};
-})
-
-/*
-var rave = rave || {};
-rave.store = rave.store || (function() {
-
- function initRatings() {
- $('.ratingButtons').button();
-
- //Adjust width's
- $('.widgetRating').each(function(){
- var $likeBtn = $(this).find(".widgetLikeButton"),
- $likeCount = $(this).find(".widgetLikeCount"),
- $dislikeBtn = $(this).find(".widgetDislikeButton"),
- $dislikeCount = $(this).find(".widgetDislikeCount");
-
- if($likeBtn.outerWidth() >= $likeCount.outerWidth()){
- $likeCount.css( "width", $likeBtn.outerWidth() +"px" ); }
- else{
- $likeBtn.css( "width", $likeCount.outerWidth() +"px" );
- }
-
- if($dislikeBtn.outerWidth() >= $dislikeCount.outerWidth()){
- $dislikeCount.css( "width", $dislikeBtn.outerWidth() +"px" );
- }
- else{ $dislikeBtn.css( "width", $dislikeCount.outerWidth() +"px"); }
- });
-
- $('.widgetLikeButton').click(function() {
- // If not already active
- if (!$(this).hasClass('active')){
- //retrieve widget id
- var widgetId = this.id.substring("like-".length);
-
- //update the widget score in database
- rave.api.rest.updateWidgetRating({widgetId: widgetId, score: 10});
-
- //call update widget rating handler function
- var widgetRating = {
- widgetId: widgetId,
- widgetLikeButton: this,
- widgetDislikeButton: $("#dislike-" + widgetId),
- isLike: true
- };
-
- //update the widget ratings on web page
- rave.api.handler.widgetRatingHandler(widgetRating);
-
- $(this).addClass('btn-success');
- $(this).siblings('.btn').removeClass('btn-danger');
- }
- });
-
- $('.widgetDislikeButton').click(function() {
- // If not already active
- if (!$(this).hasClass('active')){
- //retrieve widget id
- var widgetId = this.id.substring("dislike-".length);
-
- //update the widget score in database
- rave.api.rest.updateWidgetRating({widgetId: widgetId, score: 0});
-
- //call update widget rating handler function
- var widgetRating = {
- widgetId: widgetId,
- widgetLikeButton: $("#like-" + widgetId),
- widgetDislikeButton: this,
- isLike: false
- };
-
- //update the widget ratings on web page
- rave.api.handler.widgetRatingHandler(widgetRating);
-
- $(this).addClass('btn-danger');
- $(this).siblings('.btn').removeClass('btn-success');
-
- }
- });
- }
-
- function initComments() {
-
- $(".commentNewButton").button( {
- icons: {primary: "ui-icon-disk"},
- text: false
- }).click(function() {
- var widgetId = this.id.substring("comment-new-".length);
- rave.api.rest.createWidgetComment({widgetId: widgetId,
- text: $("#newComment-"+widgetId).get(0).value,
- successCallback: function() { window.location.reload(); }});
- });
-
- $(".commentDeleteButton").button( {
- icons: {primary: "ui-icon-close"},
- text: false
- }).click(function() {
- var commentId = this.id.substring("comment-delete-".length);
- var widgetId = this.getAttribute('data-widgetid');
- rave.api.rest.deleteWidgetComment({widgetId: widgetId,
- commentId: commentId,
- successCallback: function() { window.location.reload(); }});
- });
-
- $(".commentEditButton").click(function() {
- var commentId = this.id.substring("comment-edit-".length);
- var widgetId = this.getAttribute('data-widgetid');
- var commentText = $(this).parents(".comment").find(".commentText").text();
- $("#editComment").html(commentText);
- $("#editComment-dialog #updateComment").click( function(){
- rave.api.rest.updateWidgetComment({widgetId: widgetId,
- commentId: commentId,
- text: $("#editComment").get(0).value,
- successCallback: function() { window.location.reload(); }
- });
- }).html(rave.getClientMessage("common.update"));
- });
- }
-
- function initTags(widgetId) {
- $('*[data-toggle="basic-slide"]').click(function(){
- var target;
-
- if($(this).attr("data-target")){
- target = $(this).attr("data-target");
- console.log($(this).attr("data-target"));
- }
- else{
- target = $(this).attr("href");
- console.log("else");
- }
-
- if($(this).attr('data-toggle-text')){
- var oldcontent = $(this).html();
- $(this).html($(this).attr('data-toggle-text'));
- $(this).attr('data-toggle-text',oldcontent);
- }
- $(target).slideToggle();
- });
- $(".tagNewButton").click(function () {
- var widgetId = this.id.substring("tag-new-".length);
- rave.api.rest.createWidgetTag({widgetId:widgetId,
- text:$("#tags").get(0).value,
- successCallback:function () {
- window.location.reload();
- }});
- });
- // load the tag by widgetId
- rave.api.rest.getTags({ widgetId:widgetId,
- successCallback:function (data) {
- var result = ($.map(data, function (tag) {
- return {
- label:tag.keyword,
- value:tag.keyword
- }
- }));
- $("#tags").typeahead({
- source:result
- })
- }
- })
- }
-
- function initWidgetsTag(referringPageId) {
- if (referringPageId != null){
- // tag list box
- $("#tagList").change(function() {
- var selected = $("#tagList option:selected").text();
- selected=$.trim(selected)
- if (selected.length > 1) {
- document.location.href = rave.getContext() + "store/tag?keyword=" + selected
- +"&referringPageId="+referringPageId;
- }
- });
- }
- }
-
- function initWidgetsCategory(referringPageId) {
- if (referringPageId != null){
- // category list box
- $("#categoryList").change(function() {
- var selected = $("#categoryList option:selected").val();
- selected = parseInt(selected);
- if (!isNaN(selected) && selected != "0") {
- document.location.href = rave.getContext() + "store/category?categoryId=" + selected
- +"&referringPageId="+referringPageId;
- } else {
- document.location.href = rave.getContext() + "store?referringPageId="+referringPageId;
- }
- });
- }
- }
-
- function initMarketplaceCategory(referringPageId) {
- if (referringPageId != null){
- // category list box
- $("#marketplaceCategoryList").change(function() {
- var selectedCategory = $("#marketplaceCategoryList option:selected").val();
- document.location.href = rave.getContext() + "marketplace/category/"+selectedCategory
- +"?referringPageId="+referringPageId;
- });
- }
- }
-
- function confirmAddFromMarketplace(uri, pType){
- var answer = confirm(rave.getClientMessage("confirm.add.from.marketplace"));
- if(answer){
- rave.api.rpc.addWidgetFromMarketplace({
- url: uri,
- providerType: pType,
- successCallback: function(widget){
- if(widget.result == null){
- alert(rave.getClientMessage("failed.add.from.marketplace"));
- }else{
- alert("(" + widget.result.title + ") " + rave.getClientMessage("success.add.from.marketplace"));
- }
- }
- });
- }
- }
-
- function init(referringPageId){
- initRatings();
- initComments();
- initWidgetsTag(referringPageId);
- initWidgetsCategory(referringPageId);
- initMarketplaceCategory(referringPageId);
- }
-
- return {
- init: init,
- initTags: initTags,
- confirmAddFromMarketplace : confirmAddFromMarketplace
- };
-
-}());*/
+})
\ No newline at end of file
Modified: rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_templates.js
URL: http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_templates.js?rev=1495467&r1=1495466&r2=1495467&view=diff
==============================================================================
--- rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_templates.js (original)
+++ rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_templates.js Fri Jun 21 15:02:16 2013
@@ -1,11 +1,21 @@
-/**
- * Created with IntelliJ IDEA.
- * User: DGORNSTEIN
- * Date: 6/14/13
- * Time: 8:45 AM
- * To change this template use File | Settings | File Templates.
+/*
+ * 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.
*/
-//All set!!
define(["handlebars", "jquery"], function(Handlebars, $){
var templates = {}
Modified: rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_ui.js
URL: http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_ui.js?rev=1495467&r1=1495466&r2=1495467&view=diff
==============================================================================
--- rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_ui.js (original)
+++ rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_ui.js Fri Jun 21 15:02:16 2013
@@ -17,8 +17,6 @@
* under the License.
*/
-//All set!!
-
define(["core/rave_core", "jquery", "underscore", "handlebars","./rave_portal", "./rave_backbone", "./rave_models", "./rave_templates", "core/rave_view_manager", "core/rave_widget", "./rave_context"],
function(raveCore, $, _, Handlebars, ravePortal, raveBackbone, raveModels, raveTemplates, raveViewManager, raveRegionWidget, raveContext){
var exports = {};
@@ -910,4 +908,4 @@ define(["core/rave_core", "jquery", "und
raveCore.registerOnInitHandler(init);
return exports;
-})
\ No newline at end of file
+})
Modified: rave/branches/require/rave-portal/pom.xml
URL: http://svn.apache.org/viewvc/rave/branches/require/rave-portal/pom.xml?rev=1495467&r1=1495466&r2=1495467&view=diff
==============================================================================
--- rave/branches/require/rave-portal/pom.xml (original)
+++ rave/branches/require/rave-portal/pom.xml Fri Jun 21 15:02:16 2013
@@ -189,7 +189,7 @@
cargo.datasource.password=${shindig.dataSource.password}
</cargo.datasource.datasource.shindigDB>
<cargo.jvmargs>
- <![CDATA[-Dh2.bindAddress="localhost" -Xdebug -XX:MaxPermSize=256m -Xrunjdwp:transport=dt_socket,address=${cargo.debug.address},server=y,suspend=${cargo.debug.suspend} -noverify ${javaagent} ${cargo.args}]]>
+ <![CDATA[-Dhttp.proxyHost="gatekeeper.mitre.org" -Dhttp.proxyPort=80 -Dhttp.nonProxyHosts="*.mitre.org|127.0.0.1|localhost" -Dh2.bindAddress="localhost" -Xdebug -XX:MaxPermSize=256m -Xrunjdwp:transport=dt_socket,address=${cargo.debug.address},server=y,suspend=${cargo.debug.suspend} -noverify ${javaagent} ${cargo.args}]]>
</cargo.jvmargs>
<cargo.tomcat.context.reloadable>true</cargo.tomcat.context.reloadable>
</properties>
Modified: rave/branches/require/rave-providers/rave-opensocial-provider/rave-opensocial-client/src/main/java/org/apache/rave/provider/opensocial/web/renderer/OpenSocialWidgetWrapperRenderer.java
URL: http://svn.apache.org/viewvc/rave/branches/require/rave-providers/rave-opensocial-provider/rave-opensocial-client/src/main/java/org/apache/rave/provider/opensocial/web/renderer/OpenSocialWidgetWrapperRenderer.java?rev=1495467&r1=1495466&r2=1495467&view=diff
==============================================================================
--- rave/branches/require/rave-providers/rave-opensocial-provider/rave-opensocial-client/src/main/java/org/apache/rave/provider/opensocial/web/renderer/OpenSocialWidgetWrapperRenderer.java (original)
+++ rave/branches/require/rave-providers/rave-opensocial-provider/rave-opensocial-client/src/main/java/org/apache/rave/provider/opensocial/web/renderer/OpenSocialWidgetWrapperRenderer.java Fri Jun 21 15:02:16 2013
@@ -64,7 +64,7 @@ public class OpenSocialWidgetWrapperRend
//Note the widgets.push() call. This defines the widget objects, which are
//added to the widgets[] array in home.jsp.
private static final String SCRIPT_BLOCK =
- "<script>require(['core/main'], function(main){rave.registerWidget('%1$s', {type: '%2$s'," +
+ "<script>require(['core/rave_core'], function(raveCore){raveCore.registerWidget('%1$s', {type: '%2$s'," +
" regionWidgetId: '%3$s'," +
" widgetUrl: '%4$s', " +
" securityToken: '%5$s', " +