Skip to content
Open
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
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ This repo contains a menuing system for Internet in a Box

## IIAB Menu

iiab-menu is a menuing system that uses json files for each menu item, which are loaded by and rendered in javascript,
based on an html file that contains an array of the menu items to load. This file will usually be named index.html, but can have
any name.
iiab-menu is a menuing system that uses json files for each menu item, which are loaded by and rendered in javascript.
A menu is defined by a folder, which contains a two files: a copy of "index.html", and a "menuitems.json" file, which contains the list of the menu items to load. The html file will usually be named "index.html", but can have
any name, as long as it is accompanied in a folder by a "menuitems.json" file.

The menu files are nominally in /library/www/html/iiab-menu, but the index file can be anywhere as the path to supporting files is absolute.
Several sample files are included in the samples directory.
The menu files are nominally in /library/www/html/iiab-menu, but the index and json files can be anywhere as the path to supporting files is absolute.
Several sample json files are included in the samples directory.

A menu item, a set of links to one piece of content such as the wikipedia, is defined by a 'menu-def' json file. There is a sample in the samples
directory. There may also be an optional html file that contains free form html to be appended to the menu item entry.
Expand Down
7 changes: 6 additions & 1 deletion cp-menus
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ fi

# copy sample index file if none exists in home
if [ ! -e $WWWROOT/home/index.html ]; then
cp samples/sampler.html $WWWROOT/home/index.html
cp samples/index.html $WWWROOT/home/index.html
fi

# copy sample menuIndex file if none exists in home
if [ ! -e $WWWROOT/home/menuitems.json ]; then
cp samples/menuitems.json $WWWROOT/home/menuitems.json
fi

# restore modified files from local
Expand Down
28 changes: 28 additions & 0 deletions menu-files/js/iiab-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var apkBaseUrl = "/content/apk/";
var menuUrl = '/iiab-menu/menu-files/';
var configJson = '/iiab-menu/config.json';
var defUrl = menuUrl + 'menu-defs/';
var menuItemFile = './menuitems.json';
var imageUrl = menuUrl + 'images/';
var menuServicesUrl = menuUrl + 'services/';
var iiabMeterUrl = "/iiab_meter.php"
Expand All @@ -44,6 +45,7 @@ var mobilePortraitSize = baseFontSize + "px";
var mobileLscapeSize = baseFontSize / 2 + "px";
var menuHtml = "";
var menuDefs = {};
var menuItems = {};
var zimVersions = {};

var scaffold = $.Deferred();
Expand Down Expand Up @@ -72,6 +74,32 @@ var getZimVersions = $.getJSON(zimVersionIdx)
zimVersions = data;})
.fail(jsonErrhandler);

// Get the list of menuItems
$.ajax({
type: 'GET',
async: false,
url: menuItemFile,
dataType: 'text'
})
.done(function( data ) {
var html = '';
var lines = String(data);
lines = lines.split("\n");
cleaner = '';
for (var i = 0, len = lines.length; i < len; i++) {
line = lines[i].trim();
var n = line.search('//');
if (n == 0) {continue;}
n = line.search('menuItems');
if (n != -1) {cleaner += '[';continue;}
n = line.search(';');
if (n != -1) {cleaner += ']';continue;}
cleaner += line;
}
//alert(cleaner);
menuItems = JSON.parse(cleaner);
});

// This is the main processing
if (dynamicHtml){
//$.when(scaffold, getZimVersions, getConfigJson).then(procMenu);
Expand Down
102 changes: 102 additions & 0 deletions samples/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<!DOCTYPE html>
<html>
<head>
<title>Internet in a Box - HOME</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="/common/css/bootstrap.min.css"/>
<link rel="stylesheet" href="/common/css/font-awesome.min.css">
<link rel="stylesheet" href="/common/css/star-rating.min.css" media="all" type="text/css"/>
<link rel="stylesheet" type="text/css" href="/common/css/xo-common.css">
<link rel="stylesheet" type="text/css" href="/iiab-menu/menu-files/css/iiab-menu.css">

<script src="/common/js/jquery.min.js"></script>
<script src="/common/js/bootstrap.min.js"></script>
<script src="/common/js/star-rating.min.js" type="text/javascript"></script>

</head>

<body>
<div id="header">
<div style="padding-left: 85%; padding-top: 37px;">
<img id="btn-feedback" src="/iiab-menu/menu-files/images/button_feedback.png">
</div>
</div>

<!-- <div class="haut cf">
<ul>
<li><a href="http://schoolserver.xsce.org" target="_blank">Internet in a Box School Server</a></li>
<li><a href="/iiab-menu/menu-files/html/credits.html">Credits</a></li>
</ul>
</div> -->

<div id="content"></div>

<div class="haut cf" style="margin-bottom: 80px;">
<!-- <ul>
<li><a href="http://schoolserver.lan" target="_blank">Internet in a Box School Server</a></li>
<li><a href="/iiab-menu/menu-files/html/credits.html">Credits</a></li>
</ul> -->
<button id="toggleFullDisplay">Desktop/Mobile View</button>
<div id="footer_right">Internet in a Box</div>
</div>

<!-- Feedback Dialog Modal -->
<div class="modal fade" id="feedbackModal" tabindex="-1" role="dialog" aria-labelledby="feedbackModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h2 class="modal-title" style="text-align: center;" id="feedbackModalLabel">We Welcome Your Feedback!</h2>
</div>
<div class="modal-body">
<form id="feedbackForm">

<div class="form-group">
<label for="feedback-name" class="control-label">Your Name:</label>
<input name="name" type="text" class="form-control" id="feedback-name">
</div>

<div class="form-group">
<label for="feedback-email" class="control-label">Your Email Address:</label>
<input name="name" type="text" class="form-control" id="feedback-email">
</div>

<div class="form-group">
<label for="about_you-text" class="control-label">A little bit about You:</label>
<textarea name="about_you" class="form-control" id="about_you-text"></textarea>
</div>

<div class="form-group">
<label for="feedback-rating" class="control-label">Please Rate this App:</label>
<input name="rating" id="feedback-rating" value="0" type="number" class="rating form-control" min=0 max=5 step=0.5 data-size="xs" >
</div>

<div class="form-group">
<label for="comments-text" class="control-label">Your Comments:</label>
<textarea name="comments" class="form-control" id="comments-text" rows="8" placeholder="How did this benefit you or your community? What can we improve?"></textarea>
</div>

</form>

<h2 class="modal-title" style="text-align: center;" id="feedbackMessageModal"></h2>

</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button id="btn-submitFeedback" type="button" class="btn btn-primary">Share your Feedback</button>
</div>
</div>
</div>
</div>
</div> <!-- End Feedback Dialog Modal -->
<div id="feedbackThanksModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<!-- <div id="feedbackThanksMessageModal" class="modal-body"></div> -->
</div>
</div>
</div>
<script src="/iiab-menu/menu-files/js/iiab-menu.js"></script>

</body>
</html>
103 changes: 103 additions & 0 deletions samples/menuitems.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
menuItems = [
"en-usb",
//"ar-kaos",
//"ar-tabshoura_kg",
//"ar-wikibooks_ar_all",
//"ar-wikipedia_ar_all",
//"ar-wikipedia_ar_medicine",
//"ar-wikiquote_ar_all",
//"ar-wiktionary_ar_all",
//"en-afristory-za",
//"en-afristory",
//"en-asst_medical",
//"en-ck12",
//"en-ebooks",
//"en-edison",
//"en-elgg",
//"en-fairshake",
//"en-GCF2015",
//"en-gutenberg_en_all",
//"en-healthphone",
//"en-hesperian_health",
//"en-iicba",
//"en-infonet",
//"en-kalite-ess",
//"en-kalite-india",
"en-kalite",
"en-kalite-sample-videos",
//"en-kalite_health",
//"en-law_library",
//"en-local_content",
//"en-math_expression",
//"en-medline_plus-static",
//"en-medline_plus",
"en-moodle",
//"en-musictheory",
"en-nextcloud",
//"en-olpc",
//"en-osm",
//"en-owncloud",
//"en-oya",
"en-phet_html",
"en-ray_charles_sample",
"fr-tedxlausannechange-2013_fr_all",
//"en-practical_action",
//"en-radiolab",
//"en-rpi_guide",
//"en-saylor",
//"en-scale-of-universe",
//"en-scratch",
"en-sugarizer",
//"en-tabshoura_kg",
//"en-tedmed_en_all",
//"en-ted_en_science",
//"en-test_zim",
//"en-understanding_algebra",
//"en-wikibooks_en_all",
//"en-wikipedia_en_all",
//"en-wikipedia_en_for_schools",
//"en-wikipedia_en_medicine",
//"en-wikipedia_en_simple_all",
//"en-wikipedia_en_wp1-08",
//"en-wikipedia_kn_medicine",
//"en-wikisource_en_all",
//"en-wikispecies_en_all",
//"en-wikiversity_en_all",
//"en-wikivoyage_en_all",
//"en-wiktionary_en_all",
//"en-wiktionary_en_simple_all",
"en-worldmap_8",
"en-enjoy",
//"es-ap_didact",
//"es-bibliofilo",
//"es-biblioteca",
//"es-blockly_games",
//"es-cnbguatemala",
//"es-ebooks",
//"es-educalab",
//"es-GCF2015",
//"es-guatemala",
//"es-guias",
//"es-hesperian_health",
//"es-medline_plus",
//"es-soluciones",
//"es-vedoque",
//"es-wikibooks_es_all",
//"es-wikihow",
//"es-wikipedia_es_all",
//"es-wikisource_es_all",
//"es-wikiversity_es_all",
//"es-wikivoyage_es_all",
//"es-wiktionary_es_all",
//"fr-ebooksgratuits",
//"fr-haitifutur",
//"fr-phet-haiti",
//"fr-wikipedia_fr_all",
//"hi-healthphone",
//"kn-healthphone",
//"kn-wikipedia_kn_all",
//"kn-wikipedia_kn_medicine",
//"kn-wikisource_kn_all",
//"kn-wiktionary_kn_all",
"en-credits"
];