anchor.diff:  -export([manage/3]).
   
   
  +%% The datamodel manages parts of your datamodel. This includes
  +%% categories and predicates, but also "default data" like resources
  +%% and the menu.
  +%%
  +%% The data model maintains a special property on this installed data,
  +%% called 'installed_by'. This decides whether it can touch it.
  +%%
  +
   -include_lib("zotonic.hrl").
   
   
  
positive.code: manage_resources(_Module, [], _Context, Acc) ->
      {ok, Acc};
  manage_resources(Module, [R|Rest], Context, Acc) ->
      Id = manage_resource(Module, R, Context),
      manage_resources(Module, Rest, Context, [Id|Acc]).
  
  
  
  
negative.code:                 Module ->
                      %% Resource exists and has been installed by us.
                      %% FIXME Check if it needs updating!
                      case m_rsc:p(Id, managed_props, Context) of
                          Props ->
                              %% The props are equal, do nothing.
                              nothing;
                          _ ->
                              %% Different props, update it.
                              m_rsc:update(Id, [{managed_props, Props} | Props], Context)
                      end,
                      {ok, Id};
                  _ ->
                      %% Resource exists but is not installed by us!
  