Arjan Scherpenisse  committed 6bb053a

Tweaks to zotonicversion reporting

- On site startup, update database "zotonic.version" value with
actual software version.

- Put zotonic version in footer of the blog skeleton, and no longer
in the default data.

- Prevent editing "zotonic.*" config values in the admin.

  • Participants
  • Parent commits bf38233

Comments (0)

Files changed (5)

File modules/mod_admin_config/templates/admin_config.tpl

 								<span class="zp-10">
 									{% button text="delete" disabled=(module=="zotonic") action={dialog_config_delete module=module key=key on_success={slide_fade_out}} %}
-									{% button text="edit" action={dialog_config_edit module=module key=key on_success={reload}} %}
+									{% button text="edit" disabled=(module=="zotonic") action={dialog_config_edit module=module key=key on_success={reload}} %}
 							{% wire action={dialog_config_edit module=module key=key on_success={reload}} %}
 {% endwith %}
-{% endblock %}
+{% endblock %}

File priv/skel/blog/templates/base.tpl

         <footer class="clearfix">
 			<nav class="left">{% menu id=id menu_id='footer_menu' %}</nav>
 			<section class="right">
-				<p class="footer-blog-title">Website powered by <a href="">Zotonic</a>, the Erlang CMS.</p>
+				<p class="footer-blog-title">Website powered by <a href="">Zotonic</a> {{ m.config.zotonic.version.value }}.</p>

File src/install/z_install_data.erl

     ?DEBUG("Inserting config keys"),
     {ok, 1} = pgsql:equery(C, 
         "insert into config (module, key, value, props, modified) values ($1, $2, $3, $4, now())", 
-        ["zotonic", "version", ?ZOTONIC_VERSION, []]),
-    {ok, 1} = pgsql:equery(C, 
-        "insert into config (module, key, value, props, modified) values ($1, $2, $3, $4, now())", 
         ["i18n", "language", "en", []]),
     pgsql:reset_id(C, "config"),

File src/install/z_install_defaultdata.erl

-        [{title, <<"Welcome to Zotonic " ?ZOTONIC_VERSION "!">>},
+        [{title, <<"Welcome to Zotonic!">>},
          {publication_start, Now},
          {summary, <<"Zotonic is the content management system for people that want a fast, extensible, flexible and complete system for dynamic web sites. It is built from the ground up with rich internet applications ánd web publishing in mind.">>},
          {body, {file, datafile(blog, "welcome.html")}}

File src/support/z_site_startup.erl

 %% @spec start_link(SiteProps::proplist()) -> ignore
 %% @doc Perform all site startup routines.
 start_link(SiteProps) ->
     % Load all translations
     spawn(fun() -> z_trans_server:load_translations(Context) end),
+    % Put software version in database
+    % @todo Check if current version != database version and run upgrader (and downgrader?)
+    m_config:set_value(zotonic, version, ?ZOTONIC_VERSION, Context),
     % Let the module handle their startup code, the whole site is now up and running.
     z_notifier:notify(site_startup, Context),