Esempio n. 1
0
def index(request):
    '''
    Handler for the accounts view
    '''

    # set the request in the connector object
    connector.request = request

    # get all wallets
    wallets = getWallets(connector)

    accounts = []
    for wallet in wallets:
        accounts_by_wallet = wallet.listAccounts(gethidden=True)
        accounts = accounts + accounts_by_wallet

    sections = misc.getSiteSections(current_section)

    page_title = _("Accounts")
    context = {
        'globals': MainConfig['globals'],
        'breadcrumbs': misc.buildBreadcrumbs(current_section, 'all'),
        'system_errors': connector.errors,
        'system_alerts': connector.alerts,
        'page_title': page_title,
        'page_sections': sections,
        'accounts': accounts,
        'request': request,
    }
    return render(request, 'accounts/index.html', context)
Esempio n. 2
0
def index(request):
    '''
    Handler for the accounts view
    '''
    
    # set the request in the connector object
    connector.request = request
    
    # get all wallets
    wallets = getWallets(connector)

    accounts = []
    for wallet in wallets:
        accounts_by_wallet = wallet.listAccounts(gethidden=True)
        accounts = accounts + accounts_by_wallet
    
    sections = misc.getSiteSections(current_section)
    
    page_title = _("Accounts")
    context = {
               'globals': MainConfig['globals'],
               'breadcrumbs': misc.buildBreadcrumbs(current_section, 'all'),
               'system_errors': connector.errors,
               'system_alerts': connector.alerts,
               'page_title': page_title,
               'page_sections': sections,
               'accounts': accounts,
               'request': request,
               }
    return render(request, 'accounts/index.html', context)
Esempio n. 3
0
def index(request):
    '''
    Handler for the dashboard main page
    '''
    currect_section = 'dashboard'
    
    # set the request in the connector object
    connector.request = request
    
    # get all wallets
    wallets = getWallets(connector)

    # more efficient if we do only one call
    transactions = []
    for wallet in wallets:
        transactions = transactions + wallet.listTransactions(5, 0)
    
    # sort result
    transactions = sorted(transactions, key=lambda k: k.get('time', 0), reverse=True)
    
    # get only 10 transactions
    transactions = transactions[0:5]

    # events
    list_of_events = Events.objects.all().order_by('-entered')[:5]  
    for single_event in list_of_events:
        timestamp = calendar.timegm(single_event.entered.timetuple())
        single_event.entered_pretty = misc.twitterizeDate(timestamp)
    
    page_title = "Dashboard"
    sections = misc.getSiteSections('dashboard')
    context = {
               'globals': MainConfig['globals'],
               'system_errors': connector.errors,
               'system_alerts': connector.alerts,
               'request': request,
               'breadcrumbs': misc.buildBreadcrumbs(currect_section),
               'page_title': page_title,
               'page_sections': sections,
               'wallets': wallets,
               'transactions': transactions,
               'events': list_of_events
               }
    return render(request, 'dashboard/index.html', context)
Esempio n. 4
0
def index(request):
    '''
    Handler for the dashboard main page
    '''
    currect_section = 'dashboard'
    
    # set the request in the connector object
    connector.request = request
    
    # get all wallets
    wallets = getWallets(connector)

    # more efficient if we do only one call
    transactions = []
    for wallet in wallets:
        transactions = transactions + wallet.listTransactions(5, 0)
    
    # sort result
    transactions = sorted(transactions, key=lambda k: k.get('time', 0), reverse=True)
    
    # get only 10 transactions
    transactions = transactions[0:5]

    # events
    list_of_events = Events.objects.all().order_by('-entered')[:5]  
    for single_event in list_of_events:
        timestamp = calendar.timegm(single_event.entered.timetuple())
        single_event.entered_pretty = misc.twitterizeDate(timestamp)
    
    page_title = "Dashboard"
    sections = misc.getSiteSections('dashboard')
    context = {
               'globals': MainConfig['globals'],
               'system_errors': connector.errors,
               'system_alerts': connector.alerts,
               'request': request,
               'breadcrumbs': misc.buildBreadcrumbs(currect_section),
               'page_title': page_title,
               'page_sections': sections,
               'wallets': wallets,
               'transactions': transactions,
               'events': list_of_events
               }
    return render(request, 'dashboard/index.html', context)
Esempio n. 5
0
def index(request, selected_provider_id=False, page=1):
    '''
    handler for the transactions list
    '''

    if selected_provider_id is False:
        selected_provider_id = connector.config.keys()[0]
    else:
        selected_provider_id = int(selected_provider_id)

    page = int(page)
    items_per_page = 10
    page_title = "Transactions"

    hide_moves = request.user.setting.get('hide_moves')

    # get addressbook
    addressBookAddresses = savedAddress.objects.filter(status__gt=1)
    saved_addresses = {}
    for saved_address in addressBookAddresses:
        saved_addresses[saved_address.address] = saved_address.name

    # set the request in the connector object
    connector.request = request

    wallet = None
    wallets = getWallets(connector)
    for w in wallets:
        if w.provider_id == selected_provider_id:
            wallet = w

    # get transactions
    transactions_list = wallet.listTransactions(items_per_page,
                                                (items_per_page * (page - 1)))
    # sort transactions
    transactions_list = sorted(transactions_list,
                               key=lambda k: k.get('time', 0),
                               reverse=True)

    # remove moves if there is a user setting for it
    transactions = []
    if bool(hide_moves):
        for transaction in transactions_list:
            if transaction['category'] != "move":
                transactions.append(transaction)
    else:
        transactions = transactions_list

    sender_address_tooltip_text = "This address has been calculated using the Input Script Signature. You should verify before using it."

    providers = {}
    for provider_id in connector.config:
        providers[provider_id] = connector.config[provider_id]['name']

    context = {
        'globals':
        MainConfig['globals'],
        'system_errors':
        connector.errors,
        'system_alerts':
        connector.alerts,
        'request':
        request,
        'breadcrumbs':
        misc.buildBreadcrumbs(current_section, '',
                              connector.config[selected_provider_id]['name']),
        'page_title':
        page_title,
        'page_sections':
        misc.getSiteSections(current_section),
        'transactions':
        transactions,
        'transactions_per_page':
        items_per_page,
        'show_pager':
        True,
        'next_page': (page + 1),
        'prev_page':
        max(1, page - 1),
        'levels':
        [(max(1, (page - 10)), max(1, (page - 100)), max(1, (page - 1000))),
         ((page + 10), (page + 100), (page + 1000))],
        'current_page':
        page,
        'saved_addresses':
        saved_addresses,
        'sender_address_tooltip_text':
        sender_address_tooltip_text,
        'providers':
        providers,
        'selected_provider_id':
        selected_provider_id,
    }
    return render(request, 'transactions/index.html', context)
Esempio n. 6
0
def index(request, selected_provider_id=False, page=1):
    '''
    handler for the transactions list
    '''
    
    if selected_provider_id is False:
        selected_provider_id = connector.config.keys()[0]
    else:
        selected_provider_id = int(selected_provider_id)
        
    page = int(page)
    items_per_page = 10
    page_title = "Transactions"
    
    hide_moves = request.user.setting.get('hide_moves')
    
    # get addressbook
    addressBookAddresses = savedAddress.objects.filter(status__gt=1)
    saved_addresses = {}
    for saved_address in addressBookAddresses:
        saved_addresses[saved_address.address] = saved_address.name

    # set the request in the connector object
    connector.request = request

    wallet = None
    wallets = getWallets(connector)
    for w in wallets:
        if w.provider_id == selected_provider_id:
            wallet = w
            
    # get transactions
    transactions_list = wallet.listTransactions(items_per_page, (items_per_page * (page - 1)))
    # sort transactions
    transactions_list = sorted(transactions_list, key=lambda k: k.get('time', 0), reverse=True)
    
    # remove moves if there is a user setting for it
    transactions = []
    if bool(hide_moves):
        for transaction in transactions_list:
            if transaction['category'] != "move":
                transactions.append(transaction)
    else:
        transactions = transactions_list

    sender_address_tooltip_text = "This address has been calculated using the Input Script Signature. You should verify before using it."
    
    providers = {}
    for provider_id in connector.config:
        providers[provider_id] = connector.config[provider_id]['name']
    
    context = {
               'globals': MainConfig['globals'],
               'system_errors': connector.errors,
               'system_alerts': connector.alerts,
               'request': request,
               'breadcrumbs': misc.buildBreadcrumbs(current_section, '', connector.config[selected_provider_id]['name']),
               'page_title': page_title,
               'page_sections': misc.getSiteSections(current_section),
               'transactions': transactions,
               'transactions_per_page': items_per_page,
               'show_pager': True,
               'next_page': (page + 1),
               'prev_page': max(1, page - 1),
               'levels': [(max(1, (page - 10)), max(1, (page - 100)), max(1, (page - 1000))), ((page + 10), (page + 100), (page + 1000))],
               'current_page': page,
               'saved_addresses': saved_addresses,
               'sender_address_tooltip_text': sender_address_tooltip_text,
               'providers': providers,
               'selected_provider_id': selected_provider_id,
               }
    return render(request, 'transactions/index.html', context)