Posted by Roberto Maurizzi |
|
I'm trying to build a political discussion site for a local branch of a small Italian political party.
I need a "first page" with the latest news and such from the city, possibly with images and attachments. As a first very simple change, I added the "class" parameter to the img macro (it simply emits the class="whatever" in the html :-) ) so i can have floating images with the news text around them... in the wiki snips. I'd like to use the news macro in the wiki just like you do on sct.sphene.net but then I have problems with images. Since the forum attachments are different from the wiki snips attachments, the {img} can't work. So I tried using the img bbcode tag pointing it to a forum attachment. It doesn't work: the generated HTML has only a: <img src=""/> and then the ending </div> of the article, WITHOUT the text that follows the closing img bbcode tag. What happens? :-) Should I wait (or help? :-) ) with the new sphblog application? Unrelated, I've seen that the annotations are now displayed with the <div> tags... maybe due to the "always quote HTML" of recent django trunks :-) This is the (very simple) diff for the wikimacro.py to pass class tags: --- wikimacros.py (revision 422) +++ wikimacros.py (working copy) @@ -62,7 +62,7 @@ return HTML( '<b>Attachment for image does not exist: %s</b>' % params['id'] ) el = doc.createElement( 'img' ) el.setAttribute( 'src', attachment.get_fileupload_url() ) - for paramName in [ 'width', 'height', 'alt', 'align' ]: + for paramName in [ 'class', 'width', 'height', 'alt', 'align' ]: if params.has_key( paramName ): el.setAttribute( paramName, paramsparamName ) Well, it should be all for now :-D Thanks for your work! Ciao, Roberto Roberto Maurizzi |
|
Posted by Herbert Poul |
|
well .. the news macro should display 1:1 you see in the forum - so .. you get the same error when you look at the post right in the forum i guess ?
i discovered (and fixed) yesterday a similar bug which prevented image tags from working correctly - maybe you could try updating from subversion .. with a bit of luck it helps :) otherwise.. please give me the exact bbcode you are using ..
well... the sphblog is basically nothing else than a custom django view (and a category type extension which adds support for "slugs" - if you haven't seen it in action - visit https://herbert.poul.at ;) ) .. which retrieves all forum 'Category' objects with the category type 'sphblog' .. and renders all it's posts with a custom template.. i guess you could use this .. another option would be to make a custom extension for your needs.. i'm not quite sure what exactly you need :) if you simply need to display one forum category on a wiki snip .. the news macro i'm using for sct.sphene.net seems the right choice.. could you give me more details about your requirements - maybe i can see if the 'sphblog' application could help with it ..
oops.. thanks for the notice.. i've created an issue for it.. http://code.google.com/p/sct-project/issues/detail?id=88 ;) i'll fix it asap
thanks, looks useful ;) i think i'll add it later today :) Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Roberto Maurizzi |
|
Yes, the results are identical in both the forum and the snip
Ok! That fixed it, but I have 2 questions: 1) why shttp instead of https? I'm no regexp expert, but I find shttp strange. https: urls do work, however. 2) the CamelCase expansion works on the bbcode too. As a result if I link an image called PandoroNutelloso.jpg, the resulting html is as follows: <img src="http://www.idv.bologna.it/media/var/sphene/sphwiki/attachment/2008/02/06/<a href="/wiki/edit/PandoroNutelloso/" class="sph_wikilink sph_nonexistent">PandoroNutelloso</a>.jpg" border="0"/> as you see, the image name is transformed in a wikilink. Also, I'm not sure it's a good idea to transform ulrs into links inside code bbtags too... ^_^;
Similar to news macro but with a custom template... it could be useful, since I imagine the "first page" more like your blog than a wiki snippet. I'll do some tests if I find what to do :D
I don't even need to be able to edit the snip from a browser, so yes, it could be used as a base (maybe using urls to decide which category/forum to display?)
Well, I need the usual newspage as found on many sites, with the ability to display rather "rich" news, with tables, youtube videos, images and some formatting. Two examples could be http://www.antoniodipietro.com (the party leader blog) or http://www.beppegrillo.it I think it should be quite doable with a little work, but I'd like to decide what to do with you. Ciao, Roberto Roberto Maurizzi |
|
Posted by Herbert Poul |
|
wooops.. i somehow missed that :) it's changed now ..
Well.. one way would be to modify the SPH_SETTING['wikilink_regexp'] regex .. to not match CamelCase links, but only words sorrounded by [ and ] .. but this is currently a global setting.. so it would also apply to the wiki .. the default is: r'''(?P<escape>\\|\b)?(?P<wholeexpression>(((?P<camelcase>(A-Z+a-z- 0-9+){2,})\b)|\[(?P<snipname>A-Za-z- /0-9+)(\|(?P<sniplabel>.+?))?\]))''' simply removing the whole (?P<camelcase> ...) part should do the trick ..
i fear this is not really easy to implement .. but i've created an issue for it so i don't forget ..
well .. you would simply need to add sphblog to your applications, run syncdb .. and create a new forum category with the category type 'sphblog' but... i haven't committed all the templates for my "blog" if i remember correctly .. it should work with the default templates.. but i'm not sure how good it will look .. let me know if you have luck trying it ..
Currently it would display threads from _all_ forum categories with the type 'sphblog' .. so a few modifications would probably be necessary .. but all in all .. it is probably very easy to add .. the question is .. how much separation you have between each news section ? if they are completely separated.. (like separated (sub)domains) you could use separate community Group's .. if the "sections" are pretty close you might think about using Tags instead of categories to separate those sections ? (as a side note... i haven't had time yet to implement tagging of blog/forum posts :( )
it should be quite easy to integrate it with SCT .. you say .. you'll have rich news.. how do you plan on integrating this content into the UI ? let the users link to all those contents, or provide a specialized facility to let users upload videos/images/.. ? because if you trust your users.. and allow them to do everything they want (without a specialized form) you could create a new custom forum markup so users would simply enter HTML - and with a few additional modifications you could display a TinyMCE or similar in the 'new thread/news'-form .. Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Herbert Poul |
|
fyi: i've just fixed the escaping of the annotations and committed your image macro change :) Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Roberto Maurizzi |
|
Hi!
I didn't have too much free time in the last week between the "surprise" general election in April and some work related problems (like antivirus killing 15 servers at a customer site >___< ) I've seen that if I use bbcode in the forum posts, I can show images, but I lose the ability to place them correctly. Using markdown the img macro doesn't work for the boards' posts. I've tried to use sphblog but I fear my understanding of django is still too scarce :-/ I wasn't able to define a url that calls sphblog.* I must miss some very important and very basic django urls.py notion ^_^;;; However, the idea of a "raw html" markup with a rich editor is really nice and fit my needs quite well :-) I'm also thinking of adding a class="bbimage" attribute to img tags generated from bbcode, so that I can have a little more control on them very "cheaply". I know, I should study more but I won't have the time in the near future. Ciao, Roberto Roberto Maurizzi |
Please login to post a reply.