My Tags Widget¶
The My Tags widget displays a list of the user’s tags and any tags shared with the user.
The widget utilizes an HTML file, SQL script and Python script as shown below. Since the tags list is different for each user, Caching should be set to each user.
HTML Code¶
Below is the HTML code for the My Tags widget. As supplied by TouchPoint, the file name is WidgetTagsHTML.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | <div class="box"> <div class="box-title hidden-xs"> <h5><a href="/Tags">{{WidgetName}}</a></h5> </div> <a class="visible-xs-block" id="{{WidgetId}}-collapse" data-toggle="collapse" href="#{{WidgetId}}-section" aria-expanded="true" aria-controls="{{WidgetId}}-section"> <div class="box-title"> <h5><i class="fa fa-chevron-circle-right"></i> {{WidgetName}}</h5> </div> </a> <div class="collapse in" id="{{WidgetId}}-section"> {{#ifGT results.Count 0}} <ul class="list-group"> {{#each results}} <li class="list-group-item"><a href="/Tags?tag={{Id}}%2c{{PeopleId}}!{{Name}}">{{DisplayName}}</a></li> {{/each}} </ul> {{else}} <div class="box-content"></div> {{/ifGT}} </div> </div> |
SQL Script¶
Below is the SQL script for the My Tags widget. As supplied by TouchPoint, the file name is WidgetTagsSQL.
1 2 3 4 5 6 7 8 9 10 11 | select * from (select top 100 t.Id, t.PeopleId, t.Name, t.Name as DisplayName, 1 as [Order] from Tag t where t.PeopleId = @pid and t.TypeId = 1 order by Name) as set1 union all select * from (select top 100 t.Id, t.PeopleId, t.Name, t.OwnerName + '!' + t.Name as DisplayName, 2 as [Order] from Tag t join TagShare ts on t.Id = ts.TagId where t.PeopleId != @pid and t.TypeId = 1 and ts.PeopleId = @pid order by Name) as set2 |
Python Script¶
Below is the Python script for the My Tags widget. As supplied by TouchPoint, the file name is WidgetTagsPython.
1 2 3 4 5 6 7 8 | def Get(): sql = Data.SQLContent template = Data.HTMLContent params = { 'pid': Data.CurrentPerson.PeopleId } Data.results = q.QuerySql(sql, params) print model.RenderTemplate(template) Get() |
Latest Update |
04/30/2020 |
Added this article.