Skip to content

Commit

Permalink
Merge branch 'esope_1.11' of github.com:Facyla/esope into esope_1.11
Browse files Browse the repository at this point in the history
  • Loading branch information
Facyla committed Sep 30, 2015
2 parents cb31391 + abb8c75 commit 8114de9
Show file tree
Hide file tree
Showing 22 changed files with 225 additions and 42 deletions.
20 changes: 10 additions & 10 deletions esope_move_installation.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,17 @@ function get_input($variable, $default = '', $filter= true) {
<?php
echo '<h2>Définition des paramètres de configuration</h2>';
echo '<form method="POST">';
echo '<p>Serveur MySQL <label><input type="text" name="db_server" value="' . $db_server . '" required="required" /></label></p>';
echo '<p>Nom de la base MySQL <label><input type="text" name="db_name" value="' . $db_name . '" required="required" /></label></p>';
echo '<p>Utilisateur MySQL <label><input type="text" name="db_user" value="' . $db_user . '" required="required" /></label></p>';
echo '<p>Serveur MySQL <label><input type="text" name="db_server" value="' . $db_server . '" required="required" placeholder="localhost, mysql.domain.tld..." /></label></p>';
echo '<p>Nom de la base MySQL <label><input type="text" name="db_name" value="' . $db_name . '" required="required" placeholder="DB name, eg. elggproject" /></label></p>';
echo '<p>Utilisateur MySQL <label><input type="text" name="db_user" value="' . $db_user . '" required="required" placeholder="DB username, eg. elgguser" /></label></p>';
echo '<p>Mot de passe MySQL <label><input type="text" name="db_pass" value="' . $db_pass . '" /></label></p>';
echo '<p><label>Préfixe des tables (généralement "elgg_") <input type="text" name="prefix" value="' . $prefix . '" /></label></p>';
echo '<p><label>Ancienne URL <input type="text" name="old_www" value="' . $old_www . '" required="required" /></label></p>';
echo '<p><label>Nouvelle URL <input type="text" name="new_www" value="' . $new_www . '" required="required" /></label></p>';
echo '<p><label>Ancien chemin sur le serveur <input type="text" name="old_path" value="' . $old_path . '" required="required" /></label></p>';
echo '<p><label>Nouveau chemin sur le serveur <input type="text" name="new_path" value="' . $new_path . '" required="required" /></label></p>';
echo '<p><label>Ancien chemin des données sur le serveur <input type="text" name="old_datapath" value="' . $old_datapath . '" required="required" /></label></p>';
echo '<p><label>Nouveau chemin des données sur le serveur <input type="text" name="new_datapath" value="' . $new_datapath . '" required="required" /></label></p>';
echo '<p><label>Préfixe des tables (généralement "elgg_") <input type="text" name="prefix" value="' . $prefix . '" placeholder="elgg_" /></label></p>';
echo '<p><label>Ancienne URL (sans slash final) <input type="text" name="old_www" value="' . $old_www . '" required="required" placeholder="http://old_domain.tld/elgg" /></label></p>';
echo '<p><label>Nouvelle URL (sans slash final) <input type="text" name="new_www" value="' . $new_www . '" required="required" placeholder="http://new_domain.tld" /></label></p>';
echo '<p><label>Ancien chemin sur le serveur <input type="text" name="old_path" value="' . $old_path . '" required="required" placeholder="/var/www/old_domain.tld/" /></label></p>';
echo '<p><label>Nouveau chemin sur le serveur <input type="text" name="new_path" value="' . $new_path . '" required="required" placeholder="/var/www/new_domain.tld/www/" /></label></p>';
echo '<p><label>Ancien chemin des données sur le serveur <input type="text" name="old_datapath" value="' . $old_datapath . '" required="required" placeholder="/var/www/old_domain.tld-data/" /></label></p>';
echo '<p><label>Nouveau chemin des données sur le serveur <input type="text" name="new_datapath" value="' . $new_datapath . '" required="required" placeholder="/var/www/new_domain.tld/data/" /></label></p>';
echo '<p><label>Exécuter la mise à jour ? <select name="execute_query">';
if ($execute_query == 'yes') {
echo '<option value="no">Non</option>';
Expand Down
1 change: 1 addition & 0 deletions mod/cmspages/languages/en.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@
'cmspages:none' => "No CMS Page found.",
'cmspages:created' => "created %s",
'cmspages:updated' => "updated %s",
'cmspages:readmore' => "Read more",


);
Expand Down
2 changes: 2 additions & 0 deletions mod/cmspages/languages/fr.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@
'cmspages:none' => "Aucune page CMS trouvée.",
'cmspages:created' => "créée %s",
'cmspages:updated' => "MAJ %s",
'cmspages:readmore' => "Lire la suite",


);

19 changes: 15 additions & 4 deletions mod/cmspages/start.php
Original file line number Diff line number Diff line change
Expand Up @@ -552,8 +552,10 @@ function cmspages_compose_module($module_name, $module_config = false) {
$full_view = $module_config['full_view'];
$type = $module_config['type'];
$subtype = $module_config['subtype'];
$limit = $module_config['limit']; if (!isset($limit)) $limit = 10;
$sort = $module_config['sort']; if (!isset($sort)) $sort = "time_created desc";
$limit = $module_config['limit'];
if (!isset($limit)) $limit = 10;
$sort = $module_config['sort'];
if (!isset($sort)) $sort = "time_created desc";
$guids = $module_config['guids'];
$owner_guids = $module_config['owner_guids'];
$container_guids = $module_config['container_guids'];
Expand Down Expand Up @@ -652,7 +654,7 @@ function cmspages_compose_module($module_name, $module_config = false) {
* + softfail si accès interdit + aucun impact sur la suite de l'affichage (contextes, etc.)
* - 'embed' : can be passed to change some rendering elements based on read embed
* - 'add_edit_link' : allow non-defined pages rendering (and edit links)
* Removes admin links (useful for 'inner' and 'iframe' embed mode, required for tinymce templates)
* - 'noedit' : Removes admin links (useful for 'inner' and 'iframe' embed mode, required for tinymce templates)
* STEPS :
* 1. Check validity, access, contexts (can we display that page ?)
* 2. Render cmspage "own" content
Expand Down Expand Up @@ -680,6 +682,9 @@ function cmspages_view($cmspage, $params = array(), $vars = array()) {
if ($params['noedit'] == 'true') $add_edit_link = false;
if (!empty($params['embed'])) $embed = $params['embed'];
if (!isset($params['recursion'])) $params['recursion'] = array();
$read_more = false;
if (isset($vars['read_more'])) $read_more = $vars['read_more'];



/* 1. Check validity, access, contexts (can we display that page ?) */
Expand Down Expand Up @@ -718,7 +723,7 @@ function cmspages_view($cmspage, $params = array(), $vars = array()) {
}
if ($exit) {
if ($mode != 'view') {
register_error('cmspages:wrongcontext');
register_error(elgg_echo('cmspages:wrongcontext'));
//forward(REFERER);
}
return;
Expand Down Expand Up @@ -826,6 +831,12 @@ function cmspages_view($cmspage, $params = array(), $vars = array()) {
$edit_link = '<a class="cmspages-admin-block cmspages-edit-level-' . $edit_level . '" href="' . elgg_get_site_url() . 'cmspages/edit/' . $pagetype . '" title="' . $edit_title . '"> ' . $edit_link . $edit_icon . '</a>' . $edit_details;
}

// If asked for "Read more" button, apply it to the whole content (but before the wrapper)
if ($read_more) {
$content = elgg_get_excerpt($content, $read_more);
$content .= '<p><a href="' . $cmspage->getURL() . '" class="elgg-button elgg-button-action elgg-button-esope">' . elgg_echo('cmspages:readmore') . '</a></p>';
}


/* 4. Wrap into container (.cmspages-output) */
// Add enclosing span for custom styles + optional editable class and edit link
Expand Down
12 changes: 12 additions & 0 deletions mod/elgg_menus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ Submenus are displayed by default. To hide a specific submenu, and display it on
.elgg-menu-MENU_NAME .elgg-child-menu { display: none; }
.elgg-menu-MENU_NAME li:hover .elgg-child-menu { display: block; }

### Translated menus
The plugin will detect alternative versions of menus and use them it they exist.
If the translated menu do not exist, it will default to main language
When using menu names in theme plugins, use the canonical menu name (without language extension).

To provide language-aware versions of menus :
1. Edit a menu
2. Add "-LANGAGE_CODE" to its name, eg. "footer-fr"
3. Save the menu (it will be duplicated)
4. Edit the new translated menu strings and links


### Translate section headers
Add translation strings into your theme translation file, using this key model :
'menu:MENU_NAME:header:SECTION_NAME' => "Translated section name",
Expand Down
13 changes: 10 additions & 3 deletions mod/elgg_menus/actions/elgg_menus/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,17 @@
// Cleanup some inputs
if (!empty($new_section[$i])) $new_section[$i] = elgg_get_friendly_title($new_section[$i]);
if (!empty($new_parent_name[$i])) $new_parent_name[$i] = elgg_get_friendly_title($new_parent_name[$i]);
// Note : item_class "elgg-menu-item-{item_name}" will be automatically added when building the menu
// We don't bother to remove it here, but we will also remove duplicates in elgg_menus/input/menu_item view
if (!empty($new_item_class[$i])) {
$new_item_class[$i] = explode(' ', $new_item_class[$i]);
$new_item_class[$i] = array_unique($new_item_class[$i]);
$new_item_class[$i] = implode(' ', $new_item_class[$i]);
$new_item_class_a = explode(' ', $new_item_class[$i]);
$new_item_class_a = array_unique($new_item_class_a);
$new_item_class[$i] = implode(' ', $new_item_class_a);
}
if (!empty($new_link_class[$i])) {
$new_link_class_a = explode(' ', $new_link_class[$i]);
$new_link_class_a = array_unique($new_link_class_a);
$new_link_class[$i] = implode(' ', $new_link_class_a);
}
// Add/update item
// Convert to bool values
Expand Down
7 changes: 2 additions & 5 deletions mod/elgg_menus/languages/en.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?php
/**
* French strings
* English strings
*/
global $CONFIG;

$en = array(
return array(
'admin:appearance:menus' => "Custom Menus Editor",

'elgg_menus:new' => "New menu",
Expand Down Expand Up @@ -112,5 +111,3 @@

);

add_translation('en', $en);

5 changes: 1 addition & 4 deletions mod/elgg_menus/languages/fr.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
/**
* French strings
*/
global $CONFIG;

$fr = array(
return array(
'admin:appearance:menus' => "Gestion des menus",

'elgg_menus:new' => "Nouveau menu",
Expand Down Expand Up @@ -122,5 +121,3 @@

);

add_translation('fr', $fr);

8 changes: 5 additions & 3 deletions mod/elgg_menus/start.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ function elgg_menus_init() {
* @TODO hook sur prepare:menu avec poids 1000 pour pouvoir remplacer un menu système en dernier
*/

// @TODO Enable menu replacement + translated menus
// Note : menu switch is easier in theme, right before elgg_view_menu
/* @TODO Enable menu replacement + translated menus
* To use translated menus, create menus ending with language code (eg. "-en")
* Note : menu switch is easier in theme, right before elgg_view_menu
*/
/*
// Get translated menu, only if exists
$lang = get_language();
$lang_menu = elgg_menus_get_menu_config($menu . '_' . $lang);
$lang_menu = elgg_menus_get_menu_config($menu . '-' . $lang);
if ($lang_menu) $menu = $menu . '_' . $lang;
*/
// @TODO Also support translated menus (using lang suffix ? or alternate language items ?)
Expand Down
13 changes: 13 additions & 0 deletions mod/elgg_menus/views/default/elgg_menus/input/menu_item.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@
$confirm = $menu_item->getConfirmText();
$data = '';
$priority = $menu_item->getPriority();
// Remove duplicates from classes, as some classes are added automatically when building the menu
// and can lead to a duplicated class)
// Note : item_class "elgg-menu-item-{item_name}" will be automatically added when building the menu
if (!empty($item_class)) {
$item_class = explode(' ', $item_class);
$item_class = array_unique($item_class);
$item_class = implode(' ', $item_class);
}
if (!empty($link_class)) {
$link_class = explode(' ', $link_class);
$link_class = array_unique($link_class);
$link_class = implode(' ', $link_class);
}
}
// Convert bool values
if ($selected) { $selected = 'yes'; } else { $selected = 'no'; }
Expand Down
25 changes: 21 additions & 4 deletions mod/esope/pages/categories/listing.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,36 @@

// Liste des catégories (thématiques du site)
$themes = $site->categories;
$sidebar = '<h2>Thématiques</h2>';
sort($themes);

// We need category => category to implement label (can be different from full category name)
$themes = array_flip($themes);
array_walk($themes, create_function('&$v, $k', '$v = $k;'));

// Add tree categories support
foreach ($themes as $k => $theme) {
if (strpos($theme, '/') !== false) {
$theme_a = explode('/', $theme);
$theme_label = '';
for ($i = 1; $i < count($theme_a); $i++) { $theme_label .= "-"; }
$theme_label .= ' ' . end($theme_a);
$themes[$k] = $theme_label;
}
}

$sidebar = '<h2>' . elgg_echo('esope:categories') . '</h2>';
$sidebar .= '<ul class="elgg-menu elgg-menu-owner-block elgg-menu-owner-block-categories elgg-menu-owner-block-default">';
if (empty($category)) {
$sidebar .= '<li class="elgg-state-selected"><a href="' . $url . 'categories">' . elgg_echo('esope:categories:all') . '</a></li>';
} else {
$sidebar .= '<li><a href="' . $url . 'categories">' . elgg_echo('esope:categories:all') . '</a></li>';
}
foreach ($themes as $theme) {
foreach ($themes as $theme => $theme_label) {
//$is_current = str_replace(' ', '+', $theme);
if ($theme == $category) {
$sidebar .= '<li class="elgg-state-selected"><a href="' . $url . 'categories/list?category='.urlencode($theme) . '">' . $theme . '</a></li>';
$sidebar .= '<li class="elgg-state-selected"><a href="' . $url . 'categories/list?category='.urlencode($theme) . '">' . $theme_label . '</a></li>';
} else {
$sidebar .= '<li><a href="' . $url . 'categories/list?category='.urlencode($theme) . '">' . $theme . '</a></li>';
$sidebar .= '<li><a href="' . $url . 'categories/list?category='.urlencode($theme) . '">' . $theme_label . '</a></li>';
}
}
$sidebar .= '</ul>';
Expand Down
41 changes: 41 additions & 0 deletions mod/esope/start.php
Original file line number Diff line number Diff line change
Expand Up @@ -2000,6 +2000,47 @@ function esope_notification_handler(ElggEntity $from, ElggUser $to, $subject, $b
}


/* Determines if the user is a group administrator (=> has admin rights on any group)
* $user : the user to be checked
* $group : optional group
* $strict : if true and group_operators enabled, ensures the user is the group owner only
* (not a co-admin or even not an global admin)
*/
function esope_is_group_admin($user = false, $group = null, $strict = false) {
if (!elgg_instanceof($user, 'user')) {
if (!elgg_is_logged_in()) return false;
$user = elgg_get_logged_in_user_entity();
}

// Checks only for a given group
if (elgg_instanceof($group, 'group')) {
if ($group->canEdit()) {
if (!$strict) { return true; }
if ($group->owner_guid == $user->guid) { return true; }
}
return false;
}

// Owned group check : always validates this function test
$owned_groups = elgg_get_entities(array('type' => 'group', 'owner_guid' => $user->guid));
if ($owned_groups) { return true; }
// Strict check : any other method is not valid, so leave now (even not global admin)
if ($strict) { return false; }

// Admin bypass
if ($user->isAdmin()) { return true; }

// Now also check group operators
if (elgg_is_active_plugin('group_operators')) {
$operator_of = elgg_get_entities_from_relationship(array('types'=>'group', 'relationship_guid'=>$user->guid, 'relationship'=>'operator', 'inverse_relationship'=>false));
if ($operator_of) { return true; }
}

// None passed : definitely not a group admin...
return false;
}





31 changes: 31 additions & 0 deletions mod/esope/views/default/output/categories.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
/**
* View categories on an entity
*
* @uses $vars['entity']
*/

$linkstr = '';
if (isset($vars['entity']) && $vars['entity'] instanceof ElggEntity) {

$categories = $vars['entity']->universal_categories;
if (!empty($categories)) {
if (!is_array($categories)) {
$categories = array($categories);
}
//sort($categories);

foreach($categories as $category) {
$link = elgg_get_site_url() . 'categories/list?category=' . urlencode($category);
if (!empty($linkstr)) {
$linkstr .= ', ';
}
$linkstr .= '<a href="'.$link.'">' . $category . '</a>';
}
}

}

if ($linkstr) {
echo '<p class="elgg-output-categories">' . elgg_echo('categories') . ": $linkstr</p>";
}
16 changes: 16 additions & 0 deletions mod/esope/views/default/page/elements/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,25 @@
if (elgg_is_active_plugin('categories')) {
$categories = '';
$themes = $site->categories;
/*
if ($themes) foreach ($themes as $theme) {
$categories .= '<li><a href="' . $url . 'categories/list?category='.urlencode($theme) . '">' . $theme . '</a></li>';
}
*/
if ($themes) {
sort($themes); // Sort categories
foreach ($themes as $theme) {
// Add tree categories support
$theme_label = $theme;
if (strpos($theme, '/') !== false) {
$theme_a = explode('/', $theme);
$theme_label = '';
for ($i = 1; $i < count($theme_a); $i++) { $theme_label .= "-"; }
$theme_label .= ' ' . end($theme_a);
}
$categories .= '<li><a href="' . $url . 'categories/list?category='.urlencode($theme) . '">' . $theme_label . '</a></li>';
}
}
}

// Messages non lus
Expand Down
28 changes: 28 additions & 0 deletions mod/esope/views/default/plugins/categories/settings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
/**
* Administrator sets the categories for the site
*
* @package ElggCategories
*/

// Get site categories
$site = elgg_get_site_entity();
$categories = $site->categories;

//if (empty($categories)) { $categories = array(); }
if (empty($categories)) { $categories = array(); }
sort($categories);
$categories = implode(",\n", $categories);

// @TODO : automatically add parent categories if missing

?>
<div>
<p><?php echo elgg_echo('categories:explanation'); ?></p>
<p><?php echo elgg_echo('esope:categories:tree:explanation'); ?></p>
<?php
//echo elgg_view('input/tags', array('value' => $categories, 'name' => 'categories'));
echo elgg_view('input/plaintext', array('value' => $categories, 'name' => 'categories'));
// @TODO : automatically add commas before newlines, smthg like : yourString.split(",").join("\n")
?>
</div>
3 changes: 3 additions & 0 deletions mod/feedback/languages/en.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@
'feedback:settings:memberview' => "Are site members allowed to view feedbacks ?",
'feedback:settings:comment' => "Enable commenting on / replying to feedbacks ?",
'feedback:settings:feedbackgroup' => "Associate feedbacks to one or multiple groups ?",
'feedback:settings:enablemood' => "Enable mood in feedbacks",
'feedback:settings:enableabout' => "Enable feedback categories",
'feedback:settings:about_values' => "Feedback categories (if enabled)",

// Feedback status
'feedback:status' => "Feedbacks status",
Expand Down
Loading

0 comments on commit 8114de9

Please sign in to comment.