A basic MDID3 viewer to use as a launchpad for making new MDID3 viewers. Vaguely inspired by the classic "Hello World" program, except that if we're honest we have to admit that just seeing the words "Hello. World" in a browser window doesn't impress anyone.
MDID3 has a feature called "Viewers" - it shipped with several which you may be familiar with including View Presentation, Package Files, Print View. All (or most?) of the links that show up under "actions" on the edit presentation/light table page are technically "viewers." The Viewer is the feature that is responsible for
- Getting the images in a presentation
- Formatting/processing/packaging/etc. the images and associated data as desired
- Presenting the results to the end user
- See a presentation of your choice rendered in glorious-but-not-particularly-refined HTML
- Use the included source code to build your own
- Once it's working, try editing rooibos/apps/hello_viewer/templates/hello.html to change
- Admin access on an MDID server running version 3.5 (Django 1.11, python3)
- An idea for a new kind of viewer
-
cd to your mdid/rooibos directory (where settings_local.py and manage.py are located) and type the following command:
git clone git@github.com:mdid-devs/hello_viewer.git apps/hello_viewer
-
Save a copy of rooibos/apps/hello_viewer/settings_local_template.py as settings_local.py
-
Add the following to your rooibos/settings_local.py:
python additional_settings = [ 'rooibos.apps.hello_viewer.settings_local', ] INSTALLED_APPS = ( 'rooibos.apps.hello_viewer', )
- Restart the web server (just httpd/nginx/iis - not the server)
-
Edit a presentation (e.g. click Organization > Edit {Presentation Name}
-
In the Actions side bar, click the link titled "HelloViewer"
It outputs the items (aka slides) of a presentation to a page (similar in formatting to PDF View but not as refined) with full-sized image, both thumbnails and metadata.
However, the real purpose of hello_viewer is to see how it's not that hard to make your own custom viewer if you have worked with any web page creation task in the past. Start by editing hello.html, if you know HTML it shouldn't be too hard to adjust to django's template language.
For reference, here are some variables that you can use in your own template:
{{ tag }} | Function | Example |
---|---|---|
{{ return_url }} | link for a back button | <a href="{{ return_url }}">Back</a> |
{{ options_form }} | include the options form | <form method="post">{% csrf_token %}form method="post">{% csrf_token %}{{ options_form }}</form> |
{% static 'file' %} | url of the static files (unchanging files like images, css, etc. | <img src="{% static 'hello_mdid.png' %}"> |
{{ notes }} | The notes variable (supplied via the options_form) | ` {{ notes |
{{ options_form }} | include the options form | <form method="post"> {% csrf_token %} {{ options_form } </form> |
{% url hello_static %} | url of the static files | <img src="{% url hello_static 'hello_mdid.png' %}"> |
{{ notes }} | The notes variable (supplied via the options_form) | {{ notes }} |
Maybe write a better tutorial?