{"id":153,"date":"2011-09-26T13:12:43","date_gmt":"2011-09-26T17:12:43","guid":{"rendered":"http:\/\/www.jetmore.org\/john\/blog\/?p=153"},"modified":"2012-05-08T13:47:44","modified_gmt":"2012-05-08T17:47:44","slug":"setting-default-font-in-testlink","status":"publish","type":"post","link":"https:\/\/www.jetmore.org\/john\/blog\/2011\/09\/setting-default-font-in-testlink\/","title":{"rendered":"Setting Default Font in TestLink"},"content":{"rendered":"<p>When I first set up TestLink, one of my first actions was to figure out how to force FCKEditor to use a monospace font. Much of our testing takes place in terminals using a monospace font, and I thought it would be easier to engage with the expected results if they were also in a monospace font. This was a fairly easy thing to do using the TestLink and FCKEditor docs, but since I haven&#8217;t written it down before, here are the steps using a monospace font by default in TestLink using FCKEditor.<\/p>\n<blockquote><p><strong>Update 2012-05-08<\/strong>: There is a usable-with-the-patch-command <a href=\"https:\/\/github.com\/jetmore\/TestLink-Misc\/blob\/master\/patches\/ui-tweaks.patch\">patch available<\/a> that incorporates all of these changes and more.  See the <a href=\"https:\/\/github.com\/jetmore\/TestLink-Misc\">README at the base of the github repo<\/a> for more details on what&#8217;s in that patch.\n<\/p><\/blockquote>\n<p>First, create a file called custom_textarea.css. I placed this in the root of my install, which probably wasn&#8217;t the best place for it. The contents are a lightly edited copy of body class from gui\/themes\/default\/css\/testlink.css:<\/p>\n<pre class=\"brush: css; title: custom_textarea.css; notranslate\" title=\"custom_textarea.css\">\r\nbody {\r\n    background:     #FFF;\r\n    font-family:    'Courier New', 'Trebuchet MS', Arial, Verdana, sans-serif;\r\n    font-size:      small;\r\n    margin:         0px;\r\n    padding:        0px;\r\n}\r\n<\/pre>\n<p>The &#8220;light editing&#8221; I did was to push &#8216;Courier New&#8217; onto the front of the font-family. \u00a0I also changed it so that the edit window background would be white instead of grey by changing the background color.<\/p>\n<p>Then I told FCKEditor to use this CSS as the style for the edit boxes by adding the following line to cfg\/tl_fckeditor_config.js:<\/p>\n<pre class=\"brush: jscript; title: cfg\/tl_fckeditor_config.js; notranslate\" title=\"cfg\/tl_fckeditor_config.js\">\r\n\/\/ Set our own custom css (sets white background and mono-space font)\r\nFCKConfig.EditorAreaCSS = FCKConfig.BasePath + '..\/..\/..\/custom_textarea.css';\r\n<\/pre>\n<p>This did accomplish the task that I had set for myself, which was changing the default font displayed by FCKEditor when editing text. \u00a0However, I also assumed that it would, when the text in the editor was saved, cause that saved text to be displayed in a monospace font. \u00a0It turns out that this didn&#8217;t work though. \u00a0I can&#8217;t decide if this is a bug in TestLink or not, but these defaults don&#8217;t get applied when the text is displayed.<\/p>\n<p>I spent quite a bit of time looking for the correct knob to fix this in the TestLink docs and the FCKEditor docs, and I couldn&#8217;t find one. \u00a0Font editing works, but you have to explicitly change the font option while editing to make it work.<\/p>\n<p>What I ended up doing was to edit the two Smarty templates used for displaying steps so that each action and step were wrapped in a div I could control, and then changed the style for that div so that the default font was monospaced. \u00a0In a way this was actually a better solution than a general FCKEditor knob because it allowed me to just change the default font in action\/expected results, and not other text, like Summary, that might look better as a variable-width font.<\/p>\n<p>To achieve this I first added two new classes to gui\/themes\/default\/css\/custom.css. \u00a0This could have been done with just one class, but I liked the idea of being able to change the style of actions and results independently in the future.<\/p>\n<pre class=\"brush: css; title: gui\/themes\/default\/css\/custom.css; notranslate\" title=\"gui\/themes\/default\/css\/custom.css\">\r\ndiv.c_actions, div.c_expected_results {\r\n    font-family: 'Courier New', Courier, monospace;\r\n}\r\n<\/pre>\n<p>Then I added the class to inc_steps.tpl and tcStepEdit.tpl.<\/p>\n<pre class=\"brush: diff; title: gui\/templates\/testcases\/inc_steps.tpl; notranslate\" title=\"gui\/templates\/testcases\/inc_steps.tpl\">\r\n--- inc_steps.tpl.dist  2011-08-22 21:08:21.000000000 -0500\r\n+++ inc_steps.tpl       2011-09-26 09:42:25.000000000 -0500\r\n@@ -53,10 +53,10 @@\r\n                                size=&quot;{#STEP_NUMBER_SIZE#}&quot;\r\n                                maxlength=&quot;{#STEP_NUMBER_MAXLEN#}&quot;&gt;\r\n                        {include file=&quot;error_icon.tpl&quot; field=&quot;step_number&quot;}\r\n                        &lt;\/span&gt;{$step_info.step_number}\r\n                &lt;\/td&gt;\r\n-               &lt;td {if $edit_enabled} style=&quot;cursor:pointer;&quot; onclick=&quot;launchEditStep({$step_info.id})&quot; {\/if}&gt;{$step_info.actions}&lt;\/td&gt;\r\n-               &lt;td {if $edit_enabled} style=&quot;cursor:pointer;&quot; onclick=&quot;launchEditStep({$step_info.id})&quot; {\/if}&gt;{$step_info.expected_results}&lt;\/td&gt;\r\n+               &lt;td {if $edit_enabled} style=&quot;cursor:pointer;&quot; onclick=&quot;launchEditStep({$step_info.id})&quot; {\/if}&gt;&lt;div class=&quot;c_actions&quot;&gt;{$step_info.actions}&lt;\/div&gt;&lt;\/td&gt;\r\n+               &lt;td {if $edit_enabled} style=&quot;cursor:pointer;&quot; onclick=&quot;launchEditStep({$step_info.id})&quot; {\/if}&gt;&lt;div class=&quot;c_expected_results&quot;&gt;{$step_info.expected_results}&lt;\/div&gt;&lt;\/td&gt;\r\n                {if $session['testprojectOptions']-&gt;automationEnabled}\r\n                &lt;td {if $edit_enabled} style=&quot;cursor:pointer;&quot; onclick=&quot;launchEditStep({$step_info.id})&quot; {\/if}&gt;{$gui-&gt;execution_types[$step_info.execution_type]}&lt;\/td&gt;\r\n                {\/if}\r\n<\/pre>\n<pre class=\"brush: diff; title: gui\/templates\/testcases\/tcStepEdit.tpl; notranslate\" title=\"gui\/templates\/testcases\/tcStepEdit.tpl\">\r\n--- tcStepEdit.tpl.dist 2011-09-22 10:27:23.000000000 -0500\r\n+++ tcStepEdit.tpl      2011-09-26 09:43:47.000000000 -0500\r\n@@ -211,8 +211,8 @@\r\n        {\/if}\r\n       {else}\r\n         &lt;td style=&quot;text-align:left;&quot;&gt;&lt;a href=&quot;{$hrefEditStep}{$step_info.id}&quot;&gt;{$step_info.step_number}&lt;\/a&gt;&lt;\/td&gt;\r\n-               &lt;td &gt;&lt;a href=&quot;{$hrefEditStep}{$step_info.id}&quot;&gt;{$step_info.actions}&lt;\/a&gt;&lt;\/td&gt;\r\n-               &lt;td &gt;&lt;a href=&quot;{$hrefEditStep}{$step_info.id}&quot;&gt;{$step_info.expected_results}&lt;\/a&gt;&lt;\/td&gt;\r\n+               &lt;td &gt;&lt;a href=&quot;{$hrefEditStep}{$step_info.id}&quot;&gt;&lt;div class=&quot;c_actions&quot;&gt;{$step_info.actions}&lt;\/div&gt;&lt;\/a&gt;&lt;\/td&gt;\r\n+               &lt;td &gt;&lt;a href=&quot;{$hrefEditStep}{$step_info.id}&quot;&gt;&lt;div class=&quot;c_expected_results&quot;&gt;{$step_info.expected_results}&lt;\/div&gt;&lt;\/a&gt;&lt;\/td&gt;\r\n         {if $session['testprojectOptions']-&gt;automationEnabled}\r\n                  &lt;td&gt;&lt;a href=&quot;{$hrefEditStep}{$step_info.id}&quot;&gt;{$gui-&gt;execution_types[$step_info.execution_type]}&lt;\/a&gt;&lt;\/td&gt;\r\n                {\/if}\r\n<\/pre>\n<p>These aren&#8217;t exactly what my diffs look like since I <a href=\"https:\/\/www.jetmore.org\/john\/blog\/2011\/09\/better-copypaste-when-editing-test-steps-in-testlink\/\">removed the links from the display text<\/a> last week, but I believe it will work.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When I first set up TestLink, one of my first actions was to figure out how to force FCKEditor to use a monospace font. Much of our testing takes place in terminals using a monospace font, and I thought it &hellip; <a href=\"https:\/\/www.jetmore.org\/john\/blog\/2011\/09\/setting-default-font-in-testlink\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[8,9],"_links":{"self":[{"href":"https:\/\/www.jetmore.org\/john\/blog\/wp-json\/wp\/v2\/posts\/153"}],"collection":[{"href":"https:\/\/www.jetmore.org\/john\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jetmore.org\/john\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jetmore.org\/john\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jetmore.org\/john\/blog\/wp-json\/wp\/v2\/comments?post=153"}],"version-history":[{"count":4,"href":"https:\/\/www.jetmore.org\/john\/blog\/wp-json\/wp\/v2\/posts\/153\/revisions"}],"predecessor-version":[{"id":628,"href":"https:\/\/www.jetmore.org\/john\/blog\/wp-json\/wp\/v2\/posts\/153\/revisions\/628"}],"wp:attachment":[{"href":"https:\/\/www.jetmore.org\/john\/blog\/wp-json\/wp\/v2\/media?parent=153"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jetmore.org\/john\/blog\/wp-json\/wp\/v2\/categories?post=153"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jetmore.org\/john\/blog\/wp-json\/wp\/v2\/tags?post=153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}