NetSurf
Macros | Functions
dirlist.h File Reference

interface to generate HTML content for displaying directory listings. More...

#include <stdbool.h>
Include dependency graph for dirlist.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DIRLIST_NO_NAME_COLUMN   1
 
#define DIRLIST_NO_TYPE_COLUMN   1 << 1
 
#define DIRLIST_NO_SIZE_COLUMN   1 << 2
 
#define DIRLIST_NO_DATE_COLUMN   1 << 3
 
#define DIRLIST_NO_TIME_COLUMN   1 << 4
 

Functions

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, struct 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...
 

Detailed Description

interface to generate HTML content for displaying directory listings.

These functions should in general be called via the content interface.

Definition in file dirlist.h.

Macro Definition Documentation

◆ DIRLIST_NO_DATE_COLUMN

#define DIRLIST_NO_DATE_COLUMN   1 << 3

Definition at line 34 of file dirlist.h.

◆ DIRLIST_NO_NAME_COLUMN

#define DIRLIST_NO_NAME_COLUMN   1

Definition at line 31 of file dirlist.h.

◆ DIRLIST_NO_SIZE_COLUMN

#define DIRLIST_NO_SIZE_COLUMN   1 << 2

Definition at line 33 of file dirlist.h.

◆ DIRLIST_NO_TIME_COLUMN

#define DIRLIST_NO_TIME_COLUMN   1 << 4

Definition at line 35 of file dirlist.h.

◆ DIRLIST_NO_TYPE_COLUMN

#define DIRLIST_NO_TYPE_COLUMN   1 << 1

Definition at line 32 of file dirlist.h.

Function Documentation

◆ dirlist_generate_bottom()

bool dirlist_generate_bottom ( char *  buffer,
int  buffer_length 
)

Generates the bottom part of an HTML directory listing page.

Returns
Bottom of directory listing HTML

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().

Here is the caller graph for this function:

◆ dirlist_generate_headings()

bool dirlist_generate_headings ( char *  buffer,
int  buffer_length 
)

Generates the part of an HTML directory listing page that displays the column headings.

Parameters
bufferbuffer to fill with generated HTML
buffer_lengthmaximum size of buffer
Returns
true iff buffer filled without error

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dirlist_generate_hide_columns()

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.

Parameters
flagsflags for which cols to suppress. 0 to suppress none
bufferbuffer to fill with generated HTML
buffer_lengthmaximum size of buffer
Returns
true iff buffer filled without error

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.

◆ dirlist_generate_parent_link()

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.

Parameters
parenturl of parent directory
bufferbuffer to fill with generated HTML
buffer_lengthmaximum size of buffer
Returns
true iff buffer filled without error

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dirlist_generate_row()

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.

Parameters
evenevenness of row number, for alternate row colouring
directorywhether this row is for a directory (or a file)
urlurl for row entry
namename of row entry
mimetypeMIME type of row entry
sizesize of row entry. If negative, size is left blank
datedate row entry was last modified
timetime row entry was last modified
bufferbuffer to fill with generated HTML
buffer_lengthmaximum size of buffer
Returns
true iff buffer filled without error

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dirlist_generate_title()

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.

Parameters
titletitle to use
bufferbuffer to fill with generated HTML
buffer_lengthmaximum size of buffer
Returns
true iff buffer filled without error

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dirlist_generate_top()

bool dirlist_generate_top ( char *  buffer,
int  buffer_length 
)

Generates the top part of an HTML directory listing page.

Returns
Top of directory listing HTML

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().

Here is the caller graph for this function: