root/branches/release-29/tmpl/cms/dialog/asset_options_image.tmpl @ 1309

Revision 1309, 5.4 kB (checked in by ddavis, 23 months ago)

standarize js comment tag escape. BugzID:58265

Line 
1    <script type="text/javascript">
2    /* <![CDATA[ */
3    function calcDim (val, type, full) {
4        return val.value;
5    }
6
7    function adjustPixelsPct (f, width) {
8    //    if (!f.constrain.checked) return;
9        var e, s, full;
10        if (width) {
11            e = f.thumb_width;
12            s = f.thumb_width_type;
13            full = f.full_width.value;
14        } else {
15            e = f.thumb_height;
16            s = f.thumb_height_type;
17            full = f.full_height.value;
18        }
19        e.value = Math.floor(full * e.value / 100);
20        return true;
21    }
22
23    function checkThumbs(f) {
24        f = document.forms[0];
25        adjustWidthHeight(f,1);
26    }
27
28    function adjustWidthHeight (f, width) {
29    //    if (!f.constrain.checked) return;
30        var w = f.thumb_width;
31        var wt = f.thumb_width_type;
32        var wf = f.full_width.value;
33        var h = f.thumb_height;
34        var ht = f.thumb_height_type;
35        var hf = f.full_height.value;
36        var pct;
37        var s = width ? wt : ht;
38        pct = width ? (w.value / wf) : (h.value / hf);
39        var e = width ? h : w;
40        var s = width ? ht : wt;
41        var full = width ? hf : wf;
42        e.value = Math.floor(pct * full);
43        return true;
44    }
45
46    function widthKeyPress(e) {
47        var key;
48        if (window.event) {
49            key = window.event.keyCode;
50            e = window.event;
51        } else if (e)
52            key = e.which;
53        else
54            return true;
55        if (( key == null) || ( key == 0 ) || ( key == 8 ) ||
56            ( key == 9 ) || ( key == 13 ) || ( key == 27 ))
57            return true;
58        if (key > 60000) // handles range of special keys such as arrow keys
59            return true;
60        if (e.ctrlKey || e.altKey)
61            return true;
62        if ((e.charCode < 48) || (e.charCode > 57))
63            return TC.stopEvent(e);
64        return true;
65    }
66
67    /* ]]> */
68    </script>
69
70<mt:if name="do_thumb">
71<input type="hidden" name="full_width" value="<mt:var name="width">" />
72<input type="hidden" name="full_height" value="<mt:var name="height">" />
73</mt:if>
74<input type="hidden" name="wrap_text" value="1" />
75
76<div id="new_entry_prefs">
77<mtapp:setting
78    id="display_image"
79    label="<__trans phrase="Display image in entry">"
80    label_class="no-header"
81    hint=""
82    show_hint="0"
83    help_page=""
84    help_section="">
85    <input type="checkbox" name="include" id="display_image" value="1" checked="checked" onclick="toggleSubPrefs(this); return true;" />
86    <label for="display_image"><__trans phrase="Display image in entry"></label>
87</mtapp:setting>
88    <div id="include_prefs">
89<mtapp:setting
90    id="image_alignment"
91    label="<__trans phrase="Alignment">"
92    label_class="top-header"
93    hint=""
94    show_hint="0">
95    <input type="radio" name="align" id="align-left" class="rb" value="none" <mt:if name="align_none">checked="checked" </mt:if>/>
96    <label class="icon-left icon-left-xwide icon-align icon-align-none"><__trans phrase="None"></label>
97
98    <input type="radio" name="align" id="align-left" class="rb" value="left" <mt:if name="align_left">checked="checked" </mt:if>/>
99    <label class="icon-left-xwide icon-align icon-align-left"><__trans phrase="Left"></label>
100
101    <input type="radio" name="align" id="align-center" class="rb" value="center" <mt:if name="align_center">checked="checked" </mt:if>/>
102    <label class="icon-left-xwide icon-align icon-align-center"><__trans phrase="Center"></label>
103
104    <input type="radio" name="align" id="align-right" class="rb" value="right" <mt:if name="align_right">checked="checked" </mt:if>/>
105    <label class="icon-left-xwide icon-align icon-align-right"><__trans phrase="Right"></label>
106</mtapp:setting>
107<mt:if name="do_thumb">
108    <mtapp:setting
109        id="create_thumbnail"
110        label="<__trans phrase="Use thumbnail">"
111        label_class="no-header"
112        hint=""
113        show_hint="0"
114        help_page="file_upload"
115        help_section="creating_thumbnails">
116        <input type="checkbox" name="thumb" value="1" <mt:if name="make_thumb">checked="checked" </mt:if>/>
117        <label for="create_thumbnail"><__trans phrase="Use thumbnail"></label>
118        (<label for="thumb_width"><__trans phrase="width:"></label>
119        <input name="thumb_width" id="thumb_width" value="<mt:var name="thumb_width">" onkeypress="widthKeyPress(event)" onchange="adjustWidthHeight(this.form, 1)" size="4" /> <__trans phrase="pixels">)
120        <input type="hidden" name="thumb_height" value="<mt:var name="thumb_height">" />
121        <img onload="checkThumbs('now');" src="<mt:var name="static_uri">images/spacer.gif" alt="" width="1" height="1" />
122    </mtapp:setting>
123</mt:if>
124<mtapp:setting
125    id="link_to_popup"
126    label="<__trans phrase="Link image to full-size version in a popup window.">"
127    label_class="no-header"
128    hint=""
129    show_hint="0">
130    <input type="checkbox" name="popup" id="link_to_popup" value="1" <mt:if name="popup">checked="checked" </mt:if>/>
131    <label for="link_to_popup"><__trans phrase="Link image to full-size version in a popup window."></label>
132</mtapp:setting>
133<mt:if name="can_save_image_defaults">
134    <mtapp:setting
135        id="save_settings"
136        label="<__trans phrase="Remember these settings">"
137        label_class="no-header"
138        hint=""
139        show_hint="0">
140        <input type="checkbox" name="image_defaults" value="1" />
141        <label for="save_settings"><__trans phrase="Remember these settings"></label>
142    </mtapp:setting>
143</mt:if>
144    </div>
145</div>
Note: See TracBrowser for help on using the browser.