Personalized welcome page
554695
def welcome(self):
        """"""
        if not g.user or not g.user.get_id():
            return redirect(appbuilder.get_url_for_login)

        welcome_dashboard_id = (
            db.session
            .query(UserAttribute.welcome_dashboard_id)
            .filter_by(user_id=g.user.get_id())
            .scalar()
        )
        if welcome_dashboard_id:
            return self.dashboard(str(welcome_dashboard_id))

        payload = {
            'user': bootstrap_user_data(),
            'common': self.common_bootsrap_payload(),
        }

        return self.render_template(
            'superset/basic.html',
            entry='welcome',
            title='Superset',
            bootstrap_data=json.dumps(payload, default=utils.json_iso_dttm_ser),
        )
54334
def prompt(self):
        
        name = self.term.prompt_input('Enter page: /')
        if name:
            # Check if opening a submission url or a subreddit url
            # Example patterns for submissions:
            #     comments/571dw3
            #     /comments/571dw3
            #     /r/pics/comments/571dw3/
            #     https://www.reddit.com/r/pics/comments/571dw3/at_disneyland
            submission_pattern = re.compile(r'(^|/)comments/(?P<id>.+?)($|/)')

            match = submission_pattern.search(name)
            if match:
                url = 'https://www.reddit.com/comments/{0}'.format(match.group('id'))
                self.selected_page = self.open_submission_page(url)
            else:
                self.selected_page = self.open_subreddit_page(name)
862330
function welcomeUserCourse() {
        global $USER, $CONTEXT;
        if ( isset($USER->displayname) ) {
            if ( isset($CONTEXT->title) ) {
                printf(_m("<p>Welcome %s from %s"), htmlent_utf8($USER->displayname), htmlent_utf8($CONTEXT->title));
            } else {
                printf(_m("<p>Welcome %s"), htmlent_utf8($USER->displayname));
            }
        } else {
            if ( isset($CONTEXT->title) ) {
                printf(_m("<p>Welcome from %s"), htmlent_utf8($CONTEXT->title));
            } else {
                printf(_m("<p>Welcome "));
            }
        }

        if ( $USER->admin ) {
            echo(" "._m("(Instructor+Administrator)"));
        } else if ( $USER->instructor ) {
            echo(" "._m("(Instructor)"));
        }
        echo("</p>\n");
    }
608605
def do_welcome(self):
        
        self.rate_limited_send('join', self.config['core']['channel'])
        self.rate_limited_send('join', self.config['core']['ctrlchan'], self.config['auth']['ctrlkey'])
        # We use this to pick up info on admins who aren't currently in a channel.
        self.workers.defer(5, False, self.get_admins)
        extrachans = self.config['core']['extrachans']
        if extrachans:
            for chan in [x.strip() for x in extrachans.split(',')]:
                self.rate_limited_send('join', chan)
701087
def invite(self, event):
        """"""

        self.log('Inviting new user to enrol')
        name = event.data['name']
        email = event.data['email']
        method = event.data['method']

        self._invite(name, method, email, event.client.uuid, event)
737731
def main():
    """"""
    mod_choices = ('banned', 'contributor', 'moderator')
    mod_choices_dsp = ', '.join(['`{}`'.format(x) for x in mod_choices])
    msg = {
        'add': ('Add users to one of the following categories: {}'
                .format(mod_choices_dsp)),
        'clear': 'Remove users who have no flair set.',
        'css': 'Ignore the CSS field when synchronizing flair.',
        'edit': 'When adding flair templates, mark them as editable.',
        'file': 'The file containing contents for --message',
        'flair': 'List flair for the subreddit.',
        'flair_stats': 'Display the number of users with each flair.',
        'json': 'Output the results as json. Applies to --flair',
        'limit': ('The minimum number of users that must have the specified '
                  'flair in order to add as a template. default: %default'),
        'list': ('List the users in one of the following categories: '
                 '{}. May be specified more than once.'
                 .format(mod_choices_dsp)),
        'msg': ('Send message to users of one of the following categories: '
                '{}. Message subject provided via --subject, content provided '
                'via --file or STDIN.').format(mod_choices_dsp),
        'sort': ('The order to add flair templates. Available options are '
                 '`alpha` to add alphabetically, and `size` to first add '
                 'flair that is shared by the most number of users. '
                 'default: %default'),
        'static': ('Add this template when syncing flair templates. When '
                   'syncing text and css use a comma to separate the two.'),
        'subject': 'The subject of the message to send for --message.',
        'sync': 'Synchronize flair templates with current user flair.',
        'text': 'Ignore the text field when synchronizing flair.'}

    usage = 'Usage: %prog [options] SUBREDDIT'
    parser = arg_parser(usage=usage)
    parser.add_option('-a', '--add', help=msg['add'])
    parser.add_option('-l', '--list', action='append', help=msg['list'],
                      choices=mod_choices, metavar='CATEGORY', default=[])
    parser.add_option('-c', '--clear-empty', action='store_true',
                      help=msg['clear'])
    parser.add_option('-F', '--file', help=msg['file'])
    parser.add_option('-f', '--flair', action='store_true', help=msg['flair'])
    parser.add_option('', '--flair-stats', action='store_true',
                      help=msg['flair_stats'])
    parser.add_option('-m', '--message', choices=mod_choices, help=msg['msg'])
    parser.add_option('', '--subject', help=msg['subject'])

    group = OptionGroup(parser, 'Format options')
    group.add_option('-j', '--json', action='store_true', help=msg['json'])
    parser.add_option_group(group)

    group = OptionGroup(parser, 'Sync options')
    group.add_option('', '--sync', action='store_true', help=msg['sync'])
    group.add_option('-s', '--static', action='append', help=msg['static'])
    group.add_option('', '--editable', action='store_true', help=msg['edit'])
    group.add_option('', '--ignore-css', action='store_true',
                     default=False, help=msg['css'])
    group.add_option('', '--ignore-text', action='store_true',
                     default=False, help=msg['text'])
    group.add_option('', '--limit', type='int', help=msg['limit'], default=2)
    group.add_option('', '--sort', action='store', choices=('alpha', 'size'),
                     default='alpha', help=msg['sort'])
    parser.add_option_group(group)

    options, args = parser.parse_args()
    if len(args) == 0:
        parser.error('Must provide subreddit name.')
    if options.message and not options.subject:
        parser.error('Must provide --subject when providing --message.')
    subreddit = args[0]

    check_for_updates(options)

    modutils = ModUtils(subreddit, options.site, options.verbose)

    if options.add:
        modutils.add_users(options.add)
    if options.clear_empty:
        modutils.clear_empty()
    for category in options.list:
        modutils.output_list(category)
    if options.flair:
        modutils.output_current_flair(as_json=options.json)
    if options.flair_stats:
        modutils.output_flair_stats()
    if options.sync:
        modutils.flair_template_sync(editable=options.editable,
                                     limit=options.limit,
                                     static=options.static, sort=options.sort,
                                     use_css=not options.ignore_css,
                                     use_text=not options.ignore_text)
    if options.message:
        modutils.message(options.message, options.subject, options.file)
267925
function makePage(number, text, isDisabled, isPrevious, isNext) {
        return {
          number: number,
          text: text,
          disabled: isDisabled,
          previous: ( align && isPrevious ),
          next: ( align && isNext )
        };
      }
600875
def hello(self):
        """"""
        path = 'hello'
        response = self.request(path, do_authentication=False)
        return response
84990
protected function onSessionStarted()
    {
        add_new_template([
            'video' => 'Video',
        ], WEBED_BLOG_POSTS);
        add_new_template([
            'contact_us' => 'Contact Us',
            'videos' => 'Videos',
        ], WEBED_PAGES);

        cms_theme_options()
            ->addGroup('menu', trans('webed-theme::base.theme_groups.menus'), 30)
            ->addGroup('footer', trans('webed-theme::base.theme_groups.footer'), 31)
            ->addOptionField('theme_layout', [
                'group' => 'basic',
                'type' => 'select',
                'priority' => 0,
                'label' => trans('webed-theme::base.theme_options.theme_layout.label'),
                'helper' => trans('webed-theme::base.theme_options.theme_layout.helper'),
            ], function () {
                $allThemes = config('sgsoft-themes');

                $themes = [];
                foreach ($allThemes as $alias => $theme) {
                    $themes[$alias] = $theme['title'];
                }

                return [
                    'theme_layout',
                    $themes,
                    get_theme_option('theme_layout'),
                    ['class' => 'form-control']
                ];
            })
            ->addOptionField('items_per_page', [
                'group' => 'basic',
                'type' => 'number',
                'priority' => 1,
                'label' => trans('webed-theme::base.theme_options.items_per_page.label'),
                'helper' => trans('webed-theme::base.theme_options.items_per_page.helper'),
            ], function () {
                return [
                    'items_per_page',
                    get_theme_option('items_per_page'),
                    ['class' => 'form-control']
                ];
            })
            ->addOptionField('top_menu', [
                'group' => 'menu',
                'type' => 'select',
                'priority' => 2,
                'label' => trans('webed-theme::base.theme_options.top_menu.label'),
                'helper' => trans('webed-theme::base.theme_options.top_menu.helper'),
            ], function () {
                $menus = app(MenuRepositoryContract::class)
                    ->getWhere(['status' => 1], ['slug', 'title'])
                    ->pluck('title', 'slug')
                    ->toArray();

                return [
                    'top_menu',
                    $menus,
                    get_theme_option('top_menu'),
                    ['class' => 'form-control']
                ];
            })
            ->addOptionField('footer_menu', [
                'group' => 'menu',
                'type' => 'select',
                'priority' => 3,
                'label' => trans('webed-theme::base.theme_options.footer_menu.label'),
                'helper' => trans('webed-theme::base.theme_options.footer_menu.helper'),
            ], function () {
                $menus = app(MenuRepositoryContract::class)
                    ->getWhere(['status' => 1], ['slug', 'title'])
                    ->pluck('title', 'slug')
                    ->toArray();

                return [
                    'footer_menu',
                    $menus,
                    get_theme_option('footer_menu'),
                    ['class' => 'form-control']
                ];
            })
            ->addOptionField('google_site_verification', [
                'group' => 'basic',
                'type' => 'text',
                'priority' => 4,
                'label' => trans('webed-theme::base.theme_options.google_site_verification.label'),
                'helper' => trans('webed-theme::base.theme_options.google_site_verification.helper'),
            ], function () {
                return [
                    'google_site_verification',
                    get_theme_option('google_site_verification'),
                    ['class' => 'form-control']
                ];
            })
            ->addOptionField('visit_us_on_google_map', [
                'group' => 'basic',
                'type' => 'text',
                'priority' => 5,
                'label' => trans('webed-theme::base.theme_options.visit_us_on_google_map.label'),
                'helper' => trans('webed-theme::base.theme_options.visit_us_on_google_map.helper'),
            ], function () {
                return [
                    'visit_us_on_google_map',
                    get_theme_option('visit_us_on_google_map'),
                    ['class' => 'form-control']
                ];
            })
            ->addOptionField('footer_information', [
                'group' => 'footer',
                'type' => 'text',
                'priority' => 6,
                'label' => trans('webed-theme::base.theme_options.footer_information.label'),
                'helper' => trans('webed-theme::base.theme_options.footer_information.helper'),
            ], function () {
                return [
                    'footer_information',
                    get_theme_option('footer_information'),
                    ['class' => 'form-control']
                ];
            })
            ->addOptionField('footer_copyright', [
                'group' => 'footer',
                'type' => 'text',
                'priority' => 7,
                'label' => trans('webed-theme::base.theme_options.footer_copyright.label'),
                'helper' => trans('webed-theme::base.theme_options.footer_copyright.helper'),
            ], function () {
                return [
                    'footer_copyright',
                    get_theme_option('footer_copyright'),
                    ['class' => 'form-control']
                ];
            });
    }
216357
function init() {
		$_option = 'pressbooks_theme_options_' . $this->getSlug();
		$_page = $_option;
		$_section = $this->getSlug() . '_options_section';

		if ( false === get_option( $_option ) ) {
			add_option( $_option, $this->defaults );
		}

		add_settings_section(
			$_section,
			$this->getTitle(),
			[ $this, 'display' ],
			$_page
		);

		$custom_styles = Container::get( 'Styles' );
		$v2_compatible = $custom_styles->isCurrentThemeCompatible( 2 );

		if ( $v2_compatible ) {
			add_settings_field(
				'pdf_body_font_size',
				__( 'Body Font Size', 'pressbooks' ),
				[ $this, 'renderBodyFontSizeField' ],
				$_page,
				$_section,
				[
					__( 'Heading sizes are proportional to the body font size and will also be affected by this setting.', 'pressbooks' ),
					'pt',
					'label_for' => 'pdf_body_font_size',
				]
			);

			add_settings_field(
				'pdf_body_line_height',
				__( 'Body Line Height', 'pressbooks' ),
				[ $this, 'renderBodyLineHightField' ],
				$_page,
				$_section,
				[
					'',
					'em',
					'label_for' => 'pdf_body_line_height',
				]
			);
		}

		add_settings_field(
			'pdf_page_size',
			__( 'Page Size', 'pressbooks' ),
			[ $this, 'renderPageSizeField' ],
			$_page,
			$_section,
			[
				__( 'Digest (5.5&quot; &times; 8.5&quot;)', 'pressbooks' ),
				__( 'US Trade (6&quot; &times; 9&quot;)', 'pressbooks' ),
				__( 'US Letter (8.5&quot; &times; 11&quot;)', 'pressbooks' ),
				__( 'Custom (8.5&quot; &times; 9.25&quot;)', 'pressbooks' ),
				__( 'Duodecimo (5&quot; &times; 7.75&quot;)', 'pressbooks' ),
				__( 'Pocket (4.25&quot; &times; 7&quot;)', 'pressbooks' ),
				__( 'A4 (21cm &times; 29.7cm)', 'pressbooks' ),
				__( 'A5 (14.8cm &times; 21cm)', 'pressbooks' ),
				__( '5&quot; &times; 8&quot;', 'pressbooks' ),
				__( 'Custom&hellip;', 'pressbooks' ),
				'label_for' => 'pdf_page_size',
			]
		);

		add_settings_field(
			'pdf_page_width',
			__( 'Page Width', 'pressbooks' ),
			[ $this, 'renderPageWidthField' ],
			$_page,
			$_section,
			[
				__( 'Page width must be expressed in CSS-compatible units, e.g. &lsquo;5.5in&rsquo; or &lsquo;10cm&rsquo;.' ),
				'label_for' => 'pdf_page_width',
			]
		);

		add_settings_field(
			'pdf_page_height',
			__( 'Page Height', 'pressbooks' ),
			[ $this, 'renderPageHeightField' ],
			$_page,
			$_section,
			[
				__( 'Page height must be expressed in CSS-compatible units, e.g. &lsquo;8.5in&rsquo; or &lsquo;10cm&rsquo;.' ),
				'label_for' => 'pdf_page_height',
			]
		);

		if ( $v2_compatible ) {
			add_settings_field(
				'pdf_page_margins',
				__( 'Margins', 'pressbooks' ),
				[ $this, 'renderMarginsField' ],
				$_page,
				$_section,
				[
					__( 'Customize your book&rsquo;s margins using the fields below.', 'pressbooks' ),
				]
			);

			add_settings_field(
				'pdf_page_margin_outside',
				__( 'Outside Margin', 'pressbooks' ),
				[ $this, 'renderOutsideMarginField' ],
				$_page,
				$_section,
				[
					__( 'Margins must be expressed in CSS-compatible units, e.g. &lsquo;8.5in&rsquo; or &lsquo;10cm&rsquo;.', 'pressbooks' ),
					'label_for' => 'pdf_page_margin_outside',
				]
			);

			add_settings_field(
				'pdf_page_margin_inside',
				__( 'Inside Margin', 'pressbooks' ),
				[ $this, 'renderInsideMarginField' ],
				$_page,
				$_section,
				[
					__( 'Margins must be expressed in CSS-compatible units, e.g. &lsquo;8.5in&rsquo; or &lsquo;10cm&rsquo;.', 'pressbooks' ),
					'label_for' => 'pdf_page_margin_inside',
				]
			);

			add_settings_field(
				'pdf_page_margin_top',
				__( 'Top Margin', 'pressbooks' ),
				[ $this, 'renderTopMarginField' ],
				$_page,
				$_section,
				[
					__( 'Margins must be expressed in CSS-compatible units, e.g. &lsquo;8.5in&rsquo; or &lsquo;10cm&rsquo;.', 'pressbooks' ),
					'label_for' => 'pdf_page_margin_top',
				]
			);

			add_settings_field(
				'pdf_page_margin_bottom',
				__( 'Bottom Margin', 'pressbooks' ),
				[ $this, 'renderBottomMarginField' ],
				$_page,
				$_section,
				[
					__( 'Margins must be expressed in CSS-compatible units, e.g. &lsquo;8.5in&rsquo; or &lsquo;10cm&rsquo;.', 'pressbooks' ),
					'label_for' => 'pdf_page_margin_bottom',
				]
			);
		}

		add_settings_field(
			'pdf_hyphens',
			__( 'Hyphens', 'pressbooks' ),
			[ $this, 'renderHyphenationField' ],
			$_page,
			$_section,
			[
				__( 'Enable hyphenation', 'pressbooks' ),
			]
		);

		add_settings_field(
			'pdf_paragraph_separation',
			__( 'Paragraph Separation', 'pressbooks' ),
			[ $this, 'renderParagraphSeparationField' ],
			$_page,
			$_section,
			[
				'indent' => __( 'Indent paragraphs', 'pressbooks' ),
				'skiplines' => __( 'Skip lines between paragraphs', 'pressbooks' ),
			]
		);

		add_settings_field(
			'pdf_sectionopenings',
			__( 'Section Openings', 'pressbooks' ),
			[ $this, 'renderSectionOpeningsField' ],
			$_page,
			$_section,
			[
				'openauto' => __( 'Left or right page section opening (for print PDF)', 'pressbooks' ),
				'openright' => __( 'Right page section openings (for print PDF)', 'pressbooks' ),
				'remove' => __( 'No blank pages (for web PDF)', 'pressbooks' ),
			]
		);

		add_settings_field(
			'pdf_toc',
			__( 'Table of Contents', 'pressbooks' ),
			[ $this, 'renderTOCField' ],
			$_page,
			$_section,
			[
				__( 'Display table of contents', 'pressbooks' ),
			]
		);

		add_settings_field(
			'pdf_crop_marks',
			__( 'Crop Marks', 'pressbooks' ),
			[ $this, 'renderCropMarksField' ],
			$_page,
			$_section,
			[
				__( 'Display crop marks', 'pressbooks' ),
			]
		);

		if ( CustomCss::isCustomCss() ) {
			add_settings_field(
				'pdf_romanize_parts',
				__( 'Romanize Part Numbers', 'pressbooks' ),
				[ $this, 'renderRomanizePartsField' ],
				$_page,
				$_section,
				[
					__( 'Convert part numbers into Roman numerals', 'pressbooks' ),
				]
			);
		}

		add_settings_field(
			'pdf_footnotes_style',
			__( 'Footnote Style', 'pressbooks' ),
			[ $this, 'renderFootnoteStyleField' ],
			$_page,
			$_section,
			[
				'footnotes' => __( 'Regular footnotes', 'pressbooks' ),
				'endnotes' => __( 'Display as chapter endnotes', 'pressbooks' ),
			]
		);

		add_settings_field(
			'widows',
			__( 'Widows', 'pressbooks' ),
			[ $this, 'renderWidowsField' ],
			$_page,
			$_section,
			[
				'label_for' => 'widows',
			]
		);

		add_settings_field(
			'orphans',
			__( 'Orphans', 'pressbooks' ),
			[ $this, 'renderOrphansField' ],
			$_page,
			$_section,
			[
				'label_for' => 'orphans',
			]
		);

		if ( $v2_compatible ) {
			add_settings_field(
				'running_content',
				__( 'Running Heads & Feet', 'pressbooks' ),
				[ $this, 'renderRunningContentField' ],
				$_page,
				$_section,
				[
					__( 'Running content appears in either running heads or running feet (at the top or bottom of the page) depending on your theme.', 'pressbooks' ),
				]
			);

			add_settings_field(
				'running_content_front_matter_left',
				__( 'Front Matter Left Page Running Content', 'pressbooks' ),
				[ $this, 'renderRunningContentFrontMatterLeftField' ],
				$_page,
				$_section,
				[
					'%book_title%' => __( 'Book Title', 'pressbooks' ),
					'%book_subtitle%' => __( 'Book Subtitle', 'pressbooks' ),
					'%book_author%' => __( 'Book Author', 'pressbooks' ),
					'%section_title%' => __( 'Front Matter Title', 'pressbooks' ),
					'%section_author%' => __( 'Front Matter Author', 'pressbooks' ),
					'%section_subtitle%' => __( 'Front Matter Subtitle', 'pressbooks' ),
					'%blank%' => __( 'Blank', 'pressbooks' ),
					'' => __( 'Custom&hellip;', 'pressbooks' ),
					'label_for' => 'running_content_front_matter_left',
				]
			);

			add_settings_field(
				'running_content_front_matter_right',
				__( 'Front Matter Right Page Running Content', 'pressbooks' ),
				[ $this, 'renderRunningContentFrontMatterRightField' ],
				$_page,
				$_section,
				[
					'%book_title%' => __( 'Book Title', 'pressbooks' ),
					'%book_subtitle%' => __( 'Book Subtitle', 'pressbooks' ),
					'%book_author%' => __( 'Book Author', 'pressbooks' ),
					'%section_title%' => __( 'Front Matter Title', 'pressbooks' ),
					'%section_author%' => __( 'Front Matter Author', 'pressbooks' ),
					'%section_subtitle%' => __( 'Front Matter Subtitle', 'pressbooks' ),
					'%blank%' => __( 'Blank', 'pressbooks' ),
					'' => __( 'Custom&hellip;', 'pressbooks' ),
					'label_for' => 'running_content_front_matter_right',
				]
			);

			add_settings_field(
				'running_content_introduction_left',
				__( 'Introduction Left Page Running Content', 'pressbooks' ),
				[ $this, 'renderRunningContentIntroductionLeftField' ],
				$_page,
				$_section,
				[
					'%book_title%' => __( 'Book Title', 'pressbooks' ),
					'%book_subtitle%' => __( 'Book Subtitle', 'pressbooks' ),
					'%book_author%' => __( 'Book Author', 'pressbooks' ),
					'%section_title%' => __( 'Introduction Title', 'pressbooks' ),
					'%section_author%' => __( 'Introduction Author', 'pressbooks' ),
					'%section_subtitle%' => __( 'Introduction Subtitle', 'pressbooks' ),
					'%blank%' => __( 'Blank', 'pressbooks' ),
					'' => __( 'Custom&hellip;', 'pressbooks' ),
					'label_for' => 'running_content_introduction_left',
				]
			);

			add_settings_field(
				'running_content_introduction_right',
				__( 'Introduction Right Page Running Content', 'pressbooks' ),
				[ $this, 'renderRunningContentIntroductionRightField' ],
				$_page,
				$_section,
				[
					'%book_title%' => __( 'Book Title', 'pressbooks' ),
					'%book_subtitle%' => __( 'Book Subtitle', 'pressbooks' ),
					'%book_author%' => __( 'Book Author', 'pressbooks' ),
					'%section_title%' => __( 'Introduction Title', 'pressbooks' ),
					'%section_author%' => __( 'Introduction Author', 'pressbooks' ),
					'%section_subtitle%' => __( 'Introduction Subtitle', 'pressbooks' ),
					'%blank%' => __( 'Blank', 'pressbooks' ),
					'' => __( 'Custom&hellip;', 'pressbooks' ),
					'label_for' => 'running_content_introduction_right',
				]
			);

			add_settings_field(
				'running_content_part_left',
				__( 'Part Left Page Running Content', 'pressbooks' ),
				[ $this, 'renderRunningContentPartLeftField' ],
				$_page,
				$_section,
				[
					'%book_title%' => __( 'Book Title', 'pressbooks' ),
					'%book_subtitle%' => __( 'Book Subtitle', 'pressbooks' ),
					'%book_author%' => __( 'Book Author', 'pressbooks' ),
					'%part_number%' => __( 'Part Number', 'pressbooks' ),
					'%part_title%' => __( 'Part Title', 'pressbooks' ),
					'%blank%' => __( 'Blank', 'pressbooks' ),
					'' => __( 'Custom&hellip;', 'pressbooks' ),
					'label_for' => 'running_content_part_left',
				]
			);

			add_settings_field(
				'running_content_part_right',
				__( 'Part Right Page Running Content', 'pressbooks' ),
				[ $this, 'renderRunningContentPartRightField' ],
				$_page,
				$_section,
				[
					'%book_title%' => __( 'Book Title', 'pressbooks' ),
					'%book_subtitle%' => __( 'Book Subtitle', 'pressbooks' ),
					'%book_author%' => __( 'Book Author', 'pressbooks' ),
					'%part_number%' => __( 'Part Number', 'pressbooks' ),
					'%part_title%' => __( 'Part Title', 'pressbooks' ),
					'%blank%' => __( 'Blank', 'pressbooks' ),
					'' => __( 'Custom&hellip;', 'pressbooks' ),
					'label_for' => 'running_content_part_right',
				]
			);

			add_settings_field(
				'running_content_chapter_left',
				__( 'Chapter Left Page Running Content', 'pressbooks' ),
				[ $this, 'renderRunningContentChapterLeftField' ],
				$_page,
				$_section,
				[
					'%book_title%' => __( 'Book Title', 'pressbooks' ),
					'%book_subtitle%' => __( 'Book Subtitle', 'pressbooks' ),
					'%book_author%' => __( 'Book Author', 'pressbooks' ),
					'%part_number%' => __( 'Part Number', 'pressbooks' ),
					'%part_title%' => __( 'Part Title', 'pressbooks' ),
					'%section_title%' => __( 'Chapter Title', 'pressbooks' ),
					'%section_author%' => __( 'Chapter Author', 'pressbooks' ),
					'%section_subtitle%' => __( 'Chapter Subtitle', 'pressbooks' ),
					'%blank%' => __( 'Blank', 'pressbooks' ),
					'' => __( 'Custom&hellip;', 'pressbooks' ),
					'label_for' => 'running_content_chapter_left',
				]
			);

			add_settings_field(
				'running_content_chapter_right',
				__( 'Chapter Right Page Running Content', 'pressbooks' ),
				[ $this, 'renderRunningContentChapterRightField' ],
				$_page,
				$_section,
				[
					'%book_title%' => __( 'Book Title', 'pressbooks' ),
					'%book_subtitle%' => __( 'Book Subtitle', 'pressbooks' ),
					'%book_author%' => __( 'Book Author', 'pressbooks' ),
					'%part_number%' => __( 'Part Number', 'pressbooks' ),
					'%part_title%' => __( 'Part Title', 'pressbooks' ),
					'%section_title%' => __( 'Chapter Title', 'pressbooks' ),
					'%section_author%' => __( 'Chapter Author', 'pressbooks' ),
					'%section_subtitle%' => __( 'Chapter Subtitle', 'pressbooks' ),
					'%blank%' => __( 'Blank', 'pressbooks' ),
					'' => __( 'Custom&hellip;', 'pressbooks' ),
					'label_for' => 'running_content_chapter_right',
				]
			);

			add_settings_field(
				'running_content_back_matter_left',
				__( 'Back Matter Left Page Running Content', 'pressbooks' ),
				[ $this, 'renderRunningContentBackMatterLeftField' ],
				$_page,
				$_section,
				[
					'%book_title%' => __( 'Book Title', 'pressbooks' ),
					'%book_subtitle%' => __( 'Book Subtitle', 'pressbooks' ),
					'%book_author%' => __( 'Book Author', 'pressbooks' ),
					'%section_title%' => __( 'Back Matter Title', 'pressbooks' ),
					'%section_author%' => __( 'Back Matter Author', 'pressbooks' ),
					'%section_subtitle%' => __( 'Back Matter Subtitle', 'pressbooks' ),
					'%blank%' => __( 'Blank', 'pressbooks' ),
					'' => __( 'Custom&hellip;', 'pressbooks' ),
					'label_for' => 'running_content_back_matter_left',
				]
			);

			add_settings_field(
				'running_content_back_matter_right',
				__( 'Back Matter Right Page Running Content', 'pressbooks' ),
				[ $this, 'renderRunningContentBackMatterRightField' ],
				$_page,
				$_section,
				[
					'%book_title%' => __( 'Book Title', 'pressbooks' ),
					'%book_subtitle%' => __( 'Book Subtitle', 'pressbooks' ),
					'%book_author%' => __( 'Book Author', 'pressbooks' ),
					'%section_title%' => __( 'Back Matter Title', 'pressbooks' ),
					'%section_author%' => __( 'Back Matter Author', 'pressbooks' ),
					'%section_subtitle%' => __( 'Back Matter Subtitle', 'pressbooks' ),
					'%blank%' => __( 'Blank', 'pressbooks' ),
					'' => __( 'Custom&hellip;', 'pressbooks' ),
					'label_for' => 'running_content_back_matter_right',
				]
			);
		}

		if ( ! $v2_compatible ) {
			add_settings_field(
				'pdf_fontsize',
				__( 'Increase Font Size', 'pressbooks' ),
				[ $this, 'renderFontSizeField' ],
				$_page,
				$_section,
				[
					__( 'Increases font size and line height for greater accessibility', 'pressbooks' ),
				]
			);
		}

		/**
		 * Add custom settings fields.
		 *
		 * @since 3.9.7
		 *
		 * @param string $arg1
		 * @param string $arg2
		 */
		do_action( 'pb_theme_options_pdf_add_settings_fields', $_page, $_section );

		register_setting(
			$_option,
			$_option,
			[ $this, 'sanitize' ]
		);
	}
839882
def announcement_view(request, announcement_pk):
    '''  '''
    announce = get_object_or_404(Announcement, pk=announcement_pk)
    page_name = "View Announcement"
    profile = UserProfile.objects.get(user=request.user)
    pin_form = PinForm(
        request.POST if "pin" in request.POST else None,
        instance=announce,
        )
    can_edit = announce.incumbent == profile or request.user.is_superuser
    if pin_form.is_valid():
        pin_form.save()
        return HttpResponseRedirect(
            reverse('managers:view_announcement', kwargs={"announcement_pk": announcement_pk}),
            )
    return render_to_response('view_announcement.html', {
        'page_name': page_name,
        'pin_form': pin_form,
        'can_edit': can_edit,
        'announcement': announce,
        }, context_instance=RequestContext(request))
990149
function _contact_page_render() {
            $this->_logger->entrance();

            $vars = array( 'id' => $this->_module_id );

            /**
             * Added filter to the template to allow developers wrapping the template
             * in custom HTML (e.g. within a wizard/tabs).
             *
             * @author Vova Feldman (@svovaf)
             * @since  2.1.3
             */
            echo $this->apply_filters( 'templates/contact.php', fs_get_template( 'contact.php', $vars ) );
        }
665626
public function prepareTheme()
    {
        $this->viewBuilder()->layout('default');
        if (!empty($this->request->params['prefix']) &&
            strtolower($this->request->params['prefix']) === 'admin'
        ) {
            $this->viewBuilder()->theme(option('back_theme'));
        } else {
            $this->viewBuilder()->theme(option('front_theme'));
        }

        if ($this->request->isAjax()) {
            $this->viewBuilder()->layout('ajax');
        }

        if ($this->request->isHome()) {
            $this->viewBuilder()->layout('home');
        }

        if ($this->request->isDashboard()) {
            $this->viewBuilder()->layout('dashboard');
        }
    }
151049
def create_welcome_client(self):
        """"""
        if self.tabwidget.count() == 0:
            welcome = open(WELCOME).read()
            client = NotebookClient(self, WELCOME, ini_message=welcome)
            self.add_tab(client)
            return client
585077
async def _set_greeting_text(self):
        

        page = self.settings()

        if 'greeting' in page:
            await self._send_to_messenger_profile(page, {
                'greeting': page['greeting'],
            })

            logger.info('Greeting text set for page %s', page['page_id'])
1096808
def homepage():
    """"""
    if current_user.is_authenticated():
        if not login_fresh():
            logging.debug('User needs a fresh token')
            abort(login.needs_refresh())

        auth.claim_invitations(current_user)

    build_list = operations.UserOps(current_user.get_id()).get_builds()
    return render_template(
        'home.html',
        build_list=build_list,
        show_video_and_promo_text=app.config['SHOW_VIDEO_AND_PROMO_TEXT'])
618067
def pages_admin_menu(context, page):
    """"""
    request = context.get('request', None)

    expanded = False
    if request and "tree_expanded" in request.COOKIES:
        cookie_string = urllib.unquote(request.COOKIES['tree_expanded'])
        if cookie_string:
            ids = [int(id) for id in
                urllib.unquote(request.COOKIES['tree_expanded']).split(',')]
            if page.id in ids:
                expanded = True
    context.update({'expanded': expanded, 'page': page})
    return context