Fossil SCM

Add support for ticket/... wiki pages to /wikiedit.

stephan 2025-03-09 10:04 trunk
Commit f01d60fd175fbf34d6423d9aed3c0381a6012c122962f1a7cd539b035a35dacc
1 file changed +9 -8
--- src/fossil.page.wikiedit.js
+++ src/fossil.page.wikiedit.js
@@ -14,11 +14,11 @@
1414
cache), in the form of an "winfo" object:
1515
1616
{
1717
name: string,
1818
mimetype: mimetype string,
19
- type: "normal" | "tag" | "checkin" | "branch" | "sandbox",
19
+ type: "normal" | "tag" | "checkin" | "branch" | "ticket" | "sandbox",
2020
version: UUID string or null for a sandbox page or new page,
2121
parent: parent UUID string or null if no parent,
2222
isEmpty: true if page has no content (is "deleted").
2323
content: string, optional in most contexts
2424
}
@@ -192,11 +192,11 @@
192192
name: winfo.name
193193
});
194194
record.mimetype = winfo.mimetype;
195195
record.type = winfo.type;
196196
record.parent = winfo.parent;
197
- record.version = winfo.version;
197
+ record.version = winfo.version;
198198
record.stashTime = new Date().getTime();
199199
record.isEmpty = !!winfo.isEmpty;
200200
record.attachments = winfo.attachments;
201201
this.storeIndex();
202202
if(arguments.length>1){
@@ -207,11 +207,11 @@
207207
return this;
208208
},
209209
/**
210210
Returns the stashed content, if any, for the given winfo
211211
object.
212
- */
212
+ */
213213
stashedContent: function(winfo){
214214
return F.storage.get(this.contentKey(this.indexKey(winfo)));
215215
},
216216
/** Returns true if we have stashed content for the given winfo
217217
record or page name. */
@@ -270,11 +270,11 @@
270270
if(n) this._fireStashEvent();
271271
}
272272
};
273273
$stash.prune.defaultMaxCount = P.config.defaultMaxStashSize || 10;
274274
P.$stash = $stash /* we have to expose this for the new-page case :/ */;
275
-
275
+
276276
/**
277277
Internal workaround to select the current preview mode
278278
and fire a change event if the value actually changes
279279
or if forceEvent is truthy.
280280
*/
@@ -536,10 +536,11 @@
536536
name = name.trim();
537537
if(!this.validatePageName(name)) return false;
538538
var wtype = 'normal';
539539
if(0===name.indexOf('checkin/')) wtype = 'checkin';
540540
else if(0===name.indexOf('branch/')) wtype = 'branch';
541
+ else if(0===name.indexOf('ticket/')) wtype = 'ticket';
541542
else if(0===name.indexOf('tag/')) wtype = 'tag';
542543
/* ^^^ note that we're not validating that, e.g., checkin/XYZ
543544
has a full artifact ID after "checkin/". */
544545
const winfo = {
545546
name: name, type: wtype, mimetype: 'text/x-markdown',
@@ -573,11 +574,11 @@
573574
574575
/** Set up filter checkboxes for the various types
575576
of wiki pages... */
576577
const fsFilter = D.addClass(D.fieldset("Page types"),"page-types-list"),
577578
fsFilterBody = D.div(),
578
- filters = ['normal', 'branch/...', 'tag/...', 'checkin/...']
579
+ filters = ['normal', 'branch/...', 'tag/...', 'checkin/...', 'ticket/...']
579580
;
580581
D.append(fsFilter, fsFilterBody);
581582
D.addClass(fsFilterBody, 'flex-container', 'flex-column', 'stretch');
582583
583584
// Add filters by page type...
@@ -1045,11 +1046,11 @@
10451046
P.e.btnSave.addEventListener('click', ()=>doSave(), false);
10461047
P.e.btnSaveClose.addEventListener('click', ()=>doSave(true), false);
10471048
}
10481049
10491050
P.e.taEditor.addEventListener('change', ()=>P.notifyOfChange(), false);
1050
-
1051
+
10511052
P.selectMimetype(false, true);
10521053
P.e.selectMimetype.addEventListener(
10531054
'change',
10541055
function(e){
10551056
if(P.winfo && P.winfo.mimetype !== e.target.value){
@@ -1058,11 +1059,11 @@
10581059
P.stashContentChange(true);
10591060
}
10601061
},
10611062
false
10621063
);
1063
-
1064
+
10641065
const selectFontSize = E('select[name=editor_font_size]');
10651066
if(selectFontSize){
10661067
selectFontSize.addEventListener(
10671068
"change",function(e){
10681069
const ed = P.e.taEditor;
@@ -1590,11 +1591,11 @@
15901591
responseType: 'json',
15911592
onload: callee.onload
15921593
});
15931594
return this;
15941595
};
1595
-
1596
+
15961597
/**
15971598
Updates P.winfo for certain state and stashes P.winfo, with the
15981599
current content fetched via P.wikiContent().
15991600
16001601
If passed truthy AND the stash already has stashed content for
16011602
--- src/fossil.page.wikiedit.js
+++ src/fossil.page.wikiedit.js
@@ -14,11 +14,11 @@
14 cache), in the form of an "winfo" object:
15
16 {
17 name: string,
18 mimetype: mimetype string,
19 type: "normal" | "tag" | "checkin" | "branch" | "sandbox",
20 version: UUID string or null for a sandbox page or new page,
21 parent: parent UUID string or null if no parent,
22 isEmpty: true if page has no content (is "deleted").
23 content: string, optional in most contexts
24 }
@@ -192,11 +192,11 @@
192 name: winfo.name
193 });
194 record.mimetype = winfo.mimetype;
195 record.type = winfo.type;
196 record.parent = winfo.parent;
197 record.version = winfo.version;
198 record.stashTime = new Date().getTime();
199 record.isEmpty = !!winfo.isEmpty;
200 record.attachments = winfo.attachments;
201 this.storeIndex();
202 if(arguments.length>1){
@@ -207,11 +207,11 @@
207 return this;
208 },
209 /**
210 Returns the stashed content, if any, for the given winfo
211 object.
212 */
213 stashedContent: function(winfo){
214 return F.storage.get(this.contentKey(this.indexKey(winfo)));
215 },
216 /** Returns true if we have stashed content for the given winfo
217 record or page name. */
@@ -270,11 +270,11 @@
270 if(n) this._fireStashEvent();
271 }
272 };
273 $stash.prune.defaultMaxCount = P.config.defaultMaxStashSize || 10;
274 P.$stash = $stash /* we have to expose this for the new-page case :/ */;
275
276 /**
277 Internal workaround to select the current preview mode
278 and fire a change event if the value actually changes
279 or if forceEvent is truthy.
280 */
@@ -536,10 +536,11 @@
536 name = name.trim();
537 if(!this.validatePageName(name)) return false;
538 var wtype = 'normal';
539 if(0===name.indexOf('checkin/')) wtype = 'checkin';
540 else if(0===name.indexOf('branch/')) wtype = 'branch';
 
541 else if(0===name.indexOf('tag/')) wtype = 'tag';
542 /* ^^^ note that we're not validating that, e.g., checkin/XYZ
543 has a full artifact ID after "checkin/". */
544 const winfo = {
545 name: name, type: wtype, mimetype: 'text/x-markdown',
@@ -573,11 +574,11 @@
573
574 /** Set up filter checkboxes for the various types
575 of wiki pages... */
576 const fsFilter = D.addClass(D.fieldset("Page types"),"page-types-list"),
577 fsFilterBody = D.div(),
578 filters = ['normal', 'branch/...', 'tag/...', 'checkin/...']
579 ;
580 D.append(fsFilter, fsFilterBody);
581 D.addClass(fsFilterBody, 'flex-container', 'flex-column', 'stretch');
582
583 // Add filters by page type...
@@ -1045,11 +1046,11 @@
1045 P.e.btnSave.addEventListener('click', ()=>doSave(), false);
1046 P.e.btnSaveClose.addEventListener('click', ()=>doSave(true), false);
1047 }
1048
1049 P.e.taEditor.addEventListener('change', ()=>P.notifyOfChange(), false);
1050
1051 P.selectMimetype(false, true);
1052 P.e.selectMimetype.addEventListener(
1053 'change',
1054 function(e){
1055 if(P.winfo && P.winfo.mimetype !== e.target.value){
@@ -1058,11 +1059,11 @@
1058 P.stashContentChange(true);
1059 }
1060 },
1061 false
1062 );
1063
1064 const selectFontSize = E('select[name=editor_font_size]');
1065 if(selectFontSize){
1066 selectFontSize.addEventListener(
1067 "change",function(e){
1068 const ed = P.e.taEditor;
@@ -1590,11 +1591,11 @@
1590 responseType: 'json',
1591 onload: callee.onload
1592 });
1593 return this;
1594 };
1595
1596 /**
1597 Updates P.winfo for certain state and stashes P.winfo, with the
1598 current content fetched via P.wikiContent().
1599
1600 If passed truthy AND the stash already has stashed content for
1601
--- src/fossil.page.wikiedit.js
+++ src/fossil.page.wikiedit.js
@@ -14,11 +14,11 @@
14 cache), in the form of an "winfo" object:
15
16 {
17 name: string,
18 mimetype: mimetype string,
19 type: "normal" | "tag" | "checkin" | "branch" | "ticket" | "sandbox",
20 version: UUID string or null for a sandbox page or new page,
21 parent: parent UUID string or null if no parent,
22 isEmpty: true if page has no content (is "deleted").
23 content: string, optional in most contexts
24 }
@@ -192,11 +192,11 @@
192 name: winfo.name
193 });
194 record.mimetype = winfo.mimetype;
195 record.type = winfo.type;
196 record.parent = winfo.parent;
197 record.version = winfo.version;
198 record.stashTime = new Date().getTime();
199 record.isEmpty = !!winfo.isEmpty;
200 record.attachments = winfo.attachments;
201 this.storeIndex();
202 if(arguments.length>1){
@@ -207,11 +207,11 @@
207 return this;
208 },
209 /**
210 Returns the stashed content, if any, for the given winfo
211 object.
212 */
213 stashedContent: function(winfo){
214 return F.storage.get(this.contentKey(this.indexKey(winfo)));
215 },
216 /** Returns true if we have stashed content for the given winfo
217 record or page name. */
@@ -270,11 +270,11 @@
270 if(n) this._fireStashEvent();
271 }
272 };
273 $stash.prune.defaultMaxCount = P.config.defaultMaxStashSize || 10;
274 P.$stash = $stash /* we have to expose this for the new-page case :/ */;
275
276 /**
277 Internal workaround to select the current preview mode
278 and fire a change event if the value actually changes
279 or if forceEvent is truthy.
280 */
@@ -536,10 +536,11 @@
536 name = name.trim();
537 if(!this.validatePageName(name)) return false;
538 var wtype = 'normal';
539 if(0===name.indexOf('checkin/')) wtype = 'checkin';
540 else if(0===name.indexOf('branch/')) wtype = 'branch';
541 else if(0===name.indexOf('ticket/')) wtype = 'ticket';
542 else if(0===name.indexOf('tag/')) wtype = 'tag';
543 /* ^^^ note that we're not validating that, e.g., checkin/XYZ
544 has a full artifact ID after "checkin/". */
545 const winfo = {
546 name: name, type: wtype, mimetype: 'text/x-markdown',
@@ -573,11 +574,11 @@
574
575 /** Set up filter checkboxes for the various types
576 of wiki pages... */
577 const fsFilter = D.addClass(D.fieldset("Page types"),"page-types-list"),
578 fsFilterBody = D.div(),
579 filters = ['normal', 'branch/...', 'tag/...', 'checkin/...', 'ticket/...']
580 ;
581 D.append(fsFilter, fsFilterBody);
582 D.addClass(fsFilterBody, 'flex-container', 'flex-column', 'stretch');
583
584 // Add filters by page type...
@@ -1045,11 +1046,11 @@
1046 P.e.btnSave.addEventListener('click', ()=>doSave(), false);
1047 P.e.btnSaveClose.addEventListener('click', ()=>doSave(true), false);
1048 }
1049
1050 P.e.taEditor.addEventListener('change', ()=>P.notifyOfChange(), false);
1051
1052 P.selectMimetype(false, true);
1053 P.e.selectMimetype.addEventListener(
1054 'change',
1055 function(e){
1056 if(P.winfo && P.winfo.mimetype !== e.target.value){
@@ -1058,11 +1059,11 @@
1059 P.stashContentChange(true);
1060 }
1061 },
1062 false
1063 );
1064
1065 const selectFontSize = E('select[name=editor_font_size]');
1066 if(selectFontSize){
1067 selectFontSize.addEventListener(
1068 "change",function(e){
1069 const ed = P.e.taEditor;
@@ -1590,11 +1591,11 @@
1591 responseType: 'json',
1592 onload: callee.onload
1593 });
1594 return this;
1595 };
1596
1597 /**
1598 Updates P.winfo for certain state and stashes P.winfo, with the
1599 current content fetched via P.wikiContent().
1600
1601 If passed truthy AND the stash already has stashed content for
1602

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button