aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2010-12-27 01:47:29 +0000
committerplegall <plg@piwigo.org>2010-12-27 01:47:29 +0000
commit5382fb218c2494a63e3971305d9ee010e7d7b737 (patch)
tree7661eb6a930574eaa526f831d0991a2f84d60f82
parent4bfcf8fdc1f44e6989799408581398c11789241d (diff)
feature 2087 added: use a checkbox in the installation screen for newsletter subscription
git-svn-id: http://piwigo.org/svn/trunk@8311 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--admin/themes/default/template/install.tpl53
-rw-r--r--install.php23
2 files changed, 57 insertions, 19 deletions
diff --git a/admin/themes/default/template/install.tpl b/admin/themes/default/template/install.tpl
index b915ce517..a8ea8edfb 100644
--- a/admin/themes/default/template/install.tpl
+++ b/admin/themes/default/template/install.tpl
@@ -14,7 +14,11 @@
{/if}
{/foreach}
-<script type="text/javascript" src="themes/default/js/jquery.min.js"></script>
+<!-- BEGIN get_combined_scripts -->
+{get_combined_scripts load='header'}
+<!-- END get_combined_scripts -->
+
+{combine_script id='jquery' path='themes/default/js/jquery.min.js'}
{literal}
<script type="text/javascript">
$(function() {
@@ -48,6 +52,10 @@ $(document).ready(function() {
window.open($(this).attr("href"));
return false;
});
+
+ $("#admin_mail").keyup(function() {
+ $(".adminEmail").text($(this).val());
+ });
});
</script>
@@ -146,6 +154,20 @@ input[type="text"]:focus, input[type="password"]:focus, select:focus {
</style>
{/literal}
+
+{combine_script id='jquery.cluetip' load='async' require='jquery' path='themes/default/js/plugins/jquery.cluetip.packed.js'}
+
+{footer_script require='jquery.cluetip'}
+jQuery().ready(function(){ldelim}
+ jQuery('.cluetip').cluetip({ldelim}
+ width: 300,
+ splitTitle: '|',
+ positionBy: 'bottomTop'
+ });
+});
+{/footer_script}
+
+
<title>Piwigo {$RELEASE} - {'Installation'|@translate}</title>
</head>
@@ -295,9 +317,19 @@ input[type="text"]:focus, input[type="password"]:focus, select:focus {
</tr>
<tr>
<td class="fieldname">{'Webmaster mail address'|@translate}</td>
- <td><input type="text" name="admin_mail" value="{$F_ADMIN_EMAIL}"></td>
+ <td><input type="text" name="admin_mail" id="admin_mail" value="{$F_ADMIN_EMAIL}"></td>
<td class="fielddesc">{'Visitors will be able to contact site administrator with this mail'|@translate}</td>
</tr>
+ <tr>
+ <td>{'Options'|@translate}</options>
+ <td colspan="2">
+<label>
+<input type="checkbox" name="newsletter_subscribe"{if $F_NEWSLETTER_SUBSCRIBE} checked="checked"{/if}>
+<span class="cluetip" title="{'Piwigo Announcements Newsletter'|@translate}|{'Keep in touch with Piwigo project, subscribe to Piwigo Announcement Newsletter. You will receive emails when a new release is available (sometimes including a security bug fix, it\'s important to know and upgrade) and when major events happen to the project. Only a few emails a year.'|@translate|htmlspecialchars|nl2br}">{'Subscribe %s to Piwigo Announcements Newsletter'|@translate|@sprintf:$EMAIL}</span>
+</label>
+<br>
+ </td>
+ </tr>
</table>
</fieldset>
@@ -310,21 +342,14 @@ input[type="text"]:focus, input[type="password"]:focus, select:focus {
<p>
<input type="button" name="Home" value="{'Visit Gallery'|@translate}" onClick="window.open('index.php');">
</p>
-
-{if !isset($migration)}
-<div class="infos">
- <ul>
- <li>{'Keep in touch with Piwigo project, subscribe to Piwigo Announcement Newsletter. You will receive emails when a new release is available (sometimes including a security bug fix, it\'s important to know and upgrade) and when major events happen to the project. Only a few emails a year.'|@translate}</li>
- </ul>
-</div>
-
-<p>
- <input type="button" name="subscribe" value="{'Subscribe %s'|@translate|@sprintf:$F_ADMIN_EMAIL}" onClick="window.open('{$SUBSCRIBE_BASE_URL}{$F_ADMIN_EMAIL}');">
-</p>
-{/if}
{/if}
</div> {* content *}
<div style="text-align: center">{$L_INSTALL_HELP}</div>
</div> {* the_page *}
+
+<!-- BEGIN get_combined_scripts -->
+{get_combined_scripts load='footer'}
+<!-- END get_combined_scripts -->
+
</body>
</html>
diff --git a/install.php b/install.php
index b8707655c..5850e9180 100644
--- a/install.php
+++ b/install.php
@@ -143,6 +143,12 @@ $admin_pass1 = (!empty($_POST['admin_pass1'])) ? $_POST['admin_pass1'] : '';
$admin_pass2 = (!empty($_POST['admin_pass2'])) ? $_POST['admin_pass2'] : '';
$admin_mail = (!empty($_POST['admin_mail'])) ? $_POST['admin_mail'] : '';
+$is_newsletter_subscribe = true;
+if (isset($_POST['install']))
+{
+ $is_newsletter_subscribe = isset($_POST['newsletter_subscribe']);
+}
+
$infos = array();
$errors = array();
@@ -381,6 +387,16 @@ INSERT INTO '.$prefixeTable.'config (param,value,comment)
array_keys($datas[0]),
$datas
);
+
+ if ($is_newsletter_subscribe)
+ {
+ fetchRemote(
+ get_newsletter_subscribe_base_url($language).$admin_mail,
+ $result,
+ array(),
+ array('origin' => 'installation')
+ );
+ }
}
}
@@ -410,6 +426,8 @@ $template->assign(
'F_DB_PREFIX' => $prefixeTable,
'F_ADMIN' => $admin_name,
'F_ADMIN_EMAIL' => $admin_mail,
+ 'EMAIL' => '<span class="adminEmail">'.$admin_mail.'</span>',
+ 'F_NEWSLETTER_SUBSCRIBE' => $is_newsletter_subscribe,
'L_INSTALL_HELP' => sprintf(l10n('Need help ? Ask your question on <a href="%s">Piwigo message board</a>.'), PHPWG_URL.'/forum'),
));
@@ -450,11 +468,6 @@ else
$user = build_user(1, true);
log_user($user['id'], false);
}
-
- $template->assign(
- 'SUBSCRIBE_BASE_URL',
- get_newsletter_subscribe_base_url($language)
- );
}
if (count($errors) != 0)
{