Copyright © 2009 Marc Worrell
Behaviours: gen_model.
Authors: Marc Worrell (marc@worrell.nl).
delete/2 | Delete a resource. |
duplicate/3 | Duplicate a resource. |
exists/2 | |
get/2 | Read a whole resource. |
get_acl_props/2 | Get the ACL fields for the resource with the id. |
get_raw/2 | Get the resource from the database, do not fetch the pivot fields. |
insert/2 | Insert a new resource. |
is_a/2 | Return the categories and the inherited categories of the resource. |
is_a/3 | Check if the resource is in a categorie. |
is_a_id/2 | Return the categories and the inherited categories of the resource. |
is_cat/3 | Check if the resource is exactly the category. |
is_deletable/2 | |
is_editable/2 | |
is_me/2 | |
is_visible/2 | |
m_find_value/3 | Fetch the value for the key from a model source. |
m_to_list/2 | Transform a m_config value to a list, used for template loops. |
m_value/2 | Transform a model value so that it can be formatted or piped through filters. |
media/2 | |
name_lookup/2 | Return the id of the resource with a certain unique name. |
name_to_id/2 | Return the id of the resource with the name. |
name_to_id_cat/3 | |
name_to_id_cat_check/3 | |
name_to_id_check/2 | |
o/2 | |
o/3 | |
o/4 | |
op/2 | |
p/3 | Fetch a property from a resource. |
p/4 | |
p_no_acl/3 | Fetch a property from a resource, no ACL check is done. |
page_path_to_id/2 | |
page_url/2 | |
rid/2 | Fetch a resource id from any input. |
s/2 | |
s/3 | |
s/4 | |
sp/2 | |
touch/2 | "Touch" the rsc, incrementing the version nr and the modification date/ modifier_id. |
update/3 | Update a resource. |
uri_lookup/2 | Return the id of the resource with a certain uri. |
delete(Id::Props, Context) -> ok | {error, Reason}
Delete a resource
duplicate(Id, Props, Context) -> {ok, NewId} | {error, Reason}
Duplicate a resource.
exists(Name, Context) -> any()
get(Id, Context) -> PropList | undefined
Read a whole resource
get_acl_props(Id, Context::#context{}) -> #acl_props{}
Get the ACL fields for the resource with the id. The id must be an integer
get_raw(Id, Context) -> any()
Get the resource from the database, do not fetch the pivot fields.
insert(Props, Context) -> {ok, Id} | {error, Reason}
Insert a new resource
is_a(Id::int(), Context) -> list()
Return the categories and the inherited categories of the resource. Returns a list with category atoms
is_a(Id::int(), Cat::atom(), Context) -> bool()
Check if the resource is in a categorie.
is_a_id(Id::int(), Context) -> list()
Return the categories and the inherited categories of the resource. Returns a list with category ids
is_cat(Id, Cat, Context) -> any()
Check if the resource is exactly the category
is_deletable(Id, Context) -> any()
is_editable(Id, Context) -> any()
is_me(Id, Context) -> any()
is_visible(Id, Context) -> any()
m_find_value(Id::Key, M::Source, Context) -> term()
Fetch the value for the key from a model source
m_to_list(M::Source, Context) -> List
Transform a m_config value to a list, used for template loops
m_value(M::Source, Context) -> term()
Transform a model value so that it can be formatted or piped through filters
media(Id, Context) -> any()
name_lookup(Name, Context) -> any()
Return the id of the resource with a certain unique name. name_lookup(Name, Context) -> int() | undefined
name_to_id(Name::NameString, Context) -> {ok, int()} | {error, Reason}
Return the id of the resource with the name
name_to_id_cat(Name, Cat, Context) -> any()
name_to_id_cat_check(Name, Cat, Context) -> any()
name_to_id_check(Name, Context) -> any()
o(Id, Context) -> any()
o(Id, Predicate, Context) -> any()
o(Id, Predicate, N, Context) -> any()
op(Id, Context) -> any()
p(Id, Property, Context) -> any()
Fetch a property from a resource. When the rsc does not exist, the property does not exist or the user does not have access rights to the property then return 'undefined'. p(ResourceId, atom(), Context) -> term() | undefined
p(Id, Property, DefaultValue, Context) -> any()
p_no_acl(Id, Predicate, Context) -> any()
Fetch a property from a resource, no ACL check is done.
page_path_to_id(Path, Context) -> any()
page_url(Id, Context) -> any()
rid(Id, Context) -> any()
Fetch a resource id from any input
s(Id, Context) -> any()
s(Id, Predicate, Context) -> any()
s(Id, Predicate, N, Context) -> any()
sp(Id, Context) -> any()
touch(Id, Context) -> {ok, Id} | {error, Reason}
"Touch" the rsc, incrementing the version nr and the modification date/ modifier_id. This should be called as part of another update or transaction and does not resync the caches, and does not check the ACL. After "touching" the resource will be re-pivoted.
update(Id, Props, Context) -> {ok, Id} | {error, Reason}
Update a resource
uri_lookup(Uri, Context) -> any()
Return the id of the resource with a certain uri. uri_lookup(string(), Context) -> int() | undefined
Generated by EDoc, Feb 25 2011, 21:14:42.