Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

first commit

  • Loading branch information...
commit 926b4f9e6668084d5bfc08e1cae70842a6c40478 0 parents
vinodk321 authored
BIN  .DS_Store
Binary file not shown
BIN  Apex Classes/.DS_Store
Binary file not shown
52 Apex Classes/ForumPageExt.cls.txt
@@ -0,0 +1,52 @@
+public class ForumPageExt {
+public string currentId { get;set;}
+public string fbName { get; set; }
+public string fbId { get; set; }
+public string fbaccessToken {get;set;}
+public integer fbAnswerCount {get;set;}
+public string warMessage {get;set;}
+public List<forumAnswer__c> fans{get;set;}
+public final forumQuestion__c fqs;
+
+
+public ForumPageExt(ApexPages.StandardController controller) {
+PageReference x = ApexPages.currentPage();
+String y = x.getUrl();
+
+if(y.contains('TopicListings'))
+{
+ fqs = (forumQuestion__c)controller.getRecord();
+ warMessage = '';
+ if(ApexPages.currentPage().getParameters().get('cmpost') == 'yes')
+ {
+  warMessage  = ''; // Add verbage if you need a message for validating comment
+ }
+ if(fqs != null)
+ {
+ try{
+ fans =[select id,name,reply__c,approved__c,dateCreated__c from forumAnswer__c where topicanswer__r.id =:fqs.id];
+ fbAnswerCount = fans.size();
+ }catch(Exception e){}
+}
+}
+if(ApexPages.currentPage().getParameters().get('fbuserid') != '' || ApexPages.currentPage().getParameters().get('fbuserid') != null)
+{
+ this.fbId = ApexPages.currentPage().getParameters().get('fbuserid');
+
+ if(fbId != null || fbId !=  '')
+ {
+ try{
+  FBUserSession__c fbus = [select id,fbuserId__c,UserInfo__c,Name from FBUserSession__c where fbuserId__c=:fbId];
+  this.fbName = fbus.Name;
+  this.fbaccessToken = fbus.UserInfo__c;
+  }catch (Exception ex){}
+ }
+ }
+
+else 
+{
+  
+ }
+}
+
+}
78 Apex Classes/forumProxy.cls.txt
@@ -0,0 +1,78 @@
+public class forumProxy {
+    public string ttopic{get; set;}
+    public string tdesc{get; set;}
+    public string temail{get; set;}
+    public string headers {get; set;}
+
+    public string ftopic = '';
+    public string fcategory = '';
+   
+    public PageReference getTopic() {
+
+    return null;
+    }
+    
+    public PageReference init() {
+     if ( ApexPages.currentPage().getParameters().get('topic') != null )
+     {
+         ttopic = ApexPages.currentPage().getParameters().get('topic');
+         tdesc = ApexPages.currentPage().getParameters().get('desc');
+         temail = ApexPages.currentPage().getParameters().get('email');
+         fcategory = ApexPages.currentPage().getParameters().get('fromCategory');
+         forumQuestion__c fq = new forumQuestion__c();
+         fq.name = ttopic;
+         fq.details__c = tdesc;
+         fq.email__c = temail;
+         fq.forumCategory__c = fcategory;
+         insert fq;
+         PageReference listPage = new PageReference('/apex/forumPage?id='+fcategory+'&fbuserid='+ ApexPages.currentPage().getParameters().get('fbuserid'));
+         listPage.setRedirect(true);
+         return listPage;
+     }
+     else if (ApexPages.currentPage().getParameters().get('namea') != null) 
+     {  
+  
+         ttopic = ApexPages.currentPage().getParameters().get('namea');
+         tdesc = ApexPages.currentPage().getParameters().get('reply');
+         ftopic = ApexPages.currentPage().getParameters().get('fromTopic');
+         forumAnswer__c fa = new forumAnswer__c();         
+         fa.name = ttopic;
+         fa.reply__c = tdesc;   
+         fa.topicanswer__c  = ftopic;
+         insert fa;          
+         List<FBUserSession__c> dbus = [select id,name,fbemail__c from FBUserSession__c where fbuserId__c=:ApexPages.currentPage().getParameters().get('fbuserid')];
+         List<EmailUser__c> existeu = [select id from EmailUser__c where FBUserSession__c=:dbus[0].id and forumQuestion__c=:ftopic limit 1];
+         if(existeu.size() == 0){
+         EmailUser__c eu = new EmailUser__c();
+         eu.FBUserSession__c = dbus[0].id;
+         eu.forumQuestion__c = ftopic;
+         insert eu;
+         }
+         List<EmailUser__c> ems = [select id,FBUserSession__c,FBUserSession__r.fbemail__c,FBUserSession__r.name,forumQuestion__r.name from EmailUser__c where forumQuestion__c=:ftopic];          
+         if(ems.size() != 0)
+         {
+             for(EmailUser__c e:ems){
+             if(e.FBUserSession__c != dbus[0].id){
+             Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
+             String[] toAddress  = new String[]{e.FBUserSession__r.fbemail__c};
+             mail.setToAddresses(toAddress);       
+             mail.setReplyTo('vinod.anand@jktech.com');
+             mail.setSenderDisplayName('Qwarrel');
+             mail.setSubject( 'On Topic : ' + e.forumQuestion__r.name );
+             mail.setBccSender(false);
+             mail.setUseSignature(false);          
+             mail.setHtmlBody('Hello <b>' + e.FBUserSession__r.name + '<b>,<br><p>' + dbus[0].name + ' also commented on topic ' + e.forumQuestion__r.name + ' see the comment below,</p><p>' + tdesc +'</p>');
+             Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
+             }
+             }          
+         }
+         PageReference listPage = new PageReference('/apex/TopicListings?cmpost=yes&id='+ftopic+'&fbuserid='+ ApexPages.currentPage().getParameters().get('fbuserid'));
+         listPage.setRedirect(true);
+         return listPage;
+      }   
+   else 
+   {
+    return null;
+   }
+    }
+}
39 README
@@ -0,0 +1,39 @@
+About Qwarrel App
+
+1. Qwarrel App is nothing but a Discussion Forum. Basically this mobile app is developed using Jquery mobile, Visual force and Apex and force.com sites.
+
+2. Qwarrel App is browser based mobile application,
+
+3. this Qwarrel app has also Facebook login option to post the comments/topic but as a guest Users also can view the Qwarrel App.
+
+4. Here the Qwarrel app basically the information is organized as the Categories like Books, Movies , Creativity & innovative ideas ….
+
+5 . Under these Categories an User can create a topic/view the topics. Here the topic acts as a discussion thread for user to discuss that is by means of posting comments,
+
+6. But for posting the comments an User should be logged in using Facebook User id.
+
+7. I have used Facebook integration api to communicate from SFDC and Facebook.
+
+8. And also there is a separate Facebook app is created in Facebook called Qwarrel,
+
+9. This app does not require the SFDC user id and this app is used for community for sharing the information across sales user/Customers/Contacts/Accounts in SFDC who has Facebook User id.
+
+10. As a future enhancements, We can also provide SFDC authentication and authorization using SFDC rest api.
+
+Test Data for Qwarrel App:
+
+1. Books
+ a. Apex - Business Logic/Custom Logic in SFDC
+ b. Visual Force - For UI interface in SFDC
+ c. Adobe Flex - To build RIA
+ d. Webservices - Integration with Third part apps.
+ e. Rest Api
+ f. ORM tools. - Object to Relational Mapping.
+2. Movies.
+ a. Spider Man
+ b. Titanic
+ c. Lord of the Rings
+ d. Mission Impossible
+3. Creativity and Innovative Ideas.
+ a. Future Mobile Apps.
+ b. Cloud Computing
61 VF Pages/NewAnswer.page.rtf
@@ -0,0 +1,61 @@
+{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf230
+{\fonttbl\f0\fmodern\fcharset0 CourierNewPSMT;}
+{\colortbl;\red255\green255\blue255;}
+\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
+\deftab720
+\pard\pardeftab720
+
+\f0\fs24 \cf0 <apex:page standardController="forumQuestion__c" extensions="ForumPageExt" showHeader="false" sidebar="false" standardStylesheets="false">\
+<head>\
+ <meta content="width=device-width, minimum-scale=1.0, maximum-scale=1.6" name="viewport" /> \
+<meta http-equiv="CACHE-CONTROL" content="NO-CACHE" />\
+<meta http-equiv="pragma" content="no-cache" />\
+<meta http-equiv="EXPIRES" content="Mon, 01 Jan 2000 00:00:01 GMT" />\
+\
+<apex:stylesheet value="http://code.jquery.com/mobile/1.0rc1/jquery.mobile-1.0rc1.min.css" /> \
+<script src="http://code.jquery.com/jquery-1.6.4.min.js" ></script>\
+<script src="http://code.jquery.com/mobile/1.0rc1/jquery.mobile-1.0rc1.min.js" ></script>\
+<apex:includeScript value="\{!URLFOR($Resource.jQueryFiles, 'js/jquery-ui-1.8.7.custom.min.js')\}" />\
+<link rel="stylesheet" href="\{!URLFOR($Resource.jQueryFiles, 'css/ui-lightness/jquery-ui-1.8.7.custom.css')\}" />\
+<script>\
+ jQuery.noConflict();\
+ </script>\
+ \
+</head>\
+ \
+<body>\
+ <div data-role="page" data-theme="b" data-cache="false">\
+ <div data-role="header" id="hdrMain" name="hdrMain" data-nobackbtn="true">\
+ <h1>New Comment</h1>\
+ </div>\
+ <div data-role="content" id="contentMain" name="contentMain" > \
+ <form action="/apex/proxyVF?fbuserid=\{!fbId\}" method="post" data-ajax="false">\
+\
+\
+ <div id="topicDiv" data-role="fieldcontain">\
+ <label for="namea">Name:</label>\
+ <input name="namea" id="namea" value="" type="text" />\
+\
+ </div>\
+\
+ <div id="descDiv" data-role="fieldcontain">\
+ <label for="reply">Message:</label>\
+ <textarea cols="40" rows="8" name="reply" id="reply"></textarea>\
+</div>\
+ \
+ <input type="hidden" name="fromTopic" value="\{!forumQuestion__c.id\}" />\
+ \
+ <div id="submitDiv" data-role="fieldcontain"> \
+ <input type="submit" value="Submit Comment" data-inline="true"/>\
+ </div>\
+ \
+ </form>\
+ </div>\
+ \
+ <div data-role="footer" >\
+ All Rights reservered.\
+ </div>\
+ \
+ </div>\
+ </body>\
+ </apex:page>}
63 VF Pages/NewTopic.page.rtf
@@ -0,0 +1,63 @@
+{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf230
+{\fonttbl\f0\fmodern\fcharset0 CourierNewPSMT;}
+{\colortbl;\red255\green255\blue255;}
+\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
+\deftab720
+\pard\pardeftab720
+
+\f0\fs24 \cf0 <apex:page standardController="forumCategory__c" extensions="ForumPageExt" showHeader="false" sidebar="false" standardStylesheets="false">\
+<head>\
+<meta content="width=device-width, minimum-scale=1.0, maximum-scale=1.6" name="viewport" /> \
+<meta http-equiv="CACHE-CONTROL" content="NO-CACHE" />\
+<meta http-equiv="pragma" content="no-cache" />\
+<meta http-equiv="EXPIRES" content="Mon, 01 Jan 2000 00:00:01 GMT" />\
+\
+<apex:stylesheet value="http://code.jquery.com/mobile/1.0rc1/jquery.mobile-1.0rc1.min.css" /> \
+<script src="http://code.jquery.com/jquery-1.6.4.min.js" ></script>\
+<script src="http://code.jquery.com/mobile/1.0rc1/jquery.mobile-1.0rc1.min.js" ></script>\
+<apex:includeScript value="\{!URLFOR($Resource.jQueryFiles, 'js/jquery-ui-1.8.7.custom.min.js')\}" />\
+<link rel="stylesheet" href="\{!URLFOR($Resource.jQueryFiles, 'css/ui-lightness/jquery-ui-1.8.7.custom.css')\}" />\
+<script>\
+ jQuery.noConflict();\
+ </script>\
+ \
+</head>\
+ \
+<body>\
+ <div data-role="page" data-theme="b" data-cache="false">\
+ <div data-role="header" id="hdrMain" name="hdrMain" data-nobackbtn="true">\
+ <h1>New Topic</h1>\
+ </div>\
+ <div data-role="content" id="contentMain" name="contentMain" > \
+ <form action="/apex/ProxyVF?fbuserid=\{!fbId\}" method="post" data-ajax="false">\
+\
+\
+ <div id="topicDiv" data-role="fieldcontain">\
+ <label for="topic-c">Topic:</label>\
+ <input name="topic" id="topic-c" value="" type="text" />\
+\
+ </div>\
+\
+ <div id="descDiv" data-role="fieldcontain">\
+ <label for="desc">Description:</label>\
+ <textarea cols="40" rows="8" name="desc" id="desc"></textarea>\
+</div>\
+ <div id="topicDiv" data-role="fieldcontain">\
+ <label for="email-c">Email:</label>\
+ <input name="email" id="email-c" value="" type="text" />\
+<input type="hidden" name="fromCategory" value="\{!forumCategory__c.id\}" />\
+ </div>\
+ <div id="submitDiv" data-role="fieldcontain"> \
+ <input type="submit" value="Submit Topic" data-inline="true"/>\
+ </div>\
+\
+</form>\
+ </div>\
+ \
+ <div data-role="footer" >\
+ All Rights reservered.\
+ </div>\
+ \
+ </div>\
+ </body>\
+ </apex:page>}
68 VF Pages/TopicListings.page.rtf
@@ -0,0 +1,68 @@
+{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf230
+{\fonttbl\f0\fmodern\fcharset0 CourierNewPSMT;}
+{\colortbl;\red255\green255\blue255;}
+\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
+\deftab720
+\pard\pardeftab720
+
+\f0\fs24 \cf0 <apex:page standardController="forumQuestion__c" showHeader="false" sidebar="false" extensions="ForumPageExt" standardStylesheets="false">\
+<head>\
+ <meta content="width=device-width, minimum-scale=1.0, maximum-scale=1.6" name="viewport" /> \
+<meta http-equiv="CACHE-CONTROL" content="NO-CACHE" />\
+<meta http-equiv="pragma" content="no-cache" />\
+<meta http-equiv="EXPIRES" content="Mon, 01 Jan 2000 00:00:01 GMT" />\
+\
+<apex:stylesheet value="http://code.jquery.com/mobile/1.0rc1/jquery.mobile-1.0rc1.min.css" /> \
+<script src="http://code.jquery.com/jquery-1.6.4.min.js" ></script>\
+<script src="http://code.jquery.com/mobile/1.0rc1/jquery.mobile-1.0rc1.min.js" ></script>\
+<link rel="stylesheet" href="http://d2dnrmagaqciul.cloudfront.net/samples/star_rating_final/star_rating.css" />\
+\
+\
+\
+\
+<script>\
+ jQuery.noConflict();\
+ </script>\
+ \
+</head>\
+<body>\
+\
+<div id="fb-root"></div>\
+<script>(function(d, s, id) \{\
+ var js, fjs = d.getElementsByTagName(s)[0];\
+ if (d.getElementById(id)) \{return;\}\
+ js = d.createElement(s); js.id = id;\
+ js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=234320203292497";\
+ fjs.parentNode.insertBefore(js, fjs);\
+\}(document, 'script', 'facebook-jssdk'));</script>\
+<div data-role="page" data-cache="false" data-theme="b">\
+ <div data-role="header" data-add-back-btn="false">\
+ Qwarrel App &nbsp;Welcome &nbsp;\{!fbName\}&nbsp;&nbsp;\
+ </div>\
+\
+ <div data-role="content">\
+\
+\{!warMessage\}\
+ <ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="b">\
+ <li data-role="list-divider">\{!forumQuestion__c.name\}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;replies :&nbsp;\{!fbAnswerCount\} </li>\
+ <apex:repeat var="a" value="\{!fans\}" id="list">\
+ <li><apex:outputField value="\{!a.reply__c\}" /><br /><font color="green" size="1pt"> posted by:\{!a.name\} &nbsp;&nbsp;\{!a.dateCreated__c\}</font>\
+ \
+<c:FacebookLike postName="\{!a.id\}" style="" /> \
+ </li>\
+ \
+ </apex:repeat>\
+ \
+ \
+ </ul> \
+ <a href="/apex/NewAnswer?id=\{!forumQuestion__c.id\}&fbuserid=\{!fbId\}" data-role="button" data-icon="plus">Add a Comment</a> \
+ </div>\
+\
+ <div data-role="footer" >\
+ <a href="/apex/forumPage?fbuserid=\{!fbId\}&id=\{!forumQuestion__c.forumCategory__r\}" data-icon="home" data-iconpos="notext" data-role="button" data-theme="b" /> &nbsp;&nbsp; <a href="https://www.facebook.com/logout.php?next=https://jnan-developer-edition.ap1.force.com&access_token=\{!fbaccessToken\}">Logout</a><br/> \
+\
+ </div>\
+\
+</div>\
+</body>\
+</apex:page>}
52 VF Pages/forumHome.page.rtf
@@ -0,0 +1,52 @@
+{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf230
+{\fonttbl\f0\fmodern\fcharset0 CourierNewPSMT;}
+{\colortbl;\red255\green255\blue255;}
+\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
+\deftab720
+\pard\pardeftab720
+
+\f0\fs24 \cf0 <apex:page standardController="forumCategory__c" recordSetvar="listings" showHeader="false" sidebar="false" standardStylesheets="false">\
+<head>\
+<meta content="width=device-width, minimum-scale=1.0, maximum-scale=1.6" name="viewport" /> \
+<meta http-equiv="CACHE-CONTROL" content="NO-CACHE" />\
+<meta http-equiv="pragma" content="no-cache" />\
+<meta http-equiv="EXPIRES" content="Mon, 01 Jan 2000 00:00:01 GMT" />\
+<apex:stylesheet value="http://code.jquery.com/mobile/1.0rc1/jquery.mobile-1.0rc1.min.css" /> \
+<script src="http://code.jquery.com/jquery-1.6.4.min.js" ></script>\
+<script src="http://code.jquery.com/mobile/1.0rc1/jquery.mobile-1.0rc1.min.js" ></script>\
+<apex:includeScript value="\{!URLFOR($Resource.jQueryFiles, 'js/jquery-ui-1.8.7.custom.min.js')\}" />\
+<link rel="stylesheet" href="\{!URLFOR($Resource.jQueryFiles, 'css/ui-lightness/jquery-ui-1.8.7.custom.css')\}" />\
+<script>\
+ jQuery.noConflict(); \
+ </script>\
+ \
+</head>\
+ \
+<body>\
+<div id="fb-root"></div>\
+\
+ <div data-role="page" data-cache="false" data-theme="b">\
+ <div data-role="header" data-add-back-btn="false">\
+ Qwarrel App\
+ </div>\
+ \
+ <div data-role="content">\
+ \
+ <ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="b">\
+ <li data-role="list-divider">Categories</li>\
+ <li><a rel="external" href="/apex/QwarrelFBLogin?fbappid=a0F90000002QFde" >Join/Login Qwarrel</a></li>\
+ <apex:repeat var="a" value="\{!listings\}" id="list">\
+ <li><a rel="external" href="/apex/forumPage?id=\{!a.id\}" data-transition="flip" >\
+ <apex:outputField value="\{!a.name\}"/>&nbsp; &nbsp;<apex:outputField value="\{!a.Description__c\}"/></a></li>\
+ </apex:repeat>\
+ </ul>\
+ \
+ </div>\
+\
+ <div data-role="footer" >\
+ All Rights Reserved.\
+ </div>\
+ \
+ </div>\
+ </body>\
+ </apex:page>}
49 VF Pages/forumPage.page.rtf
@@ -0,0 +1,49 @@
+{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf230
+{\fonttbl\f0\fmodern\fcharset0 CourierNewPSMT;}
+{\colortbl;\red255\green255\blue255;}
+\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
+\deftab720
+\pard\pardeftab720
+
+\f0\fs24 \cf0 <apex:page standardController="forumCategory__c" extensions="ForumPageExt" showHeader="false" sidebar="false" standardStylesheets="false">\
+<head>\
+ <meta content="width=device-width, minimum-scale=1.0, maximum-scale=1.6" name="viewport" /> \
+<meta http-equiv="CACHE-CONTROL" content="NO-CACHE" />\
+<meta http-equiv="pragma" content="no-cache" />\
+<meta http-equiv="EXPIRES" content="Mon, 01 Jan 2000 00:00:01 GMT" />\
+\
+<apex:stylesheet value="http://code.jquery.com/mobile/1.0rc1/jquery.mobile-1.0rc1.min.css" /> \
+<script src="http://code.jquery.com/jquery-1.6.4.min.js" ></script>\
+<script src="http://code.jquery.com/mobile/1.0rc1/jquery.mobile-1.0rc1.min.js" ></script>\
+<apex:includeScript value="\{!URLFOR($Resource.jQueryFiles, 'js/jquery-ui-1.8.7.custom.min.js')\}" />\
+<link rel="stylesheet" href="\{!URLFOR($Resource.jQueryFiles, 'css/ui-lightness/jquery-ui-1.8.7.custom.css')\}" />\
+<script>\
+ jQuery.noConflict();\
+ </script>\
+</head>\
+ \
+<body>\
+ <div data-role="page" data-cache="false" data-theme="b">\
+ <div data-role="header" data-add-back-btn="false">\
+ Qwarrel App &nbsp;Welcome &nbsp;\{!fbName\}&nbsp;&nbsp;\
+ </div>\
+ \
+ <div data-role="content">\
+\
+ <ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="b">\
+ <li data-role="list-divider">Discussion Topics</li>\
+ <apex:repeat var="a" value="\{!forumCategory__c.forumQuestions__r\}" id="list">\
+ <li><a rel="external" href="/apex/TopicListings?id=\{!a.id\}&fbuserid=\{!fbId\}" data-transition="flip" >\
+ <apex:outputField value="\{!a.name\}"/>&nbsp; &ndash; &nbsp;<apex:outputField value="\{!a.details__c\}"/></a></li>\
+ </apex:repeat>\
+ </ul>\
+ <a href="/apex/NewTopic?id=\{!forumCategory__c.id\}&fbuserid=\{!fbId\}" data-role="button" data-icon="plus">Add a topic</a> \
+ </div>\
+ \
+ <div data-role="footer" >\
+ <a href="/apex/forumHome" data-icon="home" data-iconpos="notext" /> <a href="https://www.facebook.com/logout.php?next=&access_token=\{!fbaccessToken\}">Logout</a><br/> \
+ </div>\
+ \
+ </div>\
+ </body>\
+ </apex:page>}
Please sign in to comment.
Something went wrong with that request. Please try again.