Module m_rsc_update

Update routines for resources.

Copyright © 2009-2020 Marc Worrell, Arjan Scherpenisse

Authors: Marc Worrell (marc@worrell.nl).

Description

Update routines for resources. For use by the m_rsc module.

Function Index

delete/2Delete a resource.
delete/3
delete_nocheck/2Delete a resource, no check on rights etc is made.
duplicate/3Duplicate a resource, creating a new resource with the given title.
flush/2
insert/2Insert a new resource.
insert/3
merge_delete/4Merge two resources, delete the losing resource.
to_slug/1
update/3Update a resource.
update/4Update a resource.

Function Details

delete/2

delete(Id::m_rsc:resource(), Context::z:context()) -> ok | {error, atom()}

Delete a resource

delete/3

delete(Id::m_rsc:resource(), FollowUpId::m_rsc:resource(), Context::z:context()) -> ok | {error, atom()}

delete_nocheck/2

delete_nocheck(Id::m_rsc:resource(), Context::z:context()) -> ok | {error, atom()}

Delete a resource, no check on rights etc is made. This is called by m_category:delete/3

duplicate/3

duplicate(Id::m_rsc:resource(), DupProps::m_rsc:props_all(), Context::z:context()) -> {ok, m_rsc:resource_id()} | {error, term()}

Duplicate a resource, creating a new resource with the given title.

flush/2

flush(Id, Context) -> any()

insert/2

insert(Props::m_rsc:props_all(), Context::z:context()) -> {ok, m_rsc:resource_id()} | {error, term()}

Insert a new resource. Crashes when insertion is not allowed.

insert/3

insert(Props::m_rsc:props_all(), Options::list(), Context::z:context()) -> {ok, m_rsc:resource_id()} | {error, term()}

merge_delete/4

merge_delete(WinnerId::m_rsc:resource(), LoserId::m_rsc:resource(), Options::list(), Context::#context{}) -> ok | {error, term()}

Merge two resources, delete the losing resource.

to_slug/1

to_slug(Trans) -> any()

update/3

update(Id::m_rsc:resource() | insert_rsc, Props::m_rsc:props_all() | m_rsc:update_function(), Context::z:context()) -> {ok, m_rsc:resource_id()} | {error, term()}

Update a resource

update/4

update(Id::m_rsc:resource() | insert_rsc, Props::m_rsc:props_all() | m_rsc:update_function(), Options::list() | boolean(), Context::z:context()) -> {ok, m_rsc:resource_id()} | {error, term()}

Update a resource. Options flags: is_escape_texts (default: true} is_acl_check (default: true) no_touch (default: false) is_import (default: false) Other options: tz - timezone for date conversions expected - list with property value pairs that are expected, fail if the properties are different.

{is_escape_texts, false} checks if the texts are escaped, and if not then it will escape. This prevents "double-escaping" of texts.


Generated by EDoc