Is there a way to override the content of notification email from a test case update in Kiwi TCMS? - django

Im trying to change the content of the notification email sent after a test case has been updated to better clarify what has been changed. As it is, the content is hard to read.
Went through the link below to configure the other notification content:
http://kiwitcms.org/blog/atodorov/2018/08/06/how-to-override-templates-for-kiwi-tcms/
The content of the notification email:
Updated on Tue Aug 20 15:47:18 2019
Updated by Admin
--- notes
+++ notes
## -1 +1 ##
-TestTest
+TestTest123123
--- text
+++ text
## -10,7 +10,7 ##
3. item
*Expected results*:
-
+Test
1. item
2. item
3. item
I managed to replicate the example (from the link) for post_case_delete, post_run_save, and user_registered but the dir(tcms/templates/email/) lacks one for test case updates.
EDIT: It seems that adding dir and txt files for the others will undo the changes made to confirm_registration.
Is there a way to amend how the content is shown in the notification email?

Im trying to change the content of the notification email sent after a test case has been updated to better clarify what has been changed.
The link you've posted shows how to override templates (HTML, email, any kind of templates). However what context (e.g. which variables) get passed down to the template is up to the backend functions rendering that particular template.
As it is, the content is hard to read.
We thought diff is a pretty universal format but if you have other suggestions the best way is to start with opening an issue with examples, maybe a POC pull request.
In this particular example change history is automatically generated so any change will likely affect everything which deals with history but we need to see examples to comment further.
EDIT: It seems that adding dir and txt files for the others will undo the changes made to confirm_registration.
This is unrelated to the original question. Again I will have to see what exactly you are doing to tell you if/where the mistake is. The template engine in Django is trying to use the first template with a given name it finds. The search directory path tells it where to look for these templates. If you are somehow obscuring the files from the blog post then the application will not be able to find them hence you are not seeing the overriden changes you expect to.
Also follow https://github.com/kiwitcms/Kiwi/issues/1076 (not directly related but in the same domain space).

Related

how can I enable Markdown in fossil tickets

Fossil docs says that markdown can be used in tickets as well. But I do not manage to turn it on.
https://www.fossil-scm.org/xfer/tktview/35343257ffd02ba47880 reports a similar problem.
I read a solution in the Fossil-scm mail list but I cannot find the exact email now. However I put my TH1 templates for ticket in the following snippet:
https://bitbucket.org/snippets/ivzhh/GeL9pq
The basic idea is to set $mutype to markdown (x-markdown or x-fossil-markdown). Then add the redering code on line 75~82 in ticket-edit.tcl (the original solution is this post). The markdown rendering returns two values instead of one (default fossil wiki command). Please check the snippet.
I managed to get it work and have created a fossil repository with the three templates I created a repository with the patches on https://chiselapp.com/user/bwl21/repository/fossil-markdown-patches. The repository holds the files but also has applied the same in the configuration such that you can see how it works.
Thanks to #etc-100g

opencart: I can edit order but cannot delete it. (with Error log)

I use opencart version 2.1.0.1
Everytime I click admin > sales > order, it will pop up "error undefined." By closing that popup window, I can still edit order but cannot delete order (no response).
In my log, there is:
PHP Notice: Undefined variable: order_id in
/var/www/html/opencart2101/system/storage/modification/admin/view/template/sale/order_list.tpl on line 821
The line 821 is:
url: 'index.php?route=extension/openbay/addorderinfo&token=<?php echo $token; ?>&order_id=<?php echo $order_id; ?>&status_id=' + status_id,
However, I haven't installed any openbay related module. Also, line 821 is inside <!-- --> mark. It should have no effect.
Help!
Although this is now an older version of opencart, I still see this being reported a lot around and about.
The problem occurs due to the store front adding the http url rather than the https url to the order. So firstly you need to fix that. If you dont want to read all of my explanation, you can just hit up the bold points :)
Either way BACKUP EVERYTHING actually not really, back up the file you are going to edit and backup your whole database.
open:
catalog/controller/checkout/confirm.php at around line 100
Find:
$order_data['store_url'] = HTTP_SERVER;
Change to:
$order_data['store_url'] = HTTPS_SERVER;
Now you will want to fix your database because for reasons I cannot fathom, the domain name is placed in the order along with the stores id. and when editing orders it is the usage of that directly within your admin order page that throws up the undefined notice. Basically the browser blocks the request because its trying to make an insecure request from a secure page.
Crack open phpmyadmin or whatever database tool you have on hand.
locate the table, default is oc_orders
Browsing the table, look for the column that contains your store url (i cant remember the name off hand, i think its just store_url but it will be obvious anyway. if you are multi store you will need to run the query for each
I am sure somebody can come up with a clever way to automatically convert just the http into https with a single use sql query on the one column, but this works for me.
Run SQL: adjust as appropriate
UPDATE `oc_orders` SET `store_url` = 'https://example.com' WHERE store_id = 0;

django - ckeditor bug renders text/string in raw html format

am using django ckeditor. Any text/content entered into its editor renders raw html output on the webpage.
for ex: this is rendered output of ckeditor field (RichTextField) on a webpage;
<p><span style="color:rgb(0, 0, 0)">this is a test file ’s forces durin</span><span style="color:rgb(0, 0, 0)">galla’s good test is one that fails Thereafter, never to fail in real environment. </span></p>
I have been looking for a solution for a long time now but unable to find one :( There are some questions which are similar but none of those have been able to help. It will be helpful if any changes suggested are provided with the exact location where it needs to be changed. Needless to say I am a newbie.
Thanks
You need to mark the relevant variable that contains the html snippet in your template as safe
Obviously you should be sure, that the text comes from trusted users and is safe, because with the safe filter you are disabling a security feature (autoescaping) that Django applies per default.
If your ckeditor is part of a comment form and your mark the entered text as safe, anybody with access to the form could inject Javascipt and other (potentially nasty) stuff in your page.
The whole story is explained pretty well in the official docs: https://docs.djangoproject.com/en/dev/topics/templates/#automatic-html-escaping

linking to cfml code ala jsfiddle

ok so i'm working on a new version of cflive.net and one of the features is to link to code.
I am using jsfiddle.net as my inspiration for the new site.
Now with jsfiddle all the code runs in the client, so it is not a problem for other people to edit it.
But with CFML obviously the files need to be saved on the server first, which means the original file would get overwritten if anyone makes any changes, which is obviously going to be problematic as the original author may not want his files to get edited, so I am looking for some feedback/suggestions on what would be the best way to handle this.
My best idea so far is.
All files are stored in a unique folder using a JsessionID
e.g. anonymous files
/jsessionid/filename.cfm
or user files
/user/jsessionid/filename.cfm
the original author marks the files as editable or not. You must register and be logged in to have this control.
Files created anonymously (not logged in) can be edited as default.
If the file is editable then it can be edited, otherwise it gets duplicated for each new session.
Anonymous sessions get deleted if they have not been access for 90 days.
thoughts?

Django giving user the ability to manage files/images

I need help understanding hot to go about giving my users the ability to upload and remove files in the same form.
Is there a demo some were i can find?
It seems a pretty redundant task but i cant find a documentation on that.
Not talking about admin.
Thanks.
Not sure what you mean by 'in the same form'. Do you want to upload a new file while marking a already uploaded file as to-be-deleted?
You could put a list of existing files as MultipleChoiceField underneath your FileField and delete whichever the user selected as part of your form processing.
There is also a whole lot of 3rd party packages which might suit your needs:
https://www.djangopackages.com/grids/g/file-managers/
Since I can't comment yet.
You probably want to solve it with ajax requests
[___newfile.txt___] [browse] [add] --POST--> /add
- File 1 [Trash] --GET--> /delete/1
- File 2 [Trash]
- File 3 [Trash]
- File 1 [Trash]
I've created a demo project to show how this works.
You can find it at https://github.com/trostik/djangoimagemanage
Hope it helps some one.
Cheers