Skip to content

Commit 9f818d4

Browse files
committed
refactoring
1 parent 8f910e9 commit 9f818d4

File tree

9 files changed

+186
-145
lines changed

9 files changed

+186
-145
lines changed

gui/templates/tl-classic/platforms/platformsAssign.tpl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ TestLink Open Source Project - http://testlink.sourceforge.net/
33
$Id: platformsAssign.tpl,v 1.7 2010/09/06 15:44:45 erikeloff Exp $
44
Purpose: smarty template - assign platforms to testplans
55
6-
@internal Revisions:
7-
20100906 - eloff - BUGID 3738 - don't allow removing platform with linked TCs
86
*}
7+
{$cfg_section=$smarty.template|basename|replace:".tpl":"" }
8+
{config_load file="input_dimensions.conf" section=$cfg_section}
9+
910
{lang_get var="labels"
1011
s="title_platforms,menu_assign_platform_to_testplan,
1112
platform_unlink_warning_title,platform_unlink_warning_message,
@@ -83,7 +84,8 @@ Purpose: smarty template - assign platforms to testplans
8384
<input type="hidden" name="doAction" value="">
8485
{include file="opt_transfer.inc.tpl" option_transfer=$opt_cfg}
8586
<br />
86-
<input type="submit" name="doAssignPlatforms" value="{$labels.btn_save}"
87+
<input type="submit" class="{#BUTTON_CLASS#}"
88+
name="doAssignPlatforms" value="{$labels.btn_save}"
8789
onclick="doAction.value='doAssignPlatforms'" />
8890
</form>
8991
</div>

gui/templates/tl-classic/platforms/platformsEdit.tpl

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ Purpose: smarty template - Edit a platform
77
{$cfg_section=$smarty.template|basename|replace:".tpl":""}
88
{config_load file="input_dimensions.conf" section=$cfg_section}
99

10-
{$url_args="lib/platforms/platformsEdit.php"}
11-
{$platform_edit_url="$basehref$url_args"}
10+
{$tproj=$gui->tproject_id}
11+
{$manageUrl="lib/platforms/platformsEdit.php?tproject_id=$tproj"}
12+
{$manageUrl="$basehref$manageUrl"}
1213

1314
{lang_get var="labels"
1415
s="warning,warning_empty_platform,show_event_history,
@@ -39,7 +40,7 @@ Purpose: smarty template - Edit a platform
3940
</div><br />
4041

4142
<form id="addPlatform" name="addPlatform" method="post"
42-
action="{$platform_edit_url}">
43+
action="{$manageUrl}">
4344

4445
<table class="common" style="width:50%">
4546
<tr>
@@ -66,16 +67,18 @@ Purpose: smarty template - Edit a platform
6667
{if $gui->enable_on_execution eq 1} checked {/if} />
6768
</td>
6869
</tr>
69-
70-
7170
</table>
7271
<div class="groupBtn">
7372
<input type="hidden" id="doAction" name="doAction" value="" />
74-
<input type="hidden" name="tproject_id" value="{$gui->tproject_id}" />
75-
76-
<input type="submit" id="submitButton" name="submitButton" value="{$gui->submit_button_label}"
73+
<input type="hidden" id="platform_id" name="platform_id"
74+
value="{$gui->platform_id}" />
75+
<input type="submit" class="{#BUTTON_CLASS#}"
76+
id="submitButton" name="submitButton"
77+
value="{$gui->submit_button_label}"
7778
onclick="doAction.value='{$gui->submit_button_action}'" />
78-
<input type="button" id="cancelOp" value="{$labels.btn_cancel}"
79+
80+
<input type="button" class="{#BUTTON_CLASS#}"
81+
id="cancelOp" value="{$labels.btn_cancel}"
7982
onclick="javascript:location.href=fRoot+'lib/platforms/platformsView.php?tproject_id={$gui->tproject_id}'" />
8083
</div>
8184
</form>

gui/templates/tl-classic/platforms/platformsExport.tpl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Purpose: smarty template - platforms export
88
{config_load file="input_dimensions.conf" section=$cfg_section}
99
{include file="inc_head.tpl" openHead="yes" jsValidate="yes"}
1010
{include file="inc_del_onclick.tpl"}
11+
{include file="bootstrap.inc.tpl"}
1112

1213
{lang_get var="labels"
1314
s='btn_export,btn_cancel,warning,export_filename,file_type,
@@ -63,9 +64,11 @@ function validateForm(f) {
6364
value="{$gui->tproject_id}" />
6465

6566
<input type="hidden" name="doAction" id="doAction" value="" />
66-
<input type="submit" name="doExport" id="doExport" value="{$labels.btn_export}"
67-
onclick="doAction.value=this.id" />
68-
<input type="button" name="cancel" value="{$labels.btn_cancel}"
67+
<input type="submit" class="{#BUTTON_CLASS#}" role="button"
68+
name="doExport" id="doExport" value="{$labels.btn_export}"
69+
onclick="doAction.value=this.id" />
70+
<input type="button" class="{#BUTTON_CLASS#}"
71+
name="cancel" value="{$labels.btn_cancel}"
6972
{if $gui->goback_url != ''} onclick="location='{$gui->goback_url}'"
7073
{else} onclick="javascript:history.back();" {/if} />
7174
</div>

gui/templates/tl-classic/platforms/platformsImport.tpl

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,21 @@ Purpose: smarty template - manage import of platforms
55
66
*}
77

8+
{$cfg_section=$smarty.template|basename|replace:".tpl":"" }
9+
{config_load file="input_dimensions.conf" section=$cfg_section}
10+
811
{lang_get var="labels"
912
s='file_type,view_file_format_doc,local_file,warning,
1013
max_size_cvs_file1,max_size_cvs_file2,btn_upload_file,
1114
btn_goback,not_imported,warning_empty_filename,
1215
imported,btn_cancel'}
1316

14-
{$cfg_section=$smarty.template|basename|replace:".tpl":"" }
15-
{config_load file="input_dimensions.conf" section=$cfg_section}
17+
1618

1719
{include file="inc_head.tpl" openHead="yes" jsValidate="yes"}
1820
{include file="inc_del_onclick.tpl"}
21+
{include file="bootstrap.inc.tpl"}
22+
1923
<script type="text/javascript">
2024
var alert_box_title = "{$labels.warning|escape:'javascript'}";
2125
var warning_empty_filename = "{$labels.warning_empty_filename|escape:'javascript'}";
@@ -55,7 +59,8 @@ function validateForm(f)
5559
{/if}
5660
<form method="post" action="{$SCRIPT_NAME}">
5761
<br />
58-
<input type="button" name="goback" value="{$labels.btn_goback}"
62+
<input type="button" class="{#BUTTON_CLASS#}"
63+
name="goback" value="{$labels.btn_goback}"
5964
{if $gui->goback_url != ''} onclick="location='{$gui->goback_url}'"
6065
{else} onclick="javascript:history.back();" {/if} />
6166
</form>
@@ -85,9 +90,11 @@ function validateForm(f)
8590
<input type="hidden" name="tproject_id" id="tproject_id" value="{$gui->tproject_id}" />
8691
<input type="hidden" name="doAction" id="doAction" value="doImport" />
8792
<input type="hidden" name="goback_url" value="{ $gui->goback_url|escape}" />
88-
<input type="submit" name="UploadFile" value="{$labels.btn_upload_file}" />
89-
<input type="button" name="cancel" value="{$labels.btn_cancel}"
90-
{if $gui->goback_url != ''} onclick="location='{$gui->goback_url}'"
93+
<input type="submit" class="{#BUTTON_CLASS#}"
94+
name="UploadFile" value="{$labels.btn_upload_file}" />
95+
<input type="button" class="{#BUTTON_CLASS#}"
96+
name="cancel" value="{$labels.btn_cancel}"
97+
{if $gui->goback_url != ''} onclick="location='{$gui->goback_url}'"
9198
{else} onclick="javascript:history.back();" {/if} />
9299
</div>
93100
</form>

gui/templates/tl-classic/platforms/platformsView.tpl

Lines changed: 74 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,21 @@ Purpose: smarty template - View all platforms
2929
{$tprjid=$gui->tproject_id}
3030
{$managerURL="lib/platforms/platformsEdit.php?tproject_id=$tprjid"}
3131
{$viewAction="lib/platforms/platformsView.php?tproject_id=$tprjid"}
32+
33+
{$managerAction="$basehref$managerURL"}
34+
35+
{$createAction="$managerAction&doAction=create"}
36+
3237
{$dummy="lib/platforms/platformsImport.php?tproject_id="}
3338
{$importAction="$basehref$dummy$tprjid"}
3439

40+
{$dummy="lib/platforms/platformsExport.php?tproject_id="}
41+
{$exportAction="$basehref$dummy$tprjid"}
42+
3543
<script type="text/javascript">
3644
<!--
3745
/* All this stuff is needed for logic contained in inc_del_onclick.tpl */
38-
var del_action=fRoot+'{$managerURL}'+'&action=do_delete&id=';
46+
var del_action=fRoot+'{$managerURL}'+'&doAction=do_delete&id=';
3947
//-->
4048
</script>
4149

@@ -47,90 +55,95 @@ var del_action=fRoot+'{$managerURL}'+'&action=do_delete&id=';
4755
<div class="page-content">
4856
{if $gui->platforms != ''}
4957
<form method="post" id="platformsView"
50-
name="platformsView" action="{$managerURL}">
51-
<input type="hidden" name="action" id="action" value="">
58+
name="platformsView" action="{$managerAction}">
59+
60+
<!-- this will be setted by the onclick -->
61+
<input type="hidden" name="doAction" id="doAction" value="">
62+
5263
<input type="hidden" name="platform_id" id="platform_id" value="">
5364
<input type="hidden" name="tplan_id" id="tplan_id" value="{$gui->tplan_id}">
5465
<table class="table table-bordered sortable">
55-
<thead class="thead-dark">
56-
<tr>
57-
<th width="30%">{$tlImages.toggle_api_info}{$tlImages.sort_hint}{$labels.th_platform}</th>
58-
<th>{$tlImages.sort_hint}{$labels.th_notes}</th>
59-
<th>{$labels.on_design}</th>
60-
<th>{$labels.on_exec}</th>
61-
{if $gui->canManage != ""}
62-
<th class="{$noSortableColumnClass}" width="10%">{$labels.th_delete}</th>
63-
{/if}
64-
</tr>
65-
</thead>
66-
{* <tbody> *}
67-
{section name=platform loop=$gui->platforms}
68-
{$oplat=$gui->platforms[platform]}
69-
<tr>
70-
<td>
71-
<span class="api_info" style='display:none'>{$tlCfg->api->id_format|replace:"%s":$oplat.id}</span>
72-
{if $gui->canManage != ""}
73-
<a href="{$managerURL}&action=edit&id={$oplat.id}">
74-
{/if}
75-
{$oplat.name|escape}
76-
{if $gui->canManage != ""}
77-
</a>
78-
{/if}
79-
</td>
80-
{* when using rich webeditor strip_tags is needed *}
81-
<td>{if $gui->editorType == 'none'}{$oplat.notes|nl2br}{else}{$oplat.notes|strip_tags|strip|truncate:#PLATFORM_NOTES_TRUNCATE_LEN#}{/if}</td>
82-
<td class="clickable_icon">
83-
{if $oplat.enable_on_design==1}
84-
<input type="image" style="border:none"
66+
<thead class="thead-dark">
67+
<tr>
68+
<th width="30%">{$tlImages.toggle_api_info}{$tlImages.sort_hint}{$labels.th_platform}</th>
69+
<th>{$tlImages.sort_hint}{$labels.th_notes}</th>
70+
<th>{$labels.on_design}</th>
71+
<th>{$labels.on_exec}</th>
72+
{if $gui->canManage != ""}
73+
<th class="{$noSortableColumnClass}"
74+
width="10%">{$labels.th_delete}
75+
</th>
76+
{/if}
77+
</tr>
78+
</thead>
79+
{section name=platform loop=$gui->platforms}
80+
{$oplat=$gui->platforms[platform]}
81+
<tr>
82+
<td>
83+
<span class="api_info" style='display:none'>{$tlCfg->api->id_format|replace:"%s":$oplat.id}</span>
84+
{if $gui->canManage != ""}
85+
<a href="{$managerURL}&doAction=edit&id={$oplat.id}">
86+
{/if}
87+
{$oplat.name|escape}
88+
{if $gui->canManage != ""}
89+
</a>
90+
{/if}
91+
</td>
92+
{* when using rich webeditor strip_tags is needed *}
93+
<td>{if $gui->editorType == 'none'}{$oplat.notes|nl2br}{else}{$oplat.notes|strip_tags|strip|truncate:#PLATFORM_NOTES_TRUNCATE_LEN#}{/if}</td>
94+
<td class="clickable_icon">
95+
{if $oplat.enable_on_design==1}
96+
<input type="image" style="border:none"
8597
id="disableDesign_{$oplat.id}"
8698
name="disableDesign"
8799
title="{$labels.active_click_to_change}" alt="{$labels.active_click_to_change}"
88-
onClick = "platform_id.value={$oplat.id};action.value='enableDesign';"
100+
onClick = "platform_id.value={$oplat.id};doAction.value='disableDesign';"
89101
src="{$tlImages.on}"/>
90-
{else}
91-
<input type="image" style="border:none"
102+
{else}
103+
<input type="image" style="border:none"
92104
id="enableDesign_{$oplat.id}"
93105
name="enableDesign"
94106
title="{$labels.inactive_click_to_change}" alt="{$labels.inactive_click_to_change}"
95-
onClick = "action.value='enableDesign';platform_id.value={$oplat.id};"
107+
onClick = "doAction.value='enableDesign';platform_id.value={$oplat.id};"
96108
src="{$tlImages.off}"/>
97-
{/if}
98-
</td>
99-
<td class="clickable_icon">
100-
{if $oplat.enable_on_execution==1}
101-
<input type="image" style="border:none"
109+
{/if}
110+
</td>
111+
<td class="clickable_icon">
112+
{if $oplat.enable_on_execution==1}
113+
<input type="image" style="border:none"
102114
id="disableExec_{$oplat.id}"
103115
title="{$labels.active_click_to_change}" alt="{$labels.active_click_to_change}"
104-
onClick = "action.value='disableExec';platform_id.value={$oplat.id};"
116+
onClick = "doAction.value='disableExec';platform_id.value={$oplat.id};"
105117
src="{$tlImages.on}"/>
106-
{else}
107-
<input type="image" style="border:none"
118+
{else}
119+
<input type="image" style="border:none"
108120
id="enableExec_{$oplat.id}"
109121
title="{$labels.inactive_click_to_change}" alt="{$labels.inactive_click_to_change}"
110-
onClick = "action.value='enableExec';platform_id.value={$oplat.id};"
122+
onClick = "doAction.value='enableExec';platform_id.value={$oplat.id};"
111123
src="{$tlImages.off}"/>
112-
{/if}
113-
</td>
114-
{if $gui->canManage != ""}
115-
<td class="clickable_icon">
116-
{if $oplat.linked_count eq 0}
117-
<img style="border:none;cursor: pointer;" alt="{$labels.alt_delete_platform}"
124+
{/if}
125+
</td>
126+
{if $gui->canManage != ""}
127+
<td class="clickable_icon">
128+
{if $oplat.linked_count eq 0}
129+
<img style="border:none;cursor: pointer;" alt="{$labels.alt_delete_platform}"
118130
title="{$labels.alt_delete_platform}" src="{$tlImages.delete}"
119131
onclick="delete_confirmation({$oplat.id},
120132
'{$oplat.name|escape:'javascript'|escape}', '{$del_msgbox_title|escape:'javascript'}','{$warning_msg|escape:'javascript'}');" />
121-
{else}
122-
<img style="border:none;cursor: pointer;" alt="{$labels.alt_delete_platform}"
133+
{else}
134+
<img style="border:none;cursor: pointer;"
135+
alt="{$labels.alt_delete_platform}"
123136
title="{$labels.alt_delete_platform}" src="{$tlImages.delete_disabled}"
124137
onclick="alert_message_html('{$del_msgbox_title|escape:'javascript'}','{$warning_msg_cannot_del|replace:'%s':$oplat.name|escape:'javascript'}');" />
125-
{/if}
126-
</td>
127-
{/if}
128-
</tr>
129-
{/section}
130-
{* </tbody> *}
138+
{/if}
139+
</td>
140+
{/if}
141+
</tr>
142+
{/section}
131143
</table>
132-
{/if}
144+
{/if}
133145

146+
<!-- controls -->
134147
{include file="platforms/{$tplBN}Controls.inc.tpl" suffix="Bottom"}
135148
</div>
136149
</form>
Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,18 @@
11
{*
22
TestLink Open Source Project - http://testlink.sourceforge.net/
3-
@filesource cfieldsViewControl.inc.tpl
3+
@filesource platformsViewControls.inc.tpl
44
*}
55
<div class="page-content">
6-
<form style="float:left" name="platform_view" id="platform_view"
7-
method="post" action="lib/platforms/platformsEdit.php">
8-
<input type="hidden" name="doAction" value="" />
9-
<input type="hidden" name="tproject_id" value="{$gui->tproject_id}" />
10-
{if '' != $gui->canManage}
11-
<input class="btn btn-primary" role="button"
12-
type="submit"
13-
id="create_platform" name="create_platform" value="{$labels.btn_create}"
14-
onclick="doAction.value='create'"/>
15-
{/if}
16-
</form>
17-
<form name="platformsExport" id="platformsExport" method="post"
18-
action="lib/platforms/platformsExport.php">
19-
20-
<input type="hidden" name="goback_url" value="{$basehref|escape}{$viewAction|escape}"/>
21-
22-
<input type="hidden" name="tproject_id" value="{$gui->tproject_id}" />
6+
<form method="post" id="f{$suffix}" action="#">
7+
<a class="{#BUTTON_CLASS#}" role="button"
8+
href="{$createAction}">{{$labels.btn_create}}</a>
239

24-
<input type="submit" name="export_platforms" id="export_platforms"
25-
class="btn btn-primary" role="button"
26-
style="margin-left: 3px;" value="{$labels.btn_export}" />
10+
<a class="{#BUTTON_CLASS#}" role="button"
11+
href="{$exportAction}">{$labels.btn_export}</a>
2712

2813
{if '' != $gui->canManage}
29-
<input class="btn btn-primary" role="button" type="button"
30-
name="import_platforms" id="import_platforms"
31-
onclick="location='{$importAction}'" value="{$labels.btn_import}" />
32-
{/if}
14+
<a class="{#BUTTON_CLASS#}" role="button"
15+
href="{$importAction}">{$labels.btn_import}</a>
16+
{/if}
3317
</form>
34-
</div>
18+
</div>

gui/themes/default/css/testlink.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,11 @@ div.menu_bubble h3{
285285
* Give buttons, submit, reset a gradient 3d look and other components
286286
* text/password-input, textarea and select a flat appearance.
287287
*/
288+
288289
input[type="button"],
290+
input[type="submit"],
289291
input[type="password"],
290292
input[type="reset"],
291-
input[type="submit"],
292293
input[type="text"],
293294
select,
294295
textarea,

0 commit comments

Comments
 (0)