Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/apps.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/reader
diff options
context:
space:
mode:
authorpriyanka-m <priyanka.menghani@gmail.com>2012-11-30 21:55:58 +0400
committerpriyanka-m <priyanka.menghani@gmail.com>2012-11-30 21:55:58 +0400
commitf041044d9784f6132c9ac5d18a6e6bc29ba0300f (patch)
tree096c3746af46112dc1e4c65192b3630064e51bff /reader
parent46c508f10e2bc00de2660817214c4962491e800d (diff)
Added feature of tagging eBooks.
Diffstat (limited to 'reader')
-rw-r--r--reader/ajax/tags.php14
-rw-r--r--reader/appinfo/database.xml37
-rw-r--r--reader/css/reader.css46
-rw-r--r--reader/fetch_tags.php18
-rw-r--r--reader/img/download.jpgbin0 -> 3214 bytes
-rw-r--r--reader/img/images.jpgbin0 -> 2405 bytes
-rwxr-xr-xreader/index.php1
-rwxr-xr-xreader/js/integrate.js21
-rw-r--r--reader/lib/dir.php16
-rw-r--r--reader/lib/library_display.php104
-rw-r--r--reader/lib/tag_utils.php29
-rw-r--r--reader/lib/thumbnail.php6
-rw-r--r--reader/results.php1
-rwxr-xr-xreader/templates/index.php93
-rw-r--r--reader/templates/results.php25
-rw-r--r--reader/templates/tagged.php43
16 files changed, 340 insertions, 114 deletions
diff --git a/reader/ajax/tags.php b/reader/ajax/tags.php
new file mode 100644
index 000000000..489e89b11
--- /dev/null
+++ b/reader/ajax/tags.php
@@ -0,0 +1,14 @@
+<?php
+include('apps/reader/lib/tag_utils.php');
+ $path_of_ebook = $_POST['path'];
+ $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;
+ update_tag_for_ebook($new_tag,$path_of_ebook);
+ }
+ else {
+ insert_new_tag($new_tag,$path_of_ebook);
+ }
+?>
diff --git a/reader/appinfo/database.xml b/reader/appinfo/database.xml
new file mode 100644
index 000000000..01ca55675
--- /dev/null
+++ b/reader/appinfo/database.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<database>
+
+ <name>*dbname*</name>
+ <create>true</create>
+ <overwrite>false</overwrite>
+
+ <charset>utf8</charset>
+
+ <table>
+
+ <name>*dbprefix*eBook_library</name>
+
+ <declaration>
+
+ <field>
+ <name>filepath</name>
+ <type>text</type>
+ <default></default>
+ <notnull>true</notnull>
+ <length>200</length>
+ </field>
+
+ <field>
+ <name>tags</name>
+ <type>text</type>
+ <default></default>
+ <notnull>false</notnull>
+ <length>20</length>
+ </field>
+
+ </declaration>
+
+ </table>
+
+
+</database>
diff --git a/reader/css/reader.css b/reader/css/reader.css
index 69a08285f..4eef11f46 100644
--- a/reader/css/reader.css
+++ b/reader/css/reader.css
@@ -1,24 +1,44 @@
-div#controls{z-index:60;}
+div#controls{z-index:65;}
div.crumb { float:left; display:block; background:no-repeat right 0; padding:.75em 1.5em 0 1em; height:2.9em;}
div.crumb:first-child { padding-left:1em; }
div.crumb.last { font-weight:bold; }
-table#readerContent { white-space:normal; position:absolute; top:40px; left:5px;font-family:Arial;}
+table#readerContent { white-space:normal; position:absolute; top:37px;font-family:Arial;}
-table { position:relative; top:7px; width:100%;}
-tbody tr { background-color:#fff; height:2.5em;}
-tbody#fileList tr { background:white; float:left; height:150px;font-size:12px;}
-tbody tr:hover, tbody tr:active, tbody tr.selected { background-color:#ffffff; }
+/*table { position:relative; top:7px; width:100%;}*/
+/*tbody tr { background-color:#fff; height:2.5em;}*/
+tbody#fileList tr { background:white; /*float:left;*/ height:150px;font-size:12px;}
+tbody tr:hover, tbody tr:active, tbody tr.selected {background-color: white:# }
.thumbnail:not([data-loaded]) { background-color: white; }
-td.filename.svg{ background:no-repeat; vertical-align:text-bottom; height:150px; width:150px; white-space:normal; text-align:center;
- color:#888; text-shadow:#fff 0 1px 0;}
-td.filename.svg:hover{ background-color:#ffffff; }
+td.filename.svg{ background:no-repeat; /*vertical-align:text-bottom;*/ height:150px; white-space:normal;
+ color:#888; text-shadow:#fff 0 1px 0; border:1px solid #EEE; background-color: #f8f8f8;}
-a.name img,a.dirs img { border: 1px solid #EEE; -webkit-box-shadow: 4px 4px 4px 0px grey; box-shadow: 4px 4px 4px 0px grey;}
-a.dirs{ position:relative; left:5px; margin-left:5px; }
+td#info{vertical-align: top;}
-center { width:150px; overflow:hidden; text-overflow:ellipsis;}
-span.nametext{ font-family:Arial;font-size:15px;font-weight:normal;width:150px; white-space:nowrap; margin-left:5px; margin-right:5px; text-transform:capitalize; }
+a.name img,a.dirs 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;}
+span.nametext{ position: relative;
+top: 4px; padding-left:5px;font-family:Arial;font-size:16px;font-weight:normal;white-space:nowrap;/* margin-left:5px; margin-right:5px;*/ text-transform:capitalize; }
+#contentbox{
+display:none;
+border:1px solid #DDD;
+width:150px;
+height:20px;
+margin-left:5px;
+margin-top:5px;
+-webkit-box-shadow: 2px 2px 2px 0px grey; box-shadow: 2px 2px 2px 0px grey;
+}
+#displaybox {
+margin-top:8px;
+margin-left:5px;
+font-size:14px;
+color:grey;
+width:200px;
+height:30px;
+}
+
+#displaybox a{
+color:grey;
+}
diff --git a/reader/fetch_tags.php b/reader/fetch_tags.php
new file mode 100644
index 000000000..c1cfd8656
--- /dev/null
+++ b/reader/fetch_tags.php
@@ -0,0 +1,18 @@
+<?php
+
+OCP\User::checkLoggedIn();
+OCP\App::checkAppEnabled('reader');
+OCP\App::setActiveNavigationEntry( 'reader_index' );
+
+OCP\Util::addscript( 'reader', 'integrate' );
+OCP\Util::addscript( 'reader', 'pdf' );
+OCP\Util::addStyle('reader','reader');
+OCP\Util::addStyle('files','files');
+
+$tag = $_GET['tag'];
+$tmpl = new OCP\Template( 'reader', 'tagged', 'user' );
+$tmpl->assign('tag', $tag);
+$tmpl->printPage();
+
+
+?>
diff --git a/reader/img/download.jpg b/reader/img/download.jpg
new file mode 100644
index 000000000..93bbc2e30
--- /dev/null
+++ b/reader/img/download.jpg
Binary files differ
diff --git a/reader/img/images.jpg b/reader/img/images.jpg
new file mode 100644
index 000000000..09a196d88
--- /dev/null
+++ b/reader/img/images.jpg
Binary files differ
diff --git a/reader/index.php b/reader/index.php
index b8358433c..865338732 100755
--- a/reader/index.php
+++ b/reader/index.php
@@ -14,6 +14,7 @@ OCP\App::setActiveNavigationEntry( 'reader_index' );
OCP\Util::addscript( 'reader', 'integrate' );
OCP\Util::addscript( 'reader', 'pdf' );
OCP\Util::addStyle('reader','reader');
+OCP\Util::addStyle('files','files');
// Get the current directory from window url.
$dir = empty($_GET['dir'])?'/':$_GET['dir'];
diff --git a/reader/js/integrate.js b/reader/js/integrate.js
index 79dec7ef6..cbcaacf6b 100755
--- a/reader/js/integrate.js
+++ b/reader/js/integrate.js
@@ -22,6 +22,22 @@ $(document).ready(function() {
left: '-=120'}, 50, function(){
});
});
+ $('.start').click(function(){
+ var pr = $(this).parent().children('div#contentbox');
+ var path = $(this).parent().parent().children('td.filename.svg').children('a.name').attr('dir');
+ pr.show(100);
+ pr.keypress(function(e) {
+ if(e.which == 13) {
+ var tag = pr.text();
+ pr.text('');
+ pr.hide();
+ var db = $(this).parent().children('div#displaybox');
+ db.append('<a href = "apps/reader/fetch_tags.php?tag='+tag+'">'+tag+'</a>');
+ db.append(' ');
+ $.post('apps/reader/ajax/tags.php', {tag:tag, path:path});
+ }
+ });
+ });
});
$(function() {
@@ -117,6 +133,11 @@ function create_thumbnails() {
pageRendering = page.render(renderContext);
pageRendering.onData(function(){
canvasSaver(canvas,title,location);
+ var imageElement = document.getElementById(location);
+ imageElement.src = canvas.toDataURL();
+ imageElement.style.height = '100px';
+ imageElement.style.width = '100px';
+
});
});
});
diff --git a/reader/lib/dir.php b/reader/lib/dir.php
index a153bc150..261ba7444 100644
--- a/reader/lib/dir.php
+++ b/reader/lib/dir.php
@@ -1,23 +1,19 @@
<?php
- function explore($current_dir,$sub_dirs) {
+ function explore($current_dir,$sub_dirs,$num_of_results) {
$return = array();
// Search for pdfs in sub directories.
foreach ($sub_dirs as $dir) {
$pdfs = \OC_FileCache::searchByMime('application', 'pdf', '/'.\OCP\USER::getUser().'/files'.$current_dir.$dir.'/');
sort($pdfs);
+ $max_count = min(count($pdfs),$num_of_results);
$thumbs = array();
- $count = 1;
- foreach ($pdfs as $pdf) {
- // We need only 3 pdf pages to create thumbnails for folders.
- if ($count <= 3) {
- // Store the urls in an array.
- $thumbs[] = $pdf;
- $count++;
- }
+ for ($i = $max_count - 1; $i >= 0; $i--) {
+ if (!in_array($pdfs[$i],$thumbs))
+ $thumbs[] = $pdfs[$i];
}
- // Return the directory and contained pdfs(any 3).
$return[] = array($dir,$thumbs);
}
return $return;
}
+
?>
diff --git a/reader/lib/library_display.php b/reader/lib/library_display.php
new file mode 100644
index 000000000..c71b2a131
--- /dev/null
+++ b/reader/lib/library_display.php
@@ -0,0 +1,104 @@
+<?php
+function display_each_ebook($directory,$name) {
+ echo '<td class="filename svg" width="14%">';
+ $check_thumb = check_thumb_exists(urldecode($directory.$name));
+ echo '<a class="name" href="http://localhost'.\OCP\Util::linkTo('files', 'download.php').'?file='.$directory.$name.'" title="'.urldecode($name).'" dir ="'.$directory.$name.'" value = "'.$check_thumb.'">
+ <img rel ="images" id = "'.$directory.$name.'" src = "'.\OCP\Util::linkTo('reader', 'ajax/thumbnail.php').'&filepath='.$directory.rtrim($name,'pdf').'png'.'">
+ </a>
+ </td>
+ <td id = "info" width="86%">
+ <span class = "nametext">'.
+ htmlspecialchars(urldecode($name)).
+ '</span>
+ <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>';
+}
+
+function display_sub_dirs($current_dir,$sub_dirs) {
+ $results = explore($current_dir,$sub_dirs,1);
+ foreach ($results as $r) {
+ echo '<tr id = "row" data-file="'.$r[0].'" data-type="dir">
+ <td class = "filename svg" width = "14%">
+ <a class = "dirs" id = "'.$r[0].'" href = "'.OCP\Util::linkTo('reader', 'index.php').'&dir='.$current_dir.$r[0].'/'.'">';
+ // Check if sub-directory($r[0]) exists or not-->
+ $is_dir = check_dir_exists($current_dir,$r[0]);
+ if($is_dir == false)
+ echo '<img src= "'.OCP\image_path('reader','download.jpg').'" style = "width:100px; height:100px;">';
+ else {
+ $margin = 15;
+ $img_id = 1;
+ foreach ($r[1] as $thumbs) {
+ $thumb_exists = false;
+ $thumb_exists = check_thumb_exists($current_dir.$r[0].'/'.$thumbs);
+ if ($thumb_exists != 'true') {
+ $img_path = "/owncloud/apps/reader/img/images.jpg";
+ echo '<div style =';
+ echo 'background-image:url("';
+ echo OCP\image_path('reader','images.jpg');
+ echo '");width:100px;height:100px;';
+ echo "></div>";
+ }
+ else if($thumb_exists == 'true') {
+ $img_path = \OCP\Util::linkTo('reader', 'ajax/thumbnail.php').'&filepath='.urlencode($current_dir.$r[0].'/'.rtrim($thumbs,'pdf').'png');
+ $counter = 3;
+ }
+ if ($thumb_exists != 'false') {
+ for ($i = 1; $i <= $counter; $i++) {
+ echo '<img id = "img'.$img_id.'" src = "'.$img_path.'" style = "position:absolute; top:20px; left:10px; margin-left:'.$margin.'px; z-index:'.(50-$margin).';">';
+ $margin = $margin + 5;
+ $img_id = $img_id + 1;
+ }
+ }
+ }
+ }
+ echo '</a>
+ </td>
+ <td id = "info" width = "86%">
+ <span class = "nametext">';
+ echo htmlspecialchars($r[0]);
+ echo '</span>
+ <div id = "more_info" style = "color:#666;margin-left:5px;margin-top:15px;">';
+ echo "Browse in for";
+ echo '<br>';
+ $dir_browse_results = explore($current_dir,array($r[0]),5);
+ foreach($dir_browse_results as $browse_result) {
+ foreach($browse_result[1] as $each) {
+ $each_sub_dir = explode("/",$each);
+ if (count($each_sub_dir) > 1) {
+ foreach($each_sub_dir as $element) { echo '<span style = "color:#DDD;">>></span>'.$element; }
+ }
+ else
+ echo '<span style = "color:#DDD;"> >></span>'.$each;echo '<br>';
+ }
+ }
+ echo '</div> </td> </tr>';
+ }
+}
+
+function display_ebooks($filename,$current_dir) {
+ $name = str_replace('+','%20',urlencode($filename));
+ $name = str_replace('%2F','/', $name);
+ $directory = str_replace('+','%20',urlencode($current_dir));
+ $directory = str_replace('%2F','/', $directory);
+
+ echo '<tr id = "row" data-file="'.$name.'" data-type="file" data-mime="application/pdf" data-size="3462755" data-write="true">';
+ display_each_ebook($directory,$name);
+ echo '</tr>';
+ echo '<br>';
+}
diff --git a/reader/lib/tag_utils.php b/reader/lib/tag_utils.php
new file mode 100644
index 000000000..882c8c55e
--- /dev/null
+++ b/reader/lib/tag_utils.php
@@ -0,0 +1,29 @@
+<?php
+function find_tags_for_ebook($path_of_ebook) {
+ $sql = 'SELECT tags FROM *PREFIX*eBook_library WHERE filepath = ?';
+ $stmt = OCP\DB::prepare($sql);
+ $res = $stmt->execute(array($path_of_ebook));
+ $tags = NULL;
+ while($r = $res->fetchRow()) {
+ $tags = $r['tags'];
+ }
+ return $tags;
+}
+
+function update_tag_for_ebook($new_tag,$path_of_ebook) {
+ $stmt = OCP\DB::prepare("UPDATE *PREFIX*eBook_library SET tags = ? WHERE filepath = ?");
+ $stmt->execute(array($new_tag,$path_of_ebook));
+}
+
+function insert_new_tag($new_tag,$path_of_ebook) {
+ $stmt = OCP\DB::prepare('INSERT INTO *PREFIX*eBook_library (filepath,tags) VALUES (?, ?)');
+ $stmt->execute(array($path_of_ebook,$new_tag));
+}
+
+function find_results_with_tag_like($tag) {
+ $sql = 'SELECT * FROM *PREFIX*eBook_library WHERE tags LIKE ?';
+ $stmt = OCP\DB::prepare($sql);
+ $res = $stmt->execute(array($tag));
+ return $res;
+}
+?>
diff --git a/reader/lib/thumbnail.php b/reader/lib/thumbnail.php
index 3b3cd946d..32cad8505 100644
--- a/reader/lib/thumbnail.php
+++ b/reader/lib/thumbnail.php
@@ -1,8 +1,8 @@
<?php
- function check_thumb_exists($location,$filename) {
- $image_path = rtrim($location,'.pdf').'.png';
- if(!file_exists('/opt/lampp/htdocs/owncloud/data/priyanka/reader/'.$image_path)) {
+ function check_thumb_exists($location) {
+ $image_path = rtrim($location,'pdf').'png';
+ if(!file_exists('/opt/lampp/htdocs/owncloud/data/priyanka/reader'.$image_path)) {
$check = "false";
}
else
diff --git a/reader/results.php b/reader/results.php
index 7b9936984..ec6418aeb 100644
--- a/reader/results.php
+++ b/reader/results.php
@@ -3,6 +3,7 @@
OCP\Util::addscript( 'reader', 'integrate' );
OCP\Util::addscript( 'reader', 'pdf' );
OCP\Util::addStyle('reader','reader');
+OCP\Util::addStyle('files','files');
$file = $_GET['file'];
$path = dirname($file);
diff --git a/reader/templates/index.php b/reader/templates/index.php
index e17a0e1bb..96480ab46 100755
--- a/reader/templates/index.php
+++ b/reader/templates/index.php
@@ -6,15 +6,18 @@
</script>
<div id = "controls">
- <?php
+<?
include('apps/reader/lib/dir.php');
include('apps/reader/lib/thumbnail.php');
+ include('apps/reader/lib/library_display.php');
+ include('apps/reader/lib/tag_utils.php');
+
// Get the current directory.
$current_dir = empty($_['dir'])?'/':$_['dir'];
$base_url = OCP\Util::linkTo('reader', 'index.php').'&dir=';
-
$curr_path = '';
$path = explode( '/', trim($current_dir,'/'));
+
// Navaigation Tab.
if( $path != '' ){
for($i=0; $i<count($path); $i++){
@@ -22,15 +25,18 @@
<div class="crumb <?php if($i == count($path)-1) echo 'last';?> svg" data-dir='<?php echo $curr_path;?>' style='background-image:url("<?php echo OCP\image_path('core','breadcrumb.png');?>")'>
<a href="<?php echo $base_url.$curr_path.'/'; ?>"><?php echo htmlentities($path[$i],ENT_COMPAT,'utf-8'); ?></a>
</div>
- <?php }
+<? }
}
- ?>
+?>
<div id="file_action_panel"></div>
<!-- Set dir value to be passed to integrate.js -->
<input type="hidden" name="dir" value="<?php echo empty($_['dir'])?'':rtrim($_['dir'],'/') ?>" id="dir">
+
</div>
+
<div class="actions"></div>
+
<?php
// Search for pdf files in current directory.
@@ -39,6 +45,7 @@
// Construct an array, to store pdf files and directory names, in which pdf files reside.
$files = array();
+
// Store file info in the file array.
foreach ($pdfs as $pdf) {
$file_info = pathinfo($pdf);
@@ -53,85 +60,35 @@
<table id = "readerContent">
<tbody id = "fileList">
- <?php
-
+<?php
// Array to store directory entries, which contain pdfs.
$sub_dirs = array();
+ $ebooks = array();
+
foreach ($files as $file) {
- // Encode the file and directory names so that they can be used in querying a url.
- $name = str_replace('+','%20',urlencode($file['filename']));
- $name = str_replace('%2F','/', $name);
- $directory = str_replace('+','%20',urlencode($current_dir));
- $directory = str_replace('%2F','/', $directory);
if ($file['dirname'] == '.') {
- ?>
- <!-- Each tr displays a file -->
- <tr id = "row" data-file="<?php echo $name;?>" data-type="<?php echo 'file'?>" data-mime="<?php echo 'application/pdf'?>" data-size="3462755" data-write="true">
- <td class="filename svg">
- <?php $check_thumb = check_thumb_exists($directory,$name);?>
- <a class="name" href="http://localhost<?php echo \OCP\Util::linkTo('files', 'download.php').'?file='.$directory.$name; ?>" title="<?php echo urldecode($name);?>" dir ="<?php echo $directory.$name?>" value = "<?php echo $check_thumb;?>">
- <center>
- <span class = "nametext">
- <?php echo htmlspecialchars($file['basename']);?>
- </span>
- </center>
- <img rel ="images" src = "<?php echo \OCP\Util::linkTo('reader', 'ajax/thumbnail.php').'&filepath='.urlencode($current_dir.rtrim($file['filename'],'pdf').'png');?>">
- </a>
- </td>
- </tr>
- <?php
- echo '<br>';
+ $ebooks[] = $file['filename'];
}
else {
// Trim the extra slash that we don't need.
- $dir_name = ltrim($file['dirname'], '/');
+ $dir_name = ltrim($current_dir, '/');
+
// Explode the variable to check if the pdf file is contained in a directory.
- $dir_array = explode('/', $dir_name);
+ $dir_array = explode('/', $file['dirname']);
+
// Get the directory name in which the pdf resides.
$sub_dir = $dir_array[0];
if (!in_array($sub_dir, $sub_dirs)) {
$sub_dirs[] = $sub_dir;
- }
+ }
}
- }
- /* Send the the directory names, inside the current directory, and current
- * directory name to fetch any 3 pdf urls inside those directories.*/
- $results = explore($current_dir,$sub_dirs);
+ }
+ display_sub_dirs($current_dir,$sub_dirs);
- foreach ($results as $r) {
- ?>
- <!-- Display folder name-->
- <tr id = "row" data-file="<?php echo $r[0];?>" data-type="dir">
- <td class = "filename svg">
- <a class = "dirs" id = "<?php echo $r[0];?>" href = "<?php echo OCP\Util::linkTo('reader', 'index.php').'&dir='.$current_dir.$r[0].'/';?>">
- <center>
- <span class = "nametext">
- <?php echo htmlspecialchars($r[0]);?>
- </span>
-
- <?php
- // Check if sub-directory($r[0]) exists or not-->
- $is_dir = check_dir_exists($current_dir,$r[0]);
- if($is_dir == false)
- echo '<img src= "">';
- else {
- $margin = 5;
- $img = 1;
- // Display thumbnails of 3 pdf pages to show a folder.
- foreach ($r[1] as $thumbs) {
- $path1 = \OCP\Util::linkTo('reader', 'ajax/thumbnail.php').'&filepath='.urlencode($current_dir.$r[0].'/'.rtrim($thumbs,'pdf').'png');
- echo '<img id = "img'.$img.'" src = "'.$path1.'" style = "position:absolute; top:20px; left:10px; margin-left:'.$margin.'px; z-index:'.(50-$margin).';">';
- $margin = $margin + 5;
- $img = $img + 1;
- }
- }
- ?>
- </center>
- </a>
- </td>
- </tr><?php
+ foreach ($ebooks as $ebook) {
+ display_ebooks($ebook,$current_dir);
}
- ?>
+?>
</tbody>
</table>
diff --git a/reader/templates/results.php b/reader/templates/results.php
index 90367343d..9b0df040e 100644
--- a/reader/templates/results.php
+++ b/reader/templates/results.php
@@ -30,30 +30,15 @@
<table id = "readerContent">
<tbody id = "fileList">
<?php
+
include('apps/reader/lib/thumbnail.php');
+ include('apps/reader/lib/library_display.php');
+ include('apps/reader/lib/tag_utils.php');
$file = $_['file'];
$path = $_['path'];
$filename = $_['filename'];
- // Encode the file and directory names so that they can be used in querying a url.
- $name = str_replace('+','%20',urlencode($filename));
- $name = str_replace('%2F','/', $name);
- $directory = str_replace('+','%20',urlencode($path));
- $directory = str_replace('%2F','/', $path);
- ?>
- <!-- Each tr displays a file -->
- <tr id = "row" data-file="<?php echo $name;?>" data-type="<?php echo 'file'?>" data-mime="<?php echo 'application/pdf'?>" data-size="3462755" data-write="true">
- <td class="filename svg">
- <?php $check_thumb = check_thumb_exists($directory,$name);?>
- <a class="name" href="http://localhost<?php echo \OCP\Util::linkTo('files', 'download.php').'?file='.$directory.$name; ?>" title="<?php echo urldecode($name);?>" dir ="<?php echo $directory.$name?>" value = "<?php echo $check_thumb;?>">
- <center>
- <span class = "nametext">
- <?php echo htmlspecialchars($filename);?>
- </span>
- </center>
- <img rel ="images" src = "<?php echo \OCP\Util::linkTo('reader', 'ajax/thumbnail.php').'&filepath='.urlencode($path.rtrim($filename,'pdf').'png');?>">
- </a>
- </td>
- </tr>
+ display_ebooks($filename,$path.'/');
+ ?>
</tbody>
</table>
diff --git a/reader/templates/tagged.php b/reader/templates/tagged.php
new file mode 100644
index 000000000..774861d0b
--- /dev/null
+++ b/reader/templates/tagged.php
@@ -0,0 +1,43 @@
+<div id = "controls">
+ <?php
+ $current_dir = empty($_['path'])?'/':$_['path'];
+ $base_url = OCP\Util::linkTo('reader', 'index.php').'?dir=';
+
+ $curr_path = '';
+ $path = explode( '/', trim($current_dir,'/'));
+ // Navaigation Tab.
+ if( $path != '' ){
+ for($i=0; $i<count($path); $i++){
+ $curr_path .= '/'.str_replace('+','%20', urlencode($path[$i]));?>
+ <div class="crumb <?php if($i == count($path)-1) echo 'last';?> svg" data-dir='<?php echo $curr_path;?>' style='background-image:url("<?php echo OCP\image_path('core','breadcrumb.png');?>")'>
+ <a href="<?php echo $base_url.$curr_path.'/'; ?>"><?php echo htmlentities($path[$i],ENT_COMPAT,'utf-8'); ?></a>
+ </div>
+ <?php }
+ }
+ ?>
+ <div id="file_action_panel"></div>
+ <input type="hidden" name="dir" value="<?php echo empty($_['path'])?'':rtrim($_['path'],'/') ?>" id="dir">
+</div>
+
+<div class="actions"></div>
+
+<?php
+ include('apps/reader/lib/dir.php');
+ include('apps/reader/lib/thumbnail.php');
+ include('apps/reader/lib/library_display.php');
+ include('apps/reader/lib/tag_utils.php');
+ $tag = "%".$_['tag']."%";
+ $res = find_results_with_tag_like($tag);
+?>
+<table id = "readerContent">
+ <tbody id = "fileList">
+ <?php
+ while($r = $res->fetchRow()) {
+ $dirname = dirname($r['filepath']);
+ if ($dirname != '/') {
+ $dirname = $dirname.'/'; }
+ display_ebooks(basename($r['filepath']),$dirname);
+ }
+ ?>
+</tbody>
+</table>