Changeset - b55cc3e8ac74
[Not reviewed]
default
0 3 0
Nathan Brink (binki) - 13 years ago 2012-11-27 23:46:25
ohnobinki@ohnopublishing.net
Fix sharing dialogue to give links to the currently selected permutation/tab, fixing bug #92.
3 files changed with 27 insertions and 9 deletions:
0 comments (0 inline, 0 general)
inc/class.page.php
Show inline comments
 
@@ -135,13 +135,13 @@ class page
 
    $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(''),
inc/class.schedule.php
Show inline comments
 
@@ -459,12 +459,16 @@ class Schedule
 
      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
 
@@ -492,16 +496,12 @@ class Schedule
 
      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 '    });';
 

	
 

	
 
      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() {
 
@@ -513,14 +513,14 @@ class Schedule
 
	. '    ' . 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()))) .'&amp;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()))) .'&amp;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;
 

	
scripts/uiTabsKeyboard.js
Show inline comments
 
/*
 
 * 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
 
@@ -15,12 +15,14 @@
 
 *
 
 * 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
 
@@ -42,7 +44,23 @@ jQuery(document).ready( function() {
 
    else {
 
      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);
 
	});
 
});
0 comments (0 inline, 0 general)