Diff of /wordpress-plugins/KohaCatalogSearch.php [000000] .. [r231] Maximize Restore

  Switch to side-by-side view

--- a
+++ b/wordpress-plugins/KohaCatalogSearch.php
@@ -0,0 +1,88 @@
+<?php
+/*
+Plugin Name: KohaCatalogSearch
+Plugin URI: http://kylehall.info/index.php/projects/koha-tools/koha-tools-wordpress-plugins/
+Description: Allows one to add a search box to a Koha catalog on a WordPress site..
+Version: 0.1
+Author: Kyle Hall (c) 2007
+Author URI: http://www.kylehall.info
+*/
+
+/*  Copyright 2007 Kyle Hall  (email : kyle@kylahall.info)
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program 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 General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+function kcs_display_search_form() {
+	$kohaUrl = get_option('kcs_url');
+	$kohaBranchcode = get_option('kcs_branchcode');
+	$kohaLabel = get_option('kcs_label');
+	$kohaButton = get_option('kcs_button');
+	
+        echo "
+<form name='searchform' method='get' action='$kohaUrl/search' id='searchform'>
+  <h3><nobr>$kohaLabel</nobr></h3>
+    <ul>";
+if ( $kohaBranchcode ) { echo "<input type='hidden' name='limit' value='branch:$kohaBranchcode' />"; }
+echo "<input type='text' id='q' name='q' size='5' />
+      <input type='submit' name='kcs_submit' id='kcs_submit' value='$kohaButton' class='submit' />
+    </ul>
+</form>
+";	
+}
+
+function add_kcs_options_page() {
+	if ( function_exists('add_options_page') ) {
+		add_options_page('KohaCatalogSearch', 'KohaCatalogSearch', 8, basename(__FILE__), 'kcs_options_page');
+	}
+}
+
+// kcs_options_page() displays the options page for the KohaCatalogSearch submenu
+function kcs_options_page() {
+	echo "<h2>Koha Catalog Search</h2>";
+
+	if ( isset($_POST['info_update']) ) {
+		$kohaUrl = $_POST['kohaUrl'];
+		$kohaBranchcode = $_POST['kohaBranchcode'];
+		$kohaLabel = $_POST['kohaLabel'];
+		$kohaButton = $_POST['kohaButton'];
+		update_option('kcs_url', $kohaUrl);
+		update_option('kcs_branchcode', $kohaBranchcode);
+		update_option('kcs_label', $kohaLabel);
+		update_option('kcs_button', $kohaButton);
+		echo "<h3>Your Options Have Been Updated</h3>";
+	} else {
+		$kohaUrl = get_option('kcs_url');
+		$kohaBranchcode = get_option('kcs_branchcode');
+		$kohaLabel = get_option('kcs_label');
+		$kohaButton = get_option('kcs_button');
+	}
+?>
+<div class="wrap">
+	<h2>Enter Your Koha Information</h2>
+	<form method="post">
+		Catalog URL: <input type="text" name="kohaUrl" length="40" value="<?=$kohaUrl?>"> <i>The catalog URL up to but not including the final '/'.<br/>
+		Library Branchcode: <input type="text" name="kohaBranchcode" maxlength="4" value="<?=$kohaBranchcode?>"> <i>The branch to search on. Leave empty for all branches.</i> <br/>
+		Label Text: <input type="text" name="kohaLabel" value="<?=$kohaLabel?>"> <i>This text will appear before the search field.</i> <br/>
+		Submit Button Text: <input type="text" name="kohaButton" value="<?=$kohaButton?>"> <i>The text for the submit button.</i> <br/>
+		<div style="float: none;" class="submit">
+			<input type="submit" name="info_update" value="<?php _e('Update Options', 'UpdateOptions')?> ��" />
+		</div>
+	</form>
+</div>
+<?php
+}
+
+add_action('admin_menu', 'add_kcs_options_page');