updated uc_termsofservice, session_limit
This commit is contained in:
parent
08127672d6
commit
86c993f638
@ -1,13 +1,15 @@
|
||||
-- Ubercart Terms of Service --
|
||||
This module allows the administrator of a Ubercart Shop to add a check of
|
||||
Terms of Service (ToS) in the Checkout pane or in the Cart pane.
|
||||
Ubercart Terms of Service
|
||||
=========================
|
||||
This module allows the administrator of a Ubercart Shop to display
|
||||
Terms of Service (ToS) in the Checkout pane or in the Cart pane, and require
|
||||
the customer to agree to these terms before purchase.
|
||||
|
||||
-- Installation --
|
||||
Just enable the module, cart module and checkout module of ubercart are
|
||||
required.
|
||||
Installation
|
||||
============
|
||||
Just enable the module. Ubercart Cart and Checkout modules are required.
|
||||
The configuration of this module is merged into the Ubercart pane settings.
|
||||
You can configure the options for checkout in panes' checkout configuration
|
||||
page (admin/store/settings/checkout/edit/panes) and for cart in panes' cart
|
||||
page (admin/store/settings/checkout/edit/panes) and for cart in pane's cart
|
||||
configuration page (admin/store/settings/cart/edit/panes).
|
||||
|
||||
Options available for configuration:
|
||||
@ -17,33 +19,37 @@ Options available for configuration:
|
||||
- In case of checkout, if the ToS is required or not.
|
||||
- Cart pane can't be required.
|
||||
- If ModalFrame API is present, you can also select if the ToS is displayed in
|
||||
a popup window and its size.
|
||||
- You can configure conditional actions so the checkout pane is only displayed
|
||||
when there is one product from a given class.
|
||||
a popup window and its size.
|
||||
- You can configure Rules so the checkout pane is only displayed when there is
|
||||
one product from a given class.
|
||||
|
||||
Multilanguage is supported through the Translation module. You can translate the
|
||||
ToS node and the correct translation will be displayed depending of the language.
|
||||
Multilanguage is supported through the Translation module. You can translate
|
||||
the ToS node and the correct translation will be displayed depending of the
|
||||
language.
|
||||
|
||||
-- ToS in js popup --
|
||||
ToS in JavaScript popup
|
||||
=======================
|
||||
You can enable the ModalFrame API (http://drupal.org/project/modalframe) module
|
||||
in order to have the Terms of Service opened in a js popup window, you can
|
||||
accept the ToS from this window.
|
||||
You can disable the popup option in the settings of the module.
|
||||
accept the ToS from this window. You can disable the popup option in the
|
||||
settings of the module.
|
||||
|
||||
-- Theming & ToS text --
|
||||
Theming & ToS text
|
||||
==================
|
||||
You can theme both form and ToS text from two tpl files included with this
|
||||
module and a css file, just copy those tpl files in your theme and modify the
|
||||
text, structure or css.
|
||||
By default, the node body will be displayed.
|
||||
text, structure or css. By default, the node body will be displayed.
|
||||
|
||||
-- Conditional Actions --
|
||||
You can configure conditional actions to display the Terms of Service in the
|
||||
Rules
|
||||
=====
|
||||
You can configure the Rules module to display the Terms of Service in the
|
||||
checkout only if a product from a given product class or content type is
|
||||
present. The admin url for this is
|
||||
present. The admin url for this is :
|
||||
admin/store/ca/uc_termsofservice_display_pane/edit/conditions
|
||||
You can also add extra conditions and actions.
|
||||
|
||||
-- Know Issues --
|
||||
Know Issues
|
||||
===========
|
||||
The ToS can be placed as a cart pane, but then it won't be required.
|
||||
If you are using Secure Pages for a version of the checkout in SSL, you should
|
||||
add uc_termsofservice/* to the Secure Pages settings.
|
||||
@ -51,5 +57,3 @@ add uc_termsofservice/* to the Secure Pages settings.
|
||||
If you need a previous agreement checkbox, i.e. in the registration of the
|
||||
users, please take a look to the Legal (http://drupal.org/project/legal) or
|
||||
Terms of Service (http://drupal.org/project/terms_of_use) module.
|
||||
|
||||
Module supported by Neurotic (http://www.neurotic.es)
|
||||
|
@ -5,9 +5,9 @@ dependencies[] = uc_cart
|
||||
package = Ubercart - extra
|
||||
core = 7.x
|
||||
|
||||
; Information added by drupal.org packaging script on 2013-10-19
|
||||
version = "7.x-1.0-beta1+1-dev"
|
||||
; Information added by Drupal.org packaging script on 2016-04-03
|
||||
version = "7.x-1.0-beta1+3-dev"
|
||||
core = "7.x"
|
||||
project = "uc_termsofservice"
|
||||
datestamp = "1382149680"
|
||||
datestamp = "1459648442"
|
||||
|
||||
|
@ -17,8 +17,7 @@ function uc_termsofservice_uninstall() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Renames uc_termsofservice_checkout_ca to uc_termsofservice_checkout_rules
|
||||
* for D7.
|
||||
* Renames uc_termsofservice_checkout_ca to uc_termsofservice_checkout_rules.
|
||||
*/
|
||||
function uc_termsofservice_update_7100() {
|
||||
variable_set('uc_termsofservice_checkout_rules',
|
||||
|
@ -296,25 +296,17 @@ function uc_termsofservice_admin_form($type = NULL) {
|
||||
'#default_value' => variable_get('uc_termsofservice_' . $type . '_display', 'teaser'),
|
||||
);
|
||||
|
||||
// Container for advanced settings.
|
||||
$form['uc_termsofservice_advanced_settings'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('Advanced settings'),
|
||||
'#weight' => 2,
|
||||
'#collapsible' => TRUE,
|
||||
'#collapsed' => FALSE,
|
||||
);
|
||||
|
||||
// Checkbox to enable Rules.
|
||||
$form['uc_termsofservice_advanced_settings']['uc_termsofservice_' . $type . '_rules'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Enable Rules'),
|
||||
'#description' => t('You can set the conditions under which the pane will be displayed with <a href="@url">Rules</a>', array('@url' => url('admin/workflow/rules/uc_termsofservice_display_pane/edit/conditions'))),
|
||||
'#default_value' => variable_get('uc_termsofservice_' . $type . '_rules', 0),
|
||||
);
|
||||
|
||||
// Handle ToS in a popup window.
|
||||
if (module_exists('modalframe')) {
|
||||
// Container for advanced settings.
|
||||
$form['uc_termsofservice_advanced_settings'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('Advanced settings'),
|
||||
'#weight' => 2,
|
||||
'#collapsible' => TRUE,
|
||||
'#collapsed' => FALSE,
|
||||
);
|
||||
|
||||
$form['uc_termsofservice_advanced_settings']['uc_termsofservice_' . $type . '_popup'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Open ToS in a popup modal window.'),
|
||||
@ -383,7 +375,6 @@ function uc_termsofservice_checkout_form_validate($form, &$form_state) {
|
||||
if (!$agreed) {
|
||||
$node = uc_termsofservice_get_node('checkout');
|
||||
|
||||
// Issue #1818992 : the ID used in form_set_error is not a typo
|
||||
form_set_error('panes][uc_termsofservice_agreement_checkout][tos_agree', t("In order to continue with the checkout process you must first accept the !tos", array('!tos' => $node->title)));
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,16 @@
|
||||
name = Session Limit
|
||||
description = "Limit simultaneous user sessions."
|
||||
core = 7.x
|
||||
configure = admin/config/people/session_limit
|
||||
|
||||
files[] = session_limit.install
|
||||
files[] = session_limit.module
|
||||
files[] = session_limit.tokens.inc
|
||||
files[] = tests/session_limit.test
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-03-04
|
||||
version = "7.x-2.0"
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.x-2.2"
|
||||
core = "7.x"
|
||||
project = "session_limit"
|
||||
datestamp = "1393949919"
|
||||
datestamp = "1456312454"
|
||||
|
||||
|
@ -83,7 +83,7 @@ function session_limit_menu() {
|
||||
'access callback' => 'user_is_logged_in',
|
||||
'type' => MENU_SUGGESTED_ITEM,
|
||||
);
|
||||
$items['admin/config/people/session_limit'] = array(
|
||||
$items['admin/config/people/session-limit'] = array(
|
||||
'title' => 'Session limit',
|
||||
'description' => 'Configure session limits.',
|
||||
'page callback' => 'drupal_get_form',
|
||||
@ -98,7 +98,7 @@ function session_limit_menu() {
|
||||
'access arguments' => array('administer site configuration'),
|
||||
'type' => MENU_DEFAULT_LOCAL_TASK,
|
||||
);
|
||||
$items['admin/config/people/session_limit/roles'] = array(
|
||||
$items['admin/config/people/session-limit/roles'] = array(
|
||||
'title' => 'Role limits',
|
||||
'description' => 'Configure session limits by role.',
|
||||
'page callback' => 'drupal_get_form',
|
||||
@ -106,7 +106,7 @@ function session_limit_menu() {
|
||||
'access arguments' => array('administer session limits by role'),
|
||||
'type' => MENU_LOCAL_TASK,
|
||||
);
|
||||
$items['user/%user/session_limit'] = array(
|
||||
$items['user/%user/session-limit'] = array(
|
||||
'title' => 'Session limit',
|
||||
'description' => 'Configure session limit for one user.',
|
||||
'page callback' => 'drupal_get_form',
|
||||
@ -304,6 +304,21 @@ function session_limit_action_info_alter(&$info) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_field_extra_fields().
|
||||
*/
|
||||
function session_limit_field_extra_fields() {
|
||||
$extra['user']['user']['display'] = array(
|
||||
'session_limit' => array(
|
||||
'label' => t('Session limit'),
|
||||
'description' => t('Session limit.'),
|
||||
'weight' => 10,
|
||||
),
|
||||
);
|
||||
|
||||
return $extra;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_user_view().
|
||||
*/
|
||||
@ -312,7 +327,9 @@ function session_limit_user_view($account, $view_mode) {
|
||||
$account->content['session_limit'] = array(
|
||||
'#title' => t('Session limit'),
|
||||
'#type' => 'user_profile_category',
|
||||
'session_limit' => array('#value' => empty($account->data['session_limit']) ? t('Default') : $account->data['session_limit'])
|
||||
'session_limit' => array(
|
||||
'#markup' => empty($account->data['session_limit']) ? t('Default') : $account->data['session_limit'],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -487,12 +504,14 @@ function session_limit_user_max_sessions_byrole($account) {
|
||||
$limits = array();
|
||||
|
||||
foreach ($account->roles as $rid => $name) {
|
||||
$limits[] = variable_get("session_limit_rid_$rid", 0);
|
||||
$role_limit = variable_get("session_limit_rid_$rid", FALSE);
|
||||
|
||||
if (!empty($role_limit)) {
|
||||
$limits[] = (int) $role_limit;
|
||||
}
|
||||
}
|
||||
|
||||
rsort($limits);
|
||||
|
||||
return (int) $limits[0];
|
||||
return empty($limits) ? 0 : max($limits);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -554,7 +573,7 @@ function session_limit_invoke_session_limit($session, $op) {
|
||||
if ($limit > 0) {
|
||||
// Secure session ids are seperate rows in the database, but we don't want to kick
|
||||
// the user off there http session and not there https session or vice versa. This
|
||||
// is why this query is DISTINCT.
|
||||
// is why this query is DISTINCT.
|
||||
$result = db_select('sessions', 's')
|
||||
->distinct()
|
||||
->fields('s', array('sid'))
|
||||
@ -599,7 +618,7 @@ function session_limit_session_limit($sid, $op) {
|
||||
}
|
||||
|
||||
$fields['uid'] = 0;
|
||||
$query = db_update('sessions')
|
||||
db_update('sessions')
|
||||
->fields($fields)
|
||||
->condition('sid', $sid)
|
||||
->execute();
|
||||
@ -665,3 +684,31 @@ function _session_limit_bypass() {
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_variable_group_info().
|
||||
*/
|
||||
function session_limit_variable_group_info() {
|
||||
$groups['session_limit'] = array(
|
||||
'title' => t('Session limit'),
|
||||
'access' => 'administer site configuration',
|
||||
'path' => array('admin/config/people/session_limit/defaults'),
|
||||
);
|
||||
return $groups;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_variable_info().
|
||||
*/
|
||||
function session_limit_variable_info($options) {
|
||||
$variables['session_limit_logged_out_message'] = array(
|
||||
'title' => t('Logged out message', array(), $options),
|
||||
'description' => t('The message that is displayed to a user if the workstation has been logged out.<br />
|
||||
@number is replaced with the maximum number of simultaneous sessions.', array(), $options),
|
||||
'type' => 'string',
|
||||
'localize' => TRUE,
|
||||
'group' => 'session_limit',
|
||||
);
|
||||
|
||||
return $variables;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user