Example #1
0
def print_selection_links(matchAllName, matchThisPageName):

    name = os.getenv("REMOTE_USER")
    if name == '' or name == 'guest':
        return

    print ryw_view.confirm_popup_js()

    if matchThisPageName:
        buttonStr = ryw_view.select_button_string(
            '/cgi-bin/AddSearchAll.py',
            'sel', matchThisPageName,
            'Add search results on this page to the current selection?',
	    ryw_view.CONFIRM_WIDTH,  ryw_view.CONFIRM_HEIGHT, 
            '/icons/select_add_page.png',
	    ryw_view.BUTTON_WIDTH,  ryw_view.BUTTON_HEIGHT, 
            'Add search results on this page to the current selection',
	    appendBlanks = True)
        print '<BR>'
        print buttonStr
    
    if matchAllName:
        buttonStr = ryw_view.select_button_string(
            '/cgi-bin/AddSearchAll.py',
            'sel', matchAllName,
            'Add all search results to the current selection?',
	    ryw_view.CONFIRM_WIDTH,  ryw_view.CONFIRM_HEIGHT, 
            '/icons/select_add_all.png',
	    ryw_view.BUTTON_WIDTH,  ryw_view.BUTTON_HEIGHT, 
            'Add all search results to the current selection',
            appendBlanks = True)
        print buttonStr

    clearSaveButtonStr = ryw_view.clear_save_sel_buttons(name)
    print clearSaveButtonStr

    if name == 'admin' and matchThisPageName:
        buttonStr = ryw_view.select_button_string2(
            '/cgi-bin/DelSearchAll.py?' + 'sel=' + matchThisPageName,
            'Danger: do you really want to destroy all the actual data '+
            'belonging to the objects on this page??!!',
            '/icons/page_star_equal_0.png',
	    ryw_view.BUTTON_WIDTH,  ryw_view.BUTTON_HEIGHT, 
            'Danger: destroy data belonging to objects on this page',
	    appendBlanks = True)
        print buttonStr
        
    if name == 'admin' and matchAllName:
        buttonStr = ryw_view.select_button_string2(
            '/cgi-bin/DelSearchAll.py?' + 'sel=' + matchAllName,
            'Danger: do you really want to destroy all the actual data '+
            'belonging to the objects found by this search??!!',
            '/icons/all_star_equal_0.png',
	    ryw_view.BUTTON_WIDTH,  ryw_view.BUTTON_HEIGHT, 
            'Danger: destroy data belonging to objects of this search',
	    appendBlanks = True)
        print buttonStr
        
    print '<BR>'
def print_links(objID, version, name):
    if name == '' or name == 'guest':
        return

    print ryw_view.confirm_popup_js()

    objstr = objID + '%23' + str(version)

    #
    # the edit chapters button.
    #
    editChapScript = '/cgi-bin/ChapterListForm.py?objstr=' + objstr
    button0 = ryw_view.select_button_string3(
        editChapScript, '/icons/edit_chapters.png',
        ryw_view.BUTTON_WIDTH,  ryw_view.BUTTON_HEIGHT,
        'edit chapter names',
        True)

    button1 = ryw_view.select_button_string(
        '/cgi-bin/ThisSelToCurrSel.py',
        'objstr', objstr,
        'Overwrite the current selection with this selection?',
        ryw_view.CONFIRM_WIDTH,  ryw_view.CONFIRM_HEIGHT, 
        '/icons/select_equal_this.png',
        ryw_view.BUTTON_WIDTH,  ryw_view.BUTTON_HEIGHT, 
        'Overwrite the current selection with this selection',
	appendBlanks = True)

    button2 = ryw_view.select_button_string(
        '/cgi-bin/CurrSelToThisSel.py',
        'objstr', objstr,
        'Overwrite this selection with the current selection?',
        ryw_view.CONFIRM_WIDTH,  ryw_view.CONFIRM_HEIGHT, 
        '/icons/this_equal_select.png',
        ryw_view.BUTTON_WIDTH,  ryw_view.BUTTON_HEIGHT, 
        'Overwrite this selection with the current selection',
	appendBlanks = True)
    
    button3 = ryw_view.select_button_string(
        '/cgi-bin/ThisSelAddedToCurrSel.py',
        'objstr', objstr,
        'Add this selection to the current selection?',
        ryw_view.CONFIRM_WIDTH,  ryw_view.CONFIRM_HEIGHT, 
        '/icons/select_add_this.png',
        ryw_view.BUTTON_WIDTH,  ryw_view.BUTTON_HEIGHT, 
        'Add this selection to the current selection',
	appendBlanks = True)
    
    button4 = ryw_view.select_button_string(
        'CurrSelAddedToThisSel.py',
        'objstr', objstr,
        'Add the current selection to this selection?',
        ryw_view.CONFIRM_WIDTH,  ryw_view.CONFIRM_HEIGHT, 
        '/icons/this_add_select.png',
        ryw_view.BUTTON_WIDTH,  ryw_view.BUTTON_HEIGHT, 
        'Add the current selection to this selection',
        appendBlanks = True)
    
    print button0 + button1 + button2 + button3 + button4

    clearSaveButtonStr = ryw_view.clear_save_sel_buttons(name)
    print clearSaveButtonStr

    if name != 'admin':
        return

    buttonDestroy = ryw_view.select_button_string2(
        '/cgi-bin/DelSelData.py?' + 'objstr=' + objstr,
        'Danger: do you really want to destroy all the actual data '+
        'belonging to the objects of this selection?',
        '/icons/this_star_equal_0.png',
	ryw_view.BUTTON_WIDTH,  ryw_view.BUTTON_HEIGHT,
        'Danger: destroy data belonging to objects ' + 
        'of this selection')
    print buttonDestroy