Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 8 commits
  • 17 files changed
  • 0 commit comments
  • 1 contributor
View
7 NEWS
@@ -1,6 +1,13 @@
Welcome to Zotonic!
+Release 0.7.1, released on 2011-08-03
+-------------------------------------
+
+This is a bugfix release. See doc/changelogs/0.7.1.txt for all the
+relevant bugfixes.
+
+
Release 0.7.0, released on 2011-07-28
-------------------------------------
View
4 doc/ZotonicCommands.txt
@@ -60,8 +60,8 @@ granted CREATEDB in postgres as follows:
zotonic debug
-------------
Launch the Zotonic server interactively and get an EShell on the
-running instance. This command used to be called "./start.sh" in
-Zotonic 0.6 and earlier.
+running instance. There is a "start.sh" command in the root folder
+which is a shortcut for this command.
zotonic restart
View
15 doc/changelogs/0.7.1.txt
@@ -0,0 +1,15 @@
+Zotonic 0.7.1
+=============
+
+Released on 2011-08-03 13:17 by arjan.
+
+
+Arjan
+-----
+
+ * Documentation fixes and fixed wrapping of homepage links in the www.zotonic.com site
+ * Fixed the menu editor: Added resource_menu_admin_menu again which was removed by accident.
+ * Reworked the way mod_logging notifies the log pages; it now uses mod_signal.
+ * Fixed quality=xx parameter to {% image %}.
+ * Added mod_signal to the default list of installed modules.
+
View
4 doc/meta/DocumentationSnapshot.txt
@@ -1,9 +1,9 @@
-cd /tmp
+/cd /tmp
rm -rf zotonic-docs
mkdir zotonic-docs
cd zotonic-docs
httrack http://zotonic.com/
cd ..
-zip -r zotonic-html-documentation-20101003.zip zotonic-docs/
+zip -r zotonic-html-documentation-`date +"%Y%m%d"`.zip zotonic-docs/
and upload to google code.
View
2 include/zotonic_release.hrl
@@ -17,4 +17,4 @@
%% limitations under the License.
%% Release number
--define(ZOTONIC_VERSION, "0.7.0").
+-define(ZOTONIC_VERSION, "0.7.1").
View
41 modules/mod_logging/actions/action_logging_addlog.erl
@@ -0,0 +1,41 @@
+%% @author Arjan Scherpenisse <arjan@scherpenisse.net>
+%% @copyright 2010 Arjan Scherpenisse <arjan@scherpenisse.net>
+
+%% Copyright 2010 Arjan Scherpenisse <arjan@scherpenisse.net>
+%%
+%% Licensed under the Apache License, Version 2.0 (the "License");
+%% you may not use this file except in compliance with the License.
+%% You may obtain a copy of the License at
+%%
+%% http://www.apache.org/licenses/LICENSE-2.0
+%%
+%% Unless required by applicable law or agreed to in writing, software
+%% distributed under the License is distributed on an "AS IS" BASIS,
+%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+%% See the License for the specific language governing permissions and
+%% limitations under the License.
+
+-module(action_logging_addlog).
+-include("zotonic.hrl").
+-export([
+ render_action/4
+]).
+
+render_action(_TriggerId, TargetId, Args, Context) ->
+ SignalProps = proplists:get_value(signal_props, Args),
+ Type = proplists:get_value(type, SignalProps),
+
+ {Tpl, Context1} = z_template:render_to_iolist(proplists:get_value(template, Args, "_admin_log_row.tpl"), Args, Context),
+ Tpl2 = lists:flatten(z_string:line(erlang:iolist_to_binary(Tpl))),
+ {[], z_script:add_script([
+ "$('", z_utils:js_escape(Tpl2),
+ "').hide().insertBefore('#", TargetId, " li:first').fadeIn().css({backgroundColor:'",
+ log_color(Type), "'}).animate({backgroundColor:'",
+ log_color(bg), "'}, 8000, 'linear');"], Context1)}.
+
+
+log_color(debug) -> "#ffffff";
+log_color(info) -> "#ffff99";
+log_color(warning) -> "#ffcc99";
+log_color(bg) -> "#f1f1f1";
+log_color(_) -> "#f1f1f1".
View
51 modules/mod_logging/mod_logging.erl
@@ -29,9 +29,7 @@
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]).
-export([start_link/1]).
-export([
- add_admin_log_page/1,
observe_search_query/2,
- pid_observe_add_admin_log_page/3,
pid_observe_log/3
]).
@@ -42,16 +40,9 @@
%% interface functions
-add_admin_log_page(C=#context{page_pid=Pid}) ->
- z_notifier:first({add_admin_log_page, Pid}, C).
-
-
observe_search_query({search_query, Req, OffsetLimit}, Context) ->
search(Req, OffsetLimit, Context).
-pid_observe_add_admin_log_page(Pid, {add_admin_log_page, _Pid} = Msg, _Context) ->
- gen_server:call(Pid, Msg).
-
pid_observe_log(Pid, {log, #log_message{}=Msg}, Context) ->
case Msg#log_message.user_id of
undefined -> gen_server:cast(Pid, {log, Msg#log_message{user_id=z_acl:user(Context)}});
@@ -93,9 +84,6 @@ init(Args) ->
%% {stop, Reason, Reply, State} |
%% {stop, Reason, State}
%% Description: Handling call messages
-handle_call({add_admin_log_page, Pid}, _From, State) ->
- Pids = lists:filter(fun erlang:is_process_alive/1, [Pid|State#state.admin_log_pages]),
- {reply, ok, State#state{admin_log_pages=Pids}};
handle_call(Message, _From, State) ->
{stop, {unknown_call, Message}, State}.
@@ -159,7 +147,6 @@ search(_, _, _) ->
undefined.
-
%% @doc Insert a simple log entry. Send an update to all UA's displaying the log.
handle_simple_log(#log_message{user_id=UserId, type=Type, message=Msg, props=Props}, State) ->
{ok, Id} = z_db:insert(log, [
@@ -167,33 +154,7 @@ handle_simple_log(#log_message{user_id=UserId, type=Type, message=Msg, props=Pro
{type, Type},
{message, Msg}
] ++ Props, State#state.context),
-
- % Notify admins of any updates
- case State#state.admin_log_pages of
- [] ->
- nop;
- AdminPages ->
- case catch z_template:render_to_iolist("_admin_log_row.tpl", [{id, Id}], State#state.context) of
- {error, {template_not_found,"_admin_log_row.tpl",enoent}} ->
- % We can get a template_not_found error when the system is still starting.
- error;
- {error, Reason} ->
- error_logger:info_msg("[~p] Render error of _admin_log_row.tpl: ~p~n",
- [(State#state.context)#context.host, Reason]),
- error;
- {Tpl, _Ctx} ->
- Tpl2 = lists:flatten(z_string:line(erlang:iolist_to_binary(Tpl))),
- F = fun(Pid) ->
- z_session_page:add_script([
- "$('", z_utils:js_escape(Tpl2),
- "').hide().insertBefore('#log-area li:first').slideDown().css({backgroundColor:'",
- log_color(Type), "'}).animate({backgroundColor:'",
- log_color(bg), "'}, 8000, 'linear');"], Pid)
- end,
- [F(P) || P <- AdminPages],
- ok
- end
- end.
+ mod_signal:emit({log_message, [{log_id, Id}, {user_id, UserId}, {type, Type}, {message, Msg}, {props, Props}]}, State#state.context).
% All non #log_message{} logs are sent to their own log table. If the severity of the log entry is high enough then
@@ -209,7 +170,8 @@ handle_other_log(Record, State) ->
?LOG_FATAL -> handle_simple_log(Log#log_message{type=fatal}, State);
?LOG_ERROR -> handle_simple_log(Log#log_message{type=error}, State);
_Other -> nop
- end;
+ end,
+ mod_signal:emit({LogType, [{log_id, Id}|Fields]}, State#state.context);
false ->
Log = #log_message{
message=z_convert:to_binary(proplists:get_value(message, Fields, LogType)),
@@ -248,10 +210,3 @@ record_to_log_message(_, Fields, LogType, Id) ->
opt_user(undefined) -> [];
opt_user(Id) -> [" (", integer_to_list(Id), ")"].
-
-
-log_color(debug) -> "#ffffff";
-log_color(info) -> "#ffff99";
-log_color(warning) -> "#ffcc99";
-log_color(bg) -> "#f1f1f1";
-log_color(_) -> "#f1f1f1".
View
28 modules/mod_logging/scomps/scomp_logging_logwatch.erl
@@ -1,28 +0,0 @@
-%% @author Arjan Scherpenisse <arjan@scherpenisse.net>
-%% @copyright 2010 Arjan Scherpenisse <arjan@scherpenisse.net>
-
-%% Copyright 2010 Arjan Scherpenisse <arjan@scherpenisse.net>
-%%
-%% Licensed under the Apache License, Version 2.0 (the "License");
-%% you may not use this file except in compliance with the License.
-%% You may obtain a copy of the License at
-%%
-%% http://www.apache.org/licenses/LICENSE-2.0
-%%
-%% Unless required by applicable law or agreed to in writing, software
-%% distributed under the License is distributed on an "AS IS" BASIS,
-%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-%% See the License for the specific language governing permissions and
-%% limitations under the License.
-
--module(scomp_logging_logwatch).
--behaviour(gen_scomp).
-
--export([vary/2, render/3]).
-
--include("zotonic.hrl").
-
-vary(_Params, _Context) -> nocache.
-render(_Params, _Vars, Context) ->
- mod_logging:add_admin_log_page(Context),
- {ok, []}.
View
2 modules/mod_logging/templates/_admin_log_row.tpl
@@ -1,3 +1,4 @@
+{% with signal_props.log_id|default:id as id %}
{% with m.log[id] as l %}
<li id="{{ #li.id }}" class="clearfix">
<span class="zp-5">{{ l.type|default:"-" }}</span>
@@ -21,3 +22,4 @@
<span class="zp-10">{{ l.created|date:"d M Y, H:i" }}</span>
</li>
{% endwith %}
+{% endwith %}
View
3 modules/mod_logging/templates/admin_log.tpl
@@ -35,5 +35,6 @@
</div>
{% endwith %}
- {% logwatch %}
+ {% wire action={connect signal={log_message} action={addlog target="log-area"}} %}
+
{% endblock %}
View
1 modules/mod_menu/mod_menu.erl
@@ -146,7 +146,6 @@ menu_flat(undefined, _Context) ->
menu_flat(<<>>, _Context) ->
[];
menu_flat(X, Context) ->
- ?DEBUG(X),
menu_flat(X, [1], [], Context).
menu_flat([], _Path, Acc, _Context) ->
View
128 modules/mod_menu/resources/resource_menu_admin_menu.erl
@@ -0,0 +1,128 @@
+%% @author Marc Worrell <marc@worrell.nl>
+%% @copyright 2009 Marc Worrell
+%% @doc Callbacks for editing the menu.
+
+%% Copyright 2009 Marc Worrell
+%%
+%% Licensed under the Apache License, Version 2.0 (the "License");
+%% you may not use this file except in compliance with the License.
+%% You may obtain a copy of the License at
+%%
+%% http://www.apache.org/licenses/LICENSE-2.0
+%%
+%% Unless required by applicable law or agreed to in writing, software
+%% distributed under the License is distributed on an "AS IS" BASIS,
+%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+%% See the License for the specific language governing permissions and
+%% limitations under the License.
+
+-module(resource_menu_admin_menu).
+-author("Marc Worrell <marc@worrell.nl>").
+
+-export([
+ event/2,
+ test/0
+]).
+
+-include("zotonic.hrl").
+
+event({drop, {dragdrop, ["new", Id], _, _DragEltId}, {dragdrop, [MenuId, "first"], _, _DropEltId}}, Context) ->
+ mod_menu:set_menu(MenuId, [{Id, []}], Context),
+ Html = z_template:render("_admin_menu_menu_view.tpl", [{id, MenuId}], Context),
+ z_render:update("menu-editor", Html, Context);
+
+event({drop, {dragdrop, DragTag, _, _DragEltId}, {dragdrop, [MenuId, "before", TP], _, _DropEltId}}, Context) ->
+ TargetPath = lists:reverse(TP),
+ Menu = mod_menu:get_menu(MenuId, Context),
+ Menu2 = case DragTag of
+ ["new", NewId] ->
+ insert_menuitem(Menu, {NewId, []}, TargetPath);
+ Path ->
+ SourcePath = lists:reverse(Path),
+ MenuItem = get_menuitem(Menu, SourcePath),
+ Menu1 = delete_path(Menu, SourcePath),
+ TargetPath1 = path_after_delete(TargetPath, SourcePath),
+ insert_menuitem(Menu1, MenuItem, TargetPath1)
+ end,
+ mod_menu:set_menu(MenuId, Menu2, Context),
+ Html = z_template:render("_admin_menu_menu_view.tpl", [{id, MenuId}], Context),
+ z_render:update("menu-editor", Html, Context);
+
+event({drop, {dragdrop, DragTag, _, _DragEltId}, {dragdrop, [MenuId, "on", TargetPath], _, _DropEltId}}, Context) ->
+ event({drop, {dragdrop, DragTag, x, x}, {dragdrop, [MenuId, "before", [1|TargetPath]], x, x}}, Context);
+
+event({postback, {delete, Props}, _TriggerId, _TargetId}, Context) ->
+ MenuId = proplists:get_value(menu_id, Props),
+ Path = lists:reverse(proplists:get_value(path, Props)),
+ Menu = mod_menu:get_menu(MenuId, Context),
+ Menu1 = delete_path(Menu, Path),
+ mod_menu:set_menu(MenuId, Menu1, Context),
+ Html = z_template:render("_admin_menu_menu_view.tpl", [{id, MenuId}], Context),
+ z_render:update("menu-editor", Html, Context);
+
+event(_Event, Context) ->
+ Context.
+
+
+delete_path(Menu, Path) ->
+ delete_path(Menu, Path, []).
+delete_path([_|Rest], [1], Acc) ->
+ lists:reverse(Acc) ++ Rest;
+delete_path([Item|Rest], [Idx], Acc) ->
+ delete_path(Rest, [Idx-1], [Item|Acc]);
+delete_path([{Id,SubMenu}|Rest], [1|Path], Acc) ->
+ lists:reverse(Acc)
+ ++ [{Id, delete_path(SubMenu, Path)} | Rest];
+delete_path([Item|Menu], [Idx|Path], Acc) ->
+ delete_path(Menu, [Idx-1|Path], [Item|Acc]).
+
+
+get_menuitem([Item|_Menu], [1]) ->
+ Item;
+get_menuitem([_Item|Menu], [Idx]) ->
+ get_menuitem(Menu, [Idx-1]);
+get_menuitem([{_, SubMenu}|_Rest], [1|PathRest]) ->
+ get_menuitem(SubMenu, PathRest);
+get_menuitem([_|Rest], [Idx|PathRest]) ->
+ get_menuitem(Rest, [Idx-1|PathRest]).
+
+
+insert_menuitem(Menu, Item, DestPath) ->
+ insert_menuitem(Menu, Item, DestPath, []).
+insert_menuitem(Menu, Item, [1], Acc) ->
+ lists:reverse(Acc) ++ [Item | Menu];
+insert_menuitem([First|Rest], Item, [Idx], Acc) ->
+ insert_menuitem(Rest, Item, [Idx-1], [First|Acc]);
+insert_menuitem([{Id, SubMenu} | MenuRest], Item, [1|Path], Acc) ->
+ lists:reverse(Acc)
+ ++ [{Id, insert_menuitem(SubMenu, Item, Path, [])} | MenuRest];
+insert_menuitem([MenuItem|MenuRest], Item, [Idx|Path], Acc) ->
+ insert_menuitem(MenuRest, Item, [Idx-1|Path], [MenuItem|Acc]).
+
+
+path_after_delete(Path, DeletePath) ->
+ path_after_delete(Path, DeletePath, []).
+path_after_delete([], _, Acc) ->
+ lists:reverse(Acc);
+path_after_delete(Path, [], Acc) ->
+ lists:reverse(Acc) ++ Path;
+path_after_delete([X|Rest], [Y|Rest2], Acc) when X > Y ->
+ path_after_delete(Rest, Rest2, [X-1|Acc]);
+path_after_delete([X|Rest], [_|Rest2], Acc) ->
+ path_after_delete(Rest, Rest2, [X|Acc]).
+
+
+test() ->
+ [foo] = insert_menuitem([], foo, [1]),
+ [foo, bar] = insert_menuitem([bar], foo, [1]),
+ [bar, foo, baz] = insert_menuitem([bar, baz], foo, [2]),
+ [bar, baz, foo] = insert_menuitem([bar, baz], foo, [3]),
+ [{x, [foo]}, {y, []}] = insert_menuitem([{x, []}, {y, []}], foo, [1, 1]),
+ [{x, []}, {y, [foo]}] = insert_menuitem([{x, []}, {y, []}], foo, [2, 1]),
+ [{x, []}, {y, [{z, [bleh, foo]}]}] = insert_menuitem([{x, []}, {y, [{z, [bleh]}]}], foo, [2, 1, 2]),
+
+ [b] = delete_path([a, b], [1]),
+ [a] = delete_path([a, b], [2]),
+
+ [a, {b, []}, c] = delete_path([a, {b, [x]}, c], [2, 1]),
+ [a, {b, [x]}, c] = delete_path([a, {b, [x,y]}, c], [2, 2]).
View
5 modules/mod_signal/z_connect.erl
@@ -57,9 +57,10 @@ receive_loop(SignalPrototype, Actions, ConnectorContext) ->
% @doc Render the actions and send the scripts to the page connected to the signal.
%
render_page_actions(Signal, Actions, Context) ->
- Actions1 = [ {Name, [ {signal, Signal} | Props ] } || {Name, Props} <- Actions],
+ {_, SignalProps} = Signal,
+ Actions1 = [ {Name, [ {signal, Signal}, {signal_props, SignalProps} | Props ] } || {Name, Props} <- Actions],
Options = [{action, X} || X <- Actions1],
-
+
%% What parameters should be used here?
Script = z_script:get_script(z_render:wire(undefined, undefined, {event, Options}, Context)),
View
6 priv/sites/zotonicwww/lib/css/zp-project.css
@@ -230,14 +230,16 @@ header {
.home #banner #download-zotonic {
position: absolute;
- right: 63px;
+ left: 625px;
top: 40px;
+ width: 350px;
}
.home #banner #docs-zotonic {
position: absolute;
- right: 9px;
+ left: 625px;
top: 170px;
+ width: 350px;
}
.home #banner #download-zotonic a,
View
10 src/install/z_install_data.erl
@@ -57,31 +57,27 @@ install_modules(Host, C) ->
?DEBUG("Inserting modules"),
Modules = [
"mod_base",
- "mod_emailer",
"mod_menu",
"mod_oauth",
"mod_search",
"mod_video_embed",
"mod_atom_feed",
- "mod_broadcast",
"mod_translation",
- "mod_log",
+ "mod_signal",
+ "mod_logging",
"mod_seo",
"mod_seo_google",
"mod_seo_sitemap",
"mod_authentication",
- "mod_acl_adminonly",
+ "mod_acl_adminonly",
"mod_admin",
- "mod_admin_address",
"mod_admin_category",
"mod_admin_config",
- "mod_admin_event",
"mod_admin_identity",
"mod_admin_modules",
- "mod_admin_person",
"mod_admin_predicate",
%% Enable comments
View
17 src/support/z_media_preview.erl
@@ -36,9 +36,6 @@
-define(MAX_WIDTH, 5000).
-define(MAX_HEIGHT, 5000).
--define(PIX100, 1000).
--define(PIX50, 250000).
-
-include_lib("zotonic.hrl").
@@ -147,14 +144,10 @@ cmd_args(FileProps, Filters, OutMime) ->
{resize, ResizeWidth, ResizeHeight, is_enabled(upscale, Filters)},
{crop, CropArgs},
{colorspace, "RGB"} | Filters1],
- Filters2b = case {CropArgs,is_enabled(extent, Filters)} of
+ Filters3 = case {CropArgs,is_enabled(extent, Filters)} of
{none,true} -> Filters2 ++ [{extent, ReqWidth, ReqHeight}];
_ -> Filters2
end,
- Filters3 = case OutMime of
- "image/jpg" -> Filters2b ++ [quality];
- _ -> Filters2b
- end,
Filters4 = case is_blurred(Filters3) of
true -> Filters3;
false -> case Mime of
@@ -293,13 +286,7 @@ filter2arg(sharpen_small, Width, Height) ->
{Width, Height, []};
filter2arg(lossless, Width, Height) ->
{Width, Height, []};
-filter2arg(quality, Width, Height) ->
- Pix = Width * Height,
- Q = if
- Pix < ?PIX100 -> 100;
- Pix > ?PIX50 -> 50;
- true -> 100 - round(50 * (Pix - ?PIX100) / (?PIX50 - ?PIX100))
- end,
+filter2arg({quality, Q}, Width, Height) ->
{Width,Height, ["-quality ",integer_to_list(Q)]};
filter2arg({removebg, Fuzz}, Width, Height) ->
{Width, Height, ["-matte -fill none -fuzz ", integer_to_list(Fuzz), "% ",
View
2 src/zotonic.app
@@ -1,6 +1,6 @@
{application, zotonic,
[{description, "zotonic"},
- {vsn, "0.7.0"},
+ {vsn, "0.7.1"},
{modules, [
zotonic,
zotonic_app,

No commit comments for this range

Something went wrong with that request. Please try again.