]> git.mxchange.org Git - friendica.git/commitdiff
Load infos and notices via ping and show them with js popup
authorFabio Comuni <fabrix.xm@gmail.com>
Mon, 5 Sep 2011 12:01:21 +0000 (14:01 +0200)
committerFabio Comuni <fabrix.xm@gmail.com>
Mon, 5 Sep 2011 12:01:21 +0000 (14:01 +0200)
22 files changed:
boot.php
images/icons/10/info.png [new file with mode: 0644]
images/icons/10/notice.png [new file with mode: 0644]
images/icons/16/info.png [new file with mode: 0644]
images/icons/16/notice.png [new file with mode: 0644]
images/icons/22/info.png [new file with mode: 0644]
images/icons/22/notice.png [new file with mode: 0644]
images/icons/48/info.png [new file with mode: 0644]
images/icons/48/notice.png [new file with mode: 0644]
images/icons/info.png [new file with mode: 0644]
images/icons/notice.png [new file with mode: 0644]
index.php
js/main.js
library/jgrowl/README [new file with mode: 0644]
library/jgrowl/jquery.jgrowl.css [new file with mode: 0755]
library/jgrowl/jquery.jgrowl_minimized.js [new file with mode: 0644]
library/stanlemon-jgrowl-tip.tar.gz [new file with mode: 0644]
mod/ping.php
view/head.tpl
view/theme/quattro/colors.less
view/theme/quattro/quattro.less
view/theme/quattro/style.css

index 13e1eff11737465a6bfd102ffb98ea180e15698a..c131160129f21619c7404da7b85034860fbc4dcd 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -721,14 +721,16 @@ function remote_user() {
 if(! function_exists('notice')) {
 function notice($s) {
        $a = get_app();
+       if(! x($_SESSION,'sysmsg'))     $_SESSION['sysmsg'] = array();
        if($a->interactive)
-               $_SESSION['sysmsg'] .= $s;
+               $_SESSION['sysmsg'][] = $s;
 }}
 if(! function_exists('info')) {
 function info($s) {
        $a = get_app();
+       if(! x($_SESSION,'sysmsg_info')) $_SESSION['sysmsg_info'] = array();
        if($a->interactive)
-               $_SESSION['sysmsg_info'] .= $s;
+               $_SESSION['sysmsg_info'][] = $s;
 }}
 
 
diff --git a/images/icons/10/info.png b/images/icons/10/info.png
new file mode 100644 (file)
index 0000000..8097733
Binary files /dev/null and b/images/icons/10/info.png differ
diff --git a/images/icons/10/notice.png b/images/icons/10/notice.png
new file mode 100644 (file)
index 0000000..327d583
Binary files /dev/null and b/images/icons/10/notice.png differ
diff --git a/images/icons/16/info.png b/images/icons/16/info.png
new file mode 100644 (file)
index 0000000..dcd501f
Binary files /dev/null and b/images/icons/16/info.png differ
diff --git a/images/icons/16/notice.png b/images/icons/16/notice.png
new file mode 100644 (file)
index 0000000..8e551ad
Binary files /dev/null and b/images/icons/16/notice.png differ
diff --git a/images/icons/22/info.png b/images/icons/22/info.png
new file mode 100644 (file)
index 0000000..c3cc715
Binary files /dev/null and b/images/icons/22/info.png differ
diff --git a/images/icons/22/notice.png b/images/icons/22/notice.png
new file mode 100644 (file)
index 0000000..e45b18c
Binary files /dev/null and b/images/icons/22/notice.png differ
diff --git a/images/icons/48/info.png b/images/icons/48/info.png
new file mode 100644 (file)
index 0000000..a66ae38
Binary files /dev/null and b/images/icons/48/info.png differ
diff --git a/images/icons/48/notice.png b/images/icons/48/notice.png
new file mode 100644 (file)
index 0000000..a445485
Binary files /dev/null and b/images/icons/48/notice.png differ
diff --git a/images/icons/info.png b/images/icons/info.png
new file mode 100644 (file)
index 0000000..ea2b0ff
Binary files /dev/null and b/images/icons/info.png differ
diff --git a/images/icons/notice.png b/images/icons/notice.png
new file mode 100644 (file)
index 0000000..b6017c8
Binary files /dev/null and b/images/icons/notice.png differ
index 51c87cae6e6feff8b7f4abee66c6a4a61a76f635..3db8170ef4fe4d8cfd507e0f7e04bd11227a36c0 100644 (file)
--- a/index.php
+++ b/index.php
@@ -112,10 +112,10 @@ if(! x($_SESSION,'authenticated'))
        header('X-Account-Management-Status: none');
 
 if(! x($_SESSION,'sysmsg'))
-       $_SESSION['sysmsg'] = '';
+       $_SESSION['sysmsg'] = array();
 
 if(! x($_SESSION,'sysmsg_info'))
-       $_SESSION['sysmsg_info'] = '';
+       $_SESSION['sysmsg_info'] = array();
 
 /*
  * check_config() is responsible for running update scripts. These automatically 
@@ -262,7 +262,7 @@ if(isset($homebase))
 // now that we've been through the module content, see if the page reported
 // a permission problem and if so, a 403 response would seem to be in order.
 
-if(stristr($_SESSION['sysmsg'], t('Permission denied'))) {
+if(stristr( implode("",$_SESSION['sysmsg']), t('Permission denied'))) {
        header($_SERVER["SERVER_PROTOCOL"] . ' 403 ' . t('Permission denied.'));
 }
 
@@ -272,7 +272,7 @@ if(stristr($_SESSION['sysmsg'], t('Permission denied'))) {
  *
  */
        
-if(x($_SESSION,'sysmsg')) {
+/*if(x($_SESSION,'sysmsg')) {
        $a->page['content'] = "<div id=\"sysmsg\" class=\"error-message\">{$_SESSION['sysmsg']}</div>\r\n"
                . ((x($a->page,'content')) ? $a->page['content'] : '');
        $_SESSION['sysmsg']="";
@@ -283,7 +283,7 @@ if(x($_SESSION,'sysmsg_info')) {
                . ((x($a->page,'content')) ? $a->page['content'] : '');
        $_SESSION['sysmsg_info']="";
        unset($_SESSION['sysmsg_info']);
-}
+}*/
 
 
 
index 30bf8a3b742d9dbb7447bd0313bb5c931c5c8f13..328b1f231ea407e5801b26050c6da3b25099c9de 100644 (file)
                        if(notif == 0) { notif = ''; $('#notify-update').removeClass('show') } else { $('#notify-update').addClass('show') }
                        $('#notify-update').html(notif);
                        
+                       var eSysmsg = $(data).find('sysmsgs');
+                       eSysmsg.children("notice").each(function(){
+                               text = $(this).text();
+                               $.jGrowl(text, { sticky: true, theme: 'notice' });
+                       });
+                       eSysmsg.children("info").each(function(){
+                               text = $(this).text();
+                               $.jGrowl(text, { sticky: false, theme: 'info' });
+                       });
+                       
                });
                
                
diff --git a/library/jgrowl/README b/library/jgrowl/README
new file mode 100644 (file)
index 0000000..3c94f75
--- /dev/null
@@ -0,0 +1,3 @@
+http://stanlemon.net/projects/jgrowl.html
+
+jGrowl is free and open source, it's distributed under the MIT and GPL licenses
diff --git a/library/jgrowl/jquery.jgrowl.css b/library/jgrowl/jquery.jgrowl.css
new file mode 100755 (executable)
index 0000000..b4deb97
--- /dev/null
@@ -0,0 +1,136 @@
+
+div.jGrowl {
+       z-index:                        9999;
+       color:                          #fff;
+       font-size:                      12px;
+}
+
+/** Special IE6 Style Positioning **/
+div.ie6 {
+       position:                       absolute;
+}
+
+div.ie6.top-right {
+       right:                          auto;
+       bottom:                         auto;
+       left:                           expression( ( 0 - jGrowl.offsetWidth + ( document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth ) + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );
+       top:                            expression( ( 0 + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );
+}
+
+div.ie6.top-left {
+       left:                           expression( ( 0 + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );
+       top:                            expression( ( 0 + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );
+}
+
+div.ie6.bottom-right {
+       left:                           expression( ( 0 - jGrowl.offsetWidth + ( document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth ) + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );
+       top:                            expression( ( 0 - jGrowl.offsetHeight + ( document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );
+}
+
+div.ie6.bottom-left {
+       left:                           expression( ( 0 + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );
+       top:                            expression( ( 0 - jGrowl.offsetHeight + ( document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );
+}
+
+div.ie6.center {
+       left:                           expression( ( 0 + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );
+       top:                            expression( ( 0 + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );
+       width:                          100%;
+}
+
+/** Normal Style Positions **/
+div.jGrowl {
+       position:                       absolute;
+}
+
+body > div.jGrowl {
+       position:                       fixed;
+}
+
+div.jGrowl.top-left {
+       left:                           0px;
+       top:                            0px;
+}
+
+div.jGrowl.top-right {
+       right:                          0px;
+       top:                            0px;
+}
+
+div.jGrowl.bottom-left {
+       left:                           0px;
+       bottom:                         0px;
+}
+
+div.jGrowl.bottom-right {
+       right:                          0px;
+       bottom:                         0px;
+}
+
+div.jGrowl.center {
+       top:                            0px;
+       width:                          50%;
+       left:                           25%;
+}
+
+/** Cross Browser Styling **/
+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-color:               #000;
+       opacity:                                .85;
+       -ms-filter:                     "progid:DXImageTransform.Microsoft.Alpha(Opacity=85)"; 
+       filter:                                 progid:DXImageTransform.Microsoft.Alpha(Opacity=85); 
+       zoom:                                   1;
+       width:                                  235px;
+       padding:                                10px;
+       margin-top:                     5px;
+       margin-bottom:                  5px;
+       font-family:                    Tahoma, Arial, Helvetica, sans-serif;
+       font-size:                              1em;
+       text-align:                     left;
+       display:                                none;
+       -moz-border-radius:     5px;
+       -webkit-border-radius:  5px;
+}
+
+div.jGrowl div.jGrowl-notification {
+       min-height:                     40px;
+}
+
+div.jGrowl div.jGrowl-notification,
+div.jGrowl div.jGrowl-closer {
+       margin:                                 10px;
+}
+
+div.jGrowl div.jGrowl-notification div.jGrowl-header {
+       font-weight:                    bold;
+       font-size:                              .85em;
+}
+
+div.jGrowl div.jGrowl-notification div.jGrowl-close {
+       z-index:                                99;
+       float:                                  right;
+       font-weight:                    bold;
+       font-size:                              1em;
+       cursor:                                 pointer;
+}
+
+div.jGrowl div.jGrowl-closer {
+       padding-top:                    4px;
+       padding-bottom:                 4px;
+       cursor:                                 pointer;
+       font-size:                              .9em;
+       font-weight:                    bold;
+       text-align:                     center;
+}
+
+/** Hide jGrowl when printing **/
+@media print {
+       div.jGrowl {
+               display:                        none;
+       }
+}
diff --git a/library/jgrowl/jquery.jgrowl_minimized.js b/library/jgrowl/jquery.jgrowl_minimized.js
new file mode 100644 (file)
index 0000000..7828980
--- /dev/null
@@ -0,0 +1,11 @@
+(function($){$.jGrowl=function(m,o){if($('#jGrowl').size()==0)
+$('<div id="jGrowl"></div>').addClass((o&&o.position)?o.position:$.jGrowl.defaults.position).appendTo('body');$('#jGrowl').jGrowl(m,o);};$.fn.jGrowl=function(m,o){if($.isFunction(this.each)){var args=arguments;return this.each(function(){var self=this;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);}
+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,{defaults:{pool:0,header:'',group:'',sticky:false,position:'top-right',glue:'after',theme:'default',themeState:'highlight',corners:'10px',check:250,life:3000,closeDuration:'normal',openDuration:'normal',easing:'swing',closer:true,closeTemplate:'&times;',closerTemplate:'<div>[ close all ]</div>',log:function(e,m,o){},beforeOpen:function(e,m,o){},afterOpen: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:[],element:null,interval:null,create:function(message,o){var o=$.extend({},this.defaults,o);if(typeof o.speed!=='undefined'){o.openDuration=o.speed;o.closeDuration=o.speed;}
+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 '+o.themeState+' ui-corner-all'+
+((o.group!=undefined&&o.group!='')?' '+o.group:'')+'">'+'<div class="jGrowl-close">'+o.closeTemplate+'</div>'+'<div class="jGrowl-header">'+o.header+'</div>'+'<div class="jGrowl-message">'+message+'</div></div>').data("jGrowl",o).addClass(o.theme).children('div.jGrowl-close').bind("click.jGrowl",function(){$(this).parent().trigger('jGrowl.close');}).parent();$(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.openDuration,o.easing,function(){if($.browser.msie&&(parseInt($(this).css('opacity'),10)===1||parseInt($(this).css('opacity'),10)===0))
+this.style.removeAttribute('filter');if($(this).data("jGrowl")!=null)
+$(this).data("jGrowl").created=new Date();$(this).trigger('jGrowl.afterOpen');});}}).bind('jGrowl.afterOpen',function(){o.afterOpen.apply(notification,[notification,message,o,self.element]);}).bind('jGrowl.beforeClose',function(){if(o.beforeClose.apply(notification,[notification,message,o,self.element])!=false)
+$(this).trigger('jGrowl.close');}).bind('jGrowl.close',function(){$(this).data('jGrowl.pause',true);$(this).animate(o.animateClose,o.closeDuration,o.easing,function(){if($.isFunction(o.close)){if(o.close.apply(notification,[notification,message,o,self.element])!==false)
+$(this).remove();}else{$(this).remove();}});}).trigger('jGrowl.beforeOpen');if(o.corners!=''&&$.fn.corner!=undefined)$(notification).corner(o.corners);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().trigger("jGrowl.beforeClose");if($.isFunction(self.defaults.closer)){self.defaults.closer.apply($(this).parent()[0],[$(this).parent()[0]]);}});};},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()+parseInt($(this).data("jGrowl").life))<(new Date()).getTime()&&$(this).data("jGrowl").sticky!=true&&($(this).data("jGrowl.pause")==undefined||$(this).data("jGrowl.pause")!=true)){$(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();});}},startup:function(e){this.element=$(e).addClass('jGrowl').append('<div class="jGrowl-notification"></div>');this.interval=setInterval(function(){$(e).data('jGrowl.instance').update();},parseInt(this.defaults.check));if($.browser.msie&&parseInt($.browser.version)<7&&!window["XMLHttpRequest"]){$(this.element).addClass('ie6');}},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');});}});$.jGrowl.defaults=$.fn.jGrowl.prototype.defaults;})(jQuery);
\ No newline at end of file
diff --git a/library/stanlemon-jgrowl-tip.tar.gz b/library/stanlemon-jgrowl-tip.tar.gz
new file mode 100644 (file)
index 0000000..07a5fb0
Binary files /dev/null and b/library/stanlemon-jgrowl-tip.tar.gz differ
index 8a3d284af06acf01971c740b2989878645a7d445..38a32744d05a7966e469d472d0015984d20555cf 100644 (file)
@@ -159,8 +159,26 @@ function ping_init(&$a) {
        }
 
 
-       echo "  </notif>
-               </result>
+       echo "  </notif>";
+       
+       echo " <sysmsgs>";
+               if(x($_SESSION,'sysmsg')){
+                       foreach ($_SESSION['sysmsg'] as $m){
+                               echo "<notice>".($m)."</notice>";
+                       }
+                       $_SESSION['sysmsg']=array();
+                       unset($_SESSION['sysmsg']);
+               }
+               if(x($_SESSION,'sysmsg_info')){
+                       foreach ($_SESSION['sysmsg_info'] as $m){
+                               echo "<info>".($m)."</info>";
+                       }
+                       $_SESSION['sysmsg_info']=array();
+                       unset($_SESSION['sysmsg_info']);
+               }
+       
+       echo " </sysmsgs>";
+       echo"</result>
        ";
 
        killme();
index a18bcdd5e252ee576f8322ea7b37d7b8843baf39..b6d78da390a4d5b4b29c5dc500c1ee865a05dd91 100644 (file)
@@ -1,9 +1,12 @@
 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
 <base href="$baseurl/" />
 <meta name="generator" content="$generator" />
-<link rel="stylesheet" type="text/css" href="$stylesheet" media="all" />
 <link rel="stylesheet" href="$baseurl/library/fancybox/jquery.fancybox-1.3.4.css" type="text/css" media="screen" />
 <link rel="stylesheet" href="$baseurl/library/tiptip/tipTip.css" type="text/css" media="screen" />
+<link rel="stylesheet" href="$baseurl/library/jgrowl/jquery.jgrowl.css" type="text/css" media="screen" />
+
+<link rel="stylesheet" type="text/css" href="$stylesheet" media="all" />
+
 <link rel="shortcut icon" href="$baseurl/images/friendika-32.png" />
 <link rel="search"
          href="$baseurl/opensearch" 
@@ -16,6 +19,7 @@
 <script type="text/javascript" src="$baseurl/js/jquery.js" ></script>
 <script type="text/javascript" src="$baseurl/library/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
 <script type="text/javascript" src="$baseurl/library/tiptip/jquery.tipTip.minified.js"></script>
+<script type="text/javascript" src="$baseurl/library/jgrowl/jquery.jgrowl_minimized.js"></script>
 <script type="text/javascript" src="$baseurl/library/tinymce/jscripts/tiny_mce/tiny_mce_src.js" ></script>
 <script type="text/javascript" src="$baseurl/js/acl.js" ></script>
 <script type="text/javascript" src="$baseurl/js/main.js" ></script>
index 6015c61ee470b01721efc233c1dc68780b9fa166..3d3074d605dea64c73e05f52d45fb341a06dd086 100644 (file)
@@ -59,5 +59,8 @@
 @AsideConnectBg: @Blue3;
 @AsideConnectHoverBg: @Blue1;
 
+@InfoColor: @Grey1;
+@InfoBackgroundColor: @Metalic3;
 
-
+@NoticeColor: @Grey1;
+@NoticeBackgroundColor: #511919;
index c7cbe7ebb230618457e2b3abd5cec5e37c5da270..2c4e0464a41a913528827055ebe41e75cbe1b7fa 100644 (file)
@@ -38,6 +38,19 @@ a:hover {color: @LinkHover; text-decoration: underline; }
        .icon { float: right; }
 }
 
+/* popup notifications */
+div.jGrowl div.notice {
+       background: @NoticeBackgroundColor url("../../../images/icons/48/notice.png") no-repeat 5px center;
+       color:  @NoticeColor;
+       padding-left: 58px;
+}
+div.jGrowl div.info {
+       background: @InfoBackgroundColor url("../../../images/icons/48/info.png") no-repeat 5px center;
+       color:  @InfoColor;
+       padding-left: 58px;
+}
+
+
 
 /* header */
 header {
@@ -237,4 +250,3 @@ section {
 }
 
 
-
index 2b950c3ef9439ed5a83d74b98b36be68537a7c55..0fce02f0397491c41f9b57ad411b228e84c7f1ff 100644 (file)
@@ -95,6 +95,17 @@ a:hover {
 .tool .icon {
   float: right;
 }
+/* popup notifications */
+div.jGrowl div.notice {
+  background: #511919 url("../../../images/icons/48/notice.png") no-repeat 5px center;
+  color: #ffffff;
+  padding-left: 58px;
+}
+div.jGrowl div.info {
+  background: #364e59 url("../../../images/icons/48/info.png") no-repeat 5px center;
+  color: #ffffff;
+  padding-left: 58px;
+}
 /* header */
 header {
   position: fixed;