Changeset - 44a2235fb378
[Not reviewed]
default
0 4 0
Ethan Zonca - 15 years ago 2010-10-22 21:20:03
ez@ethanzonca.com
More flexible share URLs
4 files changed with 40 insertions and 5 deletions:
0 comments (0 inline, 0 general)
class.schedule.php
Show inline comments
 
@@ -225,7 +225,7 @@ class Schedule
 
      echo '}); '; /* Close document.ready for jquery */
 
      echo 'window.print(); </script>';
 

	
 
      echo '<p><a href="'.$_SERVER['SCRIPT_NAME'].'?s=' . $this->id_get() . '">Return to normal view</a> </p>';
 
      echo '<p><a href="'.$_SERVER['SCRIPT_NAME'].'?s=' . $this->id_get() . '">&laquo; Return to normal view</a> </p>';
 

	
 
    }
 
    else {
 
@@ -243,7 +243,7 @@ class Schedule
 
		jQuery(\'#selectItemsInput\').hide();
 
	    });';
 
      echo '});</script>'; /* Close document.ready for jquery */
 
      echo '<div id="sharedialog" title="Share Schedule"><p>You can share your schedule with the URL below:</p><p>http://' . $_SERVER['HTTP_HOST']  . $_SERVER['REQUEST_URI'].'</p></div>';
 
      echo '<div id="sharedialog" title="Share Schedule"><p>You can share your schedule with the URL below:</p><p><!--http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'].'-->'.$outputPage->gen_share_url($this->id_get()).'</p></div>';
 
      echo '<p><span id="printItems"><a href="#">Print</a></span> :: <span id="share"><a href="#">Share</a></span> :: <a href="input.php">Home</a></p><p class="centeredtext">Having problems? <a href="feedback.php">Let us know</a>.</p><p class="centeredtext graytext"><em>Keyboard Shortcut: Left and right arrow keys switch between schedules</em></p>';
 
    }		
 

	
 
@@ -370,9 +370,9 @@ class Schedule
 

	
 
    /* edit button */
 
    if ($id = $this->id_get())
 
      echo '<form method="get" action="input.php"><p><input type="hidden" name="s" value="' . $id . '" /><input class="gray" type="submit" value="edit" /></p></form>';
 
      echo '<form method="get" action="input.php"><p><input type="hidden" name="s" value="' . $id . '" /><input class="gray" id="editbutton" type="submit" value="edit" /></p></form>';
 

	
 
    echo "<p>There were a total of " . $this->possiblePermutations . " possible permutations. Only " . $this->nPermutations . " permutations had no class conflicts.</p>";
 
    echo "<p id=\"possiblestats\">There were a total of " . $this->possiblePermutations . " possible permutations. Only " . $this->nPermutations . " permutations had no class conflicts.</p>";
 

	
 
    $outputPage->foot();
 
  }
inc/class.page.php
Show inline comments
 
@@ -408,4 +408,22 @@ class page
 
// </script>';
 
  }
 

	
 
  private function add_trailing_slash($path){
 
    if($path[strlen($path)-1] != '/') {
 
      return $path . "/";
 
    }
 
    else {
 
      return $path;
 
    }
 
  }
 

	
 
  public function gen_share_url($id){
 
    global $clean_urls, $short_url_base,$_SERVER;
 
    if($clean_urls && isset($short_url_base)) {
 
      return $this->add_trailing_slash($short_url_base) . $id;
 
    }
 
    else {
 
      return 'http://' . $_SERVER['HTTP_HOST']  . $_SERVER['REQUEST_URI'];
 
    }
 
  }
 
}
inc/config.inc.example
Show inline comments
 
@@ -29,6 +29,17 @@
 

	
 
/**
 
 * \brief
 
 *   Custom clean URLs for schedule sharing. $clean_urls must be enabled.
 
 * 
 
 * This string should be set to a valid base URL that is rewritten
 
 * to a valid slate_permutate installation. This feature will be
 
 * extended in the future to support URL shorteners.
 
 */
 
/* $short_url_base = 'http://example.com/sp/'; */
 

	
 

	
 
/**
 
 * \brief
 
 *   List of Google Analytics trackers to enable. Default: empty list.
 
 *
 
 * Set this to an array of Google Analytics tracker IDs if you want to
styles/print.css
Show inline comments
 
@@ -21,6 +21,12 @@ div.scroller div.section div.txt {
 
	background: #fff!important;
 
}
 

	
 
#footer {
 
#editbutton {
 
  display: none;
 
}
 
#leftfoot {
 
  display: none; /* Hide feedback button */
 
}
 
#possiblestats {
 
  text-align: center;
 
}
0 comments (0 inline, 0 general)