NetSurf
|
Generate HTML content for displaying directory listings (implementation). More...
#include <stdbool.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "utils/nsurl.h"
#include "utils/messages.h"
#include "utils/nscolour.h"
#include "netsurf/inttypes.h"
#include "netsurf/types.h"
#include "netsurf/plot_style.h"
#include "dirlist.h"
#include "desktop/system_colour.h"
Go to the source code of this file.
Functions | |
static int | dirlist_filesize_calculate (unsigned long *bytesize) |
Obtain display value and units for filesize after conversion to B/kB/MB/GB, as appropriate. More... | |
static int | dirlist_filesize_value (unsigned long bytesize) |
Obtain display value for filesize after conversion to B/kB/MB/GB, as appropriate. More... | |
static char * | dirlist_filesize_unit (unsigned long bytesize) |
Obtain display units for filesize after conversion to B/kB/MB/GB, as appropriate. More... | |
bool | dirlist_generate_top (char *buffer, int buffer_length) |
Generates the top part of an HTML directory listing page. More... | |
bool | dirlist_generate_hide_columns (int flags, char *buffer, int buffer_length) |
Generates the part of an HTML directory listing page that can suppress particular columns. More... | |
bool | dirlist_generate_title (const char *title, char *buffer, int buffer_length) |
Generates the part of an HTML directory listing page that contains the title. More... | |
bool | dirlist_generate_parent_link (const char *parent, char *buffer, int buffer_length) |
Generates the part of an HTML directory listing page that links to the parent directory. More... | |
bool | dirlist_generate_headings (char *buffer, int buffer_length) |
Generates the part of an HTML directory listing page that displays the column headings. More... | |
bool | dirlist_generate_row (bool even, bool directory, nsurl *url, char *name, const char *mimetype, long long size, char *date, char *time, char *buffer, int buffer_length) |
Generates the part of an HTML directory listing page that displays a row in the directory contents table. More... | |
bool | dirlist_generate_bottom (char *buffer, int buffer_length) |
Generates the bottom part of an HTML directory listing page. More... | |
Generate HTML content for displaying directory listings (implementation).
Definition in file dirlist.c.
|
static |
Obtain display value and units for filesize after conversion to B/kB/MB/GB, as appropriate.
bytesize | file size in bytes, updated to filesize in output units |
Definition at line 367 of file dirlist.c.
Referenced by dirlist_filesize_unit(), and dirlist_filesize_value().
|
static |
Obtain display units for filesize after conversion to B/kB/MB/GB, as appropriate.
bytesize | file size in bytes |
Definition at line 403 of file dirlist.c.
References dirlist_filesize_calculate().
Referenced by dirlist_generate_row().
|
static |
Obtain display value for filesize after conversion to B/kB/MB/GB, as appropriate.
bytesize | file size in bytes |
Definition at line 388 of file dirlist.c.
References dirlist_filesize_calculate().
Referenced by dirlist_generate_row().
bool dirlist_generate_bottom | ( | char * | buffer, |
int | buffer_length | ||
) |
Generates the bottom part of an HTML directory listing page.
This is part of a series of functions. To generate a complete page, call the following functions in order:
dirlist_generate_top() dirlist_generate_hide_columns() -- optional dirlist_generate_title() dirlist_generate_parent_link() -- optional dirlist_generate_headings() dirlist_generate_row() -- call 'n' times for 'n' rows dirlist_generate_bottom()
Definition at line 344 of file dirlist.c.
References buffer.
Referenced by fetch_file_process_dir().
bool dirlist_generate_headings | ( | char * | buffer, |
int | buffer_length | ||
) |
Generates the part of an HTML directory listing page that displays the column headings.
buffer | buffer to fill with generated HTML |
buffer_length | maximum size of buffer |
This is part of a series of functions. To generate a complete page, call the following functions in order:
dirlist_generate_top() dirlist_generate_hide_columns() -- optional dirlist_generate_title() dirlist_generate_parent_link() -- optional dirlist_generate_headings() dirlist_generate_row() -- call 'n' times for 'n' rows dirlist_generate_bottom()
Definition at line 237 of file dirlist.c.
References buffer, and messages_get().
Referenced by fetch_file_process_dir().
bool dirlist_generate_hide_columns | ( | int | flags, |
char * | buffer, | ||
int | buffer_length | ||
) |
Generates the part of an HTML directory listing page that can suppress particular columns.
flags | flags for which cols to suppress. 0 to suppress none |
buffer | buffer to fill with generated HTML |
buffer_length | maximum size of buffer |
This is part of a series of functions. To generate a complete page, call the following functions in order:
dirlist_generate_top() dirlist_generate_hide_columns() -- optional dirlist_generate_title() dirlist_generate_parent_link() -- optional dirlist_generate_headings() dirlist_generate_row() -- call 'n' times for 'n' rows dirlist_generate_bottom()
Definition at line 100 of file dirlist.c.
References buffer, DIRLIST_NO_DATE_COLUMN, DIRLIST_NO_NAME_COLUMN, DIRLIST_NO_SIZE_COLUMN, DIRLIST_NO_TIME_COLUMN, and DIRLIST_NO_TYPE_COLUMN.
bool dirlist_generate_parent_link | ( | const char * | parent, |
char * | buffer, | ||
int | buffer_length | ||
) |
Generates the part of an HTML directory listing page that links to the parent directory.
parent | url of parent directory |
buffer | buffer to fill with generated HTML |
buffer_length | maximum size of buffer |
This is part of a series of functions. To generate a complete page, call the following functions in order:
dirlist_generate_top() dirlist_generate_hide_columns() -- optional dirlist_generate_title() dirlist_generate_parent_link() -- optional dirlist_generate_headings() dirlist_generate_row() -- call 'n' times for 'n' rows dirlist_generate_bottom()
Definition at line 202 of file dirlist.c.
References buffer, messages_get(), and parent.
Referenced by fetch_file_process_dir().
bool dirlist_generate_row | ( | bool | even, |
bool | directory, | ||
nsurl * | url, | ||
char * | name, | ||
const char * | mimetype, | ||
long long | size, | ||
char * | date, | ||
char * | time, | ||
char * | buffer, | ||
int | buffer_length | ||
) |
Generates the part of an HTML directory listing page that displays a row in the directory contents table.
even | evenness of row number, for alternate row colouring |
directory | whether this row is for a directory (or a file) |
url | url for row entry |
name | name of row entry |
mimetype | MIME type of row entry |
size | size of row entry. If negative, size is left blank |
date | date row entry was last modified |
time | time row entry was last modified |
buffer | buffer to fill with generated HTML |
buffer_length | maximum size of buffer |
This is part of a series of functions. To generate a complete page, call the following functions in order:
dirlist_generate_top() dirlist_generate_hide_columns() -- optional dirlist_generate_title() dirlist_generate_parent_link() -- optional dirlist_generate_headings() dirlist_generate_row() -- call 'n' times for 'n' rows dirlist_generate_bottom()
Definition at line 289 of file dirlist.c.
References buffer, dirlist_filesize_unit(), dirlist_filesize_value(), messages_get(), and nsurl_access().
Referenced by process_dir_ent().
bool dirlist_generate_title | ( | const char * | title, |
char * | buffer, | ||
int | buffer_length | ||
) |
Generates the part of an HTML directory listing page that contains the title.
title | title to use |
buffer | buffer to fill with generated HTML |
buffer_length | maximum size of buffer |
This is part of a series of functions. To generate a complete page, call the following functions in order:
dirlist_generate_top() dirlist_generate_hide_columns() -- optional dirlist_generate_title() dirlist_generate_parent_link() -- optional dirlist_generate_headings() dirlist_generate_row() -- call 'n' times for 'n' rows dirlist_generate_bottom()
Definition at line 143 of file dirlist.c.
References buffer, colour_rb_swap, nscolour_get_stylesheet(), NSCOLOUR_WIN_ODD_BG, nscolours, and NSERROR_OK.
Referenced by fetch_file_process_dir().
bool dirlist_generate_top | ( | char * | buffer, |
int | buffer_length | ||
) |
Generates the top part of an HTML directory listing page.
This is part of a series of functions. To generate a complete page, call the following functions in order:
dirlist_generate_top() dirlist_generate_hide_columns() -- optional dirlist_generate_title() dirlist_generate_parent_link() -- optional dirlist_generate_headings() dirlist_generate_row() -- call 'n' times for 'n' rows dirlist_generate_bottom()
Definition at line 61 of file dirlist.c.
References buffer.
Referenced by fetch_file_process_dir().