bon nous y voila ! voici ce que j'ai réussi a faire et comment je m'y suis pris:
1) ouvrir le fichier .../install/include/makedata.php ajouter:
//Ajout CPascal - 8 février 2010 - message de redirection en javascript
//message de redirection en javascript ou non
$dbm->insert('config', " VALUES (97, 0, 1, 'java_message_redirection', '_MD_AM_JAVAREDIRECTION', '1', '_MD_AM_JAVAREDIRECTIONINFO', 'yesno', 'int', 12)");
2) ouvrir le fichier .../modules/sytem/language/french/admin/preferences.php ajouter:
//Ajout CPascal - 8 février 2010 - message de redirection en javascript dans le thème du site et l'administration
define("_MD_AM_JAVAREDIRECTION", "Utilisez la redirection javascript");
define("_MD_AM_JAVAREDIRECTIONINFO", "affiche les messages de confirmation, connexion et autres messages dans une boite en javascript sur le site et dans l'administration");
3) ouvrir le fichier .../include/functions.php
rechercher la fonction: function redirect_header (etc...
modifier comme ceci en bas de cette fonction:
$url = preg_replace("/&/i", '&', htmlspecialchars($url, ENT_QUOTES));
$xoopsTpl->assign('url', $url);
$message = trim($message) != '' ? $message : _TAKINGBACK;
$xoopsTpl->assign('message', $message);
$xoopsTpl->assign('lang_ifnotreload', sprintf(_IFNOTRELOAD, $url));
//modif CPascal - 8 février 2010 - message de redirection en javascript
//$xoopsTpl->display('db:system_redirect.html');
//exit();
//Ajout CPascal - 8 février 2010 - message de redirection en javascript dans le thème du site
if (!headers_sent() && $xoopsConfig['java_message_redirection']==1) {
$_SESSION['redirect_message'] = $message;
header( "Location: ".preg_replace("/[&]amp;/i",'&',$url) ) ;
exit();
} else {
$xoopsTpl->display('db:system_redirect.html');
exit();
}
//fin de l'ajout
4) ouvrir le fichier www/xoops/header.php ajouter de cette façon:
// Temporary solution for start page redirection
if (defined("XOOPS_STARTPAGE_REDIRECTED")) {
$params = $content = $tpl = $repeat = null;
$xoTheme->headContent($params, "<base href='" . XOOPS_URL . '/modules/' . $xoopsConfig['startpage'] . "/' />", $tpl, $repeat);
}
//Ajout CPascal - 8 février 2010 - message de redirection en javascript dans l'administration et théme modification de la fonction: redirect_header dans le fichier .../include/function.php
$xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js');
if(! empty( $_SESSION['redirect_message'] )){
$xoTheme->addScript('browse.php?Frameworks/jquery/jgrowl.js');
//pour mode debug dans firefox firebug
$xoTheme->addScript('', array('type' => 'text/javascript'), '
if (!window.console || !console.firebug) {
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
window.console = {};
for (var i = 0; i < names.length; ++i) window.console[names[i]] = function() {};
}
//options réglage
(function($){
$(document).ready(function(){
$.jGrowl("'.$_SESSION['redirect_message'].'", { life:5000, position: "center", speed: "slow", header: "'.$xoopsConfig['sitename'].'" });
});
})(jQuery);
');
unset( $_SESSION['redirect_message'] ) ;
}
//fin de l'ajout
Petite précision: vous pouvez modifiez le temps d'affichage de la boite java => life:5000
position du texte => position: "center"
vitesse => speed: "slow"
texte dans header => header: "'.$xoopsConfig['sitename'].'"
ou supprimez cette fonction header pour rien mettre ou ajoutez le texte que vous souhaitez exemple: message
et
assurez-vous que le fichier jquery.js est bien appeler dans ce fichier exemple:
$xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js');
5) ouvrir le fichier de vos thèmes site et administration
prenon par exemple pour l'administration le thème oxygen
ouvrir le fichier ../modules/system/glass/gui/oxygen/oxygen.php ajouter cette portion de code dans la fonction: function header()
$xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js');
$xoTheme->addStylesheet('modules/system/class/gui/default/css/style.css');
//Ajout CPascal - 8 février 2010 - message de redirection en javascript dans l'administration modification de la fonction: redirect_header dans le fichier .../include/function.php
if(! empty( $_SESSION['redirect_message'] )){
$xoTheme->addScript('browse.php?Frameworks/jquery/jgrowl.js');
//pour mode debug dans firebug de firefox
$xoTheme->addScript('', array('type' => 'text/javascript'), '
if (!window.console || !console.firebug) {
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
window.console = {};
for (var i = 0; i < names.length; ++i) window.console[names[i]] = function() {};
}
(function($){
$(document).ready(function(){
$.jGrowl("'.$_SESSION['redirect_message'].'", { life:3000 , position: "center", speed: "slow" });
});
})(jQuery);
');
unset( $_SESSION['redirect_message'] ) ;
}
//fin de l'ajout - message de redirection en javascript dans l'administration
Petite précision: vous pouvez modifiez le temps d'affichage de la boite java => life:3000
position du texte => position: "center"
vitesse => speed: "slow"
et
assurez-vous que le fichier jquery.js est bien appeler dans ce fichier exemple:
$xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js');
6) ouvrir les fichiers CSS des thèmes que vous utilisez:
dans l'administration avec comme exemple le thème oxygen
ouvrir le fichier ../modules/system/glass/gui/oxygen/css/style.css ajouter cette portion de code:
/*** pages de redirection en javascript ***/
div.jGrowl {padding: 1em; z-index: 9999;}
/** positions de la boite sur la page **/
body > div.jGrowl {position: fixed;}
body > div.jGrowl.top-right {right: 25%; left: 25%; top: 15%;}
body > div.jGrowl.bottom-left {left:0; bottom:0;}
body > div.jGrowl.bottom-right {right:0; bottom:0;}
body > div.jGrowl.center {top:0; left:0;}
body > div.jGrowl.top-left {left:0; top:0;}
/*** style de la boite ***/
div.center div.jGrowl-notification, div.center div.jGrowl-closer {margin-left: auto; margin-right: auto;}
div.jGrowl div.jGrowl-notification, div.jGrowl div.jGrowl-closer {
background: #FBE3E4;
color: #DF3066;
width: 100%;
padding: .5em;
margin-top: .5em;
margin-bottom: .5em;
font-family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 1.2em;
text-align: center;
border: 1px solid #FBC2C4;
display: none;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
div.jGrowl div.jGrowl-notification {min-height: 40px;}
div.jGrowl div.jGrowl-notification div.header {font-weight: bold; font-size: 10px;}
/** croix de fermeture **/
div.jGrowl div.jGrowl-notification div.close {float: right; font-weight: bold; font-size: 12px; cursor: pointer;}
div.jGrowl div.jGrowl-closer {height: 15px; padding-top: 4px; padding-bottom: 4px; cursor: pointer; font-size: 11px; font-weight: bold; text-align: center;}
7) ouvrir le fichier style.css de votre thème de site utiliser (.../themes/votre thème/css/style.css ajoutez le même code css moi personnellement j'ai mis ce code
/** positions de la boite sur la page **/
body > div.jGrowl {position: fixed;}
body > div.jGrowl.top-right {right: 35%; left: 35%; top: 15%;}
body > div.jGrowl.bottom-left {left:0; bottom:0;}
body > div.jGrowl.bottom-right {right:0; bottom:0;}
body > div.jGrowl.center {top:0; left:0;}
body > div.jGrowl.top-left {left:0; top:0;}
/*** style de la boite ***/
div.center div.jGrowl-notification, div.center div.jGrowl-closer {margin-left: auto; margin-right: auto;}
div.jGrowl div.jGrowl-notification, div.jGrowl div.jGrowl-closer {
background: #000;
color: #fff;
width: 100%;
padding: .2em;
margin-top: .5em;
margin-bottom: .5em;
font-family: "Trebuchet MS",Arial,Helvetica,sans-serif;
font-size: .9em;
text-align: center;
border: 1px solid #7E7648;
display: none;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
div.jGrowl div.jGrowl-notification {min-height: 40px;}
div.jGrowl div.jGrowl-notification div.header {font-weight: bold; font-size: 10px;}
/** croix de fermeture **/
div.jGrowl div.jGrowl-notification div.close {float: right; font-weight: bold; font-size: 12px; cursor: pointer;}
div.jGrowl div.jGrowl-closer {height: 15px; padding-top: 4px; padding-bottom: 4px; cursor: pointer; font-size: 11px; font-weight: bold; text-align: center;}
évidement modifier couleurs, position etc.. selon vos goûts et thème utilisez aussi bien dans l'administration que dans votre thème site.
Maintenant il vous reste a ajouter le javascript jGrowl.js (version 1.2.4) et jquery.js dans le dossier: ../xoops_lib/Frameworks/jquery/
javascript jGrowl version 1.2.4
/**
* jGrowl 1.2.4
*
* jGrowl is a jQuery plugin implementing unobtrusive userland notifications. These
* notifications function similarly to the Growl Framework available for
* Mac OS X (http://growl.info).
*
*/
(function($) {
/** jGrowl Wrapper - Establish a base jGrowl Container for compatibility with older releases. **/
$.jGrowl = function( m , o ) {
// To maintain compatibility with older version that only supported one instance we'll create the base container.
if ( $('#jGrowl').size() == 0 )
$('<div id="jGrowl"></div>').addClass($.jGrowl.defaults.position).appendTo('body');
// Create a notification on the container.
$('#jGrowl').jGrowl(m,o);
};
/** Raise jGrowl Notification on a jGrowl Container **/
$.fn.jGrowl = function( m , o ) {
if ( $.isFunction(this.each) ) {
var args = arguments;
return this.each(function() {
var self = this;
/** Create a jGrowl Instance on the Container if it does not exist **/
if ( $(this).data('jGrowl.instance') == undefined ) {
$(this).data('jGrowl.instance', $.extend( new $.fn.jGrowl(), { notifications: [], element: null, interval: null } ));
$(this).data('jGrowl.instance').startup( this );
}
/** Optionally call jGrowl instance methods, or just raise a normal notification **/
if ( $.isFunction($(this).data('jGrowl.instance')[m]) ) {
$(this).data('jGrowl.instance')[m].apply( $(this).data('jGrowl.instance') , $.makeArray(args).slice(1) );
} else {
$(this).data('jGrowl.instance').create( m , o );
}
});
};
};
$.extend( $.fn.jGrowl.prototype , {
/** Default JGrowl Settings **/
defaults: {
pool: 0,
header: '',
group: '',
sticky: false,
position: 'top-right', // Is this still needed?
glue: 'after',
theme: 'default',
corners: '10px',
check: 250,
life: 3000,
speed: 'normal',
easing: 'swing',
closer: true,
closeTemplate: '×',
closerTemplate: '<div>[ close all ]</div>',
log: function(e,m,o) {},
beforeOpen: function(e,m,o) {},
open: function(e,m,o) {},
beforeClose: function(e,m,o) {},
close: function(e,m,o) {},
animateOpen: {
opacity: 'show'
},
animateClose: {
opacity: 'hide'
}
},
notifications: [],
/** jGrowl Container Node **/
element: null,
/** Interval Function **/
interval: null,
/** Create a Notification **/
create: function( message , o ) {
var o = $.extend({}, this.defaults, o);
this.notifications.push({ message: message , options: o });
o.log.apply( this.element , [this.element,message,o] );
},
render: function( notification ) {
var self = this;
var message = notification.message;
var o = notification.options;
var notification = $(
'<div class="jGrowl-notification ui-state-highlight ui-corner-all' +
((o.group != undefined && o.group != '') ? ' ' + o.group : '') + '">' +
'<div class="close">' + o.closeTemplate + '</div>' +
'<div class="header">' + o.header + '</div>' +
'<div class="message">' + message + '</div></div>'
).data("jGrowl", o).addClass(o.theme).children('div.close').bind("click.jGrowl", function() {
$(this).parent().trigger('jGrowl.close');
}).parent();
/** Notification Actions **/
$(notification).bind("mouseover.jGrowl", function() {
$('div.jGrowl-notification', self.element).data("jGrowl.pause", true);
}).bind("mouseout.jGrowl", function() {
$('div.jGrowl-notification', self.element).data("jGrowl.pause", false);
}).bind('jGrowl.beforeOpen', function() {
if ( o.beforeOpen.apply( notification , [notification,message,o,self.element] ) != false ) {
$(this).trigger('jGrowl.open');
}
}).bind('jGrowl.open', function() {
if ( o.open.apply( notification , [notification,message,o,self.element] ) != false ) {
if ( o.glue == 'after' ) {
$('div.jGrowl-notification:last', self.element).after(notification);
} else {
$('div.jGrowl-notification:first', self.element).before(notification);
}
$(this).animate(o.animateOpen, o.speed, o.easing, function() {
// Fixes some anti-aliasing issues with IE filters.
if ($.browser.msie && (parseInt($(this).css('opacity'), 10) === 1 || parseInt($(this).css('opacity'), 10) === 0))
this.style.removeAttribute('filter');
$(this).data("jGrowl").created = new Date();
});
}
}).bind('jGrowl.beforeClose', function() {
if ( o.beforeClose.apply( notification , [notification,message,o,self.element] ) != false )
$(this).trigger('jGrowl.close');
}).bind('jGrowl.close', function() {
// Pause the notification, lest during the course of animation another close event gets called.
$(this).data('jGrowl.pause', true);
$(this).animate(o.animateClose, o.speed, o.easing, function() {
$(this).remove();
var close = o.close.apply( notification , [notification,message,o,self.element] );
if ( $.isFunction(close) )
close.apply( notification , [notification,message,o,self.element] );
});
}).trigger('jGrowl.beforeOpen');
/** Optional Corners Plugin **/
if ( $.fn.corner != undefined ) $(notification).corner( o.corners );
/** Add a Global Closer if more than one notification exists **/
if ( $('div.jGrowl-notification:parent', self.element).size() > 1 &&
$('div.jGrowl-closer', self.element).size() == 0 && this.defaults.closer != false ) {
$(this.defaults.closerTemplate).addClass('jGrowl-closer ui-state-highlight ui-corner-all').addClass(this.defaults.theme)
.appendTo(self.element).animate(this.defaults.animateOpen, this.defaults.speed, this.defaults.easing)
.bind("click.jGrowl", function() {
$(this).siblings().children('div.close').trigger("click.jGrowl");
if ( $.isFunction( self.defaults.closer ) ) {
self.defaults.closer.apply( $(this).parent()[0] , [$(this).parent()[0]] );
}
});
};
},
/** Update the jGrowl Container, removing old jGrowl notifications **/
update: function() {
$(this.element).find('div.jGrowl-notification:parent').each( function() {
if ( $(this).data("jGrowl") != undefined && $(this).data("jGrowl").created != undefined &&
($(this).data("jGrowl").created.getTime() + $(this).data("jGrowl").life) < (new Date()).getTime() &&
$(this).data("jGrowl").sticky != true &&
($(this).data("jGrowl.pause") == undefined || $(this).data("jGrowl.pause") != true) ) {
// Pause the notification, lest during the course of animation another close event gets called.
$(this).trigger('jGrowl.beforeClose');
}
});
if ( this.notifications.length > 0 &&
(this.defaults.pool == 0 || $(this.element).find('div.jGrowl-notification:parent').size() < this.defaults.pool) )
this.render( this.notifications.shift() );
if ( $(this.element).find('div.jGrowl-notification:parent').size() < 2 ) {
$(this.element).find('div.jGrowl-closer').animate(this.defaults.animateClose, this.defaults.speed, this.defaults.easing, function() {
$(this).remove();
});
}
},
/** Setup the jGrowl Notification Container **/
startup: function(e) {
this.element = $(e).addClass('jGrowl').append('<div class="jGrowl-notification"></div>');
this.interval = setInterval( function() {
$(e).data('jGrowl.instance').update();
}, this.defaults.check);
if ($.browser.msie && parseInt($.browser.version) < 7 && !window["XMLHttpRequest"]) {
$(this.element).addClass('ie6');
}
},
/** Shutdown jGrowl, removing it and clearing the interval **/
shutdown: function() {
$(this.element).removeClass('jGrowl').find('div.jGrowl-notification').remove();
clearInterval( this.interval );
},
close: function() {
$(this.element).find('div.jGrowl-notification').each(function(){
$(this).trigger('jGrowl.beforeClose');
});
}
});
/** Reference the Defaults Object for compatibility with older versions of jGrowl **/
$.jGrowl.defaults = $.fn.jGrowl.prototype.defaults;
})(jQuery);
et j'utilise jQuery version 1.4.1
iciVoila je pense avoir rien oublier si c'est le cas n'hésitez pas, seul petit souci quand ont ce déconnecte du site le message du style: "vous êtes maintenant déconnectez du site" n'apparaît pas pourquoi ? j'espère qu'un programmateur PHP au grand cœur passera par la ! :roll:
ATTENTION ! pour les débutants ajouter uniquement les portions de code entre l'indication //Ajout CPascal et //fin de l'ajout j'ai mis un peut de code xoops pour vous aidez a vous repérez sur le fichier ouvert
il serait mieux de diviser cette option en deux mode d'option préférence du style:
option 1
choix d'utilisez la redirection en java sur le site
$xoopsConfig['java_message_redirection_site']==1)
option 2
choix d'utilisez la redirection en java dans l'administration
$xoopsConfig['java_message_redirection_admin']==1)
concernant la deuxième modifs (Mr burning) je le post sur un nouveau sujet afin d'éviter les confusions
ici