Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
49fccef
First version of QTI parser
rlgreen91 May 18, 2012
c337b1b
New unit test for QTI parser
rlgreen91 May 18, 2012
5dd839c
Added exceptions to the QTI parser
rlgreen91 May 18, 2012
9770932
Made the parser more flexible in terms of how it accepts inputs, and …
rlgreen91 May 21, 2012
b301335
Merge remote-tracking branch 'upstream/master' into HTML_import
rlgreen91 May 22, 2012
f44b892
Changed the parser so that it accepts almost any character that comes…
rlgreen91 May 23, 2012
72af70b
Attempting to write an execption for images within questions.
rlgreen91 May 23, 2012
8ad5b4c
Fixed the parser(again). Now, the transformer will replace HTML ital…
rlgreen91 May 25, 2012
3f1c8f1
Deleting old files
rlgreen91 May 25, 2012
1300e7b
Parser can now identify images inline in questions.
rlgreen91 May 25, 2012
9219a81
Still having problems with getting the parser to recognize images and…
rlgreen91 May 26, 2012
354d020
Finally got it to recognize and raise exceptions.
rlgreen91 May 26, 2012
5d5462b
Now replaces teletype tags with inline LaTex tags.
rlgreen91 May 26, 2012
37d9a8e
Recognizes and replaces paragraph tags with correct formatting.
rlgreen91 May 26, 2012
1334f13
Parser now detects for font changes and makes the content for those c…
rlgreen91 May 26, 2012
404f959
Renames some files. Finished the first parser.
rlgreen91 May 26, 2012
c8d12a4
Added replacements for greek letters, subscripts, superscripts, and c…
rlgreen91 May 26, 2012
e41465e
Created an import file that takes as inputs the filename and the type…
rlgreen91 May 26, 2012
c1987ff
Now, the import class will also decided which parser and transformer …
rlgreen91 May 26, 2012
3b917eb
Import class can now grab just the relevant content, and can pick out…
rlgreen91 May 26, 2012
703575f
Ok, so this is the import class. It determines what parser and trans…
rlgreen91 May 27, 2012
0c0d9c3
Ok, so now the import class can also go through the list of answer ch…
rlgreen91 May 27, 2012
f10961a
Now the import class can go through the list of relevant answer choic…
rlgreen91 May 27, 2012
d58f9b6
Redid the function for finding the points for each answer choice to s…
rlgreen91 May 27, 2012
42db907
Finished making the whole import class capable of handling any number…
rlgreen91 May 27, 2012
9620304
All of the unit test for the importer work.
rlgreen91 May 27, 2012
78796c6
The import class is done. Everything works and the structure has bee…
rlgreen91 May 27, 2012
961cb95
So, I've created a view that contains a form to enter the information…
rlgreen91 May 27, 2012
6078bae
Added extra line to allow clicking outside of modal dialog
joelbaranowski Jun 4, 2012
a2ad4f6
Added gem Carrierwave to handle file uploads.
rlgreen91 Jun 13, 2012
26e9bfe
All of the files associated with creating the form to upload files, c…
rlgreen91 Jun 13, 2012
fbfbb34
Updated parser to account for more hidden HTML tags.
rlgreen91 Jun 15, 2012
1c818c0
added unfinished solution message
Jun 15, 2012
c9f61ee
added a missing end
Jun 15, 2012
c84ad43
Just updated the parser to account for more tags.
rlgreen91 Jun 15, 2012
6928c3f
Updated parser to handle arbitrarily nested HTML tags.
rlgreen91 Jun 15, 2012
349d442
Changed eval statement into a partial render of the assets
joelbaranowski Jun 19, 2012
ca33d43
merged conflicts with quickview
joelbaranowski Jun 19, 2012
ccd14e6
Updating rails
rlgreen91 Jun 21, 2012
9c07b91
Upgraded to Rails 3.2
rlgreen91 Jun 21, 2012
7abbf7b
Had to redo form to be compatible with new Rails.
rlgreen91 Jun 21, 2012
b8fb54b
Added a check to see if there was no image, if there isn't, display i…
joelbaranowski Jun 21, 2012
88776ef
Neatened things up
joelbaranowski Jun 21, 2012
e1ca277
Switching branches
rlgreen91 Jun 23, 2012
47c7aaf
Optimized the import functions, so this feature should run faster now…
rlgreen91 Jun 24, 2012
b0bacf0
More changes to optimize the import function
rlgreen91 Jun 24, 2012
69a5ecc
Made the import function a little bit faster and added more things to…
rlgreen91 Jun 26, 2012
3c61d4a
Got the whole test file to be imported correctly.
rlgreen91 Jun 27, 2012
5b20127
Added functionality to handle any problems with import. Also added a…
rlgreen91 Jun 27, 2012
8ecb0fb
cleaning up code
rlgreen91 Jun 27, 2012
40f57f9
cleaning up code
rlgreen91 Jun 27, 2012
6bf734e
uninstalled gems
rlgreen91 Jun 27, 2012
973acf1
merge conflicts
rlgreen91 Jun 27, 2012
5b2901b
Merge branch 'master' into nonviewableSolution
Jul 2, 2012
15b2fc2
Merge branch 'master' into nonviewableSolution
Jul 6, 2012
ea7e0a4
fixed some code indentation
Jul 9, 2012
64a9327
Merge branch 'master' into nonviewableSolution
Jul 10, 2012
eb05b02
converted to one line
joelbaranowski Jul 10, 2012
a883b3d
Added closeOnClickOutside function and appended that to dialog open s…
joelbaranowski Jul 11, 2012
23778de
and finished, missed action_new
joelbaranowski Jul 11, 2012
8afd09a
removed loop
Jul 17, 2012
169a827
fixed user not logged in id problem
Jul 17, 2012
3edd5b5
removed debugger line
Jul 17, 2012
b39888f
Trying to run tests
rlgreen91 Jul 17, 2012
1820bbc
Everything works. Authors can specify if answer is drawing.
rlgreen91 Jul 17, 2012
0df10e7
Merge remote-tracking branch 'upstream/master'
rlgreen91 Jul 18, 2012
034992a
Merge pull request #113 from joelbaranowski/dialogout
jpslav Jul 20, 2012
e064da1
Merge pull request #134 from dtreiter/nonviewableSolution
jpslav Jul 20, 2012
9350ef5
Merge pull request #138 from joelbaranowski/uploadsol
jpslav Jul 20, 2012
fc180b3
Merge pull request #145 from joelbaranowski/imagemiss
jpslav Jul 20, 2012
0fc3d04
Merge remote-tracking branch 'upstream/master'
rlgreen91 Jul 18, 2012
59e115f
Merge conflicts
rlgreen91 Jul 21, 2012
b1b0331
Trying to add skeleton to qti exporter
rlgreen91 Jul 21, 2012
13b614e
The export function is completed, filling out the data in the xml as …
rlgreen91 Jul 21, 2012
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
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ end

gem 'jquery-rails', '~> 2.0.2'

gem 'nokogiri'

gem 'htmlentities'

# Deploy with Capistrano
gem 'capistrano', '~> 2.12.0'

Expand Down
12 changes: 4 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ GEM
rails (~> 3.0)
arel (3.0.2)
bcrypt-ruby (3.0.1)
bcrypt-ruby (3.0.1-x86-mingw32)
blankslate (2.1.2.4)
builder (3.0.0)
bullring (0.8.2)
Expand Down Expand Up @@ -81,6 +80,7 @@ GEM
i18n (~> 0.4)
highline (1.6.13)
hike (1.2.1)
htmlentities (4.3.1)
i18n (0.6.0)
journey (1.0.4)
jquery-rails (2.0.2)
Expand All @@ -100,14 +100,14 @@ GEM
mime-types (1.19)
multi_json (1.3.6)
mysql2 (0.3.11)
mysql2 (0.3.11-x86-mingw32)
net-scp (1.0.4)
net-ssh (>= 1.99.1)
net-sftp (2.0.5)
net-ssh (>= 2.0.9)
net-ssh (2.5.2)
net-ssh-gateway (1.1.0)
net-ssh (>= 1.99.1)
nokogiri (1.5.4)
orm_adapter (0.3.0)
paperclip (3.0.4)
activemodel (>= 3.0.0)
Expand Down Expand Up @@ -181,22 +181,16 @@ GEM
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.33)
<<<<<<< HEAD
uglifier (1.2.6)
=======
uglifier (1.2.5)
>>>>>>> Trying to run tests
execjs (>= 0.3.0)
multi_json (~> 1.3)
warden (1.2.1)
rack (>= 1.0)
will_paginate (3.0.3)
yajl-ruby (1.1.0)
yajl-ruby (1.1.0-x86-mingw32)

PLATFORMS
ruby
x86-mingw32

DEPENDENCIES
acts-as-taggable-on (~> 2.3.1)
Expand All @@ -208,11 +202,13 @@ DEPENDENCIES
execjs (~> 1.4.0)
factory_girl_rails (~> 3.4.0)
faker (~> 1.0.1)
htmlentities
jquery-rails (~> 2.0.2)
jsonify (~> 0.3.1)
jsonify-rails (~> 0.3.2)
mime-types (~> 1.18)
mysql2 (~> 0.3.11)
nokogiri
paperclip (~> 3.0.4)
parslet (~> 1.4.0)
quiet_assets (~> 1.0.1)
Expand Down
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#encoding: utf-8

# Copyright 2011-2012 Rice University. Licensed under the Affero General Public
# License version 3 or later. See the COPYRIGHT file for details.

Expand Down
7 changes: 7 additions & 0 deletions app/assets/javascripts/jquery_extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,10 @@
// License version 3 or later. See the COPYRIGHT file for details.

jQuery.fn.exists = function(){return jQuery(this).length>0;}

jQuery.fn.closeOnClickOutside = function(){
var dialogx = this;
$('.ui-widget-overlay').live("click",function(){
dialogx.dialog("close");
});
}
5 changes: 5 additions & 0 deletions app/controllers/import_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class ImportController < ApplicationController
def index
@qt_import = QtImport.new
end
end
26 changes: 26 additions & 0 deletions app/controllers/qt_import_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#encoding: utf-8

# Copyright 2011-2012 Rice University. Licensed under the Affero General Public
# License version 3 or later. See the COPYRIGHT file for details.

class QtImportController < ApplicationController
def new
@content_types = QTImport.content_types
end

def create
begin
f = params[:file]
document = QTImport.openfile(f.path)
project = QTImport.createproject(current_user)
parser, transformer = QTImport.choose_import(params[:content_type])
content = QTImport.iterate_items(document)
QTImport.get_questions(project,content,parser,transformer,current_user)

rescue
flash[:alert] = 'Unfortunately we could not import all of your questions. This may be due to formatting errors in your questions, such as HTML.
However, we were most likely able to import some of your questions. They are listed under a new project called Import, and are now unpublished questions.'
redirect_to :action => :new
end
end
end
1 change: 1 addition & 0 deletions app/controllers/questions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def index

def show
@question = Question.from_param(params[:id])
@unfinished_solutions = [email protected]{(is_visible == false) & (creator_id == my{present_user.id})}.first.nil?
raise SecurityTransgression unless present_user.can_read?(@question)

start_time = Time.now if logger.info?
Expand Down
5 changes: 5 additions & 0 deletions app/helpers/qt_import_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2011-2012 Rice University. Licensed under the Affero General Public
# License version 3 or later. See the COPYRIGHT file for details.

module QtImportHelper
end
3 changes: 3 additions & 0 deletions app/models/file_upload.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class FileUpload < ActiveRecord::Base
mount_uploader :importfile, QuestionUploader
end
1 change: 1 addition & 0 deletions app/models/logic_library_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class LogicLibraryVersion < ActiveRecord::Base
after_save :send_to_bullring

scope :ordered, order{version.asc}
attr_accessible :code, :deprecated

def name
logic_library.name + " v." + version.to_s
Expand Down
48 changes: 48 additions & 0 deletions app/uploaders/question_uploader.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# encoding: utf-8

class QuestionUploader < CarrierWave::Uploader::Base

# Include RMagick or MiniMagick support:
# include CarrierWave::RMagick
# include CarrierWave::MiniMagick

# Choose what kind of storage to use for this uploader:
storage :file
# storage :fog

# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end

# Provide a default URL as a default if there hasn't been a file uploaded:
# def default_url
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
# end

# Process files as they are uploaded:
# process :scale => [200, 300]
#
# def scale(width, height)
# # do something
# end

# Create different versions of your uploaded files:
# version :thumb do
# process :scale => [50, 50]
# end

# Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this:
def extension_white_list
%w(xml)
end

# Override the filename of the uploaded files:
# Avoid using model.id or version_name here, see uploader/store.rb for details.
# def filename
# "something.jpg" if original_filename
# end

end
6 changes: 5 additions & 1 deletion app/views/attachable_assets/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@
sizeLimit : <%= max_size %>,
multi : <%= allow_multiple_files %>,
onComplete : function(event, queueID, fileObj, response, data) {
eval(response);
$.ajax({
url: '/attachable_assets/' + response + '/finish_create',
dataType: 'script'
});
return true;
},
onAllComplete : function(event, data){
$('#uploadify_file_cancel').hide('blind');
Expand Down
2 changes: 1 addition & 1 deletion app/views/dev/toolbox.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ $("#dev_toolbox_dialog").html("<%= ej(render :partial => 'toolbox' )%>");
refresh_buttons();
refresh_datetime_pickers();

$("#dev_toolbox_dialog").dialog('open');
$("#dev_toolbox_dialog").dialog('open').closeOnClickOutside();
4 changes: 2 additions & 2 deletions app/views/help/topic.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ $("#help_dialog").dialog({

<%= reload_mathjax("help_dialog") if @options[:include_mathjax] %>

$("#help_dialog").dialog('open');
$("#help_dialog").scrollTop(0);
$("#help_dialog").dialog('open').closeOnClickOutside();
$("#help_dialog").scrollTop(0);
2 changes: 1 addition & 1 deletion app/views/project_questions/attribution.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ $("#attribution_dialog").html("<%= escape_javascript(
render :partial => 'project_questions/attribution',
:locals => {:question_ids => @question_ids}) %>");

$("#attribution_dialog").dialog('open');
$("#attribution_dialog").dialog('open').closeOnClickOutside();
16 changes: 16 additions & 0 deletions app/views/qt_import/_form.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!-- # Copyright 2011-2012 Rice University. Licensed under the Affero General Public
# License version 3 or later. See the COPYRIGHT file for details. -->

<%= form_tag("/import/qti", :multipart => true) do %>
<%= label_tag("File") %>
<br>
<%= file_field_tag(:file) %>
<br>
<br>
<%= label_tag("Content Type") %>
<br>
<%= select_tag(:content_type, options_for_select(@content_types).html_safe ) %>
<br>
<br>
<%= submit_tag("Import") %>
<% end %>
6 changes: 6 additions & 0 deletions app/views/qt_import/create.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!-- # Copyright 2011-2012 Rice University. Licensed under the Affero General Public
# License version 3 or later. See the COPYRIGHT file for details. -->

<p>Your questions were successfully imported!
<br>
They have been added to a new project named "Import", and are now unpublished questions.</p>
3 changes: 3 additions & 0 deletions app/views/qt_import/error.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<p>Unfortunately we could not import all of your questions. This may be due to formatting errors in your questions, such as HTML.
However, we were most likely able to import <i>some</i> of your questions. They are listed under a new project called Import, and
are now unpublished questions.</p>
4 changes: 4 additions & 0 deletions app/views/qt_import/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<h1>Import Questions</h1>
<p> Note: All files uploaded MUST be XML files. </p>

<%= render 'form' %>
7 changes: 7 additions & 0 deletions app/views/qt_import/new.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!-- # Copyright 2011-2012 Rice University. Licensed under the Affero General Public
# License version 3 or later. See the COPYRIGHT file for details. -->

<h1>Import Questions</h1>
<p> Note: All files uploaded MUST be XML files. </p>

<%= render 'form' %>
7 changes: 7 additions & 0 deletions app/views/questions/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,10 @@ Use this type for simple free-form questions that may or may not have a multiple


</table>

<br>
<big>
<b>
<%= link_to "Or click this link to import a file of questions.", import_qti_new_path %>
</b>
</big>
2 changes: 1 addition & 1 deletion app/views/questions/preview.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
:locals => {:question => @question}) %>");
<%= reload_mathjax("preview_dialog") %>

$("#preview_dialog").dialog('open');
$("#preview_dialog").dialog('open').closeOnClickOutside();
<% else %>
// Submit the form so that the error messages display nicely with formatting
// around the offending entries (use the trigger approach so we don't get
Expand Down
3 changes: 1 addition & 2 deletions app/views/questions/quickview.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ $("#quickview_dialog").html("<%= escape_javascript(render :partial => 'show',
:locals => {:question => @question}) %>");
<%= reload_mathjax("quickview_dialog") %>

$("#quickview_dialog").dialog('open');

$("#quickview_dialog").dialog('open').closeOnClickOutside();
3 changes: 3 additions & 0 deletions app/views/questions/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
<div class="quad-question">

<% if @question.errors.none? %>
<% if @unfinished_solutions %>
<div id="notice" class="notice" style="font-size:14px">This question has unfinished solutions</div>
<% end %>
<%= render :partial => "show",
:locals => {:question => @question} %>
<% else %>
Expand Down
51 changes: 35 additions & 16 deletions app/views/simple_questions/show.1p2.qti.builder
Original file line number Diff line number Diff line change
@@ -1,20 +1,39 @@
xml.instruct!
require 'builder'
xml = Builder::XmlMarkup.new

xml.kml(:xmlns => "http://earth.google.com/kml/2.2") {
xml.Document {
xml.name("Test")
xml.open(1)
xml.visible(1)
xml.NetworkLink {
xml.name("My rails app being passed parameters")
xml.open(1)
xml.visibility(0)
xml.Link {
xml.href("hi")
xml.viewRefreshMode("onStop")
xml.viewRefreshTime(0.5)
xml.viewFormat("BBOX=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth]&CENTRE=[lookatLon],[lookatLat]")
xml.instruct!
xml.Document{
xml.item{
xml.presentation{
xml.material{
xml.mattext("texttype" => "text/html") {
xml.cdata!(@question.content_html.html_safe)
}
}
xml.response_lid{
xml.render_choice{
@question.answer_choices.each_index do |ac|
xml.response_label("ident" => "A" + ac.to_s){
xml.material{
xml.mattext("texttype" => "text/html"){
xml.cdata!(@question.answer_choices[ac].content_html.html_safe)
}
}
}
end
}
}
}
xml.resprocessing{
@question.answer_choices.each_index do |ac|
xml.respcondition{
xml.conditionvar{
xml.varequal "A" + ac.to_s
}
xml.setvar(@question.answer_choices[ac].credit,"varname" => "que_score", "action" => "Add"
)
}
end
}
}
}
}
3 changes: 3 additions & 0 deletions app/views/solutions/_single_solution.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@

<div class="solution_div" style="float:left; width:85%">
<% if !solution.explanation.blank? %>
<% if !solution.is_visible %>
<div id="notice" class="notice">This solution is not ready to be viewed.</div>
<% end %>
<div class="solutionPartHeading" style="margin-top:0px">High-Level Explanation</div>
<div id="solution_explanation_<%= solution.id.to_s %>" style="margin-left:20px">
<%= simple_format solution.explanation %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/action_new.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ $("#user_action_dialog").dialog({
width:600,
buttons: { "Close": function() { $(this).dialog("close"); }},
open: function(event, ui) { $("#text_query").val(''); $("#selected_type").val(''); }
});
}).closeOnClickOutside();
2 changes: 2 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#encoding: utf-8

# Copyright 2011-2012 Rice University. Licensed under the Affero General Public
# License version 3 or later. See the COPYRIGHT file for details.

Expand Down
Loading