removed shortcut support which is now available as zip module
This commit is contained in:
		
							parent
							
								
									f91929bf31
								
							
						
					
					
						commit
						1028d1e78d
					
				
					 12 changed files with 0 additions and 221 deletions
				
			
		|  | @ -1,9 +0,0 @@ | |||
| <tr> | ||||
| <td valign="top"><input type="text" size="15" value="<% shortcut.title encoding="form" %>" readonly="readonly" title="A shortcut's title is read-only and cannot be edited." /> | ||||
| <input type="hidden" name="title<% param.id %>" value="<% shortcut.title encoding="form" %>"></td> | ||||
| <td valign="top"><input type="text" size="40" name="content<% param.id %>" value="<% shortcut.content encoding="form" %>" /></td> | ||||
| </tr> | ||||
| <tr> | ||||
| <td></td> | ||||
| <td class="small"><% shortcut.display %><% shortcut.placeholder prefix=" " %></td> | ||||
| </tr> | ||||
|  | @ -1,17 +0,0 @@ | |||
| /** | ||||
|  * function renders a shortcut | ||||
|  */ | ||||
| function display_macro() { | ||||
|    this.renderContent(this.getTitle()); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| /** | ||||
|  * function displays an asterisk in | ||||
|  * the preview if shortcut contains | ||||
|  * the magic placeholder $text. | ||||
|  */ | ||||
| function placeholder_macro() { | ||||
|    if (this.content.indexOf("$text") > -1) | ||||
|       res.write("*"); | ||||
| } | ||||
|  | @ -1,8 +0,0 @@ | |||
| <tr> | ||||
| <td valign="top"><% shortcut.title %></td> | ||||
| <td valign="top"><% shortcut.content encoding="form" %></td> | ||||
| </tr> | ||||
| <tr> | ||||
| <td></td> | ||||
| <td class="small"><% shortcut.display %><% shortcut.placeholder prefix=" " %></td> | ||||
| </tr> | ||||
|  | @ -1,35 +0,0 @@ | |||
| /** | ||||
|  * function renders a shortcut. | ||||
|  * the magic placeholder $text is replaced with the title; | ||||
|  * if a shortcut starts with http:// it is rendered as link.
 | ||||
|  * @param str String content of the shortcut to be rendered | ||||
|  */ | ||||
| 
 | ||||
| function renderContent(str) { | ||||
|    var re = new RegExp("\\$text"); | ||||
|    re.global = true; | ||||
|    if (!str) | ||||
|       str = this.getTitle(); | ||||
|    var content = this.content.replace(re, str); | ||||
|    if (content.indexOf("http://") == 0) { | ||||
|       openLink(content); | ||||
|       res.write(str); | ||||
|       closeLink(); | ||||
|    } | ||||
|    else | ||||
|       res.write(content); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| /** | ||||
|  * function removes meta information marked by # | ||||
|  * from a shortcut's title. this way different shortcuts | ||||
|  * with the same output can be created (e.g. both shortcut and | ||||
|  * shortcut#2 will be display as "shortcut" only). | ||||
|  * @return String extracted title of the shortcut | ||||
|  */ | ||||
| 
 | ||||
| function getTitle() { | ||||
|    var items = this.title.split("#"); | ||||
|    return(items[0]); | ||||
| } | ||||
|  | @ -1,18 +0,0 @@ | |||
| _db = antville | ||||
| _table = AV_SHORTCUT | ||||
| 
 | ||||
| _id = SHORTCUT_ID | ||||
| _parent = site.shortcuts | ||||
| 
 | ||||
| title = SHORTCUT_TITLE | ||||
| content = SHORTCUT_CONTENT | ||||
| createtime = SHORTCUT_CREATETIME | ||||
| modifytime = SHORTCUT_MODIFYTIME | ||||
| 
 | ||||
| site = object (site) | ||||
| site.local = SHORTCUT_F_SITE | ||||
| site.foreign = SITE_ID | ||||
| 
 | ||||
| creator = object (user) | ||||
| creator.local = SHORTCUT_F_USER_CREATOR | ||||
| creator.foreign = USER_ID | ||||
|  | @ -1,24 +0,0 @@ | |||
| <table border="0" cellspacing="0" cellpadding="2"> | ||||
| <form action="<% response.action %>" method="post"> | ||||
| <tr> | ||||
| <td class="small">Title</td> | ||||
| <td class="small">Content</td> | ||||
| <td></td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td><input type="text" size="15" name="newtitle" value="" /> | ||||
| <div class="small"> </div></td> | ||||
| <td valign="top"><input type="text" size="40" name="newcontent" value="" /> | ||||
| <div class="small"> </div></td> | ||||
| </tr> | ||||
| <tr> | ||||
| <td colspan="2"><input type="submit" name="submit" value=" save " /><br /> </td> | ||||
| </tr> | ||||
| 
 | ||||
| <% shortcutmgr.shortcutlist as="editor" %> | ||||
| </form> | ||||
| 
 | ||||
| <% this.skin name="help" %> | ||||
| 
 | ||||
| </table> | ||||
|  | @ -1,16 +0,0 @@ | |||
| <tr> | ||||
| <td colspan="2" class="small"><br /><br /> | ||||
| <b>How to use Antville's shortcut feature:</b></a> | ||||
| <ul> | ||||
| <li>Please be aware that this still is experimental stuff.</li> | ||||
| <li>Use the following macro to display a shortcut:<br /> | ||||
| <tt><% shortcut name="<i>title</i>" %></tt>.<br /> | ||||
| This will output the content of the shortcut with the given title.</li> | ||||
| <li>If a shortcut starts with http:// the macro will automatically output the title as an HTML link. To display an alternative text instead of the shortcut's title you can use the optional parameter <tt>text="<i>altText</i>"</tt> in the above macro.</li> | ||||
| <li>If a shortcut contains the string <tt>$text</tt> latter will be replaced either with the shortcut's title or with the value of the text parameter, if defined. An asterisk * right from the preview (ie. the line below the content input field) will indicate that the placeholder is in effect.</li> | ||||
| <li>You can use a specific shortcut title only once. If you should need the same title for two or more shortcuts simply add a hash and some additional characters to the title for distinction. These additions won't be displayed in the output. Example titles: <tt>myShortcut, myShortcut#2, myShortcut#new</tt>.</li> | ||||
| <li>Edit a shortcut's content directly in its form field. The title is read-only and cannot be edited. All changes will be saved when you click the save button.</li> | ||||
| <li>To delete a shortcut simply clear the content input field and click the save button. But be aware that this affects the output of any story containing the corresponding shortcut macro! Instead of a missing shortcut the plain title (as given in the macro) will be displayed.</li> | ||||
| </ul> | ||||
| </td> | ||||
| </tr> | ||||
|  | @ -1,12 +0,0 @@ | |||
| /** | ||||
|  * function renders a list of shortcuts | ||||
|  */ | ||||
| 
 | ||||
| function shortcutlist_macro(param) { | ||||
|    var skin = param.as == "editor" ? "edit" : "main"; | ||||
|    delete param.as; | ||||
|    for (var i=0; i<this.size(); i++) { | ||||
|       param.id = i; | ||||
|       this.get(i).renderSkin(skin, param); | ||||
|    } | ||||
| } | ||||
|  | @ -1,52 +0,0 @@ | |||
| checkIfLoggedIn(this.href(req.action)); | ||||
| 
 | ||||
| var deny = this.isDenied(session.user,req.data.memberlevel); | ||||
| if (deny) { | ||||
|    res.message = getMessage("error",deny); | ||||
|    res.redirect(path.site.href()); | ||||
| } | ||||
| 
 | ||||
| if (this._parent.isEditDenied(session.user,req.data.memberlevel)) { | ||||
|    res.data.title = path.site.title + " - Shortcuts"; | ||||
|    res.data.body = this.renderSkinAsString("main"); | ||||
|    path.site.renderSkin("page"); | ||||
|    return; | ||||
| } | ||||
| 
 | ||||
| // check if the shortcut list was submitted | ||||
| if (req.data.submit || req.data.submit == "submit") { | ||||
|    for (var i=this.size()-1; i>=0; i--) { | ||||
|       var sc = this.get(i); | ||||
|       var content = req.data["content" + i]; | ||||
|       // delete a shortcut if it's content is empty | ||||
|       if (!content) { | ||||
|          this.remove(sc); | ||||
|          continue; | ||||
|       } | ||||
|       sc.title = req.data["title" + i]; | ||||
|       sc.content = content; | ||||
|       sc.modifytime = new Date(); | ||||
|    } | ||||
|    // add a shortcut if the corresponding fields are not empty | ||||
|    if (req.data.newtitle && req.data.newcontent) { | ||||
|       // check if there is not already a shortcut with that name | ||||
|       if (!this.get(req.data.newtitle)) { | ||||
|          var sc = new shortcut(); | ||||
|          sc.title = req.data.newtitle; | ||||
|          sc.content = req.data.newcontent; | ||||
|          sc.creator = session.user; | ||||
|          sc.site = path.site; | ||||
|          sc.createtime = new Date(); | ||||
|          sc.modifytime = sc.createtime; | ||||
|          this.add(sc); | ||||
|       } | ||||
|       else | ||||
|          res.message = "This shortcut already exists."; | ||||
|    } | ||||
|    res.redirect(this.href()); | ||||
| } | ||||
| 
 | ||||
| res.data.action = this.href(); | ||||
| res.data.title = path.site.title + " - Shortcuts"; | ||||
| res.data.body = this.renderSkinAsString("edit"); | ||||
| path.site.renderSkin("page"); | ||||
|  | @ -1,12 +0,0 @@ | |||
| <table border="0" cellspacing="0" cellpadding="2"> | ||||
| <tr> | ||||
| <td class="small">Title</td> | ||||
| <td class="small">Content</td> | ||||
| <td></td> | ||||
| </tr> | ||||
| 
 | ||||
| <% shortcutmgr.shortcutlist %> | ||||
| 
 | ||||
| <% this.skin name="help" %> | ||||
| 
 | ||||
| </table> | ||||
|  | @ -1,13 +0,0 @@ | |||
| /** | ||||
|  * function checks if user is allowed to view the | ||||
|  * shortcut list of this site | ||||
|  * @param Obj Userobject | ||||
|  * @param Int Permission-Level | ||||
|  * @return String Reason for denial (or null if allowed) | ||||
|  */ | ||||
| 
 | ||||
| function isDenied(usr,level) { | ||||
|    if (!this._parent.usercontrib && (level & MAY_ADD_STORY) == 0) | ||||
|       return "shortcutEditDenied"; | ||||
|    return null; | ||||
| } | ||||
|  | @ -1,5 +0,0 @@ | |||
| _children = collection(shortcut) | ||||
| _children.local = SITE_ID | ||||
| _children.foreign = SHORTCUT_F_SITE | ||||
| _children.accessname = SHORTCUT_TITLE | ||||
| _children.order = SHORTCUT_TITLE asc | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue