Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions conf/localOverrides.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -330,5 +330,16 @@ $problemDefaults{max_attempts} = -1;

#$session_management_via = "session_cookie";

################################################################################
# Achievement Facebook Integration
################################################################################

## Because of the way facebook works, in order to use facebook integration
## with webwork, you will need to create a facebook "app" specific to the
## domain name of the server you are running. Once you have created the app
## you can enable facebook integration by setting the variables below

#$allowFacebooking = 1;
#$facebookAppId = your_app_id_here;

1; #final line of the file to reassure perl that it was read properly.
37 changes: 37 additions & 0 deletions htdocs/js/lib/vendor/bootstrap/js/bootstrap.popover.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
`/*!
* Bootstrap v2.3.1
*
* Copyright 2012 Twitter, Inc
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Designed and built with all the love in the world @twitter by @mdo and @fat.
*/
.clearfix{*zoom:1;}.clearfix:before,.clearfix:after{display:table;content:"";line-height:0;}
.clearfix:after{clear:both;}
.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0;}
.input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;}
.tooltip{position:absolute;z-index:1030;display:block;visibility:visible;font-size:11px;line-height:1.4;opacity:0;filter:alpha(opacity=0);}.tooltip.in{opacity:0.8;filter:alpha(opacity=80);}
.tooltip.top{margin-top:-3px;padding:5px 0;}
.tooltip.right{margin-left:3px;padding:0 5px;}
.tooltip.bottom{margin-top:3px;padding:5px 0;}
.tooltip.left{margin-left:-3px;padding:0 5px;}
.tooltip-inner{max-width:200px;padding:8px;color:#ffffff;text-align:center;text-decoration:none;background-color:#000000;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}
.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid;}
.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:#000000;}
.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#000000;}
.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:#000000;}
.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-width:0 5px 5px;border-bottom-color:#000000;}
.popover{position:absolute;top:0;left:0;z-index:1010;display:none;max-width:276px;padding:1px;text-align:left;background-color:#ffffff;-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0, 0, 0, 0.2);-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);-moz-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);white-space:normal;}.popover.top{margin-top:-10px;}
.popover.right{margin-left:10px;}
.popover.bottom{margin-top:10px;}
.popover.left{margin-left:-10px;}
.popover-title{margin:0;padding:8px 14px;font-size:14px;font-weight:normal;line-height:18px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;-webkit-border-radius:5px 5px 0 0;-moz-border-radius:5px 5px 0 0;border-radius:5px 5px 0 0;}.popover-title:empty{display:none;}
.popover-content{padding:9px 14px;}
.popover .arrow,.popover .arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid;}
.popover .arrow{border-width:11px;}
.popover .arrow:after{border-width:10px;content:"";}
.popover.top .arrow{left:50%;margin-left:-11px;border-bottom-width:0;border-top-color:#999;border-top-color:rgba(0, 0, 0, 0.25);bottom:-11px;}.popover.top .arrow:after{bottom:1px;margin-left:-10px;border-bottom-width:0;border-top-color:#ffffff;}
.popover.right .arrow{top:50%;left:-11px;margin-top:-11px;border-left-width:0;border-right-color:#999;border-right-color:rgba(0, 0, 0, 0.25);}.popover.right .arrow:after{left:1px;bottom:-10px;border-left-width:0;border-right-color:#ffffff;}
.popover.bottom .arrow{left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#999;border-bottom-color:rgba(0, 0, 0, 0.25);top:-11px;}.popover.bottom .arrow:after{top:1px;margin-left:-10px;border-top-width:0;border-bottom-color:#ffffff;}
.popover.left .arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#999;border-left-color:rgba(0, 0, 0, 0.25);}.popover.left .arrow:after{right:1px;border-right-width:0;border-left-color:#ffffff;bottom:-10px;}
13 changes: 5 additions & 8 deletions htdocs/themes/math4/math4.css
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,10 @@ table.attemptResults {
border-width: 1px;
margin-bottom: 1em;
border-spacing: 1px;
/* removed float stuff because none of the other elements nearby are
floated and it was causing trouble
float:left;
clear:right;
clear:right; */
}

table.attemptResults td,
Expand Down Expand Up @@ -659,7 +661,6 @@ table caption{
#render-modal.modal {
width:1024px;
left:25%;
top:40%;
}

#render-modal .modal-body {
Expand Down Expand Up @@ -802,12 +803,8 @@ table#grades_table pre{
width:60px;
}

.tabberlive {
margin-bottom:1ex;
}

.tabbertab {
min-height:2em;
.tab-pane {
margin-bottom:10px;
}

.small-table-text,
Expand Down
12 changes: 12 additions & 0 deletions htdocs/themes/math4/math4.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ $(function(){
$('.viewOptions label:has(input:radio)').addClass('radio');
$('label.radio').nextUntil(':not(br)').remove();
$('.viewOptions input:submit').addClass('btn-small');
$('.facebookbox input:submit').addClass('btn-small');

//Reformats the problem_set_table.
$('#problem-sets-form').addClass('form-inline');
Expand Down Expand Up @@ -133,4 +134,15 @@ $(function(){
$('#mainform select[name=mydisplayMode]').addClass('input-small').removeClass('input-xxlarge');
$('#mainform select[name=max_shown]').addClass('input-small').removeClass('input-xxlarge');

//Change tabber tabs to twitter tabs
if ($('div.tabber').length > 0) {tabberAutomatic({});}
$('ul.tabbernav').removeClass('tabbernav').addClass('old-tabber nav nav-tabs');
$('ul.old-tabber li a').each(function () { $(this).attr('href','#'+$(this).attr('title')).attr('data-toggle','tab');});
$('div.tabberlive').removeClass('tabberlive').addClass('tab-content');
$('div.tabbertab').each(function() { $(this).removeClass('tabbertab').addClass('tab-pane').attr('id',$(this).find('h3').html())});
$('div.tab-pane h3').remove();
if ($('li.tabberactive a').length > 0) {
$('li.tabberactive a').tab('show');}


})
26 changes: 19 additions & 7 deletions htdocs/themes/math4/system.template
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@
<link rel="shortcut icon" href="<!--#url type="webwork" name="htdocs"-->/images/favicon.ico"/>
<link rel="stylesheet" type="text/css" href="<!--#url type="webwork" name="htdocs"-->/js/lib/vendor/bootstrap/css/bootstrap.css"/>
<link rel="stylesheet" type="text/css" href="<!--#url type="webwork" name="htdocs"-->/themes/math4/math4.css"/>

<script type="text/javascript", src="<!--#url type="webwork" name="htdocs"-->/js/lib/vendor/jquery-1.8.1.min.js"></script>
<script type="text/javascript", src="<!--#url type="webwork" name="htdocs"-->/js/lib/vendor/bootstrap/js/bootstrap.js"></script>
<script type="text/javascript", src="<!--#url type="webwork" name="htdocs"-->/themes/math4/math4.js"></script>

<!--#if can="output_tabber_CSS"-->
<script type="text/javascript">
var tabberOptions = {manualStartup:true};
</script>
<link rel="stylesheet" type="text/css" href="<!--#url type="webwork" name="htdocs"-->/css/tabber.css"/>
<!--#endif-->
<!--#if can="output_jquery_ui_CSS"-->
Expand All @@ -44,6 +46,14 @@
<!--#if can="output_JS"-->
<!--#output_JS-->
<!--#endif-->

<!--
Kludge to get around the fact that some modules load jquery, which clobbers
bootstrap above.
-->
<script type="text/javascript", src="<!--#url type="webwork" name="htdocs"-->/js/lib/vendor/bootstrap/js/bootstrap.js"></script>


<title><!--#path style="text" text=" : " textonly="1"--></title>
<!--#head-->
</head>
Expand Down Expand Up @@ -122,19 +132,21 @@
</div>
<!--#endif-->

<!--#if can="output_comments" "-->
<div>
<!--#output_comments-->
</div>
<!--#endif-->



<!--#if can="output_hidden_info"-->
<!--#output_hidden_info-->
<!--#endif-->

<!--#if can="output_form_start"-->
<!--#output_form_start-->

<!--#if can="output_comments" "-->
<div>
<!--#output_comments-->
</div>
<!--#endif-->

<!--#if can="output_problem_body" can="output_message" can="output_editorLink"-->
<div class="problem">
<!--#if can="output_problem_body"-->
Expand Down
12 changes: 6 additions & 6 deletions lib/WeBWorK/AchievementEvaluator.pm
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ sub checkForAchievements {
}

#build the cheevo message. New level messages are slightly different
my $imgSrc;
my $imgSrc = $ce->{server_root_url};
if ($achievement->{icon}) {
$imgSrc = $ce->{courseURLs}->{achievements}."/".$achievement->{icon};
$imgSrc .= $ce->{courseURLs}->{achievements}."/".$achievement->{icon};
} else {
$imgSrc = $ce->{webworkURLs}->{htdocs}."/images/defaulticon.png";
$imgSrc .= $ce->{webworkURLs}->{htdocs}."/images/defaulticon.png";
}

$cheevoMessage .= CGI::start_div({class=>'cheevopopupouter'});
Expand All @@ -193,12 +193,12 @@ sub checkForAchievements {
}

#if facebook integration is enables then create a facebook popup
if ($globalUserAchievement->facebooker) {
if ($ce->{allowFacebooking}&& $globalUserAchievement->facebooker) {
$cheevoMessage .= CGI::div({id=>'fb-root'},'');
$cheevoMessage .= CGI::script({src=>'http://connect.facebook.net/en_US/all.js'},'');
$cheevoMessage .= CGI::start_script();
#WCU specific appID
$cheevoMessage .= "FB.init({appId:'193051384078348', cookie:true,status:true, xfbml:true });\n";

$cheevoMessage .= "FB.init({appId:'".$ce->{facebookAppId}."', cookie:true,status:true, xfbml:true });\n";

my $facebookmessage;
if ($achievement->category eq 'level') {
Expand Down
72 changes: 40 additions & 32 deletions lib/WeBWorK/ContentGenerator/Achievements.pm
Original file line number Diff line number Diff line change
Expand Up @@ -60,49 +60,57 @@ sub initialize {

}


sub options {
my ($self) = @_;
sub if_can {
my ($self, $arg) = @_;
my $r = $self->r;
my $db = $r->db;
my $ce = $r->ce;
my $authz = $r->authz;
my $globalUserAchievement = $self->{globalData};

#Print the facebook sidepane. This allows users to turn facebook integration on and off.
if ($arg eq 'options' && (not $ce->{allowFacebooking} || not defined($globalUserAchievement))) {
return 0;
} else {
return $self->SUPER::if_can($arg);
}
}

if (defined($globalUserAchievement)) {

my $changeFacebooking = $r->param('changeFacebooking');

if ($changeFacebooking) {
$globalUserAchievement->facebooker(!$globalUserAchievement->facebooker);
$db->putGlobalUserAchievement($globalUserAchievement);
}
sub options {
my ($self) = @_;
my $r = $self->r;
my $db = $r->db;
my $ce = $r->ce;
my $authz = $r->authz;
my $globalUserAchievement = $self->{globalData};

print CGI::start_center();
my $changeFacebooking = $r->param('changeFacebooking');

if ($changeFacebooking) {
$globalUserAchievement->facebooker(!$globalUserAchievement->facebooker);
$db->putGlobalUserAchievement($globalUserAchievement);
}

print CGI::start_center();
print CGI::start_div({class=>'facebookbox'});
print CGI::start_form(-method=>'POST', -action=>$r->uri);
print $self->hidden_authen_fields;
print CGI::submit('changeFacebooking', $globalUserAchievement->facebooker
? "Disable Facebook \n Integration" : "Enable Facebook \n Integration");
print CGI::end_form();
print CGI::end_div();

if ($globalUserAchievement->facebooker) {
#Print Facebook stuff (uses WCU specific appID)
print CGI::start_div({class=>'facebookbox'});
print CGI::start_form(-method=>'POST', -action=>$r->uri);
print $self->hidden_authen_fields;
print CGI::submit('changeFacebooking', $globalUserAchievement->facebooker
? "Disable Facebook \n Integration" : "Enable Facebook \n Integration");
print CGI::end_form();
print CGI::div({id=>'fb-root'},'');
print CGI::script({src=>'http://connect.facebook.net/en_US/all.js'},"");
print CGI::script("FB.init({appId:'".$ce->{facebookAppId}."', cookie:true, status:true, xfbml:true });");
print "<fb:login-button perms=\"publish_stream\">";
print "Login to FB";
print "</fb:login-button>";
print CGI::end_div();

if ($globalUserAchievement->facebooker) {
#Print Facebook stuff (uses WCU specific appID)
print CGI::start_div({class=>'facebookbox'});
print CGI::div({id=>'fb-root'},'');
print CGI::script({src=>'http://connect.facebook.net/en_US/all.js'},"");
print CGI::script("FB.init({appId:'193051384078348', cookie:true, status:true, xfbml:true });");
print "<fb:login-button perms=\"publish_stream\">";
print "Login to FB";
print "</fb:login-button>";
print CGI::end_div();
}
print CGI::end_center();
}

print CGI::end_center();
return "";
}

Expand Down
31 changes: 21 additions & 10 deletions lib/WeBWorK/ContentGenerator/Instructor/AchievementList.pm
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,7 @@ sub body {

print CGI::p(CGI::b("Any changes made below will be reflected in the achievement for ALL students.")) if $editMode;

print CGI::start_table({});
print CGI::Tr({}, CGI::td({-colspan=>2}, "Select an action to perform:"));
print CGI::p($r->maketext("Select an action to perform").":");

my @formsToShow;
if ($editMode) {
Expand All @@ -259,17 +258,21 @@ sub body {
@formsToShow = @{ EXPORT_FORMS() };
}

print CGI::start_div({-class=>"tabber"});

my $i = 0;
foreach my $actionID (@formsToShow) {

my $actionForm = "${actionID}_form";
my $onChange = "document.achievementlist.action[$i].checked=true";
my %actionParams = $self->getActionParams($actionID);

print CGI::Tr({-valign=>"top"},
CGI::td({}, CGI::input({-type=>"radio", -name=>"action", -value=>$actionID})),
CGI::td({}, $self->$actionForm($onChange, %actionParams))
);
print CGI::div({-class=>"tabbertab"},
CGI::h3($r->maketext(ucfirst(WeBWorK::split_cap($actionID)))),
CGI::span({-class=>"radio_span"}, WeBWorK::CGI_labeled_input(-type=>"radio",
-id=>$actionID."_id", -label_text=>$r->maketext(ucfirst(WeBWorK::split_cap($actionID))),
-input_attr=>{-name=>"action", -value=>$actionID}, -label_attr=>{-class=>"radio_label"})),
$self->$actionForm($onChange, %actionParams));

$i++;
}
Expand All @@ -292,10 +295,11 @@ sub body {
)
);
}
print CGI::Tr({}, CGI::td({-colspan=>2, -align=>"center"},
CGI::submit(-value=>"Take Action!"))
);
print CGI::end_table();

print WeBWorK::CGI_labeled_input(-type=>"reset", -id=>"clear_entries", -input_attr=>{-value=>$r->maketext("Clear"), -class=>"button_input"});
print WeBWorK::CGI_labeled_input(-type=>"submit", -id=>"take_action", -input_attr=>{-value=>$r->maketext("Take Action!"), -class=>"button_input"}).CGI::br().CGI::br();

print CGI::end_div();

########## print table

Expand Down Expand Up @@ -1297,6 +1301,13 @@ sub output_JS{
my $site_url = $ce->{webworkURLs}->{htdocs};
print CGI::start_script({type=>"text/javascript", src=>"$site_url/js/addOnLoadEvent.js"}), CGI::end_script();
print CGI::start_script({type=>"text/javascript", src=>"$site_url/js/show_hide.js"}), CGI::end_script();
print CGI::start_script({type=>"text/javascript", src=>"$site_url/js/tabber.js"}), CGI::end_script();

return "";
}

# Just tells template to output the stylesheet for Tabber
sub output_tabber_CSS{
return "";
}

Expand Down
Loading