def get_paths(objID, version): oRoot = os.path.join(RepositoryRoot, 'WWW', 'ObjectStore') try: success,meta = ryw.get_meta(oRoot, objID, version) if not success: ryw.give_bad_news( 'CreateNewThumbDir.get_paths: ryw.get_meta failed: ' + repr(meta), logging.error) return (False,None,None) success,dataURL,auxiURL,auxiDir = ryw_view.get_server_URLs(meta) if not success: ryw.give_bad_news( 'CreateNewThumbDir.get_paths: get_server_URLs failed: ' + repr(meta), logging.error) return (False,None,None) return (True,auxiURL,auxiDir) except: ryw.give_bad_news( 'CreateNewThumbDir.get_paths: failed to get server URLs: ' + objID + '#' + str(version), logging.error) return (False,None,None)
def make_dir_strs(meta): try: pdrive = False sAddr = os.environ['SERVER_ADDR'] rAddr = os.environ['REMOTE_ADDR'] if sAddr != rAddr: if not ryw.same_subnet(sAddr, rAddr): # # remote user: no mucking with directories. # return '(editing currently disabled for remote user.)' pdrive = True # # it was a mistake # just disable it. # pdrive = False # # make the thumbnail strings. # success,dataURL,auxiURL,auxiDir = ryw_view.get_server_URLs(meta) thumbURLs = ryw_view.get_thumb_URLs(meta, auxiURL, auxiDir) smallThumb1URL = thumbURLs[0] bigThumb1URL = thumbURLs[3] thumb1Str = make_thumb_string(bigThumb1URL, smallThumb1URL, 'thumbnail 1', pdrive=pdrive) smallThumb2URL = thumbURLs[1] bigThumb2URL = thumbURLs[2] thumb2Str = make_thumb_string(bigThumb2URL, smallThumb2URL, 'thumbnail 2', pdrive=pdrive) if thumb1Str == '' and thumb2Str == '': # # no thumbnail strings were found. # put in the strings that would allow addition of new thumbnails. # thumb1Str = make_new_thumb_string( meta, auxiDir, 'Do you want to add thumbnails?', 'add new thumbnails', '/cgi-bin/CreateNewThumbDir.py?objstr=%(objstr)s') # # make data folder string. # dataStr = make_dir_string(dataURL, '/icons/folder.open.gif', 'data') # # make excerpt string. # excerptStr = make_excerpt_string(auxiURL, auxiDir) if excerptStr == '': # # no excerpt string was found. # put in the string that would allow addition of new excerpts. # excerptStr = make_new_thumb_string( meta, auxiDir, 'Do you want to add excerpt files?', 'add new excerpt files', '/cgi-bin/CreateNewExcerptDir.py?objstr=%(objstr)s') # # make the cut-and-paste string for the P drive. # pDriveStr = ryw_view.make_explorer_lan_popup_string(dataURL) result = '' for str in [thumb1Str, thumb2Str, dataStr, excerptStr, pDriveStr]: if not str: continue result = result + ' ' + str return result except: ryw.give_bad_news('make_dir_strs: bad stuff happened, meta: ' + repr(meta), logging.critical) return ''