Ejemplo n.º 1
0
 def toggle_email_notification_settings(user_id, value):
     """
     Settings will be toggled to database with proper User id
     """
     events = DataGetter.get_all_events()
     user = DataGetter.get_user(user_id)
     notification_ids = []
     for event in events:
         if user.is_speaker_at_event(event.id) or user.is_organizer(event.id):
             email_notification = DataGetter.get_email_notification_settings_by_event_id(user_id, event.id)
             if email_notification:
                 email_notification.next_event = value
                 email_notification.new_paper = value
                 email_notification.session_schedule = value
                 email_notification.session_accept_reject = value
                 email_notification.after_ticket_purchase = value
                 save_to_db(email_notification, "EmailSettings Toggled")
                 notification_ids.append(email_notification.id)
             else:
                 new_email_notification_setting = EmailNotification(next_event=value,
                                                                    new_paper=value,
                                                                    session_schedule=value,
                                                                    session_accept_reject=value,
                                                                    after_ticket_purchase=value,
                                                                    user_id=user_id,
                                                                    event_id=event.id)
                 save_to_db(new_email_notification_setting, "EmailSetting Toggled")
                 notification_ids.append(new_email_notification_setting.id)
     return notification_ids
Ejemplo n.º 2
0
def email_preferences_view():
    events = DataGetter.get_all_events()
    message_settings = DataGetter.get_all_message_setting()
    settings = DataGetter.get_email_notification_settings(login.current_user.id)
    user = DataGetter.get_user(login.current_user.id)
    return render_template('gentelella/users/settings/pages/email_preferences.html',
                           settings=settings, events=events, message_settings=message_settings, user=user)
Ejemplo n.º 3
0
def index_view():
    mails = DataGetter.get_all_mails(count=300)
    notifications = DataGetter.get_all_notifications(count=300)
    activities = DataGetter.get_all_activities(count=600)

    on_heroku = HerokuApi.is_on_heroku()
    on_kubernetes = KubernetesApi.is_on_kubernetes()
    pods_info = None
    logplex_url = None

    if on_kubernetes:
        kubernetes_api = KubernetesApi()
        pods_info = kubernetes_api.get_pods()['items']
    elif on_heroku:
        heroku_api = HerokuApi()
        logplex_url = heroku_api.get_logplex_url()

    return render_template(
        'gentelella/admin/super_admin/reports/reports.html',
        mails=mails,
        notifications=notifications,
        on_heroku=on_heroku,
        logplex_url=logplex_url,
        on_kubernetes=on_kubernetes,
        pods_info=pods_info,
        activities=activities,
        navigation_bar=list_navbar()
    )
Ejemplo n.º 4
0
def user_role_invite(event_id, hash):
    """Accept User-Role invite for the event.
    """
    event = DataGetter.get_event(event_id)
    user = current_user
    role_invite = DataGetter.get_event_role_invite(event.id, hash,
                                                   email=user.email)

    if role_invite:
        if role_invite.has_expired():
            delete_from_db(role_invite, 'Deleted RoleInvite')

            flash('Sorry, the invitation link has expired.', 'error')
            return redirect(url_for('.details_view', event_id=event.id))

        if user.has_role(event.id):
            flash('You have already been assigned a Role in the Event.', 'warning')
            return redirect(url_for('events.details_view', event_id=event_id))

        role = role_invite.role
        data = dict()
        data['user_email'] = role_invite.email
        data['user_role'] = role.name
        DataManager.add_role_to_event(data, event.id)

        # Delete Role Invite after it has been accepted
        delete_from_db(role_invite, 'Deleted RoleInvite')

        flash('You have been added as a %s' % role.title_name)
        return redirect(url_for('.details_view', event_id=event.id))
    else:
        abort(404)
Ejemplo n.º 5
0
    def index_view(self):
        if request.method == 'POST':
            DataManager.update_permissions(request.form)

        perms = dict()
        roles = DataGetter.get_roles()
        services = DataGetter.get_services()
        get_permission = DataGetter.get_permission_by_role_service

        for role in roles:
            perms[role] = dict()
            for service in services:
                perms[role][service.name] = dict()
                p = get_permission(role=role, service=service)
                if not p:
                    perms[role][service.name]['c'] = False
                    perms[role][service.name]['r'] = False
                    perms[role][service.name]['u'] = False
                    perms[role][service.name]['d'] = False
                else:
                    perms[role][service.name]['c'] = p.can_create
                    perms[role][service.name]['r'] = p.can_read
                    perms[role][service.name]['u'] = p.can_update
                    perms[role][service.name]['d'] = p.can_delete

        return self.render(
            '/gentelella/admin/super_admin/permissions/permissions.html',
            perms=sorted(perms.iteritems(),
                         key=lambda (k, v): k.name))
Ejemplo n.º 6
0
def process_speaker_view(speaker_id):
    if request.method == 'GET':
        speaker = DataGetter.get_speaker(speaker_id)
        if not speaker or speaker.name == '':
            abort(404)
        form_elems = DataGetter.get_custom_form_elements(speaker.event_id)
        if not form_elems:
            flash("Speaker and Session forms have been incorrectly configured for this event."
                  " Session creation has been disabled", "danger")
            return redirect(url_for('.display_my_sessions_view', event_id=speaker.event_id))
        speaker_form = json.loads(form_elems.speaker_form)
        event = DataGetter.get_event(speaker.event_id)
        return render_template(
            'gentelella/users/mysessions/mysession_speaker_edit.html',
            photo_delete_url=url_for('.avatar_delete',
            event_id=event.id,
            speaker_id=speaker.id),
            speaker_form=speaker_form,
            event=event,
            speaker=speaker)

    if request.method == 'POST':
        speaker = DataGetter.get_speaker(speaker_id)
        DataManager.edit_speaker(request, speaker)
        flash("The speaker has been updated successfully", "success")
        return redirect(url_for('.display_my_sessions_view', event_id=speaker.event_id))
Ejemplo n.º 7
0
def publish_event(event_id):
    event = DataGetter.get_event(event_id)
    if string_empty(event.location_name):
        flash(
            "Your event was saved. To publish your event please review the highlighted fields below.",
            "warning")
        return redirect(url_for('.edit_view',
                                event_id=event.id) + "#highlight=location_name")
    if not current_user.can_publish_event():
        flash("You don't have permission to publish event.")
        return redirect(url_for('.details_view', event_id=event_id))
    event.state = 'Published'
    save_to_db(event, 'Event Published')
    organizers = DataGetter.get_user_event_roles_by_role_name(event_id, 'organizer')
    speakers = DataGetter.get_user_event_roles_by_role_name(event_id, 'speaker')
    link = url_for('.details_view', event_id=event_id, _external=True)

    for organizer in organizers:
        send_event_publish(organizer.user.email, event.name, link)
    for speaker in speakers:
        send_event_publish(speaker.user.email, event.name, link)

    record_activity('publish_event', event_id=event.id, status='published')
    flash("Your event has been published.", "success")
    return redirect(url_for('.details_view', event_id=event_id))
Ejemplo n.º 8
0
def index_view():
    live_events = DataGetter.get_all_live_events()
    draft_events = DataGetter.get_all_draft_events()
    past_events = DataGetter.get_all_past_events()
    all_events = DataGetter.get_all_events()
    trash_events = DataGetter.get_trash_events()
    free_ticket_count = {}
    paid_ticket_count = {}
    donation_ticket_count = {}
    max_free_ticket = {}
    max_paid_ticket = {}
    max_donation_ticket = {}
    for event in all_events:
        free_ticket_count[event.id] = TicketingManager.get_orders_count_by_type(event.id, type='free')
        max_free_ticket[event.id] = TicketingManager.get_max_orders_count(event.id, type='free')
        paid_ticket_count[event.id] = TicketingManager.get_orders_count_by_type(event.id, type='paid')
        max_paid_ticket[event.id] = TicketingManager.get_max_orders_count(event.id, type='paid')
        donation_ticket_count[event.id] = TicketingManager.get_orders_count_by_type(event.id, type='donation')
        max_donation_ticket[event.id] = TicketingManager.get_max_orders_count(event.id, type='donation')
    return render_template('gentelella/admin/super_admin/events/events.html',
                           live_events=live_events,
                           draft_events=draft_events,
                           past_events=past_events,
                           all_events=all_events,
                           trash_events=trash_events,
                           free_ticket_count=free_ticket_count,
                           paid_ticket_count=paid_ticket_count,
                           donation_ticket_count=donation_ticket_count,
                           max_free_ticket=max_free_ticket,
                           max_paid_ticket=max_paid_ticket,
                           max_donation_ticket=max_donation_ticket,
                           navigation_bar=list_navbar())
Ejemplo n.º 9
0
def display_my_sessions_view():
    placeholder_images = DataGetter.get_event_default_images()
    custom_placeholder = DataGetter.get_custom_placeholders()
    upcoming_events_sessions = DataGetter.get_sessions_of_user(upcoming_events=True)
    im_config = DataGetter.get_image_configs()
    im_size = ''
    for config in im_config:
        if config.page == 'mysession':
            im_size = config.size
    past_events_sessions = DataGetter.get_sessions_of_user(upcoming_events=False)
    page_content = {"tab_upcoming_events": "Upcoming Sessions",
                    "tab_past_events": "Past Sessions",
                    "title": "My Session Proposals"}
    if not AuthManager.is_verified_user():
        flash(Markup("Your account is unverified. "
                     "Please verify by clicking on the confirmation link that has been emailed to you."
                     '<br>Did not get the email? Please <a href="/resend_email/" class="alert-link"> '
                     'click here to resend the confirmation.</a>'))
    return render_template('gentelella/users/mysessions/mysessions_list.html',
                           upcoming_events_sessions=upcoming_events_sessions,
                           past_events_sessions=past_events_sessions,
                           page_content=page_content,
                           placeholder_images=placeholder_images,
                           custom_placeholder=custom_placeholder,
                           im_size=im_size)
Ejemplo n.º 10
0
def display_view(event_id):
    sessions = DataGetter.get_sessions_by_event_id(event_id)
    event = DataGetter.get_event(event_id)
    if not event.has_session_speakers:
        return render_template('gentelella/users/events/info/enable_module.html', active_page='scheduler',
                               title='Scheduler', event=event)
    return render_template('gentelella/users/events/scheduler/scheduler.html', sessions=sessions, event=event)
Ejemplo n.º 11
0
def index_view(event_id):
    speakers = DataGetter.get_speakers(event_id)
    event = DataGetter.get_event(event_id)
    if not event.has_session_speakers:
        return render_template('gentelella/users/events/info/enable_module.html', active_page='speakers',
                               title='Speakers', event=event)
    return render_template('gentelella/users/events/speakers/base_speaker_table.html',
                           speakers=speakers, event_id=event_id, event=event)
Ejemplo n.º 12
0
def email_preferences_view(user_id):
    events = DataGetter.get_all_events()
    message_settings = DataGetter.get_all_message_setting()
    settings = DataGetter.get_email_notification_settings(user_id)
    user = DataGetter.get_user(int(user_id))
    user.admin_access = 1
    return render_template('gentelella/users/settings/pages/email_preferences.html',
                           settings=settings, events=events, message_settings=message_settings, user=user)
def process_event_cfs(identifier, via_hash=False):
    if request.method == 'GET':
        event = get_published_event_or_abort(identifier)
        placeholder_images = DataGetter.get_event_default_images()
        if event.sub_topic:
            custom_placeholder = DataGetter.get_custom_placeholder_by_name(event.sub_topic)
        elif event.topic:
            custom_placeholder = DataGetter.get_custom_placeholder_by_name(event.topic)
        else:
            custom_placeholder = DataGetter.get_custom_placeholder_by_name('Other')
        if not event.has_session_speakers:
            abort(404)

        call_for_speakers = DataGetter.get_call_for_papers(event.id).first()

        if not call_for_speakers or (not via_hash and call_for_speakers.privacy == 'private'):
            abort(404)

        form_elems = DataGetter.get_custom_form_elements(event.id)
        speaker_form = json.loads(form_elems.speaker_form)
        session_form = json.loads(form_elems.session_form)

        now = datetime.now(pytz.timezone(event.timezone
                                                  if (event.timezone and event.timezone != '') else 'UTC'))
        start_date = pytz.timezone(event.timezone).localize(call_for_speakers.start_date)
        end_date = pytz.timezone(event.timezone).localize(call_for_speakers.end_date)
        state = "now"
        if end_date < now:
            state = "past"
        elif start_date > now:
            state = "future"
        speakers = DataGetter.get_speakers(event.id).all()
        user_speaker = DataGetter.get_speaker_by_email_event(login.current_user.email, event.id)
        accepted_sessions_count = get_count(DataGetter.get_sessions(event.id))
        return render_template('gentelella/guest/event/cfs_new_session.html',
                               event=event,
                               speaker_form=speaker_form,
                               user_speaker=user_speaker,
                               accepted_sessions_count=accepted_sessions_count,
                               session_form=session_form,
                               call_for_speakers=call_for_speakers,
                               placeholder_images=placeholder_images,
                               state=state,
                               speakers=speakers,
                               via_hash=via_hash,
                               custom_placeholder=custom_placeholder,
                               from_path="cfs")

    if request.method == 'POST':
        event = DataGetter.get_event_by_identifier(identifier)
        if not event.has_session_speakers:
            abort(404)
        if login.current_user.is_authenticated:
            DataManager.add_session_to_event(request, event.id, no_name=True)
            flash("Your session proposal has been submitted", "success")
            return redirect(url_for('my_sessions.display_my_sessions_view', event_id=event.id))

        return redirect(url_for('admin.login_view', next=url_for('my_sessions.display_my_sessions_view')))
Ejemplo n.º 14
0
def details_view(page_id):
    page = DataGetter.get_page_by_id(page_id)
    if request.method == 'POST':
        DataManager().update_page(page, request.form)
        return redirect(url_for('sadmin_content.details_view', page_id=page_id))
    pages = DataGetter.get_all_pages()
    return render_template('gentelella/admin/super_admin/content/content.html',
                           pages=pages,
                           current_page=page, navigation_bar=list_navbar())
def display_event_detail_home(identifier):
    event = get_published_event_or_abort(identifier)
    placeholder_images = DataGetter.get_event_default_images()
    if event.sub_topic:
        custom_placeholder = DataGetter.get_custom_placeholder_by_name(event.sub_topic)
    elif event.topic:
        custom_placeholder = DataGetter.get_custom_placeholder_by_name(event.topic)
    else:
        custom_placeholder = DataGetter.get_custom_placeholder_by_name('Other')

    call_for_speakers = DataGetter.get_call_for_papers(event.id).first()
    accepted_sessions = DataGetter.get_sessions(event.id).all()
    if event.copyright:
        licence_details = DataGetter.get_licence_details(event.copyright.licence)
    else:
        licence_details = None

    speakers = []
    for session in accepted_sessions:
        for speaker in session.speakers:
            if speaker not in speakers:
                speakers.append(speaker)

    '''Timezone aware current datetime object according to event timezone'''
    timenow_event_tz = datetime.now(pytz.timezone(event.timezone
                                                  if (event.timezone and event.timezone != '') else 'UTC'))
    module = DataGetter.get_module()
    tickets = DataGetter.get_sales_open_tickets(event.id, True)

    '''Sponsor Levels'''
    sponsors = {-1: []}
    for sponsor in event.sponsor:
        if not sponsor.level:
            sponsors[-1].append(sponsor)
        elif int(sponsor.level) in sponsors.keys():
            sponsors[int(sponsor.level)].append(sponsor)
        else:
            sponsors[int(sponsor.level)] = [sponsor]

    fees = DataGetter.get_fee_settings_by_currency(event.payment_currency)
    code = request.args.get("code")
    return render_template('gentelella/guest/event/details.html',
                           event=event,
                           sponsors=sponsors,
                           placeholder_images=placeholder_images,
                           custom_placeholder=custom_placeholder,
                           accepted_sessions=accepted_sessions,
                           accepted_sessions_count=len(accepted_sessions),
                           call_for_speakers=call_for_speakers,
                           licence_details=licence_details,
                           speakers=speakers,
                           module=module,
                           timenow_event_tz=timenow_event_tz,
                           current_timezone=get_current_timezone(),
                           tickets=tickets if tickets else [],
                           fees=fees,
                           code=code)
Ejemplo n.º 16
0
 def index_view(self):
     mails = DataGetter.get_all_mails(count=300)
     notifications = DataGetter.get_all_notifications(count=300)
     activities = DataGetter.get_all_activities(count=600)
     return self.render(
         '/gentelella/admin/super_admin/logs/logs.html',
         mails=mails,
         notifications=notifications,
         activities=activities
     )
def process_event_cfs_speaker(identifier, via_hash=False):
    if request.method == 'GET':
        event = get_published_event_or_abort(identifier)
        placeholder_images = DataGetter.get_event_default_images()
        if event.sub_topic:
            custom_placeholder = DataGetter.get_custom_placeholder_by_name(event.sub_topic)
        elif event.topic:
            custom_placeholder = DataGetter.get_custom_placeholder_by_name(event.topic)
        else:
            custom_placeholder = DataGetter.get_custom_placeholder_by_name('Other')
        if not event.has_session_speakers:
            abort(404)

        call_for_speakers = DataGetter.get_call_for_papers(event.id).first()

        if not call_for_speakers or (not via_hash and call_for_speakers.privacy == 'private'):
            abort(404)

        form_elems = DataGetter.get_custom_form_elements(event.id)
        speaker_form = json.loads(form_elems.speaker_form)
        session_form = json.loads(form_elems.session_form)

        now = datetime.now(pytz.timezone(event.timezone
                                                  if (event.timezone and event.timezone != '') else 'UTC'))
        start_date = pytz.timezone(event.timezone).localize(call_for_speakers.start_date)
        end_date = pytz.timezone(event.timezone).localize(call_for_speakers.end_date)
        state = "now"
        if end_date < now:
            state = "past"
        elif start_date > now:
            state = "future"
        speakers = DataGetter.get_speakers(event.id).all()
        accepted_sessions_count = get_count(DataGetter.get_sessions(event.id))
        return render_template('gentelella/guest/event/cfs_new_speaker.html',
                               event=event,
                               speaker_form=speaker_form,
                               accepted_sessions_count=accepted_sessions_count,
                               session_form=session_form,
                               call_for_speakers=call_for_speakers,
                               placeholder_images=placeholder_images,
                               state=state,
                               speakers=speakers,
                               via_hash=via_hash,
                               custom_placeholder=custom_placeholder,
                               from_path="cfs")

    if request.method == 'POST':
        email = request.form['email']
        event = DataGetter.get_event_by_identifier(identifier)
        if not event.has_session_speakers:
            abort(404)
        DataManager.add_speaker_to_event(request, event.id)
        if login.current_user.is_authenticated:
            flash("You have been registered as Speaker", "success")
            return redirect(url_for('event_detail.display_event_cfs', identifier=identifier))
        else:
            flash(Markup(
                "You have been registered as Speaker. Please login/register with <strong><u>" + email + "</u></strong> to manage it."),
                "success")
            return redirect(url_for('admin.login_view', next=url_for('my_sessions.display_my_sessions_view')))
def display_event_tickets(identifier):
    event = get_published_event_or_abort(identifier)
    placeholder_images = DataGetter.get_event_default_images()
    if event.sub_topic:
        custom_placeholder = DataGetter.get_custom_placeholder_by_name(event.sub_topic)
    elif event.topic:
        custom_placeholder = DataGetter.get_custom_placeholder_by_name(event.topic)
    else:
        custom_placeholder = DataGetter.get_custom_placeholder_by_name('Other')
    if event.copyright:
        licence_details = DataGetter.get_licence_details(event.copyright.licence)
    else:
        licence_details = None
    module = DataGetter.get_module()
    tickets = DataGetter.get_sales_open_tickets(event.id, True)
    accepted_sessions_count = get_count(DataGetter.get_sessions(event.id))
    timenow_event_tz = datetime.now(pytz.timezone(event.timezone))
    fees = DataGetter.get_fee_settings_by_currency(event.payment_currency)
    return render_template('gentelella/guest/event/details.html',
                           event=event,
                           placeholder_images=placeholder_images,
                           custom_placeholder=custom_placeholder,
                           accepted_sessions_count=accepted_sessions_count,
                           licence_details=licence_details,
                           module=module,
                           timenow_event_tz=timenow_event_tz,
                           current_timezone=get_current_timezone(),
                           tickets=tickets if tickets else [],
                           fees=fees)
Ejemplo n.º 19
0
def set_settings(**kwargs):
    """
    Update system settings
    """

    if 'service_fee' in kwargs:
        ticket_service_fees = kwargs.get('service_fee')
        ticket_maximum_fees = kwargs.get('maximum_fee')
        from app.helpers.data_getter import DataGetter
        from app.helpers.data import save_to_db
        currencies = DataGetter.get_payment_currencies()
        ticket_fees = DataGetter.get_fee_settings()
        if not ticket_fees:
            for i, (currency, has_paypal, has_stripe) in enumerate(currencies):
                currency = currency.split(' ')[0]
                if float(ticket_maximum_fees[i]) == 0.0:
                    ticket_maximum_fees[i] = ticket_service_fees[i]
                ticket_fee = TicketFees(currency=currency,
                                        service_fee=ticket_service_fees[i],
                                        maximum_fee=ticket_maximum_fees[i])
                save_to_db(ticket_fee, "Ticket Fees settings saved")
        else:
            i = 0
            for fee in ticket_fees:
                if float(ticket_maximum_fees[i]) == 0.0:
                    ticket_maximum_fees[i] = ticket_service_fees[i]
                fee.service_fee = ticket_service_fees[i]
                fee.maximum_fee = ticket_maximum_fees[i]
                save_to_db(fee, "Fee Options Updated")
                i += 1
    else:
        setting = Setting.query.order_by(desc(Setting.id)).first()
        if not setting:
            setting = Setting(**kwargs)
        else:
            for key, value in kwargs.iteritems():
                setattr(setting, key, value)
        from app.helpers.data import save_to_db
        save_to_db(setting, 'Setting saved')
        current_app.secret_key = setting.secret
        stripe.api_key = setting.stripe_secret_key

        if setting.app_environment == Environment.DEVELOPMENT and not current_app.config['DEVELOPMENT']:
            current_app.config.from_object('config.DevelopmentConfig')

        if setting.app_environment == Environment.STAGING and not current_app.config['STAGING']:
            current_app.config.from_object('config.StagingConfig')

        if setting.app_environment == Environment.PRODUCTION and not current_app.config['PRODUCTION']:
            current_app.config.from_object('config.ProductionConfig')

        if setting.app_environment == Environment.TESTING and not current_app.config['TESTING']:
            current_app.config.from_object('config.TestingConfig')

        current_app.config['custom_settings'] = make_dict(setting)
Ejemplo n.º 20
0
def edit_view(event_id, step=''):
    event = DataGetter.get_event(event_id)
    custom_forms = DataGetter.get_custom_form_elements(event_id)
    speaker_form = json.loads(custom_forms.speaker_form)
    session_form = json.loads(custom_forms.session_form)
    call_for_speakers = DataGetter.get_call_for_papers(event_id).first()

    preselect = []
    required = []
    for session_field in session_form:
        if session_form[session_field]['include'] == 1:
            preselect.append(session_field)
            if session_form[session_field]['require'] == 1:
                required.append(session_field)
    for speaker_field in speaker_form:
        if speaker_form[speaker_field]['include'] == 1:
            preselect.append(speaker_field)
            if speaker_form[speaker_field]['require'] == 1:
                required.append(speaker_field)

    hash = get_random_hash()
    if CallForPaper.query.filter_by(hash=hash).all():
        hash = get_random_hash()

    current_timezone = get_current_timezone()

    seed = {
        'event': get_event_json(event),
        'sponsors': get_sponsors_json(event_id),
        'microlocations': get_microlocations_json(event_id),
        'sessionTypes': get_session_types_json(event_id),
        'tracks': get_tracks_json(event_id),
        'callForSpeakers': call_for_speakers.serialize if call_for_speakers else None
    }

    return render_template('gentelella/users/events/wizard/wizard.html',
                           event=event,
                           step=step,
                           seed=json.dumps(seed),
                           required=required,
                           preselect=preselect,
                           current_date=datetime.datetime.now(),
                           event_types=DataGetter.get_event_types(),
                           event_licences=DataGetter.get_event_licences(),
                           event_topics=DataGetter.get_event_topics(),
                           event_sub_topics=DataGetter.get_event_subtopics(),
                           timezones=DataGetter.get_all_timezones(),
                           call_for_speakers=call_for_speakers,
                           cfs_hash=hash,
                           current_timezone=current_timezone,
                           payment_countries=DataGetter.get_payment_countries(),
                           payment_currencies=DataGetter.get_payment_currencies(),
                           included_settings=get_module_settings(),
                           session_types=get_session_types_json(event_id),
                           microlocations=get_microlocations_json(event_id))
def display_event_cfs(identifier, via_hash=False):
    event = get_published_event_or_abort(identifier)
    placeholder_images = DataGetter.get_event_default_images()
    if login.current_user.is_authenticated:
        email = login.current_user.email
        user_speaker = DataGetter.get_speaker_by_email(email)

        existing_sessions = []
        for speaker in user_speaker:
            current_session = []
            for session in speaker.sessions:
                if session.event_id == event.id and not session.in_trash:
                    if session.title:
                        current_session.append(session)
            if current_session:
                existing_sessions.append(current_session)
    if event.sub_topic:
        custom_placeholder = DataGetter.get_custom_placeholder_by_name(event.sub_topic)
    elif event.topic:
        custom_placeholder = DataGetter.get_custom_placeholder_by_name(event.topic)
    else:
        custom_placeholder = DataGetter.get_custom_placeholder_by_name('Other')
    if not event.has_session_speakers:
        abort(404)

    call_for_speakers = DataGetter.get_call_for_papers(event.id).first()

    if not call_for_speakers or (not via_hash and call_for_speakers.privacy == 'private'):
        abort(404)

    form_elems = DataGetter.get_custom_form_elements(event.id)
    speaker_form = json.loads(form_elems.speaker_form)
    session_form = json.loads(form_elems.session_form)

    now = datetime.now(pytz.timezone(event.timezone
                                                  if (event.timezone and event.timezone != '') else 'UTC'))
    start_date = pytz.timezone(event.timezone).localize(call_for_speakers.start_date)
    end_date = pytz.timezone(event.timezone).localize(call_for_speakers.end_date)
    state = "now"
    if end_date < now:
        state = "past"
    elif start_date > now:
        state = "future"
    speakers = DataGetter.get_speakers(event.id).all()
    accepted_sessions_count = get_count(DataGetter.get_sessions(event.id))
    if not login.current_user.is_authenticated:
        return render_template('gentelella/guest/event/cfs.html', event=event,
                           speaker_form=speaker_form,
                           accepted_sessions_count=accepted_sessions_count,
                           session_form=session_form, call_for_speakers=call_for_speakers,
                           placeholder_images=placeholder_images, state=state, speakers=speakers,
                           via_hash=via_hash, custom_placeholder=custom_placeholder)
    else:
        return render_template('gentelella/guest/event/cfs.html', event=event,
                           speaker_form=speaker_form,
                           accepted_sessions_count=accepted_sessions_count,
                           session_form=session_form, call_for_speakers=call_for_speakers,
                           placeholder_images=placeholder_images, state=state, speakers=speakers,
                           via_hash=via_hash, custom_placeholder=custom_placeholder,
                           existing_sessions=existing_sessions)
Ejemplo n.º 22
0
def user_logged_in(user):
    speakers = DataGetter.get_speaker_by_email(user.email).all()
    for speaker in speakers:
        if not speaker.user:
            speaker.user = user
            role = Role.query.filter_by(name='speaker').first()
            event = DataGetter.get_event(speaker.event_id)
            uer = UsersEventsRoles(user=user, event=event, role=role)
            save_to_db(uer)
            save_to_db(speaker)
    return True
Ejemplo n.º 23
0
def delete_user_role_invite(event_id, hash):
    event = DataGetter.get_event(event_id)
    role_invite = DataGetter.get_event_role_invite(event.id, hash)

    if role_invite:
        delete_from_db(role_invite, 'Deleted RoleInvite')

        flash('Invitation link has been successfully deleted.')
        return redirect(url_for('.details_view', event_id=event.id))
    else:
        abort(404)
Ejemplo n.º 24
0
def send_after_event_mail():
    with app.app_context():
        events = Event.query.all()
        for event in events:
            upcoming_events = DataGetter.get_upcoming_events(event.id)
            organizers = DataGetter.get_user_event_roles_by_role_name(event.id, 'organizer')
            speakers = DataGetter.get_user_event_roles_by_role_name(event.id, 'speaker')
            if datetime.now() > event.end_time:
                for speaker in speakers:
                    send_after_event(speaker.user.email, event.id, upcoming_events)
                for organizer in organizers:
                    send_after_event(organizer.user.email, event.id, upcoming_events)
def trigger_session_schedule_change_notifications(session, event_id):
    link = url_for('event_sessions.session_display_view', event_id=event_id, session_id=session.id, _external=True)
    admin_msg_setting = DataGetter.get_message_setting_by_action(SESSION_SCHEDULE)
    for speaker in session.speakers:
        email_notification_setting = DataGetter.get_email_notification_settings_by_event_id(speaker.user_id, event_id)
        if not admin_msg_setting or \
                (email_notification_setting and email_notification_setting.session_schedule == 1 and
                    admin_msg_setting.user_control_status == 1) or \
                admin_msg_setting.user_control_status == 0:
            send_schedule_change(speaker.email, session.title, link)
            # Send notification
        send_notif_session_schedule(speaker.user, session.title, link)
Ejemplo n.º 26
0
def display_export_view(event_id):
    event = DataGetter.get_event(event_id)
    export_jobs = DataGetter.get_export_jobs(event_id)
    user = current_user
    if not AuthManager.is_verified_user():
        flash(Markup("Your account is unverified. "
                     "Please verify by clicking on the confirmation link that has been emailed to you."
                     '<br>Did not get the email? Please <a href="/resend_email/" class="alert-link"> '
                     'click here to resend the confirmation.</a>'))
    return render_template(
        'gentelella/users/events/export/export.html', event=event, export_jobs=export_jobs,
        current_user=user
    )
Ejemplo n.º 27
0
def display_event_cfs(identifier, via_hash=False):
    event = get_published_event_or_abort(identifier)
    placeholder_images = DataGetter.get_event_default_images()
    if event.sub_topic:
        custom_placeholder = DataGetter.get_custom_placeholder_by_name(event.sub_topic)
    elif event.topic:
        custom_placeholder = DataGetter.get_custom_placeholder_by_name(event.topic)
    else:
        custom_placeholder = DataGetter.get_custom_placeholder_by_name('Other')
    if not event.has_session_speakers:
        abort(404)

    call_for_speakers = DataGetter.get_call_for_papers(event.id).first()

    if not call_for_speakers or (not via_hash and call_for_speakers.privacy == 'private'):
        abort(404)

    form_elems = DataGetter.get_custom_form_elements(event.id)
    speaker_form = json.loads(form_elems.speaker_form)
    session_form = json.loads(form_elems.session_form)

    now = datetime.now()
    state = "now"
    if call_for_speakers.end_date < now:
        state = "past"
    elif call_for_speakers.start_date > now:
        state = "future"
    speakers = DataGetter.get_speakers(event.id).all()
    accepted_sessions_count = get_count(DataGetter.get_sessions(event.id))
    return render_template('gentelella/guest/event/cfs.html', event=event,
                           speaker_form=speaker_form,
                           accepted_sessions_count=accepted_sessions_count,
                           session_form=session_form, call_for_speakers=call_for_speakers,
                           placeholder_images=placeholder_images, state=state, speakers=speakers,
                           via_hash=via_hash, custom_placeholder=custom_placeholder)
def trigger_session_state_change_notifications(session, event_id, state=None):
    if not state:
        state = session.state
    link = url_for('event_sessions.session_display_view', event_id=event_id, session_id=session.id, _external=True)
    admin_msg_setting = DataGetter.get_message_setting_by_action(SESSION_ACCEPT_REJECT)
    for speaker in session.speakers:
        email_notification_setting = DataGetter.get_email_notification_settings_by_event_id(speaker.user_id, event_id)
        if not admin_msg_setting or \
                (email_notification_setting and email_notification_setting.session_accept_reject == 1 and
                    admin_msg_setting.user_control_status == 1) or \
                admin_msg_setting.user_control_status == 0:
            send_session_accept_reject(speaker.email, session.title, state, link)
            # Send notification
        send_notif_session_accept_reject(speaker.user, session.title, state, link)
def display_session_view(session_id):
    session = DataGetter.get_sessions_of_user_by_id(session_id)
    if not session:
        abort(404)
    form_elems = DataGetter.get_custom_form_elements(session.event_id)
    if not form_elems:
        flash("Speaker and Session forms have been incorrectly configured for this event."
              " Session creation has been disabled", "danger")
        return redirect(url_for('.display_my_sessions_view', event_id=session.event_id))
    speaker_form = json.loads(form_elems.speaker_form)
    session_form = json.loads(form_elems.session_form)
    event = DataGetter.get_event(session.event_id)
    speakers = DataGetter.get_speakers(session.event_id).all()
    return render_template('gentelella/users/mysessions/mysession_detail.html', session=session,
                           speaker_form=speaker_form, session_form=session_form, event=event, speakers=speakers)
def send_export_mail(event_id, result):
    """
    send export event mail after the process is complete
    """
    job = DataGetter.get_export_jobs(event_id)
    if not job:  # job not stored, happens in case of CELERY_ALWAYS_EAGER
        return
    event = EventModel.query.get(event_id)
    if not event:
        event_name = '(Undefined)'
    else:
        event_name = event.name
    send_email_after_export(job.user_email, event_name, result)
    user = DataGetter.get_user_by_email(job.user_email)
    send_notif_after_export(user, event_name, result)
def set_settings(**kwargs):
    """
    Update system settings
    """

    if 'service_fee' in kwargs:
        ticket_service_fees = kwargs.get('service_fee')
        ticket_maximum_fees = kwargs.get('maximum_fee')
        from app.helpers.data_getter import DataGetter
        from app.helpers.data import save_to_db
        currencies = DataGetter.get_payment_currencies()
        ticket_fees = DataGetter.get_fee_settings()
        if not ticket_fees:
            for i, (currency, has_paypal, has_stripe) in enumerate(currencies):
                currency = currency.split(' ')[0]
                if float(ticket_maximum_fees[i]) == 0.0:
                    ticket_maximum_fees[i] = ticket_service_fees[i]
                ticket_fee = TicketFees(currency=currency,
                                        service_fee=ticket_service_fees[i],
                                        maximum_fee=ticket_maximum_fees[i])
                save_to_db(ticket_fee, "Ticket Fees settings saved")
        else:
            i = 0
            for fee in ticket_fees:
                if float(ticket_maximum_fees[i]) == 0.0:
                    ticket_maximum_fees[i] = ticket_service_fees[i]
                fee.service_fee = ticket_service_fees[i]
                fee.maximum_fee = ticket_maximum_fees[i]
                save_to_db(fee, "Fee Options Updated")
                i += 1
    else:
        setting = Setting.query.order_by(desc(Setting.id)).first()
        if not setting:
            setting = Setting(**kwargs)
        else:
            for key, value in kwargs.iteritems():
                setattr(setting, key, value)
        from app.helpers.data import save_to_db
        save_to_db(setting, 'Setting saved')
        current_app.secret_key = setting.secret
        stripe.api_key = setting.stripe_secret_key
        current_app.config['custom_settings'] = make_dict(setting)
def process_event_cfs(identifier, via_hash=False):
    if request.method == 'GET':
        event = get_published_event_or_abort(identifier)
        placeholder_images = DataGetter.get_event_default_images()
        custom_placeholder = DataGetter.get_custom_placeholders()
        if not event.has_session_speakers:
            abort(404)

        call_for_speakers = DataGetter.get_call_for_papers(event.id).first()

        if not call_for_speakers or (not via_hash and call_for_speakers.privacy
                                     == 'private'):
            abort(404)

        form_elems = DataGetter.get_custom_form_elements(event.id)
        speaker_form = json.loads(form_elems.speaker_form)
        session_form = json.loads(form_elems.session_form)

        now = datetime.now()
        state = "now"
        if call_for_speakers.end_date < now:
            state = "past"
        elif call_for_speakers.start_date > now:
            state = "future"
        speakers = DataGetter.get_speakers(event.id).all()
        accepted_sessions_count = get_count(DataGetter.get_sessions(event.id))
        return render_template('gentelella/guest/event/cfs_new.html',
                               event=event,
                               speaker_form=speaker_form,
                               accepted_sessions_count=accepted_sessions_count,
                               session_form=session_form,
                               call_for_speakers=call_for_speakers,
                               placeholder_images=placeholder_images,
                               state=state,
                               speakers=speakers,
                               via_hash=via_hash,
                               custom_placeholder=custom_placeholder)

    if request.method == 'POST':
        email = request.form['email']
        event = DataGetter.get_event_by_identifier(identifier)
        if not event.has_session_speakers:
            abort(404)
        DataManager.add_session_to_event(request, event.id)
        if login.current_user.is_authenticated:
            flash("Your session proposal has been submitted", "success")
            return redirect(
                url_for('my_sessions.display_my_sessions_view',
                        event_id=event.id))
        else:
            flash(
                Markup(
                    "Your session proposal has been submitted. Please login/register with <strong><u>"
                    + email + "</u></strong> to manage it."), "success")
            return redirect(
                url_for('admin.login_view',
                        next=url_for('my_sessions.display_my_sessions_view')))
def display_event_cfs_via_hash(hash):
    call_for_speakers = CallForPaper.query.filter_by(hash=hash).first()
    if not call_for_speakers:
        abort(404)
    event = DataGetter.get_event(call_for_speakers.event_id)
    placeholder_images = DataGetter.get_event_default_images()
    if event.sub_topic:
        custom_placeholder = DataGetter.get_custom_placeholder_by_name(
            event.sub_topic)
    elif event.topic:
        custom_placeholder = DataGetter.get_custom_placeholder_by_name(
            event.topic)
    else:
        custom_placeholder = DataGetter.get_custom_placeholder_by_name('Other')
    if not event.has_session_speakers:
        abort(404)

    if not call_for_speakers:
        abort(404)

    if request.method == 'POST':
        return process_event_cfs(event.identifier)

    form_elems = DataGetter.get_custom_form_elements(event.id)
    speaker_form = json.loads(form_elems.speaker_form)
    session_form = json.loads(form_elems.session_form)

    now = datetime.now(
        pytz.timezone(event.timezone if (
            event.timezone and event.timezone != '') else 'UTC'))
    start_date = pytz.timezone(event.timezone).localize(
        call_for_speakers.start_date)
    end_date = pytz.timezone(event.timezone).localize(
        call_for_speakers.end_date)
    state = "now"
    if end_date < now:
        state = "past"
    elif start_date > now:
        state = "future"
    speakers = DataGetter.get_speakers(event.id).all()
    accepted_sessions_count = get_count(DataGetter.get_sessions(event.id))
    return render_template('gentelella/guest/event/cfs.html',
                           event=event,
                           speaker_form=speaker_form,
                           accepted_sessions_count=accepted_sessions_count,
                           session_form=session_form,
                           call_for_speakers=call_for_speakers,
                           placeholder_images=placeholder_images,
                           state=state,
                           speakers=speakers,
                           via_hash=True,
                           custom_placeholder=custom_placeholder)
Ejemplo n.º 34
0
def avatar_delete(event_id, speaker_id):
    if request.method == 'DELETE':
        speaker = DataGetter.get_speaker(speaker_id)
        speaker.photo = ''
        speaker.small = ''
        speaker.thumbnail = ''
        speaker.icon = ''
        speakers_modified.send(current_app._get_current_object(),
                               event_id=speaker.event_id)
        save_to_db(speaker)
        return jsonify({'status': 'ok'})
Ejemplo n.º 35
0
def placeholder_upload_details():
    if request.method == 'POST':
        copyright_info = request.form['copyright']
        origin_info = request.form['origin']
        placeholder_id = request.form['placeholder_id']
        placeholder_db = DataGetter.get_custom_placeholder_by_id(placeholder_id)
        placeholder_db.copyright = copyright_info
        placeholder_db.origin = origin_info
        save_to_db(placeholder_db, 'Custom Placeholder updated')
        return jsonify({'status': 'ok'})
    return jsonify({'status': 'error'})
Ejemplo n.º 36
0
def display_attendees(event_id):
    event = DataGetter.get_event(event_id)
    orders = TicketingManager.get_orders(event_id)
    holders = []
    for order in orders:
        for holder in order.ticket_holders:
            discount = TicketingManager.get_discount_code(
                event_id, order.discount_code_id)
            order_holder = {}
            order_holder['order_invoice'] = order.get_invoice_number()
            order_holder['order_url'] = url_for('ticketing.view_order_after_payment', order_identifier=order.identifier) \
                                        if order.status == 'completed' else url_for('ticketing.show_transaction_error', \
                                        order_identifier=order.identifier)
            order_holder['by_whom'] = order.user.user_detail.fullname if order.user.user_detail \
                                        and order.user.user_detail.fullname else order.user.email
            order_holder['paid_via'] = order.paid_via
            order_holder['status'] = order.status
            order_holder['completed_at'] = order.completed_at
            order_holder['created_at'] = order.created_at
            order_holder['ticket_name'] = holder.ticket.name
            order_holder['firstname'] = holder.firstname
            order_holder['lastname'] = holder.lastname
            order_holder['email'] = holder.email
            order_holder['ticket_name'] = holder.ticket.name
            order_holder['ticket_price'] = holder.ticket.price
            if discount and str(
                    holder.ticket.id) in discount.tickets.split(","):
                if discount.type == "amount":
                    order_holder['ticket_price'] = order_holder[
                        'ticket_price'] - discount.value
                else:
                    order_holder['ticket_price'] = order_holder['ticket_price'] - (order_holder['ticket_price'] \
                                                    * discount.value / 100.0 )
            order_holder['checked_in'] = holder.checked_in
            order_holder['id'] = holder.id
            holders.append(order_holder)
        if len(order.ticket_holders) == 0:
            order_holder = {}
            order_holder['order_invoice'] = order.get_invoice_number()
            order_holder['order_url'] = url_for('ticketing.view_order_after_payment', order_identifier=order.identifier) \
                                        if order.status == 'completed' else url_for('ticketing.show_transaction_error', \
                                        order_identifier=order.identifier)
            order_holder['by_whom'] = order.user.user_detail.fullname if order.user.user_detail \
                                        and order.user.user_detail.fullname else order.user.email
            order_holder['paid_via'] = order.paid_via
            order_holder['status'] = order.status
            order_holder['completed_at'] = order.completed_at
            order_holder['created_at'] = order.created_at
            holders.append(order_holder)

    return render_template('gentelella/admin/event/tickets/attendees.html',
                           event=event,
                           event_id=event_id,
                           holders=holders)
Ejemplo n.º 37
0
def get_module_settings():
    included_setting = []
    module = DataGetter.get_module()
    if module is not None:
        if module.ticket_include:
            included_setting.append('ticketing')
        if module.payment_include:
            included_setting.append('payments')
        if module.donation_include:
            included_setting.append('donations')
    return included_setting
Ejemplo n.º 38
0
def index_view():
    if not AuthManager.is_verified_user():
        flash(
            Markup(
                "Your account is unverified. "
                "Please verify by clicking on the confirmation link that has been emailed to you."
                '<br>Did not get the email? Please <a href="/resend_email/" class="alert-link"> '
                'click here to resend the confirmation.</a>'))
    profile = DataGetter.get_user(login.current_user.id)
    return render_template('gentelella/admin/profile/index.html',
                           profile=profile)
Ejemplo n.º 39
0
def update_role_to_admin(form, user_id):
    user = DataGetter.get_user(user_id)
    old_admin_status = user.is_admin
    user.is_admin = True if form['admin_perm'] == 'isAdmin' else False

    save_to_db(user, "User role Updated")
    if old_admin_status != user.is_admin:
        record_activity(
            'system_admin', user=user,
            status='Assigned' if user.is_admin else 'Unassigned'
        )
Ejemplo n.º 40
0
def access_codes_create(event_id, access_code_id=None):
    event = DataGetter.get_event(event_id)
    if request.method == 'POST':
        TicketingManager.create_edit_access_code(request.form, event_id)
        flash("The access code has been added.", "success")
        return redirect(url_for('.access_codes_view', event_id=event_id))
    access_code = None
    if access_code_id:
        access_code = TicketingManager.get_access_code(event_id, access_code_id)
    return render_template('gentelella/users/events/tickets/access_codes_create.html', event=event, event_id=event_id,
                           access_code=access_code)
Ejemplo n.º 41
0
def view_order_after_payment(order_identifier):
    order = TicketingManager.get_and_set_expiry(order_identifier)
    if not order or (order.status != 'completed' and order.status != 'placed'):
        abort(404)
    fees = DataGetter.get_fee_settings_by_currency(
        order.event.payment_currency)
    return render_template(
        'gentelella/guest/ticketing/order_post_payment.html',
        order=order,
        event=order.event,
        fees=fees)
Ejemplo n.º 42
0
def edit_view(event_id, session_id):
    event = DataGetter.get_event(event_id)
    if not event.has_session_speakers:
        return render_template('gentelella/users/events/info/enable_module.html', active_page='sessions',
                               title='Sessions', event=event)

    session = get_session_or_throw(session_id)
    if request.method == 'POST':
        DataManager.edit_session(request, session)
        return redirect(url_for('.index_view', event_id=event_id))

    form_elems = DataGetter.get_custom_form_elements(event_id)
    if not form_elems:
        flash("Speaker and Session forms have been incorrectly configured for this event."
              " Session creation has been disabled", "danger")
        return redirect(url_for('.index_view', event_id=event_id))
    session_form = json.loads(form_elems.session_form)
    speakers = DataGetter.get_speakers(event_id).all()
    return render_template('gentelella/users/events/sessions/edit.html', session=session,
                           session_form=session_form, event=event, speakers=speakers)
Ejemplo n.º 43
0
def bgimage_upload(event_id):
    if request.method == 'POST':
        background_image = request.form['bgimage']
        if background_image:
            background_file = uploaded_file(file_content=background_image)
            background_url = upload(
                background_file,
                UPLOAD_PATHS['event']['background_url'].format(
                    event_id=event_id))
            event = DataGetter.get_event(event_id)
            event.background_url = background_url
            save_to_db(event)
            return jsonify({'status': 'ok', 'background_url': background_url})
        else:
            return jsonify({'status': 'no bgimage'})
    elif request.method == 'DELETE':
        event = DataGetter.get_event(event_id)
        event.background_url = ''
        save_to_db(event)
        return jsonify({'status': 'ok'})
Ejemplo n.º 44
0
    def fees_by_events_view(self):
        from_date = request.args.get('from_date')
        to_date = request.args.get('to_date')

        if ('from_date' in request.args and not from_date) or ('to_date' in request.args and not to_date) or \
            ('from_date' in request.args and 'to_date' not in request.args) or \
                ('to_date' in request.args and 'from_date' not in request.args):

            return redirect(url_for('.fees_by_events_view'))

        if from_date and to_date:
            orders = TicketingManager.get_orders(
                from_date=datetime.strptime(from_date, '%d/%m/%Y'),
                to_date=datetime.strptime(to_date, '%d/%m/%Y'),
                status='completed')
        else:
            orders = TicketingManager.get_orders(status='completed')

        events = DataGetter.get_all_events()

        fee_summary = {}
        for event in events:
            fee_summary[str(event.id)] = {
                'name': event.name,
                'payment_currency': event.payment_currency,
                'fee_rate': get_fee(event.payment_currency),
                'fee_amount': 0,
                'tickets_count': 0
            }

        fee_total = 0
        tickets_total = 0

        for order in orders:
            for order_ticket in order.tickets:
                fee_summary[str(
                    order.event.id)]['tickets_count'] += order_ticket.quantity
                tickets_total += order_ticket.quantity
                ticket = TicketingManager.get_ticket(order_ticket.ticket_id)
                if order.paid_via != 'free' and order.amount > 0 and ticket.price > 0:
                    fee = ticket.price * (
                        get_fee(order.event.payment_currency) / 100)
                    fee = forex(order.event.payment_currency,
                                self.display_currency, fee)
                    fee_summary[str(order.event.id)]['fee_amount'] += fee
                    fee_total += fee

        return self.render('/gentelella/admin/super_admin/sales/fees.html',
                           fee_summary=fee_summary,
                           display_currency=self.display_currency,
                           from_date=from_date,
                           to_date=to_date,
                           tickets_total=tickets_total,
                           fee_total=fee_total)
Ejemplo n.º 45
0
def get_sponsors_json(event_id_or_sponsors):
    if represents_int(event_id_or_sponsors):
        sponsors = DataGetter.get_sponsors(event_id_or_sponsors)
    else:
        sponsors = event_id_or_sponsors

    data = []
    for sponsor in sponsors:
        data.append(sponsor.serialize)

    return data
Ejemplo n.º 46
0
def sponsor_logo_upload(event_id, sponsor_id):
    if request.method == 'POST':
        logo_image = request.form['logo']
        if logo_image:
            logo_file = uploaded_file(file_content=logo_image)
            logo = upload(
                logo_file,
                UPLOAD_PATHS['sponsors']['logo'].format(event_id=event_id,
                                                        id=sponsor_id))
            sponsor = DataGetter.get_sponsor(sponsor_id)
            sponsor.logo = logo
            save_to_db(sponsor)
            return jsonify({'status': 'ok', 'logo': logo})
        else:
            return jsonify({'status': 'no logo'})
    elif request.method == 'DELETE':
        sponsor = DataGetter.get_sponsor(sponsor_id)
        sponsor.logo = ''
        save_to_db(sponsor)
        return jsonify({'status': 'ok'})
def save_call_for_speakers(data, event_id):
    call_for_papers = DataGetter.get_call_for_papers(event_id).first()
    if not call_for_papers:
        call_for_papers = CallForPaper(event_id=event_id)
    call_for_papers.announcement = data['announcement']
    call_for_papers.timezone = data['timezone']
    call_for_papers.privacy = data['privacy']
    call_for_papers.hash = data['hash']
    call_for_papers.start_date = get_event_time_field_format(data, 'start')
    call_for_papers.end_date = get_event_time_field_format(data, 'end')
    save_to_db(call_for_papers)
Ejemplo n.º 48
0
    def get_credentials(event=None, override_mode=False, is_testing=False):

        if event and represents_int(event):
            event = DataGetter.get_event(event)

        settings = get_settings()

        if not override_mode:
            if settings['paypal_mode'] and settings['paypal_mode'] != "":
                if settings['paypal_mode'] == 'live':
                    is_testing = False
                else:
                    is_testing = True
            else:
                return None

        if is_testing:
            credentials = {
                'USER':
                settings['paypal_sandbox_username'],
                'PWD':
                settings['paypal_sandbox_password'],
                'SIGNATURE':
                settings['paypal_sandbox_signature'],
                'SERVER':
                'https://api-3t.sandbox.paypal.com/nvp',
                'CHECKOUT_URL':
                'https://www.sandbox.paypal.com/cgi-bin/webscr',
                'EMAIL':
                '' if not event or not event.paypal_email
                or event.paypal_email == "" else event.paypal_email
            }
        else:
            credentials = {
                'USER':
                settings['paypal_live_username'],
                'PWD':
                settings['paypal_live_password'],
                'SIGNATURE':
                settings['paypal_live_signature'],
                'SERVER':
                'https://api-3t.paypal.com/nvp',
                'CHECKOUT_URL':
                'https://www.paypal.com/cgi-bin/webscr',
                'EMAIL':
                '' if not event or not event.paypal_email
                or event.paypal_email == "" else event.paypal_email
            }

        if credentials['USER'] and credentials['USER'] and credentials['USER'] and credentials['USER'] != "" and \
                credentials['USER'] != "" and credentials['USER'] != "":
            return credentials
        else:
            return None
Ejemplo n.º 49
0
def trigger_new_session_notifications(session_id, event_id=None, event=None):
    if not event and not event_id:
        raise Exception('event or event_id is required')
    if not event:
        event = DataGetter.get_event(event_id)

    link = url_for('event_sessions.session_display_view',
                   event_id=event.id, session_id=session_id, _external=True)

    admin_msg_setting = DataGetter.get_message_setting_by_action(NEW_SESSION)
    organizers = DataGetter.get_user_event_roles_by_role_name(event.id, 'organizer')
    for organizer in organizers:
        email_notification_setting = DataGetter.get_email_notification_settings_by_event_id(organizer.user.id, event.id)
        if not admin_msg_setting or \
            (email_notification_setting and email_notification_setting.new_paper == 1 and
             admin_msg_setting.user_control_status == 1) or admin_msg_setting.user_control_status == 0:

            send_new_session_organizer(organizer.user.email, event.name, link)
        # Send notification
        send_notif_new_session_organizer(organizer.user, event.name, link)
Ejemplo n.º 50
0
    def index_view(self):
        # System-Role (Panel) Permissions
        sys_perms = dict()
        get_panel_perm = DataGetter.get_panel_permission

        for sys_role in SYS_ROLES_LIST:
            sys_perms[sys_role] = dict()
            for panel in PANEL_LIST:
                p = get_panel_perm(role_name=sys_role, panel_name=panel)
                sys_perms[sys_role][panel] = False if not p else p.can_access

        ## User Permissions
        user_perms = DataGetter.get_user_permissions()

        # Event-Role Permissions
        event_perms = dict()
        roles = DataGetter.get_roles()
        services = DataGetter.get_services()
        get_permission = DataGetter.get_permission_by_role_service

        for role in roles:
            event_perms[role] = dict()
            for service in services:
                event_perms[role][service.name] = dict()
                p = get_permission(role=role, service=service)

                event_perms[role][
                    service.name]['c'] = False if not p else p.can_create
                event_perms[role][
                    service.name]['r'] = False if not p else p.can_read
                event_perms[role][
                    service.name]['u'] = False if not p else p.can_update
                event_perms[role][
                    service.name]['d'] = False if not p else p.can_delete

        return self.render(
            '/gentelella/admin/super_admin/permissions/permissions.html',
            event_perms=sorted(event_perms.iteritems(),
                               key=lambda (k, v): k.name),
            sys_perms=sys_perms,
            user_perms=user_perms)
def trigger_session_state_change_notifications(session, event_id, state=None):
    if not state:
        state = session.state
    link = url_for('event_sessions.session_display_view',
                   event_id=event_id,
                   session_id=session.id,
                   _external=True)
    admin_msg_setting = DataGetter.get_message_setting_by_action(
        SESSION_ACCEPT_REJECT)
    for speaker in session.speakers:
        email_notification_setting = DataGetter.get_email_notification_settings_by_event_id(
            speaker.user_id, event_id)
        if not admin_msg_setting or \
                (email_notification_setting and email_notification_setting.session_accept_reject == 1 and
                    admin_msg_setting.user_control_status == 1) or \
                admin_msg_setting.user_control_status == 0:
            send_session_accept_reject(speaker.email, session.title, state,
                                       link)
            # Send notification
        send_notif_session_accept_reject(speaker.user, session.title, state,
                                         link)
Ejemplo n.º 52
0
def fix_session_owners():
    speakers = Speaker.query.all()
    for speaker in speakers:
        if not speaker.user or speaker.user.email != speaker.email:
            speaker.user = DataGetter.get_or_create_user_by_email(
                speaker.email, {
                    'firstname': speaker.name,
                    'lastname': ''
                })
            db.session.add(speaker)
            print "Processed - " + str(speaker.id)
    db.session.commit()
Ejemplo n.º 53
0
def user_role_invite_decline(event_id, hash):
    """Decline User-Role invite for the event.
    """
    event = DataGetter.get_event(event_id)
    user = current_user
    role_invite = DataGetter.get_event_role_invite(event.id, hash,
                                                   email=user.email)

    if role_invite:
        if role_invite.has_expired():
            delete_from_db(role_invite, 'Deleted RoleInvite')

            flash('Sorry, the invitation link has expired.', 'error')
            return redirect(url_for('.details_view', event_id=event.id))

        DataManager.decline_role_invite(role_invite)

        flash('You have declined the role invite.')
        return redirect(url_for('.details_view', event_id=event.id))
    else:
        abort(404)
Ejemplo n.º 54
0
def add_order(event_id):
    if request.method == 'POST':
        order = TicketingManager.create_order(request.form, True)
        return redirect(
            url_for('.proceed_order',
                    event_id=event_id,
                    order_identifier=order.identifier))

    event = DataGetter.get_event(event_id)
    return render_template('gentelella/users/events/tickets/add_order.html',
                           event=event,
                           event_id=event_id)
Ejemplo n.º 55
0
def contact_info_view():
    user_id = login.current_user.id
    if request.method == 'POST':
        DataManager.update_user(request.form,
                                int(user_id),
                                contacts_only_update=True)
        flash("Your contact info has been updated.", "success")
        return redirect(url_for('.contact_info_view'))
    profile = DataGetter.get_user(int(user_id))

    return render_template('gentelella/admin/settings/pages/contact_info.html',
                           user=login.current_user)
Ejemplo n.º 56
0
def index_view():
    placeholder_images = DataGetter.get_event_default_images()
    pages = DataGetter.get_all_pages()
    custom_placeholder = DataGetter.get_custom_placeholders()
    subtopics = DataGetter.get_event_subtopics()
    settings = get_settings()
    languages_copy = copy.deepcopy(LANGUAGES)
    try:
        languages_copy.pop("en")
    except:
        pass
    if request.method == 'POST':
        dic = dict(request.form.copy())
        for key, value in dic.items():
            settings[key] = value[0]
            set_settings(**settings)
    return render_template(
        'gentelella/admin/super_admin/content/content.html', pages=pages, settings=settings,
        placeholder_images=placeholder_images, subtopics=subtopics, custom_placeholder=custom_placeholder,
        languages=languages_copy
    )
Ejemplo n.º 57
0
def edit_view(event_id, speaker_id):
    speaker = get_speaker_or_throw(speaker_id)
    event = DataGetter.get_event(event_id)
    form_elems = DataGetter.get_custom_form_elements(event_id)
    if not form_elems:
        flash(
            "Speaker form has been incorrectly configured for this event. Editing has been disabled",
            "danger")
        return redirect(url_for('.index_view', event_id=event_id))
    speaker_form = json.loads(form_elems.speaker_form)
    if request.method == 'GET':
        return render_template('gentelella/admin/event/speakers/edit.html',
                               speaker=speaker,
                               event_id=event_id,
                               event=event,
                               speaker_form=speaker_form)
    if request.method == 'POST':
        save_speaker(request, event_id, speaker)
        flash("Speaker has been saved", "success")

    return redirect(url_for('.index_view', event_id=event_id))
Ejemplo n.º 58
0
def display_session_view(session_id):
    session = DataGetter.get_sessions_of_user_by_id(session_id)
    if not session:
        abort(404)
    form_elems = DataGetter.get_custom_form_elements(session.event_id)
    if not form_elems:
        flash(
            "Speaker and Session forms have been incorrectly configured for this event."
            " Session creation has been disabled", "danger")
        return redirect(
            url_for('.display_my_sessions_view', event_id=session.event_id))
    speaker_form = json.loads(form_elems.speaker_form)
    session_form = json.loads(form_elems.session_form)
    event = DataGetter.get_event(session.event_id)
    speakers = DataGetter.get_speakers(session.event_id).all()
    return render_template('gentelella/users/mysessions/mysession_detail.html',
                           session=session,
                           speaker_form=speaker_form,
                           session_form=session_form,
                           event=event,
                           speakers=speakers)
Ejemplo n.º 59
0
def process_session_view(session_id):
    if request.method == 'GET':
        session = DataGetter.get_sessions_of_user_by_id(session_id)
        speaker = DataGetter.get_speakers(
            session.event_id).filter_by(user_id=login.current_user.id).first()
        if not session:
            abort(404)
        form_elems = DataGetter.get_custom_form_elements(session.event_id)
        if not form_elems:
            flash(
                "Speaker and Session forms have been incorrectly configured for this event."
                " Session creation has been disabled", "danger")
            return redirect(
                url_for('.display_my_sessions_view',
                        event_id=session.event_id))
        session_form = json.loads(form_elems.session_form)
        event = DataGetter.get_event(session.event_id)
        return render_template(
            'gentelella/users/mysessions/mysession_session_edit.html',
            session=session,
            speaker=speaker,
            session_form=session_form,
            event=event)

    if request.method == 'POST':
        session = DataGetter.get_sessions_of_user_by_id(session_id)
        speaker = DataGetter.get_speakers(
            session.event_id).filter_by(user_id=login.current_user.id).first()
        DataManager.edit_session(request, session, speaker)
        flash("The session has been updated successfully", "success")
        return redirect(url_for('.display_session_view',
                                session_id=session_id))
Ejemplo n.º 60
0
def trigger_after_purchase_notifications(buyer_email, event_id, event, invoice_id, order_url, resend=False):
    if not event and not event_id:
        raise Exception('event or event_id is required')
    if not event:
        event = DataGetter.get_event(event_id)

    admin_msg_setting = DataGetter.get_message_setting_by_action(TICKET_PURCHASED)
    organizers = DataGetter.get_user_event_roles_by_role_name(event.id, 'organizer')
    for organizer in organizers:
        email_notification_setting = DataGetter.get_email_notification_settings_by_event_id(organizer.user.id, event_id)
        if not admin_msg_setting or \
            (email_notification_setting and email_notification_setting.after_ticket_purchase == 1 and
             admin_msg_setting.user_control_status == 1) or admin_msg_setting.user_control_status == 0:
            send_email_for_after_purchase_organizers(organizer.user.email, buyer_email, invoice_id, order_url, event.name, event.organizer_name)
        if resend:
            send_notif_for_resend(organizer.user, invoice_id, order_url, event.name, buyer_email)
        else:
            send_notif_for_after_purchase_organizer(organizer.user, invoice_id, order_url, event.name, buyer_email)

    coorganizers = DataGetter.get_user_event_roles_by_role_name(event.id, 'coorganizer')
    for coorganizer in coorganizers:
        email_notification_setting = DataGetter.get_email_notification_settings_by_event_id(coorganizer.user.id, event_id)
        if not admin_msg_setting or \
            (email_notification_setting and email_notification_setting.after_ticket_purchase == 1 and
                     admin_msg_setting.user_control_status == 1) or admin_msg_setting.user_control_status == 0:
            send_email_for_after_purchase_organizers(coorganizer.user.email, buyer_email, invoice_id, order_url, event.name, event.organizer_name)
        if resend:
            send_notif_for_resend(coorganizer.user, invoice_id, order_url, event.name, buyer_email)
        else:
            send_notif_for_after_purchase_organizer(coorganizer.user, invoice_id, order_url, event.name, buyer_email)