m_rsc_update (zotonic_core v1.0.0-rc.11)

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

Link to this section Summary

Functions

Delete a resource
Delete a resource, no check on rights etc is made. This is called by m_category:delete/3
Duplicate a resource, creating a new resource with the given title.
Insert a new resource. Crashes when insertion is not allowed.
Merge two resources, delete the losing resource.
Update a resource

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.

Link to this section Functions

Link to this function

delete(Id, Context)

-spec delete(m_rsc:resource(), z:context()) -> ok | {error, atom()}.
Delete a resource
Link to this function

delete(Id, FollowUpId, Context)

-spec delete(m_rsc:resource(), m_rsc:resource(), z:context()) -> ok | {error, atom()}.
Link to this function

delete_nocheck(Id, Context)

-spec delete_nocheck(m_rsc:resource(), z:context()) -> ok | {error, atom()}.
Delete a resource, no check on rights etc is made. This is called by m_category:delete/3
Link to this function

duplicate(Id, DupProps, Context)

-spec duplicate(m_rsc:resource(), m_rsc:props_all(), z:context()) ->
             {ok, m_rsc:resource_id()} | {error, term()}.
Duplicate a resource, creating a new resource with the given title.
Link to this function

duplicate(Id, DupProps, DupOpts, Context)

-spec duplicate(m_rsc:resource(), m_rsc:props_all(), m_rsc:duplicate_options(), z:context()) ->
             {ok, m_rsc:resource_id()} | {error, term()}.
Link to this function

flush(Id, Context)

Link to this function

insert(Props, Context)

-spec insert(m_rsc:props_all(), z:context()) -> {ok, m_rsc:resource_id()} | {error, term()}.
Insert a new resource. Crashes when insertion is not allowed.
Link to this function

insert(Props, Options, Context)

-spec insert(m_rsc:props_all(), list(), z:context()) -> {ok, m_rsc:resource_id()} | {error, term()}.
Link to this function

merge_delete(WinnerId, LoserId, Options, Context)

-spec merge_delete(m_rsc:resource(), m_rsc:resource(), list(), #context{}) -> ok | {error, term()}.
Merge two resources, delete the losing resource.
Link to this function

update(Id, Props, Context)

-spec update(m_rsc:resource() | insert_rsc, m_rsc:props_all() | m_rsc:update_function(), z:context()) ->
          {ok, m_rsc:resource_id()} | {error, term()}.
Update a resource
Link to this function

update(Id, Props, Options, Context)

-spec update(m_rsc:resource() | insert_rsc,
       m_rsc:props_all() | m_rsc:update_function(),
       list() | boolean(),
       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.