Skip to content

Commit

Permalink
Changes to the admin_edit.
Browse files Browse the repository at this point in the history
Moved the sidebar to catinclude, and changed templates in modules accordingly.
Also a few new functions in m_identity.
  • Loading branch information
Arjan Scherpenisse committed Dec 10, 2009
1 parent 38eebdc commit 41af1b3
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 21 deletions.
2 changes: 1 addition & 1 deletion modules/mod_admin/templates/admin_edit.tpl
Expand Up @@ -281,7 +281,7 @@
</div>
</div>

{% all include "_admin_edit_sidebar.tpl" %}
{% all catinclude "_admin_edit_sidebar.tpl" id %}

{% if not r.is_a.meta %}
<div class="item-wrapper" id="sort-date">
Expand Down
@@ -1,5 +1,3 @@
{% if m.rsc[id].is_a.artist %}

<div class="item-wrapper" id="sort-user-credentials">
<h3 class="above-item clearfix do_blockminifier">
<span class="title">Events for this artist</span>
Expand Down Expand Up @@ -33,5 +31,3 @@
</div>
</div>
</div>

{% endif %}
@@ -1,5 +1,4 @@
{% if r.is_a.group %}
{% with m.group[r.id] as g %}
{% with m.group[r.id] as g %}
<div class="item-wrapper">
<h3 class="above-item clearfix do_blockminifier { minifiedOnInit: false }">
<span class="title">Additional site wide rights</span>
Expand Down Expand Up @@ -53,5 +52,4 @@
</fieldset>
</div>
</div>
{% endwith %}
{% endif %}
{% endwith %}
@@ -1,5 +1,3 @@
{% if m.rsc[id].is_a.group %}

{% sortable id="sort-group_members" %}

<div class="item-wrapper" id="sort-group_members">
Expand All @@ -20,5 +18,3 @@
{% button text="View group members" action={redirect dispatch="admin_group_members" id=id} %}
</div>
</div>

{% endif %}
@@ -1,5 +1,4 @@
{% if r.is_a.predicate %}
{% with m.predicate[id] as p %}
{% with m.predicate[id] as p %}
<div class="item-wrapper">
<h3 class="above-item clearfix do_blockminifier { minifiedOnInit: false }">
<span class="title">Valid between</span>
Expand Down Expand Up @@ -51,5 +50,4 @@
</fieldset>
</div>
</div>
{% endwith %}
{% endif %}
{% endwith %}
@@ -1,4 +1,3 @@
{% if r.is_a.mailinglist %}
<div class="item-wrapper">
<h3 class="above-item clearfix do_blockminifier { minifiedOnInit: false }">
<span class="title">Mailing list</span>
Expand Down Expand Up @@ -44,4 +43,3 @@
</div>
</div>
</div>
{% endwith %}
21 changes: 19 additions & 2 deletions src/models/m_identity.erl
Expand Up @@ -35,7 +35,14 @@
set_username_pw/4,
check_username_pw/3,
hash/1,
hash_is_equal/2
hash_is_equal/2,
get_rsc/2,
get_rsc/3,

lookup_by_type_and_key/3,

insert/4,
delete/2
]).

-include_lib("zotonic.hrl").
Expand Down Expand Up @@ -176,7 +183,7 @@ get_rsc(Id, Context) ->
z_db:assoc("select * from identity where rsc_id = $1", [Id], Context).

get_rsc(Id, Type, Context) ->
z_db:assoc_row("select * from identity where rsc_id = $1 and type = '$2'", [Id, Type], Context).
z_db:assoc_row("select * from identity where rsc_id = $1 and type = $2", [Id, Type], Context).


%% @doc Hash a password, using sha1 and a salt
Expand All @@ -195,3 +202,13 @@ hash_is_equal(Pw, {hash, Salt, Hash}) ->
hash_is_equal(_, _) ->
false.

%% @doc Create an identity record.
insert(RscId, Type, Key, Context) ->
Props = [{rsc_id, RscId}, {type, Type}, {key, Key}],
z_db:insert(identity, Props, Context).

delete(IdnId, Context) ->
z_db:delete(identity, IdnId, Context).

lookup_by_type_and_key(Type, Key, Context) ->
z_db:assoc_row("select * from identity where type = $1 and key = $2", [Type, Key], Context).

0 comments on commit 41af1b3

Please sign in to comment.