Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
bb2c329
Initial commit
marjev Nov 11, 2014
46309a4
Iframe will not overflow, width set to 100% and aspect ratio is maint…
marjev Nov 11, 2014
97c4a69
Set rows and columns of textarea to match textarea from which the emb…
marjev Nov 11, 2014
843c926
First unit test - Testing studio submit
marjev Nov 12, 2014
b96ada9
README.md updated with installation and testing info
marjev Nov 13, 2014
b22ce8a
Enabled editing of google calendar component
marjev Nov 14, 2014
312e433
Merge pull request #1 from edx-solutions/mjevtic/workbranch
Nov 17, 2014
366b3c9
UI string review for google docs and calendar
mhoeber Nov 21, 2014
5f3c329
Merge pull request #2 from edx-solutions/markhoeber-studio-UI-review
mhoeber Nov 24, 2014
7e5218d
Reporting event for analytics
marjev Dec 2, 2014
258ad43
Merge pull request #4 from edx-solutions/mjevtic/analytics-emit-events
Dec 2, 2014
7564990
Added validation for google docs
marjev Dec 2, 2014
bf3fb49
Added validation for google calendar
marjev Dec 2, 2014
3cce68c
URL redirection is also valid behaviour
marjev Dec 2, 2014
38c7535
Merge pull request #5 from edx-solutions/mjevtic/validation
Dec 2, 2014
2fcd892
Fixes for width/height & test folder repositioning
marjev Nov 24, 2014
a5be4e1
Some tweaks to style and javascript loading
Dec 3, 2014
f9e8653
Set correct default values
marjev Dec 3, 2014
906e330
Documention on css changes and validation
marjev Dec 3, 2014
737debd
Merge pull request #3 from edx-solutions/mjevtic/workbranch
Dec 4, 2014
2b6a8ac
Update README.md
Dec 4, 2014
2a3cfb2
Merge pull request #6 from edx-solutions/mjevtic/documentation
Dec 4, 2014
3ef0d90
Fixes for documentation on testing
marjev Dec 5, 2014
8b8da41
Merge pull request #9 from edx-solutions/mjevtic/documentation-fixes
Dec 5, 2014
d2b622c
Bugfix for edit not working on solutions + bugfixes for problems noti…
marjev Dec 5, 2014
58631fa
Fixes problem when loading document edit box
Dec 5, 2014
cbe645c
Scope styles within CSS, Common CSS moved to common file, removed dea…
Dec 5, 2014
80ca9d8
Addresses SOL-125. Removes calendar dropdown within google calendar
Dec 5, 2014
d9456ae
Improved analytics names. displayedin attribute indicates element typ…
Dec 5, 2014
248be18
Fix event handler call
Dec 5, 2014
c5e6c70
Merge pull request #8 from edx-solutions/mjevtic/bufixes
Dec 5, 2014
7c6ab0c
Enumerated list of calendar views, status code now indicates malforme…
marjev Dec 9, 2014
7dc4e55
Added title attribute to iframe/img
marjev Dec 9, 2014
de1503a
Included PublishEventMixin
marjev Dec 10, 2014
963019b
Merge pull request #10 from edx-solutions/mjevtic/SOL-135
Dec 10, 2014
4a070a3
Added title attribute to iframe/img
marjev Dec 9, 2014
31f28c9
Unit tests for student_view, studio_view for documents and calendar; …
marjev Dec 11, 2014
31a8119
Merge pull request #12 from edx-solutions/mjevtic/unit-tests
Dec 15, 2014
4b76b16
Renamed displayedin to displayed_in; added alt attribute instead of t…
marjev Dec 23, 2014
6592899
Added option to edit alt description for images; rewrote test for tha…
marjev Dec 24, 2014
15728ae
Added integration tests
marjev Dec 31, 2014
0c5718c
Merge pull request #13 from edx-solutions/mjevtic/analytics-fixes
Jan 30, 2015
ad86b84
Clean up and reorganization
Jan 29, 2015
0887699
Fixed unit tests to run on the newest version of workbench
marjev Feb 2, 2015
1b6dbb6
Updated requirements file
marjev Feb 3, 2015
7920340
Split long lines into two
marjev Feb 3, 2015
39c446a
Added the YAML file for Travis; Added coverage to requirements.txt; D…
marjev Feb 3, 2015
86f99fc
Merge pull request #15 from edx-solutions/mjevtic/SOL-299
Feb 3, 2015
8f39a0b
pep8 and pylint should be supported and runable on Travis; changed th…
marjev Feb 4, 2015
403dc44
Merge pull request #16 from edx-solutions/mjevtic/SOL-299
Feb 4, 2015
51e1002
Ignore duplicate-code in pylint - it is failing on 5 common lines bet…
Feb 4, 2015
75c50bf
Update README to show travis project status
Feb 4, 2015
90399e7
Merge pull request #14 from edx-solutions/clean_up
Feb 4, 2015
0a83943
Changes as a result of feedback
Feb 6, 2015
9d76471
Merge pull request #20 from edx-solutions/mjames/Feedback_Updates
Feb 6, 2015
64c7b7a
Added integration tests for studio views; Code clean-up;
marjev Feb 18, 2015
57ccc55
Feedback inspired changes
Feb 13, 2015
e9233c4
Merge pull request #22 from edx-solutions/mjames/feedback_updates
marjev Feb 19, 2015
0a7d86e
Merge pull request #23 from edx-solutions/mjevtic/PR-21-review
marjev Feb 19, 2015
2d44630
Code cleaning as a result of feedback
marjev Feb 19, 2015
1d652d7
Merge pull request #24 from edx-solutions/mjevtic/PR-18
marjev Feb 19, 2015
69811cb
Code refactoring; Changed description for image alt text field
marjev Feb 20, 2015
138e6fa
Merge pull request #25 from edx-solutions/mjevtic/PR-18
marjev Feb 20, 2015
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 .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
xblock_google_drive.egg-info
*.log
*.pyc
*~
4 changes: 4 additions & 0 deletions .pep8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[pep8]
ignore=E501
max_line_length=119
exclude=settings
84 changes: 84 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
[MASTER]

# Profiled execution.
profile=no

# Add files or directories to the blacklist. They should be base names, not
# paths.
ignore=migrations


[MESSAGES CONTROL]

# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifiers separated by comma (,) or put this
# option multiple times (only on the command line, not in the configuration
# file where it should appear only once).You can also use "--disable=all" to
# disable everything first and then reenable specific checks. For example, if
# you want to run only the similarities checker, you can use "--disable=all
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
# I0011 locally-disabled (module-level pylint overrides)
# disabling ```duplicate-code``` due to 5 lines that are the same near the top of
# both xblock files - of course these are similar because it is a core pattern to
# use - if we separated out into a separate file, we'd have the 5 lines in a separate
# file and have 2 import statements within each file to get back the stuff - pretty
# useless warning in this specific case
disable=I0011,W0232,duplicate-code


[REPORTS]

# Put messages in a separate file for each module / package specified on the
# command line instead of printing them on stdout. Reports (if any) will be
# written in a file name "pylint_global.[txt|html]".
files-output=no

# Add a comment according to your evaluation note. This is used by the global
# evaluation report (RP0004).
comment=no


[VARIABLES]

# Tells whether we should check for unused import in __init__ files.
init-import=no

# A regular expression matching the beginning of the name of dummy variables
# (i.e. not used).
dummy-variables-rgx=_|dummy


[TYPECHECK]

# When zope mode is activated, add a predefined set of Zope acquired attributes
# to generated-members.
zope=no


[BASIC]

# List of builtins function names that should not be used, separated by a comma
bad-functions=map,filter,apply,input

# Regular expression which should only match correct function names
function-rgx=[a-z_][a-z0-9_]{2,50}$


[SIMILARITIES]

# Ignore imports when computing similarities.
ignore-imports=no


[FORMAT]

# Maximum number of characters on a single line.
max-line-length=120


[IMPORTS]

# Deprecated modules which should not be used, separated by a comma
deprecated-modules=regsub,string,TERMIOS,Bastion,rexec
19 changes: 19 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
language: python

python:
- "2.7"

before_install:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"

install:
- "pip install -r requirements.txt"
- "pip uninstall -y xblock-google-drive && python setup.py sdist && pip install dist/xblock-google-drive-0.1.tar.gz"

script:
- DJANGO_SETTINGS_MODULE="settings" nosetests --with-coverage --cover-package="google_drive" --with-django
- pep8 --config=.pep8 google_drive
- pylint --rcfile=.pylintrc google_drive --report=no

after_success: coveralls
2 changes: 0 additions & 2 deletions README.md

This file was deleted.

155 changes: 155 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
Google Drive & Calendar XBlock |Build Status|
---------------------------------------------

This XBlock allows embedding of Google documents and calendar, within an
edX course.

Installation
------------

Install the requirements into the python virtual environment of your
``edx-platform`` installation by running the following command from the
root folder:

.. code:: bash

$ pip install -r requirements.txt

Enabling in Studio
------------------

You can enable the Google Drive & Calendar XBlock in studio through the
advanced settings.

1. From the main page of a specific course, navigate to
``Settings -> Advanced Settings`` from the top menu.
2. Check for the ``advanced_modules`` policy key, and add
``"google-document"`` and ``"google-calendar"`` to the policy value
list.
3. Click the "Save changes" button.

Workbench installation and settings
-----------------------------------

Install to the workbench's virtualenv by running the following command
form the google-drive repo root:

.. code:: bash

pip install -r requirements.txt

Running the workbench
---------------------

.. code:: bash

$ ./manage.py runserver 8000

Access it at `http://localhost:8000/ <http://localhost:8000>`__.

Running tests
-------------

From google-drive directory, run the tests with the following command:

.. code:: bash

$ DJANGO_SETTINGS_MODULE="settings" nosetests --with-django tests/*

If you want to run only the integration or the unit tests, append the
directory to the command. You can also run separate modules in this
manner.

.. code:: bash

$ DJANGO_SETTINGS_MODULE="settings" nosetests --with-django tests/unit

To see the coverage, run the tests using the following command:

.. code:: bash

$ DJANGO_SETTINGS_MODULE="settings" nosetests --with-coverage --cover-package="google_drive" --with-django

If you have not installed the xblock-sdk in the active virtualenv, you
might also have to prepend ``PYTHONPATH=".:/path/to/xblock"`` to the
command above. (``/path/to/xblock`` is the path to the xblock-sdk, where
the workbench resides).

Changes to be documented
------------------------

1. Calendar width is set to 100% of parent element's width; this
optimizes the display of google document content within the LMS user
interface
2. Max width of Google images is set to 100% to prevent images from
overflowing outside the parent element's boundaries
3. Since Google WordProcessing documents and Spreadsheets don't allow
users to explicitly define width and height, their width is set to
100%. Also, min height is set to 450px, so that documents and/or
spreadsheets with larger number of rows are displayed in their
natural size. Overflow scroll is automatically turned on when the
height of the document becomes larger than the height of the parent.

Validation
----------

Each time a character is added to or removed from Google Calendar ID,
validation takes place. Analogically, validation takes place for
embedded code of Google Drive File.

1. Google calendar IDs are being validated against a regular expression.
IDs must contain at least one '@' character, with at least one
character on each side of it, ie. 'a@a'.

2. Embedded code of Google Drive file is being validated on the server
side, by checking the status code of the HTTP response. Since error
status codes start with 400, it's assumed that each status code
that's larger than or equal to 400 states that file is invalid. If
for any reason exception occurs while getting an HTTP response, error
code is returned, thus overriding default signalization that is
invoked by edx platform when the 500 status code is reported.

Accessibility (a11y)
--------------------

For users with a visual impairment:

1. Iframes in which Google calendars and Google Drive files (except
images) are shown now have title attribute with alternative text
content which describes what the iframe contains.
2. Images have alt attribute which contains alternative text that has
the same purpose as the title attribute of an iframe has

Analytics
---------

For analytics purposes, each time an image or iframe containing a
calendar or Google Drive file is loaded, an event will be triggered.

There are two types of events:

1. edx.googlecomponent.calendar.displayed (if an iframe containing a
Google calendar is loaded)
2. edx.googlecomponent.document.displayed (if an image or an iframe
containing a Google Drive File is loaded)

License
-------

The Google Drive & Calendar XBlocks are available under the GNU Affero
General Public License (AGPLv3).

Installation Troubleshooting
----------------------------

On a Mac, some people have received errors when installing lxml, trying
to find a specific header file for the compiler

Try the following if you encounter a problem:

::

CPATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/libxml2 CFLAGS=-Qunused-arguments CPPFLAGS=-Qunused-arguments pip install lxml

.. |Build Status| image:: https://travis-ci.org/edx-solutions/xblock-google-drive.svg?branch=master
:target: https://travis-ci.org/edx-solutions/xblock-google-drive
5 changes: 4 additions & 1 deletion google_drive/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
"""
Google drive XBlocks
"""
from .google_docs import GoogleDocumentBlock
from .google_calendar import GoogleCalendarBlock
from .google_calendar import GoogleCalendarBlock
Loading