summaryrefslogtreecommitdiffstats
path: root/scilab
diff options
context:
space:
mode:
authorPierre MARECHAL <pierre.marechal@scilab.org>2010-05-17 12:06:31 +0200
committerClément DAVID <clement.david@scilab.org>2010-05-20 15:52:47 +0200
commit4c2ddb30796f387ea7c195946dc18186809119a4 (patch)
tree80671d72ca9634627d4c5fce35f2127cae432a1a /scilab
parent460a8d33ac11194d4a9f1e66cb7cee2fdec8bf60 (diff)
downloadscilab-4c2ddb30796f387ea7c195946dc18186809119a4.zip
scilab-4c2ddb30796f387ea7c195946dc18186809119a4.tar.gz
Factorize code
Change-Id: Id27f450653be5fc8941795e150025b40ddaa0527
Diffstat (limited to 'scilab')
-rw-r--r--scilab/modules/atoms/macros/atoms_gui/cbAtomsGui.sci69
1 files changed, 34 insertions, 35 deletions
diff --git a/scilab/modules/atoms/macros/atoms_gui/cbAtomsGui.sci b/scilab/modules/atoms/macros/atoms_gui/cbAtomsGui.sci
index 1872e39..0bf0dc6 100644
--- a/scilab/modules/atoms/macros/atoms_gui/cbAtomsGui.sci
+++ b/scilab/modules/atoms/macros/atoms_gui/cbAtomsGui.sci
@@ -210,36 +210,32 @@ function updateDescFrame()
210 thisModuleDetails = thisModuleStruct(MRVersionAvailable); 210 thisModuleDetails = thisModuleStruct(MRVersionAvailable);
211 end 211 end
212 212
213 // Manage size 213 // Download Size
214 // ========================================================================= 214 // =========================================================================
215 215
216 sizeHTML = "";
217
216 if isfield(thisModuleDetails,OSNAME+ARCH+"Size") then 218 if isfield(thisModuleDetails,OSNAME+ARCH+"Size") then
217 sizeHTML = .. 219 sizeHTML = txt2title(gettext("Download size")) ..
218 "<div style=""font-weight:bold;margin-top:10px;margin-bottom:5px;"">" + .. 220 + "<div>" ..
219 gettext("Download size") + .. 221 + atomsSize2human(thisModuleDetails(OSNAME+ARCH+"Size")) ..
220 "</div>" + .. 222 + "</div>";
221 "<div>" + ..
222 atomsSize2human(thisModuleDetails(OSNAME+ARCH+"Size")) + ..
223 "</div>";
224 else
225 sizeHTML = "";
226 end 223 end
227 224
228 // Manage authors 225 // Authors
229 // ========================================================================= 226 // =========================================================================
230 227
231 authorMat = thisModuleDetails.Author; 228 authorMat = thisModuleDetails.Author;
232 229 authorHTML = "";
233 authorHTML = "<div style=""font-weight:bold;margin-top:10px;margin-bottom:5px;"">" + ..
234 gettext("Author(s)") + ..
235 "</div>" + ..
236 "<div>";
237 230
238 for i=1:size(authorMat,"*") 231 for i=1:size(authorMat,"*")
239 authorHTML = authorHTML + authorMat(i)+"<br>"; 232 authorHTML = authorHTML + authorMat(i)+"<br>";
240 end 233 end
241 234
242 authorHTML = authorHTML + "</div>"; 235 authorHTML = txt2title(gettext("Author(s)")) ..
236 + "<div>" ..
237 + authorHTML
238 + "</div>";
243 239
244 // URLs (See also) 240 // URLs (See also)
245 // ========================================================================= 241 // =========================================================================
@@ -257,33 +253,28 @@ function updateDescFrame()
257 253
258 if ~isempty(URLs) then 254 if ~isempty(URLs) then
259 255
260 seeAlsoHTML = "<div style=""font-weight:bold;margin-top:10px;margin-bottom:5px;"">" + ..
261 gettext("See also") + ..
262 "</div>" + ..
263 "<div>";
264
265 for i=1:size(URLs,"*") 256 for i=1:size(URLs,"*")
266 seeAlsoHTML = seeAlsoHTML + "&nbsp;&bull;&nbsp;"+URLs(i)+"<br>"; 257 seeAlsoHTML = seeAlsoHTML + "&nbsp;&bull;&nbsp;"+URLs(i)+"<br>";
267 end 258 end
268 259
269 seeAlsoHTML = seeAlsoHTML + "</div>"; 260 seeAlsoHTML = txt2title(gettext("See also"))..
270 261 + "<div>" ..
262 + seeAlsoHTML ..
263 + "</div>";
271 end 264 end
272 265
273 // Release date 266 // Release date
274 // ========================================================================= 267 // =========================================================================
275 268
269 dateHTML = "";
270
276 if isfield(thisModuleDetails,"Date") .. 271 if isfield(thisModuleDetails,"Date") ..
277 & ~isempty(regexp(thisModuleDetails.Date,"/^[0-9]{4}-[0-1][0-9]-[0-3][0-9]\s/")) then 272 & ~isempty(regexp(thisModuleDetails.Date,"/^[0-9]{4}-[0-1][0-9]-[0-3][0-9]\s/")) then
278 273
279 dateHTML = "<div style=""font-weight:bold;margin-top:10px;margin-bottom:5px;"">" .. 274 dateHTML = txt2title(gettext("Release date")) ..
280 + gettext("Release date") ..
281 + "</div>" ..
282 + "<div>" .. 275 + "<div>" ..
283 + part(thisModuleDetails.Date,1:10) .. 276 + part(thisModuleDetails.Date,1:10) ..
284 + "</div>"; 277 + "</div>";
285 else
286 dateHTML = "";
287 end 278 end
288 279
289 // Build and Set the HTML code 280 // Build and Set the HTML code
@@ -292,14 +283,10 @@ function updateDescFrame()
292 283
293 htmlcode = "<html>" + .. 284 htmlcode = "<html>" + ..
294 "<body>" + .. 285 "<body>" + ..
295 "<div style=""font-weight:bold;margin-top:10px;margin-bottom:5px;"">" + .. 286 txt2title(gettext("Version")) + ..
296 gettext("Version") + ..
297 "</div>" + ..
298 "<div>" + thisModuleDetails.Version + "</div>" + .. 287 "<div>" + thisModuleDetails.Version + "</div>" + ..
299 authorHTML + .. 288 authorHTML + ..
300 "<div style=""font-weight:bold;margin-top:10px;margin-bottom:5px;"">" + .. 289 txt2title(gettext("Description")) + ..
301 gettext("Description") + ..
302 "</div>" + ..
303 "<div>" + .. 290 "<div>" + ..
304 strcat(thisModuleDetails.Description,"<br>") + .. 291 strcat(thisModuleDetails.Description,"<br>") + ..
305 "</div>" + .. 292 "</div>" + ..
@@ -523,3 +510,15 @@ function txtout = processHTMLLinks(txtin)
523 end 510 end
524 511
525endfunction 512endfunction
513
514// =============================================================================
515// txt2title
516// =============================================================================
517
518function txtout = txt2title(txtin)
519
520 txtout = "<div style=""font-weight:bold;margin-top:10px;margin-bottom:3px;"">" + ..
521 txtin + ..
522 "</div>";
523
524endfunction