示例#1
0
def collectionWithPreview(htmlGen, fullPath, page):
    collectionPreviewPathDb = shove.Shove('sqlite:///'+os.path.join(gDbPath,'collectionPreviewPathDb.sqlite'))
    collectionPreviewUuidDb = shove.Shove('sqlite:///'+os.path.join(gDbPath,'collectionPreviewUuidDb.sqlite'))
    #htmlGen.write('<div style="white-space:nowrap">')
    h=htmlGen
    try:
        u = collectionPreviewPathDb[fullPath]
    except KeyError:
        u = str(uuid.uuid4())
        collectionPreviewPathDb[fullPath] = u
        collectionPreviewUuidDb[u] = fullPath
    #h.write(fullPath)
    iter = fileIter(fullPath)
    i = collectionIteratorV2.cachedCollectionIter(u, iter, 0)
    #h.write(fullPath)
    h.write('<div style="float:left;max-width:30%">')
    h.write('<div style="float:left;min-width:25%">')
    co = []
    #h.write(fullPath)
    for k in i:
        p = transformDirToInternal(os.path.join(fullPath, k))
        #h.write(k+'<br/>')
        co.append([p, p])
    #h.write(str(co))
    #h.write(fullPath)

    collection.showCollection(htmlGen, co, fullPath, None)
    h.write('</div>')
    if True:
        h.inc('/webapproot/js/custom/editable.js')
        h.inc('/webapproot/js/pageScript/collectionWithPreviewV8.js')
    htmlGen.write('</div>')
    htmlGen.write('<div style="white-space:nowrap">')
    htmlGen.write('''
        <img id="previewImage" style="max-width:500px;"/>
    ''')
    htmlGen.write('</div>')
示例#2
0
def collectionWithPreview(htmlGen, fullPath, page):
    #htmlGen.write('<div style="white-space:nowrap">')
    h=htmlGen
    try:
        u = collectionPreviewPathDb[fullPath]
    except KeyError:
        u = str(uuid.uuid4())
        collectionPreviewPathDb[fullPath] = u
        collectionPreviewUuidDb[u] = fullPath
    iter = fileIter(fullPath)
    i = collectionIteratorV2.cachedCollectionIter(u, iter, 0)
    h.write('<div style="float:left;min-width:25%">')
    co = []
    for k in i:
        p = os.path.join(fullPath, k)
        co.append([p, p])
    #h.write(str(co))

    collectionV6.showCollection(htmlGen, co, fullPath, None)
    h.write('</div>')
    if True:
        h.write('''
            <script type="text/javascript">
                $(function() {
                    $("img").livequery(
                        function(){
                            $(this).lazyload({ 
                                failurelimit : 100,
                                effect : "fadeIn",
                                container:$("#collectionList")
                            });
                        }
                    );

                    $(".thumbImage").livequery(
                        function(){
                            var p = unescape($(this).attr("path")).replace("\\\\","/");
                            var s = p.lastIndexOf("/");
                            var b = p.substr(s+1);
                            var na = $("<div><p>"+b+"</p></div>");
                            na.css({"color":"white","background":"black",
                                "opacity":0.3,"margin-top":"-40px","height":"40px","font-size":"16",
                                "padding-left":"10px","padding-top":"10px"});
                            
                            $(this).after(na);
                            
                            $(this).mouseover(function(){
                                    //alert('in thumbImageLiveQuery');
                                    $("#previewImage").attr("src", "picList.py?path="+$(this).attr("path"));
                                }
                            );
                            $(this).dblclick(function(){
                                    $.get("execute.py?path=" + $(this).attr("path"),function(data){});
                                }
                            );
                        }
                    );
                    $("#previewImage").attr("width",$(window).width());
                });
            </script>
        ''')
    htmlGen.write('<div style="white-space:nowrap">')
    htmlGen.write('''
        <img id="previewImage" style="max-width:500px;"/>
    ''')
    htmlGen.write('</div>')
示例#3
0
        u = collectionPreviewPathDb[fullPath]
        #h.write('existing one')
    except KeyError:
        u = str(uuid.uuid4())
        #h.write('create new')
        collectionPreviewPathDb[fullPath] = u
        collectionPreviewUuidDb[u] = fullPath
    iter = fileIter(fullPath)
    l = tmpLog()
    #h.write(fullPath)
    page = fields.get("page",[None])[0]
    #h.write(str(page))
    thumbPerLine = int(fields.get("thumbPerLine", [5])[0])
    #h.write('calling album')
    if page is None:
        realPage = 0
    else:
        page = int(page)
        realPage = page
    i = collectionIteratorV2.cachedCollectionIter(u, iter, realPage, l)
    co = []
    for k in i:
        p = os.path.join(fullPath, k)
        co.append([p, p])

    #h.write('after calling')
    h.genHead('Collections')
    showCollection(h, co, fullPath, page)
    #h.write(l.s)
    h.genEnd()