parsav  Diff

Differences From Artifact [241a1c4277]:

To Artifact [cd79efba6f]:


28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

53
54
55
56
57
58
59
..
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
local invoker = quote co:complain(404,'not found','no such control panel is available in this version of parsav') end

for i, m in ipairs(mappings) do
	if lib.render.conf[m.render] then
		invoker = quote
			if path(1):cmp(lib.str.lit([m.url])) then
				var body = [lib.render.conf[m.render]] (co, path)
				var a: lib.str.acc a:init(body.ct+48)
				if not body then
					a:lpush(['<h1>' .. m.title .. ' :: error</h1>' ..
						'<p>the requested resource is not available.</p>'])
					panel = a:finalize()
				else
					a:lpush(['<h1>' .. m.title .. '</h1>']):ppush(body)
					panel = a:finalize()
					body:free()
				end
			else [invoker] end
		end
	end
end

local terra 
render_conf([co], [path], notify: pstr)
	var menu: lib.str.acc menu:init(64):lpush('<hr>') defer menu:free()


	-- build menu
	do var p = co.who.rights.powers
		if p:affect_users() then menu:lpush '<a href="/conf/users">users</a>' end
		if p.censor() then menu:lpush '<a href="/conf/censor">badthink alerts</a>' end
		if p.config() then menu:lpush([
			'<a href="/conf/srv">server &amp; policy</a>' ..
................................................................................
		menu = mptr;
		panel = panel;
	}

	var pgt: pstr
	if notify:ref() then
		var fnpg: lib.str.acc
		fnpg:compose('<div class="flashmsg">', notify, '</div>')
		pg:append(&fnpg)
		pgt = fnpg:finalize()
	else pgt = pg:tostr() end
	defer pgt:free()

	co:stdpage([lib.srv.convo.page] {
		title = 'configure'; body = pgt;
		class = lib.str.plit 'conf';
		cache = false;
	})

	if panel.ct ~= 0 then panel:free() end
end

return render_conf







|







|








|
>







 







|


|
|







|



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
..
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
local invoker = quote co:complain(404,'not found','no such control panel is available in this version of parsav') end

for i, m in ipairs(mappings) do
	if lib.render.conf[m.render] then
		invoker = quote
			if path(1):cmp(lib.str.lit([m.url])) then
				var body = [lib.render.conf[m.render]] (co, path)
				var a = co:stra(body.ct+48)
				if not body then
					a:lpush(['<h1>' .. m.title .. ' :: error</h1>' ..
						'<p>the requested resource is not available.</p>'])
					panel = a:finalize()
				else
					a:lpush(['<h1>' .. m.title .. '</h1>']):ppush(body)
					panel = a:finalize()
					--body:free()
				end
			else [invoker] end
		end
	end
end

local terra 
render_conf([co], [path], notify: pstr)
	var menu = co:stra(256)
	menu:lpush('<hr>') 

	-- build menu
	do var p = co.who.rights.powers
		if p:affect_users() then menu:lpush '<a href="/conf/users">users</a>' end
		if p.censor() then menu:lpush '<a href="/conf/censor">badthink alerts</a>' end
		if p.config() then menu:lpush([
			'<a href="/conf/srv">server &amp; policy</a>' ..
................................................................................
		menu = mptr;
		panel = panel;
	}

	var pgt: pstr
	if notify:ref() then
		var fnpg: lib.str.acc
		fnpg:pcompose(&co.srv.pool, '<div class="flashmsg">', notify, '</div>')
		pg:append(&fnpg)
		pgt = fnpg:finalize()
	else pgt = pg:poolstr(&co.srv.pool) end
	--defer pgt:free()

	co:stdpage([lib.srv.convo.page] {
		title = 'configure'; body = pgt;
		class = lib.str.plit 'conf';
		cache = false;
	})

	--if panel.ct ~= 0 then panel:free() end
end

return render_conf