diff options
author | priyanka-m <priyanka.menghani@gmail.com> | 2012-12-16 18:46:48 +0400 |
---|---|---|
committer | priyanka-m <priyanka.menghani@gmail.com> | 2012-12-16 18:46:48 +0400 |
commit | 0df32bd3fd0312a08192b3ff02e9a287164e3366 (patch) | |
tree | 581e6f0e3d337afbbf176ff1ca1587f168436601 /reader | |
parent | 46e1754a28c200004d18252739ae80c3ae631d3f (diff) |
Tagging of eBooks not working
Diffstat (limited to 'reader')
-rwxr-xr-x | reader/ajax/tags.php | 9 | ||||
-rwxr-xr-x | reader/appinfo/database.xml | 2 | ||||
-rwxr-xr-x | reader/css/reader.css | 2 | ||||
-rwxr-xr-x | reader/js/integrate.js | 22 | ||||
-rwxr-xr-x | reader/lib/library_display.php | 39 | ||||
-rwxr-xr-x | reader/lib/tag_utils.php | 1 | ||||
-rwxr-xr-x | reader/templates/tagged.php | 3 |
7 files changed, 58 insertions, 20 deletions
diff --git a/reader/ajax/tags.php b/reader/ajax/tags.php index 489e89b11..70e8c6d02 100755 --- a/reader/ajax/tags.php +++ b/reader/ajax/tags.php @@ -1,14 +1,17 @@ <?php include('apps/reader/lib/tag_utils.php'); + $new_tag = $_POST['s']; $path_of_ebook = $_POST['path']; - $new_tag = $_POST['tag']; - $path_of_ebook = urldecode($path_of_ebook); + //$new_tag = $_POST['tag']; + //$path_of_ebook = urldecode($path_of_ebook); $tags = find_tags_for_ebook($path_of_ebook); if ($tags != NULL) { - $new_tag = $tags.",".$new_tag; + echo $new_tag; + $new_tag = $tags.','.$new_tag; update_tag_for_ebook($new_tag,$path_of_ebook); } else { insert_new_tag($new_tag,$path_of_ebook); + echo $new_tag; } ?> diff --git a/reader/appinfo/database.xml b/reader/appinfo/database.xml index 01ca55675..43bd79f22 100755 --- a/reader/appinfo/database.xml +++ b/reader/appinfo/database.xml @@ -26,7 +26,7 @@ <type>text</type> <default></default> <notnull>false</notnull> - <length>20</length> + <length>100</length> </field> </declaration> diff --git a/reader/css/reader.css b/reader/css/reader.css index 9cdc6a98f..d1dde5311 100755 --- a/reader/css/reader.css +++ b/reader/css/reader.css @@ -15,7 +15,7 @@ td.filename.svg { background:no-repeat; height:150px; white-space:normal; color: td.filename a.name { position:relative;} a.name span.nametext { position:relative; top: 4px; left:-25px; } -span.nametext { padding-left:1px; font-family:Arial; font-size:16px; font-weight:normal; white-space:nowrap; text-transform:capitalize; } +span.nametext { padding-left:1px; font-family:Arial; font-size:16px; font-weight:normal; white-space:nowrap;} a.dirs span.nametext { margin-left:10px;} div#thumbs { position:relative;} div#thumbs img { border:1px solid #EEE; -webkit-box-shadow: 4px 4px 4px 0px grey; box-shadow: 4px 4px 4px 0px grey; /*position:absolute; left:25px; top: 20px;*/} diff --git a/reader/js/integrate.js b/reader/js/integrate.js index 75d127d6c..94cfa0d44 100755 --- a/reader/js/integrate.js +++ b/reader/js/integrate.js @@ -6,7 +6,7 @@ $(document).ready(function() { $('#file_action_panel').attr('activeAction', false); - $('.start').click(function(){ + /*$('.start').click(function(){ var contentbox = $(this).parent().children('div#contentbox'); var path = $(this).parent().children('a.name').attr('dir'); contentbox.show(100); @@ -17,11 +17,27 @@ $(document).ready(function() { contentbox.hide(); var displaybox = $(this).parent().children('div#displaybox'); displaybox.append('<a href = "apps/reader/fetch_tags.php?tag='+tag+'">'+tag+'</a>'); - displaybox.append(' '); + //location.reload(); + tag = tag + ','; $.post('apps/reader/ajax/tags.php', {tag:tag, path:path}); + } }); - }); + });*/ + + /*$("#searchForm").submit(function(event) { + event.preventDefault(); + var $form = $( this ), + term = $form.find( 'input[name="s"]' ).val(), + url = 'apps/reader/ajax/tags.php'; + var path = $(this).parent().children('a.name').attr('dir'); + $.post( url, { s: term,path:path }, + function( data ) { + $( "#result" ).empty().append(data); + } + ); + });*/ + }); $(function() { diff --git a/reader/lib/library_display.php b/reader/lib/library_display.php index 853740633..1dc74462b 100755 --- a/reader/lib/library_display.php +++ b/reader/lib/library_display.php @@ -9,24 +9,41 @@ function display_each_ebook($directory,$name) { <span class = "nametext">'. htmlspecialchars(urldecode($name)). '</span> - </a> - <div id = "displaybox">'; - $each_row = find_tags_for_ebook(urldecode($directory).urldecode($name)); + </a>'; + //<div id = "displaybox">'; + /* $each_row = find_tags_for_ebook(urldecode($directory).urldecode($name)); $tags = explode(",",$each_row); $tag_count = 1; foreach ($tags as $tag) { - if ($tag_count == 2) { - echo ", "; - } echo '<a href = "'.\OCP\Util::linkTo('reader', 'fetch_tags.php').'?tag='.$tag.'">' .ucwords($tag). '</a>'; - $tag_count+= 1; } - echo '</div> - <input type="button" class="start" value="Add Tag"> - <div id="contentbox" contenteditable="true"></div> - </td>'; + echo '</div>'; + if (count($tags) < 5 ) { + echo count($tags); + echo '<input type="button" class="start" value="Add Tag">'; + }echo '<div id="contentbox" contenteditable="true"></div>*/ + + /*echo '<form action="/" id="TagForm"> + <input type="text" name="s" placeholder="Add Tag..." /> + <input type="submit" value="add tag" /> + </form> + <!-- the result of the search will be rendered inside this div --> + <div id="result">'; + $each_row = find_tags_for_ebook(urldecode($directory).urldecode($name)); + $tags = explode(",",$each_row); + foreach ($tags as $tag) { + echo '<a href = "'.\OCP\Util::linkTo('reader', 'fetch_tags.php').'?tag='.$tag.'">' + .ucwords($tag). + '</a>'; + } + echo '</div>'; + + */ + + + echo '</td>'; } function display_sub_dirs($current_dir,$sub_dirs) { diff --git a/reader/lib/tag_utils.php b/reader/lib/tag_utils.php index d18cdd416..23a172286 100755 --- a/reader/lib/tag_utils.php +++ b/reader/lib/tag_utils.php @@ -46,4 +46,5 @@ function delete_entry($filepath) { $stmt = OCP\DB::prepare($sql); $res = $stmt->execute(array($filepath)); } + ?> diff --git a/reader/templates/tagged.php b/reader/templates/tagged.php index a3105306d..5ac3665a7 100755 --- a/reader/templates/tagged.php +++ b/reader/templates/tagged.php @@ -17,7 +17,8 @@ while($r = $res->fetchRow()) { $dirname = dirname($r['filepath']); if ($dirname != '/') { - $dirname = $dirname.'/'; } + $dirname = $dirname.'/'; + } display_ebooks(basename($r['filepath']),$dirname); } ?> |