@@ -129,25 +129,25 @@ class page
$this->headCode['jQuery'] = '<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js" type="text/javascript"></script>';
$this->headCode['jQueryUI'] = '<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js" type="text/javascript"></script><link rel="stylesheet" href="styles/jqueryui.css" type="text/css" media="screen" charset="utf-8" />';
$this->headCode['jValidate'] = '<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.pack.js"></script>';
$this->headCode['jAddress'] = '<script type="text/javascript" src="http://js.ohnopub.net/js/jquery.address-1.3.2.min.js"></script>';
$this->headCode['jQuery.cuteTime'] = '<script type="text/javascript" src="http://js.ohnopub.net/js/ohnobinki/2011.04.19/jquery.cuteTime.min.js"></script>';
$this->headCode['qTip'] = '<script type="text/javascript" src="http://js.ohnopub.net/js/jquery.qtip-1.0.min.js"></script>';
$this->headCode['qTip2'] = '<script type="text/javascript" src="http://js.ohnopub.net/js/2011.03.21/jquery.qtip.min.js"></script><link rel="stylesheet" href="http://js.ohnopub.net/js/2011.03.21/jquery.qtip.min.css" type="text/css" media="screen" />';
$this->headCode['schedInput'] = '<script type="text/javascript" src="scripts/scheduleInput.js"></script>';
$this->headCode['outputPrintStyle'] = '<link rel="stylesheet" href="styles/print.css" type="text/css" media="screen" charset="utf-8" />';
$this->headCode['outputStyle'] = '<link rel="stylesheet" href="styles/output.css" type="text/css" media="screen" charset="utf-8" />';
$this->headCode['gliderHeadcode'] = '<link rel="stylesheet" href="styles/glider.css" type="text/css" media="screen" charset="utf-8" />';
$this->headCode['uiTabsKeyboard'] = '<script type="text/javascript" src="scripts/uiTabsKeyboard.js"></script>';
$this->headCode['uiTabsKeyboard'] = '<script type="text/javascript" src="scripts/uiTabsKeyboard.js?v=20121128h"></script>';
$this->headCode['displayTables'] = '<script type="text/javascript" src="scripts/displayTables.js"></script>';
$this->pagetitle = $ntitle;
$this->scripts = $nscripts;
$this->meta = array(
'msapplication-starturl' => self::uri_resolve(''),
'msapplication-task' => 'name=Create Schedule; action-uri=' . self::uri_resolve('input.php') . '; icon-uri=' . self::uri_resolve('images/favicon_96.png'),
'msapplication-tooltip' => 'Find the semester schedule which works for you!',
);
/* Compliant browsers which care, such as gecko, explicitly request xhtml: */
if(empty($_SERVER['HTTP_ACCEPT']) /* then the browser doesn't care :-) */
@@ -453,24 +453,28 @@ class Schedule
$last_permutation = min($this->nPermutations, $first_permutation + SP_PERMUTATIONS_PER_PAGE);
$footcloser = '';
$headcode = array('jQuery', 'jQueryUI', 'uiTabsKeyboard', 'displayTables', 'outputStyle', 'jQuery.cuteTime', 'qTip2');
if(!empty($_REQUEST['print']))
array_push($headcode, 'outputPrintStyle');
else
array_push($headcode, 'jAddress');
$outputPage = page::page_create(htmlentities($this->getName()), $headcode,
array('school' => $this->school_get(), 'semester' => $this->semester_get()));
$outputPage->headcode_add('schedule_share_links', $outputPage->script_wrap(
'var share_facebook_template = ' . json_encode('https://facebook.com/sharer.php?t=' . rawurlencode($this->scheduleName) . '&u=' . $outputPage->gen_share_url($this->id_get())) . ";\n"
. 'var share_url_template = ' . json_encode($outputPage->gen_share_url($this->id_get())) . ';'),
TRUE);
$outputPage->conversion();
if (!empty($this->created))
$outputPage->meta('dcterms.created', gmdate(DATE_W3C, $this->created));
if ($schedule_store !== NULL
&& $this->parent_get() !== NULL
&& ($parent_schedule = schedule_store_retrieve($schedule_store, $this->parent_get())) !== NULL)
{
$parent_uri = $parent_schedule->my_url();
$outputPage->meta('dcterms.relation', $parent_uri);
$outputPage->meta('dcterms.replaces', $parent_uri);
}
@@ -486,47 +490,43 @@ class Schedule
. ' window.print();' . PHP_EOL
. '});';
echo $outputPage->script_wrap($script);
echo '<p><a href="'.$_SERVER['SCRIPT_NAME'].'?s=' . $this->id_get() . '">« Return to normal view</a> </p>';
else {
echo ' <script type="text/javascript">';
echo ' jQuery(document).ready( function() {';
echo ' jQuery("#tabs").tabs();';
echo ' jQuery.address.change(function(event){';
echo ' jQuery("#tabs").tabs( "select" , window.location.hash );';
echo ' });';
echo ' jQuery("#tabs").bind("tabsselect", function(event, ui) {';
echo ' window.location.hash = ui.tab.hash;';
echo ' jQuery("#sharedialog").dialog({ modal: true, width: 550, resizable: false, draggable: false, autoOpen: false });';
echo ' jQuery("#share").click( function() {
jQuery("#sharedialog").dialog("open");
});';
echo ' jQuery(\'#printItems\').click( function() {
window.location = "'.$_SERVER['SCRIPT_NAME'].'?s='.$this->id_get().'&print=" + (jQuery(\'#tabs\').tabs(\'option\',\'selected\') + 1);
});
jQuery(\'#cancelItems\').click( function() {
jQuery(\'#selectItemsInput\').hide();
});'
. ' ' . PHP_EOL
. ' jQuery(\'.cute-time\').cuteTime();' . PHP_EOL
. ' });' . PHP_EOL
. ' </script>' . PHP_EOL;
echo ' <div id="sharedialog" title="Share Schedule">' . PHP_EOL
. ' <p class="indent"><img alt="[fb]" class="noborder" src="http://facebook.com/favicon.ico" /> <a href="http://www.facebook.com/sharer.php?u=' . urlencode(htmlentities($outputPage->gen_share_url($this->id_get()))) .'&t=My%20Schedule">Share on Facebook</a></p>
<p class="indent"><img alt="[sp]" class="noborder" src="images/favicon.svg" style="margin-right: 5px; width: 16px; height: 16px;"/><span class="clicktoclipboard"><a href="#">Share with URL</a><span class="toclipboard hidden"><p>Copy the share URL below:<br /><em class="centeredtext smallurl">' . htmlentities($outputPage->gen_share_url($this->id_get())) . '</em></p></span></span></p>' . PHP_EOL
. ' <p class="indent"><img alt="[fb]" class="noborder" src="http://facebook.com/favicon.ico" /> <a id="share-fb-a" href="http://www.facebook.com/sharer.php?u=' . urlencode(htmlentities($outputPage->gen_share_url($this->id_get()))) .'&t=' . rawurlencode($this->scheduleName) . '">Share on Facebook</a></p>
<p class="indent"><img alt="[sp]" class="noborder" src="images/favicon.svg" style="margin-right: 5px; width: 16px; height: 16px;"/><span class="clicktoclipboard"><a href="#">Share with URL</a><span class="toclipboard hidden"><p>Copy the share URL below:<br /><em id="share-url-em" class="centeredtext smallurl">' . htmlentities($outputPage->gen_share_url($this->id_get())) . '</em></p></span></span></p>' . PHP_EOL
. ' </div>' . PHP_EOL
. ' <p>' . PHP_EOL
. ' <a href="input.php?s='.$this->id.'" class="button">Edit</a>' . PHP_EOL
. ' <span id="printItems"><a href="#" class="button">Print</a></span>' . PHP_EOL
. ' <span id="share"><a href="#" class="button">Share</a></span>' . PHP_EOL;
if (!empty($parent_schedule))
echo ' <a class="button" href="' . htmlentities($parent_uri, ENT_QUOTES) . '" title="Parent schedule: ' . htmlentities($parent_schedule->getName()) . '">Parent</a>' . PHP_EOL;
/*
* Copyright 2010 Nathan Gelderloos, Ethan Zonca, Nathan Phillip Brink
/* -*- tab-width: 4; -*-
* Copyright 2012 Nathan Gelderloos, Ethan Zonca, Nathan Phillip Brink
*
* This file is part of SlatePermutate.
* SlatePermutate is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* SlatePermutate is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public License
* along with SlatePermutate. If not, see <http://www.gnu.org/licenses/>.
*/
jQuery(document).ready( function() {
var share_facebook_a_obj = jQuery('#share-fb-a');
var share_url_em_obj = jQuery('#share-url-em');
jQuery(document).keydown(function(e) {
var direction = null;
// handle cursor keys
if (e.keyCode == 37) {
// slide left
direction = 'prev';
} else if (e.keyCode == 39) {
// slide right
direction = 'next';
@@ -36,13 +38,29 @@ jQuery(document).ready( function() {
var selected = jQuery('#tabs').tabs('option', 'selected');//getting the currently selected tab
if (direction == 'next') {
if (selected <= totaltabs - 1)
jQuery('#tabs').tabs('select',selected + 1)
if (selected != 0)
jQuery('#tabs').tabs('select',selected - 1)
function share_update_uris(hash)
share_facebook_a_obj.attr('href', share_facebook_template + hash.replace('#', '%23'));
share_url_em_obj.text(share_url_template + hash);
share_update_uris(window.location.hash);
jQuery('#tabs').bind('tabsselect', function(event, ui) {
window.location.hash = ui.tab.hash;
* Update some links to be specific to the current bug (bug
* #92).
share_update_uris(ui.tab.hash);
Status change: