Activity Dashboard

    Inhaltsverzeichnis
    keine Gliederung

    Version seit 11:06, 18 Jan 2025

    zu dieser Version.

    Zurück zu Versionshistorie.

    Zeige aktuelle Version

    <link href="/skins/common/templates/activitydashboard.css" rel="stylesheet" type="text/css" />
    
    try {
        // set page-level user details
        var ActivityUser = page.namespaceuser;
        var userDetails = wiki.api(ActivityUser.api);
    } catch {
        <span class="error-dekiscript">wiki.localize('MindTouch.Templates.UserProfile.error.initialization');</span>
        web.showerror(__error);
        return;
    };
    
    <div id="deki-activity-dashboard">
    <div id="col-left">
    
    /*
     * User Profile Information Box 
     */
    <div id="deki-profile" class="deki-dashboard-group">
    try {
        <div class="dashboard-title">
            <div class="profile-name">
                #ActivityUser.fullname > 0 ? ActivityUser.fullname : ActivityUser.name;
    
                var status = xml.text(userDetails, 'status');
                status == 'active' ? '' : ' (' .. wiki.localize('MindTouch.Templates.UserProfile.status.disabled') .. ')';
            </div>
        </div>
    
        <div class="profile-image">
            ActivityUser.Gravatar
        </div>
        <dl class="profile-details">
            var loginDate = date.parse(xml.text(userDetails, 'date.lastlogin'));
            <dt>wiki.localize('MindTouch.Templates.UserProfile.label.lastlogin') .. ': ';</dt>
            <dd class="dashboard-lastlogin">Template('MindTouch/Controls/DateTime', {date:loginDate, format:'datetime'});</dd>
            <dt>
                wiki.localize('MindTouch.Templates.UserProfile.label.joined') .. ': '
            </dt>
            <dd class="profile-joined">
                var joinDate = date.parse(xml.text(userDetails, 'date.created'));
                Template('MindTouch/Controls/DateTime', {date:joinDate, format:'date'})
            </dd>
            <dt>
                wiki.localize('MindTouch.Templates.UserProfile.label.timezone') .. ': ';
            </dt>
            <dd class="profile-timezone">
                ActivityUser.timezone;
            </dd>
            if (#ActivityUser.language > 0 && ActivityUser.language != site.language) {
            <dt>
                wiki.localize('MindTouch.Templates.UserProfile.label.language') .. ': '
            </dt>
            <dd class="profile-language">
                ActivityUser.language;
            </dd>
            }
            var groups = userDetails['groups/group'];
            if (#groups > 0) {
            <dt>
                wiki.localize('MindTouch.Templates.UserProfile.label.groups') .. ': '
            </dt>
            <dd class="profile-groups">
                string.join(list.sort([ xml.text(g["groupname"]) foreach var g in groups ]), ", ");
            </dd>
            }
        </dl>
        <div class="clear" />
    } catch {    
        <span class="error-dekiscript">wiki.localize('MindTouch.Templates.UserProfile.error.profile');</span>
        web.showerror(__error);
    };
    </div> // end deki-profile
    
    /*
     * Recent Comments Dashboard Box
     */
    	
    /*
     * Recent User Activities
     */
    <div id="deki-recent-changes" class="deki-dashboard-group">
    try {
        <div class="dashboard-title">wiki.localize('MindTouch.Templates.UserProfile.label.changes')</div>
       
        var feedUri = ActivityUser.api & 'feed' & {limit: 10, format: 'raw'};
        var changes = wiki.api(feedUri)['change'];
    
        if (#changes > 0) {
            <ul>
            foreach (var c in changes) {
    
                var pageId =  xml.num(c, 'rc_cur_id');
                var page = wiki.getPage(pageId);
                var changeDate = date.parse(xml.text(c, 'rc_timestamp'), 'yyyyMMddHHmmss');
                var pageExists = xml.num(c, 'rc_page_exists');
                var pageTitle = xml.text(c, 'rc_title');
    
                 <li>
                    pageExists ? web.link(page.uri, page.title) : pageTitle;
                    <div class="recentchanges-date">Template('MindTouch/Controls/DateTime', {date:changeDate, format:'date'})</div> 
                    <div class="recentchanges-details">
                        <span class="dashboard-change">xml.text(c, 'rc_comment');</span>
                    </div>
                </li>
            }
            </ul>
    
            <div class="deki-dashboard-group-footer">
                web.link('/Special:Contributions?target=' .. ActivityUser.name,
                   wiki.localize('MindTouch.Templates.UserProfile.label.allchanges', [ActivityUser.name]));
            </div>
        }
        else {
            <div class="dashboard-message">
                wiki.localize('MindTouch.Templates.UserProfile.empty.changes');
            </div>
        }
    } catch {
        <span class="error-dekiscript">wiki.localize('MindTouch.Templates.UserProfile.error.changes');</span>
        web.showerror(__error);
    };
    
    </div> // end deki-recent-changes
    </div> // end col-right
    </div> // end deki-activity-dashboard
    
    // includes
    //dekiapi();
    //jquery.ui('smoothness');
    
    // 8-March-2010  neilw         Added "avatars" and "collapse" options
    // 9-March-2010  carles.coll   Added some styling on the content text ( mantain original comment structure ), and also autolinks on http links.
    
    // + PARAMETERS
    var par = {     
        username:  $0 ?? __request.args.user ?? args.user ?? string.substr(page.path, 5),
        max: $1 ?? $max ?? __request.args.max ?? args.max ?? 30,
        skip: $2 ?? $skip ?? __request.args.skip ?? args.skip ?? 0,
        collapse: $collapse ?? __request.args.collapse ?? false,
        avatars: $avatars ?? __request.args.avatars ?? true,
        language: __request.args.language ?? args.language ?? ( page.language != '' ? page.language : ( site.language !=''?site.language:'en-us') ),
        ajax_action: String.tolower( __request.args.ajax_action ?? args.ajax_action ?? 'load')   
       };
    
    if ((par.ajax_action=='preload') || (par.ajax_action=='load') || (par.ajax_action=='reload_UsuarioLineaTemporal')) {
    
    if ((par.ajax_action=='load') || (par.ajax_action=='reload_UsuarioLineaTemporal')) {
    // + CONSTANTS
    var NO_AVATAR = '';
    
    // + VARS
    var cache_avatars = {};
    var avatar,source,n,a;
    var username = par.username;
    
    <div id='MensajesWiki' class='hslice'>
    <div class='entry-title' style='display: none'>"Wiki Messages"</div>
    <div class='entry-content'>
    // <a href='/User:carles_coll/Web_Slices/Usuario_Linea_Temporal#MensajesWiki' rel='feedurl' style='display:none'></a>
    <p>
    "Messages to "..username..": ";
    </p>
    <div id="timeline_block">
    
     <div id="deki-timeline" class="deki-timeline">
       var max = par.max; 
       var skip = par.skip;
        foreach (var entry in wiki.getsearch('type:comment AND ( @'..username..' )', max, '-date') ) {
          //       var user = entry.user, p= entry.page; 
          var user = entry.author, p= entry.page;
          let un = user.name;
            if (par.avatars && !Map.Contains(cache_avatars,un)) {
               let source=wiki.getpage('/User:' .. un).files;
               let avatar=NO_AVATAR;
               foreach (var f in source) {
                  let n=f.name;
                  let a=f.api;
                  if (String.tolower(n) == 'avatar.jpg') { let avatar=f.api; }
                 }
               if (avatar==NO_AVATAR) { let avatar = user.gravatar; }
               let cache_avatars ..= {(un): ("<img src='"..avatar.."' width='30px' valing='top' />") };
              }
     
         <div class="dekitl-item" id=(un)>
           <div class="dekitl-user">
            <a href=('/user:'..un) rel="internal" target="_blank">
              if (par.avatars) {
                 web.html(cache_avatars[un]);
                 <br />;
              }
              un;
            </a>
           </div>
           <div class="dekitl-message">
            var id = @msg .. __index;
            var timestamp = <span class='dekitl-timestamp'>(date.changetimezone(entry.date, user.timezone))</span>;
    
            <span class="dekitl-title">
             if (par.collapse) collapseitem(id, _,_, "slide");
             "Message on ";
             <a href=(p.uri) title=(p.title) rel="internal" target="_blank">(p.title)</a>;
             if (par.collapse) {
               " ";
               timestamp;
             }
            </span>
            <br />
    
            var comhref=entry.text;        
            var imov=0;
            foreach (var ihl in String.IndexesOf(comhref,"http")) { // #mod @carles.coll 2010/02/15
              let ihl+=imov;
              var href=String.SubStr(comhref,ihl);            
              var endpos=List.Min(List.Select([String.IndexOf(href," "),String.IndexOf(href,"\n"),String.Length(href)],"$>0"));
              var shltxt=String.SubStr(href,0,endpos);
              var shlref="<a href='"..shltxt.."'>"..shltxt.."</a>";
              let imov+=String.Length(shlref)-String.Length(shltxt);
              let comhref=String.SubStr(comhref,0,ihl)..shlref..String.SubStr(comhref,ihl+String.Length(shltxt));
             }   
    
            <span class='dekitl-content' id=(id) style=(par.collapse ? "display:none" : "")>
             web.html(String.Replace(comhref,'@'..username,'').." ");
             if (!par.collapse) timestamp;
            </span>
          </div>
         </div>
        }
      </div>
    
    </div>
    
    </div>
    </div>
     } // -- if ((par.ajax_action=='load') || (par.ajax_action=='reload_UsuarioLineaTemporal')) ..
    
    if ( (par.ajax_action=='load') || (par.ajax_action=='preload') ) {
     
    <style type="text/css">"
    	#deki-timeline {
    		font-size: 12px;		
    		margin: 12px 0;
    	}
    	div.dekitl-item {
    		overflow: auto;
    		padding: 8px;
                    border-top: 1px solid;
    	}
    	div.dekitl-at {
    		background-color: #ffffce;
    	}
    	div.dekitl-user {
    		width: 60px; 
    		float: left;
    		text-align: center;
    		font-weight: strong;
    	}
    	div.dekitl-user a img {
    		border: none;
    	}
    	div.dekitl-message {
    		padding-left: 70px;
    	}
    	div.dekitl-message span {
    		font-size: 11px;
    		color: #666;
    	}
    
    	div.dekitl-message span.dekitl-title,
    	div.dekitl-message span.dekitl-title a {
    		color: #333;
    	}
    
    	div.dekitl-message span.dekitl-timestamp {
    		font-style: italic;
                    float:right;
    	}
    
    	div.dekitl-message span.dekitl-content {
                   white-space:pre-line;
                   line-height: auto;
    	       overflow: visible;
     	       margin: 0px;
    		padding: 4px 0;	
    		font-size: 14px;
                    color: black;
    	}
    "</style>
    }
    
    } // -- if ((par.ajax_action=='preload') || (par.ajax_action=='load') || (par.ajax_action=='reload_UsuarioLineaTemporal')) ..
    

     

     

    Deki Appliance - Powered by TurnKey Linux