ToDoList. 1.2 * allow custom user list to be passed in * publish changes to a channel ***/

Similar documents
1.2 * allow custom user list to be passed in * publish changes to a channel

if(! list.contains(list.collect(params,'key'),'title')){ <div style="font-weight:bold;color:red;">"warning: A title field must be assigned.

Deccansoft Software Services

Wanted! Introduction. Step 1: Styling your poster. Activity Checklist. In this project, you ll learn how to make your own poster.

CSS Cascading Style Sheets

HTML Summary. All of the following are containers. Structure. Italics Bold. Line Break. Horizontal Rule. Non-break (hard) space.

HTML TAG SUMMARY HTML REFERENCE 18 TAG/ATTRIBUTE DESCRIPTION PAGE REFERENCES TAG/ATTRIBUTE DESCRIPTION PAGE REFERENCES MOST TAGS

Chapter 7: JavaScript for Client-Side Content Behavior

CS197WP. Intro to Web Programming. Nicolas Scarrci - February 13, 2017

Multimedia Systems and Technologies Lab class 6 HTML 5 + CSS 3

Networks and Web for Health Informatics (HINF 6220) Tutorial 8 : CSS. 8 Oct 2015

Assignments (4) Assessment as per Schedule (2)

CSS Selectors. element selectors. .class selectors. #id selectors

GIMP WEB 2.0 MENUS WEB 2.0 MENUS: HORIZONTAL NAVIGATION BAR CREATING AN HTML LIST

Denes Kubicek. Oracle ACE APEX Developer of the Year 2008

WEBSITE PROJECT 2 PURPOSE: INSTRUCTIONS: REQUIREMENTS:

<html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8">

IBM Bluemix Node-RED Watson Starter

<style type="text/css"> <!-- body {font-family: Verdana, Arial, sans-serif} ***set font family for entire Web page***

Fetch terms and conditions apply. Fetch is only available for business banking purposes. The Kiwibank Fetch name, logos and related trademarks and

Web Engineering CSS. By Assistant Prof Malik M Ali

Santa Tracker. Release Notes Version 1.0

Session 4. Style Sheets (CSS) Reading & References. A reference containing tables of CSS properties

KillTest *KIJGT 3WCNKV[ $GVVGT 5GTXKEG Q&A NZZV ]]] QORRZKYZ IUS =K ULLKX LXKK [VJGZK YKX\OIK LUX UTK _KGX

GIMP WEB 2.0 MENUS. Web 2.0 Menus: Horizontal Navigation Bar with Dynamic Background Image

Introduction to using HTML to design webpages

CSS CSS how to display to solve a problem External Style Sheets CSS files CSS Syntax

Index. CSS directive, # (octothorpe), intrapage links, 26

src1-malan/ajax/ajax1.html ajax1.html Gets stock quote from quote1.php via Ajax, displaying result with alert().

Cascading Style Sheets (CSS)

Final Examination Semester 1 / Year 2012

Controlled Assessment Task. Question 1 - Describe how this HTML code produces the form displayed in the browser.

HTML and CSS COURSE SYLLABUS

HTMLnotesS15.notebook. January 25, 2015

Chapter 4 Notes. Creating Tables in a Website

recall: a Web page is a text document that contains additional formatting information in the HyperText Markup Language (HTML)

Chapter4: HTML Table and Script page, HTML5 new forms. Asst. Prof. Dr. Supakit Nootyaskool Information Technology, KMITL

Signs of Spring App. Release Notes Version 1.0

<body bgcolor=" " fgcolor=" " link=" " vlink=" " alink=" "> These body attributes have now been deprecated, and should not be used in XHTML.

Programmazione Web a.a. 2017/2018 HTML5

UNIVERSITY OF TORONTO Faculty of Arts and Science APRIL 2016 EXAMINATIONS. CSC309H1 S Programming on the Web Instructor: Ahmed Shah Mashiyat

COMP1000 Mid-Session Test 2017s1

=================== coffee-submit.php ==========================

CE419 Web Programming. Session 3: HTML (contd.), CSS

Dynamic Form Processing Tool Version 5.0 November 2014

CSS: The Basics CISC 282 September 20, 2014

Scriptaculous Stuart Halloway

CSS: Layout Part 2. clear. CSS for layout and formatting: clear

CSC309 Tutorial CSS & XHTML

CS 350 COMPUTER/HUMAN INTERACTION. Lecture 6

Web Technologies - by G. Sreenivasulu Handout - 1 UNIT - I

CSC 121 Computers and Scientific Thinking

Page Layout Using Tables

The Hypertext Markup Language (HTML) Part II. Hamid Zarrabi-Zadeh Web Programming Fall 2013

Cascading Style Sheets

Outline. Link HTML With Style Sheets &6&7XWRULDO &66 ;+70/ (GZDUG;LD

CSS. Lecture 16 COMPSCI 111/111G SS 2018

Web Design and Development ACS Chapter 12. Using Tables 11/23/2017 1

GIMP WEB 2.0 MENUS. Web 2.0 Menus: Horizontal Navigation Bar

Comp-206 : Introduction to Software Systems Lecture 23. Alexandre Denault Computer Science McGill University Fall 2006

Psychology Experiments on the Web Using PHP and MySQL

A Balanced Introduction to Computer Science, 3/E

Viostream Upload Widget

c122sep2214.notebook September 22, 2014

More CSS. <link href="filename" type="text/css" rel="stylesheet" /> CS380

CSS Lecture 16 COMPSCI 111/111G SS 2018

@namespace url( /* set default namespace to HTML */ /* bidi */

CSS3 Basics. From & CSS Visual Dictionary Learning Curve Books, LLC

Zen Garden. CSS Zen Garden

Welcome Please sit on alternating rows. powered by lucid & no.dots.nl/student

Using CSS for page layout

5 Snowdonia. 94 Web Applications with C#.ASP

CSS Cascading Style Sheets

CSS: Cascading Style Sheets

INFS 2150 / 7150 Intro to Web Development / HTML Programming

What do we mean by layouts?

IMY 110 Theme 7 HTML Tables

ICT IGCSE Practical Revision Presentation Web Authoring

INFS 2150 Introduction to Web Development

INFS 2150 Introduction to Web Development

INFS 2150 Introduction to Web Development

INFS 2150 Introduction to Web Development

COMP519 Web Programming Lecture 6: Cascading Style Sheets: Part 2 Handouts

Enterprise Knowledge Platform Adding the Login Form to Any Web Page

/* ========================================================================== PROJECT STYLES

Exam Format: Multiple Choice, True/False, Short Answer (3 points each 75 points total) Write-the-page (25 points)

HTML BEGINNING TAGS. HTML Structure <html> <head> <title> </title> </head> <body> Web page content </body> </html>

Adding CSS to your HTML

Getting your work online. behance.net cargo collective krop coroflot

Chapter 9 Table Basics Key Concepts. Copyright 2013 Terry Ann Morris, Ed.D

Question No: 2 ( Marks: 1 ) - Please choose one Which of these is the correct HTML code for creating a reset button?

Web Authoring and Design. Benjamin Kenwright

SYBMM ADVANCED COMPUTERS QUESTION BANK 2013

Introduction to Web Design CSS Reference

Introduction to Web Design CSS Reference

CSS: Lists, Tables and the Box Model

CSE 154 LECTURE 8: FORMS

Introduction to WEB PROGRAMMING

Tables & Lists. Organized Data. R. Scott Granneman. Jans Carton

Unit 20 - Client Side Customisation of Web Pages. Week 2 Lesson 4 The Box Model

Transcription:

/*** USAGE: ToDoList() Embed a TODO-list into a page. The TODO list allows users to create new items, assign them to other users, and set deadlines. Items that are due are highlighted in yellow, items passed due are shown in red, and completed items are struck out. The TODOlist can be added to any page. The information of the TODO-list is stored as a page property. NOTES: * only 1 TODO-list can be embedded per page * this template requires the DekiAPI script extension * this template requires the jquery script extension CHANGE HISTORY: 1.0 * initial version 1.1 * show error message if dekiapi or jquery extensions are missing * verify if user is logged in or not; if not, disable add & update controls 1.2 * allow custom user list to be passed in * publish changes to a channel ***/ var userlist = $userlist; var publish = $publish?? 'default'; var message = $message?? { ; var allowed; if(userlist) { // convert list of names to list of user objects let userlist = [ (u is map)? u : wiki.getuser(u) foreach var u in userlist ]; let allowed = [ string.tolower(u.name) foreach var u in userlist ]; else if(site.usercount <= 500) { // get list of users from site let userlist = site.users; // check if required extensions are installed if( env.dekiapi is nil) { <span style="color: red; font-weight: bold">"error: Template:TODO requires DekiApi extension to be installed."</span> 1

else if( env.jquery is nil) { <span style="color: red; font-weight: bold">"error: Template:TODO requires jquery extension to be installed."</span> else { // includes dekiapi(); jquery.ui('smoothness'); // input form var disabled = ( // anonymous users can't edit user.anonymous // user cannot update page (wiki.pagepermissions().update is nil) // user is not listed in custom user list (allowed &&!list.contains(allowed, string.tolower(user.name)) )? "disabled" : nil); <div id="deki-todo"> <form> <input id="todoid" type="hidden" value="" /> <div class="todo-assign">" Task: ";</div> <div class="todo-who">" Who: "; ToDoList // check if the userlist is provided, otherwise use a simple textbox instead of a pre-filled listbox if(userlist) { <select id="todowho"disabled=(disabled) > foreach(var u in userlist where!u.anonymous) { <option value=(u.name) selected=((u.id == user.id)? 'selected' : nil)> u.name </option> </select> else { <input id="todowho" type="text" value=(userlist) disabled=(disabled) /> </div> <div class="todo-what">"what: "; <input id="todowhat" type="text" disabled=(disabled) /></div> <div class="todo-when">" When: "; <input id="todowhen" type="text" value=(date.format(date.now, 'MM/dd/yyyy')) disabled=(disabled) ctor="$this.datepicker();" /></div> <div class="todo-submit"> <input id="todoadd" type="submit" value="add" disabled=(disabled) ctor=" when($this.click) { @todoupdate({ index: #todoid.val(), entry: { what: #todowhat.val(), 2

who: #todowho.val(), when: #todowhen.val(), author: {{user.name, done: false ); @todoreset(); return false; ToDoList when(#tododelete.click) { @todoupdate({ index: #todoid.val(), entry: null ); @todoreset(); when(@todoreset) { #todoid.val(''); #todowhat.val(''); #todoadd.val('add'); #tododelete.hide().removeattr('disabled'); #todoadd.blur(); when(@todoedit) { MindTouch.Deki.ReadPageProperty(null, 'urn:custom.mindtouch.com#todo', function(result) { var data = YAHOO.lang.JSON.parse(result.value '[]'); #todoid.val(@todoedit.index); #todowhat.val(data[@todoedit.index].what); #todowhen.val(data[@todoedit.index].when); #todowho.val(data[@todoedit.index].who); #todoadd.val('update'); #tododelete.show();, function(result) { alert('an error occurred trying to read the TODO list (status: ' + result.status + ' - ' + ); when(@todoupdate) { MindTouch.Deki.ReadPageProperty(null, 'urn:custom.mindtouch.com#todo', function(result) { var op; var data = eval('(' + (result.value '[]') + ')'); if(@todoupdate.index!== '') { if(@todoupdate.entry === null) { op = 'remove'; data.splice(@todoupdate.index, 1); else { op = 'update'; $.extend(data[@todoupdate.index], @todoupdate.entry); else { op = 'add'; @todoupdate.index = data.length; data.push(@todoupdate.entry); 3

var completed = function() { var msg = {{ message ; msg.op = op; msg.index = @todoupdate.index; msg.entry = @todoupdate.entry; msg.list = data; Deki.publish({{ publish, msg); MindTouch.Deki.Reload(#todolist, null, function() { ToDoWireControls(); ); ; if(result.etag) { MindTouch.Deki.UpdatePageProperty(result.href, YAHOO.lang.JSON.stringify(data), result.etag, completed, function(result) { alert('an error occurred trying to update the TODO list (status: ' + result.status + ' - ' + ); else { MindTouch.Deki.CreatePageProperty(null, 'urn:custom.mindtouch.com#todo', YAHOO.lang.JSON.stringify(data), completed, function(result) { alert('an error occurred trying to create the TODO list (status: ' + result.status + ' - ' + );, function(result) { alert('an error occurred trying to read the TODO list (status: ' + result.status + ' - ' + ); " /> <input id="tododelete" type="button" style="display: none;" value="delete" /> </div> </form> // add index to each todo item var todo = json.parse(page.properties["todo"].text?? "")?? [ ]; let todo = [ item.. { index: index foreach var item in todo ]; let invaliddates = [ item foreach var item in todo where!date.isvalid(item.when) ]; let todo = [ item foreach var item in todo where date.isvalid(item.when) ]; let todo = list.sort(todo, _, _, "date.compare($left.when, $right.when)").. invaliddates; <table id="todolist" cellspacing="0" cellpadding="0"> <colgroup> <col width="20" /> <col width="20%" /> <col /> <col width="15%" /> <col width="75" /> </colgroup> <tr> <th>string.nbsp</th> <th>"when"</th> ToDoList 4

<th>"what"</th> <th>"who"</th> <th>string.nbsp</th> </tr> foreach(var entry in todo) { var class = ""; var now = date.now; if(entry.done) let class..= "completed "; else if(date.isvalid(entry.when)) { if(date.issameday(now, entry.when)) let class..= "due-today "; else if(date.isafter(now, entry.when)) let class..= "due-past "; var title = "Created by ".. entry.author; <tr class=(class)> <td><input type="checkbox" name="done" id=(entry.index) class="todochange" value=(entry.index) checked=(entry.done? 'checked' : nil) disabled=(disabled) /></td> <td title=(title)><span>entry.when</span></td> <td title=(title)><span>entry.what</span></td> <td title=(title)><span>entry.who</span></td> <td class="todo-edit"> if(disabled) { string.nbps; else { <a href="#" rel=(entry.index)>"edit"</a> </td> </tr> </table> </div> // global script code <script type="text/jem">" function ToDoWireControls() { $('#todolist a').bind('click', function() { @todoedit({ index: $(this).attr('rel') ); #todowhat.select(); return false; ); $('.todochange').bind('click', function() { var $this = $(this); @todoupdate({ index: $this.val(), entry: { done: this.checked ); ); ToDoWireControls(); "</script> // styles <html> <head> 5

<style type="text/css">" //--- Start TODO styles --- #deki-todo { margin: 0; padding: 4px; width: 98%; #deki-todo table { width: 100%; margin: 0; #deki-todo table td { border-bottom: 1px solid #000; padding: 4px 2px; #deki-todo tr td.todo-edit { text-align: right; padding-right: 8px; #deki-todo tr.due-today td { background-color: #ff0; #deki-todo tr.completed td { background-color: #fff; #deki-todo tr.completed td span { text-decoration: line-through; #deki-todo tr.due-past td, #deki-todo tr.due-past td.todo-edit a { color: #f00; #deki-todo table th { font-size: 14px; font-weight: bold; text-align: left; border-bottom: 2px solid #000; #deki-todo form { padding: 4px; background-color: #000; color: #fff; overflow: hidden; margin-bottom: 8px; #deki-todo div.todo-assign { font-weight: bold; #deki-todo form, #deki-todo form input, 6

#deki-todo form select { font-size: 11px; #deki-todo form div { padding-right: 8px; float: left; #deki-todo div.todo-submit { float: right; padding-right: 0px; #deki-todo div.todo-submit input { margin-right: 4px; #deki-todo table tr td.todo-edit a { background: url(/skins/common/icons/silk/page_white_edit.png) no-repeat center left; color: #000; text-decoration: none; padding: 3px 3px 3px 21px; font-size: 11px; #deki-todo table tr td.todo-edit a:hover { text-decoration: underline; //--- End TODO styles --- " </style> </head> </html> 7