Welcome to TiddlyWiki created by Jeremy Ruston; Copyright © 2004-2007 Jeremy Ruston, Copyright © 2007-2011 UnaMesa Association
Tools > Options > General tab
''Name ~AutoCorrect''
You for sure want "Perform name ~AutoCorrect" NOT checked.
You prolly want "Track name ~AutoCorrect info" NOT checked.
*It gets turned on for Object Dependencies and it may not actually harm anything.
Necessary maintenance on occasions. Make a shortcut and model parameters as below. Launch using shift button; follow with Compact and Repair.
Target: "C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE" "C:\Documents and Settings\smorse\My Documents\DB_Integration\My_Database.mdb" /decompile
Start in: "C:\Program Files\Microsoft Office\OFFICE11"
''How to generate Data Dictionary in Access.''
Produce a data dictionary for your database by writing the table names, fields (with types and comments) into a separated table. [[Source|http://www.profinvent.com/index.php/ms-office-automation/ms-office-free-help/43-access-scripts/80-how-to-generate-data-dictionary-in-access]]
{{{
Public Function GenerateDataDictionary(aDataDictionaryTable As String)
'*** Usage: GenerateDataDictionary("MyDataDictionaryTable")
'*** Extracts the information about the tables for the data dictionary
'*** and inserts it to a table named aDataDictionaryTable
Dim tdf As TableDef, fldCur As Field, colTdf As TableDefs
Dim rstDatadict As Recordset
Dim i As Integer, j As Integer, k As Integer
Set rstDatadict = CurrentDb.OpenRecordset(aDataDictionaryTable)
Set colTdf = CurrentDb.TableDefs
'Go through the database and get a tablename
For Each tdf In CurrentDb.TableDefs
'Do what you want with the table names here.
rstDatadict.AddNew
rstDatadict.Update
rstDatadict.AddNew
rstDatadict![Table] = tdf.NAME
rstDatadict![Field] = "----------------------------"
rstDatadict![Display] = "----------------------------"
rstDatadict![Type] = ""
rstDatadict.Update
rstDatadict.AddNew
rstDatadict![Table] = "Table Description:"
For j = 0 To tdf.Properties.Count - 1
If tdf.Properties(j).NAME = "Description" Then
rstDatadict![Field] = tdf.Properties(j).Value
End If
Next j
rstDatadict.Update
rstDatadict.AddNew
rstDatadict.Update
For i = 0 To tdf.Fields.Count - 1
Set fldCur = tdf.Fields(i)
rstDatadict.AddNew
rstDatadict![Table] = tdf.NAME
rstDatadict![Field] = fldCur.NAME
rstDatadict![Size] = fldCur.Size
Select Case fldCur.Type
Case 1
FieldDataType = "Yes/No"
Case 4
FieldDataType = "Number"
Case 8
FieldDataType = "Date"
Case 10
FieldDataType = "String"
Case 11
FieldDataType = "OLE Object"
Case 12
FieldDataType = "Memo"
Case Else ' Other values.
FieldDataType = fldCur.Type
End Select
rstDatadict![Type] = FieldDataType
For j = 0 To tdf.Fields(i).Properties.Count - 1
If fldCur.Properties(j).NAME = "Description" Then
rstDatadict![DESCRIPTION] = fldCur.Properties(j).Value
End If
If fldCur.Properties(j).NAME = "Caption" Then
rstDatadict![Display] = fldCur.Properties(j).Value
End If
If fldCur.Properties(j).NAME = "Rowsource" Then
rstDatadict![LookupSQL] = fldCur.Properties(j).Value
End If
Next j
rstDatadict.Update
Next i
Debug.Print " " & tdf.NAME
Next tdf
End Function
}}}
Stub
There is a VBA user-defined function that can be used.
"De-normalizes" data, but can be employed for a final report.
Access doesn't permit Null in the primary key of the header record. But it does permit Null in the foreign key of a corresponding detail record. This can result in a lost orphan record. Creating a relationship that enforces Referential Integrity enforced doesn't help! Rather, you must make sure to set //''Required''// as ''Yes'' for the foreign key field.
Source: [[Allen Browne|http://www.everythingaccess.com/tutorials.asp?ID=Common-Errors-with-Null ]]
|>|>| Format placeholders, may serve for templating/masking |h
|m | month | 1 |
|mm | month | 01 |
|yy | month | 86 |
|d | day of week | 1 |
|dd | day of week | 01 |
|ddd | day of week | Mon |
|dddd | day of week | Monday |
|ddddd | date | = short date |
|h |>| leading 0, OR works with ~AM/PM placeholder |
| / : - |>| date/time punctuation |
|@ | character | {{{(@@@) @@@-@@@@}}} |
|& | optional character | {{{@@@@@-&&&&}}} |
|> | upper case | |
|< | lower case | |
{{{
Format(#06/22/2025#, "mmmm dd', 'yyyy - hh:nn")) => June 22, 2025 - 00:00
'' Note this would work in a control; in VBA, use of quotes would take some extra thought.
}}}
[[VBA_Form_General]]
* Network use: go for optimistic locking. One point is to set the Properties > Data > Record Locking to "No Locks" in form design view.
[[VBA_FormOptimize]]
If a form flickers for no apparent reason when the cursor is over it, it may be due to labels that aren't attached to text boxes. The illustrious Allen Browne has a fix -- a bit of code that converts all those labels to static text boxes.
!! Resources
* [[Access_Util_Find_n_Replace]] -- Find and Replace from Rick Fisher
* [[VBA_CodeReview]] -- MZTools, StarPrint
* FE_AutomaticUpdater by Tony Teows
!!! File names and directory placement
* Names: //Short.//
* Location: //Near the root drive.//
!!! Separate MDB for bucket tables
2010-04-27
Per Tony Teows, and unless I misunderstand ...
http://www.granite.ab.ca/access/temptables.htm
The bloating of Mint ("blint") can be reduced by making a separate MDB that holds the temp bucket tables.
I guess the bucket MDB will bloat a lot; the elegant plan is to make it a Temp MDB. But just splitting out the tables might make a difference. Compacting the bucket MDB may be more effective than compacting Mint.
{{{
Public Function IsRunning() As Integer
On Error GoTo errHandler
Dim DB As DAO.Database
Set DB = CurrentDb
If TestDDELink(DB.Name) Then
'("HOMER is already open")
DB.Close
Set DB = Nothing
DoCmd.Quit
End If
Exit Function
errHandler:
MsgBox "Error " & Err.Number & ": " _
& vbCrLf & vbCrLf & " " & Err.Description
Resume Next
End Function
''-------------------
Private Function TestDDELink(ByVal strAppName$) As Integer
On Error Resume Next
Dim varDDEChannel
Application.SetOption ("Ignore DDE Requests"), True
varDDEChannel = DDEInitiate("MSAccess", strAppName)
' When the app isn't already running this will error
If Err Then
TestDDELink = False
Else
TestDDELink = True
DDETerminate varDDEChannel
DDETerminateAll
End If
Application.SetOption ("Ignore DDE Requests"), False
End Function
}}}
Tools ... Options ... Advanced to see. Try these settings: (from somewhere on net)
Default Open Mode = shared
Default record locking = Edited record @@color:#C00;Allen Browne prefers no locks.@@
Tick the 'Open databases using record-level locking' check box. @@color:#C00;Allen Browne says no, 'assuming a decent network'.@@
These are the settings which I always use on a multi-user database. You should then find that you only get a lock message when you really want one - i.e. when two users are trying to update the same record at the same time.
!!! Persistent link to back end(s)
* I thought connecting a form to a table was adequate. But it appears a DAO object is crirtical. [[Source|http://www.fmsinc.com/MicrosoftAccess/Performance/LinkedDatabase.html ]]
* The procedure below supports multiple backend databases. Edit the section with the list of databases to open, then call this when your application starts: {{{OpenAllDatabases True}}}
* When you finish, call this to close the database variables/handles: {{{OpenAllDatabases False}}}
* Password must be supplied -- 4th argument of {{{OpenDatabase(strPath, False, False, "MS Access;pwd=sneaky")}}} This is @@not@@ reflected in the code below.
{{{
Sub OpenAllDatabases(pfInit As Boolean)
' Open a handle to all databases and keep it open during the entire time the application runs.
' Params : pfInit TRUE to initialize (call when application starts)
' FALSE to close (call when application ends)
' From : Total Visual SourceBook
Dim x As Integer
Dim strName As String
Dim strMsg As String
' Maximum number of back end databases to link
Const cintMaxDatabases As Integer = 2
' List of databases kept in a static array so we can close them later
Static dbsOpen() As DAO.Database
If pfInit Then
ReDim dbsOpen(1 To cintMaxDatabases)
For x = 1 To cintMaxDatabases
' Specify your back end databases
Select Case x
Case 1:
strName = "H:\folder\Backend1.mdb"
Case 2:
strName = "H:\folder\Backend2.mdb"
End Select
strMsg = ""
On Error Resume Next
Set dbsOpen(x) = OpenDatabase(strName)
If Err.Number > 0 Then
strMsg = "Trouble opening database: " & strName & vbCrLf & _
"Make sure the drive is available." & vbCrLf & _
"Error: " & Err.Description & " (" & Err.Number & ")"
End If
On Error GoTo 0
If strMsg <> "" Then
MsgBox strMsg
Exit For
End If
Next x
Else
On Error Resume Next
For x = 1 To cintMaxDatabases
dbsOpen(x).Close
Next x
End If
End Sub
}}}
To add, edit, or delete a record, there must be a unique index on the record in the underlying data source. I believe this pertains to linked tables.
* No index results in a "Permission denied" error on AddNew, Delete, or Edit method called in a Microsoft Jet workspace
* For ODBC, results in an "Invalid argument" error.
----
Generating Seq. Number, like AutoNumber:
{{{txtPersonNumber = 1 + DMax("PersonNumber", "tblPersons")}}}
include error trapping. Either unique number index and trap the error response, or run a query and roll back new record if result comes up wrong.
//ref Primary Key//
* Formerly //~Access_Report_Summary
* Find gotcha for saving record in form before proceeding
!!!!How do I create a summary report and suppress details?'
Set up summary information in the header or footer. Then set Visibility of the detail section to False! Much easier than laboring over a query!
MS Access Application Dev, (Wrox 2004)
!!!!How do I pretty-format check boxes?
Use a text box.
# If you already have a check box on your report, delete it.
# Add a text box for your Yes/No field.
# Set these properties:
## Control Source: yes/no field
## Font Name: ~WingDings (all Windows have this font)
## Width: 0.18 in
# Type these characters into the Format property of the text box:
** Press Alt key and type {{{0168}}} on the numeric keypad (= False)
** semicolon (the separator between False and True formats)
** backslash (indicating the next character is a literal)
** Press Alt key and type {{{0254}}} on the numeric keypad (= True)
You can now increase the Font Size, set the Fore Color or Back Color, and so on.
To leave the text box blank for unchecked, omit the first character in the Format property, i.e. nothing before the semi-colon.
|>|>| Select the characters from this list |h
| Character | Keypad number | Description |h
|Checked box |Alt+0254 |Checked box |
|Crossed box |Alt+0253 |Crossed box |
|Check mark |Alt+0252 |Check mark (unboxed) |
|Cross mark |Alt+0251 |Cross mark (unboxed) |
|Unchecked box |Alt+0168 |Unchecked box |
[[Source|http://allenbrowne.com/ser-52.html]]
''How do I make basic structural changes to an Access DB that is in use?''
''Note'' This is all subject to review and points may be questionable.
[[Access_ReviseSchema_LargeDB]]
You can make a transitory state that rolls back. If renaming a table, don't delete the old one. Wait until all looks good, then "z" it out (suffix the name with a "z"); wait more, then delete.
Modules that are ready for deletion can be z-suffixed and the code remmed out entirely.
[[Access_ReviseSchema]] if overwhelmed.
''Procedure for big one-time pass:''
----
If Server/Client, do opening steps for both and combine the Word documents.
For big ~MDBs, run Documenter separately for VBA.
----
#Make sure [["Object Name Revision" feature is off|Access_AutoCorrect_NO]]
#Make sure [["Table Data Sub-Sheets" is turned off|VBA_Table_SubDataSheets_NO]].
#Make a back up.
#Check the Relationships table (specific recommendations?).
#Consider outside references (other links out).
#Run Documenter on all objects (some parameters not needed).
#Note error messages while running Documenter.
#Dump it all into Word.
#Turn on revision tracking in Word.
#Make changes in Word, starting with tables and moving out.
#Use Replace to propagate changes through the document. Ensure all changes are propagated throughout.
#Print the resulting document. (How to reduce bulk? Hazardous.)
#Use the printed Word document to make revisions in DB.
**Don't change objects -- make copies. Don't delete anything. Try to avoid any recognition problems (table, field)
**Global replaces are good for VBA code, but ...
***Use restrictions like Match Case, Whole Word Only.
***Don't "Replace All;" work incrementally.
#Use the Word document as a checklist as you go. Use real marking and give entire document a review.
#Run a [[Decompile|AccessDecompile]].
#If compile is good, z-suffix obsolete tables and fields.
#Run a [[Decompile|AccessDecompile]].
#If compile is good, delete z-suffix items and strip out obsolete VBA.\
!!! Discover relationships
{{{
Public Sub InspectRelations()
Dim rel As Relation
Dim fld As Field
For Each rel In CurrentDb.Relations
Debug.Print "Relationship Name: " & rel.Name
Debug.Print "Table: " & rel.Table
Debug.Print "ForeignTable: " & rel.ForeignTable
For Each fld In rel.Fields
Debug.Print "Field Name: " & fld.Name
Debug.Print "ForeignName: " & fld.ForeignName
Next fld
Debug.Print String(10, "-")
Next rel
Set fld = Nothing
Set rel = Nothing
End Sub
}}}
[[source|http://stackoverflow.com/questions/3960235/ms-access-deleting-a-relationship-that-cant-be-found]]
''How do I structurally revise a //really big// database?''
Rename tables and fields that are seriously foundational, using a limited scope. Roll out the changes.
If the Documenter result is too large, that's too bad.
[[Access_ReviseSchema]]
* See VBScript_OpenAccessDatabase
{{{.ini}}} files are great to use if you want to store data, or retrieve data from somewhere outside of a database. They are easy to copy and replace, e-mail, put on disk, and if you use them, you never have to touch the database to adjust values.
You can retrieve values from existing .ini Files, or create your own. In this example, I will create my own. It works great, I do it all the time, and easy to use.
I will retrieve a tax rate for sake of simplicity, but you can use any value:
-----
First, I open notepad, and add my Section, Key and value:
{{{
[Data] '' your choice on the name
Taxrate=.082
Markuprate=.55
}}}
You can have as many sections, keys and values in an .ini as you like. Also, I named my first section "Data", you could name it anything you want
Now I am going to save the file as {{{dbData.ini}}}. (Actually not mandatory to use the {{{.ini}}} file type.
VBA Module:
{{{
Public Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Public Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
Public Function GetINI(sINIFile As String, sSection As String, sKey As String, sDefault As String) As String
'Purpose: Returns a value FROM an INI File
'GetINI(Path of INI File, Name of section, Name of Key, Default value if not found)
'Example: GetINI("C:\WINNT\ACROREAD.ini", "AdobeViewer", "MaxApp", "0")
Dim sTemp As String * 256
Dim nLength As Integer
sTemp = Space$(256)
nLength = GetPrivateProfileString(sSection, sKey, sDefault, sTemp, 255, sINIFile)
GetINI = Left$(sTemp, nLength)
End Function
Public Sub WriteINI(sINIFile As String, sSection As String, sKey As String, sValue As String)
'Purpose: Writes value TO an INI File
'GetINI(Path of INI File, Name of Section, Name of Key, Value)
'Example: WriteINI("C:\WINNT\ACROREAD.ini", "AdobeViewer", "AntialiasThreshold", "25")
Dim iCounter As Integer
Dim sTemp As String
sTemp = sValue
'Replace any CR/LF characters with spaces
For iCounter = 1 To Len(sValue)
If Mid$(sValue, iCounter, 1) = vbCr Or Mid$(sValue, iCounter, 1) = vbLf Then Mid$(sValue, iCounter) = " "
Next iCounter
iCounter = WritePrivateProfileString(sSection, sKey, sTemp, sINIFile)
End Sub
}}}
{{{
Dim myVar As Single
myvar = GetINI("C:\My Documents\dbData.ini", "Data", "Taxrate", "0")
}}}
The "0" is the value if not found
To write a value out, us the WriteINI function:
{{{
WriteINI("C:\My Documents\dbData.ini", "Data", "Taxrate", "YourValue")
}}}
The {{{db.Name}}} function may be useful for working with the path.
[[Source|http://www.tek-tips.com/faqs.cfm?fid=217]]
{{{
Public Sub StatusBar(Optional Msg As Variant)
Dim Temp As Variant
''http://www.meadinkent.co.uk/astatus.htm
' if the Msg variable is omitted or is empty, return the control of the status bar to Access
If Not IsMissing(Msg) Then
If Msg <> "" Then
Temp = SysCmd(acSysCmdSetStatus, Msg)
Else
Temp = SysCmd(acSysCmdClearStatus)
End If
Else
Temp = SysCmd(acSysCmdClearStatus)
End If
End Sub
}}}
The Levenshtein Distance algorithm is an algorithm used to calculate the minimum number of edits required to transform one string into another string using addition, deletion, and substitution of characters. The most common use of the function is for approximate string matching. Since the function returns the minimum number of edits required to transform one string into another, the user can set the threshold at which one string is considered a match to another.
http://bytes.com/topic/access/insights/909002-levenshtein-approximate-string-matching
{{{
Function fxLevenshtein(str1 As String, str2 As String) As Integer
Dim arrLev, intLen1 As Integer, intLen2 As Integer, _
i As Integer, j As Integer, arrStr1, arrStr2, intMini As Integer
intLen1 = Len(str1)
ReDim arrStr1(intLen1 + 1)
intLen2 = Len(str2)
ReDim arrStr2(intLen2 + 1)
ReDim arrLev(intLen1 + 1, intLen2 + 1)
arrLev(0, 0) = 0
For i = 1 To intLen1
arrLev(i, 0) = i
arrStr1(i) = Mid(str1, i, 1)
Next
For j = 1 To intLen2
arrLev(0, j) = j
arrStr2(j) = Mid(str2, j, 1)
Next
For j = 1 To intLen2
For i = 1 To intLen1
If arrStr1(i) = arrStr2(j) Then
arrLev(i, j) = arrLev(i - 1, j - 1)
Else
intMini = arrLev(i - 1, j) 'deletion
If intMini > arrLev(i, j - 1) Then _
intMini = arrLev(i, j - 1) 'insertion
If intMini > arrLev(i - 1, j - 1) Then _
intMini = arrLev(i - 1, j - 1) 'deletion
arrLev(i, j) = intMini + 1
End If
Next
Next
fxLevenshtein = arrLev(intLen1, intLen2)
End Function
}}}
Don't apply indexes to fields that contain much the same data. //[[source|http://www.vb123.com/toolshed/99/indexfields.htm]]//
* For example, indexing a Yes/No field is almost always a performance degrading operation. Similarly, if you have a number field that only contains two or three values, and index wouldn't be a good idea.
* To check the number of unique entries in an index, use the Access DistinctCount property. Compare this value to the number of records in the table and you can quickly see if the index is doing you any good.
ATTENTION: Jerry Elbel
Thank you for registering Find and Replace. Your registration information is listed below. You need to enter this information in the registration screen. To get to the registration screen click the 'About' button on the main Find and Replace screen, and then click the 'Enter Registration Code' Button.
For your information, the latest released version of Find and Replace 9, for Access 2000, 2002, 2003, and 2007 is 9.00j. The latest version of Find and Replace 8, for Access 97, is 8.01r. The latest version of Find and Replace 7, for Access 95, is 7.00f. The latest version of Find and Replace 2, for Access 2.0, is 2.07n. All are available on the Internet at http://www.rickworld.com. If you have questions or problems, the best way to reach me is through electronic mail at RFisher@RickWorld.com.
Name: Jerry Elbel
Company: Fountain People, Inc.
Vers. 9.0 Registration Code: CA-621C-1E0B-7925-66A6
Thanks again, Rick Fisher
http://www.regular-expressions.info/vb.html
To use this library in your Visual Basic application, select Project|References in the VB IDE's menu. Scroll down the list to find the item "Microsoft VBScript Regular Expressions 5.5". It's immediately below the "Microsoft VBScript Regular Expressions 1.0" item. Make sure to tick the 5.5 version, not the 1.0 version.
{{{
Sub tester()
Dim objRex As RegExp
Dim colMatches As MatchCollection, objMatch As Match
Dim mystring As String, mypattern$
Dim RetStr As String
mypattern = "sco"
mystring = "scottmorseschofield scollarly mascolksd"
Set objRex = New RegExp
objRex.Pattern = mypattern
objRex.IgnoreCase = True
objRex.Global = True
'' objRex.Test() finds an instance and returns T/F.
'' "Tests whether the String can be compared." Code can run without this.
If (objRex.Test(mystring) = True) Then
Set colMatches = objRex.Execute(mystring) ' Execute search.
If colMatches.count > 0 Then
For Each objMatch In colMatches
RetStr = RetStr & "Found match """ & objMatch.Value & _
""" at position " & objMatch.FirstIndex & vbCrLf
Next
MsgBox RetStr, 0, "VBScript Regular Expression Tester"
End If
End If
End Sub
}}}
{{{
Sub main()
Dim SWrk_Item As DAO.Recordset
Dim Omni_Item As DAO.Recordset
Dim booSame As Boolean, byteLen_1 As Byte, byteLen_2 As Byte
Dim fld As DAO.Field, varPN As Variant, strSQL As String
Set pdm = CurrentDb
strSQL = "SELECT * FROM MATMaterials ORDER BY Description, PartNumber, StockCodeID"
Set Omni_Item = pdm.OpenRecordset(strSQL, dbOpenDynaset)
strSQL = "SELECT * FROM SW_Items ORDER BY Description, PartNumber"
Set SWrk_Item = pdm.OpenRecordset(strSQL, dbOpenDynaset)
Dim i As Byte, strPattern$
'regex.Pattern = "([^A-Z][IO] ?\.?D ?\.?)X()" ''find OD and variations
'regex.Pattern = "([FMST])X([FMST])"
'regex.Pattern = "([0-9])X([0-9])"
'regex.Pattern = "([0-9])\*([0-9])" ''asterisk used in place of x (2*4*8)
regex.IgnoreCase = True
regex.Global = True
Dim arrCharacters() As Variant, strChar
arrCharacters = Array("!", "+", "=", "<", "?", "@", "[", "\", "]", "^")
'For i = 0 To 200
For Each strChar In arrCharacters
'If i >= 60 And i <= 62 Then
'If (i >= 33 And i <= 47) Or (i >= 125 And i <= 200) Then
'Debug.Print i & " " & Chr(i)
count = 0
strPattern = strChar
regex.Pattern = "(.*)\" & strPattern & "(.*)"
'regex.Pattern = strPattern
Debug.Print "----- " & strPattern & " (ASCII " & Asc(strPattern) & ")"
With SWrk_Item '' OR SWrk_Item
Set fld = .Fields("PartNumber")
.MoveFirst
Do Until .EOF
'Call correct_Case(Omni_Item, "PartNumber")
'Call correct_Case(Omni_Item, "Description", "JobOps ")
'Call correct_Case(Omni_Item, "Description", "JobOps ") 'SolWrk
'Call correct_Case(SWrk_Item, "Description", "SolWrk ")
Call correct_Weird(SWrk_Item, "Description", "Solidworks ", regex, strPattern)
'Call MergeRecords(Omni_Item, varPN, fld)
If count > 3 Then
Exit Do
End If
.MoveNext
Loop
End With
count = 0
With Omni_Item '' OR SWrk_Item
Set fld = .Fields("PartNumber")
.MoveFirst
Do Until .EOF
'Call correct_Case(Omni_Item, "PartNumber")
'Call correct_Case(Omni_Item, "Description", "JobOps ")
'Call correct_Case(Omni_Item, "Description", "JobOps ") 'SolWrk
'Call correct_Case(Omni_Item, "Description", "JobOps ")
Call correct_Weird(Omni_Item, "Description", "JO ", regex, strPattern)
'Call MergeRecords(Omni_Item, varPN, fld)
If count > 3 Then
Debug.Print
Exit Do
End If
.MoveNext
Loop
End With
'End If
Next
Debug.Print "-------------------------"
SWrk_Item.Close: Set SWrk_Item = Nothing
Omni_Item.Close: Set Omni_Item = Nothing
Set pdm = Nothing
End Sub
}}}
{{{
Sub correct_Weird(rsItem As DAO.Recordset, strTextField As String, strTag$, objRegex As Object, strPattern$)
Dim NewString As String, OldString As String
OldString = Nz(rsItem(strTextField), "")
OldString = Left(OldString, 80) ''DE BUG TEMP
If objRegex.Test(OldString) Then
NewString = objRegex.Replace(OldString, "$1x$2")
If StrComp(NewString, OldString, 0) <> 0 Then
Debug.Print strTag & OldString
'Debug.Print strTag & OldString
'Debug.Print " " & NewString
'Debug.Print
'Stop
count = count + 1
End If
'rsItem.Edit
'rsItem(strTextField) = NewString
'rsItem.Update
End If
End Sub
}}}
/***
|Name|AdvancedOptionsPlugin|
|Source|http://www.TiddlyTools.com/#AdvancedOptionsPlugin|
|Documentation|http://www.TiddlyTools.com/#AdvancedOptionsPlugin|
|Version|1.2.0|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.3|
|Type|plugin|
|Requires||
|Overrides||
|Options|##Configuration|
|Description|automatically add plugin-defined options to the [[AdvancedOptions]] shadow tiddler|
!!!!!Usage
<<<
At document startup, this plugin examines each tiddler tagged with <<tag systemConfig>> and looks for a tiddler slice named "Options" whose value refers to a tiddler section (or separate tiddler) that contains an 'advanced options control panel' for configuring that plugin's features and behavior. For each plugin that contains an "Options" slice, a tabbed entry is automatically created in the [[AdvancedOptions]] shadow tiddler to display that plugin's control panel.
As an optional fallback for backward-compatibility with plugin tiddlers that do not define the "Options" slice, this plugin will also look for a section heading named "Configuration" within those tiddlers, so that older plugins that define this section can automatically have their settings added to the [[AdvancedOptions]] tiddler without requiring the "Options" slice to be added.
This plugin also extends the standard {{{<<option>>}}} macro syntax so you can directly set the internal value of a boolean or text option, without displaying a corresponding checkbox or input field control simply by appending {{{=value}}} syntax to the end of the option ID parameter:
{{{
<<option "txtSomeOption=some text">>
<<option chkSomeOtherOption=true>> OR <<option chkSomeOtherOption=false>>
}}}
Example: {{{<<option chkAnimate=false>>}}}
<<<
!!!!!Configuration
<<<
<<option chkAdvancedOptions>> automatically add plugin-defined options to the [[AdvancedOptions]] shadow tiddler
<<option chkAdvancedOptionsBackstage>> automatically add plugin-defined options to Backstage menu
<<option chkAdvancedOptionsFallback>> use <<option txtAdvancedOptionsFallback>> section as a fallback for plugins that don't define an ~AdvancedOptions slice
//note: these settings only take effect after reloading the document//
<<<
!!!!!Revisions
<<<
2009.07.23 [1.2.0] added support for enhanced {{{<<option id=value>>}}} 'direct assignment' syntax
2008.05.09 [1.1.0] add "options" panel to backstage
2008.04.08 [1.0.0] initial release
<<<
!!!!!Code
***/
//{{{
version.extensions.AdvancedOptionsPlugin= {major: 1, minor: 2, revision: 0, date: new Date(2009,7,23)};
if (config.options.chkAdvancedOptions===undefined)
config.options.chkAdvancedOptions=true;
if (config.options.chkAdvancedOptionsBackstage===undefined)
config.options.chkAdvancedOptionsBackstage=true;
if (config.options.chkAdvancedOptionsFallback===undefined)
config.options.chkAdvancedOptionsFallback=true;
if (config.options.txtAdvancedOptionsFallback===undefined)
config.options.txtAdvancedOptionsFallback="Configuration";
if (config.optionsDesc) config.optionsDesc.chkAdvancedOptions=
"automatically add plugin-defined options to [[AdvancedOptions]]";
//}}}
//{{{
var items=[];
var fmt="[[%0 ]] [[view options for %0]] [[%1]]\n";
var section=config.options.txtAdvancedOptionsFallback;
var plugins=store.getTaggedTiddlers("systemConfig");
for (var p=0; p<plugins.length; p++) {
var tid=plugins[p].title;
var settings=store.getTiddlerSlice(tid,"Options");
if (!settings && config.options.chkAdvancedOptionsFallback && store.getTiddlerText(tid+"##"+section))
settings="##"+section; // fallback handling for older plugins
if (settings&&settings.length) {
if (settings.substr(0,2)=="##") settings=tid+settings;
items.push(fmt.format([tid,settings]));
}
}
if (items.length) config.shadowTiddlers.PluginOptions=
"!![[Plugin-defined options|PluginManager]]\n>@@text-align:left;<<tabs '' \n"+items.join(' ')+">>@@";
if (config.options.chkAdvancedOptions)
config.shadowTiddlers.AdvancedOptions+="{{smallform{{{wrap{<<tiddler PluginOptions>>}}}}}}";
//}}}
//{{{
// // add "options" backstage task
if (config.tasks && config.options.chkAdvancedOptionsBackstage) { // for TW2.2b3 or above
config.tasks.options = {
text: "options",
tooltip: "manage plugin-defined option settings",
content: "{{smallform{{{groupbox{{{wrap{<<tiddler PluginOptions>>}}}}}}\n{{groupbox small {<<options>>}}}}}}"
}
config.backstageTasks.splice(config.backstageTasks.indexOf("plugins")+1,0,"options");
}
//}}}
//{{{
config.macros.option.AOPsave_handler=config.macros.option.handler;
config.macros.option.handler=function(place,macroName,params,wikifier,paramString,tiddler) {
var parts=params[0].split('=');
if (parts.length==1) return this.AOPsave_handler.apply(this,arguments);
var id=parts[0]; var val=(id.substr(0,3)=='txt')?parts[1]:(parts[1]=='true');
config.options[id]=val;
}
//}}}
{{{
REM Fresh install OR re-install of HOMER client. 2011 April SDM
@Echo off
REM if no directory, create one
md "%appdata%\homer\"
REM Empty existing folder
del "%appdata%\homer\*.*" /q
REM Copy in all items for deploy
xcopy "L:\Databases\HOMER\FrontEnd\Deliverables\*.*" "%appdata%\homer\*.*" /z /y /q
REM Delete shortcut from Profile desktop
REM del "%userprofile%\Desktop\HOMER.lnk" /q
REM Delete shortcut from All Users desktop
REM PROGRAMDATA for Win 7
del "%AllUsersProfile%\Desktop\HOMER.lnk" /q
del "%PROGRAMDATA%\Desktop\HOMER.lnk" /q
REM Place new desktop shortcut
REM There seems no way to avoid a "file or directory?" user prompt if
REM (a) the target file does not already exist
REM (b) the file is being renamed in transit
REM So I made a subfolder 'Desktop' to allow same-named file and keep things tidy
xcopy "L:\Databases\HOMER\FrontEnd\Deliverables\Desktop\HOMER.lnk" "%userprofile%\Desktop\" /z /y /q
}}}
/%
|Name|BreadcrumbsCommand|
|Source|http://www.TiddlyTools.com/#BreadcrumbsCommand|
|Version|1.0.0|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|script|
|Requires|BreadcrumbsPlugin|
|Overrides||
|Description|"crumbs" command displays current breadcrumbs list in a popup|
%/<html><hide linebreaks><a href="javascript:;" class="button" title="tiddlers viewed during this session"
onclick="var p=Popup.create(this); if (!p) return;
var d=createTiddlyElement(p,'div');
d.style.whiteSpace='normal'; d.style.width='auto'; d.style.padding='2px';
wikify('\<\<breadcrumbs [[\<html\>\<hr\>\</html\>]] [[<br>]]\>\>',d);
Popup.show(p,false); event.cancelBubble = true; if (event.stopPropagation) event.stopPropagation();
return(false);"
>$1</a></html>
/***
|Name|BreadcrumbsPlugin|
|Author|Eric Shulman|
|Source|http://www.TiddlyTools.com/#BreadcrumbsPlugin|
|Documentation|http://www.TiddlyTools.com/#BreadcrumbsPluginInfo|
|Version|2.1.0|
|License|[[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides|Story.prototype.displayTiddler,TiddlyWiki.prototype.deleteTiddler|
|Options|##Configuration|
|Description|list/jump to tiddlers viewed during this session plus "back" button/macro|
This plugin provides a list of links to all tiddlers opened during the session, creating a "trail of breadcrumbs" from one tiddler to the next, allowing you to quickly navigate to any previously viewed tiddler, or select 'home' to reset the display to the initial set of tiddlers that were open at the start of the session (i.e., when the document was loaded into the browser).
!!!!!Documentation
<<<
see [[BreadcrumbsPluginInfo]]
<<<
!!!!!Configuration
<<<
<<option chkCreateDefaultBreadcrumbs>> automatically create breadcrumbs display (if needed)
<<option chkShowBreadcrumbs>> show/hide breadcrumbs display
<<option chkReorderBreadcrumbs>> re-order breadcrumbs when visiting a previously viewed tiddler
<<option chkBreadcrumbsHideHomeLink>> omit 'Home' link from breadcrumbs display
<<option chkBreadcrumbsSave>> prompt to save breadcrumbs when 'Home' link is pressed
<<option chkShowStartupBreadcrumbs>> show breadcrumbs for 'startup' tiddlers
<<option chkBreadcrumbsReverse>> show breadcrumbs in reverse order (most recent first)
<<option chkBreadcrumbsLimit>> limit breadcrumbs display to {{twochar{<<option txtBreadcrumbsLimit>>}}} items
<<option chkBreadcrumbsLimitOpenTiddlers>> limit open tiddlers to {{twochar{<<option txtBreadcrumbsLimitOpenTiddlers>>}}} items
<<<
!!!!!Revisions
<<<
2009.03.22 [2.1.0] added 'save breadcrumbs to tiddler' feature
| Please see [[BreadcrumbsPluginInfo]] for previous revision details |
2006.02.01 [1.0.0] initial release
<<<
!!!!!Code
***/
//{{{
version.extensions.BreadcrumbsPlugin= {major: 2, minor: 1, revision: 0, date: new Date("March 2, 2009")};
var co=config.options; // abbreviation
// show/hide display option (default is to SHOW breadcrumbs)
if (co.chkShowBreadcrumbs===undefined) co.chkShowBreadcrumbs=true;
// REORDER breadcrumbs when visiting previously viewed tiddler (default)
if (co.chkReorderBreadcrumbs===undefined) co.chkReorderBreadcrumbs=true;
// create default breadcrumbs display as needed (default is to CREATE)
if (co.chkCreateDefaultBreadcrumbs===undefined) co.chkCreateDefaultBreadcrumbs=true;
// show breadcrumbs for 'startup' tiddlers (default is FALSE = only show crumbs for tiddlers opened after startup)
if (co.chkShowStartupBreadcrumbs===undefined) co.chkShowStartupBreadcrumbs=false;
// show crumbs in reverse order (most recent first)
if (co.chkBreadcrumbsReverse===undefined) co.chkBreadcrumbsReverse=false;
// limit number of crumbs displayed
if (co.chkBreadcrumbsLimit===undefined) co.chkBreadcrumbsLimit=false;
if (co.txtBreadcrumbsLimit===undefined) co.txtBreadcrumbsLimit=5;
// limit number of open tiddlers
if (co.chkBreadcrumbsLimitOpenTiddlers===undefined) co.chkBreadcrumbsLimitOpenTiddlers=false;
if (co.txtBreadcrumbsLimitOpenTiddlers===undefined) co.txtBreadcrumbsLimitOpenTiddlers=3;
// omit home link from breadcrumbs display
if (co.chkBreadcrumbsHideHomeLink===undefined) co.chkBreadcrumbsHideHomeLink=false;
// prompt for 'save crumbs' when 'home' button is pressed
if (co.chkBreadcrumbsSave===undefined) co.chkBreadcrumbsSave=false;
config.macros.breadcrumbs = {
crumbs: [], // the list of current breadcrumbs
askMsg: "Save current breadcrumbs before clearing?\nPress OK to save, or CANCEL to continue without saving.",
saveMsg: 'Enter the name of a tiddler in which to save the current breadcrumbs',
saveTitle: 'SavedBreadcrumbs',
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
var area=createTiddlyElement(place,"span",null,"breadCrumbs",null);
area.setAttribute("homeSep",params[0]?params[0]:this.homeSeparator); // custom home separator
area.setAttribute("crumbSep",params[1]?params[1]:this.crumbSeparator); // custom crumb separator
this.render(area);
},
add: function (title) {
var thisCrumb = title;
var ind = this.crumbs.indexOf(thisCrumb);
if(ind === -1)
this.crumbs.push(thisCrumb);
else if (config.options.chkReorderBreadcrumbs)
this.crumbs.push(this.crumbs.splice(ind,1)[0]); // reorder crumbs
else
this.crumbs=this.crumbs.slice(0,ind+1); // trim crumbs
if (config.options.chkBreadcrumbsLimitOpenTiddlers)
this.limitOpenTiddlers();
this.refresh();
return false;
},
getAreas: function() {
var crumbAreas=[];
// find all DIVs with classname=="breadCrumbs"
// Note: use try/catch to avoid "Bad NPObject as private data" fatal error caused when
// some versions of embedded QuickTime player element is accessed by hasClass() function.
var all=document.getElementsByTagName("*");
for (var i=0; i<all.length; i++)
try{ if (hasClass(all[i],"breadCrumbs")) crumbAreas.push(all[i]); } catch(e) {;}
// find single DIV w/fixed ID (backward compatibility)
var byID=document.getElementById("breadCrumbs")
if (byID && !hasClass(byID,"breadCrumbs")) crumbAreas.push(byID);
if (!crumbAreas.length && config.options.chkCreateDefaultBreadcrumbs) {
// no existing crumbs display areas... create one...
var defaultArea = createTiddlyElement(null,"span",null,"breadCrumbs",null);
defaultArea.style.display= "none";
var targetArea= document.getElementById("tiddlerDisplay");
targetArea.parentNode.insertBefore(defaultArea,targetArea);
crumbAreas.push(defaultArea);
}
return crumbAreas;
},
refresh: function() {
var crumbAreas=this.getAreas();
for (var i=0; i<crumbAreas.length; i++) {
crumbAreas[i].style.display = config.options.chkShowBreadcrumbs?"block":"none";
removeChildren(crumbAreas[i]);
this.render(crumbAreas[i]);
}
},
render: function(here) {
var co=config.options; var out=""
var homeSep=here.getAttribute("homeSep"); if (!homeSep) homeSep=this.homeSeparator;
var crumbSep=here.getAttribute("crumbSep"); if (!crumbSep) crumbSep=this.crumbSeparator;
if (!co.chkBreadcrumbsHideHomeLink) {
createTiddlyButton(here,"Home",null,this.home,"tiddlyLink tiddlyLinkExisting");
out+=homeSep;
}
for (c=0; c<this.crumbs.length; c++) // remove non-existing tiddlers from crumbs
if (!store.tiddlerExists(this.crumbs[c]) && !store.isShadowTiddler(this.crumbs[c]))
this.crumbs.splice(c,1);
var count=this.crumbs.length;
if (co.chkBreadcrumbsLimit && co.txtBreadcrumbsLimit<count) count=co.txtBreadcrumbsLimit;
var list=[];
for (c=this.crumbs.length-count; c<this.crumbs.length; c++) list.push('[['+this.crumbs[c]+']]');
if (co.chkBreadcrumbsReverse) list.reverse();
out+=list.join(crumbSep);
wikify(out,here);
},
home: function() {
var cmb=config.macros.breadcrumbs;
if (config.options.chkBreadcrumbsSave && confirm(cmb.askMsg)) cmb.saveCrumbs();
story.closeAllTiddlers(); restart();
cmb.crumbs = []; var crumbAreas=cmb.getAreas();
for (var i=0; i<crumbAreas.length; i++) crumbAreas[i].style.display = "none";
return false;
},
saveCrumbs: function() {
var tid=prompt(this.saveMsg,this.saveTitle); if (!tid||!tid.length) return; // cancelled by user
var t=store.getTiddler(tid);
if(t && !confirm(config.messages.overwriteWarning.format([tid]))) return;
var who=config.options.txtUserName;
var when=new Date();
var text='[['+this.crumbs.join(']]\n[[')+']]';
var tags=t?t.tags:[]; tags.pushUnique('story');
var fields=t?t.fields:{};
store.saveTiddler(tid,tid,text,who,when,tags,fields);
story.displayTiddler(null,tid);
story.refreshTiddler(tid,null,true);
displayMessage(tid+' has been '+(t?'updated':'created'));
},
limitOpenTiddlers: function() {
var limit=config.options.txtBreadcrumbsLimitOpenTiddlers; if (limit<1) limit=1;
for (c=this.crumbs.length-1; c>=0; c--) {
var tid=this.crumbs[c];
var elem=document.getElementById(story.idPrefix+tid);
if (elem) { // tiddler is displayed
if (limit <=0) { // display limit has been reached
if (elem.getAttribute("dirty")=="true") { // tiddler is being edited
var msg="'"+tid+"' is currently being edited.\n\n";
msg+="Press OK to save and close this tiddler\nor press Cancel to leave it opened";
if (confirm(msg)) { story.saveTiddler(tid); story.closeTiddler(tid); }
}
else
story.closeTiddler(this.crumbs[c]);
}
limit--;
}
}
}
};
if (config.macros.breadcrumbs.homeSeparator==undefined) // note: not a cookie
config.macros.breadcrumbs.homeSeparator=" | ";
if (config.macros.breadcrumbs.crumbSeparator==undefined) // note: not a cookie
config.macros.breadcrumbs.crumbSeparator=" > ";
config.commands.previousTiddler = {
text: 'back',
tooltip: 'view the previous tiddler',
hideReadOnly: false,
dateFormat: 'DDD, MMM DDth YYYY hh:0mm:0ss',
handler: function(event,src,title) {
var here=story.findContainingTiddler(src); if (!here) return;
var crumbs=config.macros.breadcrumbs.crumbs;
if (crumbs.length>1) {
var crumb=crumbs[crumbs.length-2];
story.displayTiddler(here,crumb);
}
else
config.macros.breadcrumbs.home();
return false;
}
};
config.macros.previousTiddler= {
label: 'back',
prompt: 'view the previous tiddler',
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
var label=params.shift(); if (!label) label=this.label;
var prompt=params.shift(); if (!prompt) prompt=this.prompt;
createTiddlyButton(place,label,prompt,function() {
var crumbs=config.macros.breadcrumbs.crumbs;
if (crumbs.length>1) {
var crumb=crumbs[crumbs.length-2];
story.displayTiddler(place,crumb);
}
else
config.macros.breadcrumbs.home();
});
}
}
// hijack story.displayTiddler() so crumbs can be refreshed when a tiddler is displayed
if (Story.prototype.breadCrumbs_coreDisplayTiddler==undefined)
Story.prototype.breadCrumbs_coreDisplayTiddler=Story.prototype.displayTiddler;
Story.prototype.displayTiddler = function(srcElement,tiddler,template,animate,slowly)
{
var title=(tiddler instanceof Tiddler)?tiddler.title:tiddler;
this.breadCrumbs_coreDisplayTiddler.apply(this,arguments);
// if not displaying tiddler during document startup, then add it to the breadcrumbs
// note: 'startingUp' flag is a global, set/reset by the core init() function
if (!startingUp || config.options.chkShowStartupBreadcrumbs) config.macros.breadcrumbs.add(title);
}
// hijack store.removeTiddler() so crumbs can be refreshed when a tiddler is deleted
if (TiddlyWiki.prototype.breadCrumbs_coreRemoveTiddler==undefined)
TiddlyWiki.prototype.breadCrumbs_coreRemoveTiddler=TiddlyWiki.prototype.removeTiddler;
TiddlyWiki.prototype.removeTiddler= function(title)
{
this.breadCrumbs_coreRemoveTiddler.apply(this,arguments);
config.macros.breadcrumbs.refresh();
}
//}}}
CRUD = ''Create, Read, Update, Delete''
This describes the most essential functions of a database, or by extension, a user interface.
See tags: ~CrUd, cruD, etc.
If you can't explain the current CSS effect (eg, table borders are thin or missing), check the zoom level on your browser.
Stub
* ~UTF-8 is the wave of the future ...
* and it seems I will have to learn why
* ~MySQL installation (as of 2010) defaults to Latin-1 -- this is bad.
----
| {{{ }}} | non-break space | |
| {{{ }}} | m space | not well supported? |
| {{{<}}} | less than | |
| {{{>}}} | greater than | |
| {{{—}}} | m dash | |
| {{{…}}} | ellipses | |
| {{{․ }}} | 1-dot leader | |
The entire range from {{{}}} through {{{Ÿ}}} are invalid characters, and consequently should not be used. [[Source|http://www.alistapart.com/articles/emen/]]
  —   …   ․   .
W.E.B. file clean up (todo on current files)
replace this: {{{<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">}}}
with this: {{{<!doctype html>}}}
delete all:
{{{ type="text/javascript"}}}
{{{ type="text/css"}}}
{{{<meta name="description" content= ... >}}}
{{{<meta name="keywords" content= ... >}}}
{{{<meta http-equiv="Content-Script-Type" content="text/javascript">}}}
{{{ <a href="http://WorldEnglishBible.org/cgi-bin/comment.cgi?translation=WEB&book=Titus">[Report typo]</a>}}}
Replace this: {{{<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">}}}
with this: {{{<meta charset="UTF-8">}}}
Replace this: {{{This page is being displayed without its intended CSS styles in web.css}}}
with this: {{{CSS is unavailable.}}}
Replace this: {{{This page is being displayed without the javascript in web.js.}}}
with this: {{{Javascript is unavailable.}}}
Replace this: {{{<p>HTML generated [date].}}}
with this: {{{<!--- HTML generated [date]. -->}}}
/***
|Name|ClickifyPlugin|
|Source|http://www.TiddlyTools.com/#ClickifyPlugin|
|Documentation|http://www.TiddlyTools.com/#ClickifyPlugin|
|Version|1.0.1|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Description|re-compute parameters when a 'command link' macro is clicked|
!!!!!Usage
<<<
Normally, when you use a //computed parameter// in a macro, it's value is determined when the macro is rendered. The {{{<<clickify>>}}} macro can be used to force the macro parameters of an 'on-click' command link (such as created by the {{{<<newTiddler>>}}} macro) to be automatically re-computed when the command link is clicked, rather than when it is initially displayed. This allows use of computed values that depend upon data that may change between the time the macro is rendered and when it's action is actually triggered by a click.
To apply this extended processing to any macro that creates a command link, simply insert the 'clickify' keyword in front of the usual macro name, like this:
{{{
<<clickify macroName param param param ...>>
}}}
<<<
!!!!!Example
<<<
When {{{<<newTiddler>>}}} is clicked, prompt for a title and set default text to current timestamp:
{{{
<<clickify newTiddler title:{{prompt('enter a title','NewTiddler')}} text:{{new Date()}}>>
}}}
><<clickify newTiddler title:{{prompt('enter a title','NewTiddler')}} text:{{new Date()}}>>
<<<
!!!!!Revisions
<<<
2009.02.08 [1.0.1] make sure command link has been rendered before trying to modify it
2009.01.25 [1.0.0] initial release
<<<
!!!!!Code
***/
//{{{
version.extensions.ClickifyPlugin={major: 1, minor: 0, revision: 1, date: new Date(2009,2,8)};
config.macros.clickify={
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
var cmd='<<'+paramString+'>>';
var e=createTiddlyElement(place,'span');
wikify(cmd.replace(/alert\(|prompt\(|confirm\(/g,'isNaN('),e);
var b=e.getElementsByTagName('a')[0]; if (!b) return;
b.setAttribute('cmd',cmd);
b.onclick=function(ev) {
var cmd=this.getAttribute('cmd');
var e=createTiddlyElement(this.parentNode,'span');
e.style.display='none';
wikify(cmd,e);
e.getElementsByTagName('a')[0].onclick();
this.parentNode.removeChild(e);
}
}
}
//}}}
''Blog post -- migrating a web app to CodeIgniter''
!!! Goals
* Spend no money (Ubuntu, ~NetBeans, etc ...)
!!! Lessons learned
* Ignore the {{{admin}}} meta-app
* Cookies don't work with the test suite (session headers)
* Display your PHP errors
!!! Best practices to cultivate
* TDD approach (migrating would be so much easier)
!!!CI details
Change {{{ $config['index_page']= ' ' }}}, if removing {{{index.php/}}}.
!!!.htaccess file
//Remember to reset your LAMP server//
{{{
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^@codeigniter.*
RewriteRule ^(.*)$ /sparts3/index.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /sparts3/index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
</IfModule>
}}}
! Built-in Unit Testing
{{{
$this->load->library('unit_test');
$this->unit->run( test, expected result, 'test name' );
}}}
[[User Guide on Unit Testing|.././Personal_USB/ComputerGeek/www/codeigniter_guide/libraries/unit_testing.html]].
! Built-in Output for Debugging
Approximate by memory: {{{$this->ci->profiler(TRUE);}}}
I must find the useful post on this topic.
! ~SimpleTest
Had to replace all {{{= &new}}} with {{{= new}}} in SimpleTest
ALSO {{{add_test(TESTS.$_POST['test_name'].'.php', &$test);}}} remove &
ALSO the remmed line below did not work:
{{{
define('SIMPLETEST', str_replace('/admin', '', ROOT).'@codeigniter/simpletest/');
//define('SIMPLETEST', str_replace('\admin', '', ROOT).'@codeigniter/simpletest/');
}}}
! Debugging in IDE is useless
If you are trying to step through CI code, stop right now. Use the other functions cited here. See [[Singleton]] to understand why.
Use Allman style indenting. With the exception of Class declarations, braces are always placed on a line by themselves, and indented at the same level as the control statement that "owns" them.
!!!Whitespace
Use tabs for whitespace in your code, not spaces. This may seem like a small thing, but using tabs instead of whitespace allows the developer looking at your code to have indentation at levels that they prefer and customize in whatever application they use. And as a side benefit, it results in (slightly) more compact files, storing one tab character versus, say, four space characters.
{{{
function foo($bar)
{
// ...
}
foreach ($arr as $key => $val)
{
// ...
}
if ($foo == $bar)
{
// ...
}
else
{
// ...
}
for ($i = 0; $i < 10; $i++)
{
for ($j = 0; $j < 10; $j++)
{
// ...
}
}
}}}
Access VBA is an //interpreted// language. The term //compiling// therefore does not apply, technically. VBA 'compiled' code is a tokenized //pseudo-code.// (Jennings, 1995)
* www.txt2re.com
* http://www.aivosto.com/vbtips/regex.html
* Code_Regex_Examples
* Code_Regex_MySnippets
{|
! char
! purpose and usage
! example
|-
| {{{ 23*4 }}}
|preceding from 0 to n
|1245, 12345, 123345
|-
| {{{ 23?4 }}}
|preceding from 0 to 1
|1245, 12345
|-
| {{{ 23+4 }}}
|preceding from 1 to n
|12345, 123345
|-
| {{{ . }}}
|any single character
|-
| {{{ \n }}}
|newline character (or CR+LF combination)
|-
| {{{ \t }}}
|tab (ASCII 9)
|-
| {{{ \d }}}
| digit [0-9]
|-
| {{{ \D }}}
|a non-digit
|-
| {{{ \w }}}
|alphanumeric character
|-
| {{{ \W }}}
|non-alphanumeric character
|-
| {{{ \s }}}
|whitespace character
|-
| {{{ \S }}}
|non-whitespace character
|-
| {{{ \ }}}
|Escape special characters
|\. for period; \\ for backslash
|-
| {{{ ^ }}}
|beginning of the input string
|-
| {{{ $ }}}
|end of the input string
|}
{|
| {{{ \w+@\w+ }}}
|a@a, email@company.com
|-
| {{{^[A-Za-z0-9_\.-]+@[A-Za-z0-9_\.-]+[A-Za-z0-9_][A-Za-z0-9_]$ }}}
|email@company.com
|-
| {{{ ^\d\d\d\d-[A-Z][a-z][a-z]-\d\d$ }}}
|2012-Nov-14
|}
!!! Character classes
You can group characters by putting them between square brackets. This way, any character in the class will match one character in the input.
[abc] Match any of a, b, and c.
[a-z] Match any character between a and z. (ASCII order)
[^abc] A caret ^ at the beginning indicates "not". In this case, match anything other than a, b, or c.
[+*?.] Most special characters have no meaning inside the square brackets. This expression matches any of +, *, ? or the dot.
Here are some sample uses.
Regex Matches Does not match
[^ab] c, d, z ab
^[1-9][0-9]*$ Any positive integer Zero, negative or decimal numbers
[0-9]*[,.]?[0-9]+ .1, 1, 1.2, 100,000 12.
Grouping and alternatives
It's often necessary to group things together with parentheses ( and ).
Regex Matches Does not match
(ab)+ ab, abab, ababab aabb
(aa|bb)+ aa, bbaa, aabbaaaa abab
Notice the | operator. This is the Or operator that takes any of the alternatives.
With parentheses, you can also define subexpressions to remember after the match has happened. In the below example, the string what is between (.)
Regex Matches Stores
a(\d+)a a12a 12
(\d+)\.(\d+) 1.2 1 and 2
In these examples, what is matched by (\d+) gets stored. The regex engine will allow you to retrieve the stored value by a successive call. The implementation of the call varies. In RegExpr for VB/VBA, you call RegExprResult(1) to get the first stored value, RegExprResult(2) to get the second one, and so on. This way you can retrieve fields for further processing.
* Code_Regex_MySnippets
* Below from http://www.aivosto.com/vbtips/regex.html
!!! Dates
Date strings are difficult to parse because there are so many variations. You can't always trust VB's own date conversion functions as the date may come in an unexpected or unsupported format. Let's assume we have a date string in the following format: 2002-Nov-14.
{{{
^\d\d\d\d-[A-Z][a-z][a-z]-\d\d$
Explanation
^\d\d\d\d Match four digits that make up the year.
- Match the separator dash.
[A-Z][a-z][a-z] Match a 3-letter month name. The first letter is in upper case.
- Match the separator dash.
\d\d$ Match two digits that make up the day.
}}}
If a match is found, you can be sure that the input string is formatted like a date. However, a regex is not able to verify that it's a real date. For example, it could as well be 5400-Qui-32. This doesn't look like an acceptable date to most applications. If you want to prepare yourself for the stranger dates, you'll have to write a more limiting expression:
{{{^20\d\d-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(0[1-9]|[1-2][0-9]|3[01])$}}}
Explanation
^20\d\d Match four digits that make up the year. The year must be between 2000 and 2099. No other dates please!
- Match the separator dash.
(Jan|Feb|Mar|Apr |May|Jun|Jul|Aug |Sep|Oct|Nov|Dec) Match the month abbreviation in English. Now you don't accept the date in any other language.
- Match the separator dash.
{{{ (0[1-9]|[1-2][0-9]|3[01])$ }}}
Match two digits that make up the day. This accepts numbers from 01 to 09, 10 to 29 and 30 to 31. What if the user gives 2003-Feb-31? There are limitations to what regexes can do. If you want to validate the string further, you need to use other techniques than regexes.
!!! Web logs
Web server logs come in several formats. This is a typical line in a log file.
{{{144.18.39.44 - - [01/Sep/2002:00:03:20 -0700] "GET /resources.html HTTP/1.1" 200 3458 "http://www.aivosto.com/" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"}}}
As you can see, there are several fields on the line. They conform to a complex format. The fields are different from each other. A human-readable way to define the various fields is here:
{{{host - - [date] "GET URL HTTP/1.1" status size "ref" "agent"}}}
As you can see, there are fields such as host (visitor's Internet address), date and time (enclosed in square brackets), an HTTP request with file to retrieve (enclosed in quotation marks), numeric status code, numeric size of file, referer field (enclosed in quotation marks), and agent (browser) name (enclosed in quotation marks).
To programmatically parse the line, you need to split it into fields, then look at each field. This is a sample regex that will split the fields.
{{{ ^(\S*) - - \[(.*) .....\] \"....? (\S*) .*\" (\d*) ([-0-9]*) (\"([^"]+)\")? }}}
Explanation
^(\S*) Match any number of non-space characters at the start of the line.
- - Match the two dashes. They are actually empty fields that might have content in another log file.
\[(.*) .....\] Match the date inside square brackets. The date consists of a datetime string, a space, and a 5-character time zone indication. To actually use the date you'd need to write a more detailed regex to separate the year, month, day, hour, minute, and second.
\"....? (\S*) .*\" Match the HTTP request inside quotation marks. First there is a 3 to 4-character verb, such as GET, POST or HEAD. (\S*) matches the actual file that is being retrieved. At the end, .* matches HTTP/1.1 or whatever protocol was used to retrieve the file.
(\d*) Match a numeric status code.
([-0-9]*) Match a numeric file size, or - if no number is present.
(\"([^"]+)\")? Match the "ref" field. It's anything enclosed in quotation marks.
In this example, we've left "agent" unmatched. That does no harm because $ is not used to match the end-of-line. We can leave "agent" unmatched if we're not interested in the field.
This example has been taken from a web log file parser script. To use it in your own code, you have to fine-tune it to suit your log file format. The regex assumes that lines come only in the presented format. If, say, a field is missing or the file contains garbage lines, the regex may fail. This results in an unparsed line.
* [[Access_regex]]
! TiddlyWiki
!!! Internal links
| Search | Replace with |h
|{{{(wiki_doc.+)\s(.+.pdf)}}} |{{{\1\2}}}|
|{{{(\|.+)(.+.pdf)}}} | //finds links real good// |
!!! Bible references
{{{(["[])_[0-9][0-9][0-9]_([1-3]*[A-Z][a-z]+_*[0-9]+*_*[0-9]+*["\]])}}}
{{{\1\2}}}}
this removes the following: {{{_[0-9][0-9][0-9]_}}}
With this result:
| Before | After |
| {{{[[_001_John_05]]}}} | {{{[[John_05]]}}} |
| {{{"_001_John_05"}}} | {{{"John_05"}}} |
! SQL
Strip generated aliases from VBA query (Notepad++)
{{{ AS Expr\d+}}}.
! Insert pretty sentence spaces (OpenOffice Writer)
{{{ (\.) (.) }}} Find
{{{ ([a-z][\.\?\"\!]) ([a-z]) }}} Find (alternative)
{{{ $1 $2 }}} Replace
These are close, but not quite ...
! Clean up Faith's music sheets
# delete all {{{in D}}} notes: {{{ [-�] in [A-G][#m]*.*}}}
# delete all verse number-tags: {{{ ^[0-9]\.\s }}}
# delete chord lines: {{{ ^.*\<[A-G][#ms2]*\>.*$ }}}
! HTML tags
{{{-? </?XForm>}}} Find
{{{- <XForm>}}} or
{{{ </XForm>}}}
{{{ <Label>.*</Label> }}} all these tags plus content
! Clean up bank statement
Use large date range to capture large amount of data from Broadway Bank.
Paste into OO Writer. Save as TXT.
Open in Notepad++
Replace {{{(Check).*(Cleared)}}} with {{{ \1 \2 }}}
Replace {{{(Credit - Deposit).*(Cleared)}}} with {{{ \1 \2 }}}
Replace {{{(Debit - Deposit).*(Cleared)}}} with {{{ \1 \2 }}}
{{{[A-Z0-9].*[A-Z0-9]}}} delete detail line
{{{[A-Z0-9].*[0-9][0-9][0-9][0-9]$)}}} delete detail line
{{{(\...) (..)}}} with {{{\1\n\2}}} somehow this cleaned up newlines ... I used \r with 'extended' to get rid of them actually; then this inserted by finding {{{$5.00 11/10/2010}}}
!!!! A stub is a sort of shell
Also applies to all folder structures.
{{{
Private Sub btnMenuSales_Click()
''VBA will delete an empty sub
Debug.Print "Stub" ''...so insert placeholder
''FIXME
End Sub
}}}
''Stub start for a debug trip in VBA:''
{{{
If True Then Stop
''DEBUG
}}}
!!!! HOW TO STUB:
* All lines can be processed -- no run-time bugs
* Values are placeholders -- use 42, 11
* Use self referencing: {{{IIf(True,True,False)}}}
* FI~XME as needed (which is a lot)
* Try for fake results
!!!! HOW TO PSEUDO-CODE:
write pseudo-code in these stages:
# thinking for structure
# good enough to redraft as code
# good enough to paste as code
@@[[CRUD_Acronymn|CRUD]] functions are the key points!@@
Laws of Naming by D. Boundy:
#Do not give two names to one thing
#Do not attribute two things to one name.
#Names are meaningful and specific, and their length is proportional to their scope. A loop variable used only once in a two-statement loop may be called {{{count}}}, but a global variable that may be used anywhere in the program will have a long name that accurately describes its usage.
Also
* Do not use {{{i}}}. It's too easy to confuse typographically with {{{1}}}. (Contrary to Boundy!)
!!!! Commenting
*{{{//FIXME; //DEBUG}}}
*{{{//SDM}}}
* Leave clues for yourself. A comment on recent change, noting the date, can help if a roll-back is needed.
!!!! Readability
* Use the telephone test for readability: could a programmer understand your code when read aloud over the telephone? (__Elements of Programming Style__, Kernighan and Plauger)
/***
|Name|CollapseTiddlersPlugin|
|Source|http://gensoft.revhost.net/Collapse.html|
|Version|2008.10.05|
|Author|Bradley Meck (modified by ELS)|
|License|unknown|
|~CoreVersion|2.1|
|Type|plugin|
|Requires|CollapsedTemplate|
|Overrides||
|Description|show/hide content of a tiddler while leaving tiddler title visible|
|ELS 10/5/2008: collapseAll() and expandAll(): added "return false" to button handlers to prevent IE page transition |
|ELS 3/6/2008: refactored code for size reduction, readability, and I18N/L10N-readiness. Also added 'folded' flag to tiddler elements (for use by other plugins that need to know if tiddler is folded (e.g., [[SinglePageModePlugin]]) |
|ELS 10/11/2007: moved [[FoldFirst]] inline script and converted to {{{<<foldFirst>>}}} macro. |
|ELS 9/12/2007: suspend/resume SinglePageMode (SPM/TPM/BPM) when folding/unfolding tiddlers |
|ELS 6/5/2007: add "return false" at the end of each command handler to prevent IE 'page transition' problem. |
|ELS 3/30/2007: add a shadow definition for CollapsedTemplate. Tweak ViewTemplate shadow so "fold/unfold" and "focus" toolbar items automatically appear when using default templates. Remove error check for "CollapsedTemplate" existence, since shadow version will now always work as a fallback. |
|ELS 2/24/2006: added fallback to "CollapsedTemplate" if "WebCollapsedTemplate" is not found |
|ELS 2/6/2006: added check for 'readOnly' flag to use alternative "WebCollapsedTemplate" |
***/
//{{{
config.shadowTiddlers.CollapsedTemplate=
"<!--{{{-->\
<div class='toolbar' macro='toolbar expandTiddler collapseOthers closeTiddler closeOthers +editTiddler permalink references jump'></div>\
<div class='title' macro='view title'></div>\
<!--}}}-->";
// automatically tweak shadow ViewTemplate to add "collapseTiddler collapseOthers" commands
config.shadowTiddlers.ViewTemplate=config.shadowTiddlers.ViewTemplate.replace(/closeTiddler/,"collapseTiddler collapseOthers closeTiddler");
config.commands.collapseTiddler = {
text: "fold",
tooltip: "Collapse this tiddler",
collapsedTemplate: "CollapsedTemplate",
webCollapsedTemplate: "WebCollapsedTemplate",
handler: function(event,src,title) {
var e = story.findContainingTiddler(src); if (!e) return false;
// don't fold tiddlers that are being edited!
if(story.isDirty(e.getAttribute("tiddler"))) return false;
var t=config.commands.collapseTiddler.getCollapsedTemplate();
config.commands.collapseTiddler.saveTemplate(e);
config.commands.collapseTiddler.display(title,t);
e.setAttribute("folded","true");
return false;
},
getCollapsedTemplate: function() {
if (readOnly&&store.tiddlerExists(this.webCollapsedTemplate))
return this.webCollapsedTemplate;
else
return this.collapsedTemplate
},
saveTemplate: function(e) {
if (e.getAttribute("savedTemplate")==undefined)
e.setAttribute("savedTemplate",e.getAttribute("template"));
},
// fold/unfold tiddler with suspend/resume of single/top/bottom-of-page mode
display: function(title,t) {
var opt=config.options;
var saveSPM=opt.chkSinglePageMode; opt.chkSinglePageMode=false;
var saveTPM=opt.chkTopOfPageMode; opt.chkTopOfPageMode=false;
var saveBPM=opt.chkBottomOfPageMode; opt.chkBottomOfPageMode=false;
story.displayTiddler(null,title,t);
opt.chkBottomOfPageMode=saveBPM;
opt.chkTopOfPageMode=saveTPM;
opt.chkSinglePageMode=saveSPM;
}
}
config.commands.expandTiddler = {
text: "unfold",
tooltip: "Expand this tiddler",
handler: function(event,src,title) {
var e = story.findContainingTiddler(src); if (!e) return false;
var t = e.getAttribute("savedTemplate");
config.commands.collapseTiddler.display(title,t);
e.setAttribute("folded","false");
return false;
}
}
config.macros.collapseAll = {
text: "collapse all",
tooltip: "Collapse all tiddlers",
handler: function(place,macroName,params,wikifier,paramString,tiddler){
createTiddlyButton(place,this.text,this.tooltip,function(){
story.forEachTiddler(function(title,tiddler){
if(story.isDirty(title)) return;
var t=config.commands.collapseTiddler.getCollapsedTemplate();
config.commands.collapseTiddler.saveTemplate(tiddler);
config.commands.collapseTiddler.display(title,t);
tiddler.folded=true;
});
return false;
})
}
}
config.macros.expandAll = {
text: "expand all",
tooltip: "Expand all tiddlers",
handler: function(place,macroName,params,wikifier,paramString,tiddler){
createTiddlyButton(place,this.text,this.tooltip,function(){
story.forEachTiddler(function(title,tiddler){
var t=config.commands.collapseTiddler.getCollapsedTemplate();
if(tiddler.getAttribute("template")!=t) return; // re-display only if collapsed
var t=tiddler.getAttribute("savedTemplate");
config.commands.collapseTiddler.display(title,t);
tiddler.folded=false;
});
return false;
})
}
}
config.commands.collapseOthers = {
text: "focus",
tooltip: "Expand this tiddler and collapse all others",
handler: function(event,src,title) {
var e = story.findContainingTiddler(src); if (!e) return false;
story.forEachTiddler(function(title,tiddler) {
if(story.isDirty(title)) return;
var t=config.commands.collapseTiddler.getCollapsedTemplate();
if (e==tiddler) t=e.getAttribute("savedTemplate");
config.commands.collapseTiddler.saveTemplate(tiddler);
config.commands.collapseTiddler.display(title,t);
tiddler.folded=(e!=tiddler);
})
return false;
}
}
// {{{<<foldFirst>>}}} macro forces tiddler to be folded when *initially* displayed.
// Subsequent re-render does NOT re-fold tiddler, but closing/re-opening tiddler DOES cause it to fold first again.
config.macros.foldFirst = {
handler: function(place,macroName,params,wikifier,paramString,tiddler){
var e=story.findContainingTiddler(place);
if (e.getAttribute("foldedFirst")=="true") return; // already been folded once
var title=e.getAttribute("tiddler")
var t=config.commands.collapseTiddler.getCollapsedTemplate();
config.commands.collapseTiddler.saveTemplate(e);
config.commands.collapseTiddler.display(title,t);
e.setAttribute("folded","true");
e.setAttribute("foldedFirst","true"); // only when tiddler is first rendered
return false;
}
}
//}}}
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::CollapsedToolbar]]'></div>
<div class='title' macro='view title'></div>
<!--}}}-->
Background: #fff
Foreground: #000
PrimaryPale: #ccc
PrimaryLight: #808080
PrimaryMid: #333
PrimaryDark: #014
SecondaryPale: #ffffff
SecondaryLight: #f88
SecondaryMid: #333
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
/***
|Name|CookieManagerPlugin|
|Source|http://www.TiddlyTools.com/#CookieManagerPlugin|
|Version|2.4.0|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Options|##Configuration|
|Description|view/add/delete browser-based cookies and "bake" cookies to CookieJar tiddler for 'sticky' settings|
!!!!!Usage
<<<
This plugin provides an interactive control panel that lets you select, view, modify, or delete any of the current values for TiddlyWiki options that have been stored as local, private, //browser cookies//. You can also use the control panel to "bake cookies", which generates a set of javascript statements that assign hard-coded option values to the TiddlyWiki internal variables that correspond to the current browser cookie settings. These hard-coded values are then stored in the [[CookieJar]] tiddler, which is tagged with<<tag systemConfig>> so that each time the document is loaded, the baked cookie settings will be automatically applied.
When a set of baked cookies is added to the [[CookieJar]], it is automatically surrounded by a conditional test so that the hard-coded settings will only be applied for the username that was in effect when they were initially generated. In this way, if you publish or share your document with others, //your// particular baked cookie settings are not automatically applied to others, so that their own browser-based cookie settings (if defined) will be applied as usual.
Whenever you "bake cookies", new hard-coded javascript assignment statements are *appended* to the end of the [[CookieJar]]. However, any baked cookies that were previously generated and stored in the [[CookieJar]] are not automatically removed from the tiddler. As a result, because the most recently baked cookie settings in the [[CookieJar]] are always the last to be processed, the values assigned by older baked cookies are immediately overridden by the values from the newest baked cookies, so that the newest values will be in effect when the CookieJar startup processing is completed.
Each time you bake a new batch of cookies, it is recommended that you should review and hand-edit the [[CookieJar]] to remove any "stale cookies" or merge the old and new sets of baked cookies into a single block to simplify readability (as well as saving a little tiddler storage space). Of course, you can also hand-edit the [[CookieJar]] tiddler at any time simply to remove a few individual //baked cookies// if they are no longer needed, and you can even delete the entire [[CookieJar]] tiddler and start fresh, if that is appropriate. Please note that changing or deleting a baked cookie does not alter the current value of the corresponding option setting, and any changes you make to the [[CookieJar]] will only be applied after you have saved and reloaded the document in your browser.
<<<
!!!!!Examples
<<<
{{{<<cookieManager>>}}}
{{smallform small center{
@@display:block;width:35em;<<cookieManager>>@@}}}
<<<
!!!!!Configuration
<<<
<<option chkAllowBrowserCookies>> store ~TiddlyWiki option settings using private browser cookies
<<option chkMonitorBrowserCookies>> monitor browser cookie activity (show a message whenever a cookie is set or deleted)
<<option chkCookieManagerAddToAdvancedOptions>> display [[CookieManager]] in [[AdvancedOptions]]
//note: this setting does not take effect until you reload the document//
<<<
!!!!!Revisions
<<<
2009.08.05 [2.4.0] changed CookieJar output format to support odd symbols in option names (e.g. '@')
2008.09.14 [2.3.2] fixed handling for blocked cookies (was still allowing some blocked cookies to be set)
2008.09.12 [2.3.1] added blocked[] array and allowBrowserCookie() test function for selective blocking of changes to browser cookies based on cookie name
2008.09.08 [2.3.0] extensive code cleanup: defined removeCookie(), renamed cookies, added 'button' param for stand-alone "bake cookies" button, improved init of shadow [[CookieManager]] and [[CookieJar]] tiddlers for compatibility with new [[CookieSaverPlugin]].
2008.07.11 [2.2.1] fixed recursion error in hijack for saveOptionCookie()
2008.06.26 [2.2.0] added chkCookieManagerNoNewCookies option
2008.06.05 [2.1.3] replaced hard-coded definition for "CookieJar" title with option variable
2008.05.12 [2.1.2] add "cookies" task to backstage (moved from BackstageTasks)
2008.04.09 [2.1.0] added options: chkCookieManagerAddToAdvancedOptions
2008.04.08 [2.0.1] automatically include CookieManager control panel in AdvancedOptions shadow tiddler
2007.08.02 [2.0.0] converted from inline script
2007.04.29 [1.0.0] initial release
<<<
!!!!!Code
***/
//{{{
version.extensions.CookieManagerPlugin= {major: 2, minor: 3, revision: 1, date: new Date(2008,9,12)};
//}}}
//{{{
config.macros.cookieManager = {
target:
config.options.txtCookieJar||"CookieJar",
blockedCookies:
[],
allowBrowserCookie: function(name) {
return true;
},
displayStatus: function(msg) {
if (config.options.chkMonitorBrowserCookies && !startingUp)
displayMessage("CookieManager: "+msg);
},
init: function() {
if (config.options.txtCookieJar===undefined)
config.options.txtCookieJar=this.target;
if (config.options.chkAllowBrowserCookies===undefined)
config.options.chkAllowBrowserCookies=true;
if (config.options.chkMonitorBrowserCookies===undefined)
config.options.chkMonitorBrowserCookies=false;
config.shadowTiddlers.CookieManager=
"/***\n"
+"!!![[Browser cookies:|CookieManagerPlugin]] "
+"{{fine{<<option chkAllowBrowserCookies>>enable <<option chkMonitorBrowserCookies>>monitor}}}\n"
+"^^Review, modify, or delete browser cookies..."
+"To block specific cookies, see [[CookieManagerPluginConfig]].^^\n"
+"@@display:block;width:30em;{{smallform small{\n<<cookieManager>>}}}@@\n"
+"***/\n";
// add CookieManager to shadow CookieJar
var h="/***\n<<tiddler CookieManager>>\n***/\n";
var t=(config.shadowTiddlers[this.target]||"").replace(new RegExp(h.replace(/\*/g,'\\*'),''),'')
config.shadowTiddlers[this.target]=h+t;
if (config.options.chkCookieManagerAddToAdvancedOptions===undefined)
config.options.chkCookieManagerAddToAdvancedOptions=true;
if (config.options.chkCookieManagerAddToAdvancedOptions)
config.shadowTiddlers.AdvancedOptions+="\n!!CookieManager\n><<tiddler CookieManager>>";
// add "cookies" backstage task
if (config.tasks && !config.tasks.cookies) { // for TW2.2b3 or above
config.tasks.cookies = {
text: "cookies",
tooltip: "manage cookie-based option settings",
content: "{{groupbox{<<tiddler CookieManager>><<tiddler [["+this.target+"]]>>}}}"
}
config.backstageTasks.push("cookies");
}
},
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
var span=createTiddlyElement(place,"span");
span.innerHTML=(params[0]&¶ms[0].toLowerCase()=="button")?this.button:this.panel;
this.setList(span.firstChild.list);
},
panel: '<form style="display:inline;margin:0;padding:0" onsubmit="return false"><!--\
--><select style="width:99%" name="list" \
onchange="this.form.val.value=this.value.length?config.options[this.value]:\'\';"><!--\
--></select><br>\
<input type="text" style="width:98%;margin:0;" name="val" title="enter an option value"><br>\
<input type="button" style="width:33%;margin:0;" value="get" title="refresh list" \
onclick="config.macros.cookieManager.setList(this.form.list);"><!--\
--><input type="button" style="width:33%;margin:0;" value="set" title="save cookie value" \
onclick="var cmc=config.macros.cookieManager;\
var opt=this.form.list.value; var v=this.form.val.value; \
var msg=opt+\' is a blocked cookie. OK to proceed?\';\
if ((!cmc.blockedCookies.contains(opt) && cmc.allowBrowserCookie(opt))||confirm(msg)) {\
config.options[opt]=opt.substr(0,3)==\'txt\'?v:(v.toLowerCase()==\'true\'); \
saveOptionCookie(opt);config.macros.cookieManager.setList(this.form.list);\
}"><!--\
--><input type="button" style="width:33%;margin:0;" value="del" title="remove cookie" \
onclick="var cmc=config.macros.cookieManager; var opt=this.form.list.value; \
var msg=opt+\' is a blocked cookie. OK to proceed?\';\
if ((!cmc.blockedCookies.contains(opt) && cmc.allowBrowserCookie(opt))||confirm(msg)) {\
removeCookie(this.form.list.value,true); \
cmc.setList(this.form.list);\
}"><br>\
<input type="button" style="width:50%;margin:0;" value="bake cookies" \
title="save current cookie-based option values into a tiddler" \
onclick="return config.macros.cookieManager.bake(this,false)"><!--\
--><input type="button" style="width:50%;margin:0;" value="bake all options" \
title="save ALL option values (including NON-COOKIE values) into a tiddler" \
onclick="return config.macros.cookieManager.bake(this,true)"><!--\
--></form>\
',
button: '<form style="display:inline;margin:0;padding:0" onsubmit="return false"><!--\
--><input type="button" style="margin:0;" value="bake cookies" \
title="save current browser-based cookie values into a tiddler" \
onclick="return config.macros.cookieManager.bake(this,false)"><!--\
--></form>\
',
getCookieList: function() {
var cookies = { };
if (document.cookie != "") {
var p = document.cookie.split("; ");
for (var i=0; i < p.length; i++) {
var pos=p[i].indexOf("=");
if (pos==-1) cookies[p[i]]="";
else cookies[p[i].substr(0,pos)]=unescape(p[i].slice(pos+1));
}
}
var opt=new Array(); for (var i in config.options) if (cookies[i]) opt.push(i); opt.sort();
return opt;
},
setList: function(list) {
if (!list) return false;
var opt=this.getCookieList();
var sel=list.selectedIndex;
while (list.options.length > 1) { list.options[1]=null; } // clear list (except for header item)
list.options[0]=new Option("There are "+opt.length+" cookies...","",false,false);
if (!opt.length) { list.form.val.value=""; return; } // no cookies
var c=1;
for(var i=0; i<opt.length; i++) {
var txt="";
if (opt[i].substr(0,3)=="chk")
txt+="["+(config.options[opt[i]]?"\u221A":"_")+"] ";
txt+=opt[i];
list.options[c++]=new Option(txt,opt[i],false,false);
}
list.selectedIndex=sel>0?sel:0;
list.form.val.value=sel>0?config.options[list.options[sel].value]:"";
},
header:
"/***\n"
+"!!![[Baked cookies:|CookieManagerPlugin]]\n"
+"^^Press {{smallform{<<cookieManager button>>}}} to save the current browser cookies... "
+"then hand-edit this section to customize the results.^^\n"
+"***/\n",
format: function(name) {
if (name.substr(0,3)=='chk')
return '\tconfig.options["'+name+'"]='+(config.options[name]?'true;':'false;');
return '\tconfig.options["'+name+'"]="'+config.options[name]+'";';
},
bake: function(here,all) {
if (story.isDirty(this.target)) return false; // target is being hand-edited... do nothing
var text=store.getTiddlerText(this.target);
if (text.indexOf(this.header)==-1) {
text+=this.header;
displayMessage("CookieManager: added 'Baked Cookies' section to CookieJar");
}
var who=config.options.txtUserName;
var when=new Date();
var tags=['systemConfig'];
var tid=store.getTiddler(this.target)||store.saveTiddler(this.target,this.target,text,who,when,tags,{});
if (!tid) return false; // if no target... do nothing
if (all) {
var opts=new Array();
for (var i in config.options) if (i.substr(0,3)=='chk'||i.substr(0,3)=='txt') opts.push(i);
opts.sort();
}
else var opts=this.getCookieList();
var t=tid.text;
if (t.indexOf(this.header)==-1) t+=this.header;
t+='\n// '+opts.length+(all?' options':' cookies')+' saved ';
t+=when.formatString('on DDD, MMM DDth YYYY at 0hh:0mm:0ss');
t+=' by '+who+'//\n';
t+='//^^(edit/remove username check and/or individual option settings as desired)^^//\n';
t+='//{{{\n';
t+='if (config.options.txtUserName=="'+who+'") {\n';
for (i=0; i<opts.length; i++) t+=config.macros.cookieManager.format(opts[i])+"\n";
t+='}\n//}}}\n';
store.saveTiddler(this.target,this.target,t,who,when,tags,tid?tid.fields:{});
story.displayTiddler(story.findContainingTiddler(this),this.target);
story.refreshTiddler(this.target,null,true);
var msg=opts.length+(all?' options':' cookies')+' have been saved in '+this.target+'. ';
msg+='Please review all stored settings.';
displayMessage(msg);
return false;
}
}
//}}}
//{{{
// Hijack saveOptionCookie() to add cookie blocking and monitoring messages
config.macros.cookieManager.saveOptionCookie=saveOptionCookie;
window.saveOptionCookie=function(name,force)
{
var cmc=config.macros.cookieManager; // abbrev
if (force || ((config.options.chkAllowBrowserCookies || name=="chkAllowBrowserCookies")
&& !cmc.blockedCookies.contains(name) && cmc.allowBrowserCookie(name))) {
cmc.saveOptionCookie.apply(this,arguments);
cmc.displayStatus(name+"="+config.options[name]);
} else cmc.displayStatus("setting of '"+name+"' is blocked");
}
// if removeCookie() function is not defined by TW core, define it here.
if (window.removeCookie===undefined) {
window.removeCookie=function(name) {
document.cookie = name+'=; expires=Thu, 01-Jan-1970 00:00:01 UTC; path=/;';
}
}
// ... and then hijack it to add cookie blocking and monitoring messages
config.macros.cookieManager.removeCookie=removeCookie;
window.removeCookie=function(name,force)
{
var cmc=config.macros.cookieManager; // abbrev
if (!cmc.getCookieList().contains(name))
return; // not a current cookie!
if (force || ((config.options.chkAllowBrowserCookies || name=="chkAllowBrowserCookies")
&& !cmc.blockedCookies.contains(name) && cmc.allowBrowserCookie(name))) {
cmc.removeCookie.apply(this,arguments);
cmc.displayStatus("deleted "+name);
} else cmc.displayStatus("deletion of '"+name+"' is blocked");
}
//}}}
/***
|Name|CookieManagerPluginConfig|
|Source|http://www.TiddlyTools.com/#CookieManagerPluginConfig|
|Requires|CookieManagerPlugin|
|Description|custom settings for [[CookieManagerPlugin]]|
!!!!!Browser Cookie Configuration:
***/
// // <<option chkAllowBrowserCookies>> store ~TiddlyWiki option settings using private browser cookies
// // <<option chkMonitorBrowserCookies>> monitor browser cookie activity (shows a message whenever a cookie is updated)
//{{{
// default settings:
config.options.chkAllowBrowserCookies=true; // if FALSE, this blocks *all* cookies
config.options.chkMonitorBrowserCookies=false;
//}}}
// // Individual cookie names can be prevented from being created, modified, or deleted in your browser's stored cookies by adding them to the {{{config.macros.cookieManager.blockedCookies}}} array:
//{{{
var bc=config.macros.cookieManager.blockedCookies; // abbreviation
bc.push("txtMainTab"); // TiddlyWiki: SideBarTabs
bc.push("txtTOCSortBy"); // TiddlyTools: TableOfContentsPlugin
bc.push("txtCatalogTab"); // TiddlyTools: ShowCatalog
//}}}
// // You can also define a javascript test function that determines whether or not any particular cookie name should be blocked or allowed. The following function should return FALSE if the browser cookie should be blocked, or TRUE if changes to the cookie should be allowed:
//{{{
config.macros.cookieManager.allowBrowserCookie=function(name) {
// add tests based on specific cookie names and runtime conditions
return true;
}
//}}}
/***
|Name|CopyTiddlerPlugin|
|Source|http://www.TiddlyTools.com/#CopyTiddlerPlugin|
|Version|3.2.5|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.3|
|Type|plugin|
|Requires||
|Overrides||
|Description|Quickly create a copy of any existing tiddler|
!!!Usage
<<<
The plugin automatically updates the default (shadow) ToolbarCommands definitions to insert the ''copyTiddler'' command, which will appear as ''copy'' when a tiddler is rendered. If you are already using customized toolbar definitions, you will need to manually add the ''copyTiddler'' toolbar command to your existing ToolbarCommands tiddler, e.g.:
{{{
|EditToolbar|... copyTiddler ... |
}}}
When the ''copy'' command is selected, a new tiddler is created containing an exact copy of the current text/tags/fields, using a title of "{{{TiddlerName (n)}}}", where ''(n)'' is the next available number (starting with 1, of course). If you copy while //editing// a tiddler, the current values displayed in the editor are used (including any changes you may have already made to those values), and the new tiddler is immediately opened for editing.
The plugin also provides a macro that allows you to embed a ''copy'' command directly in specific tiddler content:
{{{
<<copyTiddler TidderName label:"..." prompt:"...">>
}}}
where
* ''TiddlerName'' (optional)<br>specifies the //source// tiddler to be copied. If omitted, the current containing tiddler (if any) will be copied.
* ''label:"..."'' (optional)<br>specifies text to use for the embedded link (default="copy TiddlerName")
* ''prompt:"..."'' (optional)<br>specifies mouseover 'tooltip' help text for link
//Note: to use non-default label/prompt values with the current containing tiddler, use "" for the TiddlerName//
<<<
!!!Configuration
<<<
<<option chkCopyTiddlerDate>> use date/time from existing tiddler (otherwise, use current date/time)
{{{<<option chkCopyTiddlerDate>>}}}
<<<
!!!Revisions
<<<
2009.06.08 [3.2.5] added option to use timestamp from source tiddler
2009.03.09 [3.2.4] fixed IE-specific syntax error
2009.03.02 [3.2.3] refactored code (again) to restore use of config.commands.copyTiddler.* custom settings
2009.02.13 [3.2.2] in click(), fix calls to displayTiddler() to use current tiddlerElem and use getTiddlerText() to permit copying of shadow tiddler content
2009.01.30 [3.2.1] fixed handling for copying field values when in edit mode
2009.01.23 [3.2.0] refactored code and added {{{<<copyTiddler TiddlerName>>}}} macro
2008.12.18 [3.1.4] corrected code for finding next (n) value when 'sparse' handling is in effect (thanks to RussThomas for identifying and diagnosing the problem)
2008.11.14 [3.1.3] added optional 'sparse' setting (avoids 'filling in' missing numbers that may have been previously deleted)
2008.11.14 [3.1.2] added optional 'zeroPad' setting
2008.11.14 [3.1.1] moved hard-coded '(n)' regex into 'suffixPattern' object property so it can be customized
2008.09.26 [3.1.0] changed new title generation to use '(n)' suffix instead of 'Copy of' prefix
2008.05.20 [3.0.3] in handler, when copying from VIEW mode, create duplicate array from existing tags array before saving new tiddler.
2007.12.19 [3.0.2] in handler, when copying from VIEW mode, duplicate custom fields before saving new tiddler. Thanks to bug report from Ken Girard.
2007.09.26 [3.0.1] in handler, use findContainingTiddler(src) to get tiddlerElem (and title). Allows 'copy' command to find correct tiddler when transcluded using {{{<<tiddler>>}}} macro or enhanced toolbar inclusion (see [[CoreTweaks]])
2007.06.28 [3.0.0] complete re-write to handle custom fields and alternative view/edit templates
2007.05.17 [2.1.2] use store.getTiddlerText() to retrieve tiddler content, so that SHADOW tiddlers can be copied correctly when in VIEW mode
2007.04.01 [2.1.1] in copyTiddler.handler(), fix check for editor fields by ensuring that found field actually has edit=='text' attribute
2007.02.05 [2.1.0] in copyTiddler.handler(), if editor fields (textfield and/or tagsfield) can't be found (i.e., tiddler is in VIEW mode, not EDIT mode), then get text/tags values from stored tiddler instead of active editor fields. Allows use of COPY toolbar directly from VIEW mode (based on a request from LaurentCharles)
2006.12.12 [2.0.0] completely rewritten so plugin just creates a new tiddler EDITOR with a copy of the current tiddler EDITOR contents, instead of creating the new tiddler in the STORE by copying the current tiddler values from the STORE.
2005.xx.xx [1.0.0] original version by Tim Morgan
<<<
!!!Code
***/
//{{{
version.extensions.CopyTiddlerPlugin= {major: 3, minor: 2, revision: 5, date: new Date(2009,6,8)};
// automatically tweak shadow EditTemplate to add 'copyTiddler' toolbar command (following 'cancelTiddler')
config.shadowTiddlers.ToolbarCommands=config.shadowTiddlers.ToolbarCommands.replace(/cancelTiddler/,'cancelTiddler copyTiddler');
if (config.options.chkCopyTiddlerDate===undefined) config.options.chkCopyTiddlerDate=false;
config.commands.copyTiddler = {
text: 'copy',
hideReadOnly: true,
tooltip: 'Make a copy of this tiddler',
notitle: 'this tiddler',
prefix: '',
suffixText: ' (%0)',
suffixPattern: / \(([0-9]+)\)$/,
zeroPad: 0,
sparse: false,
handler: function(event,src,title)
{ return config.commands.copyTiddler.click(src,event); },
click: function(here,ev) {
var tiddlerElem=story.findContainingTiddler(here);
var template=tiddlerElem?tiddlerElem.getAttribute('template'):null;
var title=here.getAttribute('from');
if (!title || !title.length) {
if (!tiddlerElem) return false;
else title=tiddlerElem.getAttribute('tiddler');
}
var root=title.replace(this.suffixPattern,''); // title without suffix
// find last matching title
var last=title;
if (this.sparse) { // don't fill-in holes... really find LAST matching title
var tids=store.getTiddlers('title','excludeLists');
for (var t=0; t<tids.length; t++) if (tids[t].title.startsWith(root)) last=tids[t].title;
}
// get next number (increment from last matching title)
var n=1; var match=this.suffixPattern.exec(last); if (match) n=parseInt(match[1])+1;
var newTitle=this.prefix+root+this.suffixText.format([String.zeroPad(n,this.zeroPad)]);
// if not sparse mode, find the next hole to fill in...
while (store.tiddlerExists(newTitle)||document.getElementById(story.idPrefix+newTitle))
{ n++; newTitle=this.prefix+root+this.suffixText.format([String.zeroPad(n,this.zeroPad)]); }
if (!story.isDirty(title)) { // if tiddler is not being EDITED
// duplicate stored tiddler (if any)
var text=store.getTiddlerText(title,'');
var who=config.options.txtUserName;
var when=new Date();
var newtags=[]; var newfields={};
var tid=store.getTiddler(title); if (tid) {
if (config.options.chkCopyTiddlerDate) var when=tid.modified;
for (var t=0; t<tid.tags.length; t++) newtags.push(tid.tags[t]);
store.forEachField(tid,function(t,f,v){newfields[f]=v;},true);
}
store.saveTiddler(newTitle,newTitle,text,who,when,newtags,newfields,true);
story.displayTiddler(tiddlerElem,newTitle,template);
} else {
story.displayTiddler(tiddlerElem,newTitle,template);
var fields=config.commands.copyTiddler.gatherFields(tiddlerElem); // get current editor fields
var newTiddlerElem=document.getElementById(story.idPrefix+newTitle);
for (var f=0; f<fields.length; f++) { // set fields in new editor
if (fields[f].name=='title') fields[f].value=newTitle; // rename title in new tiddler
var fieldElem=config.commands.copyTiddler.findField(newTiddlerElem,fields[f].name);
if (fieldElem) {
if (fieldElem.getAttribute('type')=='checkbox')
fieldElem.checked=fields[f].value;
else
fieldElem.value=fields[f].value;
}
}
}
story.focusTiddler(newTitle,'title');
return false;
},
findField: function(tiddlerElem,field) {
var inputs=tiddlerElem.getElementsByTagName('input');
for (var i=0; i<inputs.length; i++) {
if (inputs[i].getAttribute('type')=='checkbox' && inputs[i].field == field) return inputs[i];
if (inputs[i].getAttribute('type')=='text' && inputs[i].getAttribute('edit') == field) return inputs[i];
}
var tas=tiddlerElem.getElementsByTagName('textarea');
for (var i=0; i<tas.length; i++) if (tas[i].getAttribute('edit') == field) return tas[i];
var sels=tiddlerElem.getElementsByTagName('select');
for (var i=0; i<sels.length; i++) if (sels[i].getAttribute('edit') == field) return sels[i];
return null;
},
gatherFields: function(tiddlerElem) { // get field names and values from current tiddler editor
var fields=[];
// get checkboxes and edit fields
var inputs=tiddlerElem.getElementsByTagName('input');
for (var i=0; i<inputs.length; i++) {
if (inputs[i].getAttribute('type')=='checkbox')
if (inputs[i].field) fields.push({name:inputs[i].field,value:inputs[i].checked});
if (inputs[i].getAttribute('type')=='text')
if (inputs[i].getAttribute('edit')) fields.push({name:inputs[i].getAttribute('edit'),value:inputs[i].value});
}
// get textareas (multi-line edit fields)
var tas=tiddlerElem.getElementsByTagName('textarea');
for (var i=0; i<tas.length; i++)
if (tas[i].getAttribute('edit')) fields.push({name:tas[i].getAttribute('edit'),value:tas[i].value});
// get selection lists (droplist or listbox)
var sels=tiddlerElem.getElementsByTagName('select');
for (var i=0; i<sels.length; i++)
if (sels[i].getAttribute('edit')) fields.push({name:sels[i].getAttribute('edit'),value:sels[i].value});
return fields;
}
};
//}}}
// // MACRO DEFINITION
//{{{
config.macros.copyTiddler = {
label: 'copy',
prompt: 'Make a copy of %0',
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
var title=params.shift();
params=paramString.parseParams('anon',null,true,false,false);
var label =getParam(params,'label',this.label+(title?' '+title:''));
var prompt =getParam(params,'prompt',this.prompt).format([title||this.notitle]);
var b=createTiddlyButton(place,label,prompt,
function(ev){return config.commands.copyTiddler.click(this,ev)});
b.setAttribute('from',title||'');
}
};
//}}}
/***
|Name|CoreTweaks|
|Source|http://www.TiddlyTools.com/#CoreTweaks|
|Version|use with TW2.4.3|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.2.0|
|Type|plugin|
|Requires||
|Overrides|various|
|Description|a small collection of overrides to TW core functions|
This tiddler contains changes TW core functions to provide minor changes in standard features or behavior. It is hoped that some of these tweaks may someday be added into the TW core, so that these adjustments will be available without needing these add-on definitions.
>''Note: the changes contained in this tiddler are generally applicable for version 2.4.3 of TiddlyWiki.''
>Please view [[CoreTweaksArchive]] for tweaks that may be used with earlier versions of TiddlyWiki.
***/
//{{{
// calculate TW version number - used to determine which tweaks should be applied
var ver=version.major+version.minor/10+version.revision/100;
//}}}
/***
----
***/
// // open tickets:
// // {{block{
/***
!!!890 add conditional test to """<<tiddler>>""" macro
***/
// // {{groupbox small{
/***
http://trac.tiddlywiki.org/ticket/890 - OPEN
This tweak extends the {{{<<tiddler>>}}} macro syntax so you can include a javascript-based //test expression// to determine if the tiddler transclusion should be performed:
{{{
<<tiddler TiddlerName if:{{...}} with: param param etc.>>
}}}
If the test is ''true'', then the tiddler is transcluded as usual. If the test is ''false'', then the transclusion is skipped and //no output is produced//.
***/
//{{{
config.macros.tiddler.if_handler = config.macros.tiddler.handler;
config.macros.tiddler.handler = function(place,macroName,params,wikifier,paramString,tiddler)
{
params = paramString.parseParams('name',null,true,false,true);
if (!getParam(params,'if',true)) return;
this.if_handler.apply(this,arguments);
};
//}}}
// // }}}}}}// // {{block{
/***
!!!831 backslash-quoting for embedding newlines in 'line-mode' formats
***/
// // {{groupbox small{
/***
http://trac.tiddlywiki.org/ticket/831 - OPEN
This tweak pre-processes source content to convert 'double-backslash-newline' into {{{<br>}}} before wikify(), so that literal newlines can be embedded in line-mode wiki syntax (e.g., tables, bullets, etc.)
***/
//{{{
window.coreWikify = wikify;
window.wikify = function(source,output,highlightRegExp,tiddler)
{
if (source) arguments[0]=source.replace(/\\\\\n/mg,'<br>');
coreWikify.apply(this,arguments);
}
//}}}
// // }}}}}}// // {{block{
/***
!!!829 """<<tag>>""" macro - sortby parameter
***/
// // {{groupbox small{
/***
http://trac.tiddlywiki.org/ticket/829 - OPEN
This tweak adds an optional 'sortby' parameter to the """<<tag tagname label tip sortby>>""" macro, as well as the """<<allTags excludeTag sortby>>""" macro used to generate the sidebar contents 'tags' list. Specify the field on which the contents of each tag popup is to be sorted, with a '+' or '-' prefix to indicate ascending/descending order, respectively.
Example: """<<tag systemConfig "plugins" "list plugins by date, most recent first" "-modified">>"""
Try it: <<tag systemConfig "plugins" "list plugins by date, most recent first" "-modified">>
Similarly, to change the sort order used by the popups from all tags shown in the sidebar contents, edit the [[TagTags]] shadow tiddler and enter: """<<allTags excludeLists -modified>>"""
***/
//{{{
// hijack tag handler() to add 'sortby' attribute to tag button
config.macros.tag.CoreTweaksSortTags_handler=config.macros.tag.handler;
config.macros.tag.handler = function(place,macroName,params)
{
this.CoreTweaksSortTags_handler.apply(this,arguments);
var btn=place.lastChild;
if (params[3]) btn.setAttribute('sortby',params[3]);
}
// tweak <<allTags>> macro to add 'sortby' attribute to each tag button
var fn=config.macros.allTags.handler;
var lines=fn.toString().split('\n');
lines.splice(lines.length-2,0,['if(params[1]) btn.setAttribute("sortby",params[1]);']);
fn=lines.join('\n');
eval('config.macros.allTags.handler='+fn);
// tweak tag event handler to:
// * use tag filtering (only if '[' is present in tag value)
// * use optional 'sortby' attribute
// * save 'sortby' value in 'open all' command (for displaying tiddlers in sorted order)
var fn=onClickTag;
fn=fn.toString().replace(
/store.getTaggedTiddlers\(tag\);/g,
'(tag.indexOf("[")==-1?store.getTaggedTiddlers(tag):store.filterTiddlers(tag));'
+'var sortby=this.getAttribute("sortby");'
+'if(sortby&&sortby.length) store.sortTiddlers(tagged,sortby);'
);
fn=fn.toString().replace(
/openAll.setAttribute\("tag",\s*tag\);/g,
'openAll.setAttribute("tag",tag); openAll.setAttribute("sortby",sortby);'
);
eval(fn);
// tweak 'open all' event handler to use 'sortby' attribute
var fn=onClickTagOpenAll;
fn=fn.toString().replace(
/story.displayTiddlers\(this,\s*tiddlers\);/g,
'var sortby=this.getAttribute("sortby");'
+'if(sortby&&sortby.length) store.sortTiddlers(tiddlers,sortby);'
+'story.displayTiddlers(this,tiddlers);'
);
eval(fn);
//}}}
// // }}}}}}// // {{block{
/***
!!!824 ~WindowTitle - alternative to combined ~SiteTitle/~SiteSubtitle in window titlebar
***/
// // {{groupbox small{
/***
http://trac.tiddlywiki.org/ticket/824 - OPEN
This tweak allows definition of an optional [[WindowTitle]] tiddler that, when present, provides alternative text for display in the browser window's titlebar, instead of using the combined text content from [[SiteTitle]] and [[SiteSubtitle]] (which will still be displayed as usual in the TiddlyWiki document header area).
Note: this ticket replaces http://trac.tiddlywiki.org/ticket/401 (closed), which proposed using a custom [[PageTitle]] tiddler for this purpose. ''If you were using the previous '401 ~PageTitle' tweak, you will need to rename [[PageTitle]] to [[WindowTitle]] to continue to use your custom window title text''
***/
//{{{
config.shadowTiddlers.WindowTitle='<<tiddler SiteTitle>> - <<tiddler SiteSubtitle>>';
window.getPageTitle=function() { return wikifyPlain('WindowTitle'); }
store.addNotification('WindowTitle',refreshPageTitle); // so title stays in sync with tiddler changes
//}}}
// // }}}}}}// // {{block{
/***
!!!784 allow tiddler sections in TiddlyLinks to be used as anchor points for intra-tiddler scrolling.
>http://trac.tiddlywiki.org/ticket/784 - OPEN - Please see separate [[SectionLinksPlugin]]
!!!683 FireFox3 Import bug: 'browse' button replacement
***/
// // {{groupbox small{
/***
http://trac.tiddlywiki.org/ticket/683 - OPEN
The web standard 'type=file' input control that has been used as a local path/file picker for TiddlyWiki no longer works as expected in FireFox3, which has, for security reasons, limited javascript access to this control so that *no* local filesystem path information can be revealed, even when it is intentional and necessary, as it is with TiddlyWiki. This tweak provides alternative HTML source that patches the backstage import panel. It replaces the 'type=file' input control with a text+button combination of controls that invokes a system-native secure 'file-chooser' dialog box to provide TiddlyWiki with access to a complete path+filename so that TW functions properly locate user-selected local files.
>Note: ''This tweak also requires http://trac.tiddlywiki.org/ticket/604 - cross-platform askForFilename()''
***/
//{{{
if (window.Components) {
var fixhtml='<input name="txtBrowse" style="width:30em"><input type="button" value="..."'
+' onClick="window.browseForFilename(this.previousSibling,true)">';
var cmi=config.macros.importTiddlers;
cmi.step1Html=cmi.step1Html.replace(/<input type='file' size=50 name='txtBrowse'>/,fixhtml);
}
merge(config.messages,{selectFile:'Please enter or select a file'}); // ready for I18N translation
window.browseForFilename=function(target,mustExist) { // note: both params are optional
var msg=config.messages.selectFile;
if (target && target.title) msg=target.title; // use target field tooltip (if any) as dialog prompt text
// get local path for current document
var path=getLocalPath(document.location.href);
var p=path.lastIndexOf('/'); if (p==-1) p=path.lastIndexOf('\\'); // Unix or Windows
if (p!=-1) path=path.substr(0,p+1); // remove filename, leave trailing slash
var file=''
var result=window.askForFilename(msg,path,file,mustExist); // requires #604
if (target && result.length) // set target field and trigger handling
{ target.value=result; target.onchange(); }
return result;
}
//}}}
// // }}}}}}// // {{block{
/***
!!!604 cross-platform askForFilename()
***/
// // {{groupbox small{
/***
http://trac.tiddlywiki.org/ticket/604 - OPEN
invokes a system-native secure 'file-chooser' dialog box to provide TiddlyWiki with access to a complete path+filename so that TW functions properly locate user-selected local files.
***/
//{{{
window.askForFilename=function(msg,path,file,mustExist) {
var r = window.mozAskForFilename(msg,path,file,mustExist);
if(r===null || r===false)
r = window.ieAskForFilename(msg,path,file,mustExist);
if(r===null || r===false)
r = window.javaAskForFilename(msg,path,file,mustExist);
if(r===null || r===false)
r = prompt(msg,path+file);
return r||'';
}
window.mozAskForFilename=function(msg,path,file,mustExist) {
if(!window.Components) return false;
try {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var nsIFilePicker = window.Components.interfaces.nsIFilePicker;
var picker = Components.classes['@mozilla.org/filepicker;1'].createInstance(nsIFilePicker);
picker.init(window, msg, mustExist?nsIFilePicker.modeOpen:nsIFilePicker.modeSave);
var thispath = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
thispath.initWithPath(path);
picker.displayDirectory=thispath;
picker.defaultExtension='html';
picker.defaultString=file;
picker.appendFilters(nsIFilePicker.filterAll|nsIFilePicker.filterText|nsIFilePicker.filterHTML);
if (picker.show()!=nsIFilePicker.returnCancel)
var result=picker.file.persistentDescriptor;
}
catch(ex) { displayMessage(ex.toString()); }
return result;
}
window.ieAskForFilename=function(msg,path,file,mustExist) {
if(!config.browser.isIE) return false;
try {
var s = new ActiveXObject('UserAccounts.CommonDialog');
s.Filter='All files|*.*|Text files|*.txt|HTML files|*.htm;*.html|';
s.FilterIndex=3; // default to HTML files;
s.InitialDir=path;
s.FileName=file;
return s.showOpen()?s.FileName:'';
}
catch(ex) { displayMessage(ex.toString()); }
return result;
}
window.javaAskForFilename=function(msg,path,file,mustExist) {
if(!document.applets['TiddlySaver']) return false;
// TBD: implement java-based askFile(...) function
try { return document.applets['TiddlySaver'].askFile(msg,path,file,mustExist); }
catch(ex) { displayMessage(ex.toString()); }
}
//}}}
// // }}}}}}// // {{block{
/***
!!!657 wrap tabs onto multiple lines
***/
// // {{groupbox small{
/***
http://trac.tiddlywiki.org/ticket/657 - OPEN
This tweak inserts an extra space element following each tab, allowing them to wrap onto multiple lines if needed.
***/
//{{{
config.macros.tabs.handler = function(place,macroName,params)
{
var cookie = params[0];
var numTabs = (params.length-1)/3;
var wrapper = createTiddlyElement(null,'div',null,'tabsetWrapper ' + cookie);
var tabset = createTiddlyElement(wrapper,'div',null,'tabset');
tabset.setAttribute('cookie',cookie);
var validTab = false;
for(var t=0; t<numTabs; t++) {
var label = params[t*3+1];
var prompt = params[t*3+2];
var content = params[t*3+3];
var tab = createTiddlyButton(tabset,label,prompt,this.onClickTab,'tab tabUnselected');
createTiddlyElement(tab,'span',null,null,' ',{style:'font-size:0pt;line-height:0px'}); // ELS
tab.setAttribute('tab',label);
tab.setAttribute('content',content);
tab.title = prompt;
if(config.options[cookie] == label)
validTab = true;
}
if(!validTab)
config.options[cookie] = params[1];
place.appendChild(wrapper);
this.switchTab(tabset,config.options[cookie]);
};
//}}}
// // }}}}}}// // {{block{
/***
!!!628 hide 'no such macro' errors
***/
// // {{groupbox small{
/***
http://trac.tiddlywiki.org/ticket/628 - OPEN
When invoking a macro that is not defined, this tweak prevents the display of the 'error in macro... no such macro' message. This is useful when rendering tiddler content or templates that reference macros that are defined by //optional// plugins that have not been installed in the current document.
<<option chkHideMissingMacros>> hide 'no such macro' error messages
***/
//{{{
if (config.options.chkHideMissingMacros===undefined)
config.options.chkHideMissingMacros=false;
window.coreTweaks_missingMacro_invokeMacro = window.invokeMacro;
window.invokeMacro = function(place,macro,params,wikifier,tiddler) {
if (!config.macros[macro] || !config.macros[macro].handler)
if (config.options.chkHideMissingMacros) return;
window.coreTweaks_missingMacro_invokeMacro.apply(this,arguments);
}
//}}}
// // }}}}}}// // {{block{
/***
!!!608/609/610 toolbars - toggles, separators and transclusion
***/
// // {{groupbox small{
/***
http://trac.tiddlywiki.org/ticket/608 - OPEN (more/less toggle)
http://trac.tiddlywiki.org/ticket/609 - OPEN (separators)
http://trac.tiddlywiki.org/ticket/610 - OPEN (wikify tiddler/slice/section content)
This combination tweak extends the """<<toolbar>>""" macro to add use of '<' to insert a 'less' menu command (the opposite of '>' == 'more'), as well as use of '*' to insert linebreaks and "!" to insert a vertical line separator between toolbar items. In addition, this tweak add the ability to use references to tiddlernames, slices, or sections and render their content inline within the toolbar, allowing easy creation of new toolbar commands using TW content (such as macros, links, inline scripts, etc.)
To produce a one-line style, with "less" at the end, use
| ViewToolbar| foo bar baz > yabba dabba doo < |
resulting in:
{{{
foo bar baz more
and
foo bar baz yabba dabba doo less
}}}
or to use the CoreTweaks? two-line style:
| ViewToolbar| foo bar baz > < * yabba dabba doo |
which would produce:
{{{
foo bar baz more
and
foo bar baz less
yabba dabba doo
}}}
''see [[ToolbarCommands]] for examples of how these features can be used''
***/
//{{{
merge(config.macros.toolbar,{
moreLabel: 'more\u25BC',
morePrompt: 'Show additional commands',
lessLabel: '\u25C4less',
lessPrompt: 'Hide additional commands',
separator: '|'
});
config.macros.toolbar.onClickMore = function(ev) {
var e = this.nextSibling;
e.style.display = 'inline'; // show menu
this.style.display = 'none'; // hide button
return false;
};
config.macros.toolbar.onClickLess = function(ev) {
var e = this.parentNode;
var m = e.previousSibling;
e.style.display = 'none'; // hide menu
m.style.display = 'inline'; // show button
return false;
};
config.macros.toolbar.handler = function(place,macroName,params,wikifier,paramString,tiddler) {
for(var t=0; t<params.length; t++) {
var c = params[t];
switch(c) {
case '!': // ELS - SEPARATOR (added)
createTiddlyText(place,this.separator);
break;
case '*': // ELS - LINEBREAK (added)
createTiddlyElement(place,'BR');
break;
case '<': // ELS - LESS COMMAND (added)
var btn = createTiddlyButton(place,
this.lessLabel,this.lessPrompt,config.macros.toolbar.onClickLess,'moreCommand');
break;
case '>':
var btn = createTiddlyButton(place,
this.moreLabel,this.morePrompt,config.macros.toolbar.onClickMore,'moreCommand');
var e = createTiddlyElement(place,'span',null,'moreCommand');
e.style.display = 'none';
place = e;
break;
default:
var theClass = '';
switch(c.substr(0,1)) {
case '+':
theClass = 'defaultCommand';
c = c.substr(1);
break;
case '-':
theClass = 'cancelCommand';
c = c.substr(1);
break;
}
if(c in config.commands)
this.createCommand(place,c,tiddler,theClass);
else { // ELS - WIKIFY TIDDLER/SLICE/SECTION (added)
if (c.substr(0,1)=='~') c=c.substr(1); // ignore leading ~
var txt=store.getTiddlerText(c);
if (txt) {
// trim any leading/trailing newlines
txt=txt.replace(/^\n*/,'').replace(/\n*$/,'');
// trim PRE format wrapper if any
txt=txt.replace(/^\{\{\{\n/,'').replace(/\n\}\}\}$/,'');
// render content into toolbar
wikify(txt,createTiddlyElement(place,'span'),null,tiddler);
}
} // ELS - end WIKIFY CONTENT
break;
}
}
};
//}}}
// // }}}}}}// // {{block{
/***
!!!529 IE fixup - case-sensitive element lookup of tiddler elements
***/
// // {{groupbox small{
/***
http://trac.tiddlywiki.org/ticket/529 - OPEN
This tweak hijacks the standard browser function, document.getElementById(), to work-around the case-INsensitivity error in Internet Explorer (all versions up to and including IE7) //''Note: This tweak is only applied when using IE, and only for lookups of rendered tiddler elements within the containing 'tiddlerDisplay' element.''//
***/
//{{{
if (config.browser.isIE) {
document.coreTweaks_coreGetElementById=document.getElementById;
document.getElementById=function(id) {
var e=document.coreTweaks_coreGetElementById(id);
if (!e || !e.parentNode || e.parentNode.id!='tiddlerDisplay') return e;
for (var i=0; i<e.parentNode.childNodes.length; i++)
if (id==e.parentNode.childNodes[i].id) return e.parentNode.childNodes[i];
return null;
};
}
//}}}
// // }}}}}}// // {{block{
/***
!!!471 'creator' field for new tiddlers
***/
// // {{groupbox small{
/***
http://trac.tiddlywiki.org/ticket/471 - OPEN
This tweak HIJACKS the core's saveTiddler() function to automatically add a 'creator' field to a tiddler when it is FIRST created. You can use """<<view creator>>""" (or """<<view creator wikified>>""" if you prefer) to show this value embedded directly within the tiddler content, or {{{<span macro="view creator"></span>}}} in the ViewTemplate and/or EditTemplate to display the creator value in each tiddler.
***/
//{{{
// hijack saveTiddler()
TiddlyWiki.prototype.CoreTweaks_creatorSaveTiddler=TiddlyWiki.prototype.saveTiddler;
TiddlyWiki.prototype.saveTiddler=function(title,newTitle,newBody,modifier,modified,tags,fields)
{
var existing=store.tiddlerExists(title);
var tiddler=this.CoreTweaks_creatorSaveTiddler.apply(this,arguments);
if (!existing) store.setValue(title,'creator',config.options.txtUserName);
return tiddler;
}
//}}}
// // }}}}}}
// // closed: won't fix //(leave as core tweaks)//
// // {{block{
/***
!!!637 TiddlyLink tooltip - custom formatting
***/
// // {{groupbox small{
/***
http://trac.tiddlywiki.org/ticket/637 - CLOSED: WON'T FIX
This tweak modifies the tooltip format that appears when you mouseover a link to a tiddler. It adds an option to control the date format, as well as displaying the size of the tiddler (in bytes)
Tiddler link tooltip format:
{{stretch{<<option txtTiddlerLinkTootip>>}}}
^^where: %0=title, %1=username, %2=modification date, %3=size in bytes, %4=description slice^^
Tiddler link tooltip date format:
{{stretch{<<option txtTiddlerLinkTooltipDate>>}}}
***/
//{{{
config.messages.tiddlerLinkTooltip='%0 - %1, %2 (%3 bytes) - %4';
config.messages.tiddlerLinkTooltipDate='DDD, MMM DDth YYYY 0hh12:0mm AM';
config.options.txtTiddlerLinkTootip=
config.options.txtTiddlerLinkTootip||config.messages.tiddlerLinkTooltip;
config.options.txtTiddlerLinkTooltipDate=
config.options.txtTiddlerLinkTooltipDate||config.messages.tiddlerLinkTooltipDate;
Tiddler.prototype.getSubtitle = function() {
var modifier = this.modifier;
if(!modifier) modifier = config.messages.subtitleUnknown;
var modified = this.modified;
if(modified) modified = modified.formatString(config.options.txtTiddlerLinkTooltipDate);
else modified = config.messages.subtitleUnknown;
var descr=store.getTiddlerSlice(this.title,'Description')||'';
return config.options.txtTiddlerLinkTootip.format([this.title,modifier,modified,this.text.length,descr]);
};
//}}}
// // }}}}}}// // {{block{
/***
!!!607 add HREF link on permaview command
***/
// // {{groupbox small{
/***
http://trac.tiddlywiki.org/ticket/607 - CLOSED: WON'T FIX
This tweak automatically sets the HREF for the 'permaview' sidebar command link so you can use the 'right click' context menu for faster, easier bookmarking. Note that this does ''not'' automatically set the permaview in the browser's current location URL... it just sets the HREF on the command link. You still have to click the link to apply the permaview.
***/
//{{{
config.macros.permaview.handler = function(place)
{
var btn=createTiddlyButton(place,this.label,this.prompt,this.onClick);
addEvent(btn,'mouseover',this.setHREF);
addEvent(btn,'focus',this.setHREF);
};
config.macros.permaview.setHREF = function(event){
var links = [];
story.forEachTiddler(function(title,element) {
links.push(String.encodeTiddlyLink(title));
});
var newURL=document.location.href;
var hashPos=newURL.indexOf('#');
if (hashPos!=-1) newURL=newURL.substr(0,hashPos);
this.href=newURL+'#'+encodeURIComponent(links.join(' '));
}
//}}}
// // }}}}}}// // {{block{
/***
!!!458 add permalink-like HREFs on internal TiddlyLinks
***/
// // {{groupbox small{
/***
http://trac.tiddlywiki.org/ticket/458 - CLOSED: WON'T FIX
This tweak assigns a permalink-like HREF to internal Tiddler links (which normally do not have any HREF defined). This permits the link's context menu (right-click) to include 'open link in another window/tab' command. Based on a request from Dustin Spicuzza.
***/
//{{{
window.coreTweaks_createTiddlyLink=window.createTiddlyLink;
window.createTiddlyLink=function(place,title,includeText,theClass,isStatic,linkedFromTiddler,noToggle)
{
// create the core button, then add the HREF (to internal links only)
var link=window.coreTweaks_createTiddlyLink.apply(this,arguments);
if (!isStatic)
link.href=document.location.href.split('#')[0]+'#'+encodeURIComponent(String.encodeTiddlyLink(title));
return link;
}
//}}}
// // }}}}}}
// // <<foldHeadings>>
''What are the benefits of migrating from a spreadsheet to a database?''
* Flexibility for selecting and sorting data
* Use of forms
** Faster data entry
** Data validation
* Formatted reports
* Faster data entry
* Effective data storage
** No redundancy
** Multi-user
** Smaller disk file storage and retrieval
----
* If your spreadsheet is handling a lot of text fields or a lot of T/F values, that is a clue.
* A wide spreadsheet becomes impossible to navigate
HelloThere
[[Firefox_HiddenSettings]]
[[VBA_GetSizeDB]]
TiddlyWiki FireFox TiddlyTools TiddlyTech HowTo $1
DejaVu San-Serif HTML5
/***
|Name|DisableWikiLinksPlugin|
|Source|http://www.TiddlyTools.com/#DisableWikiLinksPlugin|
|Version|1.6.0|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Description|selectively disable TiddlyWiki's automatic ~WikiWord linking behavior|
This plugin allows you to disable TiddlyWiki's automatic ~WikiWord linking behavior, so that WikiWords embedded in tiddler content will be rendered as regular text, instead of being automatically converted to tiddler links. To create a tiddler link when automatic linking is disabled, you must enclose the link text within {{{[[...]]}}}.
!!!!!Usage
<<<
You can block automatic WikiWord linking behavior for any specific tiddler by ''tagging it with<<tag excludeWikiWords>>'' (see configuration below) or, check a plugin option to disable automatic WikiWord links to non-existing tiddler titles, while still linking WikiWords that correspond to existing tiddlers titles or shadow tiddler titles. You can also block specific selected WikiWords from being automatically linked by listing them in [[DisableWikiLinksList]] (see configuration below), separated by whitespace. This tiddler is optional and, when present, causes the listed words to always be excluded, even if automatic linking of other WikiWords is being permitted.
Note: WikiWords contained in default ''shadow'' tiddlers will be automatically linked unless you select an additional checkbox option lets you disable these automatic links as well, though this is not recommended, since it can make it more difficult to access some TiddlyWiki standard default content (such as AdvancedOptions or SideBarTabs)
<<<
!!!!!Configuration
<<<
<<option chkDisableWikiLinks>> Disable ALL automatic WikiWord tiddler links
<<option chkAllowLinksFromShadowTiddlers>> ... except for WikiWords //contained in// shadow tiddlers
<<option chkDisableNonExistingWikiLinks>> Disable automatic WikiWord links for non-existing tiddlers
Disable automatic WikiWord links for words listed in: <<option txtDisableWikiLinksList>>
Disable automatic WikiWord links for tiddlers tagged with: <<option txtDisableWikiLinksTag>>
<<<
!!!!!Code
***/
//{{{
version.extensions.DisableWikiLinksPlugin= {major: 1, minor: 6, revision: 0, date: new Date(2008,7,22)};
if (config.options.chkDisableNonExistingWikiLinks==undefined) config.options.chkDisableNonExistingWikiLinks= false;
if (config.options.chkDisableWikiLinks==undefined) config.options.chkDisableWikiLinks=false;
if (config.options.txtDisableWikiLinksList==undefined) config.options.txtDisableWikiLinksList="DisableWikiLinksList";
if (config.options.chkAllowLinksFromShadowTiddlers==undefined) config.options.chkAllowLinksFromShadowTiddlers=true;
if (config.options.txtDisableWikiLinksTag==undefined) config.options.txtDisableWikiLinksTag="excludeWikiWords";
// find the formatter for wikiLink and replace handler with 'pass-thru' rendering
initDisableWikiLinksFormatter();
function initDisableWikiLinksFormatter() {
for (var i=0; i<config.formatters.length && config.formatters[i].name!="wikiLink"; i++);
config.formatters[i].coreHandler=config.formatters[i].handler;
config.formatters[i].handler=function(w) {
// supress any leading "~" (if present)
var skip=(w.matchText.substr(0,1)==config.textPrimitives.unWikiLink)?1:0;
var title=w.matchText.substr(skip);
var exists=store.tiddlerExists(title);
var inShadow=w.tiddler && store.isShadowTiddler(w.tiddler.title);
// check for excluded Tiddler
if (w.tiddler && w.tiddler.isTagged(config.options.txtDisableWikiLinksTag))
{ w.outputText(w.output,w.matchStart+skip,w.nextMatch); return; }
// check for specific excluded wiki words
var t=store.getTiddlerText(config.options.txtDisableWikiLinksList);
if (t && t.length && t.indexOf(w.matchText)!=-1)
{ w.outputText(w.output,w.matchStart+skip,w.nextMatch); return; }
// if not disabling links from shadows (default setting)
if (config.options.chkAllowLinksFromShadowTiddlers && inShadow)
return this.coreHandler(w);
// check for non-existing non-shadow tiddler
if (config.options.chkDisableNonExistingWikiLinks && !exists)
{ w.outputText(w.output,w.matchStart+skip,w.nextMatch); return; }
// if not enabled, just do standard WikiWord link formatting
if (!config.options.chkDisableWikiLinks)
return this.coreHandler(w);
// just return text without linking
w.outputText(w.output,w.matchStart+skip,w.nextMatch)
}
}
Tiddler.prototype.coreAutoLinkWikiWords = Tiddler.prototype.autoLinkWikiWords;
Tiddler.prototype.autoLinkWikiWords = function()
{
// if all automatic links are not disabled, just return results from core function
if (!config.options.chkDisableWikiLinks)
return this.coreAutoLinkWikiWords.apply(this,arguments);
return false;
}
Tiddler.prototype.disableWikiLinks_changed = Tiddler.prototype.changed;
Tiddler.prototype.changed = function()
{
this.disableWikiLinks_changed.apply(this,arguments);
// remove excluded wiki words from links array
var t=store.getTiddlerText(config.options.txtDisableWikiLinksList,"").readBracketedList();
if (t.length) for (var i=0; i<t.length; i++)
if (this.links.contains(t[i]))
this.links.splice(this.links.indexOf(t[i]),1);
};
//}}}
[[GettingStarted]]
[[AdvancedOptions]]
[[cookieJar]]
----
<<tiddler ShowPopup with:
DocumentSetup##cookies ~CookieManager "view/modify option cookie settings" tiddlyLinkExisting auto sticky>>
<<tiddler ShowPopup with:
DocumentSetup##tweaker ~TiddlerTweaker "view/modify tiddler values" tiddlyLinkExisting auto sticky>>
----
<<tiddler ShowPopup with:
DocumentSetup##templates templates "list templates" tiddlyLinkExisting auto>>
<<tiddler ShowPopup with:
DocumentSetup##stylesheets stylesheets "list stylesheets" tiddlyLinkExisting auto>>
<<tiddler ShowPopup with:
DocumentSetup##menus menus "list menus" tiddlyLinkExisting auto>>/%
!cookies
{{center{
[[Browser cookies:|CookieManagerPlugin]] {{fine{<<option chkAllowBrowserCookies>>enable <<option chkMonitorBrowserCookies>>monitor}}}
{{fine{
----
{{smallform small{<<cookieManager>>}}}
}}}
!tweaker
{{smallform{
<<tiddlerTweaker>>}}}
!templates
<<matchTags "%0" "<br>" sort:title template>>
!stylesheets
<<matchTags "%0" "<br>" sort:title stylesheet>>
!menus
<<matchTags "%0" "<br>" sort:title menu>>
!end
%/
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='editor' macro='edit title'></div>
<div macro='annotations'></div>
<div macro='tiddler QuickEditToolbar with: show'></div>
<div class='editor' macro='edit text'></div>
<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser excludeLists'></span></div>
<!--}}}--><span macro='resizeEditor'></span>
/%
|Name|ExpandSlidersScript|
|Source|http://www.TiddlyTools.com/#ExpandSlidersScript|
|Version|1.1.0|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|script|
|Requires|InlineJavascriptPlugin NestedSlidersPlugin (optional)|
|Overrides||
|Description|simulateously expand/collapse all nested sliders in a tiddler (or ID'd DOM element)|
Usage:
<<tiddler ExpandSlidersScript with: elementID expandlabel collapselabel>>
Where elementID is one of:
"" = the current tiddler
here = the current container
ID = specific DOM element ID (e.g., "mainMenu")
%/<script label="expand" title="expand/collapse sliders">
var here=story.findContainingTiddler(place)||place.parentNode.parentNode; // tiddler or container
if ('$1'!='$'+'1' && '$1'.length) {
if ('$1'=='here') here=place.parentNode.parentNode; // container
else here=document.getElementById('$1'); // ID
}
if (!here) return false;
var expandlabel='expand'; if ('$2'!='$'+'2') var expandlabel='$2';
var collapselabel='collapse'; if ('$3'!='$'+'3') var collapselabel='$3';
var elems=here.getElementsByTagName('*');
var state=(place.innerHTML.toLowerCase()==expandlabel)?'none':'block';
for (var e=0; e<elems.length; e++) { var p=elems[e];
if (p.className!='sliderPanel' || p.style.display!=state) continue;
if (p.button) window.onClickNestedSlider({target:p.button});
else p.previousSibling.onclick();
}
place.innerHTML=state=='none'?collapselabel:expandlabel;
return false;
</script><script>
place.lastChild.style.fontWeight='normal';
var expandlabel='expand'; if ('$2'!='$'+'2') var expandlabel='$2';
var collapselabel='collapse'; if ('$3'!='$'+'3') var collapselabel='$3';
var currlabel=place.lastChild.innerHTML.toLowerCase();
place.lastChild.innerHTML=expandlabel;
</script>
/***
|FileDropPlugin|h
|author : BradleyMeck|
|version : 0.1.1|
|date : Nov 13 2006|
|usage : drag a file onto the TW to have it be made into a tiddler|
|browser(s) supported : Mozilla|
Note: this version has been 'tweaked' by Eric Shulman (http://www.TiddlyTools.com) to add suspend/resume notification handling to improve performance when multiple files are dropped at once.
!Trouble Shooting
*If the plugin does not seem to work, open up the page "about:config" (just type it in the address bar) and make sure @@color(blue):signed.applets.codebase_principal_support@@ is set to @@color(blue):true@@
!Revisions
*Multiple File Dropping API updated, to end all capturing events after yours return a value that makes if(myFunctionsReturnValue) evaluate to true
*Added support for multiple file drop handlers
**Use the config.macros.fileDrop.addEventListener(@@color(green):String Flavor@@, @@color(green):Function handler(nsiFile){}@@, @@color(green):Boolean addToFront@@) function
***Standard Flavor is "application/x-moz-file"
***addToFront gives your handler priority over all others at time of add
*Old plugin would disallow drops of text vetween applications because it didn't check if the transfer was a file.
!Example Handler
*Adds simple file import control, add this to a tiddler tagged {{{systemConfig}}} to make file dropping work
{{{
config.macros.fileDrop.addEventListener("application/x-moz-file",function(nsiFile)
{
if(
confirm("You have dropped the file \""+nsiFile.path+"\" onto the page, it will be imported as a tiddler. Is that ok?")
)
{
var newDate = new Date();
var title = prompt("what would you like to name the tiddler?");
store.saveTiddler(title,title,loadFile(nsiFile.path),config.options.txtUserName,newDate,[]);
}
return true;
})
}}}
!Example Handler without popups and opening the tiddler on load
*Adds simple file import control, add this to a tiddler tagged {{{systemConfig}}} to make file dropping work
{{{
config.macros.fileDrop.addEventListener("application/x-moz-file",function(nsiFile)
{
var newDate = new Date();
store.saveTiddler(nsiFile.path,nsiFile.path,loadFile(nsiFile.path),config.options.txtUserName,newDate,[]);
story.displayTiddler(null,nsiFile.path)
return true;
})
}}}
!Code
***/
//{{{
config.macros.fileDrop = {version : {major : 0, minor : 0, revision: 1}};
config.macros.fileDrop.customDropHandlers = [];
config.macros.fileDrop.dragDropHandler = function(evt) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
// Load in the native DragService manager from the browser.
var dragService = Components.classes["@mozilla.org/widget/dragservice;1"].getService(Components.interfaces.nsIDragService);
// Load in the currently-executing Drag/drop session.
var dragSession = dragService.getCurrentSession();
// Create an instance of an nsITransferable object using reflection.
var transferObject = Components.classes["@mozilla.org/widget/transferable;1"].createInstance();
// Bind the object explicitly to the nsITransferable interface. We need to do this to ensure that
// methods and properties are present and work as expected later on.
transferObject = transferObject.QueryInterface(Components.interfaces.nsITransferable);
// I've chosen to add only the x-moz-file MIME type. Any type can be added, and the data for that format
// will be retrieved from the Drag/drop service.
transferObject.addDataFlavor("application/x-moz-file");
// Get the number of items currently being dropped in this drag/drop operation.
var numItems = dragSession.numDropItems;
// ELS 2007.12.03: performance improvement when dropping multiple files
if (numItems>1) {
clearMessage();
displayMessage("Reading "+numItems+" files...");
store.suspendNotifications();
}
for (var i = 0; i < numItems; i++)
{
// Get the data for the given drag item from the drag session into our prepared
// Transfer object.
dragSession.getData(transferObject, i);
// We need to pass in Javascript 'Object's to any XPConnect method which
// requires OUT parameters. The out value will then be saved as a new
// property called Object.value.
var dataObj = {};
var dropSizeObj = {};
for(var ind = 0; ind < config.macros.fileDrop.customDropHandlers.length; ind++)
{
var item = config.macros.fileDrop.customDropHandlers[ind];
if(dragSession.isDataFlavorSupported(item.flavor))
{
transferObject.getTransferData(item.flavor, dataObj, dropSizeObj);
var droppedFile = dataObj.value.QueryInterface(Components.interfaces.nsIFile);
// Display all of the returned parameters with an Alert dialog.
var result = item.handler.call(item,droppedFile);
// Since the event is handled, prevent it from going to a higher-level event handler.
evt.stopPropagation();
evt.preventDefault();
if(result){break;}
}
}
}
// ELS 2007.12.03: performance improvement and feedback after dropping multiple files
if (numItems>1) {
store.resumeNotifications();
store.notifyAll();
displayMessage(numItems+" files have been processed");
}
}
if(!window.event)
{
// Register the event handler, and set the 'capture' flag to true so we get this event
// before it bubbles up through the browser.
window.addEventListener("dragdrop", config.macros.fileDrop.dragDropHandler , true);
}
config.macros.fileDrop.addEventListener = function(paramflavor,func,inFront)
{
var obj = {};
obj.flavor = paramflavor;
obj.handler = func;
if(!inFront)
{config.macros.fileDrop.customDropHandlers.push(obj);}
else{config.macros.fileDrop.customDropHandlers.shift(obj);}
}
//}}}
/***
|Name|FileDropPluginConfig|
|Source|http://www.TiddlyTools.com/#FileDropPluginConfig|
|Version|1.5.1|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires|FileDropPlugin, AttachFilePlugin|
|Overrides||
|Options|##Configuration|
|Description|Adds drag-and-drop handlers for creating binary attachments or directory lists|
__TiddlyTools FileDrop+AttachFile extended handler:__
* use just filename instead of whole path as tiddler title
* check for existing tiddler and prompt for new name
* handle folder drops (drops each file or creates a file list in a tiddler)
* use AttachFilePlugin if MIME type is not text/plain
* autotag created tiddlers (e.g., "temporary", "dropped", etc.)
* option to suppress automatic display of newly created tiddlers
* suspend/resume notifications when handling multiple files (performance improvement)
!!!!!Configuration
<<<
<<option chkFileDropTrimFilename>> Omit file extensions from tiddler titles when creating new tiddlers
{{{usage: <<option chkFileDropTrimFilename>> }}}
<<option chkFileDropDisplay>> Automatically display newly created tiddlers
{{{usage: <<option chkFileDropDisplay>> }}}
Tag newly created tiddlers with: <<option txtFileDropTags>>
{{{usage: <<option txtFileDropTags>>}}}
__FileDrop+AttachFile configuration options:__
<<option chkFileDropAttachLocalLink>> Include reference to local path/filename
{{{usage: <<option chkFileDropAttachLocalLink>> }}}
<<option chkFileDropAttachEncodeData>> Include binary file data as encoded "base64" text
{{{usage: <<option chkFileDropAttachEncodeData>> }}}
...only if file is smaller than: <<option txtFileDropAttachDataLimit>> bytes
{{{usage: <<option txtFileDropAttachDataLimit>>}}}
See [[FileDropPlugin]] for more documentation on handler implementation specifics, including sample code for default drop handlers.
<<<
!!!!!Revisions
<<<
2008.08.11 [1.5.1] added chkFileDropAttachLocalLink option to allow suppression of local path/file link
2007.01.01 [0.9.9] initial release with extensions for AttachFilePlugin
<<<
!!!!!Code
***/
//{{{
if (config.options.chkFileDropAttachEncodeData==undefined)
config.options.chkFileDropAttachEncodeData=true;
if (config.options.chkFileDropAttachLocalLink==undefined)
config.options.chkFileDropAttachLocalLink=true;
if (config.options.txtFileDropAttachDataLimit==undefined)
config.options.txtFileDropAttachDataLimit=32768;
if (config.options.txtFileDropTags==undefined)
config.options.txtFileDropTags="";
if (config.options.chkFileDropDisplay==undefined)
config.options.chkFileDropDisplay=true;
if (config.options.chkFileDropTrimFilename==undefined)
config.options.chkFileDropTrimFilename=false;
config.macros.fileDrop.addEventListener("application/x-moz-file",function(nsiFile)
{
var header="Index of %0\n^^(as of %1)^^\n|!filename| !size | !modified |\n";
var item="|[[%0|%1]]| %2|%3|\n";
var footer="Total of %0 bytes in %1 files\n";
var now=new Date();
var files=[nsiFile];
if (nsiFile.isDirectory()) {
var folder=nsiFile.directoryEntries;
var files=[];
while (folder.hasMoreElements()) {
var f=folder.getNext().QueryInterface(Components.interfaces.nsILocalFile);
if (f instanceof Components.interfaces.nsILocalFile && !f.isDirectory()) files.push(f);
}
var msg=nsiFile.path.replace(/\\/g,"/")+"\n\n";
msg+="contains "+files.length+" files... ";
msg+="select OK to attach all files or CANCEL to create a list...";
if (!confirm(msg)) { // create a list in a tiddler
var title=nsiFile.leafName; // tiddler name is last directory name in path
while (title && title.length && store.tiddlerExists(title)) {
if (confirm(config.messages.overwriteWarning.format([title]))) break; // use existing title
title=prompt("Please enter a different tiddler title for this file",nsiFile.path.replace(/\\/g,"/"));
}
if (!title || !title.length) return true; // aborted by user... we're done!
var text=header.format([nsiFile.path.replace(/\\/g,"/"),now.toLocaleString()]);
var total=0;
for (var i=0; i<files.length; i++) { var f=files[i];
var name=f.leafName;
if (config.options.chkFileDropTrimFilename)
{ var p=name.split("."); if (p.length>1) p.pop(); name=p.join("."); }
var path="file:///"+f.path.replace(/\\/g,"/");
var size=f.fileSize; total+=size;
var when=new Date(f.lastModifiedTime).formatString("YYYY.0MM.0DD 0hh:0mm:0ss");
text+=item.format([name,path,size,when]);
}
text+=footer.format([total,files.length]);
var newtags=config.options.txtFileDropTags?config.options.txtFileDropTags.readBracketedList():[];
store.saveTiddler(null,title,text,config.options.txtUserName,now,newtags);
if (config.options.chkFileDropDisplay) story.displayTiddler(null,title);
return true;
}
}
if (files.length>1) store.suspendNotifications();
for (i=0; i<files.length; i++) {
var file=files[i];
if (file.isDirectory()) continue; // skip over nested directories
var type="text/plain";
var title=file.leafName; // tiddler name is file name
if (config.options.chkFileDropTrimFilename)
{ var p=title.split("."); if (p.length>1) p.pop(); title=p.join("."); }
var path=file.path;
var size=file.fileSize;
while (title && title.length && store.tiddlerExists(title)) {
if (confirm(config.messages.overwriteWarning.format([title]))) break; // use existing title
title=prompt("Please enter a different tiddler title for this file",path.replace(/\\/g,"/"));
}
if (!title || !title.length) continue; // cancelled by user... skip this file
if (config.macros.attach) {
type=config.macros.attach.getMIMEType(file.leafName,"");
if (!type.length)
type=prompt("Unrecognized file type. Please enter a MIME type for this file","text/plain");
if (!type||!type.length) continue; // cancelled by user... skip this file
}
var newtags=config.options.txtFileDropTags?config.options.txtFileDropTags.readBracketedList():[];
if (type=="text/plain")
store.saveTiddler(null,title,loadFile(path),config.options.txtUserName,now,newtags);
else {
// only encode data if enabled and file is smaller than limit. Default is 32768 (32K) bytes.
var embed=config.options.chkFileDropAttachEncodeData
&& file.fileSize<config.options.txtFileDropAttachDataLimit;
newtags.push("attachment"); newtags.push("excludeMissing");
var localfile="";
if (config.options.chkFileDropAttachLocalLink) {
// if file is in current document folder,
// remove path prefix and use relative reference
var localfile=path;
var h=document.location.href;
folder=getLocalPath(decodeURIComponent(h.substr(0,h.lastIndexOf("/")+1)));
if (localfile.substr(0,folder.length)==folder)
localfile='./'+localfile.substr(folder.length);
}
config.macros.attach.createAttachmentTiddler(path,
now.formatString(config.macros.timeline.dateFormat),
"attached by FileDropPlugin", newtags,
title, embed, config.options.chkFileDropAttachLocalLink, false,
localfile, "", type,!config.options.chkFileDropDisplay);
}
if (config.options.chkFileDropDisplay) story.displayTiddler(null,title);
}
if (files.length>1) { store.resumeNotifications(); store.notifyAll(); }
if (window.FFDEBUG) console.log(new Date()-now);
return true;
})
//}}}
* ~NoScript
** Use export/import to upload all settings
* ~XMarks
## Run ~XMarks synch to restore bookmarks
## Under ~XMarks preferences:
### take off 'enable automatic synch'
### don't use 'remember passwords' or 'master password'
* Web Developer
* ~ColorfulTabs
* [[Aardvark|http://karmatics.com/aardvark]]
* --Ubuntu--
* --New Tab King--
* --~FireFTP-- (hope replace w/ Gnome Commander)
* --HTML Validator--
*Set home page
*[[Firefox_HiddenSettings]]
*May need to download, install javaws
{{{
cd Downloads
sudo chmod a+x jre-*
ls -l
sudo ./jre-6u20-linux-i586.bin
}}}
* Under Preferences:
** Security: Select 'Never' for remember passwords; don't use master password.
** Applications: mailto: Gmail (hope this works well!)
** Applications:
*** java: sun-java6... (Not sure; isn't my current setting, and all is working very well)
*** mailto: 'Use Gmail'
** Content:
| | Windows | Ubuntu |
|Default |Calibri 14 |Ubuntu 12 |
|Propor |Serif |Serif 12 |
|Serif |Palatino Linotype |Ubuntu |
|San-Serif |Calibri |DejaVu Sans |
|Monospace |Consolas |DejaVu Sans Mono 12 |
*** Min. font size: 12
*** Allow pages their own font and size: Yes
* Search Engines
** Blue letter Bible
** Snappywords
*[[Firefox_AddIn_Faves]]
# Type "about:config" into the address bar and hit return.
# Go on past the warning. It's for other people with less courage than us.
# Optimize Firefox for bigger bandwidths. Search on {{{pipelining}}} and make these changes:
## {{{network.http.pipelining}}} = true (double-click on the value)
## {{{network.http.pipelining.maxrequests}}} to 30
## {{{network.http.pipelining.ssl}}} = true (why not?)
## {{{network.http.proxy.pipelining}}} = true
# Various
## {{{network.http.max-connections}}} = 96
## {{{network.http.max-connections-per-server}}} = 32
## {{{security.dialog_enable_delay}}} = 0 (silly delay for add-in OR TiddlyWiki save confirmation)
## {{{browser.search.openintab}}} = true (new tab for searches)
## Right-click > New > Integer > {{{nglayout.initialpaint.delay}}} //0 (zero)//. This value is the amount of time the browser waits before it acts on information it receives.
## Right-click > New > boolean> {{{signed.applets.codebase_principal_support}}} //True//. Enables Blue Letter Bible clipboard.
* {{{ctrl-F5}}} Refresh and clear the buffer
* {{{F5}}} Find again
* {{{Shift+F5}}} Find previous
* {{{Ctrl + PgUp}}} Next Tab
* {{{Ctrl + PgDown}}} Previous Tab
This will give you the second column data of a combo box
{{{Me!cboCustomer.Column(1)}}}
You can also have the record you want pre-selected when form is opened. ~ToDo stub.
* Access 2003 VBA p224 for goodness of Load
* [[VBA_Forms_PassingVariables]]
{{{strTabName = tabBOM_Detail.Pages(tabBOM_Detail.Value).Name}}}
{{{Me.Section(acFooter).Visible = Not Me.Section(acFooter).Visible }}}
''Wish:'' Window borders would change according to the app. Kind of like the Colorful Tabs add-in. Any iconic representations of the window (task bar button, workspace switcher) would show the color.
/***
|Name|GotoPlugin|
|Source|http://www.TiddlyTools.com/#GotoPlugin|
|Documentation|http://www.TiddlyTools.com/#GotoPluginInfo|
|Version|1.9.2|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Description|view any tiddler by entering it's title - displays list of possible matches|
''View a tiddler by typing its title and pressing //enter//.'' As you type, a list of possible matches is displayed. You can scroll-and-click (or use arrows+enter) to select/view a tiddler, or press escape to close the listbox to resume typing. When the listbox is not displayed, pressing //escape// clears the current input.
!!!Documentation
>see [[GotoPluginInfo]]
!!!Configuration
<<<
*Match titles only after {{twochar{<<option txtIncrementalSearchMin>>}}} or more characters are entered.<br>Use down-arrow to start matching with shorter input. //Note: This option value is also set/used by [[SearchOptionsPlugin]]//.
*To set the maximum height of the listbox, you can create a tiddler tagged with <<tag systemConfig>>, containing:
//{{{
config.macros.gotoTiddler.listMaxSize=10; // change this number
//}}}
<<<
!!!Revisions
<<<
2009.05.22 [1.9.2] use reverseLookup() for IncludePlugin
|please see [[GotoPluginInfo]] for additional revision details|
2006.05.05 [0.0.0] started
<<<
!!!Code
***/
//{{{
version.extensions.GotoPlugin= {major: 1, minor: 9, revision: 2, date: new Date(2009,5,22)};
// automatically tweak shadow SideBarOptions to add <<gotoTiddler>> macro above <<search>>
config.shadowTiddlers.SideBarOptions=config.shadowTiddlers.SideBarOptions.replace(/<<search>>/,"{{button{goto}}}\n<<gotoTiddler>><<search>>");
if (config.options.txtIncrementalSearchMin===undefined) config.options.txtIncrementalSearchMin=3;
config.macros.gotoTiddler= {
listMaxSize: 10,
listHeading: 'Found %0 matching title%1...',
searchItem: "Search for '%0'...",
handler:
function(place,macroName,params,wikifier,paramString,tiddler) {
var quiet =params.contains("quiet");
var showlist =params.contains("showlist");
var search =params.contains("search");
params = paramString.parseParams("anon",null,true,false,false);
var instyle =getParam(params,"inputstyle","");
var liststyle =getParam(params,"liststyle","");
var filter =getParam(params,"filter","");
var html=this.html;
var keyevent=window.event?"onkeydown":"onkeypress"; // IE event fixup for ESC handling
html=html.replace(/%keyevent%/g,keyevent);
html=html.replace(/%search%/g,search);
html=html.replace(/%quiet%/g,quiet);
html=html.replace(/%showlist%/g,showlist);
html=html.replace(/%display%/g,showlist?'block':'none');
html=html.replace(/%position%/g,showlist?'static':'absolute');
html=html.replace(/%instyle%/g,instyle);
html=html.replace(/%liststyle%/g,liststyle);
html=html.replace(/%filter%/g,filter);
if (config.browser.isIE) html=this.IEtableFixup.format([html]);
var span=createTiddlyElement(place,'span');
span.innerHTML=html; var form=span.getElementsByTagName("form")[0];
if (showlist) this.fillList(form.list,'',filter,search,0);
},
html:
'<form onsubmit="return false" style="display:inline;margin:0;padding:0">\
<input name=gotoTiddler type=text autocomplete="off" accesskey="G" style="%instyle%"\
title="Enter title text... ENTER=goto, SHIFT-ENTER=search for text, DOWN=select from list"\
onfocus="this.select(); this.setAttribute(\'accesskey\',\'G\');"\
%keyevent%="return config.macros.gotoTiddler.inputEscKeyHandler(event,this,this.form.list,%search%,%showlist%);"\
onkeyup="return config.macros.gotoTiddler.inputKeyHandler(event,this,%quiet%,%search%,%showlist%);">\
<select name=list style="display:%display%;position:%position%;%liststyle%"\
onchange="if (!this.selectedIndex) this.selectedIndex=1;"\
onblur="this.style.display=%showlist%?\'block\':\'none\';"\
%keyevent%="return config.macros.gotoTiddler.selectKeyHandler(event,this,this.form.gotoTiddler,%showlist%);"\
onclick="return config.macros.gotoTiddler.processItem(this.value,this.form.gotoTiddler,this,%showlist%);">\
</select><input name="filter" type="hidden" value="%filter%">\
</form>',
IEtableFixup:
"<table style='width:100%;display:inline;padding:0;margin:0;border:0;'>\
<tr style='padding:0;margin:0;border:0;'><td style='padding:0;margin:0;border:0;'>\
%0</td></tr></table>",
getItems:
function(list,val,filter) {
if (!list.cache || !list.cache.length || val.length<=config.options.txtIncrementalSearchMin) {
// starting new search, fetch and cache list of tiddlers/shadows/tags
list.cache=new Array();
if (filter.length) {
var fn=store.getMatchingTiddlers||store.getTaggedTiddlers;
var tiddlers=store.sortTiddlers(fn.apply(store,[filter]),'title');
} else
var tiddlers=store.reverseLookup('tags','excludeLists');
for(var t=0; t<tiddlers.length; t++) list.cache.push(tiddlers[t].title);
if (!filter.length) {
for (var t in config.shadowTiddlers) list.cache.pushUnique(t);
var tags=store.getTags();
for(var t=0; t<tags.length; t++) list.cache.pushUnique(tags[t][0]);
}
}
var found = [];
var match=val.toLowerCase();
for(var i=0; i<list.cache.length; i++)
if (list.cache[i].toLowerCase().indexOf(match)!=-1) found.push(list.cache[i]);
return found;
},
getItemSuffix:
function(t) {
if (store.tiddlerExists(t)) return ""; // tiddler
if (store.isShadowTiddler(t)) return " (shadow)"; // shadow
return " (tag)"; // tag
},
fillList:
function(list,val,filter,search,key) {
if (list.style.display=="none") return; // not visible... do nothing!
var indent='\xa0\xa0\xa0';
var found = this.getItems(list,val,filter); // find matching items...
found.sort(); // alpha by title
while (list.length > 0) list.options[0]=null; // clear list
var hdr=this.listHeading.format([found.length,found.length==1?"":"s"]);
list.options[0]=new Option(hdr,"",false,false);
for (var t=0; t<found.length; t++) list.options[list.length]=
new Option(indent+found[t]+this.getItemSuffix(found[t]),found[t],false,false);
if (search)
list.options[list.length]=new Option(this.searchItem.format([val]),"*",false,false);
list.size=(list.length<this.listMaxSize?list.length:this.listMaxSize); // resize list...
list.selectedIndex=key==38?list.length-1:key==40?1:0;
},
keyProcessed:
function(ev) { // utility function
ev.cancelBubble=true; // IE4+
try{event.keyCode=0;}catch(e){}; // IE5
if (window.event) ev.returnValue=false; // IE6
if (ev.preventDefault) ev.preventDefault(); // moz/opera/konqueror
if (ev.stopPropagation) ev.stopPropagation(); // all
return false;
},
inputEscKeyHandler:
function(event,here,list,search,showlist) {
if (event.keyCode==27) {
if (showlist) { // clear input, reset list
here.value=here.defaultValue;
this.fillList(list,'',here.form.filter.value,search,0);
}
else if (list.style.display=="none") // clear input
here.value=here.defaultValue;
else list.style.display="none"; // hide list
return this.keyProcessed(event);
}
return true; // key bubbles up
},
inputKeyHandler:
function(event,here,quiet,search,showlist) {
var key=event.keyCode;
var list=here.form.list;
var filter=here.form.filter;
// non-printing chars bubble up, except for a few:
if (key<48) switch(key) {
// backspace=8, enter=13, space=32, up=38, down=40, delete=46
case 8: case 13: case 32: case 38: case 40: case 46: break; default: return true;
}
// blank input... if down/enter... fall through (list all)... else, and hide or reset list
if (!here.value.length && !(key==40 || key==13)) {
if (showlist) this.fillList(here.form.list,'',here.form.filter.value,search,0);
else list.style.display="none";
return this.keyProcessed(event);
}
// hide list if quiet, or below input minimum (and not showlist)
list.style.display=(!showlist&&(quiet||here.value.length<config.options.txtIncrementalSearchMin))?'none':'block';
// non-blank input... enter=show/create tiddler, SHIFT-enter=search for text
if (key==13 && here.value.length) return this.processItem(event.shiftKey?'*':here.value,here,list,showlist);
// up or down key, or enter with blank input... shows and moves to list...
if (key==38 || key==40 || key==13) { list.style.display="block"; list.focus(); }
this.fillList(list,here.value,filter.value,search,key);
return true; // key bubbles up
},
selectKeyHandler:
function(event,list,editfield,showlist) {
if (event.keyCode==27) // escape... hide list, move to edit field
{ editfield.focus(); list.style.display=showlist?'block':'none'; return this.keyProcessed(event); }
if (event.keyCode==13 && list.value.length) // enter... view selected item
{ this.processItem(list.value,editfield,list,showlist); return this.keyProcessed(event); }
return true; // key bubbles up
},
processItem:
function(title,here,list,showlist) {
if (!title.length) return;
list.style.display=showlist?'block':'none';
if (title=="*") { story.search(here.value); return false; } // do full-text search
if (!showlist) here.value=title;
story.displayTiddler(null,title); // show selected tiddler
return false;
}
}
//}}}
/***
|Name|HTMLFormattingPlugin|
|Source|http://www.TiddlyTools.com/#HTMLFormattingPlugin|
|Documentation|http://www.TiddlyTools.com/#HTMLFormattingPluginInfo|
|Version|2.4.0|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides|'HTML' formatter|
|Description|embed wiki syntax formatting inside of HTML content|
The ~HTMLFormatting plugin allows you to ''mix wiki-style formatting syntax within HTML formatted content'' by extending the action of the standard TiddlyWiki formatting handler.
!!!!!Documentation
>see [[HTMLFormattingPluginInfo]]
!!!!!Revisions
<<<
2009.01.05 [2.4.0] in wikifyTextNodes(), pass w.highlightRegExp and w.tiddler to wikify() so that search term highlighting and tiddler-relative macro processing will work
| see [[HTMLFormattingPluginInfo]] for additional revision details |
2005.06.26 [1.0.0] Initial Release (as code adaptation - pre-dates TiddlyWiki plugin architecture!!)
<<<
!!!!!Code
***/
//{{{
version.extensions.HTMLFormattingPlugin= {major: 2, minor: 4, revision: 0, date: new Date(2009,1,5)};
// find the formatter for HTML and replace the handler
initHTMLFormatter();
function initHTMLFormatter()
{
for (var i=0; i<config.formatters.length && config.formatters[i].name!="html"; i++);
if (i<config.formatters.length) config.formatters[i].handler=function(w) {
if (!this.lookaheadRegExp) // fixup for TW2.0.x
this.lookaheadRegExp = new RegExp(this.lookahead,"mg");
this.lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = this.lookaheadRegExp.exec(w.source)
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
var html=lookaheadMatch[1];
// if <nowiki> is present, just let browser handle it!
if (html.indexOf('<nowiki>')!=-1)
createTiddlyElement(w.output,"span").innerHTML=html;
else {
// if <hide linebreaks> is present, suppress wiki-style literal handling of newlines
if (html.indexOf('<hide linebreaks>')!=-1) html=html.replace(/\n/g,' ');
// remove all \r's added by IE textarea and mask newlines and macro brackets
html=html.replace(/\r/g,'').replace(/\n/g,'\\n').replace(/<</g,'%%(').replace(/>>/g,')%%');
// create span, let browser parse HTML
var e=createTiddlyElement(w.output,"span"); e.innerHTML=html;
// then re-render text nodes as wiki-formatted content
wikifyTextNodes(e,w);
}
w.nextMatch = this.lookaheadRegExp.lastIndex; // continue parsing
}
}
}
// wikify #text nodes that remain after HTML content is processed (pre-order recursion)
function wikifyTextNodes(theNode,w)
{
function unmask(s) { return s.replace(/\%%\(/g,'<<').replace(/\)\%%/g,'>>').replace(/\\n/g,'\n'); }
switch (theNode.nodeName.toLowerCase()) {
case 'style': case 'option': case 'select':
theNode.innerHTML=unmask(theNode.innerHTML);
break;
case 'textarea':
theNode.value=unmask(theNode.value);
break;
case '#text':
var txt=unmask(theNode.nodeValue);
var newNode=createTiddlyElement(null,"span");
theNode.parentNode.replaceChild(newNode,theNode);
wikify(txt,newNode,highlightHack,w.tiddler);
break;
default:
for (var i=0;i<theNode.childNodes.length;i++)
wikifyTextNodes(theNode.childNodes.item(i),w); // recursion
break;
}
}
//}}}
HTML5 is so much easier to write than XHTML 1.0.
# You don't have to manually declare the "http://www.w3.org/1999/xhtml" namespace.
# You don't have to add type attributes to script and style elements (they default to text/javascript and text/css).
# You don't have to use a long doctype where the browser just ignores most of it. You must use <!DOCTYPE html>, which is easy to remember.
# You don't have a choice to include or not include a dtd uri in the doctype and you don't have a choice between transitional and strict. You just have a strict doctype that invokes full standards mode. That way, you don't have to worry about accidentally being in Almost standards mode or Quirks mode.
# The charset declaration is much simpler. It's just <meta charset="utf-8">.
# If you find it confusing to write void elements as <name>, you can use <name/>, if you want.
# HTML5 has a really good validator at http://validator.nu/. The validator isn't bound by a crappy DTD that can't express all the rules.
# You don't have to add {{{//<![CDATA}}} etc. in inline scripts or stylesheets (in certain situations) to validate.
# You can use embed if needed.
Just syntax-wise, when you use HTML5, you end up with cleaner, easier to read markup that always invokes standards mode. When you use XHTML 1.0 (served as text/html), you're specifying a bunch of crud (in order to validate against a crappy dtd) that the browser will do automatically.
!Mirus computer specs:
|CPU | | AMD Athlon 64 '3000+' |
|Graphics | 256 Mb (uncertain) | Nvidia 3DForce ~FX5600 rev a1 |
|HD sda1 |ext4 -- 140 Gb | |
|HD sdb1 |ext4 -- 40 Gb | |
|HD sdb6 |ext3 -- 22 Gb | |
|Memory | 1 Gb | |
|Monitor | best: 1400x1050 60Hz | ~ViewSonic 20" VG2021m |
!{{{sudo lspci -v }}} output:
{{{
00:00.0 Host bridge: VIA Technologies, Inc. K8M800 Host Bridge
Subsystem: ASUSTeK Computer Inc. Device 8129
Flags: bus master, 66MHz, medium devsel, latency 64
Memory at dc000000 (32-bit, prefetchable) [size=64M]
Capabilities: [80] AGP version 3.0
Capabilities: [50] Power Management version 2
Capabilities: [60] HyperTransport: Slave or Primary Interface
Capabilities: [58] HyperTransport: Interrupt Discovery and Configuration
Kernel driver in use: agpgart-amd64
Kernel modules: amd64-agp
00:00.1 Host bridge: VIA Technologies, Inc. K8M800 Host Bridge
Flags: bus master, medium devsel, latency 0
00:00.2 Host bridge: VIA Technologies, Inc. K8M800 Host Bridge
Flags: bus master, medium devsel, latency 0
00:00.3 Host bridge: VIA Technologies, Inc. K8M800 Host Bridge
Flags: bus master, medium devsel, latency 0
00:00.4 Host bridge: VIA Technologies, Inc. K8M800 Host Bridge
...
00:00.7 Host bridge: VIA Technologies, Inc. K8M800 Host Bridge
...
00:01.0 PCI bridge: VIA Technologies, Inc. VT8237 PCI bridge [K8T800/K8T890 South]
...
00:07.0 FireWire (IEEE 1394): VIA Technologies, Inc. VT6306/7/8 [Fire II(M)] IEEE 1394 OHCI Controller (rev 80) (prog-if 10)
...
00:0c.0 Ethernet controller: ADMtek NC100 Network Everywhere Fast Ethernet 10/100 (rev 11)
...
00:0d.0 Modem: Smart Link Ltd. SmartLink SmartPCI562 56K Modem (rev 04)
...
00:0f.0 IDE interface: VIA Technologies, Inc. VIA VT6420 SATA RAID Controller (rev 80) (prog-if 8f [Master SecP SecO PriP PriO])
Subsystem: ASUSTeK Computer Inc. Device 80ed
Flags: bus master, medium devsel, latency 64, IRQ 20
...
00:0f.1 IDE interface...
00:10.0 USB Controller...
00:10.1 USB Controller...
00:10.2 USB Controller...
00:10.3 USB Controller...
00:10.4 USB Controller...
00:11.0 ISA bridge...
00:11.5 Multimedia audio controller: VIA Technologies, Inc. VT8233/A/8235/8237 AC97 Audio Controller (rev 60)
Subsystem: ASUSTeK Computer Inc. Device 810f
Flags: medium devsel, IRQ 22
I/O ports at a400 [size=256]
Capabilities: [c0] Power Management version 2
Kernel driver in use: VIA 82xx Audio
Kernel modules: snd-via82xx
00:12.0 Ethernet controller: VIA Technologies, Inc. VT6102 [Rhine-II] (rev 78)
Subsystem: ASUSTeK Computer Inc. Device 80ed
Flags: bus master, medium devsel, latency 64, IRQ 23
I/O ports at a000 [size=256]
Memory at fa800000 (32-bit, non-prefetchable) [size=256]
Capabilities: [40] Power Management version 2
Kernel driver in use: via-rhine
Kernel modules: via-rhine
00:18.0 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration
Flags: fast devsel
Capabilities: [80] HyperTransport: Host or Secondary Interface
00:18.1 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Address Map
Flags: fast devsel
00:18.2 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] DRAM Controller
Flags: fast devsel
00:18.3 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control
Flags: fast devsel
Kernel driver in use: k8temp
Kernel modules: k8temp
01:00.0 VGA compatible controller: nVidia Corporation NV31 [GeForce FX 5600] (rev a1)
Subsystem: Jaton Corp Device 0001
Flags: bus master, 66MHz, medium devsel, latency 64, IRQ 16
Memory at fb000000 (32-bit, non-prefetchable) [size=16M]
Memory at e0000000 (32-bit, prefetchable) [size=256M]
Expansion ROM at faf00000 [disabled] [size=128K]
Capabilities: [60] Power Management version 2
Capabilities: [44] AGP version 3.0
Kernel driver in use: nouveau
Kernel modules: nvidiafb, nouveau
}}}
!{{{sudo lshw -C video }}} output:
{{{
description: VGA compatible controller
product: NV31 [GeForce FX 5600]
vendor: nVidia Corporation
physical id: 0
bus info: pci@0000:01:00.0
version: a1
width: 32 bits
clock: 66MHz
capabilities: pm agp agp-3.0 bus_master cap_list rom
}}}
{{annotation{
This is the //computer and code wiki//.
}}}
/%
|Name|HideTiddlerBackground|
|Source|http://www.TiddlyTools.com/#HideTiddlerBackground|
|Version|0.0.0|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|script|
|Requires|InlineJavascriptPlugin|
|Overrides||
|Description|hide a tiddler's background and border (if any)|
Usage: <<tiddler HideTiddlerBackground>>
%/<script>
var t=story.findContainingTiddler(place);
if (!t || t.id=="HideTiddlerBackground") return;
var nodes=t.getElementsByTagName("*");
for (var i=0; i<nodes.length; i++) if (hasClass(nodes[i],"viewer")) {
var s=nodes[i].style;
s.backgroundImage="none";
s.backgroundColor="transparent"
s.borderColor="transparent";
s.borderWidth=0;
s.margin=0;
s.padding=0;
break;
}
</script>
/%
|Name|HideTiddlerTags|
|Source|http://www.TiddlyTools.com/#HideTiddlerTags|
|Version|0.0.0|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|script|
|Requires|InlineJavascriptPlugin|
|Overrides||
|Description|hide a tiddler's tagged/tagging display elements|
Usage: <<tiddler HideTiddlerTags>>
%/<script>
var t=story.findContainingTiddler(place);
if (!t || t.id=="tiddlerHideTiddlerTags") return;
var nodes=t.getElementsByTagName("div");
for (var i=0; i<nodes.length; i++)
if (hasClass(nodes[i],"tagged"))
nodes[i].style.display="none";
</script>
Server type: POP
Server: mail.grandecom.net
port 110
[[Logon_Keys]]
outgoing SMTP
mail.grandecom.net
port 0
# Upgrade fields in table {{{_aa_M9_Survey_TableField}}}
# Add fields to bucket.
# Open Mint and add fields to Mint.
# Populate new field: {{{x_ExamplePopulateNewField}}}
# Run {{{TEST_Table_Refresh}}}
** Error handling off
** run using //test mode// choice
# Run {{{TEST_Table_Refresh}}}
** Error handling __on__
** run using //test mode//=No
# Consider whether table have a similar table (ex., archive version) that should also be revised
!! ~AdMint -- @@color:red;Bucket@@
# add ODBC link using {{{SOTOMAS90_Silent}}}
# //Copy// ODBC
# //Paste// as structure only and title with @@color:red;0_@@ prefix
# Run {{{x_TempFillBucket}}} to produce sample data
# Delete fields that are obviously irrelevant
# ~AdMint {{{TableSurvey}}} -- Update long name of table
# Open {{{Mint.mdb}}}
## Rename @@color:red;legacy@@ table with suffix {{{_legacy}}}
## Open legacy table in design view (to compare fields)
# Open {{{_aa_M9_Survey_TableField}}}, filter by table FID
# For fields:
## Change field name to fit new schema
## Mark as primary (refer to ODBC link)
## Enter {{{f_Useful}}} value (explanation at bottom)
### legacy table provides precedents
### Carefully note new inclusions
## Update data type and size to fit new schema
## Determine changes in padding or use of Null
# Filter {{{_aa_M9_Survey_TableField}}} on {{{f_Useful > 2}}}
# Finish @@color:red;Bucket@@ table
## Field names updated
## Field type and size match
## New inclusions added
## Remove all indexes
## Delete trial records
## Add {{{id}}} (primary key, only table index)
## Add {{{fp_ignore}}} (do not index)
!! Mint
# Import @@color:red;Bucket @@
# Remove prefix to create the @@color:red;Mint@@ table
# Add Mint fields
## date fields (index on NotFound)
## {{{fp_lock}}} (do not index)
## any smart fields from legacy table
# Remove index from {{{id}}}
# Add primary key index(es)
# Add other indexes per querying needs
# Populate table from legacy
!! ~AdMint
# Add @@color:red;link from Mint@@
# Populate new fields using {{{x_ExamplePopulateNewField}}}
# Update awkward fields
# Correct shifts in padding, Null/empty, etc. ({{{x_RemovePadding}}})
# Run {{{TEST_Table_Refresh}}} with ''CatchSchema'' set to On
** (This line of code catches such: {{{If Nz(varPut) <> Nz(varGet) Then}}})
** Error handling off
** run using //test mode// = Yes
** Update fields as required
# Run {{{TEST_Table_Refresh}}} without ''CatchSchema''
# Run {{{TEST_Table_Refresh}}}
** Error handling __on__
** Run using //test mode// = No
** Ensure no stops, errors
!! ~AdMint close out
# Resolve any {{{''DEBUG}}}, {{{''FIXME}}} in VBA
# Ensure VBA error-handling = On
# Ensure Links Manager is pointed to right sources
# Set refresh interval
# Populate refresh-timestamps
----
Field values
| !5 |Index across tables |
| !4 |Important |
| !3 |Included |
| !2 |Maybe some day |
| !1 |Very doubtful |
| !0 |Confirmed throw-away |
| html | ascii | glyph | description |h
|{{{ ‘ }}} ||{{{ ‘ }}} |left single quote|
|{{{ ’ }}} ||{{{ ’ }}} |right single quote|
|{{{ ‚ }}} ||{{{ ‚ }}} |single low-9 quote|
|{{{ “ }}} ||{{{ “ }}} |left double quote|
|{{{ ” }}} ||{{{ †}}} |right double quote|
|{{{ „ }}} ||{{{ „ }}} |double low-9 quote|
|{{{ † }}} ||{{{ †}}} |dagger|
|{{{ ‡ }}} ||{{{ ‡ }}} |double dagger|
|{{{ ‰ }}} ||{{{ ‰ }}} |per mill sign|
|{{{ ‹ }}} ||{{{ ‹ }}} |single left-pointing angle quote|
|{{{ › }}} ||{{{ › }}} |single right-pointing angle quote|
|{{{ ♠ }}} || |black spade suit|
|{{{ ♣ }}} || |black club suit|
|{{{ ♥ }}} || |black heart suit|
|{{{ ♦ }}} || |black diamond suit|
|{{{ ‾ }}} || |overline, = spacing overscore|
|{{{ ← }}} || |leftward arrow|
|{{{ ↑ }}} || |upward arrow|
|{{{ → }}} || |rightward arrow|
|{{{ ↓ }}} || |downward arrow|
|{{{ ™ }}} ||{{{ â„¢ }}} |trademark sign|
||{{{ �- }}} | |unused|
||{{{ 	 }}} ||horizontal tab|
||{{{ }}} ||line feed|
||{{{  }}} ||unused|
||{{{   }}} ||space|
||{{{ ! }}} |{{{ ! }}} |exclamation mark|
|{{{ " }}} |{{{ " }}} |{{{ “ }}} |double quotation mark|
||{{{ # }}} |{{{ # }}} |number sign|
||{{{ $ }}} |{{{ $ }}} |dollar sign|
||{{{ % }}} |{{{ % }}} |percent sign|
|{{{ & }}} |{{{ & }}} |{{{ & }}} |ampersand|
||{{{ ' }}} |{{{ ‘ }}} |apostrophe|
||{{{ ( }}} |{{{ ( }}} |left parenthesis|
||{{{ ) }}} |{{{ ) }}} |right parenthesis|
||{{{ * }}} |{{{ * }}} |asterisk|
||{{{ + }}} |{{{ + }}} |plus sign|
||{{{ , }}} |{{{ , }}} |comma|
||{{{ - }}} |{{{ - }}} |hyphen|
||{{{ . }}} |{{{ . }}} |period|
|{{{ ⁄ }}} |{{{ / }}} |{{{ / }}} |slash|
||{{{ 0-9 }}} ||digits 0-9|
||{{{ : }}} |{{{ : }}} |colon|
||{{{ ; }}} |{{{ ; }}} |semicolon|
|{{{ < }}} |{{{ < }}} |{{{ < }}} |less-than sign|
||{{{ = }}} |{{{ = }}} |equals sign|
|{{{ > }}} |{{{ > }}} |{{{ > }}} |greater-than sign|
||{{{ ? }}} |{{{ ? }}} |question mark|
||{{{ @ }}} |{{{ @ }}} |at sign|
||{{{ A-Z }}} ||uppercase letters A-Z|
||{{{ [ }}} |{{{ [ }}} |left square bracket|
||{{{ \ }}} |{{{ \ }}} |backslash|
||{{{ ] }}} |{{{ ] }}} |right square bracket|
||{{{ ] }}} |{{{ ] }}} |caret|
||{{{ _ }}} |{{{ _ }}} |horizontal bar (underscore)|
||{{{ ` }}} |{{{ ` }}} |grave accent|
||{{{ a-z }}} ||lowercase letters a-z|
||{{{ { }}} |{{{ { }}} |left curly brace|
||{{{ | }}} |{{{ | }}} |vertical bar|
||{{{ } }}} |{{{ } }}} |right curly brace|
||{{{ ~ }}} |{{{ ~ }}} |tilde|
||{{{ -• }}} ||unused|
|{{{ – }}} |{{{ – }}} |{{{ – }}} |en dash|
|{{{ — }}} |{{{ — }}} |{{{ — }}} |em dash|
||{{{ ˜-Ÿ}}} ||unused|
|{{{ }}} |{{{   }}} ||nonbreaking space|
|{{{ ¡ }}} |{{{ ¡ }}} |{{{ ¡ }}} |inverted exclamation|
|{{{ ¢ }}} |{{{ ¢ }}} |{{{ ¢ }}} |cent sign|
|{{{ £ }}} |{{{ £ }}} |{{{ £ }}} |pound sterling|
|{{{ ¤ }}} |{{{ ¤ }}} |{{{ ¤ }}} |general currency sign|
|{{{ ¥ }}} |{{{ ¥ }}} |{{{ Â¥ }}} |yen sign|
|{{{ ¦ &brkbar; }}} |{{{ ¦ }}} |{{{ ¦ }}} |broken vertical bar|
|{{{ § }}} |{{{ § }}} |{{{ § }}} |section sign|
|{{{ ¨ ¨ }}} |{{{ ¨ }}} |{{{ ¨ }}} |umlaut|
|{{{ © }}} |{{{ © }}} |{{{ © }}} |copyright|
|{{{ ª }}} |{{{ ª }}} |{{{ ª }}} |feminine ordinal|
|{{{ « }}} |{{{ « }}} |{{{ « }}} |left angle quote|
|{{{ ¬ }}} |{{{ ¬ }}} |{{{ ¬ }}} |not sign|
|{{{ ­ }}} |{{{ ­ }}} |{{{ Â }}} |soft hyphen|
|{{{ ® }}} |{{{ ® }}} |{{{ ® }}} |registered trademark|
|{{{ ¯ &hibar; }}} |{{{ ¯ }}} |{{{ ¯ }}} |macron accent|
|{{{ ° }}} |{{{ ° }}} |{{{ ° }}} |degree sign|
|{{{ ± }}} |{{{ ± }}} |{{{ ± }}} |plus or minus|
|{{{ ² }}} |{{{ ² }}} |{{{ ² }}} |superscript two|
|{{{ ³ }}} |{{{ ³ }}} |{{{ ³ }}} |superscript three|
|{{{ ´ }}} |{{{ ´ }}} |{{{ ´ }}} |acute accent|
|{{{ µ }}} |{{{ µ }}} |{{{ µ }}} |micro sign|
|{{{ ¶ }}} |{{{ ¶ }}} |{{{ ¶ }}} |paragraph sign|
|{{{ · }}} |{{{ · }}} |{{{ · }}} |middle dot|
|{{{ ¸ }}} |{{{ ¸ }}} |{{{ ¸ }}} |cedilla|
|{{{ ¹ }}} |{{{ ¹ }}} |{{{ ¹ }}} |superscript one|
|{{{ º }}} |{{{ º }}} |{{{ º }}} |masculine ordinal|
|{{{ » }}} |{{{ » }}} |{{{ » }}} |right angle quote|
|{{{ ¼ }}} |{{{ ¼ }}} |{{{ ¼ }}} |one-fourth|
|{{{ ½ }}} |{{{ ½ }}} |{{{ ½ }}} |one-half|
|{{{ ¾ }}} |{{{ ¾ }}} |{{{ ¾ }}} |three-fourths|
|{{{ ¿ }}} |{{{ ¿ }}} |{{{ ¿ }}} |inverted question mark|
|{{{ À }}} |{{{ À }}} |{{{ À }}} |uppercase A, grave accent|
|{{{ Á }}} |{{{ Á }}} |{{{ Ã }}} |uppercase A, acute accent|
|{{{  }}} |{{{  }}} |{{{ Â }}} |uppercase A, circumflex accent|
|{{{ à }}} |{{{ à }}} |{{{ Ã }}} |uppercase A, tilde|
|{{{ Ä }}} |{{{ Ä }}} |{{{ Ä }}} |uppercase A, umlaut|
|{{{ Å }}} |{{{ Å }}} |{{{ Ã… }}} |uppercase A, ring|
|{{{ Æ }}} |{{{ Æ }}} |{{{ Æ }}} |uppercase AE|
|{{{ Ç }}} |{{{ Ç }}} |{{{ Ç }}} |uppercase C, cedilla|
|{{{ È }}} |{{{ È }}} |{{{ È }}} |uppercase E, grave accent|
|{{{ É }}} |{{{ É }}} |{{{ É }}} |uppercase E, acute accent|
|{{{ Ê }}} |{{{ Ê }}} |{{{ Ê }}} |uppercase E, circumflex accent|
|{{{ Ë }}} |{{{ Ë }}} |{{{ Ë }}} |uppercase E, umlaut|
|{{{ Ì }}} |{{{ Ì }}} |{{{ ÃŒ }}} |uppercase I, grave accent|
|{{{ Í }}} |{{{ Í }}} |{{{ Ã }}} |uppercase I, acute accent|
|{{{ Î }}} |{{{ Î }}} |{{{ ÃŽ }}} |uppercase I, circumflex accent|
|{{{ Ï }}} |{{{ Ï }}} |{{{ Ã }}} |uppercase I, umlaut|
|{{{ Ð }}} |{{{ Ð }}} |{{{ Ã }}} |uppercase Eth, Icelandic|
|{{{ Ñ }}} |{{{ Ñ }}} |{{{ Ñ }}} |uppercase N, tilde|
|{{{ Ò }}} |{{{ Ò }}} |{{{ Ã’ }}} |uppercase O, grave accent|
|{{{ Ó }}} |{{{ Ó }}} |{{{ Ó }}} |uppercase O, acute accent|
|{{{ Ô }}} |{{{ Ô }}} |{{{ Ô }}} |uppercase O, circumflex accent|
|{{{ Õ }}} |{{{ Õ }}} |{{{ Õ }}} |uppercase O, tilde|
|{{{ Ö }}} |{{{ Ö }}} |{{{ Ö }}} |uppercase O, umlaut|
|{{{ × }}} |{{{ × }}} |{{{ × }}} |multiplication sign|
|{{{ Ø }}} |{{{ Ø }}} |{{{ Ø }}} |uppercase O, slash|
|{{{ ٠}}} |{{{ ٠}}} |{{{ Ù }}} |uppercase U, grave accent|
|{{{ Ú }}} |{{{ Ú }}} |{{{ Ú }}} |uppercase U, acute accent|
|{{{ Û }}} |{{{ Û }}} |{{{ Û }}} |uppercase U, circumflex accent|
|{{{ Ü }}} |{{{ Ü }}} |{{{ Ü }}} |uppercase U, umlaut|
|{{{ Ý }}} |{{{ Ý }}} |{{{ Ã }}} |uppercase Y, acute accent|
|{{{ Þ }}} |{{{ Þ }}} |{{{ Þ }}} |uppercase THORN, Icelandic|
|{{{ ß }}} |{{{ ß }}} |{{{ ß }}} |lowercase sharps, German|
|{{{ à }}} |{{{ à }}} |{{{ Ã }}} |lowercase a, grave accent|
|{{{ á }}} |{{{ á }}} |{{{ á }}} |lowercase a, acute accent|
|{{{ â }}} |{{{ â }}} |{{{ â }}} |lowercase a, circumflex accent|
|{{{ ã }}} |{{{ ã }}} |{{{ ã }}} |lowercase a, tilde|
|{{{ ä }}} |{{{ ä }}} |{{{ ä }}} |lowercase a, umlaut|
|{{{ å }}} |{{{ å }}} |{{{ Ã¥ }}} |lowercase a, ring|
|{{{ æ }}} |{{{ æ }}} |{{{ æ }}} |lowercase ae|
|{{{ ç }}} |{{{ ç }}} |{{{ ç }}} |lowercase c, cedilla|
|{{{ è }}} |{{{ è }}} |{{{ è }}} |lowercase e, grave accent|
|{{{ é }}} |{{{ é }}} |{{{ é }}} |lowercase e, acute accent|
|{{{ ê }}} |{{{ ê }}} |{{{ ê }}} |lowercase e, circumflex accent|
|{{{ ë }}} |{{{ ë }}} |{{{ ë }}} |lowercase e, umlaut|
|{{{ ì }}} |{{{ ì }}} |{{{ ì }}} |lowercase i, grave accent|
|{{{ í }}} |{{{ í }}} |{{{ Ã }}} |lowercase i, acute accent|
|{{{ î }}} |{{{ î }}} |{{{ î }}} |lowercase i, circumflex accent|
|{{{ ï }}} |{{{ ï }}} |{{{ ï }}} |lowercase i, umlaut|
|{{{ ð }}} |{{{ ð }}} |{{{ ð }}} |lowercase eth, Icelandic|
|{{{ ñ }}} |{{{ ñ }}} |{{{ ñ }}} |lowercase n, tilde|
|{{{ ò }}} |{{{ ò }}} |{{{ ò }}} |lowercase o, grave accent|
|{{{ ó }}} |{{{ ó }}} |{{{ ó }}} |lowercase o, acute accent|
|{{{ ô }}} |{{{ ô }}} |{{{ ô }}} |lowercase o, circumflex accent|
|{{{ õ }}} |{{{ õ }}} |{{{ õ }}} |lowercase o, tilde|
|{{{ ö }}} |{{{ ö }}} |{{{ ö }}} |lowercase o, umlaut|
|{{{ ÷ }}} |{{{ ÷ }}} |{{{ ÷ }}} |division sign|
|{{{ ø }}} |{{{ ø }}} |{{{ ø }}} |lowercase o, slash|
|{{{ ù }}} |{{{ ù }}} |{{{ ù }}} |lowercase u, grave accent|
|{{{ ú }}} |{{{ ú }}} |{{{ ú }}} |lowercase u, acute accent|
|{{{ û }}} |{{{ û }}} |{{{ û }}} |lowercase u, circumflex accent|
|{{{ ü }}} |{{{ ü }}} |{{{ ü }}} |lowercase u, umlaut|
|{{{ ý }}} |{{{ ý }}} |{{{ ý }}} |lowercase y, acute accent|
|{{{ þ }}} |{{{ þ }}} |{{{ þ }}} |lowercase thorn, Icelandic|
|{{{ ÿ }}} |{{{ ÿ }}} |{{{ ÿ }}} |lowercase y, umlaut |
Nicely improves the desktop.
/***
|Name|ImageSizePlugin|
|Source|http://www.TiddlyTools.com/#ImageSizePlugin|
|Version|1.2.1|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin,formatter|
|Requires||
|Overrides|'image' formatter|
|Description|adds support for resizing images|
This plugin adds optional syntax to scale an image to a specified width and height and/or interactively resize the image with the mouse.
!!!!!Usage
<<<
The extended image syntax is:
{{{
[img(w+,h+)[...][...]]
}}}
where ''(w,h)'' indicates the desired width and height (in CSS units, e.g., px, em, cm, in, or %). Use ''auto'' (or a blank value) for either dimension to scale that dimension proportionally (i.e., maintain the aspect ratio). You can also calculate a CSS value 'on-the-fly' by using a //javascript expression// enclosed between """{{""" and """}}""". Appending a plus sign (+) to a dimension enables interactive resizing in that dimension (by dragging the mouse inside the image). Use ~SHIFT-click to show the full-sized (un-scaled) image. Use ~CTRL-click to restore the starting size (either scaled or full-sized).
<<<
!!!!!Examples
<<<
{{{
[img(100px+,75px+)[images/meow2.jpg]]
}}}
[img(100px+,75px+)[images/meow2.jpg]]
{{{
[<img(34%+,+)[images/meow.gif]]
[<img(21% ,+)[images/meow.gif]]
[<img(13%+, )[images/meow.gif]]
[<img( 8%+, )[images/meow.gif]]
[<img( 5% , )[images/meow.gif]]
[<img( 3% , )[images/meow.gif]]
[<img( 2% , )[images/meow.gif]]
[img( 1%+,+)[images/meow.gif]]
}}}
[<img(34%+,+)[images/meow.gif]]
[<img(21% ,+)[images/meow.gif]]
[<img(13%+, )[images/meow.gif]]
[<img( 8%+, )[images/meow.gif]]
[<img( 5% , )[images/meow.gif]]
[<img( 3% , )[images/meow.gif]]
[<img( 2% , )[images/meow.gif]]
[img( 1%+,+)[images/meow.gif]]
{{tagClear{
}}}
<<<
!!!!!Revisions
<<<
2009.02.24 [1.2.1] cleanup width/height regexp, use '+' suffix for resizing
2009.02.22 [1.2.0] added stretchable images
2008.01.19 [1.1.0] added evaluated width/height values
2008.01.18 [1.0.1] regexp for "(width,height)" now passes all CSS values to browser for validation
2008.01.17 [1.0.0] initial release
<<<
!!!!!Code
***/
//{{{
version.extensions.ImageSizePlugin= {major: 1, minor: 2, revision: 1, date: new Date(2009,2,24)};
//}}}
//{{{
var f=config.formatters[config.formatters.findByField("name","image")];
f.match="\\[[<>]?[Ii][Mm][Gg](?:\\([^,]*,[^\\)]*\\))?\\[";
f.lookaheadRegExp=/\[([<]?)(>?)[Ii][Mm][Gg](?:\(([^,]*),([^\)]*)\))?\[(?:([^\|\]]+)\|)?([^\[\]\|]+)\](?:\[([^\]]*)\])?\]/mg;
f.handler=function(w) {
this.lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = this.lookaheadRegExp.exec(w.source)
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
var floatLeft=lookaheadMatch[1];
var floatRight=lookaheadMatch[2];
var width=lookaheadMatch[3];
var height=lookaheadMatch[4];
var tooltip=lookaheadMatch[5];
var src=lookaheadMatch[6];
var link=lookaheadMatch[7];
// Simple bracketted link
var e = w.output;
if(link) { // LINKED IMAGE
if (config.formatterHelpers.isExternalLink(link)) {
if (config.macros.attach && config.macros.attach.isAttachment(link)) {
// see [[AttachFilePluginFormatters]]
e = createExternalLink(w.output,link);
e.href=config.macros.attach.getAttachment(link);
e.title = config.macros.attach.linkTooltip + link;
} else
e = createExternalLink(w.output,link);
} else
e = createTiddlyLink(w.output,link,false,null,w.isStatic);
addClass(e,"imageLink");
}
var img = createTiddlyElement(e,"img");
if(floatLeft) img.align="left"; else if(floatRight) img.align="right";
if(width||height) {
var x=width.trim(); var y=height.trim();
var stretchW=(x.substr(x.length-1,1)=='+'); if (stretchW) x=x.substr(0,x.length-1);
var stretchH=(y.substr(y.length-1,1)=='+'); if (stretchH) y=y.substr(0,y.length-1);
if (x.substr(0,2)=="{{")
{ try{x=eval(x.substr(2,x.length-4))} catch(e){displayMessage(e.description||e.toString())} }
if (y.substr(0,2)=="{{")
{ try{y=eval(y.substr(2,y.length-4))} catch(e){displayMessage(e.description||e.toString())} }
img.style.width=x.trim(); img.style.height=y.trim();
config.formatterHelpers.addStretchHandlers(img,stretchW,stretchH);
}
if(tooltip) img.title = tooltip;
// GET IMAGE SOURCE
if (config.macros.attach && config.macros.attach.isAttachment(src))
src=config.macros.attach.getAttachment(src); // see [[AttachFilePluginFormatters]]
else if (config.formatterHelpers.resolvePath) { // see [[ImagePathPlugin]]
if (config.browser.isIE || config.browser.isSafari) {
img.onerror=(function(){
this.src=config.formatterHelpers.resolvePath(this.src,false);
return false;
});
} else
src=config.formatterHelpers.resolvePath(src,true);
}
img.src=src;
w.nextMatch = this.lookaheadRegExp.lastIndex;
}
}
config.formatterHelpers.addStretchHandlers=function(e,stretchW,stretchH) {
e.title=((stretchW||stretchH)?'DRAG=stretch/shrink, ':'')
+'SHIFT-CLICK=show full size, CTRL-CLICK=restore initial size';
e.statusMsg='width=%0, height=%1';
e.style.cursor='move';
e.originalW=e.style.width;
e.originalH=e.style.height;
e.minW=Math.max(e.offsetWidth/20,10);
e.minH=Math.max(e.offsetHeight/20,10);
e.stretchW=stretchW;
e.stretchH=stretchH;
e.onmousedown=function(ev) { var ev=ev||window.event;
this.sizing=true;
this.startX=!config.browser.isIE?ev.pageX:(ev.clientX+findScrollX());
this.startY=!config.browser.isIE?ev.pageY:(ev.clientY+findScrollY());
this.startW=this.offsetWidth;
this.startH=this.offsetHeight;
return false;
};
e.onmousemove=function(ev) { var ev=ev||window.event;
if (this.sizing) {
var s=this.style;
var currX=!config.browser.isIE?ev.pageX:(ev.clientX+findScrollX());
var currY=!config.browser.isIE?ev.pageY:(ev.clientY+findScrollY());
var newW=(currX-this.offsetLeft)/(this.startX-this.offsetLeft)*this.startW;
var newH=(currY-this.offsetTop )/(this.startY-this.offsetTop )*this.startH;
if (this.stretchW) s.width =Math.floor(Math.max(newW,this.minW))+'px';
if (this.stretchH) s.height=Math.floor(Math.max(newH,this.minH))+'px';
clearMessage(); displayMessage(this.statusMsg.format([s.width,s.height]));
}
return false;
};
e.onmouseup=function(ev) { var ev=ev||window.event;
if (ev.shiftKey) { this.style.width=this.style.height=''; }
if (ev.ctrlKey) { this.style.width=this.originalW; this.style.height=this.originalH; }
this.sizing=false;
clearMessage();
return false;
};
e.onmouseout=function(ev) { var ev=ev||window.event;
this.sizing=false;
clearMessage();
return false;
};
}
//}}}
/***
|Name|InlineJavascriptPlugin|
|Source|http://www.TiddlyTools.com/#InlineJavascriptPlugin|
|Documentation|http://www.TiddlyTools.com/#InlineJavascriptPluginInfo|
|Version|1.9.5|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Description|Insert Javascript executable code directly into your tiddler content.|
''Call directly into TW core utility routines, define new functions, calculate values, add dynamically-generated TiddlyWiki-formatted output'' into tiddler content, or perform any other programmatic actions each time the tiddler is rendered.
!!!!!Documentation
>see [[InlineJavascriptPluginInfo]]
!!!!!Revisions
<<<
2009.04.11 [1.9.5] pass current tiddler object into wrapper code so it can be referenced from within 'onclick' scripts
2009.02.26 [1.9.4] in $(), handle leading '#' on ID for compatibility with JQuery syntax
|please see [[InlineJavascriptPluginInfo]] for additional revision details|
2005.11.08 [1.0.0] initial release
<<<
!!!!!Code
***/
//{{{
version.extensions.InlineJavascriptPlugin= {major: 1, minor: 9, revision: 5, date: new Date(2009,4,11)};
config.formatters.push( {
name: "inlineJavascript",
match: "\\<script",
lookahead: "\\<script(?: src=\\\"((?:.|\\n)*?)\\\")?(?: label=\\\"((?:.|\\n)*?)\\\")?(?: title=\\\"((?:.|\\n)*?)\\\")?(?: key=\\\"((?:.|\\n)*?)\\\")?( show)?\\>((?:.|\\n)*?)\\</script\\>",
handler: function(w) {
var lookaheadRegExp = new RegExp(this.lookahead,"mg");
lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = lookaheadRegExp.exec(w.source)
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
var src=lookaheadMatch[1];
var label=lookaheadMatch[2];
var tip=lookaheadMatch[3];
var key=lookaheadMatch[4];
var show=lookaheadMatch[5];
var code=lookaheadMatch[6];
if (src) { // external script library
var script = document.createElement("script"); script.src = src;
document.body.appendChild(script); document.body.removeChild(script);
}
if (code) { // inline code
if (show) // display source in tiddler
wikify("{{{\n"+lookaheadMatch[0]+"\n}}}\n",w.output);
if (label) { // create 'onclick' command link
var link=createTiddlyElement(w.output,"a",null,"tiddlyLinkExisting",wikifyPlainText(label));
var fixup=code.replace(/document.write\s*\(/gi,'place.bufferedHTML+=(');
link.code="function _out(place,tiddler){"+fixup+"\n};_out(this,this.tiddler);"
link.tiddler=w.tiddler;
link.onclick=function(){
this.bufferedHTML="";
try{ var r=eval(this.code);
if(this.bufferedHTML.length || (typeof(r)==="string")&&r.length)
var s=this.parentNode.insertBefore(document.createElement("span"),this.nextSibling);
if(this.bufferedHTML.length)
s.innerHTML=this.bufferedHTML;
if((typeof(r)==="string")&&r.length) {
wikify(r,s,null,this.tiddler);
return false;
} else return r!==undefined?r:false;
} catch(e){alert(e.description||e.toString());return false;}
};
link.setAttribute("title",tip||"");
var URIcode='javascript:void(eval(decodeURIComponent(%22(function(){try{';
URIcode+=encodeURIComponent(encodeURIComponent(code.replace(/\n/g,' ')));
URIcode+='}catch(e){alert(e.description||e.toString())}})()%22)))';
link.setAttribute("href",URIcode);
link.style.cursor="pointer";
if (key) link.accessKey=key.substr(0,1); // single character only
}
else { // run script immediately
var fixup=code.replace(/document.write\s*\(/gi,'place.innerHTML+=(');
var c="function _out(place,tiddler){"+fixup+"\n};_out(w.output,w.tiddler);";
try { var out=eval(c); }
catch(e) { out=e.description?e.description:e.toString(); }
if (out && out.length) wikify(out,w.output,w.highlightRegExp,w.tiddler);
}
}
w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
}
}
} )
//}}}
// // Backward-compatibility for TW2.1.x and earlier
//{{{
if (typeof(wikifyPlainText)=="undefined") window.wikifyPlainText=function(text,limit,tiddler) {
if(limit > 0) text = text.substr(0,limit);
var wikifier = new Wikifier(text,formatter,null,tiddler);
return wikifier.wikifyPlain();
}
//}}}
// // GLOBAL FUNCTION: $(...) -- 'shorthand' convenience syntax for document.getElementById()
//{{{
if (typeof($)=='undefined') { function $(id) { return document.getElementById(id.replace(/^#/,'')); } }
//}}}
''throughput for large file, as reported
|Grande at home | 130 Kb/sec |2010_07_04 8 PM |HP laptop |
''My keyboard is producing numbers instead of letters.''
Laptop can lock into "accessibility mode" where letter keys serve as NumLock numbers.
Use hot-key: '' 'Windows' ''button plus ''U''
A utility called ~ZeNoKeybord is reported to solve this.
''Phase 1''
{{{
z1zPro.18.13z2zPro+18.13z3zPro 18:13</a>
z2z[1-3]*[A-Z]{2,5}\.*\+[1-9][1-9]*[1-9]*.[1-9][1-9]*-*[1-9]*[1-9]*z3z // 3.5k matches!
}}}
''Phase 2''
{{{
z3zHeb 3:1</a>
z3zLuk 22:20</a>
z3z([1-3]*[A-Z][a-z]{1,3}\.* )*[0-9]*[0-9]*:*[0-9][0-9]*[0-9]*-*[0-9]*[0-9]*[0-9]*</a> 3.0 k matches
(z3z[^z]+)</a>
}}}
{{{
z1zGen.3.15z2zGen 3:15z4z
z2z[^\:]+\:[^\:]+z4z
}}}
{{{
(<<Bbl [1-3]*[A-Za-z]+)\.([0-9][0-9]*[0-9]*)\.([0-9][0-9]*[0-9]*-*[0-9]*[0-9]*[0-9]* >>)
}}}
@@ Must@@ replace {{{^^L4^^}}} with {{{</a>}}}
{{{(^^L2^^).*.(^^L3^^)}}}
{{{
<script src="http://www.blueletterbible.org/scripts/blbToolTip/BLB_ScriptTagger-min.js" type="text/javascript"></script>
<script type="text/javascript">
BLB.Tagger.Translation = 'NIV';
BLB.Tagger.HyperLinks = 'all'; // 'all', 'none', 'hover'
BLB.Tagger.HideVersions = true;
BLB.Tagger.TargetNewWindow = true;
BLB.Tagger.Style = 'par'; // 'line' or 'par'
</script>
}}}
source: http://www.blueletterbible.org/freeoffer/BLB_ScriptTagger/
{{{ http://www.blueletterbible.org/scripts/blbToolTip/BLB_ScriptTagger-min.js }}}
{{{
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('A 13;A 1k=D.V("2D");L(A 14=0;14<1k.I;14++){A 1l=1k[14];7(1l.1m.1O(/\\/1P\\/2E\\/2F/i)>=0){A O=1l.1m.1Q(/\\//);13=O[0]+\'//\'+O[1];7(!O[1])13=O[0]+\'//\'+O[2];15}}7(1n 5=="1o"||!5){A 5={}}5.6={16:13,X:"2G",1p:[],Y:[],1q:\'1R\',1S:P,1r:P,1T:\'2H\',1U:2I,Q:E,1V:B(i,j,f,h){A l=5.6.1s(i),g=f||5.6.X,k=5.6.1t(D.17("a"),l,g);k.M=j;7(5.6.1S)k.M=k.M.J(f,\'\').J(/ *$/,\'\');h.19.1a(k,h)},1s:B(f){A g=f.J(/(\\s|\\r?\\n)+/g," ");g=g.J(/:/g,".");G g},1t:B(f,g,h){A i=f.M;7(f.R){L(A w=0;w<5.6.1W.I;w++){7(f.R.S()===5.6.1W[w].S()){h=f.R.1X();15}}}f.M=i;f.2J=E;f.2K=E;f.2L=E;f.1b=E;7(5.6.1q===\'2M\'||!f.1c)f.1c=5.6.1Y(g,h);7(5.6.1r)f.1b=\'2N\';g=g.J(/^(\\d) /,\'$1\');f.R=h+\'.\'+g.J(/[. ]+/g,\'.\');C.1u(f,\'2O-2P\',\'2Q\');5.6.T(f,"1Z",5.6.20);5.6.T(f,"21",5.6.22);G f},1Y:B(f,g){A i=5.6.16+\'/1O/2R.1v?2S=\'+f.J(/(\\s|\\r?\\n)+/g,"+")+\'&t=\'+g.1X();G 2T(i)},1w:B(h,g){A f=D.2U(h);g.19.1a(f,g)},1x:B(q,h,n,l,w,v){A p=0,g=n,f=l,r,t,o,j,k=5.6.X,x=E,s=E;7(n){r=5.6.2V.1y(q);7(r){s=1d.1z;o=[g," ",r[2]].24("");f=r[3];j=r[1]}}7(l&&!r){r=5.6.2W.1y(q);7(r){s=1d.1z;o=[g," ",f,":",r[2]].24("");j=r[1]}}7(!r&&5.6.2X.2Y(q)){r=5.6.2Z.1y(q);7(r){A m=1d.30;s=1d.1z;t=s;o=r[2];j=m+r[1];g=r[3];f=r[4];7(r[8]){x=r[8];k=x.J(/\\W/g,"")}}}7(r){7(v){A i=5.6.1s(o),u=k||5.6.X;5.6.1t(v,i,u)}K{7(!t){t=s}5.6.1w(j,h);5.6.1V(o,x===E?r[2]:r[2]+x,k,h);p=5.6.1x(t,h,g,f,k==5.6.X?E:k);p+=2}}K{7(q!==h.25){7(q&&w!=q){5.6.1w(q,h)}h.19.31(h)}}G p},1A:B(f,y,t){A n=t||0;7(n>5.6.1U){G 0}A m=0,l=P,g=(f.26||"").S(),q=f.27?f.27.1Q(" "):[],p=P,v,o,u,x;L(v=0,o=5.6.Y.I;v<o;v++){L(u=0,x=q.I;u<x;u++){7(5.6.Y[v].S()==q[u].S()){p=F;15}}7(p){15}}7(f.28===3){A r=f.25;m=5.6.1x(r,f,E,E,E,y)}K{7(g.I>0&&(!5.6.1B[g]||g==="a")&&!p){y=E;7(g==="a")7(f.29.I===1&&f.1C.28===3&&(5.6.1q!=\'1R\'||!f.1c)){y=f}K{G m}7(g==="32")G m;7(!l){A k=f.29;v=0;2a(v<k.I){A z=5.6.1A(k[v],y,n+1);v+=z+1}}}}G m},20:B(j){A k;j=j||Z.1D;k=j.1b||j.33;2a(k.26.S()!="a"){k=k.19}5.6.1E=k;7(5.6.Q){1F(5.6.1e);5.6.1f(5.6.Q)}5.6.2b=1g(B(){5.6.2c.2d(k)},5.6.2e)},22:B(g){1F(5.6.2b);7(5.6.Q){5.6.1e=1g(B(){5.6.1f(C.U(\'N\'))},5.6.1G)}},2f:B(){A g=D.17("H");g.11.34="35";g.11.36="2g";g.11.37="2g";g.11.38="39";g.1h=\'N\';D.1H.3a(g);5.6.T(g,"1Z",5.6.2h);5.6.T(g,"21",5.6.2i);G g},1f:B(f){7(f)C.1u(f,"2j","3b");5.6.Q=E},2h:B(){1F(5.6.1e)},2i:B(){5.6.1e=1g(B(){5.6.1f(C.U(\'N\'))},5.6.1G)},1i:B(f,k){A a=C.3c(f);A b=C.3d();A c=C.3e();A d=f.3f+18;A e=f.3g;A g=2k(C.U(\'N\').3h,10);A h=2k(C.U(\'N\').3i,10);A i=Z.3j||D.1H.2l||D.3k.2l;7((a[0]+d+g)>c)a[0]-=(g-23);K a[0]+=(d-3l);7((b+i)<(a[1]+h)){a[1]-=(h-9)}K{a[1]+=e}C.1i(k,a)},2c:{3m:B(o){A a=o.3n;7(a){A k=C.U(\'N\');k.M=o.3o;5.6.1i(5.6.1E,k)}},3p:B(o){3q.3r(o)},2d:B(f){A k=C.U(\'N\');7(!k)k=5.6.2f();k.M=\'<H 1h="3s" 1I="3t">\'+\' <H 1I="3u">\'+\' <H><2m>3v 3w 3x</2m></H>\'+\' </H>\'+\' <H 1I="3y">\'+\' <H>3z...</H>\'+\' </H>\'+\'</H>\';5.6.1i(5.6.1E,k);5.6.Q=k;C.1u(k,"2j","3A");5.6.1j(\'/2n/1J/1K/3B.1v?1h=\'+f.R+\'&11=\'+5.6.1T+\'&1b=\'+5.6.1r)}},2o:B(){7(!D.3C("2p")){A f=D.17("3D");f.2q="2r/1L";f.R="3E";f.1c=5.6.16+\'/1L/1J/1K/3F.1L\';f.3G="3H";f.1h="2p";D.V("12")[0].1a(f,D.V("12")[0].1C)}},1j:B(g){A f=D.17("2s");f.2q="2r/3I";f.1m=5.6.16+g;D.V("12")[0].1a(f,D.V("12")[0].1C)},2t:B(y){A a=\'/1P/3J/3K/\';L(A z=0;z<y.I;z++)5.6.1j(a+y[z]+\'.3L\')},T:B(a,b,c){7(a.2u){a.2u(b,c,P)}K{a.3M("3N"+b,c)}G a},2v:B(){7(5.6.2w){G}5.6.2o();5.6.2t([\'2x-2y-1D/2x-2y-1D\']);5.6.1j(\'/2n/1J/1K/3O.1v\');5.6.1B={3P:F,3Q:F,12:F,3R:F,3S:F,3T:F,2s:F,3U:F,3V:F};L(A g 2z 5.6.1p){A f=5.6.1p[g];5.6.1B[f]=F}5.6.2A={};L(g 2z 5.6.Y){5.6.2A[5.6.Y[g]]=F}5.6.2e=3W;5.6.1G=3X;5.6.2w=F},1M:B(){7(1n 1N!="1o"&&1n 1N.2B.C!="1o"&&5.6.2C){C=1N.2B.C;5.6.1A(D.1H)}K{1g(5.6.1M,10)}}};Z.5=5;Z.5.6=5.6;5.6.2v();5.6.T(Z,\'3Y\',5.6.1M);5.6.2C=P;',62,247,'|||||BLB|Tagger|if|||||||||||||||||||||||||||||var|function|Dom|document|null|true|return|div|length|replace|else|for|innerHTML|scriptDiv|___s|false|ContainerToHide|rel|toLowerCase|observe|get|getElementsByTagName||Translation|NoSearchClassNames|window||style|head|__hostname|__s|break|hostname|createElement||parentNode|insertBefore|target|href|RegExp|TmrHideContainer|hideContainer|setTimeout|id|setXY|loadRemoteScripts|__scripts|_s|src|typeof|undefined|NoSearchTagNames|HyperLinks|TargetNewWindow|normalizeReference|addLinkAttributes|setStyle|cfm|insertTextNode|refSearch|exec|rightContext|walkDomTree|NoSearchTags|firstChild|event|TriggerAnchor|clearTimeout|constHideContainer|body|class|remote|toolTip|css|pageInit|YAHOO|search|scripts|split|none|HideVersions|Style|MaxTreeDepth|insertRefNode|supportedT|toUpperCase|generateLink|mouseover|mouseOverHandler|mouseout|mouseOutHandler||join|nodeValue|tagName|className|nodeType|childNodes|while|TmrShowContainer|AjaxObject|startRequest|constShowContainer|createContainer|1px|mouseInContainer|mouseLeavesContainer|visibility|parseInt|scrollTop|h1|modules|loadRemoteCSS|BLBStyle|type|text|script|loadYUI|addEventListener|Init|Initialized|yahoo|dom|in|NoSearchClasses|util|RegExSet|SCRIPT|blbToolTip|BLB_ScriptTagger|NKJV|par|200|onclick|onmouseover|onmouseout|all|BLB_NW|white|space|nowrap|preSearch|Criteria|encodeURI|createTextNode|bcre|ccre|rqt|test|rre|leftContext|removeChild|cite|srcElement|position|absolute|minWidth|minHeight|zIndex|9999999|appendChild|hidden|getXY|getViewportHeight|getViewportWidth|offsetWidth|offsetHeight|clientWidth|clientHeight|pageYOffset|documentElement|40|handleSuccess|TTipID|responseText|handleFailure|console|log|blbTagger|bubble|bubHead|Blue|Letter|Bible|bubBody|Loading|visible|toolTipRemote|getElementById|link|stylesheet|BLBTagger|media|screen|javascript|yui|build|js|attachEvent|on|loadOut|applet|hr|img|input|meta|select|textarea|300|400|load'.split('|'),0,{}))
}}}
{{{
<a style="white-space: nowrap;" rel="NKJV.Isa.25.6-9" href="http://www.blueletterbible.org/search/preSearch.cfm?Criteria=Isa+25.6-9&t=NKJV" target="">Isa 25:6-9</a>
<a style="white-space: nowrap;" rel="NKJV.1Cor.12.31" href="http://www.blueletterbible.org/search/preSearch.cfm?Criteria=1Cor+12.31&t=NKJV" target="">1Cor 12:31</a>
}}}
<a style="white-space: nowrap;" rel="NKJV.1Cor.12.31" href="http://www.blueletterbible.org/search/preSearch.cfm?Criteria=1Cor+12.31&t=NKJV" target="">1Cor 12:31</a>
----
{{{
[[1Cor 12:31 2:12|./Bbl/1Cor.htm#C12V31]]
}}}
[[1Cor 12:31 2:12|./Bbl/1Cor.htm#C12V31]]
----
{{{
[[Matt.5.13-16{{{tag_mid1}}}Matt.+5.13-16{{{tag_mid2}}}Matt. 5:13-16]]
}}}
http://www.pcworld.com/article/116264/brainy_and_brawny_new_laptops.html
Pentium M
/***
|Name:|LessBackupsPlugin|
|Description:|Intelligently limit the number of backup files you create|
|Version:|3.0.1 ($Rev: 2320 $)|
|Date:|$Date: 2007-06-18 22:37:46 +1000 (Mon, 18 Jun 2007) $|
|Source:|http://mptw.tiddlyspot.com/#LessBackupsPlugin|
|Author:|Simon Baird|
|Email:|simon.baird@gmail.com|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
!!Description
You end up with just backup one per year, per month, per weekday, per hour, minute, and second. So total number won't exceed about 200 or so. Can be reduced by commenting out the seconds/minutes/hours line from modes array
!!Notes
Works in IE and Firefox only. Algorithm by Daniel Baird. IE specific code by by Saq Imtiaz.
***/
//{{{
var MINS = 60 * 1000;
var HOURS = 60 * MINS;
var DAYS = 24 * HOURS;
if (!config.lessBackups) {
config.lessBackups = {
// comment out the ones you don't want or set config.lessBackups.modes in your 'tweaks' plugin
modes: [
//["YYYY", 365*DAYS], // one per year for ever
["MMM", 31*DAYS], // one per month
//["ddd", 7*DAYS], // one per weekday
//["d0DD", 1*DAYS], // one per day of month
["h0hh", 24*HOURS], // one per hour
//["m0mm", 1*HOURS], // one per minute
//["s0ss", 1*MINS], // one per second
["latest",0] // always keep last version. (leave this).
]
};
}
window.getSpecialBackupPath = function(backupPath) {
var now = new Date();
var modes = config.lessBackups.modes;
for (var i=0;i<modes.length;i++) {
// the filename we will try
var specialBackupPath = backupPath.replace(/(\.)([0-9]+\.[0-9]+)(\.html)$/,
'$1'+now.formatString(modes[i][0]).toLowerCase()+'$3')
// open the file
try {
if (config.browser.isIE) {
var fsobject = new ActiveXObject("Scripting.FileSystemObject")
var fileExists = fsobject.FileExists(specialBackupPath);
if (fileExists) {
var fileObject = fsobject.GetFile(specialBackupPath);
var modDate = new Date(fileObject.DateLastModified).valueOf();
}
}
else {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
file.initWithPath(specialBackupPath);
var fileExists = file.exists();
if (fileExists) {
var modDate = file.lastModifiedTime;
}
}
}
catch(e) {
// give up
return backupPath;
}
// expiry is used to tell if it's an 'old' one. Eg, if the month is June and there is a
// June file on disk that's more than an month old then it must be stale so overwrite
// note that "latest" should be always written because the expiration period is zero (see above)
var expiry = new Date(modDate + modes[i][1]);
if (!fileExists || now > expiry)
return specialBackupPath;
}
}
// hijack the core function
window.getBackupPath_mptw_orig = window.getBackupPath;
window.getBackupPath = function(localPath) {
return getSpecialBackupPath(getBackupPath_mptw_orig(localPath));
}
//}}}
Very important: when you make a tar ball, you can preserve file attributes of owner and permission. The archive file can then reside on any kind of media. If you just move documents onto other media that isn't unix structured, you lose the attributes.
*scott_documents
*var_www
*zgwarts
*irene
*melisa
{{{*.sb }}} ?
{{{sudo tar -czvf /media/FP_MORSE/home_backup/back_melisa_2009_10_10.tgz /home/melisa --atime-preserve --same-owner --preserve-permissions --exclude='*.iso' --exclude='.beagle' --exclude='.gvfs' --exclude='.thumbnails' --exclude='.VirtualBox' --exclude='.miro' --exclude='.nautilus' --exclude='.Trash'}}}
''Note'' {{{--preserve-permissions}}} may renders a few other switches unnecessary. I doubt the {{{--exclude}}}s work as these folders are a level down ... would like to understand how to make them apply.
''to Restore:''
Unfortunately this really sets up everything in a sub-folder, from when it must be moved. I have to learn how to do this properly.
Also 2nd command below seems to fail; but using Archive Mgr GUI from Gnome Commander does well.
{{{
sudo cp /media/family-morse/BackUp_2010_05_23/home/melisa_2009_10_10.tgz /home/melisa
sudo tar -xvf /home/melisa/melisa_2009_10_10.tgz --atime-preserve --same-owner --preserve-permissions --preserve-order
}}}
!!!General favored methods
*[[Linux_Backup_Scheme]]
*[[http://www.psychocats.net/ubuntu/backup]]
!!!Choosing media
*~ToDo: How and why to avoid NTFS.
*Paper prints of your basic info, incl [[hardware specs|Specs_PC_Mirus]]
!!!Synaptic
#Synaptic > File > Save markings
#Check Save full state, not just changes.
#Save to {{{media/backup/home/me/save_markings_full_state}}}
!!!Package downloads
Download packages (repository)
Download packages (other)
!!!Files
[[RouterSettings]]
[[Tar|Linux_Archive_Tar]] user documents
Tar /var/www/
Copy (not tar) Mozilla user folders
Copy (not tar) /etc/
apt information keys, 3rd party repositories and sources.list
{{{grsync}}} may be good, but prefer {{{cp}}} for now.
!!!Other
Xmarks synch to save Firefox bookmarks.
----
/var/cache/apt/archives => downloaded and newly installed packages. Use {{{dpkg -i}}} to reinstall.
----
/home/scott/.mozilla/firefox/obvjotfm.default => Firefox settings. Mozilla creates a random folder name for each install where it stores your setting. Do NOT archive this folder, but the contents. When restoring, place the contents in the new random folder.
----
/home/melisa/.evolution -- important, has all old emails
F-stop -- photo management (Hmm! Could the ~SqLite data files rest on that hard drive?)
source files for applications => Keep the tarball for reinstall.
fstab
For method, see Linux_Backup.
! More insight needed
* Thunderbird -- Contacts, history ... get info
* Fonts. My ~PDFs are sort of hosed.
! Routine complete
*{{{/etc/}}}
*{{{/var/www/}}}
*tar {{{/home/scott/Desktop,Documents,etc}}}
*tar {{{/home/scott/[other]}}} incl. {{{.mozilla}}}
*tar {{{/home/[users]/Desktop,Documents,etc}}}
*tar {{{/home/[users]/[other]}}} incl. {{{.mozilla}}}
*apt-get 'markings'
*PPA keys
*apt information keys, 3rd party repositories
*sources.list
To boot into recovery mode, if Ubuntu is the only OS, press ''Shift'' during boot.
----
Knoppix will let you mount hard drives, which is critical if you are trying to recover files. Perhaps Mint does also.
{{{sudo cp -rpv /media/PKBACK*/www/sparts4/* /var/www/sparts4}}} -- synch from USB
|{{{history}}} |Use this after an install routine and you have a log of your working procedure. |
|{{{sudo mount -a}}} |reset mounted drives. |
|{{{df -T}}} | ? |
|{{{ls -l}}} |list |
|{{{ifconfig}}} |network link |
|{{{iwconfig}}} | ? |
|{{{uname -m}}} | ? |
|{{{whereis [named app]}}} |Locate [named app] you just downloaded |
|{{{sudo lspci -v}}} |motherboard |
|{{{lspci | grep VGA}}} |video graphics |
|{{{sudo lshw -C video}}} |video graphics (more) |
{{{sudo cp -afvP /etc /media/family-morse/BackUp_2010-05-21}}}
(a=archive, which means: preserve, recursive. v=verbose P=symlinks as links
f=force u=update, only replace changed items
{{{sudo chown -R scott /media/family-morse/BackUp_2010-05-21}}}
{{{cd /usr/share/java :: java -jar cgoban.jar}}} start KGS
{{{dpkg --get-selections | grep tinyproxy}}}
{{{dpkg --get-selections | grep dansguardian}}}
{{{sudo /etc/init.d/tinyproxy restart}}} handy restart
{{{edit /etc/apt/apt.conf}}}
{{{sudo chown -R -v scott /var/www}}} Own all of localhost
{{{sudo chmod -R -v a+rwx /var/www}}} Open permissions
{{{ps aux | sort -nrk 4 | head}}} See what's gobbling memory
{{{killall [named app]}}} Kill [named app] process
{{{apt-cache policy [named app]}}} See version of [named app], when I'm considering an application upgrade
Ever reinstalled an app to find the old configuration still working? This will purge the config files of Ubuntu packages:
{{{sudo aptitude purge `dpkg --get-selections | grep deinstall | awk '{print $1}'`}}}
{{{sudo cp /path/sources.list /path/sources.list.bak}}} Fast-n-ready back-up
{{{sudo echo "xxxxxx" >> /etc/apt/sources.list}}} Add (append) entry to sources.list:
{{{dpkg --get-selections > installed-packages}}} Get a fast text list of what's installed on my system
{{{sudo aptitude autoclean}}} Remove unneeded update packages
{{{sudo apt-key add key_file.gpg}}} add a downloaded key to the repository sources (for aptitude/apt-get)
{{{sudo umount /media/cdrom0/ -l}}} Force CD to eject
Sometimes I need to change a bit of text in several files.
{{{grep -lr -e 'xxxxxx' * | xargs sed -i 's/xxxxxx/yyyyyy/g'}}}
Note: xxxxxx is the word you want to change (replace) and yyyyyy is the new word you want used.
!Hopefully great method:
{{{sudo wget http://ubuntuce.com/repos/Ubuntu_CE/apt/sources.list.d/lucid_i386.list -O /etc/apt/sources.list.d/ubuntuce.list}}}
{{{sudo apt-get update && sudo apt-get install dansguardian-gui}}}
Now you can get to Admin > Configure Parental Controls.
Under System > Admin, find Dansguardian GUI. Select auto-configure/reset.
Note it [[took a few tries|http://ubuntuforums.org/showthread.php?t=1506106]] to get this to work. Try rebooting frequently.
The installer does add UbuntuCE to 'Other Software' in Synaptic' but I can't see where it adds the PPG file under 'Authentication'.
----
''All below now apparently obsolete:''
!Critical files :
etc/tinyproxy/tinyproxy.conf
etc/dansguardian/dansguardian.conf
etc/firehol/firehol.conf
etc/default/firehol: START_UP_DEFAULT=YES
Also probably ports.conf (under apache2)
Thanks to Firehol, the Firefox network setting is "No proxy".
Squid is NOT used.
Another critical fix found at https://answers.launchpad.net/ubuntu/+question/8180
Ensure present in /etc/apt/apt.conf:
Acquire::http::Proxy "http://username:password@proxy:port";
Feb 2009 Ibex: This file seems to not exist; no apt-get problem found, either
BASIC FUNCTIONING TEST
test using www.britishbeer.com (My own entry for test only)
test localhost!
test upgrade manager
EXT. TEST
Testing of all this would consist of trying other Firefox network connect settings, and trying these portal sites that would seem to defy blocking (tho presumably they still screen on words and phrases.)
Step 1 (run in terminal)
echo 'blacklist bcm43xx' | sudo tee -a /etc/modprobe.d/blacklist
sudo apt-get install ndiswrapper-utils-1.9
mkdir ~/bcm43xx; cd ~/bcm43xx
For Step 2, You can check your Broadcom wireless version with this command in terminal : "lspci | grep Broadcom\ Corporation",if your wireless device is different from BCM4312 (rev 02), please refer to the following link for this step and you can continue again with step 3 onwards:
https://help.ubuntu.com/community/Wi...f971ca757b2851
Step 2 (run in terminal)
sudo apt-get install cabextract
wget ftp://ftp.compaq.com/pub/softpaq/sp3...00/sp34152.exe
cabextract sp34152.exe
Step 3 (run in terminal)
sudo ndiswrapper -i bcmwl5.inf
ndiswrapper -l
sudo depmod -a
sudo modprobe ndiswrapper
sudo cp /etc/network/interfaces /etc/network/interfaces.orig
echo -e 'auto lo\niface lo inet loopback\n' | sudo tee /etc/network/interfaces
sudo ndiswrapper -m
echo 'ndiswrapper' | sudo tee -a /etc/modules
echo 'ENABLED=0' | sudo tee -a /etc/default/wpasupplicant
Step 4 (run in terminal)
sudo aptitude remove b43-fwcutter
Step 5 (run in terminal)
sudo gedit /etc/init.d/wirelessfix.sh
Step 6
Paste the followings in the opened file(wirelessfix.sh)and make sure you save it before continuing Step 7
#!/bin/bash
modprobe -r b44
modprobe -r b43
modprobe -r b43legacy
modprobe -r ssb
modprobe -r ndiswrapper
modprobe ndiswrapper
modprobe b44
Step 7 (run in terminal)
Run this :
cd /etc/init.d/ && sudo chmod 755 wirelessfix.sh
Step 8 (run in terminal)
finally run this:
sudo update-rc.d wirelessfix.sh defaults
Step 9
Restart your machine and enjoy the freedom from those wires....
----
sudo iwconfig wlan0
Install a .bin: go to location, fix permissions, run
{{{
cd Desktop
sudo chmod a+x nameofthefile.bin.
ls -l ...check permissions
./nameofthefile.bin ...run the install (./ prefix)
}}}
Install deb: go to location, fix permissions.
{{{
sudo dpkg -i install_flash_player_10_linux.deb
}}}
[[MySQL_General]] for installation and more
!phpMyAdmin Install
Agree to these defaults:
Web server to reconfigure automatically: {{{apache2}}}
Configure database for phpmyadmin with dbconfig-common? YES
!Java
{{{sun-java6-jre}}} -- much preferred apparently over openjdk, which may need to be removed.
Have a Sun Microsystems user login (late you will be cued to "register your product."
Download JDK .bin. Install:
{{{
cd Downloads
sudo chmod +rwx jdk*
sudo ./jdk*
}}}
Hmm. Well this worked at any rate (make sure Synaptic is closed:
{{{
88 sudo gpg --keyserver subkeys.pgp.net --recv 9AA38DCD55BE302B
89 sudo gpg --export --armor 9AA38DCD55BE302B | apt-key add-
}}}
Maybe a few errors etc. Then open Synaptic, search on Java6 and install.
Download NetBeans sh package.
{{{
sudo chmod -R a+rwx net*
sudo ./net*
}}}
legacy notes:
{{{
scott@scott-desktop:~/.netbeans/6.7$ sudo chmod -R -v a+rwx netbeans-6*
scott@scott-desktop:~/.netbeans$ ./netbeans-6.7.1-ml-linux.sh
}}}
Configuring the installer...
To get xDebug going:
sudo apt-get install php5-dev
strike above, use:
sudo apt-get install php5-xdebug
Add to php.ini:
zend_extension=/usr/lib/php5/20051025/xdebug.so
xdebug.remote_enable=on
sudo apt-get install php-pear
sudo pear channel-discover pear.phpunit.de
pear install phpunit/PHPUnit
=====================================
Kommander does not apply ... it's for scripts.
KImageMapEditor will be useful for HTML image mapping perhaps. No help files?!
KompoZer seems promising, but is dumb-down WZWIG. Some provision for PHP. CSS strong. Help strong
Bluefish seems strong on PHP and maybe image thumb is good.
Screem maybe no.
Quanta OK but not as good as BF. No PHP? Incorporates KImageMapEditor.
gPHPEdit. Sparse but clean interface, with block folding. Side bar allows explore of user-created functions.
SciTE is Very spare, but marks the code well, block folding, and (possibly) debug. SciTE claims apparently to translate straight writing into code of targeted program.
For printing, most programs above don't function. Gedit (default Text Editor) does adequately with viewing and printing with syntax highlighting, however.
XDEBUG windows
Precompiled Modules
There are a few precompiled modules for Windows, they are all for the non-debug version of PHP. See the links on the right side.
Installing the precompiled modules is easy. Just place them in a directory, and add the following line to php.ini: (don't forget to change the path and filename to the correct one � but make sure you use the full path). Also, somethings the quotes (") should be removed.
zend_extension_ts="c:/php/modules/php_xdebug-4.4.1-2.0.5.dll"
!How do I make my internal hard drive available to any user upon boot up?
Before starting, unmount all 2nd-tier drives
{{{
sudo fdisk -l
sudo mkdir /media/family-morse
sudo gedit /etc/fstab
}}}
Add to fstab: {{{ /dev/sdb1 /media/family-morse ext4 users,exec 0 0}}}
{{{sudo mount -a}}} to see how it goes
[[Source|http://www.nyutech.com/2009/03/make-ubuntu-mount-partitions-and-drives.html]]
~ToDo: check the fstab line for correctness {{{exec}}}
Fresh install partitioning. Any need for swap space? If so, is a manual partition called for?
!!Preparation:
*[[Back up|Linux_Backup_Scheme]] everything.
*have a record of your hardware: [[Specs_PC_Mirus]]
*have a record of your plan (this tiddler).
*Have these ready on flash drive.
*Have these ready on paper (unwieldy, but could help in a catastrophe).
*have a record of your hardware: [[Specs_PC_Mirus]]
!!Install from CD
*Get Ubuntu from [[www.ubuntu.com]].
**Avoid any release that is very new as it will have bugs.
**ISO image on CD; 32, not 64;
**Desktop edition, not server.
**Internet access good.
**Sticking with Gnome (not KDE).
*Install Ubuntu from CD
**Step 3 = keyboard
**Step 4 = Partitioning: keep it simple. 'Erase and use the entire disk'
**Step 5 -- name, user name (logon), password, computer name (default)
**Step 6 seems not to exist!
**Step 7 is final confirm of details; then wait for 25 min.
**Initial install is complete; reboot.
!!First boot without CD
*{{{sudo apt-get purge gnome-power-manager}}} (This malfunctions.)
*Preferences ''Screen Saver'' -- Uncheck 'activate screen saver when computer is idle'
*Run Update Manager -- there will be much (220+ Mb; 30+ minutes). Reboot
*''nVidia'' -- Administration > Hardware Drivers; Set up the restricted drivers for your graphics card. (Pick 173, not 96)
*Reboot. Now start making use of local resources:
##USB flash drive gives you access to your notes.
##An internal HD provides your backups. Note that you need to open it from the 'Places' menu to have access to it from other applications such as Synaptic Package Manager. Since you're rebooting often, you'll tend to trip over this.
*Linux_Tweaks -- set 'early tweaks'
!!Install Net Filtering
*Linux_Dansguardian_setup
!!Restore Applications
* Open Synaptic.
## Under Preferences, show all columns; choose the system fonts; 'Show package properties in the main window'.
## Repositories: Other Software: activate //...canonical.com/ubuntu lucid partner//
## Repositories: Other Software: ~ToDo: Learn how to add APT lines for repository
*** {{{deb http://dl.google.com/linux/deb/ stable non-free main}}}
*** [[Useful source||http://anotherugly.wordpress.com/my-ubuntu-10-04-lucid-lynx-sources-list/]]
## PPA keys for repository: Use "Import Keys" and locate and add your backups of these files.
* Copy your {{{/media/backup/etc/apt}}} directory to the new system ''OR'' Have it ready at hand for reference or selective import
* {{{sudo apt-get update}}}. Reboot.
!! Make a safety backup
{{{
sudo tar -czvf /media/FP_MORSE/LX_backup/early_scott.tgz /home/scott --atime-preserve --same-owner --preserve-permissions --exclude='*.iso' --exclude='.gvfs'
sudo tar -czvf /media/FP_MORSE/LX_backup/early_etc.tgz /etc --atime-preserve --same-owner --preserve-permissions
}}}
* Import Synaptic Markings from file. //Synaptic > File > Read markings//
** {{{/media/backup/home/me/save_markings_best_deinstall}}} ''Toss out some unwanted items!''
** {{{/media/backup/home/me/save_markings_best}}} ''250+ packages, 1.5 Gb'' It takes 30 minutes and takes occasional attention as there will be some password and configuration prompts -- see [[Linux_LAMP_WebDev_setup]]. Dialog boxes may not stack up properly; if stuck, look for a dialog box underneath.
* Check for broken packages (filter in Synaptic)
* Check for missing recommends (filter in Synaptic)
!! Restore your files
* Currently I use Gnome Commander. After opening, chose "open as root".
* ''Home files''
** ~ToDo -- Mozilla
** ~ToDo -- Odd snafus (symlinks, gksu)
** ~ToDo -- file ownership
* ''Localhost files''
** Extract {{{var/www/}}}
** Make all files owned by Scott with open permissions
**Browse to {{{http://localhost/php_info.php}}} -- ''Joy!'' Xdebug is showing!
*''F-Stop''
**Preferences: Set home folder (dedicated drive); Set info to be stored 'with image where possible.'
** import all photos.
**{{{~/.config/f-spot/photos.db}}} has the Sqlite back-end ([[Source|http://f-spot.org/Database]])
!! Firefox configuration
*[[Firefox_Config]]
*Test filter using [[this site|http://stupidlicious.com]].
*{{{ping localhost -c 3}}} (see if localhost is recognized)
!! Questionable Details
*Copy your {{{/media/backup/home}}} to {{{/home}}}
*Reboot to see your restored desktop and settings.
!! More tweaks
*Linux_Tweaks -- set 'later tweaks'
!! Make a safety backup
*This is your good basic solid re-install!
!! Other Users
*Linux_UsersAdmin to set up users
*Linux_MountDrive to set up second hard drive for access by all
*Linux_Archive_Tar to restore user files
*[[Home_Email]]
!! Home network and WiFi
*~Todo ...
!! Misc. Final
*Get user folders for Firefox populated before log on
*Install Gentium typeface (repository seems to be off as of Lucid -- go to [[http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&item_id=Gentium|SIL site]])
!! Enable playing DVD movies
*VLC engages DVD better than Totem-gstreamer.
*{{{sudo /usr/share/doc/libdvdread4/install-css.sh}}} (requires ubuntu-restricted-extras)
*System > Admin > NVidia X server setttings
> Display Config > Resolution: Screen res 1280 x 960, 60 Hz, solves monitor blink.
Apply. Save to X Config file 'failed to parse existing -- ignore this'
Lucid w/ Nvidia driver, ~VG2021m ~ViewSonic.
Nvidia 3DForce FX5600
!Early Tweaks
* [[Linux_SystemGraphics]]
*Open 'Change Desktop Background' (right-click on desktop)
##Set background color to suitable deep dark teal
##Set fonts to Liberation Sans and Deja Vu
##Set 'look' to ~ClearLooks
!Later Tweaks
install {{{ubuntu-tweaks}}} looks painless and helpful ... but is not tested.
{{{sudo addgroup family-morse}}}
{{{sudo useradd -m zgwartz}}}
{{{sudo passwd zgwartz}}} (prompt follows)
{{{sudo adduser zgwartz family-morse}}} (add yourself too)
*Use GUI app (you noob) to change "Full Name" for each.
*Also, 'Advanced Settings' to allow all permissions (except system admin, which is just for the root user myself).
| Application | user | password | comment |h
|Melisa <br>@grandecom.net | melisamorse | alison |[[Home_Email]] |
|Scott <br>@grandecom.net | | grande06 | |
|Home Linux | scott | shm10 _ _ _ | |
|>|>|>| FTP |h
|Kulik -- Man Thursday <br>74.52.167.34<br>ftp.themanthursday.com | themant | 21c1990 | |
|Kulik -- Sparts <br>74.52.59.210<br>ftp.spapartscenter.com | spaparts | p5m7g9cs | |
|office.fountainpeople.com <br>192.168.0.15 | [email] | w3system | |
|>|>|>| ??? |h
|Sparts | [email] | figaro12 | |
|>|>|>| Apps |h
|phpDesigner 2008 | Scott Morse |>| http://www.mpsoftware.dk |
|>|>|>| Key: {{{0D5DBDCF9BA6A6FA6FA6FA6FA6F40F40F40F10F10F50FD0F2F15E2BC4788}}}|
[[Plan Wiki|./planning_wiki.htm]]
[[Scott Wiki|./scott_wiki.htm]]
[[Bible Wiki|./bible_wiki.htm]]
[[Share Wiki|./sharedwiki.htm]]
[[Meta Wiki|./meta_wiki.htm]]
[[Blog|http://themanthursday.com]]
----
[[GettingStarted]]
[[TidW_HowTo]]
----
~To.Do is NOT a tag.
It is a term that can
be searched on.
Enter it with the tilde!
Stub is the same.
----
Tags are all lower case
unless the tag has a
dedicated tiddler
(or might soon).
----
''How do I use the ~MaroonBytes setup?''
# Get compete download. [[www.maroonbytes.com|http://www.maroonbytes.com/codeigniter/ultimate-codeigniter-setup/]]
# Ensure ~SimpleTest is latest version.
# Understand how to make a test.
# Understand how to ''name'' a test.
# Improve window title: {{{$test->_label = 'Test Suite';}}}
# If getting deprecated errors from ~SimpleTest files,
## replace all {{{= &new}}} with {{{= new}}} (many instances)
## replace all {{{&$test}}} with {{{$test}}} (2 instances)
/***
|Name|MatchTagsPlugin|
|Source|http://www.TiddlyTools.com/#MatchTagsPlugin|
|Documentation|http://www.TiddlyTools.com/#MatchTagsPluginInfo|
|Version|2.0.0|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Description|'tag matching' with full boolean expressions (AND, OR, NOT, and nested parentheses)|
!!!!!Documentation
> see [[MatchTagsPluginInfo]]
!!!!!Revisions
<<<
2008.09.04 [2.0.0] added "report" and "panel" options to generate formatted results and store in a tiddler. Also, added config.macros.matchTags.formatList(place,fmt,sep) API to return formatted output for use with other plugins/scripts
| please see [[MatchTagsPluginInfo]] for additional revision details |
2008.02.28 [1.0.0] initial release
<<<
!!!!!Code
***/
//{{{
version.extensions.MatchTagsPlugin= {major: 2, minor: 0, revision: 0, date: new Date(2008,9,4)};
// store.getMatchingTiddlers() processes boolean expressions for tag matching
// sortfield (optional) sets sort order for tiddlers - default=title
// tiddlers (optional) use alternative set of tiddlers (instead of current store)
TiddlyWiki.prototype.getMatchingTiddlers = function(tagexpr,sortfield,tiddlers) {
var debug=config.options.chkDebug; // abbreviation
var cmm=config.macros.matchTags; // abbreviation
var r=[]; // results are an array of tiddlers
var tids=tiddlers||store.getTiddlers(sortfield||"title");
if (tiddlers && sortfield) store.sortTiddlers(tids,sortfield);
if (debug) displayMessage(cmm.msg1.format([tids.length]));
// try simple lookup to quickly find single tags or tags that
// contain boolean operators as literals, e.g. "foo and bar"
for (var t=0; t<tids.length; t++)
if (tids[t].isTagged(tagexpr)) r.pushUnique(tids[t]);
if (r.length) {
if (debug) displayMessage(cmm.msg4.format([r.length,tagexpr]));
return r;
}
// convert expression into javascript code with regexp tests,
// so that "tag1 AND ( tag2 OR NOT tag3 )" becomes
// "/\~tag1\~/.test(...) && ( /\~tag2\~/.test(...) || ! /\~tag3\~/.test(...) )"
// normalize whitespace, tokenize operators, delimit with "~"
var c=tagexpr.trim(); // remove leading/trailing spaces
c = c.replace(/\s+/ig," "); // reduce multiple spaces to single spaces
c = c.replace(/\(\s?/ig,"~(~"); // open parens
c = c.replace(/\s?\)/ig,"~)~"); // close parens
c = c.replace(/(\s|~)?&&(\s|~)?/ig,"~&&~"); // &&
c = c.replace(/(\s|~)AND(\s|~)/ig,"~&&~"); // AND
c = c.replace(/(\s|~)?\|\|(\s|~)?/ig,"~||~"); // ||
c = c.replace(/(\s|~)OR(\s|~)/ig,"~||~"); // OR
c = c.replace(/(\s|~)?!(\s|~)?/ig,"~!~"); // !
c = c.replace(/(^|~|\s)NOT(\s|~)/ig,"~!~"); // NOT
c = c.replace(/(^|~|\s)NOT~\(/ig,"~!~("); // NOT(
// change tag terms to regexp tests
var terms=c.split("~"); for (var i=0; i<terms.length; i++) { var t=terms[i];
if (/(&&)|(\|\|)|[!\(\)]/.test(t) || t=="") continue; // skip operators/parens/spaces
if (t==config.macros.matchTags.untaggedKeyword)
terms[i]="tiddlertags=='~~'"; // 'untagged' tiddlers
else
terms[i]="/\\~"+t+"\\~/.test(tiddlertags)";
}
c=terms.join(" ");
if (debug) { displayMessage(cmm.msg2.format([tagexpr])); displayMessage(cmm.msg3.format([c])); }
// scan tiddlers for matches
for (var t=0; t<tids.length; t++) {
// assemble tags from tiddler into string "~tag1~tag2~tag3~"
var tiddlertags = "~"+tids[t].tags.join("~")+"~";
try { if(eval(c)) r.push(tids[t]); } // test tags
catch(e) { // error in test
displayMessage(cmm.msg2.format([tagexpr]));
displayMessage(cmm.msg3.format([c]));
displayMessage(e.toString());
break; // skip remaining tiddlers
}
}
if (debug) displayMessage(cmm.msg4.format([r.length,tagexpr]));
return r;
}
//}}}
//{{{
config.macros.matchTags = {
msg1: "scanning %0 input tiddlers",
msg2: "looking for '%0'",
msg3: "using expression: '%0'",
msg4: "found %0 tiddlers matching '%1'",
noMatch: "no matching tiddlers",
untaggedKeyword: "-",
untaggedLabel: "no tags",
untaggedPrompt: "show tiddlers with no tags",
defTiddler: "MatchingTiddlers",
defFormat: "%0",
defSeparator: "\n",
reportHeading: "Found %0 tiddlers tagged with: '{{{%1}}}'\n----\n",
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
var mode=params[0]?params[0].toLowerCase():'';
if (mode=="inline")
params.shift();
if (mode=="report" || mode=="panel") {
params.shift();
var target=params.shift()||this.defTiddler;
}
if (mode=="popup") {
params.shift();
if (params[0]&¶ms[0].substr(0,6)=="label:") var label=params.shift().substr(6);
if (params[0]&¶ms[0].substr(0,7)=="prompt:") var prompt=params.shift().substr(7);
} else {
var fmt=(params.shift()||this.defFormat).unescapeLineBreaks();
var sep=(params.shift()||this.defSeparator).unescapeLineBreaks();
}
var sortBy="+title";
if (params[0]&¶ms[0].substr(0,5)=="sort:") sortBy=params.shift().substr(5);
var expr = params.join(" ");
if (mode!="panel" && (!expr||!expr.trim().length)) return;
if (expr==this.untaggedKeyword)
{ var label=this.untaggedLabel; var prompt=this.untaggedPrompt };
switch (mode) {
case "popup": this.createPopup(place,label,expr,prompt,sortBy); break;
case "panel": this.createPanel(place,expr,fmt,sep,sortBy,target); break;
case "report": this.createReport(target,expr,fmt,sep,sortBy); break;
case "inline": default: this.createInline(place,expr,fmt,sep,sortBy); break;
}
},
formatList: function(tids,fmt,sep) {
var out=[];
for (var t=0; t<tids.length; t++) {
var title="[["+tids[t].title+"]]";
var who=tids[t].modifier;
var when=tids[t].modified.toLocaleString();
var text=tids[t].text;
var first=tids[t].text.split("\n")[0];
var desc=store.getTiddlerSlice(tids[t].title,"description");
desc=desc||store.getTiddlerSlice(tids[t].title,"Description");
desc=desc||store.getTiddlerText(tids[t].title+"##description");
desc=desc||store.getTiddlerText(tids[t].title+"##Description");
out.push(fmt.format([title,who,when,text,first,desc]));
}
return out.join(sep);
},
createInline: function(place,expr,fmt,sep,sortBy) {
wikify(this.formatList(store.sortTiddlers(store.getMatchingTiddlers(expr),sortBy),fmt,sep),place);
},
createPopup: function(place,label,expr,prompt,sortBy) {
var btn=createTiddlyButton(place,
(label||expr).format([expr]),
(prompt||config.views.wikified.tag.tooltip).format([expr]),
function(ev){ return config.macros.matchTags.showPopup(this,ev||window.event); });
btn.setAttribute("sortBy",sortBy);
btn.setAttribute("expr",expr);
},
showPopup: function(here,ev) {
var p=Popup.create(here); if (!p) return false;
var tids=store.getMatchingTiddlers(here.getAttribute("expr"));
store.sortTiddlers(tids,here.getAttribute("sortBy"));
var list=[]; for (var t=0; t<tids.length; t++) list.push(tids[t].title);
if (!list.length) createTiddlyText(p,this.noMatch);
else {
var b=createTiddlyButton(createTiddlyElement(p,"li"),
config.views.wikified.tag.openAllText,
config.views.wikified.tag.openAllTooltip,
function() {
var list=this.getAttribute("list").readBracketedList();
story.displayTiddlers(null,tids);
});
b.setAttribute("list","[["+list.join("]] [[")+"]]");
createTiddlyElement(p,"hr");
}
var out=this.formatList(tids," %0 ","\n"); wikify(out,p);
Popup.show(p,false);
ev.cancelBubble=true;
if(ev.stopPropagation) ev.stopPropagation();
return false;
},
createReport: function(target,expr,fmt,sep,sortBy) {
var tids=store.sortTiddlers(store.getMatchingTiddlers(expr),sortBy);
if (!tids.length) { displayMessage('no matches for: '+expr); return false; }
var msg=config.messages.overwriteWarning.format([target]);
if (store.tiddlerExists(target) && !confirm(msg)) return false;
var out=this.reportHeading.format([tids.length,expr])
out+=this.formatList(tids,fmt,sep);
store.saveTiddler(target,target,out,config.options.txtUserName,new Date(),[],{});
story.closeTiddler(target); story.displayTiddler(null,target);
},
createPanel: function(place,expr,fmt,sep,sortBy,tid) {
var html="<form style='display:inline'><!-- \
--><input type='text' name='expr' style='width:55%' title='tag expression'><!-- \
--><input type='text' name='fmt' style='width:10%' title='list item format'><!-- \
--><input type='text' name='sep' style='width:5%' title='list item separator'><!-- \
--><input type='text' name='tid' style='width:20%' title='target tiddler title'><!-- \
--><input type='button' name='go' style='width:8%' value='go' onclick=\" \
var expr=this.form.expr.value; \
if (!expr.length) { alert('Enter a boolean tag expression'); return false; } \
var fmt=this.form.fmt.value; \
if (!fmt.length) { alert('Enter the list item output format'); return false; } \
var sep=this.form.sep.value.unescapeLineBreaks(); \
var tid=this.form.tid.value; \
if (!tid.length) { alert('Enter a target tiddler title'); return false; } \
config.macros.matchTags.createReport(tid,expr,fmt,sep,'title'); \
return false;\"> \
</form>";
var s=createTiddlyElement(place,"span"); s.innerHTML=html;
var f=s.getElementsByTagName("form")[0];
f.expr.value=expr; f.fmt.value=fmt; f.sep.value=sep.escapeLineBreaks(); f.tid.value=tid;
}
};
//}}}
//{{{
// SHADOW TIDDLER for displaying default panel input form
config.shadowTiddlers.MatchTags="{{smallform{<<matchTags panel>>}}}";
//}}}
//{{{
// TWEAK core filterTiddlers() for enhanced boolean matching in [tag[...]] syntax:
// use getMatchingTiddlers instead getTaggedTiddlers
var fn=TiddlyWiki.prototype.filterTiddlers;
fn=fn.toString().replace(/getTaggedTiddlers/g,"getMatchingTiddlers");
eval("TiddlyWiki.prototype.filterTiddlers="+fn);
//}}}
//{{{
// REDEFINE core handler for enhanced boolean matching in tag:"..." paramifier
// use filterTiddlers() instead of getTaggedTiddlers() to get list of tiddlers.
config.paramifiers.tag = {
onstart: function(v) {
var tagged = store.filterTiddlers("[tag["+v+"]]");
story.displayTiddlers(null,tagged,null,false,null);
}
};
//}}}
/***
|''Name''|MediaWikiTableFormatterPlugin @@SDM -- this is in use! (pettydetail)@@ |
|''Description''|Allows MediaWiki style tables in TiddlyWiki|
|''Author''|Martin Budden (mjbudden (at) gmail (dot) com)|
|''Contributors''|FND|
|''Version''|0.1.2|
|''Status''|stable|
|''Source''|http://devpad.tiddlyspot.com/#MediaWikiTableFormatterPlugin|
|''CodeRepository''|http://svn.tiddlywiki.org/Trunk/contributors/MartinBudden/formatters/MediaWikiTableFormatterPlugin.js|
|''License''|[[Creative Commons Attribution-ShareAlike 3.0 License|http://creativecommons.org/licenses/by-sa/3.0/]]|
|''~CoreVersion:''|2.1.0|
!Description
Enables [[MediaWiki|http://www.mediawiki.org]]'s table markup in TiddlyWiki, allowing for multi-line contents within table cells.
(Note that all TiddlyWiki markup still applies.)
!Usage
Detailed documentation available at [[MediaWiki.org|http://www.mediawiki.org/wiki/Help:Tables]].
!!Examples
{{{
{|
! Heading 1
! Heading 2
! Heading 3
|-
| row 1, column 1
| row 1, column 2
| row 1, column 3
|-
| row 2, column 1
| row 2, column 2
| row 2, column 3
|}
}}}
{|
! Heading 1
! Heading 2
! Heading 3
|-
| row 1, column 1
| row 1, column 2
| row 1, column 3
|-
| row 2, column 1
| row 2, column 2
| row 2, column 3
|}
!Revision History
!!v0.1 (2008-10-31)
* initial release
!!v0.1.2 (2008-11-05)
* removed unnecessary code
!Code
***/
//{{{
if(!version.extensions.MediaWikiTableFormatterPlugin) { //# ensure that the plugin is only installed once
version.extensions.MediaWikiTableFormatterPlugin = {installed:true};
if(version.major < 2 || (version.major == 2 && version.minor < 1)) {
alertAndThrow('MediaWikiTableFormatterPlugin requires TiddlyWiki 2.1 or later.');
}
config.formatters.push({
name: 'enhancedTable',
match: '^\\{\\|',
handler: function(w) {
var pair = MediaWikiTemplate.findTableBracePair(w.source,w.matchStart);
if(pair.start==w.matchStart) {
w.nextMatch = w.matchStart;
var table = MediaWikiTemplate.createElement(w.output,'table');
var tbody = MediaWikiTemplate.createElement(table,'tbody'); // required for IE
var mwt = new MediaWikiTemplate();
mwt.wikifyTable(tbody,w,pair);
}
}
});
MediaWikiTemplate = function()
{
this.stack = [];
this.error = false;
this.tiddler = null;
};
MediaWikiTemplate.createElement = function(parent,element)
{
return parent.appendChild(document.createElement(element));
}
MediaWikiTemplate.setAttributesFromParams = function(e,p)
{
var re = /\s*(.*?)=(?:(?:"(.*?)")|(?:'(.*?)')|((?:\w|%|#)*))/mg;
var match = re.exec(p);
while(match) {
var s = match[1].unDash();
if(s == 'bgcolor') {
s = 'backgroundColor';
}
try {
if(match[2]) {
e.setAttribute(s,match[2]);
} else if(match[3]) {
e.setAttribute(s,match[3]);
} else {
e.setAttribute(s,match[4]);
}
}
catch(ex) {}
match = re.exec(p);
}
};
MediaWikiTemplate.findRawDelimiter = function(delimiter,text,start)
//# find a delimiter that is not enclosed by [[..]]
{
var d = text.indexOf(delimiter,start);
if(d==-1)
return -1;
var b = {start:-1,end:-1};
var bs = text.indexOf('[[',start);
if(bs==-1 || bs >d)
return d;
var s1 = -1;
if(bs!=-1 && bs <d) {
var be = text.indexOf(']]',bs);
if(be!=-1) {
b.start = bs;
b.end = be;
}
}
if(b.start!=-1 && d>b.start)
s1 = b.end+2;
return s1==-1 ? d : MediaWikiTemplate.findRawDelimiter(delimiter,text,s1);
};
MediaWikiTemplate.findTableBracePair = function(text,start)
{
var ret = {start:-1,end:-1};
var s = text.indexOf('{|',start);
if(s==-1)
return ret;
var e = text.indexOf('\n|}',s+2);
if(e==-1)
return ret;
e++;
var s2 = text.indexOf('{|',s+2);
if(s2==-1 || s2 > e)
return {start:s,end:e};
var tp = MediaWikiTemplate.findTableBracePair(text,s+2);
while(tp.end!=-1 && e>tp.start && e<=tp.end) {
//# intervening table brace pair, so skip over
e = tp.end+2;
tp = MediaWikiTemplate.findTableBracePair(text,e);
e = text.indexOf('\n|}',e);
if(e==-1)
return ret;
e++;
}
return {start:s,end:e};
};
MediaWikiTemplate.prototype.wikifyTable = function(table,w,pair)
{
function lineEnd(w) {
var r = w.source.indexOf('\n',w.nextMatch);
while(r!=-1) {
var n = w.source.substr(r+1,1);
if(n=='|' || n=='!' || (n=='{' && w.source.substr(r+2,1)=='|'))
break;
r = w.source.indexOf('\n',r+1);
}
return r;
}
function subWikifyText(e,w,text) {
var oldSource = w.source; var oldMatch = w.nextMatch;
w.source = text; w.nextMatch = 0;
w.subWikifyUnterm(e);
w.source = oldSource; w.nextMatch = oldMatch;
}
//# skip over {|
w.nextMatch += 2;
var i = lineEnd(w);
if(i>w.nextMatch) {
MediaWikiTemplate.setAttributesFromParams(table.parentNode,w.source.substring(w.nextMatch,i));
w.nextMatch = i;
}
w.nextMatch++;
if(w.source.substr(w.nextMatch,2)=='|+') {
var caption = MediaWikiTemplate.createElement(table,'caption');
w.nextMatch += 2;
i = lineEnd(w);
var d = MediaWikiTemplate.findRawDelimiter('|',w.source,w.nextMatch);
if(d!=-1 && d<i) {
MediaWikiTemplate.setAttributesFromParams(caption,w.source.substring(w.nextMatch,d));
w.nextMatch = d+1;
}
w.subWikifyTerm(caption,/(\n)/mg);
}
var tr = MediaWikiTemplate.createElement(table,'tr');
if(w.source.substr(w.nextMatch,2)=='|-') {
w.nextMatch += 2;
i = lineEnd(w);
if(i>w.nextMatch) {
MediaWikiTemplate.setAttributesFromParams(tr,w.source.substring(w.nextMatch,i));
w.nextMatch = i;
}
w.nextMatch++;
}
var x = w.source.substr(w.nextMatch,2);
while(x!='|}') {
if(x=='{|') {
//# nested table
var pair2 = MediaWikiTemplate.findTableBracePair(w.source,w.nextMatch);
if(pair2.start==w.nextMatch) {
var table2 = MediaWikiTemplate.createElement(cell,'table');
this.wikifyTable(table2,w,pair2);
}
} else if(x=='|-') {
//# new row
tr = MediaWikiTemplate.createElement(table,'tr');
w.nextMatch += 2;
i = lineEnd(w);
if(i==-1)
break;
if(i>w.nextMatch) {
MediaWikiTemplate.setAttributesFromParams(tr,w.source.substring(w.nextMatch,i));
w.nextMatch = i;
}
w.nextMatch++;
} else if(x.substr(0,1)=='!') {
//# header cell
w.nextMatch++;
i = lineEnd(w);
if(i==-1)
break;
var cell = MediaWikiTemplate.createElement(tr,'th');
var c = w.source.indexOf('!!',w.nextMatch);
while(c!=-1 && c<i) {
d = MediaWikiTemplate.findRawDelimiter('|',w.source,w.nextMatch);
if(d!=-1 && d<c) {
MediaWikiTemplate.setAttributesFromParams(cell,w.source.substring(w.nextMatch,d));
w.nextMatch = d+1;
}
while(w.source.substr(w.nextMatch,1)==' ') {
w.nextMatch++;
}
w.subWikifyTerm(cell,/(\!\!)/mg);
cell = MediaWikiTemplate.createElement(tr,'th');
c = w.source.indexOf('!!',w.nextMatch);
}
d = MediaWikiTemplate.findRawDelimiter('|',w.source,w.nextMatch);
if(d!=-1 && d<i) {
MediaWikiTemplate.setAttributesFromParams(cell,w.source.substring(w.nextMatch,d));
w.nextMatch = d+1;
}
while(w.source.substr(w.nextMatch,1)==' ') {
w.nextMatch++;
}
subWikifyText(cell,w,w.source.substring(w.nextMatch,i));
w.nextMatch = i+1;
} else if(x.substr(0,1)=='|') {
//# cell
w.nextMatch++;
i = lineEnd(w);
if(i==-1)
break;
cell = MediaWikiTemplate.createElement(tr,'td');
c = w.source.indexOf('||',w.nextMatch);
while(c!=-1 && c<i) {
d = MediaWikiTemplate.findRawDelimiter('|',w.source,w.nextMatch);
if(d!=-1 && d<c) {
MediaWikiTemplate.setAttributesFromParams(cell,w.source.substring(w.nextMatch,d));
w.nextMatch = d+1;
}
while(w.source.substr(w.nextMatch,1)==' ') {
w.nextMatch++;
}
w.subWikifyTerm(cell,/(\|\|)/mg);
cell = MediaWikiTemplate.createElement(tr,'td');
c = w.source.indexOf('||',w.nextMatch);
}
d = MediaWikiTemplate.findRawDelimiter('|',w.source,w.nextMatch);
if(d!=-1 && d<i) {
MediaWikiTemplate.setAttributesFromParams(cell,w.source.substring(w.nextMatch,d));
w.nextMatch = d+1;
}
while(w.source.substr(w.nextMatch,1)==' ') {
w.nextMatch++;
}
subWikifyText(cell,w,w.source.substring(w.nextMatch,i));
w.nextMatch = i+1;
}
x = w.source.substr(w.nextMatch,2);
}
w.nextMatch = pair.end + 3;
return;
};
} //# end of 'install only once'
//}}}
http://twhelp.tiddlyspot.com/#MemorizablePlugin
/***
!!!<<gradient horiz #fc3 #fff>> MemorizablePlugin^^<<tiddler CloseThisOpen with: ThirdPartyPlugins '� back'>>|<<toolbar editTiddler>>» ^^>>
|Name|MemorizablePlugin|
|Source|URL: http://memorizable.com|
|Version|1.0.0|
|Author|Craig D. Muth Copyright (c) 2007|
|Description|Creats flashcard like tables for memorizing data|
|For use in TiddlyWiki see|http://tinyurl.com/34fjk6|
***/
//{{{
// License
//
// Note: This is a modified version of the X11 (aka MIT) open source
// license. It lets you use, modify, distribute and sell, etc.,
// requiring only that you leave the "Help" and "About Memorizable
// Tables" links (under "Options") in tact. If you desire to use the
// software without these links please contact the author.
//
// COPYRIGHT AND PERMISSION NOTICE for Memorizable Tables
//
// Copyright (c) 2007, Craig D. Muth, memorizable.com
// Author's Website URL: http://memorizable.com
//
// All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use, copy,
// modify, merge, publish, distribute, and/or sell copies of the
// Software, and to permit persons to whom the Software is furnished
// to do so, subject to the following conditions:
//
// The above copyright notice, Author's Website URL, and this
// permission notice shall be included in all copies or substantial
// portions of the Software, and any hyperlinks in the user interface
// in the Software which refer to any page on the Author's Website may
// not be removed, disabled, altered, obscured, or repositioned.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE
// COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR
// ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY
// DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
// WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
// ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
// OF THIS SOFTWARE.
//
// Except as contained in this notice, the name of a copyright holder
// shall not be used in advertising or otherwise to promote the sale,
// use or other dealings in this Software without prior written
// authorization of the copyright holder.
//
Mem = new Object();
Mem.blankRowCount = 9;
Mem.mGray = "#d8d4c0";
Mem.mGreen = "#fff";
Mem.mClicked = "#b8b4a0";
Mem.myCellIndex = function(th) {
var cells = th.parentNode.cells;
var inn = 0;
for(var x=0; x<cells.length; x++) {
if(cells.item(x) == th)
inn = x;
}
return inn;
}
Mem.start = function( item ) {
var columnClicked;
item.parentNode.parentNode.parentNode.parentNode.isMem = true;
var t = this.setT( item );
columnClicked = Mem.myCellIndex(item.parentNode);
// If already in progress
if( t.s && t.s.tbodyBackup ) {
// Kill blinking processes
this.tChile('directionsDiv').cycles = 1;
Mem.restore();
}
// Create new if necessary
if( typeof( t.s ) != 'object')
t.s = new Array();
t.s.column = columnClicked;
// Create backup
var bak = t.tBodies[0].cloneNode( true );
t.s.tbodyBackup = bak;
// Init correct count
t.s.correctCount = 0;
t.s.pending = new Array();
var initialLength = t.tBodies[0].rows.length;
for(var x=1; x<initialLength; x++) {
// Build up list of indexes
t.s.pending[t.s.pending.length] = t.tBodies[0].rows[1];
// Remove from table
t.tBodies[0].removeChild( t.tBodies[0].rows[1] );
}
t.s.totalQuestions = t.s.pending.length;
var tds = t.s.pending[0].getElementsByTagName("TD");
var numberOfColumns=tds.length;
// Add blank rows to end
for(var x=1; x<t.s.pending.length; x++) {
if( x <= this.blankRowCount ) {
var tr = document.createElement("TR");
// For each column
for(var y=0; y<numberOfColumns; y++) {
var td = document.createElement("TD"); td.innerHTML = " ";
tr.appendChild( td );
}
t.tBodies[0].appendChild( tr );
}
}
// If hidden blank rows
if( t.s.pending.length > this.blankRowCount + 1 ) {
// Add ... row
var tr = document.createElement("TR");
var td = document.createElement("TD");
// td.innerHTML = ". . .";
td.innerHTML = "<div style='text-align: center; font-weight: bold; font-size: 6px; font-family: arial black; margin-top: 2px;'>. . .</div>";
var colspan = document.createAttribute("COLSPAN");
colspan.nodeValue=numberOfColumns;
td.setAttributeNode(colspan);
tr.appendChild( td );
//numberOfColumns
t.tBodies[0].appendChild( tr );
}
this.shuffle( t.s.pending ); t.s.pending.reverse(); this.shuffle( t.s.pending );
// Add buttons, etc. to end of table.
var tr = document.createElement("TR");
var statusTd = document.createElement("TD");
statusTd.id = 'statusTd';
tr.appendChild( statusTd );
var colspan = document.createAttribute("COLSPAN");
colspan.nodeValue=numberOfColumns;
statusTd.setAttributeNode(colspan);
t.tBodies[0].appendChild( tr );
// Create placeholders for buttons, etc.
statusTd.innerHTML = "\
<div id=mode style='text-align:right; height:19px; font-size:10px; color:#666;'>" + Mem.getModeDiv(0) + "</div>\
<div id=directionsDiv style='margin-bottom:4px; text-align: left; font-size:10px; font-family:verdana,arial,sans-serif; color:#666;'></div>\
<div id=buttons style='float:left; height:21px;'></div>\
<div id=options style='padding: 5px 0px 0px 8px; width:55px; margin-top:0px; float:right;'><a href='#' onclick='return Mem.showOptions(this);' id=optionsLink>Options</a></div>\
<div id=progress style='margin-top:6px; float:right; font-size:8px; font-family:impact; color:#aaa; text-align:right; vertical-align:middle; '></div>\
" + this.getOptions();
// Enable options if enabled before
if( t.s.optionsOn )
this.showOptions( statusTd );
this.presentQuestion();
this.glow(100);
t.s.mode = "flashcard";
return false;
}
Mem.addEvent = function( obj, type, fn ) {
if ( obj.attachEvent ) {
obj['e'+type+fn] = fn;
obj[type+fn] = function() {obj['e'+type+fn]( window.event );}
obj.attachEvent( 'on'+type, obj[type+fn] );
} else
obj.addEventListener( type, fn, false );
}
Mem.getQuestionCell = function() {
return Mem.t.s.pending[0].cells[ Mem.t.s.column ];
}
Mem.createProgressBar = function() {
var progress = "";
var progressDups = "";
var foundAlready = new Array();
for(var x=0; x<Mem.t.s.pending.length ;x++) {
// If found already
if( foundAlready[ Mem.t.s.pending[x].innerHTML ] )
progressDups += "|";
else
progress += "|";
// Remember we found this one
foundAlready[ Mem.t.s.pending[x].innerHTML ] = true;
}
return progress + "<span style='color:#f00;'>" + progressDups + "</span>";
}
Mem.presentQuestion = function() {
this.tChile('directionsDiv').innerHTML =
"<div style='text-align:center;'>Guess the answer <b style='color:#4d0'>in your head</b>.<span style='font-size:7px;'></span> Then click <b>show answer</b>, or type <b>1</b>.</div>";
this.tChile('buttons').innerHTML = "<button id=showAnswer style='margin-right:111px; width:11em; margin-bottom:1px; font-family: verdana,arial,sans-serif; font-size:9px;' onclick='Mem.showAnswer( this )' >show answer <span style='color:#aaa;text-decoration:underline;'>1</span></button>";
var iveGuessed = this.tChile('showAnswer');
Mem.addEvent( iveGuessed, 'mouseover', function(){ if(typeof( iveGuessedOnMouseOver ) =='function') iveGuessedOnMouseOver() } );
Mem.addEvent( iveGuessed, 'mouseout', function(){ if(typeof( iveGuessedOnMouseOver ) =='function') iveGuessedOnMouseOut() } );
// Add pending row
Mem.t.tBodies[0].insertBefore( Mem.t.s.pending[0], Mem.t.tBodies[0].rows[ Mem.t.s.correctCount + 1 ] );
// Insert "guess the answer", remembering old value
var questionCell = this.getQuestionCell();
Mem.t.s.questionCellOld = questionCell.innerHTML;
questionCell.innerHTML = "<span style='text-decoration:none; color:#4d0; font-weight:bold; cursor:pointer;' title=\"Guess the answer in your head. Then, click the 'show answer' button.\">what goes here?</span>";
// Help alert
Mem.addEvent( questionCell.getElementsByTagName("SPAN")[0], 'mousedown', function(){ alert('Guess the answer in your head. Then, click the \'show answer\' button at the bottom of the table.') } );
this.tChile('progress').innerHTML = this.createProgressBar();
}
Mem.showAnswer = function( button, noScroll ) {
var t = this.setT( button );
// Exit if other mode
if( t.s.mode != "flashcard" )
return;
// Exit if no answer to show
if( t.s.questionCellOld == null )
return;
var questionCell = this.getQuestionCell();
questionCell.innerHTML = t.s.questionCellOld;
t.s.questionCellOld = null;
// Default
var iWasRightText = "I was right";
// Count how many of this remaining
var timesFound = 0;
for(var x=0; x<t.s.pending.length ;x++)
if( t.s.pending[x].innerHTML == t.s.pending[0].innerHTML )
timesFound++;
// If not the last time
if( timesFound > 1 )
iWasRightText = "show later";
this.tChile('directionsDiv').innerHTML =
"<div style='text-align:center;'>Press the appropriate button based on your guess, or type <b>1</b> or <b>2</b>.</div>";
this.tChile('buttons').innerHTML = "\
<button id=iWasWrong style='width:11em; padding:0px; margin: 0px 12px 1px 0px; font-family: verdana,arial,sans-serif; font-size:9px;' onclick='Mem.answer( false, this )'>I was wrong <span style='color:#aaa;text-decoration:underline;'>1</span></button>\
<button id=iWasRight class='iWasRightButton' style='width:10em; margin-bottom:1px; font-family: verdana,arial,sans-serif; font-size:9px;' onclick='Mem.answer( true, this )' >" + iWasRightText + " <span style='color:#aaa;text-decoration:underline;'>2</span></button>\
";
this.tChile('progress').innerHTML = this.createProgressBar();
var iWasRight = this.tChile('iWasRight');
var iWasWrong = this.tChile('iWasWrong');
Mem.addEvent( iWasRight, 'mouseover', function(){ if(typeof( iWasRightOnMouseOver ) =='function') iWasRightOnMouseOver() } );
Mem.addEvent( iWasRight, 'mouseout', function(){ if(typeof( iWasRightOnMouseOut ) =='function') iWasRightOnMouseOut() } );
Mem.addEvent( iWasWrong, 'mouseover', function(){ if(typeof( iWasWrongOnMouseOver ) =='function') iWasWrongOnMouseOver() } );
Mem.addEvent( iWasWrong, 'mouseout', function(){ if(typeof( iWasWrongOnMouseOut ) =='function') iWasWrongOnMouseOut() } );
if(! noScroll)
this.scrollDownIfNecessary( this.tChile('statusTd') );
}
Mem.answer = function( correct, button, noScroll ) {
var t = this.setT( button );
// If answer not shown
if( t.s.questionCellOld != null )
return;
// If other mode
if( t.s.mode != "flashcard" )
return;
var dup = this.currentIsDuplicate();
var last = t.s.pending[0];
// Remove from front of pending
t.s.pending.splice( 0, 1 );
var allRows = t.tBodies[0].rows;
if( correct ) {
// If elsewhere in pending, remove from table
if( dup )
t.tBodies[0].removeChild( last );
// If pending is empty, they're finished
if( t.s.pending.length == 0 ) {
this.finished();
return;
}
// If not dup, increase count of correct
if( ! dup ) {
t.s.correctCount++;
// If enough rows in table, remove last one (blank or ...)
if( t.s.correctCount + this.blankRowCount >= t.s.totalQuestions - 1 )
t.tBodies[0].removeChild( allRows[allRows.length - 2] );
}
}
// If they missed it
else {
// Remove from table
t.tBodies[0].removeChild( last );
t.s.pending.push( last );
t.s.pending.splice( 2, 0, last );
}
this.presentQuestion();
if(this.tChile('directionsDiv').cycles >= 3)
this.tChile('directionsDiv').cycles = 2;
if(! noScroll)
this.scrollDownIfNecessary( this.tChile('statusTd') );
}
Mem.currentIsDuplicate = function() {
for(var x=1; x<Mem.t.s.pending.length ;x++) {
if( Mem.t.s.pending[x] == Mem.t.s.pending[0] )
return true;
}
return false;
}
Mem.message = function( s ) {
var d = document.createElement('div');
var t = document.createTextNode( s );
d.appendChild(t);
document.body.appendChild(d);
}
Mem.shuffle = function( list ) {
var holder, swaps, i, j;
for (swaps=0; swaps<(list.length*2); swaps++) {
i = Math.floor(Math.random()*list.length);
j = Math.floor(Math.random()*list.length);
holder = list[i];
list[i] = list[j];
list[j]=holder;
}
return list;
}
Mem.dump = function( o ) {
var s = "";
for(m in o)
s += m + ", ";
return s;
}
Mem.keyWasPressed = function( keyp ) {
var pressed;
if( navigator.appName == "Netscape" ) pressed = keyp.which;
if( navigator.appVersion.indexOf("MSIE") != -1 ) pressed = event.keyCode;
// In case no table in progress
try {
// Show answer
if ( ( pressed == "1".charCodeAt(0) ) || ( pressed == 97 ) ) {
// If answer not shown yet
if( Mem.t.s.questionCellOld != null )
Mem.showAnswer();
else
Mem.answer( false );
}
// TODO make sure there are no modifiers held down (because of ctrl-r)
// I was right
if ( ( pressed == "2".charCodeAt(0) ) || ( pressed == 98 ) )
Mem.answer( true );
} catch(e) {}
}
Mem.memorizeAllTables = function( item, onlyDoTheseTables ) {
// If we are a "hide" link
if( item.innerHTML == "close" ) {
item.innerHTML = item.innerHTML_old;
var removeThis = item.parentNode.getElementsByTagName("DIV")[0];
// Close and exit
item.parentNode.removeChild( removeThis );
return false;
}
// Change link to 'close'
item.innerHTML_old = item.innerHTML;
item.innerHTML = "close";
// Create table in new div
var d = document.createElement("div");
d.innerHTML = "\
<table class=\"memorizableAll\"><tr> \
<th>Left Side <a style=\"font-size: 9px;\" href=\"#\" onclick=\"return Mem.start(this)\">(memorize)</a></th> \
<th>Right Side <a style=\"font-size: 9px;\" href=\"#\" onclick=\"return Mem.start(this)\">(memorize)</a></th>\
</tr></table>";
// Get ref to it
var tb = d.getElementsByTagName("TBODY")[0];
var memTableCount = 0;
// Convert list to map
var onlyMap = [];
if( onlyDoTheseTables )
for(var x=0; x<onlyDoTheseTables.length; x++)
onlyMap[ onlyDoTheseTables[x].toString() ] = true;
// For each table
var ts = document.getElementsByTagName("table");
for(var x=0; x<ts.length; x++) {
// In case null pointer when seeking anchor
try {
// If mem table
if( ts[x].id == "memTable" ) {
memTableCount++;
if( onlyDoTheseTables && ! onlyMap[memTableCount.toString()] )
continue;
var rs = ts[x].rows;
// If in progress, use backup
if( ts[x].s && ts[x].s.tbodyBackup )
rs = ts[x].s.tbodyBackup.rows;
// Add each row to the table
for(var z=1; z<rs.length; z++)
tb.appendChild( rs[z].cloneNode( true ) );
}
} catch(e) {}
}
// Append div
item.parentNode.appendChild( d )
// Start a session, using the 2nd "(memorize)" link
Mem.start( d.getElementsByTagName("A")[1] );
return false;
}
// Returns Y coord of top of element.
Mem.findY = function( o ) {
var curtop = 0;
if (o.offsetParent) {
curtop = o.offsetTop
while (o = o.offsetParent)
curtop += o.offsetTop
}
return curtop;
}
// Get distance from page top to window bottom
Mem.getWindowBottomY = function() {
// Get scrollY
var scrollY = document.body.scrollTop;
if( window.pageYOffset )
scrollY = window.pageYOffset
var winY = document.body.clientHeight;
if( window.innerHeight )
winY = window.innerHeight;
return scrollY + winY;
}
Mem.scrollDownIfNecessary = function( obj ) {
// If last row close to getting off-screen
if( this.findY( obj ) + 55 > this.getWindowBottomY() ) {
// Scroll down smoothly
var myInterval = window.setInterval(function () { window.scrollBy( 0, 2 ); }, 10);
window.setTimeout(function () { clearInterval(myInterval); },650);
}
}
Mem.startFirst = function(level) {
var as = byid('memTable').getElementsByTagName('a');
var a = as.length == 1 ? as[0] : as[1];
Mem.start( a );
// If 2, start another record
if(level == 2) {
Mem.showAnswer(this.tChile('showAnswer'), true);
Mem.answer(true, this.tChile('iWasRightButton'), true);
this.tChile('directionsDiv').cycles = 100;
}
}
Mem.parents = function(node, levels) {
for(x=1;x<=levels;x++) node = node.parentNode;
return node;
}
Mem.showOptions = function(node) {
this.setT(node);
this.tChile('optionsLink').style.display="none";
this.tChile('optionsBox').style.display="block";
Mem.t.s.optionsOn = true;
// Don't let clicking on options change default table
this.restoreTBody();
return false;
}
Mem.hideOptions = function(node) {
this.setT(node);
this.tChile('optionsLink').style.display="block";
this.tChile('optionsBox').style.display="none";
Mem.t.s.optionsOn = false;
// Don't let clicking on options change default table
this.restoreTBody();
return false;
}
Mem.close = function( node ) {
var t = this.setT( node );
// Don't re-open options
Mem.t.s.optionsOn = false;
Mem.restore();
// Invoke hook if reset
if(node != null) {
// In case method not there
try {
mem_close( t );
} catch(e) {}
}
return false;
}
Mem.finished = function() {
var directions = this.tChile('directionsDiv');
var buttons = this.tChile('buttons');
// Default values
directions.innerHTML = "<div style='text-align:center;'>Congratulations, you've finished.</div>";
buttons.innerHTML = "";
// Restore rows
this.addRowsFromBackup();
// Call hook
try {
mem_finished( [directions, buttons] );
} catch(e) {}
Mem.glow(2, "finished");
return false;
}
Mem.startOver = function( node ) {
var t = this.setT( node );
if( t.s.mode == "flashcard" )
Mem.start( t.getElementsByTagName('a')[t.s.column] );
else if( t.s.mode == "matching" )
Mem.startMatching( t );
return false;
}
Mem.startMatching = function( node ) {
var t = this.setT( node );
t.s.match0 = t.s.match1 = null;
// Change help text
this.tChile('mode').innerHTML = Mem.getModeDiv(1);
this.tChile('directionsDiv').innerHTML =
"<div style='text-align:center;'><b>Note:</b> this table has been <i style='font-weight:bold; color:#f90; cursor: pointer;'><span onclick='Mem.startOver(this);'>shuffled</span></i>. Click items to identify matches.</div>";
this.tChile('buttons').innerHTML = "";
this.tChile('progress').innerHTML = "";
var rows = t.rows;
// Add rows from backup
this.addRowsFromBackup();
// Format them
rows = t.rows;
for(var x=1; x<(rows.length-1); x++) {
var tds = rows[x].cells;
// Add click events
Mem.addEvent( tds[0], 'click', function(){ Mem.matchingClicked( this, 0 ) } );
Mem.addEvent( tds[1], 'click', function(){ Mem.matchingClicked( this, 1 ) } );
tds[0].style.cursor = tds[1].style.cursor = "pointer";
tds[0].style.background = tds[1].style.background = tds[0].style.endColor = tds[1].style.endColor = Mem.mGray;
// Add indexes
tds[0].mIndex = tds[1].mIndex = x;
}
// Shuffle columns
for (swaps=0; swaps<(rows.length*4); swaps++) {
Mem.swapOnce(rows,0);
Mem.swapOnce(rows,1);
}
this.glow(100);
t.s.mode = "matching";
return false;
}
Mem.matchingClicked = function(cell, side) {
// Exit if already correct
if(cell.mState == "correct")
return;
var t = this.setT( cell );
var rows = t.rows;
// Update colors of others, and count remaining
var remaining = 0;
for(var x=1; x<(rows.length-1); x++) {
var td = rows[x].cells[side];
// If gray, clear it
if((cell != td) && (td.mState == "guess")) {
td.mState = null;
td.style.background = td.endColor= Mem.mGray;
}
if(td.mState != "correct") remaining++;
}
// Remember this was clicked
if(side == 0) t.s.match0 = cell;
else t.s.match1 = cell;
// If already guessed
if(cell.mState == "guess") {
cell.mState = null;
cell.style.background = cell.endColor = Mem.mGray;
// Clear it
if(side == 0) t.s.match0 = null;
else t.s.match1 = null;
} else {
// Make it selected
cell.mState = "guess";
cell.style.background = cell.endColor = Mem.mClicked;
}
// Exit if neither are selected
if(! (t.s.match0 && t.s.match1))
return;
// Go through backup table and look for matches
var found = false;
var backupRows = t.s.tbodyBackup.getElementsByTagName('tr');
for(var x=1; x<backupRows.length; x++) {
var tds = backupRows[x].getElementsByTagName('td');
if((trim(t.s.match0.innerHTML) == trim(tds[0].innerHTML))
&& (trim(t.s.match1.innerHTML) == trim(tds[1].innerHTML)))
found = true;
}
// If match
if(found) {
var directions = this.tChile('directionsDiv');
if(directions.cycles > 2)
directions.cycles = 2;
// Make me dark green
t.s.match0.mState = t.s.match1.mState = "correct";
t.s.match0.endColor = t.s.match1.endColor = Mem.mGreen;
t.s.match0.style.cursor = t.s.match1.style.cursor = "";
// If finished - congrats message, restore rows
if(remaining == 1) {
directions.innerHTML = "<div style='text-align:center;'>Congratulations, you've finished. \
Try <a href='#' onclick='return Mem.flashcardMode(this)'>flashcard mode</a>.</div>";
Mem.glow(2, "finished");
this.addRowsFromBackup();
} else {
cell.style.background = Mem.mGray;
Mem.glow(1, "green", t.s.match0, Mem.mGreen);
Mem.glow(1, "green", t.s.match1, Mem.mGreen);
}
t.s.match0 = t.s.match1 = null;
return;
}
// Must not have been found
cell.style.background = Mem.mGray;
Mem.glow(1, "red", cell, Mem.mClicked);
}
Mem.swapOnce = function( rows, index ) {
var r1 = rows[Math.floor(Math.random() * (rows.length-2)) + 1];
var r2 = rows[Math.floor(Math.random() * (rows.length-2)) + 1];
var c1 = r1.cells[index];
r1.replaceChild(r2.cells[index], c1);
if(index == 0)
r2.insertBefore(c1, r2.cells[0]);
else
r2.appendChild(c1);
}
Mem.getModeDiv = function( index ) {
var r = "\
<span style='width:260px; text-align:right; padding: 0px 0px 2px 10px; letter-spacing:2px;\
border-left: solid #ccc 1px; \
border-bottom: solid #ccc 1px;'>\
";
var modes = [["flashcard mode", "return Mem.flashcardMode(this)"], ["matching mode", "return Mem.startMatching(this)"]];
for(var x=0; x<modes.length; x++) {
if( x > 0 ) r += " | ";
if(index == x)
r += "<b>" + modes[x][0] + "</b>";
else
r += "<a style='color:#aaa;' href='#' onclick=\"" + modes[x][1] + "\">" + modes[x][0] + "</a>";
}
r += "</span>";
return r;
}
Mem.getOptions = function() {
return "\
<div style='display:none; line-height:17px; margin:27px 6px 4px 6px; padding: 3px 4px 4px 20px; border:dashed #fc0 2px;' id=optionsBox>\
<a style='float:right; margin-top:-7px; font-size:9px;' href='#' onClick='return Mem.hideOptions(this)'>Hide Options</a>\
- <a target='_blank' href='http://memorizable.com/Help'>Help</a>\
- <a onclick='return Mem.startOver(this)' href='#'>Restart</a>\
- <a onclick='return Mem.close(this)' href='#'>Cancel</a>\
<br>\
- <a target='_blank' href='http://memorizable.com/About_Memorizable_Tables'>About Memorizable Tables</a>\
</div>\
";
}
Mem.setT = function(node) {
// Return current, if no change
if(! node)
return this.t;
// Remember last, for restoreTBody
if(( typeof( Mem.t ) == 'object'))
Mem.lastT = Mem.t;
// Climb up parent until we find table
while( ! node.isMem )
node = node.parentNode;
this.t = node;
return node;
}
Mem.lookupT = function(nodex) {
// Climb up parent until we find table
while(! nodex.isMem)
nodex = nodex.parentNode;
return nodex;
}
Mem.restoreTBody = function() {
Mem.t = Mem.lastT;
}
Mem.restore = function() {
var orig = Mem.t.s.tbodyBackup;
Mem.t.replaceChild( orig, Mem.t.tBodies[0] );
Mem.t = orig.parentNode;
// Whipe out ref to backup
Mem.t.s.tbodyBackup = null;
}
Mem.addRowsFromBackup = function() {
var t = this.t;
var rows = t.rows;
// Delete rows - except top and bottom
var length = rows.length;
for(var x=1; x<=length-2; x++)
t.tBodies[0].removeChild( rows[length - (x+1)] );
// Make copies from backup, add them to table
var bak = t.s.tbodyBackup.cloneNode( true );
var backupRows = bak.getElementsByTagName('tr');
var length = backupRows.length;
for(var x=1; x<length; x++)
t.tBodies[0].insertBefore( backupRows[1], rows[rows.length-1] );
}
Mem.glow = function(cycles, color, glowDiv, endColor) {
// Remember table
if(!glowDiv) {
glowDiv = this.tChile('directionsDiv');
// Do nothing if already going
if(glowDiv.cycles >= 1)
return;
}
glowDiv.cycles = cycles;
if(!endColor)
endColor = "#fff";
// Set end color to cell
glowDiv.endColor = endColor;
var glowLevel = color == "green" ? 35 : 0;
var glowIncrement = color == "red" ? 8 : 2;
if(color == "green") glowIncrement = 1;
var myInterval = window.setInterval(function () {
// Stop if cycles over
if(glowDiv.cycles <= 0) {
clearInterval(myInterval);
return;
}
// Change level
glowLevel += glowIncrement;
// Go darker
if(glowLevel < 0) {
glowIncrement = 2;
glowLevel += glowIncrement;
// If this is the end, set it to the end color
if(--glowDiv.cycles == 0) {
glowDiv.style.background = glowDiv.endColor;
return;
}
}
// Go lighter
if(glowLevel > 44) {
glowIncrement = -2;
glowLevel += glowIncrement;
if(glowDiv.cycles == 1) {
glowIncrement = color == "red" ? -6 : -1;
if(color == "green") glowIncrement = -6;
}
}
if(color == "red")
Mem.glowColor(glowDiv, glowLevel, 180, 1, -2, -2);
else if(color == "green")
Mem.glowColor(glowDiv, glowLevel, 255, -3, 0, -5);
else if(color == "finished")
Mem.glowColor(glowDiv, glowLevel, 255, -2, 0, -4);
else // Orange
Mem.glowColor(glowDiv, glowLevel, 255, 0, -1, -4);
}, 43);
}
Mem.glowColor = function(glowDiv, glowLevel, start, r, g, b) {
glowDiv.style.background = "rgb(" + (start+glowLevel*r) + "," + (start+glowLevel*g) + "," + (start+glowLevel*b) + ")";
}
Mem.chile = function(root, idName) {
var maybe = root.getElementsByTagName( '*' );
for(var x=0; x<maybe.length; x++)
if( maybe[x].id == idName )
return maybe[x];
}
Mem.tChile = function(idName) {
return this.chile(this.t, idName);
}
Mem.flashcardMode = function(node) {
Mem.setT(node);
return Mem.start( Mem.t.getElementsByTagName('a')[Mem.t.s.column] );
}
function trim( s ) {
return s.replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1");
}
function byid( key ) {
return document.getElementById( key );
}
Mem.addEvent( document, "keydown", Mem.keyWasPressed );
//}}}
{{tablecenter table{
*Try clicking (memorize) in both columns (to decide which side to start with).
| !Palette<br><script label="(memorize)">return Mem.start(place)</script> | !Definition<br><script label="(memorize)">return Mem.start(place)</script> |
|Background: |This controls the color of the background or 'paper', and the text in the title and subtitle.|
|Foreground: |This controls the color of the text.|
|~PrimaryPale: |This controls the color of the Interface Options box.|
|~PrimaryLight: |This controls the color of the top of the Header gradient.|
|~PrimaryMid: |This controls the color of the text in the MainMenu, the color of the text for links, the color of the text in the lists of tiddlers and tags, and the color of the bottom of the Header gradient.|
|mem|k
}}}
* Try clicking (memorize) in both columns (to decide which side to start with).
{|
| @@color:#600;''Command''@@<br><script label="^^(memorize)^^">return Mem.start(place)</script>
| @@color:#600;''Usage''@@<br><script label="(memorize)">return Mem.start(place)</script>
|-
| ipswitch
| Does all kinds of things, is really useful. Does all kinds of things, is really useful. Does all kinds of things, is really useful. Does all kinds of things, is really useful. Does all kinds of things, is really useful. Does all kinds of things, is really useful. Does all kinds of things, is really useful. Does all kinds of things, is really useful.
|-
| Why?
| Because!
|}
|mem|k
!!!<<gradient horiz #fc3 #fff>> MemorizePaletteWikified^^<<tiddler CloseThisOpen with: Tables '� back'>>|<<toolbar editTiddler>>» ^^>>
|bgcolor:#fcf;''NOTE:'' This memorize table is done in ~TiddlyWiki format/syntax re: Eric Shulman's response to a request in [[this TiddlyWiki Group discussion|http://tinyurl.com/34fjk6]] Edit this tiddler to see the code.|
{{firstletter textright{
@@color:#c06;M@@
}}} ''emorizable tables'' are tables on a web page that assist you with memorizing their content. This is done by a flashcard process or matching process.
Requirements: MemorizablePlugin
|Think about the flashcards you've used to study for tests. Memorizable tables work in a very similar way. You look at something, then guess the "answer" in your head. If your guess was correct, you're done with that card. If your guess was incorrect, you put the card aside to use again until you're sure you've memorized it.|
{{tablecenter table{
|''References:'' <br>[[Group discussion|http://tinyurl.com/34fjk6]] <br> MemorizablePlugin<br> http://memorizable.com/ <br>http://memorizable.com/Help <br> http://memorizable.com/Code <br> http://memorizable.com/Code_Guidelines|
| ↓Click memorize in the table heading |
So for everyone who wants to memorize the ColorPalette system here is the thin end of the wedge :)
*Try clicking (memorize) in both columns (to decide which side to start with).
| !Palette<br><script label="(memorize)">return Mem.start(place)</script> | !Definition<br><script label="(memorize)">return Mem.start(place)</script> |
|Background: |This controls the color of the background or 'paper', and the text in the title and subtitle.|
|Foreground: |This controls the color of the text.|
|~PrimaryPale: |This controls the color of the Interface Options box.|
|~PrimaryLight: |This controls the color of the top of the Header gradient.|
|~PrimaryMid: |This controls the color of the text in the MainMenu, the color of the text for links, the color of the text in the lists of tiddlers and tags, and the color of the bottom of the Header gradient.|
|~PrimaryDark:|This controls the color of the text of the items in the top of the right hand menu and the text of the buttons on the tiddlers.|
|~SecondaryPale: |This controls the color of the background of the boxes in those tiddlers that show snippets of the TiddlyWiki code.|
|~SecondaryLight:|This controls the color that appears when the tiddler buttons or items in the right hand menu are highlighted.|
|~SecondaryMid: |This controls the color of the title cells in tables, that is, cells which begin with an exclamation mark (!). It also controls the color of the box that appears when changes have been saved, and the color of the tiddler buttons when they are selected.|
|~SecondaryDark:|This controls the color of the titles of the tiddlers.|
|~TertiaryPale: |This controls the color of the right hand menu that shows lists of tags and tiddlers, as well as the color of the tag button on the tiddlers.|
|~TertiaryLight: |This controls the color of the borders around the right hand menus.|
|~TertiaryMid: |This controls the color of the unselected tabs behind the list of tags and tiddlers in the bottom right hand menu.|
|~TertiaryDark: |This controls the color of the subtitle of each tiddler, that is, the author of the tiddler, the most recent date it was modified and date it was created.|
|Error: |Error: #f88 |
|mem|k
}}}
MCITP exam 70-685
Windows 7 Enterprise Desktop Support Technician
Set "ClearType" setting to on. Found in Display settings, takes some poking around to find it so I start with Windows Help.
----
Step 2:
http://www.xpmaximized.com/archives/xp-powertoy-cleartype.html
This is a Windows "PowerToy" utility to enhance legibility on the LCD screen.
* My dev password is {{{manifest10}}}
* Always choose ~UTF8 character encoding! As of 2010_08, the install default for Windows is Latin1! [[source|http://www.blueboxgrp.com/news/2009/07/mysql_encoding]]
!! Command line
* http://www.pantz.org/software/mysql/mysqlcommands.html
* This got me rolling after installin WAMP
!! Windows WAMP (Clunky ~WorkBench 5.2.26 CE)
* //This is deprecated by me, July 20111//
* Install in order: ~MySQL, workbench
* Workbench
** Read 'Getting Started'
** The log window is deceptive, undersized. Use elevator.
/***
|Name|NestedSlidersPlugin|
|Source|http://www.TiddlyTools.com/#NestedSlidersPlugin|
|Documentation|http://www.TiddlyTools.com/#NestedSlidersPluginInfo|
|Version|2.4.9|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Options|##Configuration|
|Description|show content in nest-able sliding/floating panels, without creating separate tiddlers for each panel's content|
!!!!!Documentation
>see [[NestedSlidersPluginInfo]]
!!!!!Configuration
<<<
<<option chkFloatingSlidersAnimate>> allow floating sliders to animate when opening/closing
>Note: This setting can cause 'clipping' problems in some versions of InternetExplorer.
>In addition, for floating slider animation to occur you must also allow animation in general (see [[AdvancedOptions]]).
<<<
!!!!!Revisions
<<<
2008.11.15 - 2.4.9 in adjustNestedSlider(), don't make adjustments if panel is marked as 'undocked' (CSS class). In onClickNestedSlider(), SHIFT-CLICK docks panel (see [[MoveablePanelPlugin]])
|please see [[NestedSlidersPluginInfo]] for additional revision details|
2005.11.03 - 1.0.0 initial public release. Thanks to RodneyGomes, GeoffSlocock, and PaulPetterson for suggestions and experiments.
<<<
!!!!!Code
***/
//{{{
version.extensions.NestedSlidersPlugin= {major: 2, minor: 4, revision: 9, date: new Date(2008,11,15)};
// options for deferred rendering of sliders that are not initially displayed
if (config.options.chkFloatingSlidersAnimate===undefined)
config.options.chkFloatingSlidersAnimate=false; // avoid clipping problems in IE
// default styles for 'floating' class
setStylesheet(".floatingPanel { position:absolute; z-index:10; padding:0.5em; margin:0em; \
background-color:#eee; color:#000; border:1px solid #000; text-align:left; }","floatingPanelStylesheet");
// if removeCookie() function is not defined by TW core, define it here.
if (window.removeCookie===undefined) {
window.removeCookie=function(name) {
document.cookie = name+'=; expires=Thu, 01-Jan-1970 00:00:01 UTC; path=/;';
}
}
config.formatters.push( {
name: "nestedSliders",
match: "\\n?\\+{3}",
terminator: "\\s*\\={3}\\n?",
lookahead: "\\n?\\+{3}(\\+)?(\\([^\\)]*\\))?(\\!*)?(\\^(?:[^\\^\\*\\@\\[\\>]*\\^)?)?(\\*)?(\\@)?(?:\\{\\{([\\w]+[\\s\\w]*)\\{)?(\\[[^\\]]*\\])?(\\[[^\\]]*\\])?(?:\\}{3})?(\\#[^:]*\\:)?(\\>)?(\\.\\.\\.)?\\s*",
handler: function(w)
{
lookaheadRegExp = new RegExp(this.lookahead,"mg");
lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = lookaheadRegExp.exec(w.source)
if(lookaheadMatch && lookaheadMatch.index == w.matchStart)
{
var defopen=lookaheadMatch[1];
var cookiename=lookaheadMatch[2];
var header=lookaheadMatch[3];
var panelwidth=lookaheadMatch[4];
var transient=lookaheadMatch[5];
var hover=lookaheadMatch[6];
var buttonClass=lookaheadMatch[7];
var label=lookaheadMatch[8];
var openlabel=lookaheadMatch[9];
var panelID=lookaheadMatch[10];
var blockquote=lookaheadMatch[11];
var deferred=lookaheadMatch[12];
// location for rendering button and panel
var place=w.output;
// default to closed, no cookie, no accesskey, no alternate text/tip
var show="none"; var cookie=""; var key="";
var closedtext=">"; var closedtip="";
var openedtext="<"; var openedtip="";
// extra "+", default to open
if (defopen) show="block";
// cookie, use saved open/closed state
if (cookiename) {
cookie=cookiename.trim().slice(1,-1);
cookie="chkSlider"+cookie;
if (config.options[cookie]==undefined)
{ config.options[cookie] = (show=="block") }
show=config.options[cookie]?"block":"none";
}
// parse label/tooltip/accesskey: [label=X|tooltip]
if (label) {
var parts=label.trim().slice(1,-1).split("|");
closedtext=parts.shift();
if (closedtext.substr(closedtext.length-2,1)=="=")
{ key=closedtext.substr(closedtext.length-1,1); closedtext=closedtext.slice(0,-2); }
openedtext=closedtext;
if (parts.length) closedtip=openedtip=parts.join("|");
else { closedtip="show "+closedtext; openedtip="hide "+closedtext; }
}
// parse alternate label/tooltip: [label|tooltip]
if (openlabel) {
var parts=openlabel.trim().slice(1,-1).split("|");
openedtext=parts.shift();
if (parts.length) openedtip=parts.join("|");
else openedtip="hide "+openedtext;
}
var title=show=='block'?openedtext:closedtext;
var tooltip=show=='block'?openedtip:closedtip;
// create the button
if (header) { // use "Hn" header format instead of button/link
var lvl=(header.length>5)?5:header.length;
var btn = createTiddlyElement(createTiddlyElement(place,"h"+lvl,null,null,null),"a",null,buttonClass,title);
btn.onclick=onClickNestedSlider;
btn.setAttribute("href","javascript:;");
btn.setAttribute("title",tooltip);
}
else
var btn = createTiddlyButton(place,title,tooltip,onClickNestedSlider,buttonClass);
btn.innerHTML=title; // enables use of HTML entities in label
// set extra button attributes
btn.setAttribute("closedtext",closedtext);
btn.setAttribute("closedtip",closedtip);
btn.setAttribute("openedtext",openedtext);
btn.setAttribute("openedtip",openedtip);
btn.sliderCookie = cookie; // save the cookiename (if any) in the button object
btn.defOpen=defopen!=null; // save default open/closed state (boolean)
btn.keyparam=key; // save the access key letter ("" if none)
if (key.length) {
btn.setAttribute("accessKey",key); // init access key
btn.onfocus=function(){this.setAttribute("accessKey",this.keyparam);}; // **reclaim** access key on focus
}
btn.setAttribute("hover",hover?"true":"false");
btn.onmouseover=function(ev) {
// optional 'open on hover' handling
if (this.getAttribute("hover")=="true" && this.sliderPanel.style.display=='none') {
document.onclick.call(document,ev); // close transients
onClickNestedSlider(ev); // open this slider
}
// mouseover on button aligns floater position with button
if (window.adjustSliderPos) window.adjustSliderPos(this.parentNode,this,this.sliderPanel);
}
// create slider panel
var panelClass=panelwidth?"floatingPanel":"sliderPanel";
if (panelID) panelID=panelID.slice(1,-1); // trim off delimiters
var panel=createTiddlyElement(place,"div",panelID,panelClass,null);
panel.button = btn; // so the slider panel know which button it belongs to
btn.sliderPanel=panel; // so the button knows which slider panel it belongs to
panel.defaultPanelWidth=(panelwidth && panelwidth.length>2)?panelwidth.slice(1,-1):"";
panel.setAttribute("transient",transient=="*"?"true":"false");
panel.style.display = show;
panel.style.width=panel.defaultPanelWidth;
panel.onmouseover=function(event) // mouseover on panel aligns floater position with button
{ if (window.adjustSliderPos) window.adjustSliderPos(this.parentNode,this.button,this); }
// render slider (or defer until shown)
w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
if ((show=="block")||!deferred) {
// render now if panel is supposed to be shown or NOT deferred rendering
w.subWikify(blockquote?createTiddlyElement(panel,"blockquote"):panel,this.terminator);
// align floater position with button
if (window.adjustSliderPos) window.adjustSliderPos(place,btn,panel);
}
else {
var src = w.source.substr(w.nextMatch);
var endpos=findMatchingDelimiter(src,"+++","===");
panel.setAttribute("raw",src.substr(0,endpos));
panel.setAttribute("blockquote",blockquote?"true":"false");
panel.setAttribute("rendered","false");
w.nextMatch += endpos+3;
if (w.source.substr(w.nextMatch,1)=="\n") w.nextMatch++;
}
}
}
}
)
function findMatchingDelimiter(src,starttext,endtext) {
var startpos = 0;
var endpos = src.indexOf(endtext);
// check for nested delimiters
while (src.substring(startpos,endpos-1).indexOf(starttext)!=-1) {
// count number of nested 'starts'
var startcount=0;
var temp = src.substring(startpos,endpos-1);
var pos=temp.indexOf(starttext);
while (pos!=-1) { startcount++; pos=temp.indexOf(starttext,pos+starttext.length); }
// set up to check for additional 'starts' after adjusting endpos
startpos=endpos+endtext.length;
// find endpos for corresponding number of matching 'ends'
while (startcount && endpos!=-1) {
endpos = src.indexOf(endtext,endpos+endtext.length);
startcount--;
}
}
return (endpos==-1)?src.length:endpos;
}
//}}}
//{{{
window.onClickNestedSlider=function(e)
{
if (!e) var e = window.event;
var theTarget = resolveTarget(e);
while (theTarget && theTarget.sliderPanel==undefined) theTarget=theTarget.parentNode;
if (!theTarget) return false;
var theSlider = theTarget.sliderPanel;
var isOpen = theSlider.style.display!="none";
// if SHIFT-CLICK, dock panel first (see [[MoveablePanelPlugin]])
if (e.shiftKey && config.macros.moveablePanel) config.macros.moveablePanel.dock(theSlider,e);
// toggle label
theTarget.innerHTML=isOpen?theTarget.getAttribute("closedText"):theTarget.getAttribute("openedText");
// toggle tooltip
theTarget.setAttribute("title",isOpen?theTarget.getAttribute("closedTip"):theTarget.getAttribute("openedTip"));
// deferred rendering (if needed)
if (theSlider.getAttribute("rendered")=="false") {
var place=theSlider;
if (theSlider.getAttribute("blockquote")=="true")
place=createTiddlyElement(place,"blockquote");
wikify(theSlider.getAttribute("raw"),place);
theSlider.setAttribute("rendered","true");
}
// show/hide the slider
if(config.options.chkAnimate && (!hasClass(theSlider,'floatingPanel') || config.options.chkFloatingSlidersAnimate))
anim.startAnimating(new Slider(theSlider,!isOpen,e.shiftKey || e.altKey,"none"));
else
theSlider.style.display = isOpen ? "none" : "block";
// reset to default width (might have been changed via plugin code)
theSlider.style.width=theSlider.defaultPanelWidth;
// align floater panel position with target button
if (!isOpen && window.adjustSliderPos) window.adjustSliderPos(theSlider.parentNode,theTarget,theSlider);
// if showing panel, set focus to first 'focus-able' element in panel
if (theSlider.style.display!="none") {
var ctrls=theSlider.getElementsByTagName("*");
for (var c=0; c<ctrls.length; c++) {
var t=ctrls[c].tagName.toLowerCase();
if ((t=="input" && ctrls[c].type!="hidden") || t=="textarea" || t=="select")
{ try{ ctrls[c].focus(); } catch(err){;} break; }
}
}
var cookie=theTarget.sliderCookie;
if (cookie && cookie.length) {
config.options[cookie]=!isOpen;
if (config.options[cookie]!=theTarget.defOpen) window.saveOptionCookie(cookie);
else window.removeCookie(cookie); // remove cookie if slider is in default display state
}
// prevent SHIFT-CLICK from being processed by browser (opens blank window... yuck!)
// prevent clicks *within* a slider button from being processed by browser
// but allow plain click to bubble up to page background (to close transients, if any)
if (e.shiftKey || theTarget!=resolveTarget(e))
{ e.cancelBubble=true; if (e.stopPropagation) e.stopPropagation(); }
Popup.remove(); // close open popup (if any)
return false;
}
//}}}
//{{{
// click in document background closes transient panels
document.nestedSliders_savedOnClick=document.onclick;
document.onclick=function(ev) { if (!ev) var ev=window.event; var target=resolveTarget(ev);
if (document.nestedSliders_savedOnClick)
var retval=document.nestedSliders_savedOnClick.apply(this,arguments);
// if click was inside a popup... leave transient panels alone
var p=target; while (p) if (hasClass(p,"popup")) break; else p=p.parentNode;
if (p) return retval;
// if click was inside transient panel (or something contained by a transient panel), leave it alone
var p=target; while (p) {
if ((hasClass(p,"floatingPanel")||hasClass(p,"sliderPanel"))&&p.getAttribute("transient")=="true") break;
p=p.parentNode;
}
if (p) return retval;
// otherwise, find and close all transient panels...
var all=document.all?document.all:document.getElementsByTagName("DIV");
for (var i=0; i<all.length; i++) {
// if it is not a transient panel, or the click was on the button that opened this panel, don't close it.
if (all[i].getAttribute("transient")!="true" || all[i].button==target) continue;
// otherwise, if the panel is currently visible, close it by clicking it's button
if (all[i].style.display!="none") window.onClickNestedSlider({target:all[i].button})
if (!hasClass(all[i],"floatingPanel")&&!hasClass(all[i],"sliderPanel")) all[i].style.display="none";
}
return retval;
};
//}}}
//{{{
// adjust floating panel position based on button position
if (window.adjustSliderPos==undefined) window.adjustSliderPos=function(place,btn,panel) {
if (hasClass(panel,"floatingPanel") && !hasClass(panel,"undocked")) {
// see [[MoveablePanelPlugin]] for use of 'undocked'
var rightEdge=document.body.offsetWidth-1;
var panelWidth=panel.offsetWidth;
var left=0;
var top=btn.offsetHeight;
if (place.style.position=="relative" && findPosX(btn)+panelWidth>rightEdge) {
left-=findPosX(btn)+panelWidth-rightEdge; // shift panel relative to button
if (findPosX(btn)+left<0) left=-findPosX(btn); // stay within left edge
}
if (place.style.position!="relative") {
var left=findPosX(btn);
var top=findPosY(btn)+btn.offsetHeight;
var p=place; while (p && !hasClass(p,'floatingPanel')) p=p.parentNode;
if (p) { left-=findPosX(p); top-=findPosY(p); }
if (left+panelWidth>rightEdge) left=rightEdge-panelWidth;
if (left<0) left=0;
}
panel.style.left=left+"px"; panel.style.top=top+"px";
}
}
//}}}
//{{{
// TW2.1 and earlier:
// hijack Slider stop handler so overflow is visible after animation has completed
Slider.prototype.coreStop = Slider.prototype.stop;
Slider.prototype.stop = function()
{ this.coreStop.apply(this,arguments); this.element.style.overflow = "visible"; }
// TW2.2+
// hijack Morpher stop handler so sliderPanel/floatingPanel overflow is visible after animation has completed
if (version.major+.1*version.minor+.01*version.revision>=2.2) {
Morpher.prototype.coreStop = Morpher.prototype.stop;
Morpher.prototype.stop = function() {
this.coreStop.apply(this,arguments);
var e=this.element;
if (hasClass(e,"sliderPanel")||hasClass(e,"floatingPanel")) {
// adjust panel overflow and position after animation
e.style.overflow = "visible";
if (window.adjustSliderPos) window.adjustSliderPos(e.parentNode,e.button,e);
}
};
}
//}}}
http://joeit.wordpress.com/2008/11/25/banish-windows-notepad-replacing-notepad-with-notepad/
Likely will need to temporarily change "Folder Options"
# Show hidden files and folders
# Hide protected operating system files [uncheck]
{{{
Copy the Notepad ++ launcher to %windir%\servicepackfiles\i386
Copy the Notepad ++ launcher to %windir%\system32\dllcache
Copy the Notepad ++ launcher to %windir%\system32
Copy the Notepad ++ launcher to %windir%
}}}
Also possibly needed:
{{{
Go to %windir%\system32\Restore
Select filelist.xml
right click, select Properties
uncheck Read-only
Edit the file, adding:
<REC>%windir%\notepad.exe</REC>
to:
<Exclude>
<REC>%windir%\system.ini</REC>
<REC>%windir%\tasks\desktop.ini</REC>
<REC>%windir%\win.ini</REC>
<REC>*:\AUTOEXEC.BAT</REC>
<REC>*:\CONFIG.MSI</REC>
<REC>*:\CONFIG.SYS</REC>
</Exclude>
}}}
Also:
from http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Replacing_Notepad
{{{
Installation Instruction :
* Backup your original Notepad.exe (we never know...).
* Copy notepad.exe which comes with this package into 3 directories (in given order) :
1. c:\windows\system32\dllcache
2. c:\windows\system32
3. c:\windows
When you replace notepad.exe in c:\windows\system32 and c:\windows, a "Windows File Protection" message box appears, click Cancel. Then another message box appears, click OK.
* Modify you registry (if you use installer to install your Notepad++, you don't need to do this step): Create key \HKEY_LOCAL_MACHINE\SOFTWARE\Notepad++, then add your Notepad++ full path as the default value of this key. In my case, it's C:\Program Files\Notepad++.
Now Notepad++ is your default Notepad. Enjoy.
}}}
Scripting plugin for Notepad++, documentation included
As easy as:
{{{
notepad.open('filename.txt')
editor.appendText("Hello World")
}}}
Full programmatic access to Notepad++ features and menus
Percent = {{{ ((A - B) / B) * 100 }}}
* B mustn't equal zero
* Note in Microsoft, Percent format takes care of the {{{* 100}}}
!!!Breaking it down
# A - B = C
# C / B = D
# D * 100
{{{
If sng_B = 0 then stop
varDiff = (sng_A - sng_B)
varDiff = varDiff / sng_B
varDiff = Round(varDiff * 100, 1)
}}}
!!! Disk file system (NTFS, ~FAT32)
!!!! NTFS
* allows permissions -- difficult to set up, but very secure. Also supports encryption. ~FAT32 has nothing of the kind.
* Possible to wreck your own access via permissions.
* space efficiency much higher. supports compression.
* more reliable, stable.
* can't be converted to ~FAT32 -- reformat is required.
!!!! ~FAT32
* can be converted to NTFS
* More readable -- Win/Linux/Mac
* History buffs: //~FAT// is an obsolete precursor to ~FAT32.
!!!!Pretty Link
<a href="file://%ServerShortcutName%">Click anywhere on this sentence to install the application.</a><br> </p>
<b>For this email only </b>you can ignore the security notices.
----
Click on the below link to install the application.
file://%ServerShortcutName%
For this email only you can ignore the security notices.
|Insert date |Press CTRL + SEMICOLON |
|Insert time |Press CTRL + SHIFT + SEMICOLON |
|Insert date and time |Both above, with a space in between |
* [[Text_DictionaryList]] to revise spell check reference list.
|My Name |HOME PC |
|System Name |~SCOTT-PC |
|OS Name |Windows 7 Pro |
|Motherboard |~K8V-MX/S ~MicroATX 9.6" x 9.6" <br>[[Specifications|http://www.asus.com/Motherboards/AMD_Socket_754/K8VMX/#specifications]] |
|Processor |AMD Athlon Sempron(?) 64 3000+, x86 Family, <br>2GB-RAM , 200 Mhz, 1 Core, 1 Logical Proc'r |
|Video |nVidia ~GeForce FX 5600 256MB |
|BIOS |Am. Megatrends 1009.005, 9/20/2005 |
|SMBIOS |2.3 |
!! GeForce 5 FX Series video card
* The 5600 falls in the GeForce 5 Series (launched in 2003). "FX" means 5; these were between the 4 and 6 series.
* GeForce is not Quadro. They were targeted for gaming and CAD apps, respectively.
* Apparent best driver: {{{96.85_forceware_winvista_x86_international_whql.exe}}}
!! Hard drives
* {{{160 Gb}}} Seagate Barracuda 7200.9
* {{{ 80 Gb}}} Western Digital ~WD800 Caviar SE
!! Other news about eMachine
* Mirus
* 300W power supply
* socket 754
* CPU
** 32/64-bit both symult
** L2 cache up to 1 Mb
** architecture i686
** CPU speed 800 MHz FSB
* Chipset ~VIA ~K8M800 ~VT8237
* RAM -- 2 slots x 184 pin DDR DIMM ~PC3200/2700/2100 SDRAM
* RAM Max is 2 Gb
* PCI slots -- 3
* AGP 3.0 using 1.5v
* ~FireWire (IEEE 1394) connection on mobo
* USB 4 in back, 2 in front
''How do I see all of the array (incl multi-dimensional)?''
{{{ var_dump($query); }}}
{{{
function rgb2html($r, $g=-1, $b=-1)
{
if (is_array($r) && sizeof($r) == 3)
list($r, $g, $b) = $r;
$r = intval($r); $g = intval($g);
$b = intval($b);
$r = dechex($r<0?0:($r>255?255:$r));
$g = dechex($g<0?0:($g>255?255:$g));
$b = dechex($b<0?0:($b>255?255:$b));
$color = (strlen($r) < 2?'0':'').$r;
$color .= (strlen($g) < 2?'0':'').$g;
$color .= (strlen($b) < 2?'0':'').$b;
return '#'.$color;
}
}}}
''This can be kept off the document root for good security''
Not sure if the @ in @mysql_pconnect is a good idea -- can't recall
{{{
function make_connection ( $data_source ) {
$dbhost = 'localhost'; //3306
if ( $data_source == "production" ) {
$dbname = '...';
$dbuser = '...';
$dbpass = '...';
} elseif ( $data_source == "demo" ) {
$dbname = '...';
$dbuser = '...';
$dbpass = '...';
} else { return ( FALSE ); }
$db_link = @mysql_pconnect($dbhost, $dbuser, $dbpass);
if ($db_link && mysql_select_db ($dbname))
{ return ($db_link); }
else
{ return (FALSE); }
}
}}}
!How do I review colors in a GIMP color palette file (gpl)?
This uses [[PHP_ColorCodeConvert]]
{{{
<table cellpadding="6px">
<?php
//$palette= fopen("../style/Dark_pastels.gpl","rt");
//fclose("../style/Dark_pastels.gpl");
$palette_file = file_get_contents ( "Sparts.gpl" );
$whatever = explode ( "\n", $palette_file );
$rightside = 3;
foreach ( $whatever as $color_line_raw ) {
$color_line = htmlentities($color_line_raw);
// convert odd whitespace to a space
$color_line = str_replace("\t", " ", $color_line);
$color_line = preg_replace("/\s\s+/", " ", $color_line);
$color_line = ltrim ( $color_line );
list ( $startcharacter ) = substr ( $color_line, 1, 1 );
if (is_numeric( $startcharacter ) || $startcharacter == 0 ) {
//one more space so next explode has something to find
$color_line = $color_line." ";
list ( $r, $g, $b, $name ) = explode ( " ", $color_line );
$color_html = rgb2html($r, $g, $b);
if ( !($color_html == "#000000") ) {
if ( $rightside % 3 == 0 ) {
echo "<tr>";
}
$color_html = strtoupper ( $color_html ) ;
echo "<td width='40px' align='right'></td>";
echo "<td width='120px' bgcolor='".$color_html."'> </td>";
echo "<td>".$name."<br /><span style='font-family: monospace'>".$color_html."</span></td>";
if ( $rightside % 3 == 2 ) {
echo "</tr>";
}
$rightside = ++$rightside;
}
}
if ( $rightside % 3 == 0 ) {
echo "</tr>";
}
}
?>
</table>
<hr />
<table cellpadding="6px">
<?php
foreach ( $whatever as $color_line_raw ) {
$color_line = htmlentities($color_line_raw);
// convert odd whitespace to a space
$color_line = str_replace("\t", " ", $color_line);
$color_line = preg_replace("/\s\s+/", " ", $color_line);
$color_line = ltrim ( $color_line );
list ( $startcharacter ) = substr ( $color_line, 1, 1 );
if (is_numeric( $startcharacter ) || $startcharacter == 0 ) {
//one more space so next explode has something to find
$color_line = $color_line." ";
list ( $r, $g, $b, $name ) = explode ( " ", $color_line );
$color_html = rgb2html($r, $g, $b);
if ( !($color_html == "#000000") && !($color_html == "#ffffff") ) {
$color_html = strtoupper ( $color_html ) ;
echo "<tr>";
echo "<td>/* ".$color_html."</td><td><span style='font-family: monospace'> ".$name." */</span></td>";
echo "<td width='40px' bgcolor='".$color_html."'> </td>";
echo "</tr>";
}
}
}
?>
</table>
}}}
''For Debugging, how can expose Session, Post and Get?''
Note: Set the three types in an array for real elegance ....?
{{{
<div style="background-color: white;">
<?php
//If not debugging, good to leave the include
//in place and just REV OUT all this code.
If ( TRUE ) {
$strWidth = "100%";
echo "<table width='".$strWidth."' align='center'>";
echo "<tr><th></th><th><h6>This is for developer's view only.</h6></th></tr>\n";
$color = "black";
echo "<tr><td style='background: ".$color.";' align='right'> ";
echo "<font color='white'>Directive</font> </td><td>".$directive."</td></tr>" ;
if ( count($_SESSION) > 0 )
{ $color = "forestgreen";
$var_string = "";
echo "<tr><td style='background: ".$color.";' align='right'> ";
echo "<font color='white'>SESSION</font> </td><td>" ;
foreach ($_SESSION as $var => $value)
{ $var_string = $var_string."<font color='".$color."'>"
.$var." =></font> ";
$var_string = $var_string.$value." ";
if ( strlen($var_string) > ( $strWidth - 10 ) ) {
$var_string = $var_string."<br />\n";
echo $var_string;
$var_string = "";
} }
echo $var_string;
echo "</td></tr>\n" ;
}
$var_string = "";
if ( count($_POST) > 0 )
{ $color = "red";
echo "<tr><td style='background: ".$color.";' align='right'> ";
echo "<font color='white'>POST</font> </td><td>" ;
foreach ($_POST as $var => $value)
{ $var_string = $var_string."<font color='".$color."'>"
.$var." =></font> ";
$var_string = $var_string.$value." ";
if ( strlen($var_string) > $strWidth ) {
$var_string = $var_string."<br />\n";
echo $var_string;
$var_string = "";
} }
echo $var_string;
echo "</td></tr>\n" ;
}
$var_string = "";
if ( count($_REQUEST) > 0 )
{ $color = "brown";
echo "<tr><td style='background: ".$color.";' align='right'> ";
echo "<font color='white'>REQUEST</font> </td><td>" ;
foreach ($_REQUEST as $var => $value)
{ $var_string = $var_string."<font color='".$color."'>"
.$var." =></font> ";
$var_string = $var_string.$value." ";
if ( strlen($var_string) > $strWidth ) {
$var_string = $var_string."<br />\n";
echo $var_string;
$var_string = "";
} }
echo $var_string;
echo "</td></tr>\n" ;
}
$var_string = "";
if ( count($_GET) > 0 )
{ $color = "blue";
echo "<tr><td style='background: ".$color.";' align='right'> ";
echo "<font color='white'>GET</font> </td><td>" ;
foreach ($_GET as $var => $value)
{ $var_string = $var_string."<font color='".$color."'>"
.$var." =></font> ";
$var_string = $var_string.$value." ";
if ( strlen($var_string) > $strWidth ) {
$var_string = $var_string."<br />\n";
echo $var_string;
$var_string = "";
} }
echo $var_string;
echo "</td></tr>\n" ;
}
$color = "orange";
echo "<tr><td style='background: ".$color.";' align='right'> ";
echo "<font color='white'>SELF</font> </td><td>" ;
echo $_SERVER['PHP_SELF'];
echo "</td></tr>" ;
echo "</table>";
unset( $var_string );
unset( $color );
unset( $strWidth );
unset( $var );
unset( $value );
}
?>
</div>
}}}
''How do I move documents from remote FTP to local?''
{{{ftp_nlist ftp_nb_get}}}
Or possibly
{{{file_put_contents('./file.txt', file_get_contents('ftp://server/file.txt'));}}}
[[Ref|http://stackoverflow.com/questions/2803955/how-to-download-folder-from-some-ftp-server-into-your-server-home-directory-and-g/2804153#2804153]]
Whoa! Loads real slow!
file:///G:/Documents/Personal_USB/ComputerGeek/CheatSheet_php.pdf
<!--{{{-->
<div class='header' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
<div class='headerShadow'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
<div class='headerForeground'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
</div>
<div id='siteNav' class='siteNav' refresh='content' force='true' tiddler='SiteNav'></div>
<div id='breadCrumbs' class='breadCrumbs' style='font-size:80%;padding:0 1em;'></div>
<div id='mainMenu' refresh='content' force='true' tiddler='MainMenu'></div>
<div id='sidebar'>
<div id='sidebarOptions' refresh='content' tiddler='SideBarOptions'></div>
<div id='sidebarTabs' refresh='content' force='true' tiddler='SideBarTabs'></div>
</div>
<div id='displayArea'>
<div id='messageArea' ondblclick='clearMessage()'></div>
<div id='storyMenu' refresh='content' force='true' tiddler='StoryMenu'></div>
<div id='tiddlerDisplay'></div>
<div style="position:fixed;z-index:1001;bottom:.3em;right:.3em;cursor:pointer;font-size:9pt;">
<a href="javascript:window.scrollTo(0,0)" title="scroll to top of page">▲</a>
</div>
</div>
<!--}}}-->
Zire 21
!!! Downloading Apps
Expand +++
# Download apps from site (e.g., www.palm.com.
# Unzip the app, if needed, to the add-on folder in the Desktop Software directory (i.e. C:\program files\palm\add-on).
# Double click and open Palm Quick Install from your Windows desktop.
# Click Add and browse to the Palm� software add-on folder, i.e. C:\program files\palm\add-on.
# Select the applications you want to install to the handheld.
# Click Open, then click Done.
# Perform a HotSync�
===
!!!! ODBC
{{{
Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;
Data Source=C:\Documents and Settings\smorse\My Documents\Homer_DEV\HomerBackEnd.mdb;
Jet OLEDB:Database Password="password"
}}}
!!!! MAS 90
As of 2010_09
* Version {{{4.30.0.18}}}
* Customer {{{THE FOUNTAIN PEOPLE, INC.}}}
* Registra. Number {{{330050499E}}}
!!!! ODBC Legacy read-write
* Ver. 3.7 Harris Technologies uses an old driver that allows write-to!
!!!! ODBC
Set up source under "User DSN" tab. (NOT System. Security)
Driver is MAS 90 --32-bit-- 4.0 ODBC.
Under ODBC Admin, 'connect Pooling' enable=YES
may allow 1+ computers to access!
May even solve ( 1 ) computer conflicts
From 'About' tab in Setup (Nov 2009):
version 3.33.1000
Files: C:\WINDOWS\system32\pvxodb32.dll
Under driver Admin, the version is --3.33.10.00-- and marked "Best Software"
Data Src Name: {{{user prerogative}}}
Description: {{{user prerogative}}}
Database Dir: M:\~MAS90
Defini. File:
Company ID: TFP
User: SDM
Password: [//not shown//]
Session ID: empty
Prefix: M:\~MAS90\soa
Views DLL: M:\~MAS90\Home
Dirty Read Y
Burst mode Y
Key Restrict nothing
Silent Mode Y
enforce Double nothing
Null Date nothing
Enable Debug nothing
Works on PC box as of Nov 2009:
{{{
ODBC;DSN= [//not shown//];UID= [//not shown//];PWD= [//not shown//];Directory=M:\MAS90;Prefix=M:\MAS90\soa;ViewDLL=M:MAS90\Home;Company= [//not shown//];LogFile=\PVXODB32..LOG;DirtyReads=1;BurstMode=1;SILENT=1;SERVER=NotTheServer
}}}
{{{import pdb; pdb.set_trace()}}}
http://aymanh.com/python-debugging-techniques#stepping-through-program-execution
''Set path with flexibility as to OS''
Note forward slashes are handled painlessly!
{{{
folder_root = "/media/S_MORSE/Documents/"
#folder_root = "F:/Documents/"
folder_path = folder_root + "MyProject/"
file_r = open( folder_path+"file1.txt", "rt" )
file_w = open( folder_path+"file2.txt", "w" )
file_w.write("stuff you wanted written in")
file_r.close()
file_w.close()
}}}
{{{
if line == "\n":
pass #Skip blank line
elif line.startswith("Hamlet:"):
[do stuff]
elif booStaging:
[do stuff]
else:
print("Unimportant")
}}}
''Curious nesting of functions''
Quite inscrutable. But useful to me if only for syntax clues at the noob level.
{{{
def fibonacci(x):
if x < 2: return 1
return (fibonacci(x-2) + fibonacci(x-1))
def factorial(x):
if x < 2: return 1
return (x * factorial(x-1))
def main():
funcs = [fibonacci, factorial]
n = 10
for func in funcs:
print func(n)
main()
}}}
[[Source|http://love-python.blogspot.com/2008/06/function-call-in-python.html]]
''Use a file to create a list (equiv. to array):''
{{{
def book_titles(path_doc, book_list):
all_books = []
file_r = open( path_doc, "r" )
for line in file_r:
book_num = str(line[:3])
book_name = line[4:-1]
all_books.append (book)
#Can sort here if desired
return all_books
file_r.close()
}}}
{{{
i=0
while i < 15:
i = i+1
print i
if i == 4:
print('punt')
break
else:
print(i)
}}}
This will print:
{{{1 ... 2 ... 3 ... punt }}}
Apparently a loop can have an else clause! Break will cause this else clause to go by without execution.
{{{
import imp
import passage_end
for date_sunday in calendar_sabbath:
imp.reload(passage_end)
placeTextEnd = passage_end.text_end(line)
}}}
!First occurrence after a specified location
{{{
aString = "Bow wow, how many ow's here?"
count = 0
index = aString.find('ow') # use default start
while index != -1:
count += 1
start = 14
# start optional default = 0
index = aString.find('ow', start)
print "Found %d of 'ow' in %s" % (count, aString)
}}}
Can also set end as a 3rd parameter. //[[Source|http://www.freenetpages.co.uk/hp/alan.gauld/tuttext.htm]]//
!Last occurrence
{{{
index = aString.rfind('ow')
}}}
{{{
numChap = numChap.zfill(2) #changes 8 to 08
}}}
http://www.tek-tips.com/viewthread.cfm?qid=948751
Query in Access:
{{{
SELECT Clinic([redundant]) AS test FROM iColor;
}}}
And in VBA:
{{{
Public Function Clinic(booRedundant as boolean) as String
If booRedundant = -1 Then
Clinic = "Kinda"
Else
Clinic = "Nah"
End If
End Function
}}}
CAN PASS A TABLE!
This package provides a toolbar of interactive 'power tools' that you can use while editing a tiddler to quickly insert TiddlyWiki tiddler links, images, macros, etc. or common formatting sequences directly into tiddler content, as well as perform other functions (such as find/replace, sort, split, convert, etc.) that can be used to modify the current tiddler's source content in a variety of ways.
<<tiddler QuickEditToolbar with: show>>
!!!!!Installation:
<<<
Individual ~QuickEdit buttons are defined in separate tiddlers (e.g., [[QuickEdit_replace]]) that have also been //transcluded// into a single toolbar definition named [[QuickEditToolbar]]. You can edit this definition to add, remove, or rearrange the toolbar buttons to best suit your needs, and then embed the [[QuickEditToolbar]] tiddler into your document's [[EditTemplate]], like this:
{{{
<div macro='tiddler QuickEditToolbar'></div>
}}}
Next, in order to support some of the formatting 'shortcuts' provided by the toolbar, add a reference to the shortcuts CSS class definitions in your [[StyleSheet]]:
{{{
[[StyleSheetShortcuts]]
}}}
By default, the QuickEdit toolbar is hidden until you enable it by using the ''toggleQuickEdit'' command, which you can add to the ~EditToolbar definition in [[ToolbarCommands]]:
{{{
|EditToolbar|... toggleQuickEdit ...|
}}}
You can also toggle the ~QuickEdit toolbar display via a single checkbox option that can be added to [[SideBarOptions]] (or any other desired location):
{{{
<<option chkShowQuickEdit>> show QuickEdit toolbar
}}}
Note: You can 'hard-code' the ''chkShowQuickEdit'' setting, so that the toolbar will be //initially// displayed, by creating a tiddler (e.g., ConfigTweaks), tagged with <<tag systemConfig>>, containing:
{{{
config.options.chkShowQuickEdit=true;
}}}
Alternatively, if you want the toolbar to //always// be displayed, regardless of the option setting, you can add a special keyword, ''show'', to the [[EditTemplate]] syntax, like this:
{{{
<div macro='tiddler QuickEditToolbar with: show'></div>
}}}
<<<
/***
|Name|QuickEditPlugin|
|Source|http://www.TiddlyTools.com/#QuickEditPlugin|
|Documentation|http://www.TiddlyTools.com/#QuickEditPlugin|
|Version|2.4.3|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 3.0 License|http://creativecommons.org/licenses/by-sa/3.0/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Description|Support functions for ~QuickEdit package: styles, utility functions, and 'toggleQuickEdit' command|
!!!!!Revisions
<<<
2009.06.11 [2.4.3] added keyup() function to abbreviate listbox handling for CR and ESC
2009.05.07 [2.4.2] added processed() function to abbreviate event handler code
2008.09.07 [2.4.1] added removeCookie() function for compatibility with [[CookieManagerPlugin]]
2008.05.17 [2.4.0] copied code from StickyPopupPlugin to remove dependency
2008.05.12 [2.3.0] added "toggleQuickEdit" command handler (replaces inline script command)
2008.01.11 [2.2.0] converted from inline script
2007.03.29 [1.0.0] initial release (as inline script)
<<<
!!!!!Code
***/
//{{{
version.extensions.QuickEditPlugin= {major: 2, minor: 4, revision: 3, date: new Date(2009,6,11)};
// SET STYLESHEET
setStylesheet("\
.quickEdit a { border:2px outset ButtonFace; padding:0px 3px !important; \
-moz-border-radius:.5em; -webkit-border-radius:.5em; \
-moz-appearance:button !important; -webkit-appearance:push-button !important; \
background-color:ButtonFace; color:ButtonText !important; \
line-height:200%; font-weight:normal; } \
.quickEdit a:hover { border: 2px inset ButtonFace; background-color:ButtonFace; }\
", "quickEditStyles");
// REMOVE COOKIE
if (window.removeCookie===undefined) {
window.removeCookie=function(name) {
document.cookie = name+'=; expires=Thu, 01-Jan-1970 00:00:01 UTC; path=/;';
}
}
// UTILITY FUNCTIONS
config.quickEdit = {
processed: function(ev) { ev=ev||window.event;
ev.cancelBubble=true;
if(ev.stopPropagation) ev.stopPropagation();
return false;
},
keyup: function(ev){ var k=(ev||window.event).keyCode;
if (k==13) this.onclick();
if (k==27) Popup.remove();
},
getField: function(where) {
var here=story.findContainingTiddler(where); if (!here) return null;
var e=story.getTiddlerField(here.getAttribute("tiddler"),"text");
if (e&&e.getAttribute("edit")=="text") return e;
return null;
},
setSelection: function(where,newtext) {
var e=this.getField(where); if (!e) return false;
e.focus(); replaceSelection(e,newtext);
return false;
},
wrapSelection: function(where,before,after) {
var e=this.getField(where); if (!e) return false;
e.focus(); replaceSelection(e,before+config.quickEdit.getSelection(e)+after);
return false;
},
getSelection: function(e) {
var seltext="";
if (e&&e.setSelectionRange)
seltext=e.value.substr(e.selectionStart,e.selectionEnd-e.selectionStart);
else if (document.selection) {
var range = document.selection.createRange();
if (range.parentElement()==e) seltext=range.text
}
return seltext;
},
promptForFilename: function(msg,path,file) {
if(window.Components) { // moz
try {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var nsIFilePicker = window.Components.interfaces.nsIFilePicker;
var picker = Components.classes['@mozilla.org/filepicker;1'].createInstance(nsIFilePicker);
picker.init(window, msg, nsIFilePicker.modeOpen);
var thispath = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
thispath.initWithPath(path);
picker.displayDirectory=thispath;
picker.defaultExtension='jpg';
picker.defaultString=file;
picker.appendFilters(nsIFilePicker.filterAll|nsIFilePicker.filterImages);
if (picker.show()!=nsIFilePicker.returnCancel)
var result="file:///"+picker.file.persistentDescriptor.replace(/\\/g,'/');
}
catch(e) { alert('error during local file access: '+e.toString()) }
}
else { // IE
try { // XP only
var s = new ActiveXObject('UserAccounts.CommonDialog');
s.Filter='All files|*.*|JPG files|*.jpg|GIF files|*.gif|PNG files|*.png|';
s.FilterIndex=1; // default to JPG
s.InitialDir=path;
s.FileName=file;
if (s.showOpen()) var result=s.FileName;
}
catch(e) { var result=prompt(msg,path+file); } // fallback for non-XP IE
}
return result;
}
}
//}}}
//{{{
if (config.options.chkShowQuickEdit===undefined) config.options.chkShowQuickEdit=false;
config.commands.toggleQuickEdit = {
hideReadOnly: true,
getText: function() { return config.options.chkShowQuickEdit?'\u221Aquickedit':'quickedit'; },
tooltip: 'show QuickEdit toolbar buttons',
handler: function(event,src,title) {
config.options.chkShowQuickEdit=!config.options.chkShowQuickEdit;
config.macros.option.propagateOption("chkShowQuickEdit","checked", config.options.chkShowQuickEdit,"input");
if (config.options.chkShowQuickEdit) saveOptionCookie("chkShowQuickEdit");
else removeCookie("chkShowQuickEdit");
src.innerHTML=config.commands.toggleQuickEdit.getText();
story.forEachTiddler(function(t,e){if (story.isDirty(t)) refreshElements(e);});
return false;
}
};
//}}}
// // COPIED FROM [[StickyPopupPlugin]] TO ELIMINATE PLUGIN DEPENDENCY
//{{{
if (config.options.chkStickyPopups==undefined) config.options.chkStickyPopups=false;
Popup.stickyPopup_onDocumentClick = function(ev)
{
// if click is in a sticky popup, ignore it so popup will remain visible
var e = ev ? ev : window.event; var target = resolveTarget(e);
var p=target; while (p) {
if (hasClass(p,"popup") && (hasClass(p,"sticky")||config.options.chkStickyPopups)) break;
else p=p.parentNode;
}
if (!p) // not in sticky popup (or sticky popups disabled)... use normal click handling
Popup.onDocumentClick(ev);
return true;
};
try{removeEvent(document,"click",Popup.onDocumentClick);}catch(e){};
try{addEvent(document,"click",Popup.stickyPopup_onDocumentClick);}catch(e){};
//}}}
/%
|Name|QuickEditToolbar|
|Source|http://www.TiddlyTools.com/#QuickEditToolbar|
|Version|2.4.3|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.2|
|Type|transclusion|
|Requires|QuickEditPlugin|
|Optional|QuickEdit_*|
|Description|format/insert TiddlyWiki content using toolbar buttons|
Usage:
* install [[QuickEditPlugin]] (runtime support functions)
* add the toolbar to [[EditTemplate]]:
<div macro='tiddler QuickEditToolbar with: show'></div>
* 'show' (optional) forces the toolbar to always be displayed or,
omit keyword and use <<option chkShowQuickEdit>> setting
* selected QuickEdit buttons can also be added individually to the
regular tiddler toolbar by adding references directly in [[EditTemplate]]:
<span class='toolbar' macro='tiddler QuickEdit_...'></span>
* see [[QuickEditPackage]] for additional installation options
%/<<tiddler HideTiddlerTags>>/%
%/{{hidden fine center quickEdit{
<<tiddler {{ // show/hide toolbar
var here=story.findContainingTiddler(place); if (here) var tid=here.getAttribute('tiddler');
var show='$1'!='$'+'1'||config.options.chkShowQuickEdit||tid=='QuickEditToolbar';
place.style.display=show?'block':'none';
'';}}>>/%
TOOLBAR DEFINITION - add, remove, or re-order items as desired:
= = = = = = = = = =
%/<<tiddler QuickEdit_replace>>/%
%/<<tiddler QuickEdit_split>>/%
%/<<tiddler QuickEdit_sort>>/%
%/<<tiddler QuickEdit_convert>>/%
%/ /% (SPACER)
%/<<tiddler QuickEdit_link>>/%
%/<<tiddler QuickEdit_insert>>/%
%/<<tiddler QuickEdit_macro>>/%
%/<<tiddler QuickEdit_image>>/%
%/ /% (SPACER)
%/<<tiddler QuickEdit_format>>/%
%/<<tiddler QuickEdit_align>>/%
%/<<tiddler QuickEdit_color>>/%
%/<<tiddler QuickEdit_font>>/%
%/ /% (SPACER)
%/<<tiddler QuickEdit_custom>>/%
%/}}}
/%
|Name|QuickEdit_align|
|Source|http://www.TiddlyTools.com/#QuickEdit_align|
|Version|2.4.3|
|Author|Eric Shulman|
|License|see http://www.TiddlyTools.com/#QuickEditPlugin|
|Type|html|
|Requires|QuickEditPlugin|
|Description|quickedit - text alignment|
Usage: see http://www.TiddlyTools.com/#QuickEditToolbar
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1"
title="align text"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
var s=createTiddlyElement(p,'select'); s.button=this;
s.options[0]=new Option('select text alignment...','');
s.options[s.length]=new Option('left','left');
s.options[s.length-1].title='{{left{...}}}';
s.options[s.length]=new Option('center','center');
s.options[s.length-1].title='{{center{...}}}';
s.options[s.length]=new Option('right','right');
s.options[s.length-1].title='{{right{...}}}';
s.options[s.length]=new Option('justify','justify');
s.options[s.length-1].title='{{justify{...}}}';
s.options[s.length]=new Option('float left','floatleft');
s.options[s.length-1].title='{{floatleft{...}}}';
s.options[s.length]=new Option('float right','floatright');
s.options[s.length-1].title='{{floatright{...}}}';
s.size=s.length;
s.onclick=function(){ if (!this.value.length) return;
config.quickEdit.wrapSelection(this.button,'{{'+this.value+'{','}}}');
Popup.remove(); return false;
};
s.onkeyup=config.quickEdit.keyup;
Popup.show();
s.focus();
return config.quickEdit.processed(event);"
>align</a></html>
/%
|Name|QuickEdit_color|
|Source|http://www.TiddlyTools.com/#QuickEdit_color|
|Version|2.4.3|
|Author|Eric Shulman|
|License|see http://www.TiddlyTools.com/#QuickEditPlugin|
|Type|html|
|Requires|QuickEditPlugin|
|Description|quickedit - text/background color|
Usage: see http://www.TiddlyTools.com/#QuickEditToolbar
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1"
title="text/background color - @@color:#RGB;background-color:#RGB;...@@"
onclick="var p=Popup.create(this,null,'popup sticky smallform'); if (!p) return false;
p.style.padding='2px';
function hex(d) { return '0123456789ABCDEF'.substr(d,1); }
var fg=createTiddlyElement(p,'select'); fg.button=this;
fg.style.width='12em';
fg.options[0]=new Option('text color...','');
fg.options[1]=new Option('\xa0 or enter a value','_ask');
fg.options[2]=new Option('\xa0 or use default color','');
for (var r=0;r<16;r+=3) for (var g=0;g<16;g+=3) for (var b=0;b<16;b+=3) {
var label=hex(r)+hex(g)+hex(b);
fg.options[fg.length]=new Option(label,'#'+label);
fg.options[fg.length-1].style.color='#'+label;
}
fg.onchange=function(){ var val=this.value;
if (val=='_ask') { val=prompt('Enter a CSS color value');
if (!val||!val.length) return false; }
this.options[0].value=val; this.options[0].text=val.length?'text: '+val:'text color...';
var bg=this.nextSibling;
for (var i=3;i<bg.options.length;i++) bg.options[i].style.color=val;
var preview=this.nextSibling.nextSibling.nextSibling;
var t=config.quickEdit.getSelection(config.quickEdit.getField(this.button));
t=t.replace(/^@@(color\:.+;)?(background-color\:.+;)?/,'').replace(/@@$/,'');
if (!t.length) t='~AaBbCcDdEeFfGgHhIiJj 1234567890';
var fg=this.value; if (fg.length) fg='color:'+fg+';';
var bg=this.nextSibling.value; if (bg.length) bg='background-color:'+bg+';';
if (fg.length||bg.length) t='@@'+fg+bg+t+'@@';
removeChildren(preview); wikify(t,preview);
this.selectedIndex=0; return false;
};
var bg=createTiddlyElement(p,'select'); bg.button=this;
bg.style.width='12em';
bg.options[0]=new Option('background color...','');
bg.options[1]=new Option('\xa0 or enter a value','_ask');
bg.options[2]=new Option('\xa0 or use default color','');
for (var r=0;r<16;r+=3) for (var g=0;g<16;g+=3) for (var b=0;b<16;b+=3) {
var label=hex(15-r)+hex(15-g)+hex(15-b);
bg.options[bg.length]=new Option(label,'#'+label);
bg.options[bg.length-1].style.backgroundColor='#'+label;
}
bg.onchange=function(){ var val=this.value;
if (val=='_ask') { val=prompt('Enter a CSS color value');
if (!val||!val.length) return false; }
this.options[0].value=val;
this.options[0].text=val.length?'background: '+val:'background color...';
var fg=this.previousSibling;
for (var i=3;i<fg.options.length;i++) fg.options[i].style.backgroundColor=val;
var preview=this.nextSibling.nextSibling;
var t=config.quickEdit.getSelection(config.quickEdit.getField(this.button));
t=t.replace(/^@@(color\:.+;)?(background-color\:.+;)?/,'').replace(/@@$/,'');
if (!t.length) t='~AaBbCcDdEeFfGgHhIiJj 1234567890';
var fg=this.previousSibling.value; if (fg.length) fg='color:'+fg+';';
var bg=this.value; if (bg.length) bg='background-color:'+bg+';';
if (fg.length||bg.length) t='@@'+fg+bg+t+'@@';
removeChildren(preview); wikify(t,preview);
this.selectedIndex=0; return false;
};
var b=createTiddlyElement(p,'input',null,null,null,{type:'button'}); b.button=this;
b.value='ok'; b.style.width='4em';
b.onclick=function() {
var fg=this.previousSibling.previousSibling.value; if (fg.length) fg='color:'+fg+';';
var bg=this.previousSibling.value; if (bg.length) bg='background-color:'+bg+';';
var t=config.quickEdit.getSelection(config.quickEdit.getField(this.button));
t=t.replace(/^@@(color\:.+;)?(background-color\:.+;)?/,'').replace(/@@$/,'');
if (fg.length||bg.length) config.quickEdit.setSelection(this.button,'@@'+fg+bg+t+'@@');
Popup.remove(); return false;
};
var preview=createTiddlyElement(p,'div',null,'viewer'); var s=preview.style;
s.border='1px solid'; s.margin='2px'; s.width='24em'; s.padding='3px'; s.MozBorderRadius='3px';
s.overflow='hidden'; s.textAlign='center'; s.whiteSpace='normal';
var t=config.quickEdit.getSelection(config.quickEdit.getField(this));
wikify(t.length?t:'~AaBbCcDdEeFfGgHhIiJj 1234567890',preview);
Popup.show();
event.cancelBubble=true;if(event.stopPropagation)event.stopPropagation();return false;"
>color</a></html>
/%
|Name|QuickEdit_convert|
|Source|http://www.TiddlyTools.com/#QuickEdit_convert|
|Version|2.4.3|
|Author|Eric Shulman|
|License|see http://www.TiddlyTools.com/#QuickEditPlugin|
|Type|html|
|Requires|QuickEditPlugin|
|Description|quickedit - convert between comma/tab-separated and TW table format|
Usage: see http://www.TiddlyTools.com/#QuickEditToolbar
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1"
title="convert between comma/tab-separated and TW table format"
onclick="var e=config.quickEdit.getField(this);
if (e) e.focus(); var txt=config.quickEdit.getSelection(e);
if (txt.indexOf(',')+txt.indexOf('\t')+txt.indexOf('|')==-3) {
alert('Please select text containing tabs, commas, or TiddlyWiki table syntax.');
return false;
}
var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
var s=createTiddlyElement(p,'select'); s.button=this;
s.options[0]=new Option('select a converter...','');
if (txt.indexOf(',')!=-1) {
s.options[s.length]=new Option('commas -> table','commasToTable');
s.options[s.length]=new Option('commas -> tabs','commasToTabs');
}
if (txt.indexOf('\t')!=-1) {
s.options[s.length]=new Option('tabs -> table','tabsToTable');
s.options[s.length]=new Option('tabs -> commas','tabsToCommas');
}
if (txt.indexOf('|')!=-1) {
s.options[s.length]=new Option('table -> tabs','tableToTabs');
s.options[s.length]=new Option('table -> commas','tableToCommas');
}
s.size=s.length;
s.onclick=function(){ if (!this.value.length) return;
var e=config.quickEdit.getField(this.button); if (!e) return false;
e.focus(); var txt=config.quickEdit.getSelection(e);
switch(this.value) {
case 'tabsToTable':
txt=txt.replace(/\t/g,'|').replace(/^|$/g,'|');
txt=txt.replace(/\n/g,'|\n|').replace(/^\|$/g,'');
break;
case 'tableToTabs':
txt=txt.replace(/\t/g,' ').replace(/\|/g,'\t');
txt=txt.replace(/^\t/g,'').replace(/\t$/g,'');
txt=txt.replace(/\n\t/g,'\n').replace(/\t\n/g,'\n');
break;
case 'commasToTable':
txt=txt.replace(/,/g,'|').replace(/^|$/g,'|');
txt=txt.replace(/\n/g,'|\n|').replace(/^\|$/g,'');
break;
case 'tableToCommas':
txt=txt.replace(/,/g,' ').replace(/\|/g,',');
txt=txt.replace(/^,/g,'').replace(/,$/g,'');
txt=txt.replace(/\n,/g,'\n').replace(/,\n/g,'\n');
break;
case 'tabsToCommas':
txt=txt.replace(/\t/g,',');
break;
case 'commasToTabs':
txt=txt.replace(/,/g,'\t');
break;
}
replaceSelection(e,txt);
Popup.remove(); return false;
};
s.onkeyup=config.quickEdit.keyup;
Popup.show();
s.focus();
return config.quickEdit.processed(event);"
>convert</a></html>
/%
|Name|QuickEdit_custom|
|Source|http://www.TiddlyTools.com/#QuickEdit_custom|
|Version|2.4.3|
|Author|Eric Shulman|
|License|see http://www.TiddlyTools.com/#QuickEditPlugin|
|Type|html|
|Requires|QuickEditPlugin|
|Description|quickedit - custom defined formats|
Usage: see http://www.TiddlyTools.com/#QuickEditToolbar
!help
Reminders:
Custom formats are stored as an "HR-separated list" in [[QuickEdit_customList]], where the first line of each list item is the text 'label' to show in the droplist, followed by one or more lines of wiki content to be inserted into the tiddler source.
Substitution markers can be used to dynamically insert values into the formatted output: $1 inserts the tiddler editor's current selected text. $[[message|default value]] interactively prompts for a value to be inserted. $[[message|$1]] uses the selected text as the default value. $[[message|{{javascript}}]] calculates the default value using javascript code.
!end help
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1" title="custom defined formats"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
var s=createTiddlyElement(p,'select'); s.button=this;
s.options[0]=new Option('select a custom format...','');
var items=store.getTiddlerText('QuickEdit_customList','').split('\n----\n');
for (var i=0; i<items.length; i++) {
if (!items[i].length) continue; var lines=items[i].split('\n');
var label=lines.shift(); var val=lines.join('\n');
s.options[s.length]=new Option(label,val); s.options[s.length-1].title=val;
}
s.options[s.length]=new Option('[Edit custom formats...]','_edit');
s.options[s.length-1].title='add/change custom format definitions...';
s.size=Math.min(s.length,15);
s.onclick=function(){ if (!this.value.length) return;
if (this.value=='_edit') {
alert(store.getTiddlerText('QuickEdit_custom##help'));
story.displayTiddler(story.findContainingTiddler(this.button),
'QuickEdit_customList',DEFAULT_EDIT_TEMPLATE);
} else {
var e=config.quickEdit.getField(this.button); if (!e) return false;
e.focus(); var txt=config.quickEdit.getSelection(e);
replaceSelection(e, this.value.replace(/\$\x31/g,txt)
.replace(/\$\[\[[^\]]+\]\]/g, function(t){
x=t.substr(3,t.length-5).split('|');
var msg=x[0]; var def=x[1]||'';
if (def.startsWith('{{')) {
try{def=eval(def.substr(2,def.length-4))} catch(ex){showException(ex)}
}
return prompt(msg,def)||'';
})
);
}
Popup.remove(); return false;
};
s.onkeyup=config.quickEdit.keyup;
Popup.show();
s.focus();
return config.quickEdit.processed(event);"
>custom</a></html>
timestamp
$[[enter a date|{{new Date().formatString('DDD, MMM DDth, YYYY hh12:0mm:0ssam')}}]]
----
scrollbox
@@display:block;height:10em;overflow:auto;$[[enter scrolling content|$1]]@@@@display:block;text-align:right;^^scroll for more...^^@@
----
nested slider
+++[$1]<<tiddler $1>>===
----
big red
@@font-size:36pt;color:red;$1@@
----
/%
|Name|QuickEdit_font|
|Source|http://www.TiddlyTools.com/#QuickEdit_font|
|Version|2.4.3|
|Author|Eric Shulman|
|License|see http://www.TiddlyTools.com/#QuickEditPlugin|
|Type|html|
|Requires|QuickEditPlugin|
|Description|quickedit - select font family|
Usage: see http://www.TiddlyTools.com/#QuickEditToolbar
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1"
title="set font-family CSS attribute - @@font-family:facename;...@@"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
var s=createTiddlyElement(p,'select'); s.button=this;
s.options[0]=new Option('select a font family...','');
var fonts=store.getTiddlerText('QuickEdit_fontList','').split('\n');
for (var i=0; i<fonts.length; i++) {
if (!fonts[i].length) continue;
s.options[s.length]=new Option(fonts[i],fonts[i]);
s.options[s.length-1].style.fontFamily=fonts[i];
}
s.options[s.length]=new Option('[Edit font list...]','_edit');
s.options[s.length-1].title='enter fonts, one per line...';
s.size=Math.min(s.length,15);
s.onclick=function(){
if (this.value=='_edit')
story.displayTiddler(story.findContainingTiddler(this.button),'QuickEdit_fontList',DEFAULT_EDIT_TEMPLATE);
else
config.quickEdit.wrapSelection(this.button,'@@font-family:\x22'+this.value+'\x22;','@@');
Popup.remove(); return false;
};
s.onkeyup=config.quickEdit.keyup;
Popup.show();
s.focus();
return config.quickEdit.processed(event);"
>font</a></html>
Arial,helvetica,sans-serif
Times New Roman,times,serif
Courier,monospaced
/%
|Name|QuickEdit_format|
|Source|http://www.TiddlyTools.com/#QuickEdit_format|
|Version|2.4.3|
|Author|Eric Shulman|
|License|see http://www.TiddlyTools.com/#QuickEditPlugin|
|Type|html|
|Requires|QuickEditPlugin|
|Description|quickedit - basic text formats, headings, blockquotes, etc.|
Usage: see http://www.TiddlyTools.com/#QuickEditToolbar
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1"
title="plain text (remove ALL formatting)" accesskey="P"
onclick="var e=config.quickEdit.getField(this); if (e) e.focus(); var txt=config.quickEdit.getSelection(e);
config.quickEdit.setSelection(e,wikifyPlainText(txt)); return false;"
> ~ </a></html>/%
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1"
title="''bold''" accesskey="B"
onclick="config.quickEdit.wrapSelection(this,'\x27\x27','\x27\x27'); return false;"
> B </a></html>/%
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1"
title="//italics//" accesskey="I"
onclick="config.quickEdit.wrapSelection(this,'//','//'); return false;"
> I </a></html>/%
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1"
title="__underline__" accesskey="U"
onclick="config.quickEdit.wrapSelection(this,'__','__'); return false;"
> U </a></html>/%
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1"
title="--strikethrough--" accesskey="S"
onclick="config.quickEdit.wrapSelection(this,'--','--'); return false;"
> S </a></html>/%
%/ /% SPACER
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1"
title="format text"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
var s=createTiddlyElement(p,'select'); s.button=this;
s.options[0]=new Option('select text format...','');
s.options[s.length]=new Option('CSS class wrapper','{{$1{,}}},Enter a CSS classname');
s.options[s.length-1].title='CSS class wrapper - {{classname classname etc{...}}}';
s.options[s.length]=new Option('inline CSS styles','@@$1,@@,Enter CSS (attribute:value;attribute:value;...;)');
s.options[s.length-1].title='inline CSS styles - @@attr:value;attr:value;...@@';
s.options[s.length]=new Option('heading 1','\n!,\n');
s.options[s.length-1].title='H1 heading - !';
s.options[s.length]=new Option('heading 2','\n!!,\n');
s.options[s.length-1].title='H2 heading - !!';
s.options[s.length]=new Option('heading 3','\n!!!,\n');
s.options[s.length-1].title='H3 heading - !!!';
s.options[s.length]=new Option('heading 4','\n!!!!,\n');
s.options[s.length-1].title='H4 heading - !!!!';
s.options[s.length]=new Option('heading 5','\n!!!!!,\n');
s.options[s.length-1].title='H5 heading - !!!!!';
s.options[s.length]=new Option('blockquote','\n\<\<\<\n,\n\<\<\<\n');
s.options[s.length-1].title='indented blockquote - \<\<\<';
s.options[s.length]=new Option('monospaced','{{{,}}}');
s.options[s.length-1].title='inline monospaced text - {{{...}}}';
s.options[s.length]=new Option('plain text','\n{{{\n,\n}}}\n');
s.options[s.length-1].title='multi-line monospaced text box - {{{...}}}';
s.options[s.length]=new Option('superscript','^^,^^');
s.options[s.length-1].title='^^superscript^^';
s.options[s.length]=new Option('subscript','~~,~~');
s.options[s.length-1].title='~~subscript~~';
s.options[s.length]=new Option('HTML','<html>,<\x2fhtml>');
s.options[s.length-1].title='HTML syntax - <html>...<\x2fhtml>';
s.options[s.length]=new Option('comment','/%,%/');
s.options[s.length-1].title='comment (hidden content) - /%...%/';
s.size=s.length;
s.onclick=function(){ if (!this.value.length) return;
var parts=this.value.split(',');
var prefix=parts[0]; var suffix=parts[1]; var ask=parts[2];
if (ask) {
var val=prompt(ask); if (!val) { Popup.remove(); return false; }
prefix=prefix.replace(/\$1/g,val); suffix=suffix.replace(/\$1/g,val);
}
config.quickEdit.wrapSelection(this.button,prefix,suffix);
Popup.remove(); return false;
};
s.onkeyup=config.quickEdit.keyup;
Popup.show();
s.focus();
return config.quickEdit.processed(event);"
>format</a></html>
/%
|Name|QuickEdit_image|
|Source|http://www.TiddlyTools.com/#QuickEdit_image|
|Version|2.4.3|
|Author|Eric Shulman|
|License|see http://www.TiddlyTools.com/#QuickEditPlugin|
|Type|html|
|Requires|QuickEditPlugin|
|Description|quickedit - embed an image|
Usage: see http://www.TiddlyTools.com/#QuickEditToolbar
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1"
title="embed an image (jpg/gif/png) - [img[tooltip|URL]] or [img[tooltip|path/to/file.ext]]"
onclick="var fn=config.quickEdit.promptForFilename(
'Enter/select an image file',getLocalPath(document.location.href),'');
if (!fn) return false; /* cancelled by user */
var h=document.location.href; var p=decodeURIComponent(h.substr(0,h.lastIndexOf('/')+1));
if (fn.startsWith(p)) fn=fn.substr(p.length); /* use RELATIVE path/filename.ext */
var tip=prompt('Enter a tooltip for this image',''); if (!tip) tip=''; else tip+='|';
return config.quickEdit.setSelection(this,'[img['+tip+fn+']]');"
>image</a></html>
/%
|Name|QuickEdit_insert|
|Source|http://www.TiddlyTools.com/#QuickEdit_insert|
|Version|2.4.3|
|Author|Eric Shulman|
|License|see http://www.TiddlyTools.com/#QuickEditPlugin|
|Type|html|
|Requires|QuickEditPlugin|
|Description|quickedit - insert content from another tiddler or external file|
Usage: see http://www.TiddlyTools.com/#QuickEditToolbar
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1"
title="insert content from another tiddler or external file"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
var s2=createTiddlyElement(p,'select'); s2.title='filter by tag';
s2.options[0]=new Option('filter by tag...','');
s2.options[s2.length]=new Option('[all tiddlers]','');
var tags=store.getTags();
for (var t=0; t<tags.length; t++) s2.options[s2.length]=new Option(tags[t][0],tags[t][0]);
s2.onchange=function(){
var tag=this.value;
var tids=tag.length?store.reverseLookup('tags',tag,true):store.reverseLookup('tags','excludeLists');
var list=this.nextSibling.nextSibling;
while (list.length) list.options[0]=null;
var prompt='select a tiddler or file...';
if (tag.length) prompt='select a tagged tiddler ['+tids.length+' matches]...';
list.options[0]=new Option(prompt,'');
if (!tag.length) list.options[list.length]=new Option('[browse for file...]','_file');
for (var t=0; t<tids.length; t++) {
list.options[list.length]=new Option(tids[t].title,tids[t].title);
list.options[list.length-1].title=tids[t].getSubtitle();
}
list.size=Math.min(list.length,10);
list.selectedIndex=0; list.focus();
this.style.width=list.offsetWidth+'px';
if (!tag.length) this.selectedIndex=0;
};
createTiddlyElement(p,'br');
var s=createTiddlyElement(p,'select'); s.button=this;
s.title='select a tiddler or file';
s.options[0]=new Option('select a tiddler or file...','');
s.options[s.length]=new Option('[browse for file...]','_file');
var tids=store.reverseLookup('tags','excludeLists');
for (var t=0; t<tids.length; t++) {
s.options[s.length]=new Option(tids[t].title,tids[t].title);
s.options[s.length-1].title=tids[t].getSubtitle();
}
s.size=Math.min(s.length,10);
s.onclick=function(){ if (!this.value.length) return false;
if (this.value=='_file') {
var fn=config.quickEdit.promptForFilename(
'Enter/select a text file',getLocalPath(document.location.href),'');
if (!fn) return false; /* cancelled by user */
var txt=loadFile(getLocalPath(fn));
if (!txt) { alert('Error: unable to read contents from \0027'+fn+'\0027'); return; }
}
else var txt=store.getTiddlerText(this.value);
if (!txt) {
displayMessage(this.value+' not found');
this.selectedIndex=0; this.focus();
return false;
}
config.quickEdit.setSelection(this.button,txt);
Popup.remove(); return false;
};
s.onkeyup=config.quickEdit.keyup;
Popup.show();
s2.style.width=s.offsetWidth+'px';
s.focus();
return config.quickEdit.processed(event);"
>insert</a></html>
/%
|Name|QuickEdit_link|
|Source|http://www.TiddlyTools.com/#QuickEdit_link|
|Version|2.4.3|
|Author|Eric Shulman|
|License|see http://www.TiddlyTools.com/#QuickEditPlugin|
|Type|html|
|Requires|QuickEditPlugin|
|Description|quickedit - link to tiddler or external file|
Usage: see http://www.TiddlyTools.com/#QuickEditToolbar
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1"
title="add a link to a tiddler or external file - [[link text|TiddlerName]]"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
var s2=createTiddlyElement(p,'select'); s2.title='filter by tag';
s2.options[0]=new Option('filter by tag...','');
s2.options[s2.length]=new Option('[all tiddlers]','');
var tags=store.getTags();
for (var t=0; t<tags.length; t++) s2.options[s2.length]=new Option(tags[t][0],tags[t][0]);
s2.onchange=function(){
var tag=this.value;
var tids=tag.length?store.reverseLookup('tags',tag,true):store.reverseLookup('tags','excludeLists');
var list=this.nextSibling.nextSibling;
while (list.length) list.options[0]=null;
var prompt='select a tiddler or file...';
if (tag.length) prompt='select a tagged tiddler ['+tids.length+' matches]...';
list.options[0]=new Option(prompt,'');
if (!tag.length) list.options[list.length]=new Option('[browse for file...]','_file');
for (var t=0; t<tids.length; t++) {
list.options[list.length]=new Option(tids[t].title,tids[t].title);
list.options[list.length-1].title=tids[t].getSubtitle();
}
list.size=Math.min(list.length,10);
list.selectedIndex=0; list.focus();
this.style.width=list.offsetWidth+'px';
if (!tag.length) this.selectedIndex=0;
};
createTiddlyElement(p,'br');
var s=createTiddlyElement(p,'select'); s.button=this;
s.title='select a tiddler or file';
s.options[0]=new Option('select a tiddler or file...','');
s.options[s.length]=new Option('[browse for file...]','_file');
var tids=store.reverseLookup('tags','excludeLists');
for (var t=0; t<tids.length; t++) {
s.options[s.length]=new Option(tids[t].title,tids[t].title);
s.options[s.length-1].title=tids[t].getSubtitle();
}
s.size=Math.min(s.length,10);
s.onclick=function(){ if (!this.value.length) return false;
var title=this.value; var txt=title;
if (title=='_file') {
title=config.quickEdit.promptForFilename('Select a file',
getLocalPath(document.location.href),'');
if (!title) { this.selectedIndex=0; this.focus(); return false; }
var txt=title.substr(title.lastIndexOf('/')+1);
}
var txt=prompt('Enter the text to display for this link',txt);
if (!txt) { this.selectedIndex=0; this.focus(); return false; }
config.quickEdit.setSelection(this.button,'[['+txt+'|'+title+']]');
Popup.remove(); return false;
};
s.onkeyup=config.quickEdit.keyup;
Popup.show();
s2.style.width=s.offsetWidth+'px';
s.focus();
return config.quickEdit.processed(event);"
>link</a></html>
/%
|Name|QuickEdit_macro|
|Source|http://www.TiddlyTools.com/#QuickEdit_macro|
|Version|2.4.3|
|Author|Eric Shulman|
|License|see http://www.TiddlyTools.com/#QuickEditPlugin|
|Type|html|
|Requires|QuickEditPlugin|
|Description|quickedit - embed a macro with 'guide text'|
Usage: see http://www.TiddlyTools.com/#QuickEditToolbar
Note:
Optional 'guideText' can be used to add suggested defaults/placeholders for specific macro parameters.
Add guideText to your own plugin-defined macros using:
config.macros.macroName.guideText='guide text goes here';
%/<<tiddler {{
/* define guide text for a few common TW core macros */
config.macros.edit.guideText='fieldname #rows';
config.macros.view.guideText='fieldname (link,wikified,date) format';
config.macros.slider.guideText='cookie TiddlerName label tooltip';
config.macros.option.guideText='(txtCookieName,chkCookieName)';
config.macros.tiddler.guideText='TiddlerName with: params...';
''; /* must return blank to suppress output */ }}>>/%
%/<html><hide linebreaks><a href='javascript:;' class='tiddlyLink' tabindex='-1'
title='add a macro - \<\<macroName ...\>\>'
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
var s=createTiddlyElement(p,'select'); s.button=this;
s.options[0]=new Option('select a macro...','');
var macros=[]; for (var m in config.macros) if (config.macros[m].handler) macros.push(m); macros.sort();
for (var i=0; i<macros.length; i++) { var m=macros[i];
var help=config.macros[m].guideText; if (!help) help=''; else help=' '+help;
s.options[s.length]=new Option(m,m+help);
s.options[s.length-1].title='\<\<'+m+help+'\>\>';
}
s.size=Math.min(s.length,15);
s.onclick=function(){ if (!this.value.length) return;
config.quickEdit.setSelection(this.button,'\<\<'+this.value+'\>\>');
Popup.remove(); return false;
};
s.onkeyup=config.quickEdit.keyup;
Popup.show();
s.focus();
return config.quickEdit.processed(event);"
>macro</a></html>
/%
|Name|QuickEdit_replace|
|Source|http://www.TiddlyTools.com/#QuickEdit_replace|
|Version|2.4.3|
|Author|Eric Shulman|
|License|see http://www.TiddlyTools.com/#QuickEditPlugin|
|Type|html|
|Requires|QuickEditPlugin|
|Description|quickedit - find/replace selected text with replacement text|
Usage: see http://www.TiddlyTools.com/#QuickEditToolbar
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1"
title="find/replace selected text with replacement text"
onclick="var here=story.findContainingTiddler(this); if (!here) return false;
var e=config.quickEdit.getField(here);
var s=config.quickEdit.getSelection(e);
var p=Popup.create(this,null,'popup sticky smallform'); if (!p) return false;
var t=createTiddlyElement(p,'input'); t.onfocus=function(){this.select()};
t.value=s.length?s:'enter target text';
var r=createTiddlyElement(p,'input'); r.onfocus=function(){this.select()};
r.value='enter replacement text';
var tid=here.getAttribute('tiddler');
var b=createTiddlyElement(p,'button',null,null,'?',{tid:tid});
b.style.width='2em';
b.title='FIND/FIND NEXT target text';
b.onclick=function(ev) { /* FIND */
var e=story.getTiddlerField(this.getAttribute('tid'),'text');
if (!e||e.getAttribute('edit')!='text') return;
var t=this.previousSibling.previousSibling;
e.focus();
if (e.setSelectionRange) { /* MOZ */
var newstart=e.value.indexOf(t.value,e.selectionStart+1);
if (newstart==-1) newstart=e.value.indexOf(t.value); /* wrap around */
if (newstart==-1) { alert('\u0022'+t.value+'\u0022 not found'); t.focus(); return; }
e.setSelectionRange(newstart,newstart+t.value.length);
var linecount=e.value.split('\n').length;
var thisline=e.value.substr(0,e.selectionStart).split('\n').length;
e.scrollTop=Math.floor((thisline-1-e.rows/2)*e.scrollHeight/linecount);
} else if (document.selection) { /* IE */
var range=document.selection.createRange();
if(range.parentElement()==e) {
range.collapse(false);
var found=false; try{found=range.findText(t.value,e.value.length,4)}catch(e){}
if (found) range.select();
else { alert('\u0022'+t.value+'\u0022 not found'); t.focus(); }
}
}
};
b=createTiddlyElement(p,'button',null,null,'=',{tid:tid});
b.style.width='2em';
b.title='REPLACE selected text';
b.onclick=function(ev) { /* REPLACE */
var e=story.getTiddlerField(this.getAttribute('tid'),'text');
if (!e||e.getAttribute('edit')!='text') return;
var t=this.previousSibling.previousSibling.previousSibling;
var r=this.previousSibling.previousSibling;
if ( (e.selectionStart!==undefined && e.selectionEnd==e.selectionStart)
|| (document.selection && document.selection.createRange().text==''))
this.previousSibling.click(); /* no selection... do FIND first */
if ( (e.selectionStart!==undefined && e.selectionEnd==e.selectionStart)
|| (document.selection && document.selection.createRange().text==''))
{ t.focus(); return; } /* still no selection... goto target input */
e.focus(); replaceSelection(e,r.value);
};
b=createTiddlyElement(p,'button',null,null,'+',{tid:tid});
b.style.width='2em';
b.title='REPLACE selected text AND FIND NEXT target text';
b.onclick=function(ev) { /* REPLACE and FIND NEXT */
this.previousSibling.click();
this.previousSibling.previousSibling.click();
};
b=createTiddlyElement(p,'button',null,null,'!',{tid:tid});
b.style.width='2em';
b.title='REPLACE ALL occurrences of target text';
b.onclick=function(ev) { /* REPLACE ALL */
var e=story.getTiddlerField(this.getAttribute('tid'),'text');
if (!e||e.getAttribute('edit')!='text') return;
var t=this.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling;
var r=this.previousSibling.previousSibling.previousSibling.previousSibling;
if (!t.value.length) { alert('Please enter the target text'); t.focus(); return; }
var m='This will replace all occurences of:\n\n';
m+='\''+t.value+'\'\n\nwith:\n\n\''+r.value+'\'\n\nAre you sure?';
if (!confirm(m)) { r.focus(); r.select(); return; }
e.value=e.value.replace(new RegExp(t.value.escapeRegExp(),'gm'),r.value);
e.focus(); e.select(); Popup.remove();
};
Popup.show();
if (!s.length) {t.focus();t.select()} else {r.focus();r.select()}
event.cancelBubble=true;if(event.stopPropagation)event.stopPropagation();return false;"
>replace</a></html>
/%
|Name|QuickEdit_sort|
|Source|http://www.TiddlyTools.com/#QuickEdit_sort|
|Version|2.4.3|
|Author|Eric Shulman|
|License|see http://www.TiddlyTools.com/#QuickEditPlugin|
|Type|html|
|Requires|QuickEditPlugin|
|Description|quickedit - sort lines of text|
Usage: see http://www.TiddlyTools.com/#QuickEditToolbar
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1"
title="sort lines of text"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
var s=createTiddlyElement(p,'select'); s.button=this;
s.options[0]=new Option('select sort order...','');
s.options[s.length]=new Option('ascending','A');
s.options[s.length-1].title='ascending';
s.options[s.length]=new Option('descending','D');
s.options[s.length-1].title='descending';
s.size=s.length;
s.onclick=function(){ if (!this.value.length) return;
var e=config.quickEdit.getField(this.button); if (!e) return false;
var lines=config.quickEdit.getSelection(e).split('\n').sort();
if (this.value=='D') lines=lines.reverse();
replaceSelection(e,lines.join('\n'));
e.focus();
Popup.remove(); return false;
};
s.onkeyup=config.quickEdit.keyup;
Popup.show();
s.focus();
return config.quickEdit.processed(event);"
>sort</a></html>
/%
|Name|QuickEdit_split|
|Source|http://www.TiddlyTools.com/#QuickEdit_split|
|Version|2.4.3|
|Author|Eric Shulman|
|License|see http://www.TiddlyTools.com/#QuickEditPlugin|
|Type|html|
|Requires|QuickEditPlugin|
|Description|quickedit - move selection to new tiddler and insert link, embedded tiddler, or slider|
Usage: see http://www.TiddlyTools.com/#QuickEditToolbar
Based on ideas originally developed by YannPerrin
(http://yann.perrin.googlepages.com/twkd.html#easySlicer)
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink" tabindex="-1"
title="move selection to new tiddler and insert link, embedded tiddler, or slider"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
p.style.whiteSpace='nowrap';
var i=createTiddlyElement(p,'input');
i.defaultValue='Enter a new tiddler title';
i.onfocus=function(){this.select()};
var s=createTiddlyElement(p,'select'); s.button=this;
s.options[0]=new Option('select type...','');
s.options[0].title='select split type';
s.options[1]=new Option('link','link');
s.options[1].title='replace with [[TiddlerName]]';
s.options[2]=new Option('embed','embed');
s.options[2].title='replace with \<\<tiddler TiddlerName\>\>';
s.options[3]=new Option('slider','slider');
s.options[3].title='replace with \<\<slider \u0022\u0022 [[TiddlerName]] [[label]] [[tooltip]]\>\>';
s.onchange=function(){
if (s.previousSibling.value==s.previousSibling.defaultValue)
{ alert('A tiddler title is required'); s.selectedIndex=0; s.previousSibling.focus(); return false; }
var tid=s.previousSibling.value;
if (store.tiddlerExists(tid) && !confirm(config.messages.overwriteWarning.format([tid])))
{ s.previousSibling.focus(); return false; }
switch(s.value) {
case 'link':
var newtxt='[['+tid+']]';
break;
case 'embed':
var newtxt='\<\<tiddler [['+tid+']]\>\>';
break;
case 'slider':
var label=prompt('Enter a slider label',tid);
if (!label) { Popup.remove(); return false; }
var tip=prompt('Enter a slider tooltip',label);
if (!tip) { Popup.remove(); return false; }
var newtxt='\<\<slider \u0022\u0022 [['+tid+']] [['+label+']] [['+tip+']]\>\>';
break;
}
var txt=config.quickEdit.getSelection(config.quickEdit.getField(this.button));
store.saveTiddler(tid,tid,txt,config.options.txtUserName,new Date(),[],{});
story.displayTiddler(story.findContainingTiddler(this.button),tid);
config.quickEdit.setSelection(this.button,newtxt);
Popup.remove(); return false;
};
Popup.show();
event.cancelBubble=true;if(event.stopPropagation)event.stopPropagation();return false;"
>split</a></html>
/%
|Name|QuickEdit_tiddler|
|Source|http://www.TiddlyTools.com/#QuickEdit_tiddler|
|Version|2.2.0|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.2|
|Type|script|
|Requires|QuickEditPlugin|
|Overrides||
|Description|definition for toolbar button that inserts content from another tiddler|
Usage:
QuickEditToolbar: <<tiddler QuickEdit_tiddler>>
OR
EditTemplate: <span class='toolbar' macro='tiddler QuickEdit_tiddler'></span>
**** INSERT TIDDLER ****
%/<html><hide linebreaks><a href="javascript:;" class="tiddlyLink"
title="copy content from another tiddler"
onclick="var p=Popup.create(this); if (!p) return false; p.className+=' sticky smallform';
var s=createTiddlyElement(p,'select'); s.button=this;
s.options[0]=new Option('select a tiddler...','');
s.onchange=function(){
var txt=store.getTiddlerText(this.value);
if (!txt) { displayMessage(this.value+' not found'); this.selectedIndex=0; this.focus(); return false; }
config.quickEdit.setSelection(this.button,txt);
Popup.remove(); return false;
};
var tids=store.getTiddlers('title');
for (var t=0; t<tids.length; t++) {
s.options[s.length]=new Option(tids[t].title,tids[t].title);
s.options[s.length-1].title=tids[t].getSubtitle();
}
var s=createTiddlyElement(p,'select');
s.options[0]=new Option('match tag...','');
s.onchange=function(){
var tag=this.value;
var tids=tag.length?store.getTaggedTiddlers(tag,'title'):store.getTiddlers('title');
var list=this.previousSibling;
while (list.length) list.options[0]=null;
var prompt='select a '+(tag.length?'tagged ':'')+'tiddler'+(tag.length?(' ['+tids.length+' matches]'):'')+'...';
list.options[0]=new Option(prompt,'');
for (var t=0; t<tids.length; t++) {
list.options[list.length]=new Option(tids[t].title,tids[t].title);
list.options[list.length-1].title=tids[t].getSubtitle();
}
};
var tags=store.getTags();
for (var t=0; t<tags.length; t++) s.options[s.length]=new Option(tags[t][0],tags[t][0]);
Popup.show(p,false);
event.cancelBubble=true;if(event.stopPropagation)event.stopPropagation();return false;"
>tiddler</a></html>
/***
|Name|RearrangeTiddlersPlugin|
|Source|http://www.TiddlyTools.com/#RearrangeTiddlersPlugin|
|Version|2.0.0|
|Author|Eric Shulman|
|OriginalAuthor|Joe Raii|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides|Story.prototype.refreshTiddler|
|Description|drag tiddlers by title to re-order story column display|
adapted from: http://www.cs.utexas.edu/~joeraii/dragn/#Draggable
changes by ELS:
* hijack refreshTiddler() instead of overridding createTiddler()
* find title element by className instead of elementID
* set cursor style via code instead of stylesheet
* set tooltip help text
* set tiddler "position:relative" when starting drag event, restore saved value when drag ends
* update 2006.08.07: use getElementsByTagName("*") to find title element, even when it is 'buried' deep in tiddler DOM elements (due to custom template usage)
* update 2007.03.01: use apply() to invoke hijacked core function
* update 2008.01.13: only hijack core function once. (allows for dynamic loading of plugin via bookmarklet)
* update 2008.10.19: added onclick popup menu with 'move to top' and 'move to bottom' commands
***/
//{{{
if (Story.prototype.rearrangeTiddlersHijack_refreshTiddler===undefined) {
Story.prototype.rearrangeTiddlersHijack_refreshTiddler = Story.prototype.refreshTiddler;
Story.prototype.refreshTiddler = function(title,template)
{
this.rearrangeTiddlersHijack_refreshTiddler.apply(this,arguments);
var theTiddler = document.getElementById(this.idPrefix + title); if (!theTiddler) return;
var theHandle;
var children=theTiddler.getElementsByTagName("*");
for (var i=0; i<children.length; i++) if (hasClass(children[i],"title")) { theHandle=children[i]; break; }
if (!theHandle) return theTiddler;
Drag.init(theHandle, theTiddler, 0, 0, null, null);
theHandle.style.cursor="move";
theHandle.title="drag title to re-arrange tiddlers, click for more options..."
theTiddler.onDrag = function(x,y,myElem) {
if (this.style.position!="relative")
{ this.savedstyle=this.style.position; this.style.position="relative"; }
y = myElem.offsetTop;
var next = myElem.nextSibling;
var prev = myElem.previousSibling;
if (next && y + myElem.offsetHeight > next.offsetTop + next.offsetHeight/2) {
myElem.parentNode.removeChild(myElem);
next.parentNode.insertBefore(myElem, next.nextSibling);//elems[pos+1]);
myElem.style["top"] = -next.offsetHeight/2+"px";
}
if (prev && y < prev.offsetTop + prev.offsetHeight/2) {
myElem.parentNode.removeChild(myElem);
prev.parentNode.insertBefore(myElem, prev);
myElem.style["top"] = prev.offsetHeight/2+"px";
}
};
theTiddler.onDragEnd = function(x,y,myElem) {
myElem.style["top"] = "0px";
if (this.savedstyle!=undefined)
this.style.position=this.savedstyle;
};
theHandle.onclick=function(ev) {
ev=ev||window.event;
var p=Popup.create(this); if (!p) return;
var b=createTiddlyButton(createTiddlyElement(p,"li"),
"\u25B2 move to top of column ","move this tiddler to the top of the story column",
function() {
var t=story.getTiddler(this.getAttribute("tid"));
t.parentNode.insertBefore(t,t.parentNode.firstChild); // move to top of column
window.scrollTo(0,ensureVisible(t));
return false;
});
b.setAttribute("tid",title);
var b=createTiddlyButton(createTiddlyElement(p,"li"),
"\u25BC move to bottom of column ","move this tiddler to the bottom of the story column",
function() {
var t=story.getTiddler(this.getAttribute("tid"));
t.parentNode.insertBefore(t,null); // move to bottom of column
window.scrollTo(0,ensureVisible(t));
return false;
});
b.setAttribute("tid",title);
Popup.show(p,false);
ev.cancelBubble=true; if (ev.stopPropagation) ev.stopPropagation(); return(false);
};
return theTiddler;
}
}
/**************************************************
* dom-drag.js
* 09.25.2001
* www.youngpup.net
**************************************************
* 10.28.2001 - fixed minor bug where events
* sometimes fired off the handle, not the root.
**************************************************/
var Drag = {
obj:null,
init:
function(o, oRoot, minX, maxX, minY, maxY) {
o.onmousedown = Drag.start;
o.root = oRoot && oRoot != null ? oRoot : o ;
if (isNaN(parseInt(o.root.style.left))) o.root.style.left="0px";
if (isNaN(parseInt(o.root.style.top))) o.root.style.top="0px";
o.minX = typeof minX != 'undefined' ? minX : null;
o.minY = typeof minY != 'undefined' ? minY : null;
o.maxX = typeof maxX != 'undefined' ? maxX : null;
o.maxY = typeof maxY != 'undefined' ? maxY : null;
o.root.onDragStart = new Function();
o.root.onDragEnd = new Function();
o.root.onDrag = new Function();
},
start:
function(e) {
var o = Drag.obj = this;
e = Drag.fixE(e);
var y = parseInt(o.root.style.top);
var x = parseInt(o.root.style.left);
o.root.onDragStart(x, y, Drag.obj.root);
o.lastMouseX = e.clientX;
o.lastMouseY = e.clientY;
if (o.minX != null) o.minMouseX = e.clientX - x + o.minX;
if (o.maxX != null) o.maxMouseX = o.minMouseX + o.maxX - o.minX;
if (o.minY != null) o.minMouseY = e.clientY - y + o.minY;
if (o.maxY != null) o.maxMouseY = o.minMouseY + o.maxY - o.minY;
document.onmousemove = Drag.drag;
document.onmouseup = Drag.end;
Drag.obj.root.style["z-index"] = "10";
return false;
},
drag:
function(e) {
e = Drag.fixE(e);
var o = Drag.obj;
var ey = e.clientY;
var ex = e.clientX;
var y = parseInt(o.root.style.top);
var x = parseInt(o.root.style.left);
var nx, ny;
if (o.minX != null) ex = Math.max(ex, o.minMouseX);
if (o.maxX != null) ex = Math.min(ex, o.maxMouseX);
if (o.minY != null) ey = Math.max(ey, o.minMouseY);
if (o.maxY != null) ey = Math.min(ey, o.maxMouseY);
nx = x + (ex - o.lastMouseX);
ny = y + (ey - o.lastMouseY);
Drag.obj.root.style["left"] = nx + "px";
Drag.obj.root.style["top"] = ny + "px";
Drag.obj.lastMouseX = ex;
Drag.obj.lastMouseY = ey;
Drag.obj.root.onDrag(nx, ny, Drag.obj.root);
return false;
},
end:
function() {
document.onmousemove = null;
document.onmouseup = null;
Drag.obj.root.style["z-index"] = "0";
Drag.obj.root.onDragEnd(parseInt(Drag.obj.root.style["left"]), parseInt(Drag.obj.root.style["top"]), Drag.obj.root);
Drag.obj = null;
},
fixE:
function(e) {
if (typeof e == 'undefined') e = window.event;
if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
return e;
}
};
//}}}
<<tiddler HideTiddlerBackground>><<tiddler HideTiddlerTags>>{{transparent smallform{<<recentChanges 30>>}}}
/***
|Name|RecentChangesPlugin|
|Source|http://www.TiddlyTools.com/#RecentChangesPlugin|
|Version|2.2.0|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Description|display droplist of recently changed tiddlers with goto, edit, and preview buttons|
!!!!!Usage
<<<
The {{{<<recentChanges>>}}} macro displays a droplist of all tiddlers that have been changed within the last N days (default=10 days).
{{{
<<recentChanges>>
<<recentChanges #ofdays summary noEdit previewheight previewclass>>
}}}
where:
* #ofdays specifies the time limit for listing changed tiddlers. Use 0 (zero) to list all tiddlers in the document.
* ''summary'' is an optional keyword that outputs only the summary text (without the droplist or buttons)
* ''noEdit'' is an optional keyword that hides the 'edit' button
* previewheight is a CSS height measurement and sets the FIXED height of the tiddler preview area (default is 15em)
* previewclass is any CSS classname, and can be used to apply custom styles to the preview area (default is to use the standard 'viewer' class)
<<<
!!!!!Examples
<<<
{{smallform{
{{{<<recentChanges>>}}}
<<recentChanges>>
{{{<<recentChanges 30 summary>>}}}
<<recentChanges 30 summary>>
{{{<<recentChanges 30 noedit 10em groupbox>>}}}
<<recentChanges 30 noedit 10em groupbox>>
}}}
<<<
!!!!!Revisions
<<<
2009.07.02 [2.2.0] added optional 'noedit' keyword to hide 'edit' button
2008.07.01 [2.1.0] added optional 'summary' keyword for simple text output
2008.05.01 [2.0.1] fixup for titles with double-quotes
2007.07.26 [2.0.0] re-written as plugin
2006.10.02 [1.0.0] initial release (as inline script ShowRecentChanges)
<<<
!!!!!Code
***/
//{{{
version.extensions.RecentChangesPlugin= {major: 2, minor: 2, revision: 0, date: new Date(2009,7,2)};
config.shadowTiddlers.RecentChanges='<recentChanges>>';
config.macros.recentChanges = {
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
var days=10; if (!isNaN(params[0])) days=parseInt(params[0]); // time limit in days (use 0 for all tiddlers)
var summary=params[1]&¶ms[1].toLowerCase()=='summary'; if (summary) params.shift();
var noedit=params[1]&¶ms[1].toLowerCase()=='noedit'; if (noedit) params.shift();
var height='15em'; if (params[1]) height=params[1]; // preview area fixed height
var previewclass='viewer'; if (params[2]) previewclass=params[2]; // preview area CSS class
var tiddlers=store.getTiddlers('modified','excludeLists').reverse();
var count=tiddlers.length;
if (days) {
var timelimit=(new Date()).getTime()-86400000*days;
for (var count=0; count<tiddlers.length && tiddlers[count].modified>timelimit; count++);
}
var s=count+' tiddlers have changed since ';
s+=new Date(timelimit).formatString('DDD, MMM DDth YYYY 0hh:0mm');
s+=' ('+days+' days ago)';
if (summary)
{ wikify(s,place); return; }
var opts='<option value="">'+s+'</option>';
for (var i=0; i<count; i++) { var t=tiddlers[i];
opts+='<option value="'+t.title.replace(/"/g,""")+'">';
opts+=t.modified.formatString('YYYY.0MM.0DD 0hh:0mm')+' - '+t.title;
opts+='</option>';
}
var h=store.getTiddlerText('RecentChangesPlugin##html')
h=h.replace(/%options%/,opts);
h=h.replace(/%listwidth%/,noedit?79.5:69.5);
h=h.replace(/%noedit%/,noedit?'none':'inline');
createTiddlyElement(place,'div').innerHTML=h;
var preview=createTiddlyElement(place,'div',null,previewclass);
preview.style.display='none';
preview.style.whiteSpace='normal';
preview.style.overflow='auto';
preview.style.height=height;
}
}
//}}}
/***
//{{{
!html
<form><select size=1 name="list" style="width:%listwidth%%"
onchange="this.form.goto.disabled=this.form.edit.disabled=this.form.preview.disabled=!this.value.length;
var target=this.parentNode.parentNode.nextSibling; removeChildren(target);
if (!this.value.length)
{ target.style.display='none'; this.form.preview.value='preview'; }
else if (target.style.display=='block') {
wikify('<'+'<tiddler [['+this.value+']]>'+'>',target);
target.style.display='block';
this.form.preview.value='done';
}
">%options%</select><!--
--><input type="button" name="goto" value="goto" disabled title="view selected tiddler" style="width:10%"
onclick="var target=this.parentNode.parentNode.nextSibling; removeChildren(target);
target.style.display='none'; this.form.preview.value='preview';
story.displayTiddler(story.findContainingTiddler(this),this.form.list.value);
"><input type="button" name="edit" value="edit" disabled title="edit selected tiddler" style="width:10%;display:%noedit%"
onclick="var target=this.parentNode.parentNode.nextSibling; removeChildren(target);
target.style.display='none'; this.form.preview.value='preview';
story.displayTiddler(story.findContainingTiddler(this),this.form.list.value,DEFAULT_EDIT_TEMPLATE);
"><input type="button" name="preview" value="preview" disabled title="show/hide tiddler preview" style="width:10%"
onclick="var target=this.parentNode.parentNode.nextSibling;
if (this.value=='preview') {
removeChildren(target);
wikify('<'+'<tiddler [['+this.form.list.value+']]>'+'>',target);
target.style.display=this.form.list.value.length?'block':'none'; this.value='done';
} else {
removeChildren(target);
target.style.display='none'; this.value='preview';
}
"></form>
!end
//}}}
***/
<script label="refresh" title="re-render this tiddler">
var here=story.findContainingTiddler(place); if (!here) return false;
story.refreshTiddler(here.getAttribute("tiddler"),null,true);
</script><script>place.lastChild.className='button';</script>
/***
|Name|RelatedTiddlersPlugin|
|Source|http://www.TiddlyTools.com/#RelatedTiddlersPlugin|
|Version|1.1.8|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Requires|InlineJavascriptPlugin, NestedSlidersPlugin, StyleSheetShortcuts|
|Description|starting from a selected tiddler, display a list and/or tree of linked or transcluded tiddlers|
!!!!!Usage
<<<
Starting from a specified tiddler (default=current tiddler), {{{<<relatedTiddlers>>}}} recursively follows the internal links[] data to find all other tiddlers that are related to it by linking (e.g., {{{[[TiddlerName]]}}}) or used as macro parameter (e.g., {{{<<tiddler TiddlerName>>}}}).
The results can be displayed as a simple flat list of related tiddler titles, or as an indented tree diagram that shows the specific connections between the related tiddlers, and can be helpful for identifying clusters of interdependent tiddlers or simply generating an on-the-fly site map for quick discovery and navigation through complex or unfamiliar document content.
//{{{
<<relatedTiddlers TiddlerName hideform "exclude list">>
//}}}
*''TiddlerName'' (optional)<br>specifies the starting tiddler (and hides the 'select a tiddler' form controls). Use keyword ''here'' to specify the current tiddler.
*''hideform'' (optional)<br>when present, suppress display of 'select tiddler' droplist and buttons.
*''"exclude list"'' (optional)<br>space-separated list of tiddlers whose links should not be followed. Use quotes or double-square brackets to ensure list is processed as a single parameter.
The plugin also defines two functions that can be called externally (from other plugins or scripts) to generate and retrieve either a list of links or a formatted "tree view":
>{{{var list=config.macros.relatedTiddlers.getList(start,exclude,callback);}}}
>{{{var tree=config.macros.relatedTiddlers.getTree(start,exclude,callback);}}}
where ''start'' and ''exclude'' are the same as the macro parameters described above, plus an optional reference to a callback function that allows you to generate an alternative list/tree, based on application-specific data (such tiddler references contained in tags or custom fields), rather than using the default "links" list, like this:
>{{block{
{{{
window.myCallback=function(tiddler) {
var list=[];
// ... fill the list based on the specified tiddler ...
return list;
}
}}}
}}}
The function takes a tiddler object as input, and returns a list of tiddler titles that are //directly// linked (or otherwise related) to that specific tiddler. {{{getList()}}} and {{{getTree()}}} then use this information to find all the //indirect// connections between tiddlers to produce the list or tree output.
<<<
!!!!!Configuration
<<<
<<option chkRelatedTiddlersShowList>> show list display
<<option chkRelatedTiddlersShowTree>> show tree display
<<option chkRelatedTiddlersZoom>> enable autosizing of tree display //(aka, "zoom" or "shrink-and-grow")//
don't follow links contained in these tiddlers: <<option txtRelatedTiddlersExclude>>
<<<
!!!!!Examples
<<<
{{smallform{<<relatedTiddlers>>}}}
Using getList()/getTree() public API from other scripts/plugins:
><script show>
var start="About";
var exclude=config.options.txtRelatedTiddlersExclude.readBracketedList();
var callback=null;
var list=config.macros.relatedTiddlers.getList(start,exclude,callback);
var tree=config.macros.relatedTiddlers.getTree(start,exclude,callback);
return "There are "+list.length+" tiddlers related to [["+start+"]]...\n"+tree;
</script>
<<<
!!!!!Revisions
<<<
2009.09.29 [1.1.8] in findRelatedTiddlers(), fixed recursion when using non-null callback
2007.11.11 [1.1.7] in findRelatedTiddlers(), refactored into separate getlinks(),<br>and added param for optional callback function that can be used to return an alternative set of links.<br>Also added API functions, getTree() and getList() for use by other scripts
2007.07.13 [1.1.6] performance optimizations, more code cleanup
2007.07.10 [1.1.5] extensive code cleanup
2007.07.08 [1.1.0] converted from inline script
2007.06.29 [1.0.0] started (as inline script)
<<<
!!!!!Code
***/
//{{{
version.extensions.RelatedTiddlersPlugin={major: 1, minor: 1, revision: 8, date: new Date(2009,9,29)};
// initialize 'autozoom' and 'exclude' tree options (defaults are not to zoom, and to follow all links)
if (config.options.chkRelatedTiddlersZoom===undefined)
config.options.chkRelatedTiddlersZoom=false;
if (config.options.txtRelatedTiddlersExclude===undefined)
config.options.txtRelatedTiddlersExclude='GettingStarted DefaultTiddlers';
if (config.options.chkRelatedTiddlersShowList===undefined)
config.options.chkRelatedTiddlersShowList=true;
if (config.options.chkRelatedTiddlersShowTree===undefined)
config.options.chkRelatedTiddlersShowTree=false;
config.macros.relatedTiddlers={
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
// create form with unique DOM element ID (using current timestamp)... permits multiple form instances
var now=new Date().getTime();
var span=createTiddlyElement(place,"span");
span.innerHTML=this.form.format(["relatedTiddlers_form"+now]);
var form=span.getElementsByTagName("form")[0]; // find form that we just created
var target=createTiddlyElement(span,"div"); // create target block in which generated output will be placed
// initialize droplist contents (all tiddlers except hidden ones)
var tids=store.getTiddlers('title','excludeLists');
for (i=0; i<tids.length; i++) form.list.options[form.list.options.length]=new Option(tids[i].title,tids[i].title,false,false);
// initialize exclude field (space-separated list)
if (config.options.txtRelatedTiddlersExclude) form.exclude.value=config.options.txtRelatedTiddlersExclude;
// set starting tiddler, form display, and/or exclude list from macro params (if present) and then show the results!
var root="";
var hide=false;
var exclude=config.options.txtRelatedTiddlersExclude;
if (params[0]) root=params[0]; // TiddlerName
if (params[1]) hide=(params[1].toLowerCase()=="hideform"); // keyword: "hideform" or "showform" (default)
if (params[2]) exclude=params[2]; // list of tiddlers whose links should not be followed
if (root=="here") { var tid=story.findContainingTiddler(place); if (tid) root=tid.getAttribute("tiddler"); }
if (store.tiddlerExists(root)) {
// NOTE: don't hide form when running IE, where putting initial focus on hidden form creates an error
if (!config.browser.isIE) form.style.display=hide?"none":"block"; // show/hide the controls
form.list.value=root; // set the root
form.exclude.value=exclude; // set 'exclude' field
form.get.click(); // DISPLAY INITIAL RESULTS (if tiddler is selected)
}
},
form:
"<form id='%0' action='javascript:;' style='display:inline;margin:0;padding:0;' onsubmit='return false'><!-- \
--><span class='fine' style='float:left;vertical-align:bottom;width:39.5%;'><i>find all tiddlers related to:</i></span><!-- \
--><span class='fine' style='float:left;vertical-align:bottom;'><i>exclude links contained in:</i></span><!-- \
--><div style='clear:both'><!-- \
--><select name=list size=1 style='width:39.5%' onchange='this.form.get.click()'><!-- \
--><option value=''>select a tiddler...</option><!-- \
--></select><!-- \
--><input type='text' option='txtRelatedTiddlersExclude' name='exclude' value='' style='width:40%' \
title='enter the names of tiddlers whose links should NOT be followed' \
onkeyup='if (event.keyCode==13) { this.blur(); this.form.get.click(); }' \
onchange='config.options[this.getAttribute(\"option\")]=this.value;saveOptionCookie(this.getAttribute(\"option\"));'><!-- \
--><input type=button name=get value='get related' style='width:10%' \
onclick='config.macros.relatedTiddlers.show(this.form,this.form.nextSibling);'><!-- \
--><input type=button name=done value='done' disabled style='width:10%' \
onclick='this.form.list.selectedIndex=0; this.form.get.click();'><!-- \
--></div><!-- \
--></form>",
styles:
".relatedTiddlers blockquote \
{ border-left:1px dotted #999; margin:0 25px; padding-left:.5em; font-size:%0%; line-height:115%; } \
.relatedTiddlers .borderleft \
{ margin:0; padding:0; margin-left:1em; border-left:1px dotted #999; padding-left:.5em; } \
.relatedTiddlers .fourcolumns \
{ display:block; -moz-column-count:4; -moz-column-gap:1em; -moz-column-width:25%} \
.relatedTiddlers a \
{ font-weight:normal; } \
.relatedTiddlers .bold, .relatedTiddlers .bold a \
{ font-weight:bold; } \
.relatedTiddlers .floatright \
{ float:right; } \
.relatedTiddlers .clear \
{ clear:both; } ",
toggleform:
"{{floatright{<html><a href='javascript:;' class='button' title='show/hide tiddler selection droplist and buttons' \
onclick='var here=story.findContainingTiddler(this); var tid=here?here.getAttribute(\"tiddler\"):\"\"; \
var f=document.getElementById(\"%0\"); var hide=(f.style.display!=\"none\"); \
f.style.display=hide?\"none\":\"inline\"; this.innerHTML=hide?\"show form\":\"hide form\"; return false;'>%1</a></html>}}}",
treecheck:
"{{floatright{@@display:none;<<option chkRelatedTiddlersShowTree>>@@<html><a href='javascript:;' class='button' onclick='this.parentNode.previousSibling.firstChild.click(); return false;'>tree view</a></html>}}}",
tree:
"{{clear{\n----\n}}} \
{{floatright small{<<option chkRelatedTiddlersZoom>>autosize tree display}}} \
{{fine{\n''tiddlers linked from or included by'' [[%0]]\n}}}%1",
listcheck:
"{{floatright{@@display:none;<<option chkRelatedTiddlersShowList>>@@<html><a href='javascript:;' class='button' onclick='this.parentNode.previousSibling.firstChild.click(); return false;'>list view</a></html>}}}",
list:
"{{clear{\n----\n}}} \
{{fine{\n''tiddlers containing links to'' [[%0]]\n}}} \
{{small fourcolumns borderleft{\n%1}}} \
{{fine{\n''tiddlers linked from or included by'' [[%0]]\n}}} \
{{borderleft{\n \
{{fine{\n''bold''=//direct links//, plain=//indirect links//, ''...''=//links not followed//}}} \
{{small fourcolumns{\n%2}}} \
}}}",
skipped:
"<html><span title='links from %0 have NOT been followed'>...</span></html>",
mouseover: function(ev) {
this.saveSize=this.style.fontSize;
this.style.fontSize='100%';
this.style.borderLeftStyle='solid';
},
mouseout: function(ev) {
this.style.fontSize=this.saveSize;
this.style.borderLeftStyle='dotted';
},
findRelatedTiddlers: function(tid,tids,treeout,level,exclude,callback) {
// recursively build list of related tids (links and includes FROM the root tiddler) and generate treeview output
var t=store.getTiddler(tid);
if (!t || tids.contains(tid)) return tids; // tiddler already in results (or missing tiddler)... just return current results
tids.push(t.title); // add tiddler to results
var skip=exclude && exclude.contains(tid);
treeout.text+=level+"[["+tid+"]]"+(skip?this.skipped.format([tid]):"")+"\n";
if (skip) return tids; // branch is pruned... don't follow links
var links=callback?callback(t):this.getLinks(t);
for (var i=0; i<links.length; i++) tids=this.findRelatedTiddlers(links[i],tids,treeout,level+">",exclude,callback);
return tids;
},
getLinks: function(tiddler) {
if (!tiddler.linksUpdated) tiddler.changed();
return tiddler.links;
},
getTree: function(start,exclude,callback) {
// get related tiddlers and generate blockquote-indented tree output
var list=[]; var tree={text:""}; var level="";
list=this.findRelatedTiddlers(start,list,tree,level,exclude,callback);
return tree.text;
},
getList: function(start,exclude,callback) {
// get related tiddlers and generate blockquote-indented tree output
var list=[]; var tree={text:""}; var level="";
list=this.findRelatedTiddlers(start,list,tree,level,exclude,callback);
return list;
},
show: function(form,target) {
removeChildren(target); form.done.disabled=true; // clear any existing output and disable 'done' button
var start=form.list.value; if (!start.length) return; // get selected starting tiddler. If blank value (heading), do nothing
// get related tiddlers and generate blockquote-indented tree output
var rels=[]; var treeview={text:""}; var level="";
var exclude=config.options.txtRelatedTiddlersExclude.readBracketedList();
var rels=this.findRelatedTiddlers(start,rels,treeview,level,exclude);
rels.shift(); // remove self from list
rels.sort(); // sort titles alphabetically
// generate list output
var tid=store.getTiddler(start);
var relsview=""; for (t=0; t<rels.length; t++) {
relsview+=tid.links.contains(rels[t])?("{{bold{[["+rels[t]+"]]}}}"):("[["+rels[t]+"]]");
if (exclude && exclude.contains(rels[t])) relsview+=this.skipped.format([rels[t]]);
relsview+="\n";
}
// get references TO the root tiddler, add to related tiddlers and generate refsview output
var refs=[]; var referers=store.getReferringTiddlers(start);
for(var r=0; r<referers.length; r++)
if(referers[r].title!=start && !referers[r].tags.contains("excludeLists")) refs.push(referers[r].title);
var refcount=refs.length; var relcount=rels.length; // remember individual counts
for (var r=0; r<refs.length; r++) rels.pushUnique(refs[r]); // combine lists without duplicates
var total=rels.length; // get combined total
var refsview="[["+refs.sort().join("]]\n[[")+"]]\n";
// set custom blockquote styles for treeview
setStylesheet(this.styles.format([config.options.chkRelatedTiddlersZoom?80:100]),'relatedTiddlers_styles');
// assemble and render output
var summary=(total?(total+" tiddler"+(total==1?" is":"s are")):"There are no tiddlers")+" related to: [["+start+"]]";
var list=this.list.format([start,refsview.length?refsview:"//none//",relsview.length?relsview:"//none//"]);
var tree=this.tree.format([start,treeview.text]);
var toggle=this.toggleform.format([form.id,(form.style.display=='none'?'show form':'hide form')]);
var sep="{{floatright{ | }}}";
var showList=total && config.options.chkRelatedTiddlersShowList;
var showTree=relcount && config.options.chkRelatedTiddlersShowTree;
var out="{{relatedTiddlers{"+toggle+(relcount?sep+this.treecheck:"")+(total?sep+this.listcheck:"")+summary+(showList?list:"")+(showTree?tree:"")+"}}}";
wikify(out,target);
form.done.disabled=false; // enable 'done' button
// add mouseover/mouseout handling to blockquotes (for autosizing)
var blocks=target.getElementsByTagName("blockquote");
for (var b=0; b<blocks.length; b++)
{ blocks[b].onmouseover=this.mouseover; blocks[b].onmouseout=this.mouseout; }
// add side-effect to checkboxes so that display is refreshed when a checkbox state is changed
var checks=target.getElementsByTagName("input");
for (var c=0; c<checks.length; c++) {
if (checks[c].type.toLowerCase()!="checkbox") continue;
checks[c].coreClick=checks[c].onclick; // save standard click handler
checks[c].formID=form.id; // link checkbox with correponding form
checks[c].onclick=function() { this.coreClick.apply(this,arguments); document.getElementById(this.formID).get.click(); }
}
}
}
//}}}
Do not use the upsizing wizard from Access ... use SSMA, the SQL Server Migration Assistant for Access which is provided for free by Microsoft. [[source|http://stackoverflow.com/questions/559394/ms-access-application-convert-data-storage-from-access-to-sql-server]]
!!! Round UP to the nearest dollar.
Good for items > $25
{{{New: Round([PriceList]+0.5,0)}}}
!!! Round UP to the nearest tensies.
Good for items > $400
{{{New: [PriceList]+10-([PriceList] Mod 10)}}}
{{{Table List1 UNION table List2}}}
This assumes both tables have identical structure. It returns only unique records!
{{{SELECT Alpha1, "1" as Source FROM List1 UNION SELECT Alpha2, "2" as Source FROM List2 ORDER BY Source}}}
This uses tables of possibly different structure, but selects only one field from each (these fields are the same data type). It also adds a field that lets you know which table is the source of a particular record. Doing this forces all records to appear.
''MAS 90/Providex flavor of SQL''
~Pass-Through SQL query must be readable to the server.
* No closing semi-colon
* Date format
* Single quote marks, not double
* Wildcard {{{*}}} is replaced by {{{%}}}
* Aliases do not use the word {{{AS}}}
* No support (?!) for LIMIT or TOP to limit results.
* {{{JOIN}}} syntax is significantly different
{{{
SELECT ItemNumber, TransactionDate, RefDate,
TransactionRefNumber, TransactionCode
FROM IM5_TransactionDetail
WHERE ItemNumber='15-1501'
AND TransactionDate>{ d '2010-07-14' } AND TransactionDate<{ d '2010-10-31' }
}}}
''Sybase flavor of SQL''
* No closing semi-colon
* Date format
* Single quote marks, not double
* Wildcard {{{*}}} is replaced by {{{%}}}
* Wildcard {{{_}}} for single character
* Aliases do not use the word {{{AS}}} (must confirm)
* http://www.selectorweb.com/sql_sybase.html (not known how current this)
{{{
SELECT PartNumber, Weight, ROUND(11 + (30-10)*RAND(),0)/2 generated
FROM MATMaterials ORDER BY Weight DESC
select PartNumber, Weight from MATMaterials where Weight between 2 and 2.5
UPDATE MATMaterials SET Weight = ROUND(11 + (30-10)*RAND(),0)
WHERE NOT BuyItem
CONVERT(Weight, SQL_CHAR) AS PartWeight
SELECT StockCodeID, PartNumber, Description, InternalDescription, Obsolete
FROM MATMaterials
WHERE (Description LIKE '%PALMS%' OR InternalDescription LIKE '%PALMS%')
ORDER BY PartNumber
SELECT PartNumber, Description, CatalogItem, MakeItem, BuyItem
FROM MATMaterials
WHERE PartNumber LIKE '02-____'
UPDATE MATMaterials SET BuyItem = TRUE, MakeItem = FALSE
WHERE PartNumber LIKE '02-____'
SELECT PartNumber, Traceable
FROM MATMaterials
ORDER BY Traceable DESC
SELECT PartNumber, DefaultTravelerType, CatalogItem, MakeItem, BuyItem, StockItem
FROM MATMaterials
ORDER BY MTravelerTemplateID
SELECT PartNumber, DefaultTravelerType, CatalogItem, MakeItem, BuyItem, StockItem
FROM MATMaterials
WHERE DefaultTravelerType IS NULL
UPDATE MATMaterials SET UofM = 'EA'
WHERE (UofM='EACH')
UPDATE MATMaterials SET DefaultWH = 'SNM'
WHERE DefaultWH IS NULL
}}}
/***
|Name|SaveAsPlugin|
|Source|http://www.TiddlyTools.com/#SaveAsPlugin|
|Documentation|http://www.TiddlyTools.com/#SaveAsPluginInfo|
|Version|2.6.1|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Description|Save current document to a different path/filename|
Adds 'save as' command to 'backstage' menu and {{{<<saveAs>>}}} macro (to embed command link wherever you like).
>//Note: This plugin replaces functionality previously provided by [[NewDocumentPlugin]], except for the HTML+CSS 'snapshot' feature, which has been moved to a separate [[SnapshotPlugin]].//
!!!!!Documentation
<<<
see [[SaveAsPluginInfo]]
<<<
!!!!!Revisions
<<<
2009.08.04 [2.6.1] fixed handling when limit is omitted
| Please see [[SaveAsPluginInfo]] for additional revision details |
2006.02.03 [1.0.0] Created
<<<
!!!!!Code
***/
//{{{
version.extensions.SaveAsPlugin= {major: 2, minor: 6, revision: 1, date: new Date(2009,8,4)};
config.macros.saveAs = {
label: 'save as...',
labelparam: 'label:',
prompt: 'Save current document to a different path/file',
promptparam: 'prompt:',
filePrompt: 'Please select or enter a target path/filename',
targetparam: 'target:',
defaultFilename: 'new.html',
filenameparam: 'filename:',
currfilekeyword: 'here',
typeparam: 'type:',
type_TW: 'tw', type_PS: 'ps', type_TX: 'tx', type_CS: 'cs', type_NF: 'nf', // file type tokens
type_map: { // map filetype param alternatives/abbreviations to token values
tiddlywiki:'tw', tw:'tw', wiki: 'tw',
purestore: 'ps', ps:'ps', store:'ps',
plaintext: 'tx', tx:'tx', text: 'tx',
comma: 'cs', cs:'cs', csv: 'cs',
newsfeed: 'nf', nf:'nf', xml: 'nf', rss:'nf'
},
limitparam: 'limit:',
replaceparam: 'replace',
mergeparam: 'merge',
quietparam: 'quiet',
openparam: 'open',
askParam: 'ask',
askMsg: "Enter a tag filter (use * for all tiddlers, 'none' for blank document)",
emptyParam: 'none',
confirmmsg: "Found %0 tiddlers matching\n\n'%1'\n\nPress OK to proceed",
mergeprompt: '%0\nalready contains tiddler definitions.\n'
+'\nPress OK to add new/revised tiddlers to current file contents.'
+'\nPress Cancel to completely replace file contents',
mergestatus: 'Merged %0 new/revised tiddlers and %1 existing tiddlers',
okmsg: '%0 tiddlers written to %1',
failmsg: 'An error occurred while creating %1',
filter: '',
handler: function(place,macroName,params) {
if ((params[0]||'').startsWith(this.labelparam))
var label=params.shift().substr(this.labelparam.length);
if ((params[0]||'').startsWith(this.promptparam))
var prompt=params.shift().substr(this.promptparam.length);
if ((params[0]||'').startsWith(this.targetparam))
var target=params.shift().substr(this.targetparam.length);
if ((params[0]||'').startsWith(this.filenameparam))
var filename=params.shift().substr(this.filenameparam.length);
if ((params[0]||'').startsWith(this.typeparam))
var filetype=this.type_map[params.shift().substr(this.typeparam.length).toLowerCase()];
if ((params[0]||'').startsWith(this.limitparam))
var limit=params.shift().substr(this.limitparam.length);
var q=((params[0]||'')==this.quietparam); if (q) params.shift();
var o=((params[0]||'')==this.replaceparam); if (o) params.shift();
var m=((params[0]||'')==this.mergeparam); if (m) params.shift();
var a=((params[0]||'')==this.openparam); if (a) params.shift();
var btn=createTiddlyButton(place,label||this.label,prompt||this.prompt,
function(){ config.macros.saveAs.go( this.getAttribute('target'),
this.getAttribute('filename'), this.getAttribute('filetype'),
this.getAttribute('filter'), this.getAttribute('limit'),
this.getAttribute('quiet')=='true', this.getAttribute('overwrite')=='true',
this.getAttribute('merge')=='true', this.getAttribute('autoopen')=='true');
return false; }
);
if (target) btn.setAttribute('target',target);
if (filename) btn.setAttribute('filename',filename);
btn.setAttribute('filetype',filetype||this.type_TW);
btn.setAttribute('filter',params.join(' '));
btn.setAttribute('limit',limit||0);
btn.setAttribute('quiet',q?'true':'false');
btn.setAttribute('overwrite',o?'true':'false');
btn.setAttribute('merge',m?'true':'false');
btn.setAttribute('autoopen',a?'true':'false');
},
go: function(target,filename,filetype,filter,limit,quiet,overwrite,merge,autoopen) {
var cm=config.messages; // abbreviation
var cms=config.macros.saveAs; // abbreviation
if (window.location.protocol!='file:') // make sure we are local
{ displayMessage(cm.notFileUrlError); return; }
// get tidders, confirm filtered results
var tids=cms.selectTiddlers(filter);
if (tids===false) return; // cancelled by user
if (cms.filter!=cms.emptyParam && cms.filter.length && !quiet)
if (!confirm(cms.confirmmsg.format([tids.length,cms.filter]))) return;
// get target path/filename
if (!filetype) filetype=this.type_TW;
target=target||cms.getTarget(filename,filetype==this.type_TX?'txt':filetype==this.type_CS?'csv':'html');
if (!target) return; // cancelled by user
var link='file:///'+target.replace(/\\/g,'/');
var samefile=link==decodeURIComponent(window.location.href);
var p=getLocalPath(document.location.href);
if (samefile) {
if (config.options.chkSaveBackups) { var t=loadOriginal(p);if(t)saveBackup(p,t); }
if (config.options.chkGenerateAnRssFeed && saveRss instanceof Function) saveRss(p);
}
var notes='';
var total={val:0};
var out=this.assembleFile(target,filetype,tids,limit,notes,quiet,overwrite,merge,total);
var ok=saveFile(target,out);
if (ok && autoopen) {
if (!samefile) window.open(link).focus();
else { store.setDirty(false); window.location.reload(); }
}
if (!quiet || !(ok && autoopen))
displayMessage((ok?this.okmsg:this.failmsg).format([total.val,target]),link);
},
selectTiddlers: function(filter) {
var cms=config.macros.saveAs; // abbreviation
var tids=[]; cms.filter=filter||'';
if (filter==cms.emptyParam) tids=[];
if (filter==config.macros.saveAs.askParam) {
filter=prompt(config.macros.saveAs.askMsg,'');
if (!filter) return false; // cancelled by user
cms.filter=filter=='*'?'':filter;
}
if (!filter||!filter.length||filter=='*') tids=store.getTiddlers('title');
else tids=store.filterTiddlers('[tag['+filter+']]');
return tids;
},
getTarget: function(defName,defExt) {
var cms=config.macros.saveAs; // abbreviation
// get new target path/filename
var newPath=getLocalPath(window.location.href);
var slashpos=newPath.lastIndexOf('/'); if (slashpos==-1) slashpos=newPath.lastIndexOf('\\');
if (slashpos!=-1) newPath=newPath.substr(0,slashpos+1); // trim filename
if (!defName||!defName.length) { // use current filename as default
var p=getLocalPath(window.location.href);
var s=p.lastIndexOf('/'); if (s==-1) s=p.lastIndexOf('\\');
if (s!=-1) defName=p.substr(s+1);
}
var defFilename=(defName||cms.defaultFilename).replace(/.html$/,'.'+defExt);
var target=cms.askForFilename(cms.filePrompt,newPath,defFilename,defExt);
if (!target) return; // cancelled by user
// if specified file does not include a path, assemble fully qualified path and filename
var slashpos=target.lastIndexOf('/'); if (slashpos==-1) slashpos=target.lastIndexOf('\\');
if (slashpos==-1) target=target+(defName||cms.defaultFilename).replace(/.html$/,'.'+defExt);
return target;
},
askForFilename: function(msg,path,file,defExt) {
if(window.Components) { // moz
try {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var nsIFilePicker = window.Components.interfaces.nsIFilePicker;
var picker = Components.classes['@mozilla.org/filepicker;1'].createInstance(nsIFilePicker);
picker.init(window, msg, nsIFilePicker.modeSave);
var thispath = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
thispath.initWithPath(path);
picker.displayDirectory=thispath;
picker.defaultExtension=defExt||'html';
picker.defaultString=file;
picker.appendFilters(nsIFilePicker.filterAll|nsIFilePicker.filterText|nsIFilePicker.filterHTML);
if (picker.show()!=nsIFilePicker.returnCancel) var result=picker.file.persistentDescriptor;
}
catch(e) { alert('error during local file access: '+e.toString()) }
}
else { // IE
try { // XP/Vista only
var s = new ActiveXObject('UserAccounts.CommonDialog');
s.Filter='All files|*.*|Text files|*.txt|HTML files|*.htm;*.html|';
s.FilterIndex=(defExt=='txt')?2:3; // default to HTML files;
s.InitialDir=path;
s.FileName=file;
if (s.showOpen()) var result=s.FileName;
}
catch(e) { var result=prompt(msg,path+file); } // fallback for non-XP IE
}
return result;
},
plainTextHeader:
'Source:\n\t%0\n'
+'Title:\n\t%1\n'
+'Subtitle:\n\t%2\n'
+'Created:\n\t%3 by %4\n'
+'Application:\n\tTiddlyWiki %5 / %6 %7\n\n',
plainTextTiddler:
'- - - - - - - - - - - - - - -\n'
+'| title: %0\n'
+'| created: %1\n'
+'| modified: %2\n'
+'| edited by: %3\n'
+'| tags: %4\n'
+'- - - - - - - - - - - - - - -\n'
+'%5\n',
plainTextFooter:
'',
newsFeedHeader:
'<'+'?xml version="1.0"?'+'>\n'
+'<rss version="2.0">\n'
+'<channel>\n'
+'<title>%1</title>\n'
+'<link>%0</link>\n'
+'<description>%2</description>\n'
+'<language>en-us</language>\n'
+'<copyright>Copyright '+(new Date().getFullYear())+' %4</copyright>\n'
+'<pubDate>%3</pubDate>\n'
+'<lastBuildDate>%3</lastBuildDate>\n'
+'<docs>http://blogs.law.harvard.edu/tech/rss</docs>\n'
+'<generator>TiddlyWiki %5 / %6 %7</generator>\n',
newsFeedTiddler:
'\n%0\n',
newsFeedFooter:
'</channel></rss>',
pureStoreHeader:
'<html><body>'
+'<style type="text/css">'
+' #storeArea {display:block;margin:1em;}'
+' #storeArea div {padding:0.5em;margin:1em;border:2px solid black;height:10em;overflow:auto;}'
+' #pureStoreHeading {width:100%;text-align:left;background-color:#eeeeee;padding:1em;}'
+'</style>'
+'<div id="pureStoreHeading">'
+' TiddlyWiki "PureStore" export file<br>'
+' Source'+': <b>%0</b><br>'
+' Title: <b>%1</b><br>'
+' Subtitle: <b>%2</b><br>'
+' Created: <b>%3</b> by <b>%4</b><br>'
+' TiddlyWiki %5 / %6 %7<br>'
+' Notes:<hr><pre>%8</pre>'
+'</div>'
+'<div id="storeArea">',
pureStoreTiddler:
'%0\n%1',
pureStoreFooter:
'</div><!--POST-BODY-START-->\n<!--POST-BODY-END--></body></html>',
assembleFile: function(target,filetype,tids,limit,notes,quiet,overwrite,merge,total) {
var revised='';
var now = new Date().toLocaleString();
var src=convertUnicodeToUTF8(document.location.href);
var title = convertUnicodeToUTF8(wikifyPlain('SiteTitle').htmlEncode());
var subtitle = convertUnicodeToUTF8(wikifyPlain('SiteSubtitle').htmlEncode());
var user = convertUnicodeToUTF8(config.options.txtUserName.htmlEncode());
var twver = version.major+'.'+version.minor+'.'+version.revision;
var v=version.extensions.SaveAsPlugin; var pver = v.major+'.'+v.minor+'.'+v.revision;
var headerargs=[src,title,subtitle,now,user,twver,'SaveAsPlugin',pver,notes];
switch (filetype) {
case this.type_TX: // plain text
var header=this.plainTextHeader.format(headerargs);
var footer=this.plainTextFooter;
break;
case this.type_CS: // comma-separated
var fields={};
for (var i=0; i<tids.length; i++) for (var f in tids[i].fields) fields[f]=f;
var names=['title','created','modified','modifier','tags','text'];
for (var f in fields) names.push(f);
var header=names.join(',')+'\n';
var footer='';
break;
case this.type_NF: // news feed (XML)
headerargs[0]=store.getTiddlerText('SiteUrl','');
var header=this.newsFeedHeader.format(headerargs);
var footer=this.newsFeedFooter;
tids=store.sortTiddlers(tids,'-modified');
break;
case this.type_PS: // PureStore (no code)
var header=this.pureStoreHeader.format(headerargs);
var footer=this.pureStoreFooter;
break;
case this.type_TW: // full TiddlyWiki
default:
var currPath=getLocalPath(window.location.href);
var original=loadFile(currPath);
if (!original) { alert(config.messages.cantSaveError); return; }
var posDiv = locateStoreArea(original);
if (!posDiv) { alert(config.messages.invalidFileError.format([currPath])); return; }
var header = original.substr(0,posDiv[0]+startSaveArea.length)+'\n';
var footer = '\n'+original.substr(posDiv[1]);
break;
}
if (parseInt(limit)!=0) tids=tids.slice(0,limit);
var out=this.getData(target,filetype,tids,quiet,overwrite,merge,fields);
var revised = header+convertUnicodeToUTF8(out.join('\n'))+footer;
// if full TW, insert page title and language attr, and reset MARKUP blocks as needed...
if (filetype==this.type_TW) {
var newSiteTitle=convertUnicodeToUTF8(getPageTitle()).htmlEncode();
revised=revised.replaceChunk('<title'+'>','</title'+'>',' ' + newSiteTitle + ' ');
revised=updateLanguageAttribute(revised);
var titles=[]; for (var i=0; i<tids.length; i++) titles.push(tids[i].title);
revised=updateMarkupBlock(revised,'PRE-HEAD',
titles.contains('MarkupPreHead')? 'MarkupPreHead' :null);
revised=updateMarkupBlock(revised,'POST-HEAD',
titles.contains('MarkupPostHead')?'MarkupPostHead':null);
revised=updateMarkupBlock(revised,'PRE-BODY',
titles.contains('MarkupPreBody')? 'MarkupPreBody' :null);
revised=updateMarkupBlock(revised,'POST-SCRIPT',
titles.contains('MarkupPostBody')?'MarkupPostBody':null);
}
total.val=out.length;
return revised;
},
getData: function(target,filetype,tids,quiet,overwrite,merge,fields) {
// output selected tiddlers and gather list of titles (for use with merge)
var out=[]; var titles=[];
var url=store.getTiddlerText('SiteUrl','');
for (var i=0; i<tids.length; i++) {
out.push(this.formatItem(store,filetype,tids[i],url,fields));
titles.push(tids[i].title);
}
// if TW or PureStore format, ask to merge with existing tiddlers (if any)
if (filetype==this.type_TW || filetype==this.type_PS) {
if (overwrite) return out; // skip merge... forced overwrite
var txt=loadFile(target);
if (txt && txt.length) {
var remoteStore=new TiddlyWiki();
if (version.major+version.minor*.1+version.revision*.01<2.52) txt=convertUTF8ToUnicode(txt);
if (remoteStore.importTiddlyWiki(txt) && (merge||confirm(this.mergeprompt.format([target])))) {
var existing=remoteStore.getTiddlers('title');
for (var i=0; i<existing.length; i++)
if (!titles.contains(existing[i].title))
out.push(this.formatItem(remoteStore,filetype,existing[i],url));
if (!quiet) displayMessage(this.mergestatus.format([tids.length,out.length-tids.length]));
}
}
}
return out;
},
formatItem: function(s,f,t,u,fields) {
if (f==this.type_TW)
var r=s.getSaver().externalizeTiddler(s,t);
if (f==this.type_PS)
var r=this.pureStoreTiddler.format([t.title,s.getSaver().externalizeTiddler(s,t)]);
if (f==this.type_NF)
var r=this.newsFeedTiddler.format([t.saveToRss(u)]);
if (f==this.type_TX)
var r=this.plainTextTiddler.format([t.title, t.created.toLocaleString(), t.modified.toLocaleString(),
t.modifier, String.encodeTiddlyLinkList(t.tags), t.text]);
if (f==this.type_CS) {
function toCSV(t) { return '"'+t.replace(/"/g,'""')+'"'; } // always encode CSV
var out=[ toCSV(t.title), toCSV(t.created.toLocaleString()), toCSV(t.modified.toLocaleString()),
toCSV(t.modifier), toCSV(String.encodeTiddlyLinkList(t.tags)), toCSV(t.text) ];
for (var f in fields) out.push(toCSV(t.fields[f]||''));
var r=out.join(',');
}
return r||'';
}
};
//}}}
//{{{
// automatically add saveAs to backstage
config.tasks.saveAs = {
text: 'saveAs',
tooltip: config.macros.saveAs.prompt,
action: function(){ clearMessage(); config.macros.saveAs.go(); }
}
config.backstageTasks.splice(config.backstageTasks.indexOf('save')+1,0,'saveAs');
//}}}
/***
|Name:|SaveCloseTiddlerPlugin|
|Description:|Provides two extra toolbar commands, saveCloseTiddler and cancelCloseTiddler|
|Version:|3.0 ($Rev: 5502 $)|
|Date:|$Date: 2008-06-10 23:31:39 +1000 (Tue, 10 Jun 2008) $|
|Source:|http://mptw.tiddlyspot.com/#SaveCloseTiddlerPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
To use these you must add them to the tool bar in your EditTemplate
***/
//{{{
merge(config.commands,{
saveCloseTiddler: {
text: 'done/close',
tooltip: 'Save changes to this tiddler and close it',
handler: function(ev,src,title) {
var closeTitle = title;
var newTitle = story.saveTiddler(title,ev.shiftKey);
if (newTitle)
closeTitle = newTitle;
return config.commands.closeTiddler.handler(ev,src,closeTitle);
}
},
cancelCloseTiddler: {
text: 'cancel/close',
tooltip: 'Undo changes to this tiddler and close it',
handler: function(ev,src,title) {
// the same as closeTiddler now actually
return config.commands.closeTiddler.handler(ev,src,title);
}
}
});
//}}}
/%
|Name|ScrollBox|
|Source|http://www.TiddlyTools.com/#ScrollBox|
|Version|1.0.0|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|transcluded wiki syntax|
|Requires||
|Overrides||
|Description|display the contents of a tiddler in a fixed-height scrolling area|
%//%
Usage: <<tiddler ScrollBox with: TiddlerName height>>
%/@@display:block;height:$2;overflow:auto;<<tiddler $1>>@@@@display:block;text-align:right;^^scroll for more...^^@@
/***
|Name|SearchOptionsPlugin|
|Source|http://www.TiddlyTools.com/#SearchOptionsPlugin|
|Documentation|http://www.TiddlyTools.com/#SearchOptionsPluginInfo|
|Version|3.0.5|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides|Story.prototype.search, TiddlyWiki.prototype.search, config.macros.search.onKeyPress|
|Options|##Configuration|
|Description|extend core search function with additional user-configurable options|
Adds extra options to core search function including selecting which data items to search, enabling/disabling incremental key-by-key searches, and generating a ''list of matching tiddlers'' instead of immediately displaying all matches. This plugin also adds syntax for rendering 'search links' within tiddler content to embed one-click searches using pre-defined 'hard-coded' search terms.
!!!!!Documentation
>see [[SearchOptionsPluginInfo]]
!!!!!Configuration
<<<
Search in:
<<option chkSearchTitles>> titles <<option chkSearchText>> text <<option chkSearchTags>> tags <<option chkSearchFields>> fields <<option chkSearchShadows>> shadows
<<option chkSearchHighlight>> Highlight matching text in displayed tiddlers
<<option chkSearchList>> Show list of matches
<<option chkSearchListTiddler>> Write list to [[SearchResults]] tiddler
<<option chkSearchTitlesFirst>> Show title matches first
<<option chkSearchByDate>> Sort matching tiddlers by modification date (most recent first)
<<option chkIncrementalSearch>> Incremental key-by-key search: {{twochar{<<option txtIncrementalSearchMin>>}}} or more characters, {{threechar{<<option txtIncrementalSearchDelay>>}}} msec delay
<<option chkSearchOpenTiddlers>> Search only in tiddlers that are currently displayed
<<option chkSearchExcludeTags>> Exclude tiddlers tagged with: <<option txtSearchExcludeTags>>
<<<
!!!!!Revisions
<<<
2009.01.16 [3.0.5] added chkSearchOpenTiddlers option to limit searches to displayed tiddlers only
|please see [[SearchOptionsPluginInfo]] for additional revision details|
2005.10.18 [1.0.0] Initial Release
<<<
!!!!!Code
***/
//{{{
version.extensions.SearchOptionsPlugin= {major: 3, minor: 0, revision: 5, date: new Date(2009,1,16)};
var co=config.options; // abbrev
if (co.chkSearchTitles===undefined) co.chkSearchTitles=true;
if (co.chkSearchText===undefined) co.chkSearchText=true;
if (co.chkSearchTags===undefined) co.chkSearchTags=true;
if (co.chkSearchFields===undefined) co.chkSearchFields=true;
if (co.chkSearchTitlesFirst===undefined) co.chkSearchTitlesFirst=true;
if (co.chkSearchList===undefined) co.chkSearchList=true;
if (co.chkSearchHighlight===undefined) co.chkSearchHighlight=true;
if (co.chkSearchListTiddler===undefined) co.chkSearchListTiddler=false;
if (co.chkSearchByDate===undefined) co.chkSearchByDate=false;
if (co.chkIncrementalSearch===undefined) co.chkIncrementalSearch=true;
if (co.chkSearchShadows===undefined) co.chkSearchShadows=true;
if (co.txtIncrementalSearchDelay===undefined) co.txtIncrementalSearchDelay=500;
if (co.txtIncrementalSearchMin===undefined) co.txtIncrementalSearchMin=3;
if (co.chkSearchOpenTiddlers===undefined) co.chkSearchOpenTiddlers=false;
if (co.chkSearchExcludeTags===undefined) co.chkSearchExcludeTags=true;
if (co.txtSearchExcludeTags===undefined) co.txtSearchExcludeTags="excludeSearch";
if (config.macros.search.reportTitle==undefined)
config.macros.search.reportTitle="SearchResults"; // note: not a cookie!
config.macros.search.label+="\xa0"; // a little bit of space just because it looks better
//}}}
// // searchLink: {{{[search[text to find]] OR [search[text to display|text to find]]}}}
//{{{
config.formatters.push( {
name: "searchLink",
match: "\\[search\\[",
lookaheadRegExp: /\[search\[(.*?)(?:\|(.*?))?\]\]/mg,
prompt: "search for: '%0'",
handler: function(w)
{
this.lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = this.lookaheadRegExp.exec(w.source);
if(lookaheadMatch && lookaheadMatch.index == w.matchStart) {
var label=lookaheadMatch[1];
var text=lookaheadMatch[2]||label;
var prompt=this.prompt.format([text]);
var btn=createTiddlyButton(w.output,label,prompt,
function(){story.search(this.getAttribute("searchText"))},"searchLink");
btn.setAttribute("searchText",text);
w.nextMatch = this.lookaheadRegExp.lastIndex;
}
}
});
//}}}
// // incremental search uses option settings instead of hard-coded delay and minimum input values
//{{{
var fn=config.macros.search.onKeyPress;
fn=fn.toString().replace(/500/g, "config.options.txtIncrementalSearchDelay||500");
fn=fn.toString().replace(/> 2/g, ">=(config.options.txtIncrementalSearchMin||3)");
eval("config.macros.search.onKeyPress="+fn);
//}}}
// // REPLACE story.search() for option to "show search results in a list"
//{{{
Story.prototype.search = function(text,useCaseSensitive,useRegExp)
{
var co=config.options; // abbrev
var re=new RegExp(useRegExp ? text : text.escapeRegExp(),useCaseSensitive ? "mg" : "img");
if (config.options.chkSearchHighlight) highlightHack=re;
var matches = store.search(re,co.chkSearchByDate?"modified":"title","");
if (co.chkSearchByDate) matches=matches.reverse(); // most recent first
var q = useRegExp ? "/" : "'";
clearMessage();
if (!matches.length) {
if (co.chkSearchListTiddler) discardSearchResults();
displayMessage(config.macros.search.failureMsg.format([q+text+q]));
} else {
if (co.chkSearchList||co.chkSearchListTiddler)
reportSearchResults(text,matches);
else {
var titles = []; for(var t=0; t<matches.length; t++) titles.push(matches[t].title);
this.closeAllTiddlers(); story.displayTiddlers(null,titles);
displayMessage(config.macros.search.successMsg.format([matches.length, q+text+q]));
}
}
highlightHack = null;
}
//}}}
// // REPLACE store.search() for enhanced searching/sorting options
//{{{
TiddlyWiki.prototype.search = function(searchRegExp,sortField,excludeTag)
{
var co=config.options; // abbrev
var tids = this.reverseLookup("tags",excludeTag,false,sortField);
var opened=[]; story.forEachTiddler(function(tid,elem){opened.push(tid);});
// eliminate tiddlers tagged with excluded tags
if (co.chkSearchExcludeTags&&co.txtSearchExcludeTags.length) {
var ex=co.txtSearchExcludeTags.readBracketedList();
var temp=[]; for(var t=tids.length-1; t>=0; t--)
if (!tids[t].tags.containsAny(ex)) temp.push(tids[t]);
tids=temp;
}
// scan for matching titles first...
var results = [];
if (co.chkSearchTitles) {
for(var t=0; t<tids.length; t++) {
if (co.chkSearchOpenTiddlers && !opened.contains(tids[t].title)) continue;
if(tids[t].title.search(searchRegExp)!=-1) results.push(tids[t]);
}
if (co.chkSearchShadows)
for (var t in config.shadowTiddlers) {
if (co.chkSearchOpenTiddlers && !opened.contains(t)) continue;
if ((t.search(searchRegExp)!=-1) && !store.tiddlerExists(t))
results.push((new Tiddler()).assign(t,config.shadowTiddlers[t]));
}
}
// then scan for matching text, tags, or field data
for(var t=0; t<tids.length; t++) {
if (co.chkSearchOpenTiddlers && !opened.contains(tids[t].title)) continue;
if (co.chkSearchText && tids[t].text.search(searchRegExp)!=-1)
results.pushUnique(tids[t]);
if (co.chkSearchTags && tids[t].tags.join(" ").search(searchRegExp)!=-1)
results.pushUnique(tids[t]);
if (co.chkSearchFields && store.forEachField!=undefined)
store.forEachField(tids[t],
function(tid,field,val) {
if (val.search(searchRegExp)!=-1) results.pushUnique(tids[t]);
},
true); // extended fields only
}
// then check for matching text in shadows
if (co.chkSearchShadows)
for (var t in config.shadowTiddlers) {
if (co.chkSearchOpenTiddlers && !opened.contains(t)) continue;
if ((config.shadowTiddlers[t].search(searchRegExp)!=-1) && !store.tiddlerExists(t))
results.pushUnique((new Tiddler()).assign(t,config.shadowTiddlers[t]));
}
// if not 'titles first', or sorting by modification date,
// re-sort results to so titles, text, tag and field matches are mixed together
if(!sortField) sortField = "title";
var bySortField=function(a,b){
if(a[sortField]==b[sortField])return(0);else return(a[sortField]<b[sortField])?-1:+1;
}
if (!co.chkSearchTitlesFirst || co.chkSearchByDate) results.sort(bySortField);
return results;
}
//}}}
// // HIJACK core {{{<<search>>}}} macro to add "report" and "simple inline" output
//{{{
config.macros.search.SOP_handler=config.macros.search.handler;
config.macros.search.handler = function(place,macroName,params)
{
// if "report", use SearchOptionsPlugin report generator for inline output
if (params[1]&¶ms[1].substr(0,6)=="report") {
var keyword=params[0];
var options=params[1].split("=")[1]; // split "report=option+option+..."
var heading=params[2]?params[2].unescapeLineBreaks():"";
var matches=store.search(new RegExp(keyword.escapeRegExp(),"img"),"title","excludeSearch");
if (matches.length) wikify(heading+window.formatSearchResults(keyword,matches,options),place);
} else if (params[1]) {
var keyword=params[0];
var heading=params[1]?params[1].unescapeLineBreaks():"";
var seperator=params[2]?params[2].unescapeLineBreaks():", ";
var matches=store.search(new RegExp(keyword.escapeRegExp(),"img"),"title","excludeSearch");
if (matches.length) {
var out=[];
for (var m=0; m<matches.length; m++) out.push("[["+matches[m].title+"]]");
wikify(heading+out.join(seperator),place);
}
} else
config.macros.search.SOP_handler.apply(this,arguments);
};
//}}}
// // SearchResults panel handling
//{{{
setStylesheet(".searchResults { padding:1em 1em 0 1em; }","searchResults"); // matches std tiddler padding
config.macros.search.createPanel=function(text,matches,body) {
function getByClass(e,c) { var d=e.getElementsByTagName("div");
for (var i=0;i<d.length;i++) if (hasClass(d[i],c)) return d[i]; }
var panel=createTiddlyElement(null,"div","searchPanel","searchPanel");
this.renderPanel(panel,text,matches,body);
var oldpanel=document.getElementById("searchPanel");
if (!oldpanel) { // insert new panel just above tiddlers
var da=document.getElementById("displayArea");
da.insertBefore(panel,da.firstChild);
} else { // if panel exists
var oldwrap=getByClass(oldpanel,"searchResults");
var newwrap=getByClass(panel,"searchResults");
// if no prior content, just insert new content
if (!oldwrap) oldpanel.insertBefore(newwrap,null);
else { // swap search results content but leave containing panel intact
oldwrap.style.display='block'; // unfold wrapper if needed
var i=oldwrap.getElementsByTagName("input")[0]; // get input field
if (i) { var pos=this.getCursorPos(i); i.onblur=null; } // get cursor pos, ignore blur
oldpanel.replaceChild(newwrap,oldwrap);
panel=oldpanel; // use existing panel
}
}
this.showPanel(true,pos);
return panel;
}
config.macros.search.renderPanel=function(panel,text,matches,body) {
var wrap=createTiddlyElement(panel,"div",null,"searchResults");
wrap.onmouseover = function(e){ addClass(this,"selected"); }
wrap.onmouseout = function(e){ removeClass(this,"selected"); }
// create toolbar: "open all", "fold/unfold", "close"
var tb=createTiddlyElement(wrap,"div",null,"toolbar");
var b=createTiddlyButton(tb, "open all", "open all matching tiddlers", function() {
story.displayTiddlers(null,this.getAttribute("list").readBracketedList()); return false; },"button");
var list=""; for(var t=0;t<matches.length;t++) list+='[['+matches[t].title+']] ';
b.setAttribute("list",list);
var b=createTiddlyButton(tb, "fold", "toggle display of search results", function() {
config.macros.search.foldPanel(this); return false; },"button");
var b=createTiddlyButton(tb, "close", "dismiss search results", function() {
config.macros.search.showPanel(false); return false; },"button");
createTiddlyText(createTiddlyElement(wrap,"div",null,"title"),"Search for: "+text); // title
wikify(body,createTiddlyElement(wrap,"div",null,"viewer")); // report
return panel;
}
config.macros.search.showPanel=function(show,pos) {
var panel=document.getElementById("searchPanel");
var i=panel.getElementsByTagName("input")[0];
i.onfocus=show?function(){config.macros.search.stayFocused(true);}:null;
i.onblur=show?function(){config.macros.search.stayFocused(false);}:null;
if (show && panel.style.display=="block") { // if shown, grab focus, restore cursor
if (i&&this.stayFocused()) { i.focus(); this.setCursorPos(i,pos); }
return;
}
if(!config.options.chkAnimate) {
panel.style.display=show?"block":"none";
if (!show) { removeChildren(panel); config.macros.search.stayFocused(false); }
} else {
var s=new Slider(panel,show,false,show?"none":"children");
s.callback=function(e,p){e.style.overflow="visible";}
anim.startAnimating(s);
}
return panel;
}
config.macros.search.foldPanel=function(button) {
var d=document.getElementById("searchPanel").getElementsByTagName("div");
for (var i=0;i<d.length;i++) if (hasClass(d[i],"viewer")) var v=d[i]; if (!v) return;
var show=v.style.display=="none";
if(!config.options.chkAnimate)
v.style.display=show?"block":"none";
else {
var s=new Slider(v,show,false,"none");
s.callback=function(e,p){e.style.overflow="visible";}
anim.startAnimating(s);
}
button.innerHTML=show?"fold":"unfold";
return false;
}
config.macros.search.stayFocused=function(keep) { // TRUE/FALSE=set value, no args=get value
if (keep===undefined) return this.keepReportInFocus;
this.keepReportInFocus=keep;
return keep
}
config.macros.search.getCursorPos=function(i) {
var s=0; var e=0; if (!i) return { start:s, end:e };
try {
if (i.setSelectionRange) // FF
{ s=i.selectionStart; e=i.selectionEnd; }
if (document.selection && document.selection.createRange) { // IE
var r=document.selection.createRange().duplicate();
var len=r.text.length; s=0-r.moveStart('character',-100000); e=s+len;
}
}catch(e){};
return { start:s, end:e };
}
config.macros.search.setCursorPos=function(i,pos) {
if (!i||!pos) return; var s=pos.start; var e=pos.end;
if (i.setSelectionRange) //FF
i.setSelectionRange(s,e);
if (i.createTextRange) // IE
{ var r=i.createTextRange(); r.collapse(true); r.moveStart("character",s); r.select(); }
}
//}}}
// // SearchResults report generation
// note: these functions are defined globally, so they can be more easily redefined to customize report formats//
//{{{
if (!window.reportSearchResults) window.reportSearchResults=function(text,matches)
{
var cms=config.macros.search; // abbrev
var body=window.formatSearchResults(text,matches);
if (!config.options.chkSearchListTiddler) // show #searchResults panel
window.scrollTo(0,ensureVisible(cms.createPanel(text,matches,body)));
else { // write [[SearchResults]] tiddler
var title=cms.reportTitle;
var who=config.options.txtUserName;
var when=new Date();
var tags="excludeLists excludeSearch temporary";
var tid=store.getTiddler(title); if (!tid) tid=new Tiddler();
tid.set(title,body,who,when,tags);
store.addTiddler(tid);
story.closeTiddler(title);
story.displayTiddler(null,title);
}
}
if (!window.formatSearchResults) window.formatSearchResults=function(text,matches,opt)
{
var body='';
var title=config.macros.search.reportTitle
var q = config.options.chkRegExpSearch ? "/" : "'";
if (!opt) var opt="all";
var parts=opt.split("+");
for (var i=0; i<parts.length; i++) { var p=parts[i].toLowerCase();
if (p=="again"||p=="all") body+=window.formatSearchResults_again(text,matches);
if (p=="summary"||p=="all") body+=window.formatSearchResults_summary(text,matches);
if (p=="list"||p=="all") body+=window.formatSearchResults_list(text,matches);
if (p=="buttons"||p=="all") body+=window.formatSearchResults_buttons(text,matches);
}
return body;
}
if (!window.formatSearchResults_again) window.formatSearchResults_again=function(text,matches)
{
var title=config.macros.search.reportTitle
var body='';
// search again
body+='{{span{<<search "'+text.replace(/"/g,'"')+'">> /%\n';
body+='%/<html><input type="button" value="search again"';
body+=' onclick="var t=this.parentNode.parentNode.getElementsByTagName(\'input\')[0];';
body+=' config.macros.search.doSearch(t); return false;">';
body+=' <a href="javascript:;" onclick="';
body+=' var e=this.parentNode.nextSibling;';
body+=' var show=e.style.display!=\'block\';';
body+=' if(!config.options.chkAnimate) e.style.display=show?\'block\':\'none\';';
body+=' else anim.startAnimating(new Slider(e,show,false,\'none\'));';
body+=' return false;">options...</a>';
body+='</html>@@display:none;border-left:1px dotted;margin-left:1em;padding:0;padding-left:.5em;font-size:90%;/%\n';
body+=' %/<<option chkSearchTitles>>titles /%\n';
body+=' %/<<option chkSearchText>>text /%\n';
body+=' %/<<option chkSearchTags>>tags /%\n';
body+=' %/<<option chkSearchFields>>fields /%\n';
body+=' %/<<option chkSearchShadows>>shadows\n';
body+=' <<option chkCaseSensitiveSearch>>case-sensitive /%\n';
body+=' %/<<option chkRegExpSearch>>text patterns /%\n';
body+=' %/<<option chkSearchByDate>>sorted by date\n';
body+=' <<option chkSearchHighlight>> highlight matching text in displayed tiddlers\n';
body+=' <<option chkIncrementalSearch>>incremental key-by-key search: /%\n';
body+=' %/{{twochar{<<option txtIncrementalSearchMin>>}}} or more characters, /%\n';
body+=' %/{{threechar{<<option txtIncrementalSearchDelay>>}}} msec delay\n';
body+=' <<option chkSearchOpenTiddlers>> search only in tiddlers that are currently displayed\n';
body+=' <<option chkSearchExcludeTags>>exclude tiddlers tagged with:\n';
body+=' {{editor{<<option txtSearchExcludeTags>>}}}/%\n';
body+='%/@@}}}\n\n';
return body;
}
if (!window.formatSearchResults_summary) window.formatSearchResults_summary=function(text,matches)
{
// summary: nn tiddlers found matching '...', options used
var body='';
var co=config.options; // abbrev
var title=config.macros.search.reportTitle
var q = co.chkRegExpSearch ? "/" : "'";
body+="''"+config.macros.search.successMsg.format([matches.length,q+"{{{"+text+"}}}"+q])+"''\n";
var opts=[];
if (co.chkSearchTitles) opts.push("titles");
if (co.chkSearchText) opts.push("text");
if (co.chkSearchTags) opts.push("tags");
if (co.chkSearchFields) opts.push("fields");
if (co.chkSearchShadows) opts.push("shadows");
if (co.chkSearchOpenTiddlers) body+="^^//search limited to displayed tiddlers only//^^\n";
body+="~~ searched in "+opts.join(" + ")+"~~\n";
body+=(co.chkCaseSensitiveSearch||co.chkRegExpSearch?"^^ using ":"")
+(co.chkCaseSensitiveSearch?"case-sensitive ":"")
+(co.chkRegExpSearch?"pattern ":"")
+(co.chkCaseSensitiveSearch||co.chkRegExpSearch?"matching^^\n":"");
return body;
}
if (!window.formatSearchResults_list) window.formatSearchResults_list=function(text,matches)
{
// bullet list of links to matching tiddlers
var body='';
var pattern=co.chkRegExpSearch?text:text.escapeRegExp();
var sensitive=co.chkCaseSensitiveSearch?"mg":"img";
var link='{{tiddlyLinkExisting{<html><nowiki><a href="javascript:;" onclick="'
+'if(config.options.chkSearchHighlight)'
+' highlightHack=new RegExp(\x27'+pattern+'\x27,\x27'+sensitive+'\x27);'
+'story.displayTiddler(null,\x27%0\x27);'
+'highlightHack = null; return false;'
+'" title="%2">%1</a></html>}}}';
for(var t=0;t<matches.length;t++) {
body+="* ";
if (config.options.chkSearchByDate)
body+=matches[t].modified.formatString('YYYY.0MM.0DD 0hh:0mm')+" ";
var title=matches[t].title;
var fixup=title.replace(/'/g,"\\x27").replace(/"/g,"\\x22");
var tid=store.getTiddler(title);
var tip=tid?tid.getSubtitle():''; tip=tip.replace(/"/g,""");
body+=link.format([fixup,title,tip])+'\n';
}
return body;
}
if (!window.formatSearchResults_buttons) window.formatSearchResults_buttons=function(text,matches)
{
// embed buttons only if writing SearchResults to tiddler
if (!config.options.chkSearchListTiddler) return "";
// "open all" button
var title=config.macros.search.reportTitle;
var body="";
body+="@@diplay:block;<html><input type=\"button\" href=\"javascript:;\" "
+"onclick=\"story.displayTiddlers(null,[";
for(var t=0;t<matches.length;t++)
body+="'"+matches[t].title.replace(/\'/mg,"\\'")+"'"+((t<matches.length-1)?", ":"");
body+="],1);\" accesskey=\"O\" value=\"open all matching tiddlers\"></html> ";
// "discard SearchResults" button
body+="<html><input type=\"button\" href=\"javascript:;\" "
+"onclick=\"discardSearchResults()\" value=\"discard "+title+"\"></html>";
body+="@@\n";
return body;
}
if (!window.discardSearchResults) window.discardSearchResults=function()
{
// remove the tiddler
story.closeTiddler(config.macros.search.reportTitle);
store.deleteTiddler(config.macros.search.reportTitle);
store.notify(config.macros.search.reportTitle,true);
}
//}}}
/%
|Name|ShowAllByTags|
|Source|http://www.TiddlyTools.com/#ShowAllByTags|
|Version|1.1.0|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|script|
|Requires|InlineJavascriptPlugin|
|Description|for each tag, show a numbered list of all tiddlers with that tag|
Usage:
<<tiddler ShowAllByTags with: "tag tag tag">>
where
"tag tag tag" (optional)
quoted, space-separated, bracketed list of tags to **exclude** from the display
!Revisions
2008.08.04 [1.1.0] added optional parameter to exclude specified tags
!end Revisions
%/<script>
var ex=[];
if ("$1"!="$"+"1") ex="$1".readBracketedList();
var tags = store.getTags();
if(tags.length == 0) return "no tags in document";
var out="";
for(var t=0; t<tags.length; t++) {
if (ex.contains(tags[t][0])) continue;
out+="*[["+tags[t][0]+"]] ("+tags[t][1]+")"+"\n";
var tids=store.getTaggedTiddlers(tags[t][0]);
for (i=0; i<tids.length; i++) out+="##[["+tids[i].title+"]]\n";
}
return out;
</script>
/%
!info
|Name|ShowPopup|
|Source|http://www.TiddlyTools.com/#ShowPopup|
|Version|1.1.0|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|transcluded html|
|Requires||
|Overrides||
|Description|display tiddler content in a TiddlyWiki popup panel|
Usage:
<<<
{{{
<<tiddler ShowPopup with: TiddlerName label tooltip buttonClass width popupClass>>
}}}
*{{{TiddlerName}}} is the title of the tiddler whose content is to be displayed
*{{{label}}} is the text of the popup command
*{{{tooltip}}} is the mouseover help text for the command
*{{{buttonClass}}} is a CSS classname applied to the command text (default=button)
*{{{width}}} is the width of the popup (using CSS measurements, default=auto)
*{{{popupClass}}} is a CSS classname applied to the popup panel (default=none). Use 'sticky' for persistent popups (requires StickyPopupPlugin)
<<<
Example:
<<<
{{{
<<tiddler ShowPopup with: ShowPopup [[Try this]] [[show this tiddler in a popup]]>>
}}}
<<tiddler ShowPopup with: ShowPopup [[Try this]] [[show this tiddler in a popup]]>>
<<<
!end
!show
<html><hide linebreaks>
<a href="javascript:;" class="$4" title="$3" onclick="
var p=Popup.create(this);if(!p)return;p.className+=' $6';var t=store.getTiddlerText('$1','');
var d=createTiddlyElement(p,'div');var s=d.style;s.whiteSpace='normal';s.width='$5';s.padding='2px';wikify(t,d);
Popup.show();event.cancelBubble=true;if(event.stopPropagation)event.stopPropagation();return(false);
">$2</a></html>
!end
%/<<tiddler {{'ShowPopup##'+('$1'=='$'+'1'?'info':'show')}} with: [[$1]] [[$2]] [[$3]] [[$4]] [[$5]] [[$6]]>>
<<closeAll>><<permaview>><<newTiddler>><<newJournal "DD MMM YYYY" "journal">><<saveChanges>><<slider chkSliderOptionsPanel OptionsPanel "options »" "Change TiddlyWiki advanced options">>
<<slider chkSliderSidebarTabs SideBarTabs##tabset 'index »' 'view lists of tiddlers'>>/%
!tabset
<<tabs txtMainTab "Tags" "All tags" TabTags "Timeline" "Timeline" TabTimeline "All" "All tiddlers" TabAll "More" "More lists" TabMore>>
!end
%/
/***
|Name|SinglePageModePlugin|
|Source|http://www.TiddlyTools.com/#SinglePageModePlugin|
|Documentation|http://www.TiddlyTools.com/#SinglePageModePluginInfo|
|Version|2.9.6|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides|Story.prototype.displayTiddler(), Story.prototype.displayTiddlers()|
|Options|##Configuration|
|Description|Show tiddlers one at a time with automatic permalink, or always open tiddlers at top/bottom of page.|
This plugin allows you to configure TiddlyWiki to navigate more like a traditional multipage web site with only one tiddler displayed at a time.
!!!!!Documentation
>see [[SinglePageModePluginInfo]]
!!!!!Configuration
<<<
<<option chkSinglePageMode>> Display one tiddler at a time
><<option chkSinglePagePermalink>> Automatically permalink current tiddler
><<option chkSinglePageKeepFoldedTiddlers>> Don't close tiddlers that are folded
><<option chkSinglePageKeepEditedTiddlers>> Don't close tiddlers that are being edited
<<option chkTopOfPageMode>> Open tiddlers at the top of the page
<<option chkBottomOfPageMode>> Open tiddlers at the bottom of the page
<<option chkSinglePageAutoScroll>> Automatically scroll tiddler into view (if needed)
Notes:
* The "display one tiddler at a time" option can also be //temporarily// set/reset by including a 'paramifier' in the document URL: {{{#SPM:true}}} or {{{#SPM:false}}}.
* If more than one display mode is selected, 'one at a time' display takes precedence over both 'top' and 'bottom' settings, and if 'one at a time' setting is not used, 'top of page' takes precedence over 'bottom of page'.
* When using Apple's Safari browser, automatically setting the permalink causes an error and is disabled.
<<<
!!!!!Revisions
<<<
2008.10.17 [2.9.6] changed chkSinglePageAutoScroll default to false
| Please see [[SinglePageModePluginInfo]] for previous revision details |
2005.08.15 [1.0.0] Initial Release. Support for BACK/FORWARD buttons adapted from code developed by Clint Checketts.
<<<
!!!!!Code
***/
//{{{
version.extensions.SinglePageModePlugin= {major: 2, minor: 9, revision: 6, date: new Date(2008,10,17)};
//}}}
//{{{
config.paramifiers.SPM = { onstart: function(v) {
config.options.chkSinglePageMode=eval(v);
if (config.options.chkSinglePageMode && config.options.chkSinglePagePermalink && !config.browser.isSafari) {
config.lastURL = window.location.hash;
if (!config.SPMTimer) config.SPMTimer=window.setInterval(function() {checkLastURL();},1000);
}
} };
//}}}
//{{{
if (config.options.chkSinglePageMode==undefined)
config.options.chkSinglePageMode=false;
if (config.options.chkSinglePagePermalink==undefined)
config.options.chkSinglePagePermalink=true;
if (config.options.chkSinglePageKeepFoldedTiddlers==undefined)
config.options.chkSinglePageKeepFoldedTiddlers=false;
if (config.options.chkSinglePageKeepEditedTiddlers==undefined)
config.options.chkSinglePageKeepEditedTiddlers=false;
if (config.options.chkTopOfPageMode==undefined)
config.options.chkTopOfPageMode=false;
if (config.options.chkBottomOfPageMode==undefined)
config.options.chkBottomOfPageMode=false;
if (config.options.chkSinglePageAutoScroll==undefined)
config.options.chkSinglePageAutoScroll=false;
//}}}
//{{{
config.SPMTimer = 0;
config.lastURL = window.location.hash;
function checkLastURL()
{
if (!config.options.chkSinglePageMode)
{ window.clearInterval(config.SPMTimer); config.SPMTimer=0; return; }
if (config.lastURL == window.location.hash) return; // no change in hash
var tids=decodeURIComponent(window.location.hash.substr(1)).readBracketedList();
if (tids.length==1) // permalink (single tiddler in URL)
story.displayTiddler(null,tids[0]);
else { // restore permaview or default view
config.lastURL = window.location.hash;
if (!tids.length) tids=store.getTiddlerText("DefaultTiddlers").readBracketedList();
story.closeAllTiddlers();
story.displayTiddlers(null,tids);
}
}
if (Story.prototype.SPM_coreDisplayTiddler==undefined)
Story.prototype.SPM_coreDisplayTiddler=Story.prototype.displayTiddler;
Story.prototype.displayTiddler = function(srcElement,tiddler,template,animate,slowly)
{
var title=(tiddler instanceof Tiddler)?tiddler.title:tiddler;
var tiddlerElem=document.getElementById(story.idPrefix+title); // ==null unless tiddler is already displayed
var opt=config.options;
var single=opt.chkSinglePageMode && !startingUp;
var top=opt.chkTopOfPageMode && !startingUp;
var bottom=opt.chkBottomOfPageMode && !startingUp;
if (single) {
story.forEachTiddler(function(tid,elem) {
// skip current tiddler and, optionally, tiddlers that are folded.
if ( tid==title
|| (opt.chkSinglePageKeepFoldedTiddlers && elem.getAttribute("folded")=="true"))
return;
// if a tiddler is being edited, ask before closing
if (elem.getAttribute("dirty")=="true") {
if (opt.chkSinglePageKeepEditedTiddlers) return;
// if tiddler to be displayed is already shown, then leave active tiddler editor as is
// (occurs when switching between view and edit modes)
if (tiddlerElem) return;
// otherwise, ask for permission
var msg="'"+tid+"' is currently being edited.\n\n";
msg+="Press OK to save and close this tiddler\nor press Cancel to leave it opened";
if (!confirm(msg)) return; else story.saveTiddler(tid);
}
story.closeTiddler(tid);
});
}
else if (top)
arguments[0]=null;
else if (bottom)
arguments[0]="bottom";
if (single && opt.chkSinglePagePermalink && !config.browser.isSafari) {
window.location.hash = encodeURIComponent(String.encodeTiddlyLink(title));
config.lastURL = window.location.hash;
document.title = wikifyPlain("SiteTitle") + " - " + title;
if (!config.SPMTimer) config.SPMTimer=window.setInterval(function() {checkLastURL();},1000);
}
if (tiddlerElem && tiddlerElem.getAttribute("dirty")=="true") { // editing... move tiddler without re-rendering
var isTopTiddler=(tiddlerElem.previousSibling==null);
if (!isTopTiddler && (single || top))
tiddlerElem.parentNode.insertBefore(tiddlerElem,tiddlerElem.parentNode.firstChild);
else if (bottom)
tiddlerElem.parentNode.insertBefore(tiddlerElem,null);
else this.SPM_coreDisplayTiddler.apply(this,arguments); // let CORE render tiddler
} else
this.SPM_coreDisplayTiddler.apply(this,arguments); // let CORE render tiddler
var tiddlerElem=document.getElementById(story.idPrefix+title);
if (tiddlerElem&&opt.chkSinglePageAutoScroll) {
// scroll to top of page or top of tiddler
var isTopTiddler=(tiddlerElem.previousSibling==null);
var yPos=isTopTiddler?0:ensureVisible(tiddlerElem);
// if animating, defer scroll until after animation completes
var delay=opt.chkAnimate?config.animDuration+10:0;
setTimeout("window.scrollTo(0,"+yPos+")",delay);
}
}
if (Story.prototype.SPM_coreDisplayTiddlers==undefined)
Story.prototype.SPM_coreDisplayTiddlers=Story.prototype.displayTiddlers;
Story.prototype.displayTiddlers = function() {
// suspend single/top/bottom modes when showing multiple tiddlers
var opt=config.options;
var saveSPM=opt.chkSinglePageMode; opt.chkSinglePageMode=false;
var saveTPM=opt.chkTopOfPageMode; opt.chkTopOfPageMode=false;
var saveBPM=opt.chkBottomOfPageMode; opt.chkBottomOfPageMode=false;
this.SPM_coreDisplayTiddlers.apply(this,arguments);
opt.chkBottomOfPageMode=saveBPM;
opt.chkTopOfPageMode=saveTPM;
opt.chkSinglePageMode=saveSPM;
}
//}}}
A singleton is an object which can be instantiated only once and is universally available in an application. This makes it similar in a sense to a global object. However, a singleton is so rigidly singular that its usage, if inappropriate, may create big problems. This has made it the subject of many heated blog posts. In particular, use of a global is amenable to code re-use and testing; a singleton may be ruinous in these aspects.
!!! ~CodeIgniter
The ~CodeIgniter framework uses a singleton to create a super-object (reference the function {{{&load_class}}}). This is probably very good. However, it means there's little use trying to debug problems by stepping through CI's code.
!!! Other References
* See my ~StackOverflow posts of anguish.
** [[simpletest-with-codeigniter-wont-identify-file-variables-die|http://stackoverflow.com/questions/3327832/simpletest-with-codeigniter-wont-identify-file-variables-die]]
** [[netbeans-xdebug-works-but-wont-expose-some-php-variables|http://stackoverflow.com/questions/3473437/netbeans-xdebug-works-but-wont-expose-some-php-variables]]
* See someone's insightful post which I discovered on the evening 8/25 (or maybe it was after midnight).
* Google "~CodeIgniter Singleton"
* Note //singleton// and //simpleton// are near spellings.
* Attempts to penetrate the singleton with xdebug have resulted in various behaviors:
|>| Variables panel| Mouse-over | Watches |
|~NetBeans 6.9 with LAMP | No info | No info |IDE shuts down (helpful warning options) |
|~NetBeans 6.9 with WAMP | No info | Tiny info |Allows visibility (but tedious) |
|phpDesigner with WAMP | No info | Small info |Untested |
! ~CodeIgniter &load_class Function
{{{
* This function acts as a singleton. If the requested class does not
* exist it is instantiated and set to a static variable. If it has
* previously been instantiated the variable is returned.
}}}
Found in ''common.php''.
See [[CodeIgniter_Testing]].
{{smallform{
<script label="tiddler:" title="select a tiddler title or open matching tiddler">
// send a return key to the gotoTiddler input field
var form=place.parentNode.nextSibling.firstChild;
config.macros.gotoTiddler.inputKeyHandler({keyCode:13},form.gotoTiddler,form.list);
return false;
</script><script>
place.lastChild.style.fontWeight="normal";
</script>
<<gotoTiddler search inputstyle:"display:block;width:98.5%;margin:0;font-size:8pt;" liststyle:"width:85%;font-size:8pt;">>/%
%/}}}/%
%/{{selected{{{toolbar fine{
<<tiddler BreadcrumbsCommand>>/%
%/ <<tiddler ShowPopup with:
FavoriteTiddlers "favorites" "quick access to favorite tiddlers" button auto>>/%
%/ <<openStory popup>>/%
%/ <<tiddler QuickSearchPopup with: {{tiddler?tiddler.title:""}} "see also">>/%
%/}}}}}}{{clear{
}}}
{{floatright small{<<tiddler BreadcrumbsCommand with: crumbs>><<tiddler ToggleBreadcrumbs>>}}}{{small{
Goto/Search:
{{transparent{<<gotoTiddler
inputstyle:"width:100%;font-size:100%;border:2px inset #999;"
liststyle:"font-size:100%;"
search
>>}}}}}}
Code, Software, Hardware, Power Tips, Minutiae (sigh). Scott Morse
/***
|Name|SnapshotPlugin|
|Source|http://www.TiddlyTools.com/#SnapshotPlugin|
|Documentation|http://www.TiddlyTools.com/#SnapshotPluginInfo|
|Version|1.2.0|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Description|save or print HTML+CSS image of rendered document content|
|Status|ALPHA - DO NOT DISTRIBUTE|
This plugin provides a macro as well as tiddler toolbar commands to create a file or browser window containing the //rendered// CSS-and-HTML that is currently being displayed for selected elements of the current document.
!!!!!Documentation
>see [[SnapshotPluginInfo]]
!!!!!Configuration
<<<
<<option chkSnapshotHTMLOnly>> output HTML only (omit CSS)
<<<
!!!!!Revisions
<<<
2009.06.04 [1.2.0] added handling in getSnap() so current form input values are shown in snapshots
|please see [[SnapshotPluginInfo]] for additional revision details|
2008.04.21 [1.0.0] initial release - derived from [[NewDocumentPlugin]] with many improvements...
<<<
!!!!!Code
***/
//{{{
version.extensions.SnapshotPlugin= {major: 1, minor: 2, revision: 0, date: new Date(2009,6,4)};
if (config.options.chkSnapshotHTMLOnly===undefined) config.options.chkSnapshotHTMLOnly=false;
config.macros.snapshot = {
snapLabel: "save a snapshot",
printLabel: "print a snapshot",
snapPrompt: "save an HTML image of rendered content",
printPrompt: "print an HTML image of rendered content",
hereID: "here",
viewerID: "viewer",
storyID: "story",
allID: "all",
askID: "ask",
askTiddlerID: "askTiddler",
askDOMID: "askDOM",
askMsg: "select an element...",
hereItem: "tiddler: '%0'",
viewerItem: "tiddler: '%0' (content only)",
storyItem: "story column",
allItem: "entire document",
tiddlerItem: "select a tiddler...",
IDItem: "select a DOM element by ID...",
HTMLItem: "[%0] output HTML only (omit CSS)",
fileMsg: "select or enter a target path/filename",
defaultFilename: "snapshot.html",
okmsg: "snapshot written to %0",
failmsg: "An error occurred while creating %0",
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
var printing=params[0]&¶ms[0]=="print"; if (printing) params.shift();
params = paramString.parseParams("anon",null,true,false,false);
var id=getParam(params,"id","here");
var label=getParam(params,"label",printing?this.printLabel:this.snapLabel);
var prompt=getParam(params,"prompt",printing?this.printPrompt:this.snapPrompt);
var btn=createTiddlyButton(place,label,prompt, function(ev){
this.setAttribute("snapID",this.getAttribute("startID"));
config.macros.snapshot.go(this,ev)
});
btn.setAttribute("startID",id);
btn.setAttribute("snapID",id);
btn.setAttribute("printing",printing?"true":"false");
btn.setAttribute("HTMLOnly",config.options.chkSnapshotHTMLOnly?"true":"false");
},
go: function(here,ev) {
var cms=config.macros.snapshot; // abbreviation
var id=here.getAttribute("snapID");
var printing=here.getAttribute("printing")=="true";
var HTMLOnly=here.getAttribute("HTMLOnly")=="true";
if (id==cms.askID||id==cms.askTiddlerID||id==cms.askDOMID) {
cms.askForID(here,ev);
} else {
// get element
if (id==cms.storyID) id="tiddlerDisplay";
if (id==cms.allID) id="contentWrapper";
var snapElem=document.getElementById(id);
if (id==cms.hereID || id==cms.viewerID)
var snapElem=story.findContainingTiddler(here);
if (snapElem && hasClass(snapElem,"tiddler") && (id==cms.viewerID || HTMLOnly)) {
// find viewer class element within tiddler element
var nodes=snapElem.getElementsByTagName("*");
for (var i=0; i<nodes.length; i++)
if (hasClass(nodes[i],"viewer")) { snapElem=nodes[i]; break; }
}
if (!snapElem) // not in a tiddler or no viewer element or unknown ID
{ e.cancelBubble=true; if(e.stopPropagation)e.stopPropagation(); return(false); }
// write or print snapshot
var out=cms.getsnap(snapElem,id,printing,HTMLOnly);
if (printing) cms.printsnap(out); else cms.savesnap(out);
}
return false;
},
askForID: function(here,ev) {
var ev = ev ? ev : window.event;
var cms=config.macros.snapshot; // abbreviation
var id=here.getAttribute("snapID");
var indent='\xa0\xa0\xa0\xa0';
var p=Popup.create(here); if (!p) return false; p.className+=' sticky smallform';
var s=createTiddlyElement(p,'select'); s.button=here;
if (id==cms.askID) {
s.options[s.length]=new Option(cms.askMsg,cms.askID);
var tid=story.findContainingTiddler(here);
if(tid) {
var title=tid.getAttribute("tiddler");
if (here.getAttribute("HTMLOnly")!="true")
s.options[s.length]=new Option(indent+cms.hereItem.format([title]),cms.hereID);
s.options[s.length]=new Option(indent+cms.viewerItem.format([title]),cms.viewerID);
}
s.options[s.length]=new Option(indent+cms.tiddlerItem,cms.askTiddlerID);
s.options[s.length]=new Option(indent+cms.IDItem,cms.askDOMID);
s.options[s.length]=new Option(indent+cms.storyItem,"tiddlerDisplay");
s.options[s.length]=new Option(indent+cms.allItem,"contentWrapper");
}
if (id==cms.askDOMID) {
s.options[s.length]=new Option(cms.IDItem,cms.askDOMID);
var elems=document.getElementsByTagName("*");
var ids=[];
for (var i=0;i<elems.length;i++)
if (elems[i].id.length && elems[i].className!="animationContainer")
ids.push(elems[i].id);
ids.sort();
for (var i=0;i<ids.length;i++) s.options[s.length]=new Option(indent+ids[i],ids[i]);
}
if (id==cms.askTiddlerID) {
s.options[s.length]=new Option(cms.tiddlerItem,cms.askTiddlerID);
var elems=document.getElementsByTagName("div");
var ids=[];
for (var i=0;i<elems.length;i++) { var id=elems[i].id;
if (id.length && id.substr(0,story.idPrefix.length)==story.idPrefix && id!="tiddlerDisplay")
ids.push(id);
}
ids.sort();
for (var i=0;i<ids.length;i++) s.options[s.length]=new Option(indent+ids[i].substr(story.idPrefix.length),ids[i]);
}
s.options[s.length]=new Option(cms.HTMLItem.format([here.getAttribute("HTMLOnly")=="true"?"\u221a":"_"]),cms.HTMLItem);
s.onchange=function(ev){
var ev = ev ? ev : window.event;
var cms=config.macros.snapshot; // abbreviation
var here=this.button;
if (this.value==cms.HTMLItem) {
config.options.chkSnapshotHTMLOnly=!config.options.chkSnapshotHTMLOnly;
here.setAttribute("HTMLOnly",config.options.chkSnapshotHTMLOnly?"true":"false");
config.macros.option.propagateOption("chkSnapshotHTMLOnly","checked",
config.options.chkSnapshotHTMLOnly,"input");
} else
here.setAttribute("snapID",this.value);
config.macros.snapshot.go(here,ev);
return false;
};
Popup.show();
ev.cancelBubble=true;
if(ev.stopPropagation)ev.stopPropagation();
return false;
},
getpath: function() {
// get current path
var path=getLocalPath(window.location.href);
var slashpos=path.lastIndexOf("/");
if (slashpos==-1) slashpos=path.lastIndexOf("\\");
if (slashpos!=-1) path=path.substr(0,slashpos+1); // trim filename
return path;
},
getsnap: function(snapElem,id,printing,HTMLOnly) {
var cms=config.macros.snapshot; // abbreviation
var out='<head>\n';
if (printing)
out+='<base href="file:///'+cms.getpath().replace(/\\/g,'/')+'"></base>\n';
if (!HTMLOnly) {
var styles=document.getElementsByTagName('style');
var fmt='<style>\n/* stylesheet=%0 */\n%1\n\n</style>\n';
for(var i=0; i < styles.length; i++)
out+=fmt.format([styles[i].getAttribute('id'),styles[i].innerHTML]);
}
out+='</head>\n';
var elems=snapElem.getElementsByTagName('input');
for (var i=0; i<elems.length; i++) { var e=elems[i];
if (e.type=='text') e.defaultValue=e.value;
if (e.type=='checkbox') e.defaultChecked=e.checked;
if (e.type=='radiobutton') e.defaultChecked=e.checked;
}
var elems=snapElem.getElementsByTagName('textarea');
for (var i=0; i<elems.length; i++) elems[i].defaultValue=elems[i].value;
var fmt='<body>\n\n<div class="%0">%1</div>\n\n</body>\n';
out+=fmt.format([(id==cms.viewerID?'tiddler viewer':''),snapElem.innerHTML]);
return '<html>\n'+out+'</html>';
},
printsnap: function(out) {
var win=window.open("","_blank","");
win.document.open();
win.document.writeln(out);
win.document.close();
win.focus(); // bring to front
win.print(); // trigger print dialog
},
savesnap: function(out) {
var cms=config.macros.snapshot; // abbreviation
// make sure we are local
if (window.location.protocol!="file:")
{ alert(config.messages.notFileUrlError); return; }
var target=cms.askForFilename(cms.fileMsg,cms.getpath(),cms.defaultFilename);
if (!target) return; // cancelled by user
// if specified file does not include a path, assemble fully qualified path and filename
var slashpos=target.lastIndexOf("/");
if (slashpos==-1) slashpos=target.lastIndexOf("\\");
if (slashpos==-1) target=target+cms.defaultFilename;
var link="file:///"+target.replace(/\\/g,'/'); // link for message text
var ok=saveFile(target,convertUnicodeToUTF8(out));
var msg=ok?cms.okmsg.format([target]):cms.failmsg.format([target]);
clearMessage(); displayMessage(msg,link);
},
askForFilename: function(msg,path,file) {
if(window.Components) { // moz
try {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var nsIFilePicker = window.Components.interfaces.nsIFilePicker;
var picker = Components.classes['@mozilla.org/filepicker;1'].createInstance(nsIFilePicker);
picker.init(window, msg, nsIFilePicker.modeSave);
var thispath = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
thispath.initWithPath(path);
picker.displayDirectory=thispath;
picker.defaultExtension='html';
picker.defaultString=file;
picker.appendFilters(nsIFilePicker.filterAll|nsIFilePicker.filterText|nsIFilePicker.filterHTML);
if (picker.show()!=nsIFilePicker.returnCancel) var result=picker.file.persistentDescriptor;
}
catch(e) { alert('error during local file access: '+e.toString()) }
}
else { // IE
try { // XP/Vista only
var s = new ActiveXObject('UserAccounts.CommonDialog');
s.Filter='All files|*.*|Text files|*.txt|HTML files|*.htm;*.html|';
s.FilterIndex=3; // default to HTML files;
s.InitialDir=path;
s.FileName=file;
if (s.showOpen()) var result=s.FileName;
}
catch(e) { var result=prompt(msg,path+file); } // fallback for non-XP IE
}
return result;
}
};
//}}}
// // TOOLBAR DEFINITIONS
//{{{
config.commands.snapshotSave = {
text: "snap",
tooltip: config.macros.snapshot.snapPrompt,
handler: function(ev,src,title) {
src.setAttribute("snapID","ask");
src.setAttribute("printing","false");
src.setAttribute("HTMLOnly",config.options.chkSnapshotHTMLOnly?"true":"false");
config.macros.snapshot.go(src,ev);
return false;
}
};
config.commands.snapshotPrint = {
text: "print",
tooltip: config.macros.snapshot.printPrompt,
handler: function(ev,src,title) {
src.setAttribute("snapID","ask");
src.setAttribute("printing","true");
src.setAttribute("HTMLOnly",config.options.chkSnapshotHTMLOnly?"true":"false");
config.macros.snapshot.go(src,ev);
return false;
}
};
//}}}
// // COPIED FROM [[StickyPopupPlugin]] TO ELIMINATE PLUGIN DEPENDENCY
//{{{
if (config.options.chkStickyPopups==undefined) config.options.chkStickyPopups=false;
Popup.stickyPopup_onDocumentClick = function(ev)
{
// if click is in a sticky popup, ignore it so popup will remain visible
var e = ev ? ev : window.event; var target = resolveTarget(e);
var p=target; while (p) {
if (hasClass(p,"popup") && (hasClass(p,"sticky")||config.options.chkStickyPopups)) break;
else p=p.parentNode;
}
if (!p) // not in sticky popup (or sticky popups disabled)... use normal click handling
Popup.onDocumentClick(ev);
return true;
};
try{removeEvent(document,"click",Popup.onDocumentClick);}catch(e){};
try{addEvent(document,"click",Popup.stickyPopup_onDocumentClick);}catch(e){};
//}}}
/***
|Name|StickyPopupPlugin|
|Source|http://www.TiddlyTools.com/#StickyPopupPlugin|
|Version|1.0.1|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides|Popup.onDocumentClick|
|Options|##Configuration|
|Description|allow mouse interactions inside popups without automatically closing them|
Usually, when a TW popup is displayed, it is automatically closed whenever a click occurs //anywhere// in the document, either //inside// or //outside// the popup itself. This plugin makes popups persistent (a.k.a, "sticky"), allowing you to perform multiple mouse interactions on content //inside// the popup (e.g., entering form fields, opening links, selecting text, etc.), remaining visible until you click //outside// the popup or perform an action that opens another popup (only one popup can be displayed at any given time).
!!!!!Configuration
<<<
You can cause popups to behave in a persistent ("sticky") manner simply by selecting the option checkbox below. The selected popup display behavior will be applied to ALL popups in the document automatically.
><<option chkStickyPopups>> make all popups "sticky"
>{{{usage: <<option chkStickyPopups>>}}}
<<<
!!!!!Usage
<<<
If you are developing your own plugins or inline scripts that create popups programmatically using the core function:
{{{
Popup.create(this)
}}}
you can provide additional parameters that specify the desired CSS classname(s) to assign to the popup DOM element. The default class when none is specified is simply "popup". To create a //sticky// popup, simply enter a custom class combination like this:
{{{
Popup.create(this,null,"sticky popup")
}}}
<<<
!!!!!Revisions
<<<
2008.05.16 [1.0.1] added try..catch around addEvent/removeEvent calls to avoid error in Opera
2007.11.25 [1.0.0] initial release - moved from [[CoreTweaks]]
<<<
!!!!!Code
***/
//{{{
version.extensions.StickyPopupPlugin= {major: 1, minor: 0, revision: 1, date: new Date(2008,5,16)};
if (config.options.chkStickyPopups==undefined) config.options.chkStickyPopups=false;
Popup.stickyPopup_onDocumentClick = function(ev)
{
// if click is in a sticky popup, ignore it so popup will remain visible
var e = ev ? ev : window.event; var target = resolveTarget(e);
var p=target; while (p) {
if (hasClass(p,"popup") && (hasClass(p,"sticky")||config.options.chkStickyPopups)) break;
else p=p.parentNode;
}
if (!p) // not in sticky popup (or sticky popups disabled)... use normal click handling
Popup.onDocumentClick(ev);
return true;
};
try{removeEvent(document,"click",Popup.onDocumentClick);}catch(e){};
try{addEvent(document,"click",Popup.stickyPopup_onDocumentClick);}catch(e){};
//}}}
{{center{
{{floatleft{ <<tiddler ToggleLeftSidebar>>}}}{{floatright{<<tiddler ToggleRightSidebar>>}}}/%
%/{{small{
<<openStory popup>><script>
place.lastChild.className='tiddlyLinkExisting';
</script>/%
%/ <<tiddler ShowPopup with:
[[StoryMenu##changes]] "changes" "show recent changes" tiddlyLinkExisting 60em sticky>>/%
%/ {{span{<script>
place.style.display=readOnly?'none':'inline';
</script><<tiddler ShowPopup with:
[[DocumentSetup]] "setup" "configuration and setup" tiddlyLinkExisting auto sticky>>/%
%/}}}
{{smallform{<<unsavedChanges panel>>}}}/%
%/}}}/%
!changes
{{smallform{<<recentChanges 30>>}}}
!end
%/
/***
|Name|StorySaverPlugin|
|Source|http://www.TiddlyTools.com/#StorySaverPlugin|
|Documentation|http://www.TiddlyTools.com/#StorySaverPluginInfo|
|Version|1.7.1|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Requires|MarkupPostBody|
|Overrides|confirmExit(), getParameters()|
|Description|save/restore current tiddler view between browser sessions|
Automatically save a list of currently viewed tiddlers (the 'story') in a local cookie, {{{txtSavedStory}}} and then open those tiddlers when the document is reloaded, so you can resume working from the same place you left off!! Also, use {{{<<saveStory>>}}} and {{{<<openStory>>}}} macros to quickly save/re-display stories stored in tiddlers, using a command link, droplist, or popup display.
!!!!!Documentation
>see [[StorySaverPluginInfo]]
!!!!!Configuration
<<<
<<option chkStoryAllowAdd>>include 'add a story' command in droplist/popup
<<option chkStoryFold>>fold story tiddlers when opening a story (see [[CollapseTiddlersPlugin]])
<<option chkStoryClose>>close other tiddlers when opening a story
<<option chkStoryTop>>open story tiddlers at top of column
<<option chkStoryBottom>>open story tiddlers at bottom of column
<<<
!!!!!Revisions
<<<
2009.07.27 [1.7.1] corrected test for {{{chkStoryAllowAdd}}} when rendering //list// output
2009.07.27 [1.7.0] added options: {{{chkStoryAllowAdd=true}}}, {{{chkStoryTop=true}}}, and {{{chkStoryBottom=false}}}. Also, autoscroll to first tiddler in story
|please see [[StorySaverPluginInfo]] for additional revision details|
2007.10.05 [1.0.0] initial release. Moved [[SetDefaultTiddlers]] inline script and rewrote as a {{{<<saveStory>>}}} macro.
<<<
!!!!!Code
***/
//{{{
version.extensions.StorySaverPlugin= {major: 1, minor: 7, revision: 1, date: new Date(2009,7,27)};
//}}}
// // ''save or clear story cookie on exit:''
//{{{
// if removeCookie() function is not defined by TW core, define it here.
if (window.removeCookie===undefined) {
window.removeCookie=function(name) {
document.cookie = name+'=; expires=Thu, 01-Jan-1970 00:00:01 UTC; path=/;';
}
}
if (config.options.chkSaveStory==undefined) config.options.chkSaveStory=false;
if (window.coreTweaks_confirmExit==undefined) {
window.coreTweaks_confirmExit=window.confirmExit;
window.confirmExit=function() {
if (config.options.chkSaveStory) { // save cookie
var links=[];
story.forEachTiddler(function(title,element){links.push('[['+title+']]');});
config.options.txtSavedStory=links.join(' ');
saveOptionCookie('txtSavedStory');
} else removeCookie('txtSavedStory');
return window.coreTweaks_confirmExit.apply(this,arguments);
}
}
//}}}
/***
''apply saved story on startup:'' //important note: the following code is actually located in [[MarkupPostBody]]. This is because it needs to supercede the core's getParameters() function, which is called BEFORE plugins are loaded, preventing the normal plugin-based hijack method from working, while code loaded into [[MarkupPostBody]] will be processed as soon as the document is read, even before the TW main() function is invoked.//
<<tiddler MarkupPostBody>>
***/
// // MACRO definitions
//{{{
config.macros.saveStory = {
label: 'set default tiddlers',
defaultTiddler: 'DefaultTiddlers',
prompt: 'store a list of currently displayed tiddlers in another tiddler',
askMsg: 'Enter the name of a tiddler in which to save the current story:',
tag: 'story',
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
var tid=params.shift()||'DefaultTiddlers';
var label=params.shift()||this.label;
var tip=params.shift()||this.prompt;
var btn=createTiddlyButton(place,label,tip,this.setTiddler,'button');
btn.setAttribute('tid',tid);
btn.setAttribute('extratags','[['+params.join(']] [[')+']]');
},
setTiddler: function() {
var cms=config.macros.saveStory; // abbrev
// get list of current open tiddlers
var tids=[];
story.forEachTiddler(function(title,element){tids.push('[['+title+']]')});
// get target tiddler
var tid=this.getAttribute('tid');
if (!tid || tid=='ask') {
tid=prompt(cms.askMsg,cms.defaultTiddler);
if (!tid || !tid.length) return; // cancelled by user
}
if(store.tiddlerExists(tid) && !confirm(config.messages.overwriteWarning.format([tid]))) return;
tids=tids.join('\n'); // separate tiddler links by newlines for easier reading
var t=store.getTiddler(tid); var tags=t?t.tags:[];
var extratags=this.getAttribute('extratags').readBracketedList();
for (var i=0; i<extratags.length; i++) tags.pushUnique(extratags[i]);
tags.pushUnique(cms.tag);
store.saveTiddler(tid,tid,tids,config.options.txtUserName,new Date(),tags,t?t.fields:null);
story.displayTiddler(null,tid);
story.refreshTiddler(tid,null,true);
displayMessage(tid+' has been '+(t?'updated':'created'));
}
}
//}}}
//{{{
if (config.options.chkStoryFold==undefined) config.options.chkStoryFold=true;
if (config.options.chkStoryClose==undefined) config.options.chkStoryClose=true;
if (config.options.chkStoryAllowAdd==undefined) config.options.chkStoryAllowAdd=true;
if (config.options.chkStoryTop==undefined) config.options.chkStoryTop=true;
if (config.options.chkStoryBottom==undefined) config.options.chkStoryBottom=false;
config.macros.openStory = {
label: 'open story: %0',
prompt: 'open the set of tiddlers listed in: %0',
popuplabel: 'stories',
popupprompt: 'view a set of tiddlers',
tag: 'story',
selectprompt: 'select a story...',
optionsprompt: 'viewing options...',
foldcmd: '[%0] fold story',
foldprompt: 'fold story tiddlers when opening a story',
closecmd: '[%0] close others',
closeprompt: 'close other tiddlers when opening a story',
topcmd: '[%0] open at top',
topprompt: 'open story tiddlers at top of column',
bottomcmd: '[%0] open at bottom',
bottomprompt: 'open story tiddlers at bottom of column',
addcmd: 'add a story...',
addprompt: 'create a new story',
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
if (params[0].toLowerCase()=='list') return this.createList(place,params);
else if (params[0].toLowerCase()=='popup') return this.createPopup(place,params);
else this.createButton(place,params);
},
showStory: function(tid,fold) {
var co=config.options; // abbrev
var tids=[];
var tagged=store.getTaggedTiddlers(tid,'title');
if (tagged.length) // if tiddler IS a tag, use tagged tiddlers as story
for (var t=0; t<tagged.length; t++) tids.push(tagged[t].title);
else { // get tiddler list from content
var t=store.getTiddler(tid);
if (t) { if (!t.linksUpdated) t.changed(); tids=t.links.slice(0); }
}
var template=null;
if (fold||co.chkStoryFold) template='CollapsedTemplate'; // see [[CollapseTiddlersPlugin]]
if (!store.tiddlerExists('CollapsedTemplate')) template=null;
if (co.chkStoryClose) story.closeAllTiddlers();
var pos='top'; var first=tids[0];
if (!story.isEmpty() && co.chkStoryBottom) { pos='bottom'; tids=tids.reverse(); }
story.displayTiddlers(pos,tids,template);
var cmd='var t=story.getTiddler("'+first+'");if(t)window.scrollTo(0,t.offsetTop);';
var delay=config.options.chkAnimate?config.animDuration+100:0;
setTimeout(cmd,delay);
},
createButton: function(place,params) {
var tid=params[0]||'';
var label=params[1]||this.label; label=label.format([tid]);
var tip=params[2]||this.prompt; tip=tip.format([tid]);
var fold=(params[3]&&(params[3].toLowerCase()=='fold'))||config.options.chkStoryFold;
var fn=function(){config.macros.openStory.showStory(this.getAttribute('tid'),this.getAttribute('fold'))};
var btn=createTiddlyButton(place,label,tip,fn,'button');
btn.setAttribute('tid',tid);
if (fold) btn.setAttribute('fold',fold);
},
createPopup: function(place,params) {
params.shift(); // discard 'popup' keyword
var label=params.shift()||this.popuplabel;
var tip=params.shift()||this.popupprompt;
var btn=createTiddlyButton(place,label,tip,this.showPopup,'button');
btn.setAttribute('filter',params.shift()||config.macros.openStory.tag);
},
showPopup: function(ev) { var e=ev||window.event;
var co=config.options; // abbrev
var cmo=config.macros.openStory; // abbrev
var indent='\xa0\xa0';
var p=Popup.create(this); if (!p) return false;
createTiddlyText(createTiddlyElement(p,'li'),cmo.selectprompt);
var stories=store.filterTiddlers('[tag['+this.getAttribute('filter')+']]');
for (var s=0; s<stories.length; s++) {
var label=indent+stories[s].title;
var tip=cmo.prompt.format([stories[s].title]);
var fn=function(){cmo.showStory(this.getAttribute('tid'))};
var btn=createTiddlyButton(createTiddlyElement(p,'li'),label,tip,fn,'button');
btn.setAttribute('tid',stories[s].title);
}
createTiddlyText(createTiddlyElement(p,'li'),cmo.optionsprompt);
if (store.tiddlerExists('CollapsedTemplate')) {
var label=indent+cmo.foldcmd.format([co.chkStoryFold?'x':'\xa0\xa0']);
var tip=cmo.foldprompt;
var fn=function(){ config.macros.option.propagateOption(
'chkStoryFold','checked',!config.options.chkStoryFold,'input'); };
var btn=createTiddlyButton(createTiddlyElement(p,'li'),label,tip,fn,'button');
}
var label=indent+cmo.closecmd.format([co.chkStoryClose?'x':'\xa0\xa0']);
var tip=indent+cmo.closeprompt;
var fn=function(){ config.macros.option.propagateOption(
'chkStoryClose','checked',!config.options.chkStoryClose,'input'); };
var btn=createTiddlyButton(createTiddlyElement(p,'li'),label,tip,fn,'button');
if (!co.chkStoryClose) {
var label=indent+cmo.topcmd.format([co.chkStoryTop?'x':'\xa0\xa0']);
var tip=indent+cmo.topprompt;
var fn=function(){
config.macros.option.propagateOption(
'chkStoryTop','checked',!config.options.chkStoryTop,'input');
config.macros.option.propagateOption(
'chkStoryBottom','checked',!config.options.chkStoryTop,'input');
};
var btn=createTiddlyButton(createTiddlyElement(p,'li'),label,tip,fn,'button');
var label=indent+cmo.bottomcmd.format([co.chkStoryBottom?'x':'\xa0\xa0']);
var tip=indent+cmo.botprompt;
var fn=function(){
config.macros.option.propagateOption(
'chkStoryBottom','checked',!config.options.chkStoryBottom,'input');
config.macros.option.propagateOption(
'chkStoryTop','checked',!config.options.chkStoryBottom,'input');
};
var btn=createTiddlyButton(createTiddlyElement(p,'li'),label,tip,fn,'button');
}
if (!readOnly && co.chkStoryAllowAdd) {
var label=cmo.addcmd;
var tip=cmo.addprompt;
var fn=config.macros.saveStory.setTiddler;
createTiddlyElement(createTiddlyElement(p,'li'),'hr');
var btn=createTiddlyButton(createTiddlyElement(p,'li'),label,tip,fn,'button');
}
Popup.show();
e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation();
return false;
},
createList: function(place,params) {
var cmo=config.macros.openStory; // abbrev
var s=createTiddlyElement(place,'select',null,'storyListbox');
s.size=1;
s.onchange=function() {
if (this.value=='_fold') {
config.macros.option.propagateOption('chkStoryFold','checked',
!config.options.chkStoryFold,'input');
cmo.refreshList();
} else if (this.value=='_close') {
config.macros.option.propagateOption('chkStoryClose','checked',
!config.options.chkStoryClose,'input');
cmo.refreshList();
} else if (this.value=='_top') {
config.macros.option.propagateOption('chkStoryTop','checked',
!config.options.chkStoryTop,'input');
cmo.refreshList();
} else if (this.value=='_bottom') {
config.macros.option.propagateOption('chkStoryBottom','checked',
!config.options.chkStoryBottom,'input');
cmo.refreshList();
} else if (this.value=='_add')
config.macros.saveStory.setTiddler.apply(this,arguments);
else cmo.showStory(this.value);
}
params.shift(); // discard 'list' keyword
s.setAttribute('filter',params.shift()||cmo.tag);
setStylesheet('.storyListbox { width:100%; }', 'StorySaverStyles');
store.addNotification(null,this.refreshList); this.refreshList();
return;
},
refreshList: function() {
var cmo=config.macros.openStory; // abbrev
var indent='\xa0\xa0\xa0\xa0';
var lists=document.getElementsByTagName('select');
for (var i=0; i<lists.length; i++) { if (lists[i].className!='storyListbox') continue;
var here=lists[i];
var stories=store.filterTiddlers('[tag['+here.getAttribute('filter')+']]');
while (here.length) here.options[0]=null; // remove current list items
here.options[here.length]=new Option(cmo.selectprompt,'',true,true);
for (var s=0; s<stories.length; s++)
here.options[here.length]=new Option(indent+stories[s].title,stories[s].title);
if (!readOnly && config.options.chkStoryAllowAdd)
here.options[here.length]=new Option(cmo.addcmd,'_add');
here.options[here.length]=new Option(cmo.optionsprompt,'');
if (store.tiddlerExists('CollapsedTemplate')) {
var msg=cmo.foldcmd.format([config.options.chkStoryFold?'x':'\xa0\xa0']);
here.options[here.length]=new Option(indent+msg,'_fold');
}
var msg=cmo.closecmd.format([config.options.chkStoryClose?'x':'\xa0\xa0']);
here.options[here.length]=new Option(indent+msg,'_close',false,false);
if (!config.options.chkStoryClose) {
var msg=cmo.topcmd.format([config.options.chkStoryTop?'x':'\xa0\xa0']);
here.options[here.length]=new Option(indent+msg,'_top',false,false);
var msg=cmo.bottomcmd.format([config.options.chkStoryBottom?'x':'\xa0\xa0']);
here.options[here.length]=new Option(indent+msg,'_bottom',false,false);
}
}
}
}
//}}}
/*{{{*/
/***
!!!Specific Purpose
***/
.selected .title { color:#000; }
.selected .viewer { border-color:#000; color:#000; }
/* below, the size adjust works but not the font change. ??? */
.editor textarea { font-size:1.2em; font-family:arial,helvetica }
/* SHORTCUTS */
[[StyleSheetShortcuts]]
#mainMenu {width: 16.5em; text-align: left; font-size: 10pt;}
/*
#displayArea {margin: 0em 13.5em 0em 15em;}
.sliderPanel { margin-left: 1em; }
*/
/* ADJUSTMENTS TO SHORTCUTS */
.small { font-size:90%; line-height:120%; }
.fine { font-size:80%; line-height:120%; }
.tiny { font-size:70%; line-height:120%; }
.groupbox { padding:.5em; border:1px solid gray; -moz-border-radius:.5em; -webkit-border-radius:.5em; }
/* CUSTOM SHORTCUTS */
.scroll { display:block; overflow:auto; width:auto; max-height:8em; padding-bottom:.5em; }
.scroll ul { margin:0; }
.scroll li { white-space:nowrap; }
*[id="mainMenu"] .scroll li /* MOZ ONLY */ { margin-left:-2em; }
/* ADJUSTMENTS TO STANDARD ELEMENTS */
[[StyleSheetAdjustments]]
.viewer {border: 2px solid gray}
.selected .title {color: #0000ff}
.selected .viewer {border: 2px solid #0000ff}
/* ADJUSTMENTS TO CUSTOM ELEMENTS */
.storyListbox { font-size:80%; }
.siteNav { position:absolute;z-index:1;right:.5em;top:2em;width:14em; }
.siteNav, .siteNav .button { color:#fff }
.siteNav .button:hover { color:#009 }
.siteNav input[type="checkbox"] { margin:0; }
/***
!!!Printing
***/
@media print {#mainMenu {display: none ! important;}}
@media print {#topMenu {display: none ! important;}}
@media print {#sidebar {display: none ! important;}}
@media print {#messageArea {display: none ! important;}}
@media print {#toolbar {display: none ! important;}}
@media print {.header {display: none ! important;}}
@media print {.tiddler .subtitle {display: none ! important;}}
@media print {.tiddler .toolbar {display; none ! important; }}
@media print {.tiddler .tagging {display; none ! important; }}
@media print {.tiddler .tagged {display; none ! important; }}
/*}}}*/
/*{{{*/
/* ADJUSTMENTS TO STANDARD ELEMENTS */
.headerShadow, .headerForeground
{ padding-top:1em; white-space:nowrap; }
#mainMenu
{ text-align:left; width:13em; padding:0.5em; }
#mainMenu table, #mainMenu table td
{ border:1px solid #999; border-collapse:collapse; padding:.3em; }
#displayArea
{ margin-left:16em; margin-right:15em; }
.popup
{ max-height:40em; overflow:auto; -moz-border-radius:.5em; -webkit-border-radius:.5em; padding:.5em; }
.popup li
{ white-space:nowrap; line-height:100%; }
.toolbar
{ float:right; white-space:nowrap; }
.viewer
{ border:1px solid gray; -moz-border-radius:.5em; -webkit-border-radius:.5em; padding:.5em; }
.tiddler .subtitle
{ display:inline; }
.tagged
{ border:1px solid #999; -moz-border-radius:3px; -webkit-border-radius:3px; }
.tagged
{ opacity:.7; }
.selected .tagged
{ opacity:1; }
.button, .tiddler .button, #sidebarTabs .button
{ margin:0px; padding: 0px .3em; border:1px solid transparent;
-moz-border-radius:3px; -webkit-border-radius:3px; }
.button:hover
{ border:1px solid #999; }
#sidebarTabs .button
{ margin:0px 0.2em; padding:0.2em 0.3em; border:1px solid transparent;
-moz-border-radius:3px; -webkit-border-radius:3px; display:block; }
#sidebarTabs .button:hover
{ border:1px solid #999; }
.editor textarea
{ font-family:monospace; }
.tab
{ padding-bottom:1px;
-moz-border-radius-topleft:.5em;
-moz-border-radius-topright:.5em;
-webkit-border-top-left-radius:.5em;
-webkit-border-top-right-radius:.5em;
}
.tabContents
{ -moz-border-radius:.5em; -webkit-border-radius:.5em; }
.tabContents, .tabSelected
{ background-color:#eef; }
.tabUnselected
{ background-color:#79d; }
/*}}}*/
/*{{{*/
* html .tiddler {height:1%;}
body {font-size:.75em; font-family:arial,helvetica; margin:0; padding:0;}
h1,h2,h3,h4,h5,h6 {font-weight:bold; text-decoration:none;}
h1,h2,h3 {padding-bottom:1px; margin-top:1.2em;margin-bottom:0.3em;}
h4,h5,h6 {margin-top:1em;}
h1 {font-size:1.35em;}
h2 {font-size:1.25em;}
h3 {font-size:1.1em;}
h4 {font-size:1em;}
h5 {font-size:.9em;}
hr {height:1px;}
a {text-decoration:none;}
dt {font-weight:bold;}
ol {list-style-type:decimal;}
ol ol {list-style-type:lower-alpha;}
ol ol ol {list-style-type:lower-roman;}
ol ol ol ol {list-style-type:decimal;}
ol ol ol ol ol {list-style-type:lower-alpha;}
ol ol ol ol ol ol {list-style-type:lower-roman;}
ol ol ol ol ol ol ol {list-style-type:decimal;}
.txtOptionInput {width:11em;}
#contentWrapper .chkOptionInput {border:0;}
.externalLink {text-decoration:underline;}
.indent {margin-left:3em;}
.outdent {margin-left:3em; text-indent:-3em;}
code.escaped {white-space:nowrap;}
.tiddlyLinkExisting {font-weight:bold;}
.tiddlyLinkNonExisting {font-style:italic;}
/* the 'a' is required for IE, otherwise it renders the whole tiddler in bold */
a.tiddlyLinkNonExisting.shadow {font-weight:bold;}
#mainMenu .tiddlyLinkExisting,
#mainMenu .tiddlyLinkNonExisting,
#sidebarTabs .tiddlyLinkNonExisting {font-weight:normal; font-style:normal;}
#sidebarTabs .tiddlyLinkExisting {font-weight:bold; font-style:normal;}
.header {position:relative;}
.header a:hover {background:transparent;}
.headerShadow {position:relative; padding:4.5em 0 1em 1em; left:-1px; top:-1px;}
.headerForeground {position:absolute; padding:4.5em 0 1em 1em; left:0px; top:0px;}
.siteTitle {font-size:3em;}
.siteSubtitle {font-size:1.2em;}
#mainMenu {position:absolute; left:0; width:10em; text-align:right; line-height:1.6em; padding:1.5em 0.5em 0.5em 0.5em; font-size:1.1em;}
#sidebar {position:absolute; right:3px; width:15em; font-size:.9em;} /*SDM*/
#sidebarOptions {padding-top:0.3em;}
#sidebarOptions a {margin:0 0.2em; padding:0.2em 0.3em; display:block;}
#sidebarOptions input {margin:0.4em 0.5em;}
#sidebarOptions .sliderPanel {margin-left:1em; padding:0.5em; font-size:.85em;}
#sidebarOptions .sliderPanel a {font-weight:bold; display:inline; padding:0;}
#sidebarOptions .sliderPanel input {margin:0 0 0.3em 0;}
#sidebarTabs .tabContents {width:14em; overflow:hidden;}
.wizard {padding:0.1em 1em 0 2em;}
.wizard h1 {font-size:2em; font-weight:bold; background:none; padding:0; margin:0.4em 0 0.2em;}
.wizard h2 {font-size:1.2em; font-weight:bold; background:none; padding:0; margin:0.4em 0 0.2em;}
.wizardStep {padding:1em 1em 1em 1em;}
.wizard .button {margin:0.5em 0 0; font-size:1.2em;}
.wizardFooter {padding:0.8em 0.4em 0.8em 0;}
.wizardFooter .status {padding:0 0.4em; margin-left:1em;}
.wizard .button {padding:0.1em 0.2em;}
#messageArea {position:fixed; top:2em; right:0; margin:0.5em; padding:0.5em; z-index:2000; _position:absolute;}
.messageToolbar {display:block; text-align:right; padding:0.2em;}
#messageArea a {text-decoration:underline;}
.tiddlerPopupButton {padding:0.2em;}
.popupTiddler {position: absolute; z-index:300; padding:1em; margin:0;}
.popup {position:absolute; z-index:300; font-size:.9em; padding:0; list-style:none; margin:0;}
.popup .popupMessage {padding:0.4em;}
.popup hr {display:block; height:1px; width:auto; padding:0; margin:0.2em 0;}
.popup li.disabled {padding:0.4em;}
.popup li a {display:block; padding:0.4em; font-weight:normal; cursor:pointer;}
.listBreak {font-size:1px; line-height:1px;}
.listBreak div {margin:2px 0;}
.tabset {padding:1em 0 0 0.5em;}
.tab {margin:0 0 0 0.25em; padding:2px;}
.tabContents {padding:0.5em;}
.tabContents ul, .tabContents ol {margin:0; padding:0;}
.txtMainTab .tabContents li {list-style:none;}
.tabContents li.listLink { margin-left:.75em;}
#contentWrapper {display:block;}
#splashScreen {display:none;}
#displayArea {margin:1em 17em 0 14em;}
.toolbar {text-align:right; font-size:.9em;}
.tiddler {padding:1em 1em 0;}
.missing .viewer,.missing .title {font-style:italic;}
.title {font-size:1.6em; font-weight:bold;}
.missing .subtitle {display:none;}
.subtitle {font-size:1.1em;}
.tiddler .button {padding:0.2em 0.4em;}
.tagging {margin:0.5em 0.5em 0.5em 0; float:left; display:none;}
.isTag .tagging {display:block;}
.tagged {margin:0.5em; float:right;}
.tagging, .tagged {font-size:0.9em; padding:0.25em;}
.tagging ul, .tagged ul {list-style:none; margin:0.25em; padding:0;}
.tagClear {clear:both;}
.footer {font-size:.9em;}
.footer li {display:inline;}
.annotation {padding:0.5em; margin:0.5em;}
* html .viewer pre {width:99%; padding:0 0 1em 0;}
.viewer {line-height:1.4em; padding-top:0.5em;}
.viewer .button {margin:0 0.25em; padding:0 0.25em;}
.viewer blockquote {line-height:1.5em; padding-left:0.8em;margin-left:2.5em;}
.viewer ul, .viewer ol {margin-left:0.5em; padding-left:1.5em;}
.viewer table, table.twtable {border-collapse:collapse; margin:0.8em 1.0em;}
.viewer th, .viewer td, .viewer tr,.viewer caption,.twtable th, .twtable td, .twtable tr,.twtable caption {padding:3px;}
table.listView {font-size:0.85em; margin:0.8em 1.0em;}
table.listView th, table.listView td, table.listView tr {padding:0px 3px 0px 3px;}
.viewer pre {padding:0.5em; margin-left:0.5em; font-size:1.2em; line-height:1.4em; overflow:auto;}
.viewer code {font-size:1.2em; line-height:1.4em;}
.editor {font-size:1.1em;}
.editor input, .editor textarea {display:block; width:100%; font:inherit;}
.editorFooter {padding:0.25em 0; font-size:.9em;}
.editorFooter .button {padding-top:0px; padding-bottom:0px;}
.fieldsetFix {border:0; padding:0; margin:1px 0px;}
.sparkline {line-height:1em;}
.sparktick {outline:0;}
.zoomer {font-size:1.1em; position:absolute; overflow:hidden;}
.zoomer div {padding:1em;}
* html #backstage {width:99%;}
* html #backstageArea {width:99%;}
#backstageArea {display:none; position:relative; overflow: hidden; z-index:150; padding:0.3em 0.5em;}
#backstageToolbar {position:relative;}
#backstageArea a {font-weight:bold; margin-left:0.5em; padding:0.3em 0.5em;}
#backstageButton {display:none; position:absolute; z-index:175; top:0; right:0;}
#backstageButton a {padding:0.1em 0.4em; margin:0.1em;}
#backstage {position:relative; width:100%; z-index:50;}
#backstagePanel {display:none; z-index:100; position:absolute; width:90%; margin-left:3em; padding:1em;}
.backstagePanelFooter {padding-top:0.2em; float:right;}
.backstagePanelFooter a {padding:0.2em 0.4em;}
#backstageCloak {display:none; z-index:20; position:absolute; width:100%; height:100px;}
.whenBackstage {display:none;}
.backstageVisible .whenBackstage {display:block;}
/*}}}*/
/***
|Name|StyleSheetShortcuts|
|Source|http://www.TiddlyTools.com/#StyleSheetShortcuts|
|Version||
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|CSS|
|Requires||
|Overrides||
|Description|'convenience' classes for common formatting, alignment, boxes, tables, etc.|
These 'style tweaks' can be easily included in other stylesheet tiddler so they can share a baseline look-and-feel that can then be customized to create a wide variety of 'flavors'.
***/
/*{{{*/
/* text alignments */
.left
{ display:block;text-align:left; }
.center
{ display:block;text-align:center; }
.center table
{ margin:auto !important; }
.right
{ display:block;text-align:right; }
.justify
{ display:block;text-align:justify; }
.indent
{ display:block;margin:0;padding:0;border:0;margin-left:2em; }
.floatleft
{ float:left; }
.floatright
{ float:right; }
.valignTop, .valignTop table, .valignTop tbody, .valignTop th, .valignTop tr, .valignTop td
{ vertical-align:top; }
.valignBottom, .valignBottom table, .valignBottom tbody, .valignBottom th, .valignBottom tr, .valignBottom td
{ vertical-align:bottom; }
.clear
{ clear:both; }
.wrap
{ white-space:normal; }
.nowrap
{ white-space:nowrap; }
.hidden
{ display:none; }
.show
{ display:inline !important; }
.span
{ display:span; }
.block
{ display:block; }
.relative
{ position:relative; }
.absolute
{ position:absolute; }
/* font sizes */
.big
{ font-size:14pt;line-height:120% }
.medium
{ font-size:12pt;line-height:120% }
.normal
{ font-size:9pt;line-height:120% }
.small
{ font-size:8pt;line-height:120% }
.fine
{ font-size:7pt;line-height:120% }
.tiny
{ font-size:6pt;line-height:120% }
.larger
{ font-size:120%; }
.smaller
{ font-size:80%; }
/* font styles */
.bold
{ font-weight:bold; }
.italic
{ font-style:italic; }
.underline
{ text-decoration:underline; }
/* plain list items (no bullets or indent) */
.nobullets li { list-style-type: none; margin-left:-2em; }
/* multi-column tiddler content (not supported in Internet Explorer) */
.twocolumns { display:block;
-moz-column-count:2; -moz-column-gap:1em; -moz-column-width:50%; /* FireFox */
-webkit-column-count:2; -webkit-column-gap:1em; -webkit-column-width:50%; /* Safari */
column-count:2; column-gap:1em; column-width:50%; /* Opera */
}
.threecolumns { display:block;
-moz-column-count:3; -moz-column-gap:1em; -moz-column-width:33%; /* FireFox */
-webkit-column-count:3; -webkit-column-gap:1em; -webkit-column-width:33%; /* Safari */
column-count:3; column-gap:1em; column-width:33%; /* Opera */
}
.fourcolumns { display:block;
-moz-column-count:4; -moz-column-gap:1em; -moz-column-width:25%; /* FireFox */
-webkit-column-count:4; -webkit-column-gap:1em; -webkit-column-width:25%; /* Safari */
column-count:4; column-gap:1em; column-width:25%; /* Opera */
}
/* show/hide browser-specific content for InternetExplorer vs. non-IE ("moz") browsers */
*[class="ieOnly"]
{ display:none; } /* hide in moz (uses CSS selector) */
* html .mozOnly, *:first-child+html .mozOnly
{ display: none; } /* hide in IE (uses IE6/IE7 CSS hacks) */
/* borderless tables */
.borderless, .borderless table, .borderless td, .borderless tr, .borderless th, .borderless tbody
{ border:0 !important; margin:0 !important; padding:0 !important; }
.widetable, .widetable table
{ width:100%; }
/* thumbnail images (fixed-sized scaled images) */
.thumbnail img { height:5em !important; }
/* stretchable images (auto-size to fit tiddler) */
.stretch img { width:95%; }
/* grouped content */
.outline
{ display:block; padding:1em; -moz-border-radius:1em;-webkit-border-radius:1em; border:1px solid; }
.menubox
{ display:block; padding:1em; -moz-border-radius:1em;-webkit-border-radius:1em; border:1px solid; background:#fff; color:#000; }
.menubox .button, .menubox .tiddlyLinkExisting, .menubox .tiddlyLinkNonExisting
{ color:#009 !important; }
.groupbox
{ display:block; padding:1em; -moz-border-radius:1em;-webkit-border-radius:1em; border:1px solid; background:#ffe; color:#000; }
.groupbox a, .groupbox .button, .groupbox .tiddlyLinkExisting, .groupbox .tiddlyLinkNonExisting
{ color:#009 !important; }
.groupbox code
{ color:#333 !important; }
.borderleft
{ margin:0;padding:0;border:0;margin-left:1em; border-left:1px dotted; padding-left:.5em; }
.borderright
{ margin:0;padding:0;border:0;margin-right:1em; border-right:1px dotted; padding-right:.5em; }
.borderbottom
{ margin:0;padding:1px 0;border:0;border-bottom:1px dotted; margin-bottom:1px; padding-bottom:1px; }
.bordertop
{ margin:0;padding:0;border:0;border-top:1px dotted; margin-top:1px; padding-top:1px; }
/* scrolled content */
.scrollbars { overflow:auto; }
.height10em { height:10em; }
.height15em { height:15em; }
.height20em { height:20em; }
.height25em { height:25em; }
.height30em { height:30em; }
.height35em { height:35em; }
.height40em { height:40em; }
/* compact form */
.smallform
{ white-space:nowrap; }
.smallform input, .smallform textarea, .smallform button, .smallform checkbox, .smallform radio, .smallform select
{ font-size:8pt; }
/* stretchable edit fields and textareas (auto-size to fit tiddler) */
.stretch input { width:99%; }
.stretch textarea { width:99%; }
/* compact input fields (limited to a few characters for entering percentages and other small values) */
.onechar input { width:1em; }
.twochar input { width:2em; }
.threechar input { width:3em; }
.fourchar input { width:4em; }
.fivechar input { width:5em; }
/* text colors */
.white { color:#fff !important }
.gray { color:#999 !important }
.black { color:#000 !important }
.red { color:#f66 !important }
.green { color:#0c0 !important }
.blue { color:#99f !important }
/* rollover highlighting */
.mouseover
{color:[[ColorPalette::TertiaryLight]] !important;}
.mouseover a
{color:[[ColorPalette::TertiaryLight]] !important;}
.selected .mouseover
{color:[[ColorPalette::Foreground]] !important;}
.selected .mouseover .button, .selected .mouseover a
{color:[[ColorPalette::PrimaryDark]] !important;}
/* rollover zoom text */
.zoomover
{ font-size:80% !important; }
.selected .zoomover
{ font-size:100% !important; }
/* [[ColorPalette]] text colors */
.Background { color:[[ColorPalette::Background]]; }
.Foreground { color:[[ColorPalette::Foreground]]; }
.PrimaryPale { color:[[ColorPalette::PrimaryPale]]; }
.PrimaryLight { color:[[ColorPalette::PrimaryLight]]; }
.PrimaryMid { color:[[ColorPalette::PrimaryMid]]; }
.PrimaryDark { color:[[ColorPalette::PrimaryDark]]; }
.SecondaryPale { color:[[ColorPalette::SecondaryPale]]; }
.SecondaryLight { color:[[ColorPalette::SecondaryLight]];}
.SecondaryMid { color:[[ColorPalette::SecondaryMid]]; }
.SecondaryDark { color:[[ColorPalette::SecondaryDark]]; }
.TertiaryPale { color:[[ColorPalette::TertiaryPale]]; }
.TertiaryLight { color:[[ColorPalette::TertiaryLight]]; }
.TertiaryMid { color:[[ColorPalette::TertiaryMid]]; }
.TertiaryDark { color:[[ColorPalette::TertiaryDark]]; }
.Error { color:[[ColorPalette::Error]]; }
/* [[ColorPalette]] background colors */
.BGBackground { background-color:[[ColorPalette::Background]]; }
.BGForeground { background-color:[[ColorPalette::Foreground]]; }
.BGPrimaryPale { background-color:[[ColorPalette::PrimaryPale]]; }
.BGPrimaryLight { background-color:[[ColorPalette::PrimaryLight]]; }
.BGPrimaryMid { background-color:[[ColorPalette::PrimaryMid]]; }
.BGPrimaryDark { background-color:[[ColorPalette::PrimaryDark]]; }
.BGSecondaryPale { background-color:[[ColorPalette::SecondaryPale]]; }
.BGSecondaryLight { background-color:[[ColorPalette::SecondaryLight]]; }
.BGSecondaryMid { background-color:[[ColorPalette::SecondaryMid]]; }
.BGSecondaryDark { background-color:[[ColorPalette::SecondaryDark]]; }
.BGTertiaryPale { background-color:[[ColorPalette::TertiaryPale]]; }
.BGTertiaryLight { background-color:[[ColorPalette::TertiaryLight]]; }
.BGTertiaryMid { background-color:[[ColorPalette::TertiaryMid]]; }
.BGTertiaryDark { background-color:[[ColorPalette::TertiaryDark]]; }
.BGError { background-color:[[ColorPalette::Error]]; }
/*}}}*/
<<timeline 'modified' '30' 'YYYY-0MM-0DD'>>
!Examples
<<<
//tags listed in// [[FavoriteTags]]
{{{<<cloud +FavoriteTags>>}}}
{{groupbox{<<cloud +FavoriteTags>>}}}
//tags NOT listed in// [[FavoriteTags]]
{{{<<cloud -FavoriteTags>>}}}
{{groupbox{<<cloud -FavoriteTags>>}}}
//top 20 most referenced tiddlers//
{{{<<cloud references limit:20>>}}}
{{groupbox{<<cloud references limit:20>>}}}
//top 20 tiddlers that contain the most links//
{{{<<cloud links limit:20>>}}}
{{groupbox{<<cloud links limit:20>>}}}
//top 16 tags excluding<<tag systemConfig>>, <<tag excludeMissing>>, <<tag excludeLists>> and <<tag script>>//
{{{<<cloud limit:16 systemConfig excludeMissing excludeLists script>>}}}
{{groupbox{<<cloud limit:16 systemConfig excludeMissing excludeLists script>>}}}
//links to tiddlers tagged with 'package'//
{{{<<cloud action:goto =package>>}}}
{{groupbox{<<cloud action:goto =package>>}}}
/***
|Name|TagCloudPlugin|
|Source|http://www.TiddlyTools.com/#TagCloudPlugin|
|Version|1.7.0|
|Author|Eric Shulman|
|Original Author|Clint Checketts|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Description|present a 'cloud' of tags (or links) using proportional font display|
!Usage
<<<
{{{
<<cloud type action:... limit:... tag tag tag ...>>
<<cloud type action:... limit:... +TiddlerName>>
<<cloud type action:... limit:... -TiddlerName>>
<<cloud type action:... limit:... =tagvalue>>
}}}
where:
* //type// is a keyword, one of:
** ''tags'' (default) - displays a cloud of tags, based on frequency of use
** ''links'' - displays a cloud of tiddlers, based on number of links //from// each tiddler
** ''references'' - displays a cloud of tiddlers, based on number of links //to// each tiddler
* ''action:popup'' (default) - clicking a cloud item shows a popup with links to related tiddlers<br>//or//<br> ''action:goto'' - clicking a cloud item immediately opens the tiddler corresponding to that item
* ''limit:N'' (optional) - restricts the cloud display to only show the N most popular tags/links
* ''tag tag tag...'' (or ''title title title'' if ''links''/''references'' is used)<br>shows all tags/links in the document //except// for those listed as macro parameters
* ''+TiddlerName''<br>show only tags/links read from a space-separated, bracketed list stored in a separate tiddler.
* ''-TiddlerName''<br>show all tags/links //except// those read from a space-separated, bracketed list stored in a separate tiddler.
* ''=tagvalue'' (//only if type=''tags''//)<br>shows only tags that are themselves tagged with the indicated tag value (i.e., ~TagglyTagging usage)
//note: for backward-compatibility, you can also use the macro {{{<<tagCloud ...>>}}} in place of {{{<<cloud ...>>}}}//
<<<
!Examples
<<<
//all tags excluding<<tag systemConfig>>, <<tag excludeMissing>> and <<tag script>>//
{{{<<cloud systemConfig excludeMissing script>>}}}
{{groupbox{<<cloud systemConfig excludeMissing script>>}}}
//top 10 tags excluding<<tag systemConfig>>, <<tag excludeMissing>>, <<tag excludeLists>> and <<tag script>>//
{{{<<cloud limit:10 systemConfig excludeMissing excludeLists script>>}}}
{{groupbox{<<cloud limit:10 systemConfig excludeMissing excludeLists script>>}}}
//tags listed in// [[FavoriteTags]]
{{{<<cloud +FavoriteTags>>}}}
{{groupbox{<<cloud +FavoriteTags>>}}}
//tags NOT listed in// [[FavoriteTags]]
{{{<<cloud -FavoriteTags>>}}}
{{groupbox{<<cloud -FavoriteTags>>}}}
//links to tiddlers tagged with 'package'//
{{{<<cloud action:goto =package>>}}}
{{groupbox{<<cloud action:goto =package>>}}}
//top 20 most referenced tiddlers//
{{{<<cloud references limit:20>>}}}
{{groupbox{<<cloud references limit:20>>}}}
//top 20 tiddlers that contain the most links//
{{{<<cloud links limit:20>>}}}
{{groupbox{<<cloud links limit:20>>}}}
<<<
!Revisions
<<<
2009.07.17 [1.7.0] added {{{-TiddlerName}}} parameter to exclude tags that are listed in the indicated tiddler
2009.02.26 [1.6.0] added {{{action:...}}} parameter to apply popup vs. goto action when clicking cloud items
2009.02.05 [1.5.0] added ability to show links or back-links (references) instead of tags and renamed macro to {{{<<cloud>>}}} to reflect more generalized usage.
2008.12.16 [1.4.2] corrected group calculation to prevent 'group=0' error
2008.12.16 [1.4.1] revised tag filtering so excluded tags don't affect calculations
2008.12.15 [1.4.0] added {{{limit:...}}} parameter to restrict the number of tags displayed to the top N most popular
2008.11.15 [1.3.0] added {{{+TiddlerName}}} parameter to include only tags that are listed in the indicated tiddler
2008.09.05 [1.2.0] added '=tagname' parameter to include only tags that are themselves tagged with the specified value (i.e., ~TagglyTagging usage)
2008.07.03 [1.1.0] added 'segments' property to macro object. Extensive code cleanup
<<<
!Code
***/
//{{{
version.extensions.TagCloudPlugin= {major: 1, minor: 7 , revision: 0, date: new Date(2009,7,17)};
//Originally created by Clint Checketts, contributions by Jonny Leroy and Eric Shulman
//Currently maintained and enhanced by Eric Shulman
//}}}
//{{{
config.macros.cloud = {
tagstip: "%1 tiddlers tagged with '%0'",
refslabel: " (%0 references)",
refstip: "%1 tiddlers have links to '%0'",
linkslabel: " (%0 links)",
linkstip: "'%0' has links to %1 other tiddlers",
groups: 9,
init: function() {
config.macros.tagCloud=config.macros.cloud; // for backward-compatibility
config.shadowTiddlers.TagCloud='<<cloud>>';
config.shadowTiddlers.StyleSheetTagCloud=
'/*{{{*/\n'
+'.tagCloud span {line-height: 3.5em; margin:3px;}\n'
+'.tagCloud1{font-size: 80%;}\n'
+'.tagCloud2{font-size: 100%;}\n'
+'.tagCloud3{font-size: 120%;}\n'
+'.tagCloud4{font-size: 140%;}\n'
+'.tagCloud5{font-size: 160%;}\n'
+'.tagCloud6{font-size: 180%;}\n'
+'.tagCloud7{font-size: 200%;}\n'
+'.tagCloud8{font-size: 220%;}\n'
+'.tagCloud9{font-size: 240%;}\n'
+'/*}}}*/\n';
setStylesheet(store.getTiddlerText('StyleSheetTagCloud'),'tagCloudsStyles');
},
getLinks: function(tiddler) { // get list of links to existing tiddlers and shadows
if (!tiddler.linksUpdated) tiddler.changed();
var list=[]; for (var i=0; i<tiddler.links.length; i++) {
var title=tiddler.links[i];
if (store.isShadowTiddler(title)||store.tiddlerExists(title))
list.push(title);
}
return list;
},
handler: function(place,macroName,params) {
// unpack params
var inc=[]; var ex=[]; var limit=0; var action='popup';
var links=(params[0]&¶ms[0].toLowerCase()=='links'); if (links) params.shift();
var refs=(params[0]&¶ms[0].toLowerCase()=='references'); if (refs) params.shift();
if (params[0]&¶ms[0].substr(0,7).toLowerCase()=='action:')
action=params.shift().substr(7).toLowerCase();
if (params[0]&¶ms[0].substr(0,6).toLowerCase()=='limit:')
limit=parseInt(params.shift().substr(6));
while (params.length) {
if (params[0].substr(0,1)=='+') { // read taglist from tiddler
inc=inc.concat(store.getTiddlerText(params[0].substr(1),'').readBracketedList());
} else if (params[0].substr(0,1)=='-') { // exclude taglist from tiddler
ex=ex.concat(store.getTiddlerText(params[0].substr(1),'').readBracketedList());
} else if (params[0].substr(0,1)=='=') { // get tag list using tagged tags
var tagged=store.getTaggedTiddlers(params[0].substr(1));
for (var t=0; t<tagged.length; t++) inc.push(tagged[t].title);
} else ex.push(params[0]); // exclude params
params.shift();
}
// get all items, include/exclude specific items
var items=[];
var list=(links||refs)?store.getTiddlers('title','excludeLists'):store.getTags();
for (var t=0; t<list.length; t++) {
var title=(links||refs)?list[t].title:list[t][0];
if (links) var count=this.getLinks(list[t]).length;
else if (refs) var count=store.getReferringTiddlers(title).length;
else var count=list[t][1];
if ((!inc.length||inc.contains(title))&&(!ex.length||!ex.contains(title)))
items.push({ title:title, count:count });
}
if(!items.length) return;
// sort by decending count, limit results (optional)
items=items.sort(function(a,b){return(a.count==b.count)?0:(a.count>b.count?-1:1);});
while (limit && items.length>limit) items.pop();
// find min/max and group size
var most=items[0].count;
var least=items[items.length-1].count;
var groupSize=(most-least+1)/this.groups;
// sort by title and draw the cloud of items
items=items.sort(function(a,b){return(a.title==b.title)?0:(a.title>b.title?1:-1);});
var cloudWrapper = createTiddlyElement(place,'div',null,'tagCloud',null);
for (var t=0; t<items.length; t++) {
cloudWrapper.appendChild(document.createTextNode(' '));
var group=Math.ceil((items[t].count-least)/groupSize)||1;
var className='tagCloudtag tagCloud'+group;
var tip=refs?this.refstip:links?this.linkstip:this.tagstip;
tip=tip.format([items[t].title,items[t].count]);
if (action=='goto') { // TAG/LINK/REFERENCES GOTO
var btn=createTiddlyLink(cloudWrapper,items[t].title,true,className);
btn.title=tip;
btn.style.fontWeight='normal';
} else if (!links&&!refs) { // TAG POPUP
var btn=createTiddlyButton(cloudWrapper,items[t].title,tip,onClickTag,className);
btn.setAttribute('tag',items[t].title);
} else { // LINK/REFERENCES POPUP
var btn=createTiddlyButton(cloudWrapper,items[t].title,tip,
function(ev) { var e=ev||window.event; var cmt=config.macros.cloud;
var popup = Popup.create(this);
var title = this.getAttribute('tiddler');
var count = this.getAttribute('count');
var refs = this.getAttribute('refs')=='T';
var links = this.getAttribute('links')=='T';
var label = (refs?cmt.refslabel:cmt.linkslabel).format([count]);
createTiddlyLink(popup,title,true);
createTiddlyText(popup,label);
createTiddlyElement(popup,'hr');
if (refs) {
popup.setAttribute('tiddler',title);
config.commands.references.handlePopup(popup,title);
}
if (links) {
var tiddler = store.fetchTiddler(title);
var links=config.macros.cloud.getLinks(tiddler);
for(var i=0;i<links.length;i++)
createTiddlyLink(createTiddlyElement(popup,'li'),
links[i],true);
}
Popup.show();
e.cancelBubble=true; if(e.stopPropagation) e.stopPropagation();
return false;
}, className);
btn.setAttribute('tiddler',items[t].title);
btn.setAttribute('count',items[t].count);
btn.setAttribute('refs',refs?'T':'F');
btn.setAttribute('links',links?'T':'F');
btn.title=tip;
}
}
}
};
//}}}
/***
|Name|TaggedTemplateTweak|
|Source|http://www.TiddlyTools.com/#TaggedTemplateTweak|
|Documentation|http://www.TiddlyTools.com/#TaggedTemplateTweakInfo|
|Version|1.6.0|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides|Story.prototype.chooseTemplateForTiddler()|
|Description|use alternative ViewTemplate/EditTemplate for specific tiddlers|
This plugin extends the core function, story.chooseTemplateForTiddler(), so that any given tiddler can be viewed and/or edited using alternatives to the standard tiddler templates.
!!!!!Documentation
>see [[TaggedTemplateTweakInfo]]
!!!!!Revisions
<<<
2009.07.31 [1.6.0] added support for using custom field value as prefix
| please see [[TaggedTemplateTweakInfo]] for previous revision details |
2007.06.11 [1.0.0] initial release
<<<
!!!!!Code
***/
//{{{
version.extensions.TaggedTemplateTweak= {major: 1, minor: 6, revision: 0, date: new Date(2009,7,31)};
if (!config.options.txtTemplateTweakFieldname)
config.options.txtTemplateTweakFieldname='template';
Story.prototype.taggedTemplate_chooseTemplateForTiddler = Story.prototype.chooseTemplateForTiddler
Story.prototype.chooseTemplateForTiddler = function(title,template)
{
// get core template and split into theme and template name
var coreTemplate=this.taggedTemplate_chooseTemplateForTiddler.apply(this,arguments);
var theme=""; var template=coreTemplate;
var parts=template.split(config.textPrimitives.sectionSeparator);
if (parts[1]) { theme=parts[0]; template=parts[1]; }
else theme=config.options.txtTheme||""; // if theme is not specified
theme+=config.textPrimitives.sectionSeparator;
// look for template using title as prefix
if (!store.getTaggedTiddlers(title).length) { // if tiddler is not a tag
if (store.getTiddlerText(theme+title+template))
{ return theme+title+template; } // theme##TitleTemplate
if (store.getTiddlerText(title+template))
{ return title+template; } // TitleTemplate
}
// look for template using tags as prefix
var tiddler=store.getTiddler(title);
if (!tiddler) return coreTemplate; // tiddler doesn't exist... use core result
for (i=0; i<tiddler.tags.length; i++) {
var t=tiddler.tags[i]+template; // add tag prefix to template
var c=t.substr(0,1).toUpperCase()+t.substr(1); // capitalized for WikiWord title
if (store.getTiddlerText(theme+t)) { return theme+t; } // theme##tagTemplate
if (store.getTiddlerText(theme+c)) { return theme+c; } // theme##TagTemplate
if (store.getTiddlerText(t)) { return t; } // tagTemplate
if (store.getTiddlerText(c)) { return c; } // TagTemplate
}
// look for templates using custom field value as prefix
var v=store.getValue(title,config.options.txtTemplateTweakFieldname);
if (store.getTiddlerText(theme+v+template))
{ return theme+v+template; } // theme##valueTemplate
if (store.getTiddlerText(v+template))
{ return v+template; } // valueTemplate
// no match... use core result
return coreTemplate;
}
//}}}
/***
|Name:|TagglyTaggingPlugin|
|Description:|tagglyTagging macro is a replacement for the builtin tagging macro in your ViewTemplate|
|Version:|3.3.1 ($Rev: 6100 $)|
|Date:|$Date: 2008-07-27 01:42:07 +1000 (Sun, 27 Jul 2008) $|
|Source:|http://mptw.tiddlyspot.com/#TagglyTaggingPlugin|
|Author:|Simon Baird <simon.baird@gmail.com>|
|License:|http://mptw.tiddlyspot.com/#TheBSDLicense|
!Notes
See http://mptw.tiddlyspot.com/#TagglyTagging
***/
//{{{
merge(String.prototype,{
parseTagExpr: function(debug) {
if (this.trim() == "")
return "(true)";
var anyLogicOp = /(!|&&|\|\||\(|\))/g;
var singleLogicOp = /^(!|&&|\|\||\(|\))$/;
var spaced = this.
// because square brackets in templates are no good
// this means you can use [(With Spaces)] instead of [[With Spaces]]
replace(/\[\(/g," [[").
replace(/\)\]/g,"]] ").
// space things out so we can use readBracketedList. tricky eh?
replace(anyLogicOp," $1 ");
var expr = "";
var tokens = spaced.readBracketedList(false); // false means don't uniq the list. nice one JR!
for (var i=0;i<tokens.length;i++)
if (tokens[i].match(singleLogicOp))
expr += tokens[i];
else
expr += "tiddler.tags.contains('%0')".format([tokens[i].replace(/'/,"\\'")]); // fix single quote bug. still have round bracket bug i think
if (debug)
alert(expr);
return '('+expr+')';
}
});
merge(TiddlyWiki.prototype,{
getTiddlersByTagExpr: function(tagExpr,sortField) {
var result = [];
var expr = tagExpr.parseTagExpr();
store.forEachTiddler(function(title,tiddler) {
if (eval(expr))
result.push(tiddler);
});
if(!sortField)
sortField = "title";
result.sort(function(a,b) {return a[sortField] < b[sortField] ? -1 : (a[sortField] == b[sortField] ? 0 : +1);});
return result;
}
});
config.taggly = {
// for translations
lingo: {
labels: {
asc: "\u2191", // down arrow
desc: "\u2193", // up arrow
title: "title",
modified: "modified",
created: "created",
show: "+",
hide: "-",
normal: "normal",
group: "group",
commas: "commas",
sitemap: "sitemap",
numCols: "cols\u00b1", // plus minus sign
label: "Tagged as '%0':",
exprLabel: "Matching tag expression '%0':",
excerpts: "excerpts",
descr: "descr",
slices: "slices",
contents: "contents",
sliders: "sliders",
noexcerpts: "title only",
noneFound: "(none)"
},
tooltips: {
title: "Click to sort by title",
modified: "Click to sort by modified date",
created: "Click to sort by created date",
show: "Click to show tagging list",
hide: "Click to hide tagging list",
normal: "Click to show a normal ungrouped list",
group: "Click to show list grouped by tag",
sitemap: "Click to show a sitemap style list",
commas: "Click to show a comma separated list",
numCols: "Click to change number of columns",
excerpts: "Click to show excerpts",
descr: "Click to show the description slice",
slices: "Click to show all slices",
contents: "Click to show entire tiddler contents",
sliders: "Click to show tiddler contents in sliders",
noexcerpts: "Click to show entire title only"
},
tooDeepMessage: "* //sitemap too deep...//"
},
config: {
showTaggingCounts: true,
listOpts: {
// the first one will be the default
sortBy: ["title","modified","created"],
sortOrder: ["asc","desc"],
hideState: ["show","hide"],
listMode: ["normal","group","sitemap","commas"],
numCols: ["1","2","3","4","5","6"],
excerpts: ["noexcerpts","excerpts","descr","slices","contents","sliders"]
},
valuePrefix: "taggly.",
excludeTags: ["excludeLists","excludeTagging"],
excerptSize: 50,
excerptMarker: "/%"+"%/",
siteMapDepthLimit: 25
},
getTagglyOpt: function(title,opt) {
var val = store.getValue(title,this.config.valuePrefix+opt);
return val ? val : this.config.listOpts[opt][0];
},
setTagglyOpt: function(title,opt,value) {
if (!store.tiddlerExists(title))
// create it silently
store.saveTiddler(title,title,config.views.editor.defaultText.format([title]),config.options.txtUserName,new Date(),"");
// if value is default then remove it to save space
return store.setValue(title,
this.config.valuePrefix+opt,
value == this.config.listOpts[opt][0] ? null : value);
},
getNextValue: function(title,opt) {
var current = this.getTagglyOpt(title,opt);
var pos = this.config.listOpts[opt].indexOf(current);
// a little usability enhancement. actually it doesn't work right for grouped or sitemap
var limit = (opt == "numCols" ? store.getTiddlersByTagExpr(title).length : this.config.listOpts[opt].length);
var newPos = (pos + 1) % limit;
return this.config.listOpts[opt][newPos];
},
toggleTagglyOpt: function(title,opt) {
var newVal = this.getNextValue(title,opt);
this.setTagglyOpt(title,opt,newVal);
},
createListControl: function(place,title,type) {
var lingo = config.taggly.lingo;
var label;
var tooltip;
var onclick;
if ((type == "title" || type == "modified" || type == "created")) {
// "special" controls. a little tricky. derived from sortOrder and sortBy
label = lingo.labels[type];
tooltip = lingo.tooltips[type];
if (this.getTagglyOpt(title,"sortBy") == type) {
label += lingo.labels[this.getTagglyOpt(title,"sortOrder")];
onclick = function() {
config.taggly.toggleTagglyOpt(title,"sortOrder");
return false;
}
}
else {
onclick = function() {
config.taggly.setTagglyOpt(title,"sortBy",type);
config.taggly.setTagglyOpt(title,"sortOrder",config.taggly.config.listOpts.sortOrder[0]);
return false;
}
}
}
else {
// "regular" controls, nice and simple
label = lingo.labels[type == "numCols" ? type : this.getNextValue(title,type)];
tooltip = lingo.tooltips[type == "numCols" ? type : this.getNextValue(title,type)];
onclick = function() {
config.taggly.toggleTagglyOpt(title,type);
return false;
}
}
// hide button because commas don't have columns
if (!(this.getTagglyOpt(title,"listMode") == "commas" && type == "numCols"))
createTiddlyButton(place,label,tooltip,onclick,type == "hideState" ? "hidebutton" : "button");
},
makeColumns: function(orig,numCols) {
var listSize = orig.length;
var colSize = listSize/numCols;
var remainder = listSize % numCols;
var upperColsize = colSize;
var lowerColsize = colSize;
if (colSize != Math.floor(colSize)) {
// it's not an exact fit so..
upperColsize = Math.floor(colSize) + 1;
lowerColsize = Math.floor(colSize);
}
var output = [];
var c = 0;
for (var j=0;j<numCols;j++) {
var singleCol = [];
var thisSize = j < remainder ? upperColsize : lowerColsize;
for (var i=0;i<thisSize;i++)
singleCol.push(orig[c++]);
output.push(singleCol);
}
return output;
},
drawTable: function(place,columns,theClass) {
var newTable = createTiddlyElement(place,"table",null,theClass);
var newTbody = createTiddlyElement(newTable,"tbody");
var newTr = createTiddlyElement(newTbody,"tr");
for (var j=0;j<columns.length;j++) {
var colOutput = "";
for (var i=0;i<columns[j].length;i++)
colOutput += columns[j][i];
var newTd = createTiddlyElement(newTr,"td",null,"tagglyTagging"); // todo should not need this class
wikify(colOutput,newTd);
}
return newTable;
},
createTagglyList: function(place,title,isTagExpr) {
switch(this.getTagglyOpt(title,"listMode")) {
case "group": return this.createTagglyListGrouped(place,title,isTagExpr); break;
case "normal": return this.createTagglyListNormal(place,title,false,isTagExpr); break;
case "commas": return this.createTagglyListNormal(place,title,true,isTagExpr); break;
case "sitemap":return this.createTagglyListSiteMap(place,title,isTagExpr); break;
}
},
getTaggingCount: function(title,isTagExpr) {
// thanks to Doug Edmunds
if (this.config.showTaggingCounts) {
var tagCount = config.taggly.getTiddlers(title,'title',isTagExpr).length;
if (tagCount > 0)
return " ("+tagCount+")";
}
return "";
},
getTiddlers: function(titleOrExpr,sortBy,isTagExpr) {
return isTagExpr ? store.getTiddlersByTagExpr(titleOrExpr,sortBy) : store.getTaggedTiddlers(titleOrExpr,sortBy);
},
getExcerpt: function(inTiddlerTitle,title,indent) {
if (!indent)
indent = 1;
var displayMode = this.getTagglyOpt(inTiddlerTitle,"excerpts");
var t = store.getTiddler(title);
if (t && displayMode == "excerpts") {
var text = t.text.replace(/\n/," ");
var marker = text.indexOf(this.config.excerptMarker);
if (marker != -1) {
return " {{excerpt{<nowiki>" + text.substr(0,marker) + "</nowiki>}}}";
}
else if (text.length < this.config.excerptSize) {
return " {{excerpt{<nowiki>" + t.text + "</nowiki>}}}";
}
else {
return " {{excerpt{<nowiki>" + t.text.substr(0,this.config.excerptSize) + "..." + "</nowiki>}}}";
}
}
else if (t && displayMode == "contents") {
return "\n{{contents indent"+indent+"{\n" + t.text + "\n}}}";
}
else if (t && displayMode == "sliders") {
return "<slider slide>\n{{contents{\n" + t.text + "\n}}}\n</slider>";
}
else if (t && displayMode == "descr") {
var descr = store.getTiddlerSlice(title,'Description');
return descr ? " {{excerpt{" + descr + "}}}" : "";
}
else if (t && displayMode == "slices") {
var result = "";
var slices = store.calcAllSlices(title);
for (var s in slices)
result += "|%0|<nowiki>%1</nowiki>|\n".format([s,slices[s]]);
return result ? "\n{{excerpt excerptIndent{\n" + result + "}}}" : "";
}
return "";
},
notHidden: function(t,inTiddler) {
if (typeof t == "string")
t = store.getTiddler(t);
return (!t || !t.tags.containsAny(this.config.excludeTags) ||
(inTiddler && this.config.excludeTags.contains(inTiddler)));
},
// this is for normal and commas mode
createTagglyListNormal: function(place,title,useCommas,isTagExpr) {
var list = config.taggly.getTiddlers(title,this.getTagglyOpt(title,"sortBy"),isTagExpr);
if (this.getTagglyOpt(title,"sortOrder") == "desc")
list = list.reverse();
var output = [];
var first = true;
for (var i=0;i<list.length;i++) {
if (this.notHidden(list[i],title)) {
var countString = this.getTaggingCount(list[i].title);
var excerpt = this.getExcerpt(title,list[i].title);
if (useCommas)
output.push((first ? "" : ", ") + "[[" + list[i].title + "]]" + countString + excerpt);
else
output.push("*[[" + list[i].title + "]]" + countString + excerpt + "\n");
first = false;
}
}
return this.drawTable(place,
this.makeColumns(output,useCommas ? 1 : parseInt(this.getTagglyOpt(title,"numCols"))),
useCommas ? "commas" : "normal");
},
// this is for the "grouped" mode
createTagglyListGrouped: function(place,title,isTagExpr) {
var sortBy = this.getTagglyOpt(title,"sortBy");
var sortOrder = this.getTagglyOpt(title,"sortOrder");
var list = config.taggly.getTiddlers(title,sortBy,isTagExpr);
if (sortOrder == "desc")
list = list.reverse();
var leftOvers = []
for (var i=0;i<list.length;i++)
leftOvers.push(list[i].title);
var allTagsHolder = {};
for (var i=0;i<list.length;i++) {
for (var j=0;j<list[i].tags.length;j++) {
if (list[i].tags[j] != title) { // not this tiddler
if (this.notHidden(list[i].tags[j],title)) {
if (!allTagsHolder[list[i].tags[j]])
allTagsHolder[list[i].tags[j]] = "";
if (this.notHidden(list[i],title)) {
allTagsHolder[list[i].tags[j]] += "**[["+list[i].title+"]]"
+ this.getTaggingCount(list[i].title) + this.getExcerpt(title,list[i].title) + "\n";
leftOvers.setItem(list[i].title,-1); // remove from leftovers. at the end it will contain the leftovers
}
}
}
}
}
var allTags = [];
for (var t in allTagsHolder)
allTags.push(t);
var sortHelper = function(a,b) {
if (a == b) return 0;
if (a < b) return -1;
return 1;
};
allTags.sort(function(a,b) {
var tidA = store.getTiddler(a);
var tidB = store.getTiddler(b);
if (sortBy == "title") return sortHelper(a,b);
else if (!tidA && !tidB) return 0;
else if (!tidA) return -1;
else if (!tidB) return +1;
else return sortHelper(tidA[sortBy],tidB[sortBy]);
});
var leftOverOutput = "";
for (var i=0;i<leftOvers.length;i++)
if (this.notHidden(leftOvers[i],title))
leftOverOutput += "*[["+leftOvers[i]+"]]" + this.getTaggingCount(leftOvers[i]) + this.getExcerpt(title,leftOvers[i]) + "\n";
var output = [];
if (sortOrder == "desc")
allTags.reverse();
else if (leftOverOutput != "")
// leftovers first...
output.push(leftOverOutput);
for (var i=0;i<allTags.length;i++)
if (allTagsHolder[allTags[i]] != "")
output.push("*[["+allTags[i]+"]]" + this.getTaggingCount(allTags[i]) + this.getExcerpt(title,allTags[i]) + "\n" + allTagsHolder[allTags[i]]);
if (sortOrder == "desc" && leftOverOutput != "")
// leftovers last...
output.push(leftOverOutput);
return this.drawTable(place,
this.makeColumns(output,parseInt(this.getTagglyOpt(title,"numCols"))),
"grouped");
},
// used to build site map
treeTraverse: function(title,depth,sortBy,sortOrder,isTagExpr) {
var list = config.taggly.getTiddlers(title,sortBy,isTagExpr);
if (sortOrder == "desc")
list.reverse();
var indent = "";
for (var j=0;j<depth;j++)
indent += "*"
var childOutput = "";
if (depth > this.config.siteMapDepthLimit)
childOutput += indent + this.lingo.tooDeepMessage;
else
for (var i=0;i<list.length;i++)
if (list[i].title != title)
if (this.notHidden(list[i].title,this.config.inTiddler))
childOutput += this.treeTraverse(list[i].title,depth+1,sortBy,sortOrder,false);
if (depth == 0)
return childOutput;
else
return indent + "[["+title+"]]" + this.getTaggingCount(title) + this.getExcerpt(this.config.inTiddler,title,depth) + "\n" + childOutput;
},
// this if for the site map mode
createTagglyListSiteMap: function(place,title,isTagExpr) {
this.config.inTiddler = title; // nasty. should pass it in to traverse probably
var output = this.treeTraverse(title,0,this.getTagglyOpt(title,"sortBy"),this.getTagglyOpt(title,"sortOrder"),isTagExpr);
return this.drawTable(place,
this.makeColumns(output.split(/(?=^\*\[)/m),parseInt(this.getTagglyOpt(title,"numCols"))), // regexp magic
"sitemap"
);
},
macros: {
tagglyTagging: {
handler: function (place,macroName,params,wikifier,paramString,tiddler) {
var parsedParams = paramString.parseParams("tag",null,true);
var refreshContainer = createTiddlyElement(place,"div");
// do some refresh magic to make it keep the list fresh - thanks Saq
refreshContainer.setAttribute("refresh","macro");
refreshContainer.setAttribute("macroName",macroName);
var tag = getParam(parsedParams,"tag");
var expr = getParam(parsedParams,"expr");
if (expr) {
refreshContainer.setAttribute("isTagExpr","true");
refreshContainer.setAttribute("title",expr);
refreshContainer.setAttribute("showEmpty","true");
}
else {
refreshContainer.setAttribute("isTagExpr","false");
if (tag) {
refreshContainer.setAttribute("title",tag);
refreshContainer.setAttribute("showEmpty","true");
}
else {
refreshContainer.setAttribute("title",tiddler.title);
refreshContainer.setAttribute("showEmpty","false");
}
}
this.refresh(refreshContainer);
},
refresh: function(place) {
var title = place.getAttribute("title");
var isTagExpr = place.getAttribute("isTagExpr") == "true";
var showEmpty = place.getAttribute("showEmpty") == "true";
removeChildren(place);
addClass(place,"tagglyTagging");
var countFound = config.taggly.getTiddlers(title,'title',isTagExpr).length
if (countFound > 0 || showEmpty) {
var lingo = config.taggly.lingo;
config.taggly.createListControl(place,title,"hideState");
if (config.taggly.getTagglyOpt(title,"hideState") == "show") {
createTiddlyElement(place,"span",null,"tagglyLabel",
isTagExpr ? lingo.labels.exprLabel.format([title]) : lingo.labels.label.format([title]));
config.taggly.createListControl(place,title,"title");
config.taggly.createListControl(place,title,"modified");
config.taggly.createListControl(place,title,"created");
config.taggly.createListControl(place,title,"listMode");
config.taggly.createListControl(place,title,"excerpts");
config.taggly.createListControl(place,title,"numCols");
config.taggly.createTagglyList(place,title,isTagExpr);
if (countFound == 0 && showEmpty)
createTiddlyElement(place,"div",null,"tagglyNoneFound",lingo.labels.noneFound);
}
}
}
}
},
// todo fix these up a bit
styles: [
"/*{{{*/",
"/* created by TagglyTaggingPlugin */",
".tagglyTagging { padding-top:0.5em; }",
".tagglyTagging li.listTitle { display:none; }",
".tagglyTagging ul {",
" margin-top:0px; padding-top:0.5em; padding-left:2em;",
" margin-bottom:0px; padding-bottom:0px;",
"}",
".tagglyTagging { vertical-align: top; margin:0px; padding:0px; }",
".tagglyTagging table { margin:0px; padding:0px; }",
".tagglyTagging .button { visibility:hidden; margin-left:3px; margin-right:3px; }",
".tagglyTagging .button, .tagglyTagging .hidebutton {",
" color:[[ColorPalette::TertiaryLight]]; font-size:90%;",
" border:0px; padding-left:0.3em;padding-right:0.3em;",
"}",
".tagglyTagging .button:hover, .hidebutton:hover, ",
".tagglyTagging .button:active, .hidebutton:active {",
" border:0px; background:[[ColorPalette::TertiaryPale]]; color:[[ColorPalette::TertiaryDark]];",
"}",
".selected .tagglyTagging .button { visibility:visible; }",
".tagglyTagging .hidebutton { color:[[ColorPalette::Background]]; }",
".selected .tagglyTagging .hidebutton { color:[[ColorPalette::TertiaryLight]] }",
".tagglyLabel { color:[[ColorPalette::TertiaryMid]]; font-size:90%; }",
".tagglyTagging ul {padding-top:0px; padding-bottom:0.5em; margin-left:1em; }",
".tagglyTagging ul ul {list-style-type:disc; margin-left:-1em;}",
".tagglyTagging ul ul li {margin-left:0.5em; }",
".editLabel { font-size:90%; padding-top:0.5em; }",
".tagglyTagging .commas { padding-left:1.8em; }",
"/* not technically tagglytagging but will put them here anyway */",
".tagglyTagged li.listTitle { display:none; }",
".tagglyTagged li { display: inline; font-size:90%; }",
".tagglyTagged ul { margin:0px; padding:0px; }",
".excerpt { color:[[ColorPalette::TertiaryDark]]; }",
".excerptIndent { margin-left:4em; }",
"div.tagglyTagging table,",
"div.tagglyTagging table tr,",
"td.tagglyTagging",
" {border-style:none!important; }",
".tagglyTagging .contents { border-bottom:2px solid [[ColorPalette::TertiaryPale]]; padding:0 1em 1em 0.5em;",
" margin-bottom:0.5em; }",
".tagglyTagging .indent1 { margin-left:3em; }",
".tagglyTagging .indent2 { margin-left:4em; }",
".tagglyTagging .indent3 { margin-left:5em; }",
".tagglyTagging .indent4 { margin-left:6em; }",
".tagglyTagging .indent5 { margin-left:7em; }",
".tagglyTagging .indent6 { margin-left:8em; }",
".tagglyTagging .indent7 { margin-left:9em; }",
".tagglyTagging .indent8 { margin-left:10em; }",
".tagglyTagging .indent9 { margin-left:11em; }",
".tagglyTagging .indent10 { margin-left:12em; }",
".tagglyNoneFound { margin-left:2em; color:[[ColorPalette::TertiaryMid]]; font-size:90%; font-style:italic; }",
"/*}}}*/",
""].join("\n"),
init: function() {
merge(config.macros,this.macros);
config.shadowTiddlers["TagglyTaggingStyles"] = this.styles;
store.addNotification("TagglyTaggingStyles",refreshStyles);
}
};
config.taggly.init();
//}}}
/***
InlineSlidersPlugin
By Saq Imtiaz
http://tw.lewcid.org/sandbox/#InlineSlidersPlugin
// syntax adjusted to not clash with NestedSlidersPlugin
// added + syntax to start open instead of closed
***/
//{{{
config.formatters.unshift( {
name: "inlinesliders",
// match: "\\+\\+\\+\\+|\\<slider",
match: "\\<slider",
// lookaheadRegExp: /(?:\+\+\+\+|<slider) (.*?)(?:>?)\n((?:.|\n)*?)\n(?:====|<\/slider>)/mg,
lookaheadRegExp: /(?:<slider)(\+?) (.*?)(?:>)\n((?:.|\n)*?)\n(?:<\/slider>)/mg,
handler: function(w) {
this.lookaheadRegExp.lastIndex = w.matchStart;
var lookaheadMatch = this.lookaheadRegExp.exec(w.source)
if(lookaheadMatch && lookaheadMatch.index == w.matchStart ) {
var btn = createTiddlyButton(w.output,lookaheadMatch[2] + " "+"\u00BB",lookaheadMatch[2],this.onClickSlider,"button sliderButton");
var panel = createTiddlyElement(w.output,"div",null,"sliderPanel");
panel.style.display = (lookaheadMatch[1] == '+' ? "block" : "none");
wikify(lookaheadMatch[3],panel);
w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;
}
},
onClickSlider : function(e) {
if(!e) var e = window.event;
var n = this.nextSibling;
n.style.display = (n.style.display=="none") ? "block" : "none";
return false;
}
});
//}}}
/***
|Name|TextAreaPlugin|
|Source|http://www.TiddlyTools.com/#TextAreaPlugin|
|Documentation|http://www.TiddlyTools.com/#TextAreaPluginInfo|
|Version|2.2.1|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides|Story.prototype.focusTiddler|
|Options|##Configuration|
|Description|Adds Find/Again keyboard search, autosize, and 'stretch bar' resize for textarea controls|
!!!!!Documentation
>see [[TextAreaPluginInfo]]
!!!!!Configuration
<<<
<<option chkTextAreaExtensions>> use control-f (find), control-g (find again) inside text area
<<option chkDisableAutoSelect>> place cursor at start of textarea instead of pre-selecting content
<<option chkResizeEditor>> modify shadow EditTemplate to add resizeable text area (and autosize command)
<<<
!!!!!Revisions
<<<
2009.04.08 [2.2.1] added autosizeEditor macro to enable automatic autosizing without using toolbar command
2009.04.06 [2.2.0] added resizeListbox macro definition and adjusted dragbar width calculation.
|please see [[TextAreaPluginInfo]] for additional revision details|
2006.01.22 [1.0.0] Moved from temporary "System Tweaks" tiddler into 'real' TextAreaPlugin tiddler.
<<<
!!!!!Code
***/
//{{{
version.extensions.TextAreaPlugin= {major: 2, minor: 2, revision: 1, date: new Date(2009,4,8)};
if (config.options.chkTextAreaExtensions===undefined) config.options.chkTextAreaExtensions=true;
if (config.options.chkDisableAutoSelect===undefined) config.options.chkDisableAutoSelect=true;
if (config.options.chkResizeEditor===undefined) config.options.chkResizeEditor=true;
// automatically tweak shadow EditTemplate to add "autosizeEditor" toolbar command
if (config.options.chkResizeEditor)
config.shadowTiddlers.EditTemplate=config.shadowTiddlers.EditTemplate.replace(/deleteTiddler/,"deleteTiddler autosizeEditor");
// automatically tweak shadow EditTemplate to add "resizeEditor" macro
if (config.options.chkResizeEditor)
config.shadowTiddlers.EditTemplate+="<span macro='resizeEditor'></span>";
// Put focus in a specified tiddler field
Story.prototype.TextAreaExtensions_focusTiddler=Story.prototype.focusTiddler;
Story.prototype.focusTiddler = function(title,field)
{
this.TextAreaExtensions_focusTiddler.apply(this,arguments); // first call core
var e = this.getTiddlerField(title,field);
if (e && config.options.chkDisableAutoSelect) {
if (e.setSelectionRange) // FF
e.setSelectionRange(0,0);
else if (e.createTextRange) // IE
{ var r=e.createTextRange(); r.collapse(true); r.select(); }
}
if (e && config.options.chkTextAreaExtensions) addKeyDownHandlers(e);
}
//}}}
//{{{
function addKeyDownHandlers(e)
{
// exit if not textarea or element doesn't allow selections
if (e.tagName.toLowerCase()!="textarea"||!e.setSelectionRange||e.initialized) return;
// utility function: exits keydown handler and prevents browser from processing the keystroke
var processed=function(ev) {
ev.cancelBubble=true; // IE4+
try{event.keyCode=0;}catch(e){}; // IE5
if (window.event) ev.returnValue=false; // IE6
if (ev.preventDefault) ev.preventDefault(); // moz/opera/konqueror
if (ev.stopPropagation) ev.stopPropagation(); // all
return false;
}
// capture keydown in edit field
e.saved_onkeydown=e.onkeydown; // save current keydown handler (if any)
e.onkeydown=function(ev) { if (!ev) var ev=window.event;
var key=ev.keyCode;
if (!key) {
var char=event.which?event.which:event.charCode;
if (char==102) key=70;
if (char==103) key=71;
}
// process CTRL-F (find matching text) or CTRL-G (find next match)
if (ev.ctrlKey && (key==70||key==71)) {
// prompt for text to find
var defFind=e.findText?e.findText:e.value.substring(e.selectionStart,e.selectionEnd);
if (key==70||!e.findText||!e.findText.length) // ctrl-f or no saved search text
{ var f=prompt("find:", defFind); e.focus(); if (f) e.findText=f; }
if (!e.findText||!e.findText.length) return processed(ev); // if no search text, exit
// do case-insensitive match with 'wraparound'... if not found, alert and exit
var newstart=e.value.toLowerCase().indexOf(e.findText.toLowerCase(),e.selectionStart+1);
if (newstart==-1) newstart=e.value.toLowerCase().indexOf(e.findText.toLowerCase());
if (newstart==-1) { alert("'"+e.findText+"' not found"); e.focus(); return processed(ev); }
// set new selection, scroll it into view, and report line position in status bar
e.setSelectionRange(newstart,newstart+e.findText.length);
var linecount=e.value.split('\n').length;
var thisline=e.value.substr(0,e.selectionStart).split('\n').length;
e.scrollTop=Math.floor((thisline-1-e.rows/2)*e.scrollHeight/linecount);
window.status="line: "+thisline+"/"+linecount;
return processed(ev);
}
if (e.saved_onkeydown) // call previous keydown handler (if any)
e.saved_onkeydown(ev);
}
e.initialized=true;
}
//}}}
// // 'autosize' toolbar command
//{{{
config.commands.autosizeEditor = {
text: 'autosize',
tooltip: 'automatically adjust the editor height to fit the contents',
text_alt: '\u221Aautosize',
hideReadOnly: false,
handler: function(event,src,title) {
var here=story.findContainingTiddler(src); if (!here) return;
var ta=here.getElementsByTagName('textarea'); if (!ta) return;
for (i=0;i<ta.length;i++) {
// only autosize textareas actually used to edit tiddler fields
if (ta[i].getAttribute("edit")==undefined) continue;
ta[i].button=src;
if (!ta[i].maxed)
config.commands.autosizeEditor.on(ta[i]);
else
config.commands.autosizeEditor.off(ta[i],true);
}
return false;
},
on: function(e) {
if (e.maxed) return; // already autosizing!
if (e.savedheight==undefined)
e.savedheight=e.style.height;
if (e.savedkeyup==undefined) {
e.savedkeyup=e.onkeyup;
e.onkeyup=function(ev) {
if (!ev) var ev=window.event; var e=resolveTarget(ev);
e.style.height=e.scrollHeight+'px';
if (e.savedkeyup) e.savedkeyup();
}
}
// IE reports error: "not implemented" for onkeypress
if (!config.browser.isIE && e.savedkeypress==undefined) {
e.savedkeypress=e.onkeypress;
e.onkeypress=function(ev) {
if (!ev) var ev=window.event; var e=resolveTarget(ev);
if (ev.keyCode==33) { // PGUP
if (window.scrollByPages) window.scrollByPages(-1);
return false;
}
if (ev.keyCode==34) { // PGDN
if (window.scrollByPages) window.scrollByPages(1);
return false;
}
if (e.savedkeypress) e.savedkeypress();
}
}
e.style.height=e.scrollHeight+'px';
if (e.button) e.button.innerHTML=config.commands.autosizeEditor.text_alt;
e.maxed=true;
},
off: function(e,resetHeight) {
if (resetHeight) e.style.height=e.savedheight;
e.onkeyup=e.savedkeyup;
// IE reports error: "not implemented" for onkeypress
if (!config.browser.isIE) e.onkeypress=e.savedkeypress;
if (e.button) e.button.innerHTML=config.commands.autosizeEditor.text;
e.maxed=false;
}
};
config.macros.autosizeEditor={
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
var here=story.findContainingTiddler(place); if (!here) return;
var ta=here.getElementsByTagName('textarea'); if (!ta) return;
for (i=0;i<ta.length;i++) {
// only autosize textareas actually used to edit tiddler fields
if (ta[i].getAttribute("edit")==undefined) continue;
config.commands.autosizeEditor.on(ta[i]);
}
return false;
}
}
//}}}
// // grab-and-stretch handle
//{{{
config.macros.resizeEditor = { // add stretch bar to editor textarea
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
var here=story.findContainingTiddler(place); if (!here) return;
var ta=here.getElementsByTagName('textarea');
if (ta) for (i=0;i<ta.length;i++) {
// only resize tiddler editor textareas
if (ta[i].getAttribute("edit")==undefined) continue;
new window.TextAreaResizer(ta[i]);
}
}
}
config.macros.resizeTiddler = { // add stretch bar to tiddler viewer element
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
var here=story.findContainingTiddler(place); if (!here) return;
var elems=here.getElementsByTagName('div');
if (elems) for (i=0;i<elems.length;i++) if (hasClass(elems[i],'viewer')) break;
if (i<elems.length) new window.TextAreaResizer(elems[i]);
}
}
config.macros.resizeFrame = { // add stretch bar to iframes
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
var here=story.findContainingTiddler(place); if (!here) return;
var fr=here.getElementsByTagName('iframe');
if (fr) for (i=0;i<fr.length;i++) new window.TextAreaResizer(fr[i]);
}
}
config.macros.resizeListbox = { // add stretch bar to listbox controls
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
var here=story.findContainingTiddler(place); if (!here) here=place;
var fr=here.getElementsByTagName('select');
if (fr) for (i=0;i<fr.length;i++) new window.TextAreaResizer(fr[i]);
}
}
// TextAreaResizer script by Jason Johnston (jj@lojjic.net)
// Created August 2003. Use freely, but give me credit.
// adds a handle below textareas that the user can drag with the mouse to resize the textarea.
// MODIFIED by ELS for cross-browser (IE) compatibility, including:
window.TextAreaResizer = function(elt) {
this.element = elt;
this.create();
}
window.TextAreaResizer.prototype = {
create : function() {
var elt = this.element;
var thisRef = this;
var h = this.handle = document.createElement("div");
h.style.height = "2px"; // was 4px... looked too fat!
h.style.overflow = "hidden"; // ELS: force IE to trim height to < 1em
var adjust=elt.nodeName=='textarea'?4:0; // 4 pixels for textarea border edge
// h.style.width=(elt.offsetWidth-adjust)+"px";
h.style.width="auto";
h.style.backgroundColor = "#999"; // ELS: standard mid-tone (dark) gray
h.style.cursor = "s-resize";
h.title = "Drag to resize text box";
h.onmousedown=function(evt){thisRef.dragStart(evt)};
elt.parentNode.insertBefore(h, elt.nextSibling);
},
dragStart : function(evt) {
if (!evt) var evt=window.event;
this.dragStop(evt); // ELS: stop any current drag processing first
var thisRef = this;
this.dragStartY = evt.clientY;
this.dragStartH = this.element.offsetHeight;
document.savedmousemove=document.onmousemove;
document.onmousemove=this.dragMoveHdlr=function(evt){thisRef.dragMove(evt)};
document.savedmouseup=document.onmouseup;
document.onmouseup=this.dragStopHdlr=function(evt){thisRef.dragStop(evt)};
},
dragMove : function(evt) {
if (!evt) var evt=window.event;
// ELS: make sure height is at least 10px
var h=this.dragStartH+evt.clientY-this.dragStartY;
if (h<10) h=10; this.element.style.height=h+"px";
// ELS: match handle to textarea width (which may have changed due to document scrollbars)
// var adjust=this.element.nodeName.toLowerCase()=='textarea'?4:0; // 4 pixels for textarea
// this.handle.style.width=(this.element.offsetWidth-adjust)+"px";
// ELS: when manually resizing, disable autoresizing (without restoring saved height)
if (this.element.maxed!=undefined && this.element.maxed)
config.commands.autosizeEditor.off(this.element,false);
},
dragStop : function(evt) {
if (!evt) var evt=window.event;
document.onmousemove=(document.savedmousemove!=undefined)?document.savedmousemove:null;
document.onmousemove=(document.savedmouseup!=undefined)?document.savedmouseup:null;
},
destroy : function() {
var elt = this.element;
elt.parentNode.removeChild(this.handle);
elt.style.height = "";
}
};
//}}}
MS Dynamics CRM
# .csv format
# Delimiter = comma
# Text delimiter = {{{^}}}
# replace all {{{^^}}} with {{{^ ^}}}
# replace all {{{"}}} with {{{""}}}
# replace all {{{^}}} with {{{"}}}
Now ready for import
|MS Office |{{{%APPDATA%\Microsoft\Proof}}} |CUSTOM.DIC |
|Firefox |{{{%APPDATA%\Mozilla\Firefox\Profiles}}} |persdict.dat |
Make your own persdict.dat if it doesn't exist. Put it in the trashy-named default directory in "Profiles".
@@display:block;height:18em;overflow:auto;
{{{
AdMint
Angeles
BOM
Barack
BusinessIntel
CNC
CRM
Caulkins
CodeIgniter
Colley
CostAccounting
CostingStandard
DesignCycle
Disc.+Comm'n
Drucker
ETO
Eckhardt
Elbel
Fannin
ForLabor
Fountain
GAAP
Gitmo
Goldratt
Goynes
Grimaldi
HOMER's
Hachmeister
Helmsley
Hendrick
HomeFinancialAnalysis
Inc
Isaiah's
Israelites
Kenna
Krauskopf
Kveton
Liberum
Liska
Lockhart
Los
MITI
MRP
Maniscalo
Masterson
Mastersons
Maturin
McGinnis
MySQL
NIV
NPD
NetBeans
Nold
Obama
Olvera
PDM
PN
PN's
People
Petroff
Polack
Pontius
PreEnigma
ProfitFab
ProjType
Questica
R�sum�
RDC
Ritch
Routings
Scheffer
Screwtape
Selleck
Semmler
SharePoint
Sherrod
SimpleTest
Sparts
Stephen's
SupportingDocuments
TFP
TFPs
Teows
Terstriep
TiddlyWiki
TimePlanning
ToDo
Turrentine
Ubuntu
UnitOfMeasurement
VBA
WAMP
Westphall
WorkCenter
WorkPlan
Zire
Teows
bosun's
cognitions
costed
ctrl
darkgreen
djoseph
eldership
img
inslab
jpg
leapt
liger
liger's
orlop
phpDesigner
premillennial
r�sum�
routings
sabstinence
searchable
sprayground
stressors
synesthesia
trifecta
wiki
phpDesigner
}}}
/***
|Name|TiddlerTweakerPlugin|
|Source|http://www.TiddlyTools.com/#TiddlerTweakerPlugin|
|Version|2.4.2|
|Author|Eric Shulman|
|License|http://www.TiddlyTools.com/#LegalStatements|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Description|select multiple tiddlers and modify author, created, modified and/or tag values|
~TiddlerTweaker is a tool for TiddlyWiki authors. It allows you to select multiple tiddlers from a listbox, either by direct interaction or automatically matching specific criteria. You can then modify the creator, author, created, modified and/or tag values of those tiddlers using a compact set of form fields. The values you enter into the fields simultantously overwrite the existing values in all tiddlers you have selected.
!!!!!Usage
<<<
{{{<<tiddlerTweaker>>}}}
{{smallform{<<tiddlerTweaker>>}}}
By default, any tags you enter into the TiddlerTweaker will //replace// the existing tags in all the tiddlers you have selected. However, you can also use TiddlerTweaker to quickly filter specified tags from the selected tiddlers, while leaving any other tags assigned to those tiddlers unchanged:
>Any tag preceded by a "+" (plus) or "-" (minus), will be added or removed from the existing tags //instead of replacing the entire tag definition// of each tiddler (e.g., enter "-excludeLists" to remove that tag from all selected tiddlers. When using this syntax, care should be taken to ensure that //every// tag is preceded by "+" or "-", to avoid inadvertently overwriting any other existing tags on the selected tiddlers. (note: the "+" or "-" prefix on each tag value is NOT part of the tag value, and is only used by TiddlerTweaker to control how that tag value is processed)
Important Notes:
* Inasmuch as TiddlerTweaker is a 'power user' tool that can perform 'batch' functions (operating on many tiddlers at once), you should always have a recent backup of your document (or "save changes" just *before* tweaking the tiddlers), just in case you "shoot yourself in the foot".
* The date and author information on any tiddlers you tweak will ONLY be updated if the corresponding TiddlyTweaker checkboxes have been selected. As a general rule, after using TiddlerTweaker, always ''//remember to save your document//'' when you are done, even though the tiddler timeline tab may not show any recently modified tiddlers.
* Selecting and updating all tiddlers in a document can take a while. Your browser may warn about an "unresponsive script". Usually, if you allow it to continue, it should complete the processing... eventually. Nonetheless, be sure to save your work before you begin tweaking lots of tiddlers, just in case something does get 'stuck'.
<<<
!!!!!Revisions
<<<
2009.06.26 [2.4.2] only add brackets around tags containing spaces
2009.06.22 [2.4.1] in setFields(), add brackets around all tags shown tweaker edit field
2009.03.30 [2.4.0] added 'sort by modifier'
2009.01.22 [2.3.0] added support for text pattern find/replace
2008.10.27 [2.2.3] in setTiddlers(), fixed Safari bug by replacing static Array.concat(...) with new Array().concat(...)
2008.09.07 [2.2.2] added removeCookie() function for compatibility with [[CookieManagerPlugin]]
2008.05.12 [2.2.1] replace built-in backstage "tweak" task with tiddler tweaker control panel (moved from BackstageTweaks)
2008.01.13 [2.2.0] added "auto-selection" links: all, changed, tags, title, text
2007.12.26 [2.1.0] added support for managing 'creator' custom field (see [[CoreTweaks]])
2007.11.01 [2.0.3] added config.options.txtTweakerSortBy for cookie-based persistence of list display order preference setting.
2007.09.28 [2.0.2] in settiddlers() and deltiddlers(), added suspend/resume notification handling (improves performance when operating on multiple tiddlers)
2007.08.03 [2.0.1] added shadow definition for [[TiddlerTweaker]] tiddler for use as parameter references with {{{<<tiddler>>, <<slider>> or <<tabs>>}}} macros.
2007.08.03 [2.0.0] converted from inline script
2006.01.01 [1.0.0] initial release
<<<
!!!!!Code
***/
//{{{
version.extensions.TiddlerTweakerPlugin= {major: 2, minor: 4, revision: 1, date: new Date(2009,6,22)};
// shadow tiddler
config.shadowTiddlers.TiddlerTweaker="<<tiddlerTweaker>>";
/// backstage task
if (config.tasks) { // for TW2.2b3 or above
config.tasks.tweak.tooltip="review/modify tiddler internals: dates, authors, tags, etc.";
config.tasks.tweak.content="{{smallform small groupbox{<<tiddlerTweaker>>}}}";
}
if (config.options.txtTweakerSortBy==undefined) config.options.txtTweakerSortBy="modified";
// if removeCookie() function is not defined by TW core, define it here.
if (window.removeCookie===undefined) {
window.removeCookie=function(name) {
document.cookie = name+'=; expires=Thu, 01-Jan-1970 00:00:01 UTC; path=/;';
}
}
config.macros.tiddlerTweaker = {
html: '<form style="display:inline"><!--\
--><table style="padding:0;margin:0;border:0;width:100%"><tr valign="top" style="padding:0;margin:0;border:0"><!--\
--><td style="text-align:center;white-space:nowrap;width:99%;padding:0;margin:0;border:0"><!--\
--><font size=-2><div style="text-align:left;"><span style="float:right"><!--\
--> <a href="javascript:;" \
title="select all tiddlers"\
onclick="\
var f=this; while (f&&f.nodeName.toLowerCase()!=\'form\')f=f.parentNode;\
for (var t=0; t<f.list.options.length; t++)\
if (f.list.options[t].value.length) f.list.options[t].selected=true;\
config.macros.tiddlerTweaker.selecttiddlers(f.list);\
return false">all</a><!--\
--> <a href="javascript:;" \
title="select tiddlers that are new/changed since the last file save"\
onclick="\
var lastmod=new Date(document.lastModified);\
var f=this; while (f&&f.nodeName.toLowerCase()!=\'form\')f=f.parentNode;\
for (var t=0; t<f.list.options.length; t++) {\
var tid=store.getTiddler(f.list.options[t].value);\
f.list.options[t].selected=tid&&tid.modified>lastmod;\
}\
config.macros.tiddlerTweaker.selecttiddlers(f.list);\
return false">changed</a><!--\
--> <a href="javascript:;" \
title="select tiddlers with at least one matching tag"\
onclick="\
var t=prompt(\'Enter space-separated tags (match ONE)\');\
if (!t||!t.length) return false;\
var tags=t.readBracketedList();\
var f=this; while (f&&f.nodeName.toLowerCase()!=\'form\')f=f.parentNode;\
for (var t=0; t<f.list.options.length; t++) {\
f.list.options[t].selected=false;\
var tid=store.getTiddler(f.list.options[t].value);\
if (tid&&tid.tags.containsAny(tags)) f.list.options[t].selected=true;\
}\
config.macros.tiddlerTweaker.selecttiddlers(f.list);\
return false">tags</a><!--\
--> <a href="javascript:;" \
title="select tiddlers whose titles include matching text"\
onclick="\
var txt=prompt(\'Enter a title (or portion of a title) to match\');\
if (!txt||!txt.length) return false;\
var f=this; while (f&&f.nodeName.toLowerCase()!=\'form\')f=f.parentNode;\
for (var t=0; t<f.list.options.length; t++) {\
f.list.options[t].selected=f.list.options[t].value.indexOf(txt)!=-1;\
}\
config.macros.tiddlerTweaker.selecttiddlers(f.list);\
return false">titles</a><!--\
--> <a href="javascript:;" \
title="select tiddlers containing matching text"\
onclick="\
var txt=prompt(\'Enter tiddler text (content) to match\');\
if (!txt||!txt.length) return false;\
var f=this; while (f&&f.nodeName.toLowerCase()!=\'form\')f=f.parentNode;\
for (var t=0; t<f.list.options.length; t++) {\
var tt=store.getTiddlerText(f.list.options[t].value,\'\');\
f.list.options[t].selected=(tt.indexOf(txt)!=-1);\
}\
config.macros.tiddlerTweaker.selecttiddlers(f.list);\
return false">text</a> <!--\
--></span><span>select tiddlers</span><!--\
--></div><!--\
--></font><select multiple name=list size="11" style="width:99.99%" \
title="use click, shift-click and/or ctrl-click to select multiple tiddler titles" \
onclick="config.macros.tiddlerTweaker.selecttiddlers(this)" \
onchange="config.macros.tiddlerTweaker.setfields(this)"><!--\
--></select><br><!--\
-->show<input type=text size=1 value="11" \
onchange="this.form.list.size=this.value; this.form.list.multiple=(this.value>1);"><!--\
-->by<!--\
--><select name=sortby size=1 \
onchange="config.macros.tiddlerTweaker.init(this.form,this.value)"><!--\
--><option value="title">title</option><!--\
--><option value="size">size</option><!--\
--><option value="modified">modified</option><!--\
--><option value="created">created</option><!--\
--><option value="modifier">modifier</option><!--\
--></select><!--\
--><input type="button" value="refresh" \
onclick="config.macros.tiddlerTweaker.init(this.form,this.form.sortby.value)"<!--\
--> <input type="button" name="stats" disabled value="totals..." \
onclick="config.macros.tiddlerTweaker.stats(this)"><!--\
--></td><td style="white-space:nowrap;padding:0;margin:0;border:0;width:1%"><!--\
--><div style="text-align:left"><font size=-2> modify values</font></div><!--\
--><table border=0 style="width:100%;padding:0;margin:0;border:0;"><tr style="padding:0;border:0;"><!--\
--><td style="padding:1px;border:0;white-space:nowrap"><!--\
--><input type=checkbox name=settitle unchecked \
title="allow changes to tiddler title (rename tiddler)" \
onclick="this.form.title.disabled=!this.checked">title<!--\
--></td><td style="padding:1px;border:0;white-space:nowrap"><!--\
--><input type=text name=title size=35 style="width:98%" disabled><!--\
--></td></tr><tr style="padding:0;border:0;"><td style="padding:1px;border:0;white-space:nowrap"><!--\
--><input type=checkbox name=setcreator unchecked \
title="allow changes to tiddler creator" \
onclick="this.form.creator.disabled=!this.checked">created by<!--\
--></td><td style="padding:1px;border:0;white-space:nowrap"><!--\
--><input type=text name=creator size=35 style="width:98%" disabled><!--\
--></td></tr><tr style="padding:0;border:0;"><td style="padding:1px;border:0;white-space:nowrap"><!--\
--><input type=checkbox name=setwho unchecked \
title="allow changes to tiddler author" \
onclick="this.form.who.disabled=!this.checked">modified by<!--\
--></td><td style="padding:1px;border:0;white-space:nowrap"><!--\
--><input type=text name=who size=35 style="width:98%" disabled><!--\
--></td></tr><tr style="padding:0;border:0;"><td style="padding:1px;border:0;white-space:nowrap"><!--\
--><input type=checkbox name=setcdate unchecked \
title="allow changes to created date" \
onclick="var f=this.form; f.cm.disabled=f.cd.disabled=f.cy.disabled=f.ch.disabled=f.cn.disabled=!this.checked"><!--\
-->created on<!--\
--></td><td style="padding:1px;border:0;white-space:nowrap"><!--\
--><input type=text name=cm size=2 style="width:2em;padding:0;text-align:center" disabled><!--\
--> / <input type=text name=cd size=2 style="width:2em;padding:0;text-align:center" disabled><!--\
--> / <input type=text name=cy size=4 style="width:3em;padding:0;text-align:center" disabled><!--\
--> at <input type=text name=ch size=2 style="width:2em;padding:0;text-align:center" disabled><!--\
--> : <input type=text name=cn size=2 style="width:2em;padding:0;text-align:center" disabled><!--\
--></td></tr><tr style="padding:0;border:0;"><td style="padding:1px;border:0;white-space:nowrap"><!--\
--><input type=checkbox name=setmdate unchecked \
title="allow changes to modified date" \
onclick="var f=this.form; f.mm.disabled=f.md.disabled=f.my.disabled=f.mh.disabled=f.mn.disabled=!this.checked"><!--\
-->modified on<!--\
--></td><td style="padding:1px;border:0;white-space:nowrap"><!--\
--><input type=text name=mm size=2 style="width:2em;padding:0;text-align:center" disabled><!--\
--> / <input type=text name=md size=2 style="width:2em;padding:0;text-align:center" disabled><!--\
--> / <input type=text name=my size=4 style="width:3em;padding:0;text-align:center" disabled><!--\
--> at <input type=text name=mh size=2 style="width:2em;padding:0;text-align:center" disabled><!--\
--> : <input type=text name=mn size=2 style="width:2em;padding:0;text-align:center" disabled><!--\
--></td></tr><tr style="padding:0;border:0;"><td style="padding:1px;border:0;white-space:nowrap"><!--\
--><input type=checkbox name=replacetext unchecked\
title="find/replace matching text" \
onclick="this.form.pattern.disabled=this.form.replacement.disabled=!this.checked">replace text<!--\
--></td><td style="padding:1px;border:0;white-space:nowrap"><!--\
--><input type=text name=pattern size=15 value="" style="width:40%" disabled \
title="enter TEXT PATTERN (regular expression)"> with <!--\
--><input type=text name=replacement size=15 value="" style="width:40%" disabled \
title="enter REPLACEMENT TEXT"><!--\
--></td></tr><tr style="padding:0;border:0;"><td style="padding:1px;border:0;white-space:nowrap"><!--\
--><input type=checkbox name=settags checked \
title="allow changes to tiddler tags" \
onclick="this.form.tags.disabled=!this.checked">tags<!--\
--></td><td style="padding:1px;border:0;white-space:nowrap"><!--\
--><input type=text name=tags size=35 value="" style="width:98%" \
title="enter new tags or use \'+tag\' and \'-tag\' to add/remove tags from existing tags"><!--\
--></td></tr></table><!--\
--><div style="text-align:center"><!--\
--><nobr><input type=button name=display disabled style="width:32%" value="display tiddlers" \
onclick="config.macros.tiddlerTweaker.displaytiddlers(this)"><!--\
--> <input type=button name=del disabled style="width:32%" value="delete tiddlers" \
onclick="config.macros.tiddlerTweaker.deltiddlers(this)"><!--\
--> <input type=button name=set disabled style="width:32%" value="update tiddlers" \
onclick="config.macros.tiddlerTweaker.settiddlers(this)"></nobr><!--\
--></div><!--\
--></td></tr></table><!--\
--></form><span style="display:none"><!--content replaced by tiddler "stats"--></span>\
',
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
var span=createTiddlyElement(place,"span");
span.innerHTML=this.html;
this.init(span.firstChild,config.options.txtTweakerSortBy);
},
init: function(f,sortby) { // initialize form controls
if (!f) return; // form might not be rendered yet...
while (f.list.options[0]) f.list.options[0]=null; // empty current list content
var tids=store.getTiddlers(sortby);
if (sortby=='size') // descending order
tids.sort(function(a,b) {return a.text.length > b.text.length ? -1 : (a.text.length == b.text.length ? 0 : +1);});
var who='';
for (i=0; i<tids.length; i++) { var t=tids[i];
var label=t.title; var value=t.title;
switch (sortby) {
case 'modified':
case 'created':
var t=tids[tids.length-i-1]; // reverse order
var when=t[sortby].formatString('YY.0MM.0DD 0hh:0mm ');
label=when+t.title;
value=t.title;
break;
case 'size':
label='['+t.text.length+'] '+label;
break;
case 'modifier':
case 'creator':
if (who!=t[sortby]) {
who=t[sortby];
f.list.options[f.list.length]=new Option('by '+who+':','',false,false);
}
label='\xa0\xa0\xa0'+label; // indent
break;
}
f.list.options[f.list.length]=new Option(label,value,false,false);
}
f.title.value=f.who.value=f.creator.value=f.tags.value="";
f.cm.value=f.cd.value=f.cy.value=f.ch.value=f.cn.value="";
f.mm.value=f.md.value=f.my.value=f.mh.value=f.mn.value="";
f.stats.disabled=f.set.disabled=f.del.disabled=f.display.disabled=true;
f.settitle.disabled=false;
config.options.txtTweakerSortBy=sortby; // remember current setting
f.sortby.value=sortby; // sync droplist selection with current setting
if (sortby!="modified") // non-default preference... save cookie
saveOptionCookie("txtTweakerSortBy");
else removeCookie("txtTweakerSortBy"); // default preference... clear cookie
},
selecttiddlers: function(here) { // enable/disable tweaker fields based on number of items selected
// count how many tiddlers are selected
var f=here.form; var list=f.list;
var c=0; for (i=0;i<list.length;i++) if (list.options[i].selected) c++;
if (c>1) f.title.disabled=true;
if (c>1) f.settitle.checked=false;
f.set.disabled=(c==0);
f.del.disabled=(c==0);
f.display.disabled=(c==0);
f.settitle.disabled=(c>1);
f.stats.disabled=(c==0);
var msg=(c==0)?'select tiddlers':(c+' tiddler'+(c!=1?'s':'')+' selected');
here.previousSibling.firstChild.firstChild.nextSibling.innerHTML=msg;
if (c) clearMessage(); else displayMessage("no tiddlers selected");
},
setfields: function(here) { // set tweaker edit fields from first selected tiddler
var f=here.form;
if (!here.value.length) {
f.title.value=f.who.value=f.creator.value=f.tags.value="";
f.cm.value=f.cd.value=f.cy.value=f.ch.value=f.cn.value="";
f.mm.value=f.md.value=f.my.value=f.mh.value=f.mn.value="";
return;
}
var tid=store.getTiddler(here.value); if (!tid) return;
f.title.value=tid.title;
f.who.value=tid.modifier;
f.creator.value=tid.fields['creator']||''; // custom field - might not exist
f.tags.value=tid.tags.map(function(t){return String.encodeTiddlyLink(t)}).join(' ');
var c=tid.created; var m=tid.modified;
f.cm.value=c.getMonth()+1;
f.cd.value=c.getDate();
f.cy.value=c.getFullYear();
f.ch.value=c.getHours();
f.cn.value=c.getMinutes();
f.mm.value=m.getMonth()+1;
f.md.value=m.getDate();
f.my.value=m.getFullYear();
f.mh.value=m.getHours();
f.mn.value=m.getMinutes();
},
settiddlers: function(here) {
var f=here.form; var list=f.list;
var tids=[];
for (i=0;i<list.length;i++) if (list.options[i].selected) tids.push(list.options[i].value);
if (!tids.length) { alert("please select at least one tiddler"); return; }
var cdate=new Date(f.cy.value,f.cm.value-1,f.cd.value,f.ch.value,f.cn.value);
var mdate=new Date(f.my.value,f.mm.value-1,f.md.value,f.mh.value,f.mn.value);
if (tids.length>1 && !confirm("Are you sure you want to update these tiddlers:\n\n"+tids.join(', '))) return;
store.suspendNotifications();
for (t=0;t<tids.length;t++) {
var tid=store.getTiddler(tids[t]); if (!tid) continue;
var title=!f.settitle.checked?tid.title:f.title.value;
var who=!f.setwho.checked?tid.modifier:f.who.value;
var text=tid.text;
if (f.replacetext.checked) text=text.replace(new RegExp(f.pattern.value,'mg'),f.replacement.value);
var tags=tid.tags;
if (f.settags.checked) {
var intags=f.tags.value.readBracketedList();
var addtags=[]; var deltags=[]; var reptags=[];
for (i=0;i<intags.length;i++) {
if (intags[i].substr(0,1)=='+')
addtags.push(intags[i].substr(1));
else if (intags[i].substr(0,1)=='-')
deltags.push(intags[i].substr(1));
else
reptags.push(intags[i]);
}
if (reptags.length)
tags=reptags;
if (addtags.length)
tags=new Array().concat(tags,addtags);
if (deltags.length)
for (i=0;i<deltags.length;i++)
{ var pos=tags.indexOf(deltags[i]); if (pos!=-1) tags.splice(pos,1); }
}
if (!f.setcdate.checked) cdate=tid.created;
if (!f.setmdate.checked) mdate=tid.modified;
store.saveTiddler(tid.title,title,text,who,mdate,tags,tid.fields);
if (f.setcreator.checked) store.setValue(tid.title,'creator',f.creator.value); // set creator
if (f.setcdate.checked) tid.assign(null,null,null,null,null,cdate); // set create date
}
store.resumeNotifications();
this.init(f,f.sortby.value);
},
displaytiddlers: function(here) {
var f=here.form; var list=f.list;
var tids=[];
for (i=0; i<list.length;i++) if (list.options[i].selected) tids.push(list.options[i].value);
if (!tids.length) { alert("please select at least one tiddler"); return; }
story.displayTiddlers(story.findContainingTiddler(f),tids)
},
deltiddlers: function(here) {
var f=here.form; var list=f.list;
var tids=[];
for (i=0;i<list.length;i++) if (list.options[i].selected) tids.push(list.options[i].value);
if (!tids.length) { alert("please select at least one tiddler"); return; }
if (!confirm("Are you sure you want to delete these tiddlers:\n\n"+tids.join(', '))) return;
store.suspendNotifications();
for (t=0;t<tids.length;t++) {
var tid=store.getTiddler(tids[t]); if (!tid) continue;
if (tid.tags.contains("systemConfig"))
if (!confirm("'"+tid.title+"' is tagged with 'systemConfig'.\n\nRemoving this tiddler may cause unexpected results. Are you sure?"))
continue;
store.removeTiddler(tid.title);
story.closeTiddler(tid.title);
}
store.resumeNotifications();
this.init(f,f.sortby.value);
},
stats: function(here) {
var f=here.form; var list=f.list; var tids=[]; var out=''; var tot=0;
var target=f.nextSibling;
for (i=0;i<list.length;i++) if (list.options[i].selected) tids.push(list.options[i].value);
if (!tids.length) { alert("please select at least one tiddler"); return; }
for (t=0;t<tids.length;t++) {
var tid=store.getTiddler(tids[t]); if (!tid) continue;
out+='[['+tid.title+']] '+tid.text.length+'\n'; tot+=tid.text.length;
}
var avg=tot/tids.length;
out=tot+' bytes in '+tids.length+' selected tiddlers ('+avg+' bytes/tiddler)\n<<<\n'+out+'<<<\n';
removeChildren(target);
target.innerHTML="<hr><font size=-2><a href='javascript:;' style='float:right' "
+"onclick='this.parentNode.parentNode.style.display=\"none\"'>close</a></font>";
wikify(out,target);
target.style.display="block";
}
};
//}}}
Upgrade didn't handle
* {{{—}}}
* {{{»}}} -- found in SideBarOptions toddler only
In place it put ? (looks like a square).
{{{ ([A-z][A-z]*)?([a-z]*) }}} -- apostrophes for contractions
{{{ (\s)?([A-z]) }}} -- apostrophes as opening quote marks {{{ \1'\2 }}}
{{{ (\s)?(\s) }}} -- replace with {{{ \1--\2 }}}
open all wikis and do it for all of them.
Accented e's (resume) are mishandled.
"Match Case" needs to be unchecked
"Typography_Fun" Tiddler is hopeless
/%
|Name|ToggleBreadcrumbs|
|Source|http://www.TiddlyTools.com/#ToggleBreadcrumbs|
|Version|0.0.0|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|script|
|Requires|BreadcrumbsPlugin, InlineJavascriptPlugin|
|Overrides||
|Description|dynamically enable/disable BreadcrumbsPlugin display|
%/<script>
if (config.options.chkShowBreadcrumbs==undefined) config.options.chkShowBreadcrumbs=true;
</script><<option chkShowBreadcrumbs>><script>
var chk=place.lastChild;
chk.coreOnChange=chk.onchange;
chk.onchange=function() {
if (this.coreOnChange) this.coreOnChange.apply(this,arguments);
this.checked=config.options.chkShowBreadcrumbs;
if (config.macros.breadcrumbs) config.macros.breadcrumbs.refresh();
};
</script>
/%
|Name|ToggleFullScreen|
|Source|http://www.TiddlyTools.com/#ToggleFullScreen|
|Version|1.1.3|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|script|
|Requires|InlineJavascriptPlugin|
|Overrides||
|Description|show/hide main menu, sidebar and page header|
Usage:
<<tiddler ToggleFullScreen with: label altlabel>>
- displays 'onclick' command link that toggles full screen display mode
or
<<tiddler ToggleFullScreen##ON>>
- immediately sets full screen mode
or
<<tiddler ToggleFullScreen##OFF>>
- immediately resets full screen mode
!ON
<script> if (!config.options.chkFullScreen) window.toggleFullScreen(); </script>
!end ON
!OFF
<script> if (config.options.chkFullScreen) window.toggleFullScreen(); </script>
!end OFF
%/<script>
window.toggleFullScreen=function(here) {
config.options.chkFullScreen=!config.options.chkFullScreen;
var showmm=!config.options.chkFullScreen && config.options.chkShowLeftSidebar!==false;
var showsb=!config.options.chkFullScreen && config.options.chkShowRightSidebar!==false;
var showcrumbs=!config.options.chkFullScreen && config.options.chkShowBreadcrumbs!==false
&& config.macros.breadcrumbs && config.macros.breadcrumbs.crumbs.length;
var cw=document.getElementById('contentWrapper');
var da=document.getElementById('displayArea');
var mm=document.getElementById('mainMenu');
var sb=document.getElementById('sidebar');
var sm=document.getElementById('storyMenu');
var bc=document.getElementById('breadCrumbs');
var sn=document.getElementById('siteNav');
if (cw){
for (var i=0; i<cw.childNodes.length; i++)
if (hasClass(cw.childNodes[i],'header')) { var h=cw.childNodes[i]; break; }
if (h) h.style.display=!config.options.chkFullScreen?'block':'none';
}
if (mm) {
mm.style.display=showmm?'block':'none';
da.style.marginLeft=showmm?(config.options.txtDisplayAreaLeftMargin||''):'1em';
}
if (sb) {
sb.style.display=showsb?'block':'none';
da.style.marginRight=showsb?(config.options.txtDisplayAreaRightMargin||''):'1em';
}
if (sm)
sm.style.display=!config.options.chkFullScreen ?'block':'none';
if (bc)
bc.style.display=showcrumbs?'block':'none';
if (sn)
sn.style.display=!config.options.chkFullScreen?'block':'none';
var label=('$'+'1'=='$1')?'fullscreen':'$1';
var altlabel='$2'; if ('$'+'2'=='$2') altlabel=label;
if (typeof(here)!='undefined' && here!=window.place)
here.innerHTML=!config.options.chkFullScreen?label:altlabel;
var b=document.getElementById('restoreFromFullscreenButton');
if (b) removeNode(b);
else {
var b=createTiddlyElement(null,'span','restoreFromFullscreenButton','selected');
b.innerHTML='◊';
b.title='RESTORE: redisplay page header, menu and sidebar';
b.onclick=window.toggleFullScreen;
var s=b.style;
s.position='fixed'; s.top='.3em'; s.right='.3em'; s.zIndex='10001';
s.border='2px outset ButtonFace';
s.padding='0px 3px';
s.cursor='pointer';
s.fontSize='8pt';
s.backgroundColor='ButtonFace';
if (config.browser.isGecko) {
s.color='ButtonText !important';
s.MozAppearance='button';
}
document.body.insertBefore(b,null);
}
return false;
};
</script>/%
%/<script label="$1" title="FULLSCREEN: toggle display of mainmenu, sidebar, and page header">
window.toggleFullScreen(place);
return false;
</script><script>
place.lastChild.innerHTML=('$'+'1'=='$1')?'fullscreen':'$1';
</script>
/%
|Name|ToggleLeftSidebar|
|Source|http://www.TiddlyTools.com/#ToggleLeftSidebar|
|Version|2.0.0|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|script|
|Requires|InlineJavascriptPlugin|
|Overrides||
|Description|show/hide left sidebar (MainMenu)|
Usage: <<tiddler ToggleLeftSidebar with: "label">>
Config settings:
config.options.chkShowLeftSidebar (true)
config.options.txtToggleLeftSideBarLabelShow (?)
config.options.txtToggleLeftSideBarLabelHide (?)
%/<script label="$1" title="show/hide MainMenu content">
var co=config.options;
if (co.chkShowLeftSidebar=='undefined') co.chkShowLeftSidebar=true;
co.chkShowLeftSidebar=!co.chkShowLeftSidebar;
var mm=document.getElementById('mainMenu'); if (!mm) return;
mm.style.display=co.chkShowLeftSidebar?'block':'none';
document.getElementById('displayArea').style.marginLeft=co.chkShowLeftSidebar?'':'1em';
saveOptionCookie('chkShowLeftSidebar');
var labelShow=co.txtToggleLeftSideBarLabelShow||'►';
var labelHide=co.txtToggleLeftSideBarLabelHide||'◄';
if (typeof(place)!='undefined' && '$1'=='$'+'1') {
place.innerHTML=co.chkShowLeftSidebar?labelHide:labelShow;
place.title=(co.chkShowLeftSidebar?'hide':'show')+' left sidebar';
}
var sm=document.getElementById('storyMenu'); if (sm) config.refreshers.content(sm);
</script><script>
var co=config.options;
if (co.chkShowLeftSidebar=='undefined') co.chkShowLeftSidebar=true;
var mm=document.getElementById('mainMenu'); if (!mm) return;
mm.style.display=co.chkShowLeftSidebar?'block':'none';
document.getElementById('displayArea').style.marginLeft=co.chkShowLeftSidebar?'':'1em';
if ('$1'=='$'+'1') {
var labelShow=co.txtToggleLeftSideBarLabelShow||'►';
var labelHide=co.txtToggleLeftSideBarLabelHide||'◄';
place.lastChild.innerHTML=co.chkShowLeftSidebar?labelHide:labelShow;
place.lastChild.title=(co.chkShowLeftSidebar?'hide':'show')+' left sidebar';
}
</script>
/%
|Name|ToggleRightSidebar|
|Source|http://www.TiddlyTools.com/#ToggleRightSidebar|
|Version|2.0.0|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|script|
|Requires|InlineJavascriptPlugin|
|Overrides||
|Description|show/hide right sidebar (MainMenu)|
Usage: <<tiddler ToggleRightSidebar with: "label">>
Config settings:
config.options.chkShowRightSidebar (true)
config.options.txtToggleRightSideBarLabelShow (?)
config.options.txtToggleRightSideBarLabelHide (?)
%/<script label="$1" title="show/hide right sidebar content">
var co=config.options;
if (co.chkShowRightSidebar=='undefined') co.chkShowRightSidebar=true;
co.chkShowRightSidebar=!co.chkShowRightSidebar;
var sb=document.getElementById('sidebar'); if (!sb) return;
sb.style.display=co.chkShowRightSidebar?'block':'none';
document.getElementById('displayArea').style.marginRight=co.chkShowRightSidebar?'':'1em';
saveOptionCookie('chkShowRightSidebar');
var labelShow=co.txtToggleRightSideBarLabelShow||'◄';
var labelHide=co.txtToggleRightSideBarLabelHide||'►';
if (typeof(place)!='undefined' && '$1'=='$'+'1') {
place.innerHTML=co.chkShowRightSidebar?labelHide:labelShow;
place.title=(co.chkShowRightSidebar?'hide':'show')+' right sidebar';
}
var sm=document.getElementById('storyMenu'); if (sm) config.refreshers.content(sm);
</script><script>
var co=config.options;
if (co.chkShowRightSidebar=='undefined') co.chkShowRightSidebar=true;
var sb=document.getElementById('sidebar'); if (!sb) return;
sb.style.display=co.chkShowRightSidebar?'block':'none';
document.getElementById('displayArea').style.marginRight=co.chkShowRightSidebar?'':'1em';
if ('$1'=='$'+'1') {
var labelShow=co.txtToggleRightSideBarLabelShow||'◄';
var labelHide=co.txtToggleRightSideBarLabelHide||'►';
place.lastChild.innerHTML=co.chkShowRightSidebar?labelHide:labelShow;
place.lastChild.title=(co.chkShowRightSidebar?'hide':'show')+' right sidebar';
}
</script>
!!!!!toolbar definitions for templates
<<<
Uses CoreTweaks (#609/#610) for extended "!" and 'toolbar include' syntax
|~ViewToolbar|~ToolbarCommands##spacer collapseTiddler collapseOthers closeTiddler closeOthers ! ~ToolbarCommands##goto ~ToolbarCommands##editTiddler ~ToolbarCommands##refreshTiddler ! > < * ~ToolbarCommands##tidide ~ToolbarCommands##related ~ToolbarCommands##permalink ~ToolbarCommands##deleteTiddler ~ToolbarCommands##copyTiddler ~ToolbarCommands##snapshotSave ~ToolbarCommands##snapshotPrint ~ToolbarCommands##saveTiddlerToFile ~ToolbarCommands##sendTiddler ~ToolbarCommands##revertTiddler ~ToolbarCommands##runTiddler |
|~EditToolbar|~ToolbarCommands##spacer ~ToolbarCommands##saveTiddler ~ToolbarCommands##saveCloseTiddler ~ToolbarCommands##cancelTiddler ~ToolbarCommands##copyTiddler ~ToolbarCommands##deleteTiddler ! ~ToolbarCommands##fields ! > < * ~ToolbarCommands##options ~ToolbarCommands##autosizeCheckbox ~ToolbarCommands##previewCheckbox ~ToolbarCommands##quickeditCheckbox ~ToolbarCommands##minorchangesCheckbox |
|~EditToolbarReadOnly|~ToolbarCommands##spacer ~ToolbarCommands##cancelTiddler ! ~ToolbarCommands##fields ! ~ToolbarCommands##autosizeCheckbox ~ToolbarCommands##previewCheckbox |
|~CollapsedToolbar|~ToolbarCommands##spacer +expandTiddler collapseOthers closeTiddler closeOthers ! ~ToolbarCommands##goto ~ToolbarCommands##editTiddler ~ToolbarCommands##refreshTiddler ! > < * ~ToolbarCommands##tidide ~ToolbarCommands##related ~ToolbarCommands##permalink ~ToolbarCommands##copyTiddler ~ToolbarCommands##snapshotSave ~ToolbarCommands##snapshotPrint ~ToolbarCommands##saveTiddlerToFile ~ToolbarCommands##sendTiddler ~ToolbarCommands##runTiddler|
<<<
!!!!!wiki-syntax toolbar commands
<<<
!!!!!spacer
{{{
/% force whitespace separation and baseline alignment of toolbar with tiddler title %/@@font-size:12pt; @@
}}}
!!!!!goto
{{{
@@position:static;+++^25em^*[goto|view another tiddler]...
{{fine{
{{floatright{ }}}/%
%/<<tiddler SiteMenuGoto>>}}}===@@
}}}
!!!!!editTiddler
{{{
<script>
if (readOnly) return "<<toolbar +editTiddler>>"; // view
else return "<<toolbar +editTiddler>>"; // edit
</script>
}}}
!!!!!refreshTiddler
{{{
<script label="refresh" title="redisplay the contents of this tiddler">
story.refreshTiddler(story.findContainingTiddler(place).getAttribute("tiddler"),null,true);
</script><script>
place.lastChild.style.fontWeight="normal";
</script>
}}}
!!!!!related
{{{
@@position:static;+++^65em^[related|show list/tree view of tiddlers related to the current tiddler]...
{{smallform{
{{floatright{ }}}/%
%/<<relatedTiddlers here hideform>>}}}===@@
}}}
!!!!!permalink
{{{
<<toolbar permalink>>
}}}
!!!!!copyTiddler
{{{
<script> if (!readOnly) return "<<toolbar copyTiddler>>"; </script>
}}}
!!!!!snapshotSave
{{{
<<toolbar snapshotSave>>
}}}
!!!!!snapshotPrint
{{{
<<toolbar snapshotPrint>>
}}}
!!!!!saveTiddlerToFile
{{{
<<toolbar saveTiddlerToFile>>
}}}
!!!!!sendTiddler
{{{
<<toolbar sendTiddler>>
}}}
!!!!!runTiddler
{{{
<<toolbar runTiddler>>
}}}
!!!!!revertTiddler
{{{
<html><hide linebreaks><a href="javascript:;"
title="reload the last SAVED version of this tiddler"
onclick="
var here=story.findContainingTiddler(this); if (!here) return;
var tid=here.getAttribute('tiddler');
var t='\<\<loadTiddlers [[tiddler:'+tid+']] '+document.location.href+' confirm force noreport\>\>';
var e=document.getElementById('executeRevertTiddler');
if (e) e.parentNode.removeChild(e);
e=document.createElement('span'); e.id='executeRevertTiddler';
wikify(t,e);
">revert</a>
</html>
}}}
!!!!!saveTiddler
{{{
<<toolbar +saveTiddler>>
}}}
!!!!!saveCloseTiddler
{{{
<<toolbar +saveCloseTiddler>>
}}}
!!!!!cancelTiddler
{{{
<script> return "<<toolbar -cancelTiddler>>"; </script>
}}}
!!!!!deleteTiddler
{{{
<<toolbar deleteTiddler>>
}}}
!!!!!fields
{{{
<<toolbar fields>>
}}}
!!!!!options
{{{
{{fine{//options://}}}
}}}
!!!!!autosizeCheckbox
{{{
<script label="autosize" title="automatically resize editor to fit contents">
var txt="<input type='checkbox' style='padding:0;margin:0;' %0>autosize";
var chk=place.innerHTML.toLowerCase().indexOf("checked")==-1?"checked":"";
config.commands.autosizeEditor.handler(null,place,null);
place.innerHTML=txt.format([chk]);
</script><script>
place.lastChild.innerHTML="<input type='checkbox' style='padding:0;margin:0;'>autosize";
place.lastChild.style.fontWeight="normal";
place.lastChild.style.fontSize="90%";
</script>
}}}
!!!!!previewCheckbox
{{{
<script label="preview" title="show key-by-key preview">
var txt="<input type='checkbox' style='padding:0;margin:0;' %0>preview";
var chk=place.innerHTML.toLowerCase().indexOf("checked")==-1?"checked":"";
config.commands.previewTiddler.handler(null,place,null);
place.innerHTML=txt.format([chk]);
</script><script>
place.lastChild.innerHTML="<input type='checkbox' style='padding:0;margin:0;'>preview";
place.lastChild.style.fontWeight="normal";
place.lastChild.style.fontSize="90%";
</script>
}}}
!!!!!quickeditCheckbox
{{{
<script label="quickedit" title="show QuickEdit toolbar buttons">
var opt="chkShowQuickEdit";
config.commands.toggleQuickEdit.handler(null,place,null);
var chk=config.options[opt]?"CHECKED":"";
var txt="<input type='checkbox' style='padding:0;margin:0;' option='%0' %1>quickedit";
place.innerHTML=txt.format([opt,chk]);
</script><script>
var opt="chkShowQuickEdit";
var chk=config.options[opt]?"CHECKED":"";
var txt="<input type='checkbox' style='padding:0;margin:0;' option='%0' %1>quickedit";
place.lastChild.innerHTML=txt.format([opt,chk]);
place.lastChild.style.fontWeight="normal";
place.lastChild.style.fontSize="90%";
</script>
}}}
!!!!!minorchangesCheckbox
{{{
<script label="minor changes">
var opt="chkForceMinorUpdate";
config.options[opt]=!config.options[opt];
config.macros.option.propagateOption(opt,"checked", config.options[opt],"input");
var chk=config.options[opt]?"CHECKED":"";
var txt="<input type='checkbox' style='padding:0;margin:0;' option='%0' %1>minor changes";
place.innerHTML=txt.format([opt,chk]);
</script><script>
var opt="chkForceMinorUpdate";
var chk=config.options[opt]?"CHECKED":"";
var txt="<input type='checkbox' style='padding:0;margin:0;' option='%0' %1>minor changes";
place.lastChild.innerHTML=txt.format([opt,chk]);
place.lastChild.style.fontWeight="normal";
place.lastChild.style.fontSize="90%";
place.lastChild.title=config.optionsDesc[opt];
</script>
}}}
!!!!!end of extra commands
<<<
Examples of Base ~URLs
| Absolute URL | Base URL |
|{{{http://Leonardo.com/}}} |{{{http://Leonardo.com/}}} |
|{{{http://Leonardo.com/italy/}}} |{{{http://Leonardo.com/italy/}}} |
|{{{http://Leonardo.com/italy/about.htm}}} |{{{http://Leonardo.com/italy/}}} |
|{{{http://Leonardo.com/foo/bar.htm?baz}}} |{{{http://Leonardo.com/foo/}}} |
Resolving relative ~URLs relative to {{{http://Leonardo.com/italy/}}}
| Syntax | Example | Result as Absolute URI |
| |{{{about.htm }}} |{{{http://Leonardo.com/italy/about.htm}}} |
| |{{{clock/ }}} |{{{http://Leonardo.com/italy/clock/}}} |
| |{{{clock/2.htm }}} |{{{http://Leonardo.com/italy/clock/2.htm}}} |
| |{{{/ }}} |{{{http://Leonardo.com/}}} |
| |{{{//www.internet.com/}}} |{{{http://www.internet.com/}}} |
| |{{{/patrons/}}} |{{{http://Leonardo.com/patrons/}}} |
|parent^^1^^ |{{{../ }}} |{{{http://Leonardo.com/}}} |
| |{{{../patrons/ }}} |{{{http://Leonardo.com/patrons/}}} |
| |{{{../../../ }}} |{{{http://Leonardo.com/}}} |
|self |{{{./ }}} |{{{http://Leonardo.com/italy/}}} |
| |{{{./about.htm}}} |{{{http://Leonardo.com/italy/about.htm}}} |
^^1^^ Strips off everything up to the previous slash in the the Base URI. Note that this only has meaning inside the pathname, so you cannot use this notation to go up higher than the root directory.
[[source|http://www.webreference.com/italy/tutorial2/3.htm]] (needed obfuscation fixed)
----
~ToDo -- transfer these into 'syntax' column above:
*A relative URL that begins with {{{/}}} (a slash) always replaces the entire pathname of the base URL.
*A relative URL that begins with {{{//}}} (two slashes) always replaces everything from the hostname onwards.
*Also note that a relative URL that is empty (consisting of no characters) points to the resource in which it exists.
!!!!PHP
{{{include_once($_SERVER['DOCUMENT_ROOT'].'/clock/2.htm'}}}
!!! Windows -- assign drive letter
# Plug in the USB drive
# Right-click on "My Computer" and choose"Manage"
# Choose "Storage" -- > "Disk Management"
# Right-click the USB drive and select "Change Drive Letter and Paths"
/***
|Name|UnsavedChangesPlugin|
|Source|http://www.TiddlyTools.com/#UnsavedChangesPlugin|
|Version|3.3.3|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides|TiddlyWiki.prototype.setDirty,store.saveTiddler,store.removeTiddler|
|Description|show droplist of tiddlers that have changed since the last time the document was saved|
Display a list of tiddlers that have been changed since the last time the document was saved. The list includes all new/modified tiddlers as well as those changed with "minor edits" enabled and any tiddlers that you import during the session, regardless of their modification date.
!!!!!Usage
<<<
{{{
<<unsavedChanges panel>> or <<unsavedChanges>>
}}}
{{indent{
the ''panel'' keyword displays a 'control panel' interface containing a droplist of unsaved tiddlers and a 'goto' button, along with a command link to 'save changes'. Depending upon what other plugins are installed, several additional elements will also be displayed: When [[NestedSlidersPlugin]] is installed, the entire control panel is contained within a ''SLIDER''. When [[LoadTiddlersPlugin]] is installed, a ''REVERT'' button is added. When [[SaveAsPlugin]] is installed, a ''SAVE AS'' link is added. When [[UploadPlugin]] is installed, an ''UPLOAD'' (or ''save to web'') link is added. When [[TrashPlugin]] is installed and there are tiddlers tagged with<<tag Trash>>, an ''EMPTY TRASH'' link is added.
}}}
{{{
<<unsavedChanges list separator>>
}}}
{{indent{
the ''list'' keyword displays a simple space-separated list of unsaved tiddlers without any other command links. You can specify an optional ''separator'' value that can be used in place of the default space character. For example, you can specify {{{"<br>"}}} as the separator in order to display each link, one per line.
}}}
{{{
<<unsavedChanges command label tip>>
}}}
{{indent{
the ''command'' keyword displays a single 'command link' that, when clicked, displays a ~TiddlyWiki popup containing the list of unsaved tiddlers, the 'save changes' command and, depending upon what other plugins are installed, additional commands for 'save as', 'upload', and 'empty trash' (similar to the panel display described above).
You can specify optional ''label'' and ''tip'' parameters in the macro to customize the command link text and tooltip. The default label for the command link is: "There %1 %0 unsaved tiddler%2...", where:
* %0 is automatically replaced with the number of unsaved changes
* %1 is either "is" (if changes=1) or "are" (if changes>1)
* %2 is either blank (if changes=1) or "s" (if changes>1)
resulting in the text: //"There is 1 unsaved tiddler...", "There are 2 unsaved tiddlers...", etc.//
}}}
<<<
!!!!!Examples
<<<
^^//note: the following examples will not display any output unless you have already created/modified tiddlers in the current document.//^^
{{{<<unsavedChanges>>}}}
<<unsavedChanges>>
----
{{{<<unsavedChanges command>>}}}
<<unsavedChanges command>>
----
{{{<<unsavedChanges list>>}}}
<<unsavedChanges list>>
----
{{{<<unsavedChanges list "<br>">>}}}
<<unsavedChanges list "<br>">>
<<<
!!!!!Revisions
<<<
2009.03.02 [3.3.3] fix handling for titles that contain HTML special chars (lt,gt,quot,amp)
2008.09.02 [3.3.2] cleanup popup list output generation and added timestamps/sizes to popup display
2008.08.23 [3.3.1] added optional custom 'label' and 'tip' params to 'command' mode and defined default values for mode, label, tip, and separator as object properties for I18N/L10N-readiness.
2008.08.21 [3.3.0] complete re-write of rendering and refresh processing to support multiple instances and automatic self-refresh (no longer depends upon core refresh notifications)
2008.08.21 [3.2.0] added 'command' option for link+popup as alternative to 'control panel' interface
2008.04.22 [3.1.2] use SaveAsPlugin instead of obsolete NewDocumentPlugin to add "save as" link
2007.12.22 [3.1.1] hijack removeTiddler() instead of low-level deleteTiddler() to correct tracking and refresh handling issues. in saveTiddler(), check for 'tiddler rename' (title!=newtitle) and adjust list accordingly.
2007.12.21 [3.1.0] added support for {{{<<unsavedChanges list separator>>}}} usage to unsaved tiddlers as a simple list of links, embedded in tiddler content (e.g., [[MainMenu]])
2007.12.20 [3.0.0] rewrite to track ALL changed tiddlers, including imports and minor edits, regardless of saved modification dates. Also, rewrote display logic to directly refresh macro output instead of triggering a page refresh. The entire process is MUCH more efficient now.
2007.08.02 [2.0.0] converted from inline script
2007.01.01 [1.0.0] initial release
<<<
!!!!!Code
***/
//{{{
version.extensions.UnsavedChangesPlugin= {major: 3, minor: 3, revision: 3, date: new Date(2009,3,2)};
config.macros.unsavedChanges = {
changed: [], // list of currently unsaved tiddler titles
defMode: "panel",
defSep: " ",
defLabel: "There %1 %0 unsaved tiddler%2...",
defTip: "view a list of unsaved tiddler changes",
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
var wrapper=createTiddlyElement(place,"span",null,"unsavedChanges");
wrapper.setAttribute("mode",params[0]||this.defMode);
wrapper.setAttribute("sep",params[1]||this.defSep); // for 'list' mode
wrapper.setAttribute("label",params[1]||this.defLabel); // for 'command' mode
wrapper.setAttribute("tip",params[2]||this.defTip); // for 'command' mode
this.render(wrapper);
},
render: function(wrapper) {
removeChildren(wrapper); // make sure its empty
if (!this.changed.length) return; // no changes = no output
switch (wrapper.getAttribute("mode")) {
case "command": this.command(wrapper); break;
case "list": this.list(wrapper); break;
case "panel": default: this.panel(wrapper); break;
}
},
refresh: function() {
var wrappers=document.getElementsByTagName("span");
for (var w=0; w<wrappers.length; w++)
if (hasClass(wrappers[w],"unsavedChanges"))
this.render(wrappers[w]);
},
list: function(place) { // show simple list of unsaved tiddlers
wikify("[["+this.changed.join("]]"+place.getAttribute("sep")+"[[")+"]]",place);
},
command: function(place) { // show command link with popup list
var c=this.changed.length;
var txt=place.getAttribute("label").format([c,c==1?'is':'are',c==1?'':'s']);
var tip=place.getAttribute("tip");
var action=function(ev) { if (!ev) var ev=window.event;
var p=Popup.create(this); if (!p) return false;
var d=createTiddlyElement(p,"div");
d.style.whiteSpace="normal"; d.style.width="auto"; d.style.padding="2px";
// gather pretty links for changed tiddlers
var list=[]; var item=" [[%1 - %0 (%2 bytes)|%0]] ";
for (var i=config.macros.unsavedChanges.changed.length-1; i>=0; i--) {
var tid=store.getTiddler(config.macros.unsavedChanges.changed[i]);
if (!tid) continue;
var when=tid.modified.formatString('YYYY.0MM.0DD 0hh:0mm:0ss');
list.push(item.format([tid.title,when,tid.text.length]));
}
wikify("@@white-space:nowrap;"+list.join("<br>")+"@@",d);
if (!readOnly) {
var t="\n----\n";
t+="@@white-space:nowrap;display:block;text-align:center; ";
t+="<<saveChanges>>";
t+=config.macros.saveAs?" | <<saveAs>>":"";
t+=config.macros.upload?" | <<upload>>":"";
t+=(config.macros.emptyTrash&&store.getTaggedTiddlers("Trash").length)?" | <<emptyTrash>>":"";
t+=" @@";
wikify(t,d);
}
Popup.show(p,false);
ev.cancelBubble=true; if(ev.stopPropagation)ev.stopPropagation();
return(false);
}
createTiddlyButton(place,txt,tip,action,"button");
},
panel: function(place) { // show composite droplist+buttons+commands
// gather changed tiddlers (in reverse order by date - most recent first)
var tids=[]; for (var i=this.changed.length-1; i>=0; i--)
{ var t=store.getTiddler(this.changed[i]); if (t) tids.push(t); }
tids.sort(function(a,b){return a.modified<b.modified?-1:(a.modified==b.modified?0:1);});
// generate droplist items
var list=[]; var item='<option value="%0">%1 - %0 (%2 bytes)</option>';
for (var i=tids.length-1; i>=0; i--) {
var when=tids[i].modified.formatString('YYYY.0MM.0DD 0hh:0mm:0ss');
list.push(item.format([tids[i].title.htmlEncode(),when,tids[i].text.length]));
}
// display droplist, buttons, and command links
var out=''; var c=this.changed.length;
var NSP=config.formatters.findByField("name","nestedSliders");
var summary=this.defLabel.format([c,c==1?'is':'are',c==1?'':'s'])
out+=NSP?'+++(unsaved)['+summary+'|'+this.defTip+']...':(summary+"\n");
out+='<html><form style="display:inline"><!--\
--><select size="1" name="list" \
title="select a tiddler to view" \
onchange="var v=this.value; if (v.length) story.displayTiddler(null,v);"><!--\
-->'+list.join('')+'<!--\
--></select><!--\
--><input type="button" value="goto" onclick="this.form.list.onchange();">';
if (config.macros.loadTiddlers) {
out+='<input type="button" value="revert" \
title="import the last saved version of this tiddler" \
onclick="var v=this.form.list.value; if (!v.length) return; \
var t=\'<\'+\'<loadTiddlers [[tiddler:\'+v+\']] \'; \
t+=document.location.href; \
t+=\' confirm force noreport>\'+\'>\'; \
var e=document.getElementById(\'executeRevert\'); \
if (e) e.parentNode.removeChild(e); \
e=document.createElement(\'span\'); \
e.id=\'executeRevert\'; \
wikify(t,e);">';
}
out+='</form></html>';
if (!readOnly) {
out+='\n{{small nowrap{';
out+="<<saveChanges>>";
out+=config.macros.saveAs?" | <<saveAs>>":"";
out+=config.macros.upload?" | <<upload>>":"";
out+=(config.macros.emptyTrash&&store.getTaggedTiddlers("Trash").length)?" | <<emptyTrash>>":"";
out+='}}}';
}
out+=NSP?'===':'';
wikify(out,place);
}
};
// hijack store.saveTiddler() to track changes to tiddlers
if (store.showUnsaved_saveTiddler==undefined) {
store.showUnsaved_saveTiddler=store.saveTiddler;
store.saveTiddler=function(title,newtitle) {
if (title!=newtitle) {
var i=config.macros.unsavedChanges.changed.indexOf(title);
if (i!=-1) config.macros.unsavedChanges.changed.splice(i,1); // remove old from list
}
var i=config.macros.unsavedChanges.changed.indexOf(newtitle);
if (i!=-1) config.macros.unsavedChanges.changed.splice(i,1); // remove new title from list
config.macros.unsavedChanges.changed.push(newtitle); // add new title to END of list
var t=this.showUnsaved_saveTiddler.apply(this,arguments);
if (!this.notificationLevel) config.macros.unsavedChanges.refresh();
return t;
}
}
// hijack store.removeTiddler() to track changes to tiddlers
if (store.showUnsaved_removeTiddler==undefined) {
store.showUnsaved_removeTiddler=store.removeTiddler;
store.removeTiddler=function(title) {
var i=config.macros.unsavedChanges.changed.indexOf(title);
if (i!=-1) config.macros.unsavedChanges.changed.splice(i,1); // remove from list
this.showUnsaved_removeTiddler.apply(this,arguments);
if (!this.notificationLevel) config.macros.unsavedChanges.refresh();
}
}
// hijack store.setDirty() function to reset change list after file save
// note: do NOT hijack the prototype function. This hijack should only be applied to
// the main 'store' instance only (i.e., don't refresh when loading temporary store
// as part of ImportTiddlers processing)
if (store.showUnsaved_setDirty==undefined) {
store.showUnsaved_setDirty=store.setDirty;
store.setDirty = function(flag) {
var refresh=this.isDirty() && !flag; // 'dirty' to 'clean', force a refresh...
this.showUnsaved_setDirty.apply(this,arguments); // but change the flag first.
if (refresh) {
config.macros.unsavedChanges.changed=[]; // clear changed list
config.macros.unsavedChanges.refresh();
}
}
}
//}}}
An assortment of tips. ~ToDo: untangle
{{{
Private Sub btnPasteCost_Click()
Dim PasteString As String, strPrompt As String
00010 strPrompt = "Paste raw cost figures. This can include the " & _
"Materials and Outside Cost, or not."
PasteString = InputBox(strPrompt, "Raw Cost Import")
00015 ''TIP - makes InputBox 'cancel' work, even if input was entered
If PasteString = "" Then Exit Sub
''TIP Remove extra spaces (split function won't take em)
Do While InStr(PasteString, " ")
00030 PasteString = VBA.Replace(PasteString, " ", " ")
Loop
''TIP Array using Split function
''TIP VBA.split function is new (2003) and not well documented.
Dim arrayHourSets As Variant, b As Byte, strBoxName As String
00035 arrayHourSets = VBA.Split(PasteString)
For b = 0 To UBound(arrayHourSets)
If b < 6 Then
strBoxName = "boxLabor" & b + 1
ElseIf b = 6 Then 'the 7th cost (Mat'ls) is included in string
00040 strBoxName = "boxMatAndOSCost"
Else
Me.Repaint: Exit Sub
End If
Me(strBoxName).Value = arrayHourSets(b)
00045 Next b
}}}
''How can I quickly list all the ASCII codes?''
{{{
Dim i As Long
Private Sub get_ascii()
For i = 0 To 200
Debug.Print i & " " & Chr(i)
Next
End Sub
}}}
{{{Chr(34)}}} " (double quote)
{{{Chr(39)}}} ' (single quote)
{{{Chr(42)}}} * (asterisk)
{{{
Sub List_CurrentDB_Variables()
On Error GoTo errHandler ''Err handling must be turned on!
Dim i As Integer
For i = 0 To CurrentDb.Properties.count - 1
Debug.Print CurrentDb.Properties(i).Name;
Debug.Print " " & CurrentDb.Properties(i).value
Next
errHandler:
Debug.Print " "
Resume Next
End Sub
}}}
!How do VBA arrays work?
{{{
Sub MultiDimArray()
Dim i As Integer, j As Integer
Dim intNum() As Integer ''dynamic array
ReDim intNum(2 To 3, 3 To 5) '' re-size
For i = 2 To 3 '' populate array
For j = 3 To 5
intNum(i, j) = i ^ j
Next j
Next i
For i = 2 To 3 '' dump all
For j = 3 To 5
Debug.Print i & "^" & j _
& "=" & intNum(i, j)
Next j
Next i
End Sub
}}}
----
{{{
Private Sub ChangeLightBulb()
Debug.Print "~~~~~~~~~~~~~~~~~~~~~~"
Debug.Print "For a given kind of person, how many " _
& vbCrLf & "are required to change a light bulb?"
Dim lngRecordCount As Long
Dim arrBulb() As Variant
''Index starts at 0, so uppermost value seems one short.
''BUT, Redim and Ubound don't reflect this!
''A range of 0 To 7 is specified with 3.
ReDim arrBulb(3, 2)
arrBulb(0, 0) = "Psychlgst"
arrBulb(0, 1) = "PMS Woman"
arrBulb(0, 2) = "Democrat "
arrBulb(1, 0) = "1"
arrBulb(1, 1) = "3"
arrBulb(1, 2) = "0"
arrBulb(2, 0) = "'But it has to want to change'"
arrBulb(2, 1) = "'It just does, OKAY?'"
arrBulb(2, 2) = "'Obama means change is already here'"
If Timer Mod 2 = 0 Then ''random yes or no
''IMPORTANT: Only the LAST dimension can be redimensioned!
'' So for a 2D array, THINK: 1st = columns, 2nd = rows
lngRecordCount = UBound(arrBulb, 2) + 1
ReDim Preserve arrBulb(3, lngRecordCount)
'' OR
ReDim Preserve arrBulb(3, UBound(arrBulb, 2) + 1)
arrBulb(0, 3) = "Programmr"
arrBulb(1, 3) = "n"
arrBulb(2, 3) = "'Data abstraction makes this irrelevant'"
End If
Call printout_1(arrBulb)
''Ubound does NOT give a recordcount. It gives a highest value.
Debug.Print " " & UBound(arrBulb, 2) + 1 & " entries; ";
Debug.Print "Array dimensions are (" & UBound(arrBulb, 1) & ", " & UBound(arrBulb, 2) & ")"
Debug.Print " 1st dimension is 3? " & CBool(Eval(UBound(arrBulb, 1) = 3));
Debug.Print ": Ubound(arrBulb, 1) = " & UBound(arrBulb, 1)
Debug.Print " 2nd dimension is 3? " & CBool(Eval(UBound(arrBulb, 2) = 3));
Debug.Print ": Ubound(arrBulb, 2) = " & UBound(arrBulb, 2)
Debug.Print
End Sub
Private Sub printout_1(arrBulb As Variant)
Dim count_Wide As Long, count_Deep As Long
Dim lngRecordCount As Long
lngRecordCount = UBound(arrBulb, 2)
'Debug.Print "V = " & "" & " and H = " & ""
For count_Deep = 0 To lngRecordCount
For count_Wide = 0 To 2
Debug.Print " " & arrBulb(count_Wide, count_Deep) & " ";
Next
Debug.Print
Next
End Sub
Private Sub printout_2()
''Use of For Each ... for single dim array only?
'' www.tek-tips.com/viewthread.cfm?qid=1416223&page=1
Dim ControlNames As Variant, myElement As Variant
ControlNames = Array("rectFailure", "listDisposition", "listDisposition")
For Each myElement In ControlNames
Debug.Print myElement
Next
End Sub
}}}
Access 97 VBA (Wrox) pg. 160ff.
[[VBA_Array_IfMissingThenAdd]]
[[VBA_Array]]
http://www.tek-tips.com/viewthread.cfm?qid=1492689&page=1
{{{
Private Sub add_Element_IF_Missing()
''For a 2-dim array (strNeedle, Ct), incr Ct OR IF MISSING append strNeedle
Dim arrayNeedles As Variant
Dim strNeedle$ ''TIP $ = 'as String'
Dim lngUbound As Long
lngUbound = UBound(arrayNeedles, 2)
Dim i As Long
For i = 0 To lngUbound
If arrayNeedles(0, i) Like strNeedle Then
'Gotcha! Now I edit arrayNeedles(1, i)
arrayNeedles(1, i) = arrayNeedles(1, i) + 1
Exit Sub
End If
Next
''If I made here, then this record truly is new
i = lngUbound + 1
ReDim Preserve arrayNeedles(1, i)
arrayNeedles(0, i) = strNeedle
arrayNeedles(1, i) = 1
End Sub
}}}
* You can put line numbers in your code. Just type numbers along the left border. This should happen after code is finished (final delivery steps). However, ~MZTools makes it simple with an add/remove button. ~MZTools and the use of line numbers are recommended by Tony Teows.
*In the error handler, reference this using the {{{erl}}} variable: {{{MsgBox "Error " & Err.Number & " Line: " & Erl}}}
*Clearly this is only for trouble-shooting, debugging (or we are seriously regressing in our approach to programming!). (Do not tag this tiddler {{{err}}}.)
* ~MZTools also has "Code Review" that reveals all your unused variables and functions.
* ~VBACodePrint from http://www.starprinttools.com is very good. Font: Calibri 10.
Wild cards call for the Like keyword:
{{{If Me.RecordSource Like "q_pBOM_Product*" Then}}}
strcomp() enables case-insensitive comparison:
{{{If StrComp(NewString, OldString, 0) <> 0 Then}}}
Stub
salvage the hints from HOMER attempt
----
For HOMER, {{{Refresh Links}}} routine seems to be a sticky point. Other sections seemed to translate through (not however with overall success). For this one routine, I need either a different solution or DAO library references.
----
Question: How much mixing of ADO and DAO in an Access database might be appropriate? I've always figured "None" -- is that correct?
~ToDo: learn which function provides the numeric argument.
{{{
Function TypeName(n) As String
' Purpose: Converts the numeric results of DAO fieldtype to Text.
Select Case n
Case DB_BOOLEAN
TypeName = "Yes/No" '1
Case DB_BYTE
TypeName = "Byte" '2
Case DB_INTEGER
TypeName = "Integer" '3
Case DB_LONG
TypeName = "Long Integer" '4
Case DB_CURRENCY
TypeName = "Currency" '5
Case DB_SINGLE
TypeName = "Single" '6
Case DB_DOUBLE
TypeName = "Double" '7
Case DB_DATE
TypeName = "Date/Time" '8
Case DB_TEXT
TypeName = "Text" '10
Case DB_LONGBINARY
TypeName = "OLE Object" '11
Case DB_MEMO
TypeName = "Memo" '12
Case Else
TypeName = "User function TypeName() did not recognize type " & n
End Select
End Function
}}}
''Date Stamping Records''
You may want to know the last time a record was changed. To accomplish this you can add a date stamp field (~LastUpdated) to a table, then set the field's Default Value to Now, and add the field to your form but make it invisible. Access will enter the current date whenever you add a new record using the form. To change the ~LastUpdated field to the current date when you alter an existing record, use the form's [[BeforeUpdate|VBA_FormBeforeUpdate]] property and set ~LastUpdated to Now.
Access stores date/time variables like floating point numbers where the integer part represents days since 30/12/1899 and the fractional part represents time of day. You can do arithmetic without any functions in many cases. You need functions if your arithmetic needs to know about the calendar or to represent the results in the way you want.
''Adding/subtracting''
to get a date N days before/after a given date [givendate] just use + and -:
{{{ thirtydaysago: [givendate]-30 }}}
{{{ weekstime: [givendate]+7 }}}
'To get a date months or years in the past'
use DateAdd() as it knows how many days in each month/year:
{{{ samedaylastmonth: DateAdd("m",-1,[givendate]) }}}
{{{ samedaylastyear: DateAdd("yyyy",-1,[givendate]) }}}
You can also use DateAdd to add/subtract hours, minutes or seconds (the first argument is "n" for minutes". DateAdd is described in the VBA help but not the Access help - open the VBA editor and look it up there
''A related date''
Use DateSerial() with the year(), month() and day() functions:
{{{ firstofnextmonth: DateSerial(Year([givendate]),Month([givendate])+1,1) }}}
{{{ lastoflastmonth: DateSerial(Year([givendate]),Month([givendate]),1)-1 }}}
DateSerial works even if the month or day is <1, >12, >31 etc, it just adjusts everything logically to fit. E.g. month 0 is month 12 of the previous year.
''Use DateAdd with year(), month() or day():''
{{{ lastofthismonth: DateAdd("m",1,[givendate])-day([givendate]) }}}
''Weeks''
The function Weekday returns 1 to 7 depending of the day of the week a given date represents. This can be used with date arithmetic to give the previous Monday etc.
{{{ previousmonday: [givendate]-Weekday([givendate],3) }}}
The second argument to Weekday() indicates the start day of the week, 1 or no argument is Sunday, 2 is Monday, 7 is Saturday.
These return true (-1) or false (0):
{{{ isworkday: weekday([givendate],2)<6 }}}
{{{ isweekend: weekday([givendate],7)<3 }}}
(thanks to Norris68 for the weekend tip)
''Returning formatted dates''
if you want to return a date as "Friday", "Tuesday" etc. use the Format() function:
{{{ dayname: format([givendate],"dddd") }}}
''To group records in months in a totals query'' add a field:
{{{ YrMnth: format([givendate],"yyyymm") }}}
and group by that field.
''Summing times''
If you sum entries in a date/time field that represent times you get a numeric result, e.g. if you have
>2:34
>3:45
>2:50
the sum comes to 0.38125. To get a H:M:S result you might use Format([mytimes],"hh:nn:ss") ("nn" for minutes not "mm" which is month) but this gives the hours modulo 24. This adds a position for the number of days if your sum is going to exceed 24 hours:
{{{ dhhmmss: Str(Int(Sum([mytimes]))) & " " & Format(Sum([mytimes]),"hh:nn:ss") }}}
Source: http://www.tek-tips.com/faqs.cfm?fid=4230
''Disable UI polish while dev/troubleshooting''
* Set a constant {{{DEBUG_SET}}} and replace T/F settings with the constant.
* Necessary to ensure the constant changes for production deployment.
* Will slow down forms a bit.
* Don't apply to lines that restore the default (ex., {{{Echo = True}}}).
* Don't apply to bomb-proof code -- use straight T/F.
* See [[VBA_CodeReview]], [[VBA_Error]]
{{{
'############################################
' When deployed to users ... = False !
Public Const DEBUG_SET As Boolean = False
'############################################
DoCmd.Hourglass Not DEBUG_SET
Screen.Application.Echo DEBUG_SET
....
DoCmd.Hourglass False
Screen.Application.Echo True
}}}
''How do I make 'Cancel' the default in a dialog box?''
use {{{vbDefaultButton2}}}
{{{
Response = MsgBox("Are you sure?", _
vbYesNo + vbCritical + vbDefaultButton2)
}}}
!!! Watch out for incorrect //vbOK//
//vbOKOnly// is an available constant. //vbOK// is NOT! VBA Compile won't catch this!. If you use it, you will get two buttons, Okay and Cancel. However, //vbOK// DOES work as a response. The problem is that you won't know to catch a response for vbCancel.
!Useful for spotting an RDC user?
{{{
Sub List_Environment_Variables()
Dim EnvString As String, Count As Integer
Count = 1
Do
EnvString = Environ(Count)
Debug.Print Count & " " & EnvString
Count = Count + 1
Loop Until EnvString = ""
End Sub
}}}
''Results:''
{{{
USERNAME = Smorscient
COMPUTERNAME = TFP-SMORSCIENT-LT
LOGONSERVER = \\TFP-SALES-200N
HOMEDRIVE = H:
HOMESHARE = \\tfp-sales-2003\users\Smorscient
USERDNSDOMAIN = TFQ.LOCAL
USERDOMAIN = TFQ
FP_NO_HOST_CHECK = NO
}}}
See [[VBA_Debugging]]
Simplest err handling; <>0 evaluates False
{{{
ActiveControlName = Screen.ActiveControl.Name
If Err Then
ActiveControlName = "No Active Control"
Err.Clear ''Err = 0
End If
}}}
Another super-simple method, sloughed from OpenAllDatabases routine
{{{
If pfInit Then
ReDim dbsOpen(1 To cintMaxDatabases)
For x = 1 To cintMaxDatabases
On Error Resume Next
Set dbsOpen(x) = OpenDatabase(strName)
If Err.Number > 0 Then
strMsg = "Trouble opening database: " & strName & vbCrLf & _
"Make sure the drive is available." & vbCrLf & _
"Error: " & Err.Description & " (" & Err.Number & ")"
End If
On Error GoTo 0
If strMsg <> "" Then
MsgBox strMsg
Exit For
End If
Next x
End If
}}}
minimalist handle/log
{{{
errHandler:
Call Msg notification or make log entry
Resume Next
}}}
''Nested routines''
Procedure A with error-handling will catch all errors. Procedure B with no error-handling will catch none.
* If A calls B and B has an error, it will roll up and be caught in A's handler.
* If B calls A and B has an error, there won't be any handling.
* If B calls A and A has an error, A will catch it.
Whether it's a function or a procedure makes no difference. However it's worth noting that a class module won't handle errors locally, but passes them back up the stack to the first non-class module.
Where you want an error caught can depend on what you want to do with the error. For example, if a certain error requires you to make a small tweak on a string and then resume where you were, then you want very local handling. In other cases, simplicity might call for top-level handling.
''List all VBA error messages''
{{{
For intErr = 1 to 9000
Debug.Print intErr ; " - "; Error(intErr )
Next
}}}
''User-defined Errors''
{{{
Private Sub boxPN_DblClick(Cancel As Integer)
On Error GoTo errHandler
Response = InputBox("Enter Quantity:", , "1")
If IsNumeric(Response) Then
intQty = CInt(Response)
If CDbl(intQty) = CLng(intQty) Then
If intQty < 1 Or intQty > 2000 Then
Err.Raise Number:=vbObjectError + 1001, Source:="AddProduct"
End If
Else
Err.Raise Number:=vbObjectError + 1002, Source:="AddProduct"
End If
Else
Err.Raise Number:=vbObjectError + 1000, Source:="AddProduct"
End If
Call vba_20_Product.DoSomething(intQty)
errExit:
Exit Sub
errHandler:
Select Case Err.Number
Case Is < 0
strMsg = "There was a problem with the entry for quantity."
Case Else
strMsg = Err.Description & vbCrLf & vbCrLf & Err.Number
End Select
MsgBox strMsg, vbCritical
Resume errExit
End Sub
}}}
Lists All Documents in a Folder
Hmm! No API call?
{{{
Public Sub ListDocuments()
DoCmd.SetWarnings False
DoCmd.Echo False
Dim fs As Object
Dim i As Long
Set cnn = CurrentProject.Connection
Set fs = Application.FileSearch
NothingFoundStop = False
DoCmd.SetWarnings False
DoCmd.Echo False
DoCmd.RunSQL "DELETE * FROM [Current850List]"
Ready.Open "Current850List", cnn, adOpenKeyset, adLockPessimistic
With fs
.LookIn = "\\dptweb\edi\"
' .LookIn = "C:\Temp\"
.Filename = "AC2RV_*_DPT.txt"
If .Execute > 0 Then
For i = 1 To .FoundFiles.Count
Ready.AddNew
Ready![DateTitle] = Mid(.FoundFiles(i), 20, 14)
' Ready![DateTitle] = Mid(.FoundFiles(i), 15, 14)
Ready.Update
Debug.Print .FoundFiles(i)
Next i
Else
NothingFoundStop = True
End If
End With
Ready.Close
DoCmd.Echo True
End Sub
}}}
! Get created date (validate client)
{{{
Function fxVersion_Client() As Variant
Dim oFS As Object, strClient As String
strClient = CurrentDb.Name
'This creates an instance of the MS Scripting Runtime FileSystemObject class
Set oFS = CreateObject("Scripting.FileSystemObject")
fxVersion_Client = oFS.GetFile(strClient).DateCreated
Debug.Print fxVersion_Client
Set oFS = Nothing
End Function
}}}
{{{
Dim rst As Recordset
Set rst = Me.RecordsetClone
rst.FindFirst "[SocialSecurity] = '" & Me![cboFind] & "'"
If rst.NoMatch Then
MsgBox "No match was found. Please try again."
Else
Me.Bookmark = rst.Bookmark
End If
rst.Close
}}}
{{{
''.FindFirst depends on this recordset:
Set rst = myDB.OpenRecordset("a_table", dbOpenSnapshot)
''Error 3251 results if you use this:
Set rst = myDB.OpenRecordset("a_table", , dbOpenSnapshot)
}}}
''Expose array using For Each.''
Simple examples at [[VBA_ASCII]], [[VBA_Error]]
{{{
Dim strFieldName as variant
For Each strFieldName In arrFields
val1 = Nz(rsProduct(strFieldName))
Debug.Print strFieldName & " " & val1
Next
}}}
{{{
For intCount = 0 To MyDB.TableDefs.Count - 1
If (MyDB.TableDefs(intCount).Attributes And dbSystemObject) = 0 Then
If MyDB.TableDefs(intCount).Properties(propName).value <> propValueDesired Then
MyDB.TableDefs(intCount).Properties(propName).value = propValueDesired
intFound = intFound + 1
End If
End If
errMoveOn: ''TIP good way to recover from Err inside structure
Next intCount ''TIP refer to Each object here with Next keyword
...
Exit Sub
errHandler:
If Err.Number = 3270 Then
intFound = intFound + 1
Resume errMoveOn
Else
MsgBox Err.Description
End If
End Sub
}}}
* See [[VBA_DateStamp_Record]]
* Validation happens here, not at [[Unload|VBA_FormUnload]]
{{{
If RecordOK = False Then
Cancel = True
If MsgBox("There is data missing from the record. " _
& vbCrLf & "Press Yes to continue, editing. " _
& vbCrLf & "Press No to discard all changes.",vbYesNo) = vbYes
Me.Project_Name.SetFocus
Else
Me.Undo
End If
End If
}}}
Confirmation of delete request.
{{{
Private Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)
Response = acDataErrContinue ''Suppress default dialog
Dim strMsg$
' Display custom dialog box.
strMsg = "Do you want to delete this contact link?" _
& vbCrLf & vbCrLf & "(The contact will not be deleted, only the link.)"
If MsgBox(strMsg, vbYesNo) = vbNo Then
Cancel = True
End If
End Sub
Private Sub Form_AfterDelConfirm(intResponse As Integer)
Select Case intResponse
Case acDeleteOK
MsgBox "Contact Link is deleted."
Case acDeleteCancel
'MsgBox "Programmer canceled the deletion."
Case acDeleteUserCancel
'MsgBox "User canceled the deletion."
End Select
End Sub
}}}
Prevent Null entry; warn before updating record, allow user to review. This is for field only. More substantial validation must be handled in [[BeforeUpdate|VBA_FormBeforeUpdate]].
{{{
Private Sub boxProjName_BeforeUpdate(Cancel As Integer)
'' Prevent next record if data is wrong.
'' vbDefaultButton2 makes Cancel the Default choice
Dim response As Variant, strMsg As String
If IsNull(ActiveControl) Or Len(ActiveControl) < 2 Then
strMsg = "The Project Name cannot be blank or too short."
response = vbCancel
Else
strMsg = "Altering this will change the Project Name from" _
& vbCrLf & vbCrLf & ActiveControl _
& vbCrLf & " to " _
& vbCrLf & vbCrLf & ActiveControl.OldValue
response = MsgBox(strMsg, vbOKCancel + _
vbCritical + vbDefaultButton2, "Project Name")
End If
If response = vbCancel Then Me.Undo
End Sub
}}}
[[VBA_DateStamp_Record]]
Lets me mark a form for refresh.
{{{
Global frmFocus As Form
)))
{{{
Private Sub Form_Load()
DoCmd.MoveSize 40, 40
''Found to be touchy ... "run only at top"
''For long scrolling form this fixes width,
''but form merely retains last saved height.
DoCmd.RunCommand acCmdSizeToFitForm
}}}
* [[Access_FormOptimize]] -- less VBA oriented
* [[VBA_FormOptimizeMethod]] -- How to make improvements below efficiently
* Leaving things unbound makes for speed -- combo boxes, form recordsets
Surely important for speed? TechRepublic Harkins
{{{
Private Sub FormControls_AllowAutoCorrect_NO()
Dim obj As AccessObject
Dim ctl As Control
Dim varType As Variant
For Each obj In CurrentProject.AllForms
DoCmd.OpenForm obj.Name, acDesign, , , , acHidden
For Each ctl In Forms(obj.Name).Controls
varType = ctl.ControlType
If varType = acTextBox Or _
varType = acComboBox _
Then
If ctl.AllowAutoCorrect Then
Debug.Print obj.Name & " " & ctl.Name & " "
ctl.AllowAutoCorrect = False
End If
End If
Next ctl
DoCmd.Close acForm, obj.Name, acSaveYes
Next obj
End Sub
}}}
Likely important for speed. TechRepublic Harkins
Run this to reveal Combos that are early-binding
{{{
Private Sub FormControls_ComboRowSource()
Dim obj As AccessObject
Dim ctl As Control
Dim varType As Variant
For Each obj In CurrentProject.AllForms
If Not obj.Name Like "f_xMain*" Then
DoCmd.OpenForm obj.Name, acDesign, , , , acHidden
For Each ctl In Forms(obj.Name).Controls
varType = ctl.ControlType
If varType = acComboBox Or varType = acListBox _
Then
'If Not ctl.RowSource Like "" Then
Debug.Print obj.Name & " - " & ctl.Name _
& ": " & ctl.RowSource & ": " & ctl.ColumnCount _
& ": " & ctl.BoundColumn
'End If
End If
Next ctl
DoCmd.Close acForm, obj.Name, acSaveYes
End If
Next obj
End Sub
}}}
! Review all Forms
{{{
Private Sub Forms_Conform()
Dim obj As AccessObject
For Each obj In CurrentProject.AllForms
DoCmd.OpenForm obj.Name, acDesign, , , , acHidden
'' [ INSERT OPERATION HERE ]
DoCmd.Close acForm, obj.Name, acSaveYes
Next obj
End Sub
}}}
!!!! Operations to insert above
* {{{ Forms(obj.Name).AllowDesignChanges = False }}}
* {{{ Forms(obj.Name).RecordLocks = 0 }}}
! Review all Controls in Forms
{{{
For Each ctl In Forms(obj.Name).Controls
varType = ctl.ControlType
If varType = acTextBox Or _
varType = acComboBox _
Then
If ctl.AllowAutoCorrect Then
Debug.Print obj.Name & " " & ctl.Name & " "
ctl.AllowAutoCorrect = False
End If
End If
Next ctl
}}}
{{{
If Me.Dirty Then RunCommand acCmdSaveRecord
}}}
* This saves a record, as if Shift-Enter were pressed.
* It may be rejected with error number 2046. Handler using {{{Resume Next}}} makes sense for that.
* Do NOT validate data here. See [[VBA_FormDataValidate]], [[VBA_FormBeforeUpdate]]
{{{
Sub Form_Unload(Cancel As Integer)
On Error GoTo ErrHandle
''TIP - use Unload to run code when database is closed!
''Since the form is open/hidden, this will be triggered
''Dim booLogOffHandled As Boolean in general declarations)
If Not booLogOffHandled Then
Call Log("", 0, "Database Log OFF (close Access window)", "Handled")
End If
}}}
End Sub
Stub
I believe Feddema says that all the variants that start with //On// (OnLoad for Load) should be be ignored.
* [[Load|FormLoad]]
* [[BeforeUpdate|VBA_FormBeforeUpdate]]
* [[BeforeDelConfirm|VBA_FormDataValidate]]
* [[AfterDelConfirm|VBA_FormDataValidate]]
* [[BeforeInsert|VBA_Form_Subform]]
* [[Unload|VBA_FormUnload]]
[[VBA_Form_EventsGeneral]]
!!! Form locking gotcha
The 2 below can conflict, per [[http://allenbrowne.com/casu-20.html]]
{{{
Private Function fnEditable(booAuthorized) As Byte
If booAuthorized Then
fnEditable = 0 '' = dynaset (consistant)
frm_sub.Form.AllowAdditions = False
Else
fnEditable = 2 '' = snapshot
frm_sub.Form.AllowAdditions = True
End If
End Function
}}}
!!! New form instance ... reusable form, form as class
Note that if you change the echo/hourglass settings anywhere you are over-riding these settings. This is relevant to {{{Form_Load}}} and also user's {{{.UponLoading}}}.
{{{
Private colfrmProject As New Collection
'
Private Sub btnEnter_Click()
On Error GoTo errHandler
DoCmd.Hourglass Not DEBUG_SET
Screen.Application.Echo DEBUG_SET
Dim frmProject As Form_f_pProject_Header
Set frmProject = New Form_f_pProject_Header ''Form_Load event now
colfrmProject.Add frmProject
a frmProject.Filter = strFieldName & "=" & lngProj
b frmProject.FilterOn = True
frmProject.Visible = True
errExit:
DoCmd.Hourglass False
Screen.Application.Echo True
Exit Sub
errHandler:
Resume errExit
End Sub
}}}
Alternatives to lines a,b above. {{{MyVariable}}} is a {{{Public Property Let}}} whose purpose is to set a private form variable.
{{{
frmProject.MyVariable = MyValue
Call frmProject.UponLoading '' Can set filter, act on MyValue
}}}
!!! Weird cursor gotcha
''Weird behavior for mouse cursor'' and how to fix it: When new form gets the focus, cursor starts as appropriate for the form location (e.g., a text field shows the I-beam) and then remains stuck regardless of mouse location. This is resolved by clicking somewhere else. The problem's occurrence and its resolution seem a bit arbitrary. The only solution I know is to ensure the form's new location, relative to the button that called it, will not tend to leave the cursor over a text field.
[[Access_FormFormat]]
* A sub-form loads BEFORE the parent form.
This is a useful method synch Parent-Child
{{{
Private Sub Form_BeforeInsert(Cancel As Integer)
lngContact = Me.Parent!PID_Agent
Me!FID_Agent = lngContact
End Sub
}}}
The linking fields don't have to be included in the main object
or in the child object -- the underlying table/query is enough.
This is probably better as a Property Let of the subform
" ... _sub.LinkMasterFields can only be called during Open event."
{{{
Public Sub CreateSubFormLink(frm As Access.Form, strSubControlName$, _
strChildFields$, strMasterFields$)
}}}
http://stackoverflow.com/questions/1462876/msaccess-2003-vba-for-passing-a-value-from-one-form-to-another
In general when one form launches another form in the 2nd form in the forms on-open event (in fact, you can even use as late as the on-load event) you can pick up a reference to the PREVIOUS form object. In other words, you can use a object approach here.
At the forms module level, for form I declare a form object as:
Option Compare Database
Option Explicit
dim frmPrevious as form
Then, in the forms on-load event, we go:
Set frmPrevious = Screen.ActiveForm
Now, any code in our form can FREELY use code, events, even varibles declared as public from that previous form in code.
So, if you want to force a disk write of the previous form, and re-load of data.
frmPrevious.Refresh
If you want to set the ID value, then go:
frmPrevious!ID = some value
And, note that you can even declare form previous as a PUBLIC variable for that form, and thus if you two forms deep, you could go:
frmPrevious.frmPrevious!ID = some value
So, simply declare a forms object in EACH forms code module (or at lest the ones where you need to use values in code). The above means any code has a ready made reference to the previous form object. Functions declared as pubic in a form will become a METHOD of the form, and can be run like:
frmPrevious.MyCustomRefresh
or even things like some option to force the previous form to generate and setup a invoice number:
frmPrevous.SetInvoice
or frmPrevious.SetProjectStatusOn
So not only can you shuffle values and data back and forth, but you can easily execute features and functions that you build in code for the prevous form.
In fact as a coding standard, MOST of my forms have a pubic function called MyRefresh.
Note that the beauty of this approach is that you can thus read + use + set values from that previous form. This allows your code to not only receive values, but also set values in that previous form. So this approach is bi-directional. You can shuffle data and values back and forth between the forms. The other advantage here is you NOT restricted to just variables, but can use fields, control values (events, properties) etc.
This approach means that much of the previous form is now at your fingertips.
http://stackoverflow.com/questions/1462876/msaccess-2003-vba-for-passing-a-value-from-one-form-to-another
!!!!Arguments, Optional, Default
{{{
Public Function fxMyFunction _
(Optional lngProj As Variant, _
Optional booTest As Boolean = False) As String
booNoProject = IsMissing(lngProj) '' IsMissing requires that lngProj be a Variant
...
fxMyFunction = "banana"
End Function
}}}
{{{
Format$(Date, "short date") & " " & Format$(Time, "Medium Time")
Format$(1500, "$#,000") '=> '$1,500'
Format$(3, "00") '=> '03'
Format$(0.1234, "#0.00%") '=> '12.35'
Format$(1755, "00000") '=> '01755' issuing serial num w/ leading zeros
}}}
{{{
' ' Translate time value into VBA timer value
fxTimerLaunch = _
(Format(timeLaunch, "h") * 3600) + (Format(timeLaunch, "n") * 60) _
+ Format(timeLaunch, "s") - 0.5
fxFirstDayNextMonth = _
DateSerial(CInt(Format(dCurrDate, "yyyy")), CInt(Format(dCurrDate, "mm")) + 1, 1)
Format$(time_mark, ""#,#00") & " sec."
}}}
See [[Access_Form]] for more about placeholders, some applies.
{{{Len(varString & "")}}} empty space helps if varString is null
{{{ FileLen(CurrentDB.Name) / 1024 }}}
{{{
Public Function ModuleType(ByVal ModuleName As String) As Variant
On Error GoTo errHandler
Dim mdl As Module
Set mdl = Modules(ModuleName)
ModuleType = mdl.Type
ModuleType = Switch(ModuleType = 0, _
"std ", ModuleType = 1, "class ")
Set mdl = Nothingjavascript:;
errExit: Exit Function
errHandler:
ModuleType = "Err " & Err.Number
Resume errExit
End Function
}}}
Function to Search for a String in a Code Module. It will return True if it is found and False if it is not. It has an optional parameter (~NewString) that will allow you to replace the found text with the ~NewString. If ~NewString is not included in the call to the function, the function will only find the string not replace it.
Created by Joe Kendall 02/07/2003
----
{{{
Public Function SearchOrReplace(ByVal ModuleName As String, _
ByVal StringToFind As String, Optional ByVal NewString, _
Optional ByVal FindWholeWord = False, _
Optional ByVal MatchCase = False, _
Optional ByVal PatternSearch = False) As Boolean
''TIP use of ByRef, Optionals with defaults
Dim mdl As Module
Dim lSLine As Long
Dim lELine As Long
Dim lSCol As Long
Dim lECol As Long
Dim sLine As String
Dim lLineLen As Long
Dim lBefore As Long
Dim lAfter As Long
Dim sLeft As String
Dim sRight As String
Dim sNewLine As String
Set mdl = Modules(ModuleName)
If mdl.Find(StringToFind, lSLine, lSCol, lELine, lECol, FindWholeWord, _
MatchCase, PatternSearch) = True Then
If IsMissing(NewString) = False Then
' Store text of line containing string.
sLine = mdl.Lines(lSLine, Abs(lELine - lSLine) + 1)
' Determine length of line.
lLineLen = Len(sLine)
' Determine number of characters preceding search text.
lBefore = lSCol - 1
' Determine number of characters following search text.
lAfter = lLineLen - CInt(lECol - 1)
' Store characters to left of search text.
sLeft = Left$(sLine, lBefore)
' Store characters to right of search text.
sRight = Right$(sLine, lAfter)
' Construct string with replacement text.
sNewLine = sLeft & NewString & sRight
' Replace original line.
mdl.ReplaceLine lSLine, sNewLine
End If
'mdl.InsertLines lSLine, ""
SearchOrReplace = True
Else
SearchOrReplace = False
End If
Set mdl = Nothing
End Function
}}}
''This is an extended version, conceptually, of the Nz() function.''
{{{
Public Function nnz(varRaw As Variant) As Variant
On Error GoTo errHandler
'' Prevents #Error in a form control; called from the control
''This is only for numerics! String are converted to ""
If IsError(varRaw) Then
nnz = 0
Else
If Not IsNumeric(varRaw) Then
nnz = ""
ElseIf IsNull(varRaw) Then
nnz = 0
Else
nnz = varRaw
End If
End If
errExit: Exit Function
errHandler: 'Stop ''When does this trip? With "no Value?"
''If Err 'NoValue', convert to "" probably and Log Error
nnz = 0: Resume errExit
End Function
}}}
''How do I control decimal length while slinging number variables?''
{{{sngMinutes = Val(Format(sngMinutes, "0.000"))}}}
''Random Number Generator''
{{{
Dim intRand
Randomize
intRand = CInt(90 * RND + 1)
}}}
{{{
Private Function fxAcronym()
''a bit of fun. Mouseover on the "HOMER" on main menu and find these.
Dim byteRandom As Byte, strAcronym As String, byteCount As Byte
byteCount = 6 ' equals number of idiotic acronyms available
Randomize: byteRandom = CByte((byteCount - 0 + 0) * (Rnd + 0))
Select Case byteRandom
Case 0: fxAcronym = "Hydraulic Operations Made Easy and Rapid"
Case 1: fxAcronym = "Heuristically Optimized Meta-Enhancing Realisant"
Case 2: fxAcronym = "Hastily Organized Methods and End-Results"
Case 3: fxAcronym = "He Ought to Make an Emergency Revision"
Case 4: fxAcronym = "Here, Only Magnificent Eagles Roost"
Case 5: fxAcronym = "H2-O Management (Electronic Resource)"
Case 6: fxAcronym = "Honest, Optimistic, Multi-talented, Energetic, " & _
"Responsible -- and he can make a decent database, too!"
End Select
End Function
}}}
Quick-and-dirty for 0-2 or 0-9:
{{{
booRandom = (Timer Mod 2 = 0)
}}}
''How can I trap an ODBC Error in VBA?''
Use the DbEngine.Errors collection. Otherwise the return is merely 'ODBC Call Failed'.
{{{
Sub Update_TempLib()
On Error GoTo ErrorTrap
' Executing connect code at this point
Exit_errortrap:
Exit Sub
ErrorTrap:
Dim myerror As Error
For Each myerror In DBEngine.Errors
With myerror
If .Number <> 3146 Then
MsgBox .Description
End If
End With
Next
Resume Exit_errortrap
End Sub
}}}
{{{
Application.SetOption "ShowWindowsInTaskBar", False
Application.SetOption "Show Status Bar", False
}}}
Set error trapping on the fly
*0 break on all errors
*1 break on class mod errors
*2 break on unhandled errors
~ToDo replace with enum constants
{{{Application.SetOption "Error Trapping", 2 }}}
http://www.mattsbits.co.uk/item-76.html
Also for VBScript
{{{
Function fxFixedLength(strRaw As Variant, pLength As Long, _
pChar As String, booTrim As Boolean, _
booLeftJustify As Boolean) As String
' Pads a string; or if too long, truncates
' pLength - Required length
' pChar - character for padding (1 only)
Dim strString$, strPadding$
strString = Nz(strRaw, "")
' Create padding of required length
If booTrim Then
strPadding = ""
Else
strPadding = String(pLength, pChar)
End If
If booLeftJustify Then
fxFixedLength = strString & strPadding
fxFixedLength = Left(fxFixedLength, pLength)
Else
fxFixedLength = strPadding & strString
fxFixedLength = Right(fxFixedLength, pLength)
End If
End Function
}}}
Constructing SQL in VBA can reportedly cause huge bloating. For queries as DB Objects, the HD space is deallocated. Thus parameter queries become important.
''Deleting a record''
{{{
Private Sub DeleteCurrentReport(lngProd As Long)
Dim qryItem As QueryDef
Set qryItem = myMint.QueryDefs("q_Snowbirds_param_delete")
qryItem.Parameters(0) = lngProd
qryItem.Execute
Set qryItem = Nothing
End Sub
}}}
''Retrieving a value''
{{{
Private Function fxIsItemCosted(strItem$) As Boolean
Dim readItemThis As dao.Recordset
Dim qryItem As QueryDef
'May have to use CurrentDB instead of MyMint
Set qryItem = myMint.QueryDefs("q_Snowbirds_param_item")
qryItem.Parameters(0) = strItem
Set readItemThis = qryItem.OpenRecordset(dbOpenSnapshot)
fxIsItemCosted = readItemThis!m_CostAvailable
readItemThis.Close
Set qryItem = Nothing
Set readItemThis = Nothing
End Function
}}}
''Getting a recordset'' (read-only in this case)
{{{
Public Function fxChildrenRecordset(strItem$) As dao.Recordset
Dim qrySB As QueryDef
Set qrySB = myMint.QueryDefs("q_Snowbirds_param_LotNum")
qryChilds.Parameters(0) = strItem
Set fxChildrenRecordset = qrySB.OpenRecordset(dbOpenSnapshot)
Set qrySB = Nothing
End Function
}}}
Identify the query with suffix {{{_param}}}. Since you may build another in the future, add a suffix about usage also.
@@'Can't open any more databases'@@ -- potential error that can result from use of QueryDefs in recursive functions.
Faster recordset iterations -- specific to DAO. [[Source|http://www22.brinkster.com/accessory/modules/007.shtml]]
{{{
Set rst = CurrentDb.OpenRecordset("SELECT * FROM tblSupplier", dbOpenDynaset)
rst.MoveFirst
Do Until rst.EOF
strSupplier = rst("SupplierName")
rst.MoveNext
Loop
}}}
Can be 20+ times faster:
{{{
Dim fld As DAO.Field
Set rst = CurrentDb.OpenRecordset("SELECT * FROM tblSupplier", dbOpenDynaset)
Set fld = rst("SupplierName")
rst.MoveFirst
Do Until rst.EOF
strSupplier = fld
rst.MoveNext
Loop
}}}
Once the Field object variable has been defined as equating to a certain field in a Recordset object, it automatically updates itself for each record as you iterate through that recordset.
!!!PROBLEM with this in AdMint:
{{{
Static read_Item_sub As DAO.Recordset
Set read_Item_sub = M90_DB.OpenRecordset("q_item", dbOpenSnapshot)
Dim read_BOMs_sub As DAO.Recordset
Dim fldMake As DAO.field, fld_pn_sub As DAO.field, fldQty As DAO.field
'Set fldMake = read_Item_sub!make ''DOES NOT KEEP UP
Set fld_pn_sub = read_BOMs_sub!PN_sub
Set fldQty = read_BOMs_sub!qty_sub
Do Until read_BOMs_sub.EOF
Dim strPN_sub$, booMake_sub As Boolean, qty_sub As Variant
strPN_sub = fld_pn_sub
qty_sub = fldQty
read_Item_sub.FindFirst "pn_pad=" & Chr(39) & strPN & Chr(39)
'booMake_sub = fldMake ''DOES NOT KEEP UP
booMake_sub = read_Item_sub!make ''MY SOLUTION
}}}
The line ordering looks suspicious. Would like to try this:
{{{
Dim fldMake As DAO.field, fld_pn_sub As DAO.field, fldQty As DAO.field
Static read_Item_sub As DAO.Recordset
Set read_Item_sub = M90_DB.OpenRecordset("q_item", dbOpenSnapshot)
Dim read_BOMs_sub As DAO.Recordset
Set fldMake = read_Item_sub!make
Set fld_pn_sub = read_BOMs_sub!PN_sub
Set fldQty = read_BOMs_sub!qty_sub
Do Until read_BOMs_sub.EOF
Dim strPN_sub$, booMake_sub As Boolean, qty_sub As Variant
strPN_sub = fld_pn_sub
qty_sub = fldQty
read_Item_sub.FindFirst "pn_pad=" & Chr(39) & strPN & Chr(39)
booMake_sub = fldMake
}}}
A balky network connection will cause "disk or network err", 91 or 92. You may need an error handler that stalls a few seconds and attempts again.
I needed to "interview" a massive database. The goal was to learn its structure and workings, and there was no documentation. It had almost 200 tables comprised of 18,000 fields, and the total in records was 5.5 million.
I made a routine that, given a string, would search everything. Systematically following the few clues I had yielded a lot of information. The routine itself was exhaustive in scope and just a few hundred lines of code.
{{{
Open Database
Get all Tables
For Each Table
Get all Fields
For Each Field
If Field type is text ... and
If Field size is not TOO Long ...
Search for string
If found, write to a results bucket
Next
Next
}}}
Starts Procedure on Time Mark
This is prolly better than Mint Launcher 2010-04
{{{
Option Compare Database
Dim cnn As ADODB.Connection
Dim Ready As New Recordset
Dim Filename As String
Dim NothingFoundStop As Boolean
Public Sub Time855()
Dim TimeMark As String
TimeMark = Format(Time, "hhmm")
If TimeMark = "0602" _
Or TimeMark = "1702" Then
ImportRV_850
ElseIf TimeMark = "0608" _
Or TimeMark = "1708" Then
Export_855
End If
}}}
''How do I set up a pause in code processing?''
{{{
Option Compare Database
Private Declare Sub sapiSleep Lib "kernel32" _
Alias "Sleep" _
(ByVal dwMilliseconds As Long)
Sub sSleep(lngMilliSec As Long)
If lngMilliSec > 0 Then
Call sapiSleep(lngMilliSec)
End If
End Sub
Sub sTestSleep()
Const cTIME = 1000 'in MilliSeconds
Call sSleep(cTIME)
MsgBox "Before this Msgbox, I was asleep for " _
& cTIME & " Milliseconds."
End Sub
}}}
{{{
Sub RemoveFieldCaptions()
'' A caption is a sort of alias. Stripping captions
'' could break a lot of functions. This lets you
'' delete, or merely expose.
'' Err handling must be turned on!
Dim MyDB As DAO.Database
Dim intCount As Integer
Set MyDB = CurrentDb
For intCount = 0 To MyDB.TableDefs.Count - 1
If (MyDB.TableDefs(intCount).Attributes _
And dbSystemObject) = 0 Then
Dim fld As Field, varCaption As Variant
For Each fld In MyDB.TableDefs(intCount).Fields
varCaption = HasProperty(fld, "Caption")
If Not IsNull(varCaption) Then
Debug.Print MyDB.TableDefs(intCount).Name;
Debug.Print " " & fld.Name & " " & varCaption
''Use this to remove the caption.
'fld.Properties.Delete "Caption"
End If
Next
End If
Next intCount
MyDB.Close
End Sub
''------------------------------------------------
Public Function HasProperty(obj As Object, strPropName As String) _
As Variant
'Purpose: Return true if the object has the property.
HasProperty = Null
Dim varDummy As Variant
On Error Resume Next
varDummy = obj.Properties(strPropName)
HasProperty = obj.Properties(strPropName)
End Function
}}}
[[Source: A. Browne|http://dbaspot.com/forums/ms-access/139305-how-change-caption-vba.html]]
''Now I know all the links I need, how do I delete the rest?''
If you have a table that functions as an index of the table and identifies whether each is useful, you can run this. Note you may need to close and re-open the database to show the effect of deletions.
{{{
Private Sub DeleteLink()
''deletes links based on low score of usefulness of table.
Dim MyDB As DAO.Database
Dim rsRejectLink As DAO.Recordset
Dim MyTableName As String, MyTable As Object
Set MyDB = CurrentDb
Set rsRejectLink = MyDB.OpenRecordset _
("x_M9_Survey_Table_Build_REJECT_LINK", dbOpenSnapshot)
With rsRejectLink
Do Until .EOF
MyDB.TableDefs.Refresh
MyTableName = !NameTable
Dim i As Integer
For i = 0 To MyDB.TableDefs.count - 1
If MyTableName Like MyDB.TableDefs(i).Name Then
MyDB.TableDefs.DELETE MyTableName
DoEvents
Exit For
End If
Next i
.MoveNext
Loop
.Close
End With
Set rsRejectLink = Nothing
Set MyDB = Nothing
End Sub
}}}
{{{
Sub TurnOffSubDataSheets()
On Error GoTo errHandler ''Err handling must be turned on!
Dim MyDB As DAO.Database, MyProperty As DAO.Property
Dim propName$, propValueDesired$ ', propValueNew$
Dim propType As Integer, intCount As Integer, intFound As Integer
Set MyDB = CurrentDb
propName = "SubDataSheetName"
propType = 10
propValueDesired = "[None]"
'propValueNew = "[Auto]"
intFound = 0
For intCount = 0 To MyDB.TableDefs.Count - 1
If (MyDB.TableDefs(intCount).Attributes And dbSystemObject) = 0 Then
If MyDB.TableDefs(intCount).Properties(propName).value <> propValueDesired Then
MyDB.TableDefs(intCount).Properties(propName).value = propValueDesired
Debug.Print " " & MyDB.TableDefs(intCount).Name
intFound = intFound + 1
End If
End If
errMoveOn:
Next intCount
MyDB.Close
If intFound > 0 Then
MsgBox "The " & propName & " value for " & intFound _
& " non-system tables has been updated to " & propValueDesired & "."
End If
Exit Sub
errHandler:
If Err.Number = 3270 Then
Set MyProperty = MyDB.TableDefs(intCount).CreateProperty(propName)
MyProperty.Type = propType
MyProperty.value = propValueDesired
MyDB.TableDefs(intCount).Properties.Append MyProperty
intFound = intFound + 1
Resume errMoveOn
Else
MsgBox Err.Description & vbCrLf & vbCrLf & " in TurnOffSubDataSheets routine."
End If
End Sub
}}}
http://support.microsoft.com/kb/275085
http://www.granite.ab.ca/access/performancefaq.htm
Spell Check
www.databasedev.co.uk/spell_check.html
''This is probably inferior.'' Check [[VBA_DateTime]]
''~Turn-Around Time''
Not sure whether I made this up -- SDM
{{{
Function funct_TAT(DateBegin As Date, DateEnd As Date) As Long
' Note that this function does not account for holidays.
Dim WholeWeeks As Variant, DateCnt As Variant, EndDays As Integer
'DateBegin = DateValue(DateBegin)
'DateEnd = DateValue(DateEnd)
WholeWeeks = DateDiff("w", DateBegin, DateEnd)
DateCnt = DateAdd("ww", WholeWeeks, DateBegin)
EndDays = 0
Do While DateCnt < DateEnd
If Weekday(DateCnt) <> 7 And Weekday(DateCnt) <> 1 Then
EndDays = EndDays + 1
End If
DateCnt = DateAdd("d", 1, DateCnt)
Loop
funct_TAT = WholeWeeks * 5 + EndDays
End Function
}}}
''How do I set code to run after a specified time delay?''
http://www.tek-tips.com/faqs.cfm?fid=1305
{{{
Static PrevFormName$
Static PrevControlName$
Static ExpiredTime
Dim ActiveFormName$, ActiveControlName$
Dim ExpiredMinutes, Response, booWarning
' Get the active control name.
ActiveControlName = Screen.ActiveControl.Name
' If Err Then DELETE_ME Err handling -- simple key boolean
' ActiveControlName = "No Active Control"
' Err.Clear ''Err = 0
' End If
'' Record the current active name and reset ExpiredTime if:
'' 1. not been recorded yet (code is running for the first time).
'' 2. different than previous (the user has done something).
If PrevControlName = "" Or Not ActiveControlName Like PrevControlName Then
ExpiredTime = 0
PrevControlName = ActiveControlName
Else
ExpiredTime = ExpiredTime + Me.TimerInterval
End If
ExpiredMinutes = ExpiredTime / TimerUnitsPerMinute
If IdleMinutesMe < 2 Then ''TODO hasty fix: this value gets lost 2/8/2010
IdleMinutesMe = IdleMinutes
If Environ("username") = "bhachmeister" Then
IdleMinutesMe = IdleMinutesMe / 4
ElseIf Environ("username") = "jpolk" Then
IdleMinutesMe = IdleMinutesMe / 4
End If
End If
If ExpiredMinutes > IdleMinutesMe Then '' TIME OUT and QUIT
booLogOffHandled = True
booModalWait = False ''not sure, but could make for a cleaner shut-down!
Call vba_70_Misc.LogAdmin("", 0, "LOG OFF (time-out " & ExpiredMinutes & " min.)", "Handled")
DoEvents
Application.Quit acQuitSaveNone ''DE BUG
End If
}}}
http://www.tomshardware.com/forum/171584-46-acessing-machine-trough-windows-shell-vbscript
{{{
Dim ob
Set ob = Wscript.CreateObject("Wscript.Network" )
strComputerName = ob.ComputerName
strUser = ob.UserName
strUser = fxFixedLength(strUser,9," ","right")
Set ob = nothing
}}}
* {{{fxFixedLength}}} -- see [[VBScript_PadString_or_Trim]]
{{{
On Error Resume Next
'[ ... code ... ]
Dim test_result, divisor
divisor = 1 '' No error
'divisor = 0 '' raise error #11
'divisor = "zero" '' raise a different error
test_result = 2/divisor
''This line must appear at the point error is raised
If Err.Number = 11 then
MsgBox "Handled Error: " & Err.Description
ElseIf Err.Number > 0 then
MsgBox "Error: " & Err.Number & " " & Err.Description
Err.Clear ''if you wanted to proceed clean from here
End If
MsgBox "Result: " & test_result
}}}
http://www.dwarfsoft.com/blog/2009/02/27/ini-file-handler-for-vbscript/
[[VBScript_INI_file_handler]]
{{{
[Globals]
DebugMode=0
SimulateUser=0
LockOut=0
CGDW=0
DT_Begin=5/5/2011 12:15:20 PM
DT_End=5/5/2011 12:35:20 PM
Version=7.2.a
StatusMsg=''
}}}
http://www.dwarfsoft.com/blog/2009/02/27/ini-file-handler-for-vbscript/
[[VBScript_INI_file]]
{{{
Class IniFile
Private mIniFile
'
'----------------------- Sub Load -------------------------------
Public Sub Load(Filename)
LoadIni FileName,False
End Sub
'-------------------- End of Sub Load ---------------------------
Public Sub LoadIni(Filename,JustDefaults)
Dim objFSO, objDictionary, objSubDictionary, file, ini, arr, line, splitline, tmpsplit
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objDictionary = mIniFile
Set objDictionary = CreateObject("Scripting.Dictionary")
Set objSubDictionary = Nothing
Set mIniFile = objDictionary
If JustDefaults Then
Read = False
Else
Read = True
End If
If objFSO.FileExists(Filename) Then
Set file = objFSO.OpenTextFile(Filename)
ini = file.ReadAll()
file.Close
arr = Split(ini,vbCrLf)
For Each line in arr
If line = "##STARTDEFAULT" Then
Read = True
End If
If Read Then
If Left(Trim(Line),1) = "[" And Right(Trim(Line),1) = "]" Then
line = replace(replace(line,"[",""),"]","")
If Not IsEmpty(objDictionary.Item(line)) Then
Set objSubDictionary = objDictionary.Item(line)
Else
Set objSubDictionary = CreateObject("Scripting.Dictionary")
'objDictionary.Add line, objSubDictionary
set objDictionary.Item(line) = objSubDictionary
End If
Else
If TypeName(objSubDictionary) = "Nothing" or IsEmpty(objSubDictionary) Then
Set objSubDictionary = CreateObject("Scripting.Dictionary")
objDictionary.Add "[]",objSubDictionary
Set objDictionary.Item("[]") = objSubDictionary
End If
If Left(Trim(line),1) = "#" Then
objSubDictionary.Item( "[" & objSubDictionary.Count & "]") = Trim(line)
Else
splitline = split(Trim(line),"=")
If TypeName(splitline) <> "Nothing" Then
If UBound(splitline) = 1 Then
tmpsplit = split(splitline(1), "#")
' Resolve a <value>=<blank> error
If UBound(tmpsplit) >= 0 Then
objSubDictionary.Item(Trim(splitline(0))) = Trim(tmpsplit(0))
Else
objSubDictionary.Item(Trim(splitline(0))) = ""
End If
Else
'Error
End If
End If
End If
End If
If line = "##ENDDEFAULT" And JustDefaults Then
MsgBox "End Default"
Read = False
Exit Sub
End If
End If
Next
Else
Exit Sub
End If
End Sub
'------------------- End of Sub LoadIni -------------------------
'----------------------- Function GetValue -------------------------------
Public Function GetValue(Section, Value)
Set objDictionary = mIniFile
If IsSection(Section) Then
Set objSubDictionary = objDictionary.Item(Section)
If IsEmpty(objSubDictionary.Item(Value)) Then
objSubDictionary.Remove(Value)
Else
GetValue = objSubDictionary.Item(Value)
End If
End If
End Function
'-------------------- End of Function GetValue ---------------------------
'----------------------- Function IsSection ------------------------------
Public Function IsSection(Section)
Set objDictionary = mIniFile
If IsEmpty(objDictionary.Item(Section)) Then
objDictionary.Remove(Section)
IsSection = False
Else
IsSection = True
End If
End Function
'-------------------- End of Function IsSection --------------------------
'----------------------- Function IsSection ------------------------------
Public Function Save(FileName)
Set objDictionary = mIniFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set Outfile = objFSO.CreateTextFile(FileName)
If TypeName(objDictionary) <> "Nothing" Then
If Not IsEmpty(objDictionary.Keys) Then
For Each Key in objDictionary.Keys
If Key = "[]" Then
ElseIf Key = "" Then
Else
Outfile.WriteLine("[" & Key & "]")
End If
Set objSubDictionary = Nothing
If Not IsEmpty(objDictionary.Item(Key)) Then
Set objSubDictionary = objDictionary.Item(Key)
End If
If TypeName(objSubDictionary) <> "Nothing" Then
If Not IsEmpty(objSubDictionary.Keys) Then
For Each subKey in objSubDictionary.Keys
If Left(subKey,1) = "[" Then
OutFile.WriteLine(objSubDictionary.Item(subKey))
Else
OutFile.WriteLine(subKey & "=" & objSubDictionary.Item(subKey))
End If
Next
End If
End If
OutFile.WriteLine
Next
End If
End If
End Function
'-------------------- End of Function IsSection --------------------------
'--------------------- Function AddNextNumeric ---------------------------
Public Function AddNextNumeric(Section,Value)
Set objDictionary = mIniFile
If IsEmpty(objDictionary.Item(Section)) Then
Set objSubDictionary = CreateObject("Scripting.Dictionary")
Set objDictionary.Item(Section) = objSubDictionary
objSubDictionary.Item("1") = Value
AddNextNumeric = 1
Else
Set objSubDictionary = objDictionary.Item(Section)
Number = 1
Do While IsEmpty(objSubDictionary.Item("" & Number))
Number = Number + 1
Loop
objSubDictionary.Item("" & Number) = Value
AddNextNumeric = Number
End If
End Function
'------------------ End of Function AddNextNumeric -----------------------
'--------------------------- CONSTRUCTOR ---------------------------------
Private Sub Class_Initialize
' Calss Constructor
' Initialization goes here
Set mIniFile = Nothing
' MsgBox TypeName(mIniFile)
End Sub
'------------------------- END CONSTRUCTOR -------------------------------
'---------------------------- DESTRUCTOR ---------------------------------
Private Sub Class_Terminate
' Calss Destructor
' Cleanup goes here
' MsgBox TypeName(mIniFile)
Set mIniFile = Nothing
End Sub
'-------------------------- END DESTRUCTOR -------------------------------
End Class
}}}
http://www.dwarfsoft.com/blog/2009/02/27/ini-file-handler-for-vbscript/
[[VBScript_INI_file]]
{{{
Function version_loc(strPath)
version_loc = "Version Whatever"
Set MyConn = CreateObject("ADODB.Connection")
Dim strPathLocal
Dim strDoc
Set oShell = CreateObject( "WScript.Shell" )
strPathLocal=oShell.ExpandEnvironmentStrings("%appdata%")
strPathLocal = strPathLocal & "\homer\"
strDoc = "HOMER.mdb"
'C:\Documents and Settings\smorse\Application Data\homer
'%APPDATA%\homer
MyConn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & strPathLocal & strDoc & "; PWD=76eagle;"
SQL_query = "SELECT First(Version) AS Ver FROM yAdmin_Local;"
version_loc = "7.2.a"
exit function
Set RS = MyConn.Execute(SQL_query)
WHILE NOT RS.EOF
version_loc = RS("Ver")
RS.MoveNext
WEND
RS.Close
set RS = nothing
MyConn.close
set MyConn = nothing
End Function
}}}
This is a ''.wsh'' file. That allows calling functions from other files.
[[VBScript_INI_file]]
{{{
<job>
<script language="VBScript">
Const ForReading = 1
REM Const path_Base = "G:\Documents\Databases\HOMER\"
Const path_Base = "L:\Databases\HOMER\FrontEnd\"
Const path_Script_suffix = "Scripts\"
Dim path_Script
path_Script = path_Base & path_Script_suffix
Dim strVersionLocal, strVersionNorm, datBegin, datEnd, booCGDW, booLockOut
Dim strMsg
REM Get Config Variables =================================
Set objFSOi = CreateObject("Scripting.FileSystemObject")
Set objFilei = objFSOi.OpenTextFile(path_Script & "Read_INI.vbs", ForReading)
Execute objFilei.ReadAll()
set ifile = New IniFile
ifile.Load(path_Script & "H_Settings.ini")
strVersionNorm = ifile.GetValue("Globals","Version")
booCGDW = ifile.GetValue("Globals","CGDW")
datBegin = ifile.GetValue("Globals","DT_Begin")
datEnd = ifile.GetValue("Globals","DT_End")
booLockOut = ifile.GetValue("Globals","LockOut")
REM If Lockout, then quit =================================
If booLockOut <> 0 Then
Wscript.Echo "HOMER is unavailable."
Wscript.Quit
End If
REM Get local client version =================================
Set objFSO3 = CreateObject("Scripting.FileSystemObject")
Set objFile3 = objFSO3.OpenTextFile(path_Script & "H_version_loc.vbs", ForReading)
Execute objFile3.ReadAll()
strVersionLocal = version_loc(strVersionNorm)
Set objFile3 = Nothing
REM Make entry in Log =================================
strMsg = strVersionNorm & " " & strVersionLocal
Set objFSO2 = CreateObject("Scripting.FileSystemObject")
Set objFile2 = objFSO2.OpenTextFile(path_Script & "Admin_Log.vbs", ForReading)
Execute objFile2.ReadAll()
LogUpdate path_Script, strMsg
REM Update client if version is not current =================================
If strVersionNorm <> strVersionLocal Then
UpdateHomer(path_Base)
End If
REM Open Homer =================================
OpenHomer
Sub OpenHomer()
''Wscript.Echo "Let's open HOMER!"
Set objFSO4 = CreateObject("Scripting.FileSystemObject")
Set objFile4 = objFSO4.OpenTextFile(path_Script & "H_launch.vbs", ForReading)
Execute objFile4.ReadAll()
homer_launch()
End Sub
Sub UpdateHomer(path_Base)
Wscript.Echo "Let's update HOMER!"
Set objFSO5 = CreateObject("Scripting.FileSystemObject")
Set objFile5 = objFSO5.OpenTextFile(path_Script & "H_client_update.vbs", ForReading)
Execute objFile5.ReadAll()
HomerClientDownload(path_Base)
End Sub
REM ==========================================================
</script>
<script language="JScript">
Wscript.Quit();
Wscript.echo("hello world (from js)");
</script>
</job>
}}}
Works for opening an Access 2003 document.
Also see [[Access_Scripting]] and [[VBScript_Error]].
{{{
''==================================
'' Part C: Open Client
On Error Resume Next
Dim AcApp
Set AcApp = CreateObject("Access.Application.11")
If AcApp.Version >= 10 Then
''this in lieu of a digital certificate
acApp.AutomationSecurity = 1
End If
AcApp.OpenCurrentDatabase strPathLocal & strVersionServer, True
If err.Number = 7866 Then
Call WriteToLog("Launch " & " " & err.Number _
& ": " & "AdMint seems to be running already.")
ElseIf err.Number > 0 Then
Call WriteToLog("Launch " & " " & err.Number _
& ": " & Left(Err.Description,60))
Else
Call WriteToLog("Launch " & strFile & " Success ")
AcApp.Visible = True
AcApp.UserControl = True
End If
Set AcApp = nothing
}}}
{{{
Function pad(strRaw, intLength)
if intLength> len(strRaw) then
pad = String(intLength-len(strRaw),"0") & strRaw
else
pad = strRaw
end if
End Function
}}}
* [[VBScript_PadString_or_Trim]]
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::ViewToolbar]]'></div>
<span class='title' macro='view title'></span>
<!-- <div class='subtitle fine'>
<span macro='view modifier link'></span>, <span macro='view modified date'></span> (<span macro='message views.wikified.createdPrompt'></span> <span macro='view created date'></span>)</div> -->
<div class='tagClear'></div>
<div class='tagging' macro='tagging'></div>
<div class='tagged' macro='tags'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>
<div class='toolbar' style='line-height:100%;margin-top:.5em;'><a href="javascript:;"
onclick="window.scrollTo(0,ensureVisible(story.findContainingTiddler(this)));return false;"
onmouseover="this.title='scroll to top of '+story.findContainingTiddler(this).getAttribute('tiddler')">▲</a>
</div>
<div class='tagClear'></div>
<!--}}}-->
* {{{Cannot Find SIMPLETEST File / Directory}}} -- open permissions on docs
{{{http://192.168.1.1/}}}
{{{admin... admin}}}
{{{admin... 5lS...}}}
[[How-to-configure|http://hubpages.com/hub/How-to-configure-Linksys-Wireless-Access-Point]]
[[Best-Practices-for-Securing|http://hubpages.com/hub/Best-Practices-for-Securing-Your-Home-Network]]
/***
|Name|WikifyPlugin|
|Source|http://www.TiddlyTools.com/#WikifyPlugin|
|Documentation|http://www.TiddlyTools.com/#WikifyPluginInfo|
|Version|1.1.4|
|Author|Eric Shulman - ELS Design Studios|
|License|http://www.TiddlyTools.com/#LegalStatements <br>and [[Creative Commons Attribution-ShareAlike 2.5 License|http://creativecommons.org/licenses/by-sa/2.5/]]|
|~CoreVersion|2.1|
|Type|plugin|
|Requires||
|Overrides||
|Description|substitute fields, slices, or computed values into a wiki-syntax format string and render results dynamically|
The {{{<<wikify>>}}} macro allows you to easily retrieve values from custom tiddler fields, tiddler slices, computed values (using javascript) or just plain old literals, and assemble them into small bits of generated wiki-syntax text content that can be rendered directly into a tiddler, or used in the ViewTemplate or EditTemplate to add dynamically-generated content to each tiddler.
The {{{<<wikiCalc>>}}} macro performs the same processing as {{{<<wikify>>}}} and, in addition, passes the assembled text content through javascript's {{{eval()}}} function before rendering the results. This allows you to, for example, construct and compute mathematical expressions that use input values extracted from tiddler fields or slices.
!!!!!Documentation
> see [[WikifyPluginInfo]]
!!!!!Revisions
<<<
2009.03.29 [1.1.4] in handler(), pass 'tiddler' value to wikify() to fix macro errors in rendered content
|please see [[WikifyPluginInfo]] for additional revision details|
2007.06.22 [1.0.0] initial release
<<<
!!!!!Code
***/
//{{{
version.extensions.WikifyPlugin= {major: 1, minor: 1, revision: 4, date: new Date(2009,3,29)};
config.macros.wikify={
handler: function(place,macroName,params,wikifier,paramString,tiddler) {
var fmt=params.shift();
var values=[];
var out="";
if (!fmt.match(/\%[0-9]/g) && params.length) // format has no markers, just join all params with spaces
out=fmt+" "+params.join(" ");
else { // format param has markers, get values and perform substitution
while (p=params.shift()) values.push(this.getFieldReference(place,p));
out=fmt.format(values);
}
if (macroName=="wikiCalc") out=eval(out).toString();
wikify(out.unescapeLineBreaks(),place,null,tiddler);
},
getFieldReference: function(place,p) { // "slicename::tiddlername" or "fieldname@tiddlername" or "fieldname"
if (typeof p != "string") return p; // literal non-string value... just return it...
var parts=p.split(config.textPrimitives.sliceSeparator);
if (parts.length==2) {// maybe a slice reference?
var tid=parts[0]; var slice=parts[1];
if (!tid || !tid.length || tid=="here") { // no target (or "here"), use containing tiddler
tid=story.findContainingTiddler(place);
if (tid) tid=tid.getAttribute("tiddler")
else tid="SiteSlices"; // fallback for 'non-tiddler' areas (e.g, header, sidebar, etc.)
}
var val=store.getTiddlerSlice(tid,slice); // get tiddler slice value
}
if (val==undefined) {// not a slice, or slice not found, maybe a field reference?
var parts=p.split("@");
var field=parts[0];
if (!field || !field.length) field="checked"; // missing fieldname, fallback: checked@tiddlername
var tid=parts[1];
if (!tid || !tid.length || tid=="here") { // no target (or "here"), use containing tiddler
tid=story.findContainingTiddler(place);
if (tid) tid=tid.getAttribute("tiddler")
else tid="SiteFields"; // fallback for 'non-tiddler' areas (e.g, header, sidebar, etc.)
}
var val=store.getValue(tid,field);
}
// not a slice or field, or slice/field not found... return value unchanged
return val===undefined?p:val;
}
}
//}}}
//{{{
// define alternative macroName for triggering pre-rendering call to eval()
config.macros.wikiCalc=config.macros.wikify;
//}}}
+++
9C6B3-T3WCD-WJTCR-QCTXW-9BK6R
===
These two folders expose the stupid All Programs menu:
* C:\Users\Scott\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
* C:\ProgramData\Microsoft\Windows\Start Menu\Programs
See [[Windows_DirectoryNames]]
http://www.tech-forums.net/pc/f127/admin-rights-vista-windows-7-a-197772/
{{{secpol.msc}}} -- run this
{{{Security Settings -> Local Pol -> Sec. Options ->
User Account Control: Behavior of the ... for administrators}}}
Usual setting is "prompt for consent for non-Windows binaries"
Change to "Elevate without prompts"
In order to get the printing services back up and running, follow these steps:
1. Go to Start, Control Panel and Administrative Tools. Double click on Services icon.
2. Scroll down to the Print Spooler service and right click on it and select Stop. In order to do this, you need to be logged in as Administrator. At this point, no one will be able to print anything on any of the printers that are being hosted on this server.
3. Next you need to go to the following directory: C:\WINDOWS\System32\spool\PRINTERS. Delete all the files in this folder. This will clear all print queues (it�s a good idea to first make sure there are no other print jobs being processed on any of the other printers on the server because doing this step will delete those jobs also)
4. Now you can go back to the Services console and right-click and choose Start for the Print Spooler service!
[[source|http://www.online-tech-tips.com/computer-tips/how-to-forcefully-clear-all-jobs-from-a-print-queue/]]
REM if no directory, create one
md "%appdata%\homer\"
REM Empty existing folder
del "%appdata%\homer\*.*" /q
REM Copy in all items for deploy
xcopy "L:\Databases\HOMER\FrontEnd\Deliverables\*.*" "%appdata%\homer\*.*" /z /y /q
REM Delete shortcut from Profile desktop
REM del "%userprofile%\Desktop\HOMER.lnk" /q
REM Delete shortcut from All Users desktop
REM PROGRAMDATA for Win 7
del "%AllUsersProfile%\Desktop\HOMER.lnk" /q
del "%PROGRAMDATA%\Desktop\HOMER.lnk" /q
Makes caps lock like left shift key.
Open Regedit and go to [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]. Be careful not to edit the "Keyboard Layouts" key. If you want the remapping to apply on a user-specific basis, log in as that user (you need to be an administrator in XP Home or have registry editing privileges, usually a power user or administrator, in XP Pro) and use [HKEY_CURRENT_USER\Keyboard Layout].
Click on Edit->New->Binary Value and name it "Scancode Map" without the quotes.
{{{
00 00 00 00
00 00 00 00
02 00 00 00
2A 00 3A 00
00 00 00 00
}}}
http://www.usnetizen.com/fix_capslock.php
http://www.annoyances.org/exec/forum/win2000/n1019911460
[[Download from Microsoft 'Virtual XP'|http://www.microsoft.com/windows/virtual-pc/download.aspx?runGenuineCheck=true&system=6&lang=1&buttonClicked=winXpMode]]
Note you must run this from IE, not Firefox. Very subtle, Microsoft.
And now the cam works in Windows 7.
* In addition to backing up, generate at .OPS file that will migrate all your settings.
* Outlook installed? {{{TFP\smorse + password}}}.
* [[Windows_Install_Personal]]
* [[Windows_Install]]
* [[Firefox_Config]]
* [[Text_DictionaryList]]
* [[Wampserver]]
* [[Notepad++]]
* [[Font_Anonymous]]
* [[Font_AndaleMono]]
* [[Fences]]
----
Install list for windows seven. Flash player. Adobe reader. Bamboo. Clear type. Crystal reports. Drawing viewer software. Fences . Google earth. ITunes. Job. Net framework. Visio. Project. Firefox. MZ tools. Notepad plus plus. Omni. Homer. Parts and vendors. PHP designer. Primo PDF. Safe eyes. Skype. Snag it. Toodledo. VBA code print. Web server.
A solid color background causes slow awakening. Change to a JPG.
|View desktop |"Windows" key + D |
Operating System Information
Updates
System Directories
Installed Programs
Applications
Licenses
System Files
Accessibility
Environment
File Associations
Regional Settings
Running Processes
Loaded DLLs
Drivers
NT Services
NT Pipes
Autorun
Scheduled Tasks
Databases
Audio and Video Codecs
Shared DLLs
ActiveX
Open Files
Groups and Users
Protected Files
Passwords
Certificates
System
Motherboard
Sensors
BIOS
CPU Info
Devices
PCI
System Slots
Network Cards
Memory
Video
Storage Devices
Logical Disks
Ports
Battery
Printers
Network Info
Extended Network Info
Neighborhood Scan
Open Ports
Shares
RAS Connections
Hosts Scan
Ping
Trace
Request
Network Traffic
Statistics
Remote Computer
Remote Command
Network Info
Extended Network Info
Neighborhood Scan
Open Ports
Shares
RAS Connections
Hosts Scan
Ping
Trace
Request
Network Traffic
Statistics
Remote Computer
Remote Command
[[Source|http://www.gtopala.com/siw-tools/index.html]]
{{{Computer (right-click)->Properties->Enable}}}
{{{tfp-smorse-nx.tfp.local}}}
You can control which drive letter is assigned.
{{{Computer (right-click)->Manage->Storage->Disk Management}}}
!! To create a restore point
# Open System by clicking the Start button Picture of the Start button, right-clicking Computer, and then clicking Properties.
# In the left pane, click System protection. Administrator permission required If you're prompted for an administrator password or confirmation, type the password or provide confirmation.
# Click the System Protection tab, and then click Create.
# In the System Protection dialog box, type a description, and then click Create.
http://windows.microsoft.com/en-US/windows7/Create-a-restore-point
* [[add-copy-to-move-to|http://www.howtogeek.com/howto/windows-vista/add-copy-to-move-to-on-windows-vista-right-click-menu/]]
* [[add-take-ownership-to-explorer|http://www.howtogeek.com/howto/windows-vista/add-take-ownership-to-explorer-right-click-menu-in-]]vista/
All Access 2007 trusted locations are stored in the registry under
{{{HKCU\Software\Microsoft\Office\12.0\Access\Security\Trusted Locations\}}}
The Auto FE Updater utility creates registry keys based on the name of the INI file, and creates the recommended sub keys with the update date and description of the key for full traceability in the future.
* Go to "Ease of Access" and disable everything you can.
* [[Windows_RightClickEnhancements]]
//{{{
readOnly=false; // TW core setting
config.options.chkInsertTabs=true; // TW core option
config.options.txtMaxEditRows="20"; // TW core option
config.options.chkShowLeftSidebar=true; // ToggleLeftSidebar
config.options.chkShowRightSidebar=true; // ToggleRightSidebar
config.options.chkSliderunsaved=true; // UnsavedChangesPlugin
config.options.chkStoryFold=false; // StorySaverPlugin
//}}}
{{{/usr/bin/idle-python3.1 -n}}}
Drop the {{{-n}}} to avoid constipated variables!
BasicsPackage BookmarkPackage DiscoveryPackage DiscussionPackage EmasticSystem IFramePackage IconPackage ImportExportPackage InputPackage MediaPackage NavigationPackage QuickEditPackage ScrollbarPackage TaskPackage TidIDEPackage bookmarklet excludeLists excludeSearch html journal menu script settings setup story stylesheet systemConfig template wiki EFCA_Statement bible_bk