Displays the preview of the uploaded file
329738
protected function preview_uploaded_cohorts() {
        global $OUTPUT;
        if (empty($this->processeddata)) {
            return;
        }
        foreach ($this->processeddata[0]['errors'] as $error) {
            echo $OUTPUT->notification($error);
        }
        foreach ($this->processeddata[0]['warnings'] as $warning) {
            echo $OUTPUT->notification($warning, 'notifymessage');
        }
        $table = new html_table();
        $table->id = 'previewuploadedcohorts';
        $columns = $this->processeddata[0]['data'];
        $columns['contextid'] = get_string('context', 'role');

        // Add column names to the preview table.
        $table->head = array('');
        foreach ($columns as $key => $value) {
            $table->head[] = $value;
        }
        $table->head[] = get_string('status');

        // Add (some) rows to the preview table.
        $previewdrows = $this->get_previewed_rows();
        foreach ($previewdrows as $idx) {
            $line = $this->processeddata[$idx];
            $cells = array(new html_table_cell($idx));
            $context = context::instance_by_id($line['data']['contextid']);
            foreach ($columns as $key => $value) {
                if ($key === 'contextid') {
                    $text = html_writer::link(new moodle_url('/cohort/index.php', array('contextid' => $context->id)),
                        $context->get_context_name(false));
                } else {
                    $text = s($line['data'][$key]);
                }
                $cells[] = new html_table_cell($text);
            }
            $text = '';
            if ($line['errors']) {
                $text .= html_writer::div(join('<br>', $line['errors']), 'notifyproblem');
            }
            if ($line['warnings']) {
                $text .= html_writer::div(join('<br>', $line['warnings']));
            }
            $cells[] = new html_table_cell($text);
            $table->data[] = new html_table_row($cells);
        }
        if ($notdisplayed = count($this->processeddata) - count($previewdrows) - 1) {
            $cell = new html_table_cell(get_string('displayedrows', 'cohort',
                (object)array('displayed' => count($previewdrows), 'total' => count($this->processeddata) - 1)));
            $cell->colspan = count($columns) + 2;
            $table->data[] = new html_table_row(array($cell));
        }
        echo html_writer::table($table);
    }
644126
public function setPreviewFile($preview_file) {
        if(!$this->setModified('preview_file', $preview_file)->isModified()) {
            return $this;
        }
		$this->preview_file = $preview_file;
		return $this;
    }
250918
def image_dialog
      @uploaded_files = UploadedFile.all.select { |file| file.is_image? }
      render layout: false
    end
395469
protected function execUpload()
    {
        $this->loadTranslations('form', sprintf('private/global/locales/%s/form.ini', LANGUAGE));
        //fields  instances
        foreach($this->uploadFieldsDefinitions as $fieldName => $definition) {
            $validations = isset($definition['validations']) ? $definition['validations'] : null;
            $previewTemplate = isset($definition['previewTemplate']) ? $definition['previewTemplate'] : null;
            $this->uploadFields[$fieldName] = new Upload\Field($fieldName, $validations, $previewTemplate);
            foreach($definition['outputs'] as $outputName => $output) {
                $this->uploadFields[$fieldName]->addOutput($outputName, $output['destination']);
            }
        }
        $this->handleUpload();
        echo $this->outputUploadOutcome();
    }
864114
def preview(file):
    """"""
    params = deepcopy(current_app.config['IIIF_PREVIEWER_PARAMS'])
    if 'image_format' not in params:
        params['image_format'] = \
            'png' if file.has_extensions('.png') else 'jpg'
    return render_template(
        current_app.config['IIIF_PREVIEW_TEMPLATE'],
        file=file,
        file_url=ui_iiif_image_url(
            file.file,
            **params
        )
    )
1282121
def preview(directory=None, host=None, port=None, watch=True):
    """"""
    directory = directory or '.'
    host = host or '127.0.0.1'
    port = port or 5000

    # TODO: admin interface

    # TODO: use cache_only to keep from modifying output directly
    out_directory = build(directory)

    # Serve generated site
    os.chdir(out_directory)
    Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
    httpd = SocketServer.TCPServer((host, port), Handler)
    print ' * Serving on http://%s:%s/' % (host, port)
    httpd.serve_forever()
614217
def post(self, request, *args, **kwargs):
        
        self.init_attachment_cache()

        # Stores a boolean indicating if we are considering a preview
        self.preview = 'preview' in self.request.POST

        # Initializes the forms
        post_form_class = self.get_post_form_class()
        post_form = self.get_post_form(post_form_class)
        attachment_formset_class = self.get_attachment_formset_class()
        attachment_formset = self.get_attachment_formset(attachment_formset_class)
        poll_option_formset_class = self.get_poll_option_formset_class()
        poll_option_formset = self.get_poll_option_formset(poll_option_formset_class)

        post_form_valid = post_form.is_valid()
        attachment_formset_valid = (
            attachment_formset.is_valid() if attachment_formset else None
        )
        poll_option_formset_valid = (
            poll_option_formset.is_valid()
            if poll_option_formset and len(post_form.cleaned_data['poll_question']) else None
        )

        self.attachment_preview = self.preview if attachment_formset_valid else None
        self.poll_preview = self.preview if poll_option_formset_valid else None

        poll_options_validated = poll_option_formset_valid is not None
        if (
            post_form_valid and
            attachment_formset_valid is not False and
            poll_option_formset_valid is not False
        ):
            return self.form_valid(
                post_form, attachment_formset, poll_option_formset,
                poll_options_validated=poll_options_validated,
            )
        else:
            return self.form_invalid(
                post_form, attachment_formset, poll_option_formset,
                poll_options_validated=poll_options_validated,
            )
864337
public function preview()
	{
		$strPreview = '<div class="widget m12"><div class="tl_checkbox_single_container"><input class="tl_checkbox" value="1" type="checkbox"> <label>' . $GLOBALS['TL_LANG']['tl_pattern']['invisible'][0] . '</label><p title="" class="tl_help tl_tip">' . $GLOBALS['TL_LANG']['tl_pattern']['invisible'][1] . '</p></div></div>';	
		
		if ($this->canChangeStart)
		{
			$strPreview .= '<div class="w50 wizard widget" style="padding-top:10px;"><h3 style="margin: 0;"><label>' . $GLOBALS['TL_LANG']['tl_pattern']['start'][0] . '</label></h3>';
			$strPreview .= '<input class="tl_text" value="" type="text"> ';
			$strPreview .= '<img src="assets/datepicker/images/icon.svg" alt="Page picker" style="cursor:pointer" height="20" width="20">';
			$strPreview .= '<p title="" class="tl_help tl_tip">' . $GLOBALS['TL_LANG']['tl_pattern']['start'][1] . '</p></div>';			
		}

		if ($this->canChangeStop)
		{
			$strPreview .= '<div class="w50 wizard widget" style="padding-top:10px;"><h3 style="margin: 0;"><label>' . $GLOBALS['TL_LANG']['tl_pattern']['stop'][0] . '</label></h3>';
			$strPreview .= '<input class="tl_text" value="" type="text"> ';
			$strPreview .= '<img src="assets/datepicker/images/icon.svg" alt="Page picker" style="cursor:pointer" height="20" width="20">';
			$strPreview .= '<p title="" class="tl_help tl_tip">' . $GLOBALS['TL_LANG']['tl_pattern']['stop'][1] . '</p></div>';	
		}
		
		return $strPreview;
	}
1128296
def view(self):
        
        print(self.format(remove='bnode',
                          sort=True,
                          pretty=True,
                          compress=True,
                          output='json',
                          add_ids=True))
1254320
def preview(self, limit=None, width=None):
        
        heading = self.heading
        rel = self.proj(*heading.non_blobs)
        if limit is None:
            limit = config['display.limit']
        if width is None:
            width = config['display.width']
        tuples = rel.fetch(limit=limit+1, format="array")
        has_more = len(tuples) > limit
        tuples = tuples[:limit]
        columns = heading.names
        widths = {f: min(max([len(f)] +
            [len(str(e)) for e in tuples[f]] if f in tuples.dtype.names else [len('=BLOB=')]) + 4, width) for f in columns}
        templates = {f: '%%-%d.%ds' % (widths[f], widths[f]) for f in columns}
        return (
            ' '.join([templates[f] % ('*' + f if f in rel.primary_key else f) for f in columns]) + '\n' +
            ' '.join(['+' + '-' * (widths[column] - 2) + '+' for column in columns]) + '\n' +
            '\n'.join(' '.join(templates[f] % (tup[f] if f in tup.dtype.names else '=BLOB=')
                for f in columns) for tup in tuples) +
            ('\n   ...\n' if has_more else '\n') +
            (' (Total: %d)\n' % len(rel) if config['display.show_tuple_count'] else ''))
226906
public function preview()
    {
        // Enable theme for preview (may be needed for Shortcodes)
        Config::nest();
        Config::modify()->set(SSViewer::class, 'theme_enabled', true);

        $content = $this->customise([
            'Body' => $this->record->getEmailBodyContent(),
            'HideFormData' => (bool) $this->record->HideFormData,
            'Fields' => $this->getPreviewFieldData()
        ])->renderWith($this->record->EmailTemplate);

        Config::unnest();

        return $content;
    }
551537
public function previewAdjustments() {
		$image_id = esc_html($_POST['image_id']);
		$size = esc_html($_POST['size']);

		if(!current_user_can('edit_post', $image_id)) {
			json_response([
				              'status' => 'error',
				              'message' => 'You are not strong enough, smart enough or fast enough.'
			              ]);
		}


		$params = (isset($_POST['settings'])) ? $_POST['settings'] : [];
		$result = $this->buildImgixImage($image_id, $size, $params);

		json_response(['status' => 'ok', 'src' => $result[0]]);
	}
1278900
public function show()
    {
        switch ($this->type) {
            case self::GIF:
                header("Content-Type: image/gif");
                imagegif($this->resource);
                break;
            case self::JPG:
                header("Content-Type: image/jpeg");
                imagejpeg($this->resource, null, $this->jpgQuality);
                break;
            case self::PNG:
                header("Content-Type: image/png");
                imagepng($this->resource);
                break;
            case self::BMP:
                header("Content-Type: image/wbmp");
                imagewbmp($this->resource);
                break;
            default:
                throw new ImageException("Unknown type of file " . ($this->pathToFile) . ".", ImageException::UnsupportedFormatException);
                break;
        }
    }
474132
def _previewFile(self):
        
        dataFrame = self._loadCSVDataFrame()
        dataFrameModel = DataFrameModel(dataFrame, filePath=self._filename)
        dataFrameModel.enableEditing(True)
        self._previewTableView.setModel(dataFrameModel)
        columnModel = dataFrameModel.columnDtypeModel()
        columnModel.changeFailed.connect(self.updateStatusBar)
        self._datatypeTableView.setModel(columnModel)
1241090
def display(self, filename=None):
        """"""
        if filename is None:
            filename = 'display_temp.svg'
        self.save(filename)
        open_in_browser(filename)
90564
function fileUploaded( error, response ) {
  this.debug( 'File Uploaded' );
  console.log( require( 'util' ).inspect( error || response, { showHidden: false, colors: true, depth: 4 } ) );
}
90908
protected function display()
    {
        foreach ($this->values as $key => $value) {
            $$key = $value;
        }

        require $this->TemplateDir.'/'.$this->templateFile;
    }