$multi_maxpage = 0;
$sql =
-"SELECT id,title,part,startpage,endpage FROM pdffile WHERE title = '$title_group' ORDER BY part DESC LIMIT 1";
+"SELECT id,title,part,startpage,endpage FROM pdffile WHERE title_id = '$title_group' ORDER BY part DESC LIMIT 1";
$dbs = $dbi->prepare($sql);
$dbs->execute();
$dbh = $dbs->fetchrow_hashref;
$multi_maxpage = $dbh->{'endpage'};
$sql2 =
-"SELECT id,startpage FROM pdffile WHERE title = '$title_group' AND startpage < $pagenum AND endpage > $pagenum";
+"SELECT id,startpage FROM pdffile WHERE title_id = '$title_group' AND startpage < $pagenum AND endpage > $pagenum";
$dbs2 = $dbi->prepare($sql2);
$dbs2->execute();
$dbh2 = $dbs2->fetchrow_hashref;
import sqlite3
confstr="/etc/libre10.conf"
-sqlpath="/tmp/libre10.db"
conf_dic=yaml.load(open(confstr).read())
+sqlpath=conf_dic['dburl']
dbcon=sqlite3.connect(sqlpath,isolation_level=None)
try:
sql = u"""
path varchar(100),
page integer,
title varchar(40),
+ title_id varchar(40),
part integer,
genre varchar(100),
startpage integer,
parttext=int(parttext)
else:
parttext=0
- title_group=os.path.basename(pdfpath).split(".")[0]
+ title_group=os.path.basename(pdfpath).split(".pdf")[0]
print title_group
print "Part"
print parttext
-
+ rd = hashlib.md5()
+ rd.update(title_group.encode('utf-8'))
+ rdl=rd.hexdigest()
for i in xrange(1,pagenum+1):
cmd=u"pdftotext -eol unix -enc UTF-8 -f "+str(i)+u" -l "+str(i)+" \""+pdfpath+u"\" page-"+str(i)+dstpath
p=subprocess.Popen(cmd.encode("utf-8"),shell=True)
time.sleep(1)
TEXT2solr(s,os.path.splitext(os.path.basename(pdfpath))[0],"page-"+str(i)+dstpath,i,pagenum,pdfpath,idnum)
os.system("rm -f page-"+str(i)+dstpath)
- sql = u"insert into pdffile (id,path,page,title,part)values (?,?,?,?,?)"
- dbcon.execute(sql,(idnum,pdfpath,pagenum,title_group,parttext))
+ sql = u"insert into pdffile (id,path,page,title,title_id,part)values (?,?,?,?,?,?)"
+ dbcon.execute(sql,(idnum,pdfpath,pagenum,title_group,rdl,parttext))
s.commit()
def TEXT2solr(solrcon,titletxt,textpath,pagenum,pagemax,pdfpath,idnum):
f=codecs.open(textpath,"r","utf-8","ignore")
$confdata = YAML::XS::LoadFile($confpath);
my $sqlpath = "/tmp/libre10.db";
+$sqlpath = $confdata->{dburl};
$sqldbi =
DBI->connect( "dbi:SQLite:dbname=$sqlpath", "", "",
{ RaiseError => 1, AutoCommit => 1 } );
foreach $doc (@$hits) {
( $pagenum, $path, $linkpath ) =
( $doc->{page}, $doc->{path_id}, $doc->{path_id} );
- my $findPageSQL = "SELECT startpage from pdffile WHERE id = '$path';";
+ my $findPageSQL = "SELECT startpage,title_id from pdffile WHERE id = '$path';";
my $sth = $sqldbi->prepare($findPageSQL);
$sth->execute;
- $showpagenum = $pagenum + $sth->fetchrow_array;
+ $dbarray=$sth->fetchrow_arrayref;
+ $showpagenum = $pagenum + $dbarray->[0];
+ #print Dumper $dbarray;
print "page " . $showpagenum . "<br>";
print " " . $hits_hl->{ $doc->{id} }{text}[0] . "<br>";
print "<a href=\"htmlserver.pl?title="
- . uri_escape( encode( 'utf-8', $title ) );
+ . uri_escape( $dbarray->[1] );
print "&pagenum=$showpagenum&mode=$mode&width=$width&height=$height\">";
print "該当ページを見る";
print "</a>";
<script src='http://code.jquery.com/jquery-1.9.1.min.js'></script>
<script src='http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js'></script>
<script>
+ $(document).on("mobileinit",function(){
+ $(document).bind("mobileinit",function(event){
+ $.extend($.mobile.zoom,{locked:false,enabled:true});
+ });
+ });
$(document).on('pageinit',function(){
$.mobile.loadPage('<TMPL_VAR NAME="nlink">',{showLoadMsg:false});
$.mobile.loadPage('<TMPL_VAR NAME="blink">',{showLoadMsg:false});
$.mobile.metaViewportContent = 'width-device-width,user-scalable=yes';
}
});
+ $(document).bind("mobileinit",function(){
+ $.mobile.metaViewportContent = 'width=device-width,initial-scale=1';
+ });
$('#jumpPage').bind("click",function(e,ui){
//console.log("<TMPL_VAR NAME="jumplink">");
//console.log($('#jumpPagenum').val());
- $.mobile.changePage("<TMPL_VAR NAME="jumplink">"+$('#jumpPagenum').val(),{transition:'slide'});
+ $.mobile.changePage("<TMPL_VAR NAME="jumplink">"+$('#jumpPagenum').val(),{transition:'slidedown'});
});
+ //$("#images").css('width',$("#image"),innerWidth()+"px");
+
});
</script>
</head>