Skip to content
This repository has been archived by the owner on Jan 12, 2018. It is now read-only.

Commit

Permalink
firt commit
Browse files Browse the repository at this point in the history
  • Loading branch information
asinsalasilva committed Oct 6, 2014
1 parent b442f98 commit 543ef61
Show file tree
Hide file tree
Showing 9 changed files with 7,656 additions and 0 deletions.
6,271 changes: 6,271 additions & 0 deletions css/bootstrap.css

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions css/bootstrap.min.css

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
.content{padding:10px 0}
.doc_thumb, .doc_data{float:left}
.doc_thumb{width:33%}
.doc_data{width:67%}
.row{margin:0}
.doc_thumb img{padding:2px;line-height:1.42857143;background-color:#fcfcfc;border:1px solid #dddddd;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out;display:inline-block;width:100% \9;max-width:100%;height:auto;margin:5px 3px}
.data_wrapper{padding:5px}

@media (min-width: 1024px){
.doc_thumb{width:10%}
.doc_data{width:90%}
}
@media (min-width: 768px) and (max-width: 1023px){
.doc_thumb{width:15%}
.doc_data{width:85%}
}
@media (min-width: 600px) and (max-width: 767px){
.doc_thumb{width:23%}
.doc_data{width:77%}
}
@media (min-width: 400px) and (max-width: 599px){
.doc_thumb{width:25%}
.doc_data{width:75%}
}
@media (min-width: 360px) and (max-width: 399px){
.doc_thumb{width:34%}
.doc_data{width:66%}
}
@media (min-width: 320px) and (max-width: 359px){
.doc_thumb{width:35%}
.doc_data{width:65%}
}
@media (max-width: 900px) { .pagination > li.away-4 { display:none; } }
@media (max-width: 825px) { .pagination > li.away-3 { display:none; } }
@media (max-width: 750px) { .pagination > li.away-2 { display:none; } }
#loading{height:16px;width:16px;background:url(../images/ajax-loader.gif) center no-repeat;margin:0 auto}
208 changes: 208 additions & 0 deletions document_list.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
<?php
session_start();
require_once("phpEdocr.php");
define(CONSUMER_KEY, "ba8532ea606d5c93a8a8b180954e9ea1");
define(CONSUMER_SECRET, "d8e085de1ac97a0e07a01a42457fc5bf");

$obj_phpEdocr = new phpEdocr(CONSUMER_KEY, CONSUMER_SECRET);

$doc_count_api_response = $obj_phpEdocr->call_api_method(
'edocr.getUserDocCount',
array(
"mail_address" => $_REQUEST['mail_address'],
),
false,
($_REQUEST['http_method'] == "POST")? "POST" : "GET"
);
$doc_count_array = json_decode($doc_count_api_response);
$all_docs = $doc_count_array->documents;

$api_method = 'edocr.getUserLimitedDocList';
$page = $_REQUEST['page'];
$mail_address = $_REQUEST['mail_address'];
$send_page = $page;
if(!$send_page){
$send_page = 1;
}
if($send_page <= 0){
$send_page = 1;
}
$api_response = $obj_phpEdocr->call_api_method(
$api_method,
array(
"mail_address" => $_REQUEST['mail_address'],
"page" => $send_page,
),
false,
($_REQUEST['http_method'] == "POST")? "POST" : "GET"
);
$array = json_decode($api_response);
$num_docs = $array->total;
$total_pages = $all_docs;
$adjacents = 3;
$targetpage = "index.php";
$limit = 10;
if($page)
$start = ($page - 1) * $limit;
else
$start = 0;

if ($page == 0) $page = 1;
$prev = $page - 1;
$next = $page + 1;
$lastpage = ceil($total_pages/$limit);
$lpm1 = $lastpage - 1;

$pagination = "";
$page_class="";
if($lastpage > 1)
{
$pagination .= "<ul class=\"pagination\">";
if ($page > 1)
$pagination.= "<li><a href=\"#\" title=\"$prev\">&laquo;</a></li>";
else
$pagination.= "<li class=\"disabled\"><a>&laquo;</a></li>";

if ($lastpage < 7 + ($adjacents * 2))
{
for ($counter = 1; $counter <= $lastpage; $counter++)
{
if($counter > 2){
$page_class = "away-2";
}
if($counter > 3){
$page_class = "away-3";
}
if($counter > 4){
$page_class = "away-4";
}
if ($counter == $page)
$pagination.= "<li class=\"active\"><a>$counter</a></li>";
else
$pagination.= "<li class=\"$page_class\"><a href=\"#\" title=\"$counter\">$counter</a></li>";
}
}
elseif($lastpage > 5 + ($adjacents * 2))
{
if($page < 1 + ($adjacents * 2))
{
for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)
{
if($counter > 2){
$page_class = "away-2";
}
if($counter > 3){
$page_class = "away-3";
}
if($counter > 4){
$page_class = "away-4";
}
if ($counter == $page)
$pagination.= "<li class=\"active\"><a>$counter</a></li>";
else
$pagination.= "<li class=\"$page_class\"><a href=\"#\" title=\"$counter\">$counter</a></li>";
}
$pagination.= "<li><a>...</a></li>";
$pagination.= "<li class=\"$page_class\"><a href=\"#\" title=\"$lpm1\">$lpm1</a></li>";
$pagination.= "<li><a href=\"#\" title=\"$lastpage\">$lastpage</a></li>";
}
elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))
{
$pagination.= "<li><a href=\"#\" title=\"1\">1</a></li>";
$pagination.= "<li><a href=\"#\" title=\"2\">2</a></li>";
$pagination.= "<li><a>...</a></li>";
for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)
{
if($counter > 2){
$page_class = "away-2";
}
if($counter > 3){
$page_class = "away-3";
}
if($counter > 4){
$page_class = "away-4";
}
if ($counter == $page)
$pagination.= "<li class=\"active\"><a>$counter</a></li>";
else
$pagination.= "<li class=\"$page_class\"><a href=\"#\" title=\"$counter\">$counter</a></li>";
}
$pagination.= "<li><a>...</a></li>";
$pagination.= "<li class=\"$page_class\"><a href=\"#\" title=\"$lpm1\">$lpm1</a></li>";
$pagination.= "<li><a href=\"#\" title=\"$lastpage\">$lastpage</a></li>";
}
else
{
$pagination.= "<li><a href=\"#\" title=\"1\">1</a></li>";
$pagination.= "<li><a href=\"#\" title=\"2\">2</a></li>";
$pagination.= "<li><a>...</a></li>";
for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)
{
if($counter > 2){
$page_class = "away-2";
}
if($counter > 3){
$page_class = "away-3";
}
if($counter > 4){
$page_class = "away-4";
}
if ($counter == $page)
$pagination.= "<li class=\"active\"><a>$counter</a></li>";
else
$pagination.= "<li class=\"$page_class\"><a href=\"#\" title=\"$counter\">$counter</a></li>";
}
}
}

if ($page < $counter - 1)
$pagination.= "<li><a href=\"#\" title=\"$next\">&raquo;</a></li>";
else
$pagination.= "<li class=\"disabled\"><a>&raquo;</a></li>";
$pagination.= "</ul>\n";
}
if($num_docs){
for($i = 0; $i < $num_docs; $i++){
$doc_description = $array->document[$i]->description;
if(strlen($doc_description) > 150) {
$doc_description = substr($doc_description, 0, 150).' ...';
}
?>
<div class="row">
<div class="col-md-12">
<?php
print '<div class="doc_thumb"><img src="'.$array->document[$i]->thumanail.'" /></div>';
print '<div class="doc_data">
<div class="data_wrapper">
<div class="doc_title"><a href="'.$array->document[$i]->url.'">'.$array->document[$i]->title.'</a></div>
<div class="doc_desciption">'.strip_tags($doc_description).'</div>
</div>';
print '</div>';
?>
</div>
</div>
<?php
}
print '<div class="row"><div class="col-md-12">'.$pagination.'</div></div>';
}
else if($mail_address && !$num_docs){
print '<div class="row"><div class="col-md-12">No documents found.</div></div>';
}
?>
<script type="text/javascript">
$('ul.pagination li a').click(function(e){
e.preventDefault();
var page = $( this ).attr('title');
if(page){
$('#document_list').html('<div id="loading"> </div>');
$.ajax({
type: "POST",
url: "document_list.php",
data: {mail_address: '<?php print $mail_address;?>', page: page},
success: function(data){
$('#document_list').html(data);
}
});
}
});
</script>
Binary file added images/ajax-loader.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 53 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>edocr Document Listing</title>
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
<meta content="yes" name="apple-mobile-web-app-capable">
<meta content="black" name="apple-mobile-web-app-status-bar-style">
<!-- Basic Styles -->
<link href="css/bootstrap.css" media="screen" rel="stylesheet" type="text/css">
<link href="css/style.css" rel="stylesheet" type="text/css">
<script src="//staging2.livestax.com/assets/livestax-0.1.0.js"></script>
</head>
<body>
<div class="content twitter">
<div class="row">
<div class="col-md-12">
<form class="form-horizontal">
<div class="form-group">
<label for="inputEmail" class="col-md-4 control-label">Enter Email Address of your account</label>
<div class="col-md-4">
<input type="text" class="form-control" name="mail_address" id="mail_address" placeholder="Email">
</div>
</div>
<div class="form-group">
<div class="col-md-8 col-md-offset-4">
<button type="submit" class="btn btn-primary" id="sumit_button">Submit</button>
</div>
</div>
</form>
</div>
</div>
<div id="document_list"></div>
</div>
<script src="js/jquery.min.js"></script>
<script type="text/javascript">
$('#sumit_button').click(function(e){
e.preventDefault();
$('#document_list').html('<div id="loading"> </div>');
var mail_address = $('#mail_address').val();
$.ajax({
type: "POST",
url: "document_list.php",
data: {mail_address: mail_address},
success: function(data){
$('#document_list').html(data);
}
});
});
</script>
</body>
</html>
5 changes: 5 additions & 0 deletions js/jquery.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 543ef61

Please sign in to comment.