Exemplo n.º 1
0
def print_next_button(script, connectChar, prevEndIndex, numMatches,
		      addBlanks = False):
    if numMatches <= 0:
        ryw.give_bad_news('ShowQueue: number of matches is non-positive. '+
                          'This is not supposed to happen.',
                          logging.critical)
        return
    
    if prevEndIndex + 1 >= numMatches:
        print '<BR>'
        return

    offsetNum,endIndex = compute_begin_end(prevEndIndex + 1, numMatches)
    script = script + connectChar + 'offset=' + str(offsetNum)
    hoverMsg = 'next selected objects: ' + \
               str(offsetNum + 1) + ' - ' + \
               str(endIndex + 1)
    buttonStr = ryw_view.select_button_string3(
        script, '/icons/next.png', 
	ryw_view.BUTTON_WIDTH,  ryw_view.BUTTON_HEIGHT, hoverMsg, addBlanks)
    print '<BR><BR>' + buttonStr
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