Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronmaturen committed May 20, 2012
0 parents commit 4f1e98c
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.ResourcePanel {margin:5px;}
.ResourcePanelSmall {margin:5px;}
.chosen .ResourcePanel, .chosen .ResourcePanelSmall{border:5px solid hotPink; margin:1px 0;}
64 changes: 64 additions & 0 deletions hooks/search.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php
function HookInline_keywordsSearchSearchbarbottomtoolbar()
{
global $lang;
?>
<div id="SearchBoxPanel" class="keywordPanel">
<div class="SearchSpace">
<h2><?php echo $lang["addkeywords"]; ?></h2>
<p><?php echo $lang['keywordstoresource']; ?></p>

<form id="manipulateKeywords">
<input id="newKeywordsForSelectedResources" class="SearchWidth"/>
<input type="button" id="selectAllResourceButton" value="<?php echo $lang["selectall"]; ?>">
<input type="button" id="clearSelectedResourceButton" value="<?php echo $lang["unselectall"]; ?>">
<input type="button" id="submitSelectedResourceButton" value="<?php echo $lang["addkeywords"]; ?>">
</form>
</div>
</div>
<?php
}
function HookInline_keywordsSearchAdditionalheaderjs()
{
global $baseurl;
if(checkperm('a'))
{ ?>
<script type='text/javascript'>
jQuery(document).ready(function() {
jQuery('.ResourcePanelShell, .ResourcePanelShellSmall').on('click', function() {
jQuery(this).toggleClass('chosen');
});

jQuery('.ResourcePanelShell, .ResourcePanelShellSmall').on('click','a',function(event){event.stopPropagation();});

jQuery('#clearSelectedResourceButton').on('click', function() {
jQuery('.chosen').removeClass('chosen');
jQuery('#newKeywordsForSelectedResources').val('');
});

jQuery('#selectAllResourceButton').on('click', function() {
jQuery('.ResourcePanelShell, .ResourcePanelShellSmall').addClass('chosen');
});

jQuery('#submitSelectedResourceButton').on('click', function() {
resourceIds = jQuery.map(jQuery('.chosen'), function(a, b){
return jQuery(a).attr('id').replace('ResourceShell','');
}).join('+');
jQuery.ajax({
type: "POST",
url: "<?php echo $baseurl; ?>/plugins/simple_keywords/pages/add_keywords.php",
data: { refs: resourceIds, keywords: jQuery('#newKeywordsForSelectedResources').val().replace(/ /g,'+') }
}).done(function( msg ) {
if(msg !== ''){alert( "Data Saved: " + msg );}
//jQuery(".keywordPanel").effect("highlight", {}, 3000);
jQuery(".keywordPanel").fadeTo("slow", 0.5, function () {
jQuery(".keywordPanel").fadeTo("slow", 1.0, function(){});
});
});
});
});
</script>
<?php }
return true;
}
?>
7 changes: 7 additions & 0 deletions inline_keywords.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: inline_keywords
author: Aaron T. Maturen
version: 0.1
desc: Short project description
info_url: http://url.to.your/info_pages/ (Link to web page with additional information about the plugin)
config_url: /plugins/simple_keywords/pages/setup.php
default_priority: 999
6 changes: 6 additions & 0 deletions languages/en.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php
$lang['selectall'] = 'Select All';
$lang['unselectall'] = 'Unselect All';
$lang['addkeywords'] = 'Add Keyword(s)';
$lang['keywordstoresource'] = 'Add keyword(s) to selected resources.';
?>
15 changes: 15 additions & 0 deletions pages/add_keywords.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

include_once "../../../include/db.php";
include_once "../../../include/authenticate.php";if (!checkperm("a")) {exit("Permission denied");}
include_once "../../../include/general.php";
include_once "../../../include/resource_functions.php";

$keywords = explode(' ',str_replace('+',' ',$_REQUEST['keywords']));
$refs = explode(' ',str_replace('+',' ',$_REQUEST['refs']));
foreach($refs as $ref){
foreach($keywords as $keyword){
add_keyword_mappings($ref, $keyword,8);
}
}
?>

0 comments on commit 4f1e98c

Please sign in to comment.