shroom

package
v1.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2022 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CanDelete = canFactory(
		rejectDeleteLog,
		"delete-confirm",
		nil,
		"ui.act_norights_delete",
		"ui.act_notexist_delete",
		true,
	)

	CanRename = canFactory(
		rejectRenameLog,
		"rename-confirm",
		nil,
		"ui.act_norights_rename",
		"ui.act_notexist_rename",
		true,
	)

	CanUnattach = canFactory(
		rejectUnattachLog,
		"unattach-confirm",
		func(h hyphae.Hypha, u *user.User, lc *l18n.Localizer) (errmsg, errtitle string) {
			switch h := h.(type) {
			case *hyphae.EmptyHypha:
			case *hyphae.TextualHypha:
				rejectUnattachLog(h, u, "no amnt")
				return lc.Get("ui.act_noattachment_tip"), lc.Get("ui.act_noattachment")
			}

			return "", ""
		},
		"ui.act_norights_unattach",
		"ui.act_notexist_unattach",
		true,
	)

	CanEdit = canFactory(
		rejectEditLog,
		"upload-text",
		nil,
		"ui.act_norights_edit",
		"You cannot edit a hypha that does not exist",
		false,
	)

	CanAttach = canFactory(
		rejectAttachLog,
		"upload-binary",
		nil,
		"ui.act_norights_attach",
		"You cannot attach a hypha that does not exist",
		false,
	)
)

CanDelete and etc are hyphae operation checkers based on user rights and hyphae existence.

Functions

func DeleteHypha

func DeleteHypha(u *user.User, h hyphae.Hypha, lc *l18n.Localizer) (hop *history.Op, errtitle string)

DeleteHypha deletes hypha and makes a history record about that.

func FetchTextFile added in v1.8.2

func FetchTextFile(h hyphae.Hypha) (string, error)

FetchTextFile tries to read text file of the given hypha. If there is no file, empty string is returned.

func RenameHypha

func RenameHypha(h hyphae.Hypha, newHypha hyphae.Hypha, recursive bool, u *user.User, lc *l18n.Localizer) (hop *history.Op, errtitle string)

RenameHypha renames hypha from old name `hyphaName` to `newName` and makes a history record about that. If `recursive` is `true`, its subhyphae will be renamed the same way.

func SetHeaderLinks()

SetHeaderLinks initializes header links by reading the configured hypha, if there is any, or resorting to default values.

func UnattachHypha

func UnattachHypha(u *user.User, h hyphae.Hypha, lc *l18n.Localizer) (hop *history.Op, errtitle string)

UnattachHypha unattaches hypha and makes a history record about that.

func UploadBinary

func UploadBinary(h hyphae.Hypha, mime string, file multipart.File, u *user.User, lc *l18n.Localizer) (*history.Op, string)

UploadBinary edits the hypha's media part and makes a history record about that.

func UploadText

func UploadText(h hyphae.Hypha, data []byte, userMessage string, u *user.User, lc *l18n.Localizer) (hop *history.Op, errtitle string)

UploadText edits the hypha's text part and makes a history record about that.

func YieldHyphaNamesContainingString added in v1.3.0

func YieldHyphaNamesContainingString(query string) <-chan string

YieldHyphaNamesContainingString picks hyphae with have a string in their title, sorts and iterates over them.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL