root/branches/release-29/tmpl/cms/edit_blog.tmpl @ 1309

Revision 1309, 11.8 kB (checked in by ddavis, 22 months ago)

standarize js comment tag escape. BugzID:58265

  • Property svn:keywords set to Author Date Id Revision
Line 
1<mt:setvar name="page_title" value="<__trans phrase="Create Blog">">
2<$mt:setvar name="position_actions_bottom" value="1"$>
3<mt:setvarblock name="system_msg">
4    <mt:if name="error">
5        <mtapp:statusmsg
6            id="generic-error"
7            class="error">
8            <mt:var name="error">
9        </mtapp:statusmsg>
10    </mt:if>
11    <mt:if name="saved">
12        <mtapp:statusmsg
13            id="saved"
14            class="success"
15            rebuild="all">
16            <__trans phrase="Your blog configuration has been saved.">
17        </mtapp:statusmsg>
18    </mt:if>
19</mt:setvarblock>
20<mt:setvarblock name="html_head" append="1">
21<script type="text/javascript">
22/* <![CDATA[ */
23var orig_site_url = "<mt:var name="site_url" _default="$suggested_site_url" escape="js">";
24var orig_site_path = "<mt:var name="site_path" _default="$suggested_site_path" escape="js">";
25function dirify_blog_name(fld) {
26    var dir_blog_name = dirify(fld.value);
27    if (!dir_blog_name.length) return;
28    var url = fld.form['site_url'];
29    var path = fld.form['site_path'];
30    /* detect linux/mac or windows path separator */
31    var slash = orig_site_path.match( /(\\|\/)/ )[ 0 ];
32    var basic_site_url = orig_site_url.replace(/\/BLOG-NAME\/$/, '/');
33    var basic_site_path = orig_site_path.replace(/(\/|\\)BLOG-NAME(\/|\\)?$/, slash);
34    if (basic_site_url && (url.value.indexOf(basic_site_url) == 0))
35        url.value = basic_site_url + dir_blog_name + '/';
36    if (basic_site_path && (path.value.indexOf(basic_site_path) == 0))
37        path.value = basic_site_path + dir_blog_name;
38}
39function validate (f) {
40<mt:if name="can_edit_config">
41    if (!f.name.value) {
42        alert('<__trans phrase="You must set your Blog Name." escape="singlequotes">');
43        return false;
44    } else if (f.server_offset.value == '') {
45        alert('<__trans phrase="You did not select a timezone." escape="singlequotes">');
46        return false;
47</mt:if>
48<mt:if name="can_set_publish_paths">
49<mt:if name="can_edit_config">
50    } else if (!f.site_path.value) {
51<mt:else>
52    if (!f.site_path.value) {
53</mt:if>
54        alert('<__trans phrase="You must set your Local Site Path." escape="singlequotes">');
55        return false;
56    } else if (!f.site_url.value) {
57        alert('<__trans phrase="You must set your Site URL." escape="singlequotes">');
58        return false;
59    } else if (f.server_offset.value == '') {
60        alert('<__trans phrase="You did not select a timezone." escape="singlequotes">');
61        return false;
62    } else if (!is_valid_url(f.site_url.value)){
63        alert('<__trans phrase="Your Site URL is not valid." escape="singlequotes">');
64        return false;
65    } else if (checkUrlSpaces(f.site_url.value)){
66        alert('<__trans phrase="You can not have spaces in your Site URL." escape="singlequotes">');
67        return false;
68    } else if (checkPathSpaces(f.site_path.value)){
69        alert('<__trans phrase="You can not have spaces in your Local Site Path." escape="singlequotes">');
70        return false;
71    } else if (!is_valid_path(f.site_path.value)){
72        alert('<__trans phrase="Your Local Site Path is not valid." escape="singlequotes">');
73        return false;
74</mt:if>
75    }
76    return true;
77}
78function init() {
79<mt:if name="new_object">
80    getByID("name").focus();
81</mt:if>
82}
83function checkUrlSpaces(url_){
84    if (url_.match(/\s+/)){
85        return true;
86    }
87}
88function is_valid_url(url_){
89    return url_.match( /^https?:\/\/[A-Za-z0-9!$%()=_.:,;@~-]+/ );
90}
91function checkPathSpaces(path_){
92    if (path_.match(/\s+/)){
93        return true;
94    }
95}
96function is_valid_path(path_){
97    for(i = 0; i < path_.length; i++){
98        var buf = escape(path_.substr(i, 1));
99        if (buf.match(/^%u.*/)){
100            return false;
101        }
102        if (buf.match(/(%.{2}){2}?/)){
103            return false;
104        }
105    }
106    return true;
107}
108
109TC.attachLoadEvent(init);
110
111/* ]]> */
112</script>
113</mt:setvarblock>
114
115<mt:include name="include/header.tmpl">
116
117<form method="post" action="<mt:var name="script_url">" onsubmit="return validate(this)">
118<mt:unless name="new_object">
119    <input type="hidden" name="id" value="<mt:var name="id">" />
120</mt:unless>
121    <input type="hidden" name="__mode" value="save" />
122    <input type="hidden" name="_type" value="blog" />
123    <input type="hidden" name="blog_id" value="<mt:var name="blog_id">" />
124    <input type="hidden" name="return_args" value="<mt:var name="return_args" escape="html">" />
125    <input type="hidden" name="magic_token" value="<mt:var name="magic_token">" />
126
127<fieldset>
128    <h3><__trans phrase="Blog Details"></h3>
129<mt:if name="can_edit_config">
130
131    <mtapp:setting
132        id="name"
133        label="<__trans phrase="Blog Name">"
134        hint="<__trans phrase="Name your blog. The blog name can be changed at any time.">"
135        help_page="blog_settings_general"
136        help_section="blog_name">
137                <input name="name" id="name" value="<mt:var name="name" escape="html">" size="50" onkeyup="dirify_blog_name(this)" />
138    </mtapp:setting>
139<mt:if name="template_set_index">
140    <mtapp:setting
141        id="template_set"
142        label="<__trans phrase="Template Set">"
143        hint="<__trans phrase="Select the templates you wish to use for this new blog.">"
144        help_page="blog_settings_general"
145        help_section="template_set">
146        <select name="template_set">
147        <mt:loop name="template_set_loop">
148            <option value="<mt:var name="key" escape="html">"<mt:if name="selected"> selected="selected"</mt:if>><mt:var name="label" escape="html"></option>
149        </mt:loop>
150        </select>
151    </mtapp:setting>
152</mt:if>
153</mt:if>
154<mt:if name="can_set_publish_paths">
155    <mtapp:setting
156        id="site_url"
157        label="<__trans phrase="Site URL">"
158        hint="<__trans phrase="Enter the URL of your public website. Do not include a filename (i.e. exclude index.html). Example: http://www.example.com/weblog/">"
159        help_page="blog_settings_publishing"
160        help_section="site_url">
161            <input name="site_url" id="site_url" value="<mt:var name="site_url" _default="$suggested_site_url" escape="html">" size="50" />
162    </mtapp:setting>
163
164    <mtapp:setting
165        id="site_path"
166        label="<__trans phrase="Site Root">"
167        hint="<__trans phrase="Enter the path where your main index file will be located. An absolute path (starting with '/') is preferred, but you can also use a path relative to the Movable Type directory. Example: /home/melody/public_html/weblog">"
168        help_page="blog_settings_publishing"
169        help_section="site_root">
170            <input name="site_path" id="site_path" value="<mt:var name="site_path" _default="$suggested_site_path" escape="html">" size="50" />
171    </mtapp:setting>
172</mt:if>
173<mt:if name="can_edit_config">
174    <mtapp:setting
175        id="server_offset"
176        label="<__trans phrase="Timezone">"
177        hint="<__trans phrase="Select your timezone from the pulldown menu.">"
178        help_page="blog_settings_general"
179        help_section="blog_timezone">
180            <select name="server_offset" id="server_offset">
181                <option value=""><__trans phrase="Time zone not selected"></option>
182                <option value="13"<mt:if name="SERVER_OFFSET_13"> selected="selected"</mt:if>><__trans phrase="UTC+13 (New Zealand Daylight Savings Time)"></option>
183                <option value="12"<mt:if name="SERVER_OFFSET_12"> selected="selected"</mt:if>><__trans phrase="UTC+12 (International Date Line East)"></option>
184                <option value="11"<mt:if name="SERVER_OFFSET_11"> selected="selected"</mt:if>><__trans phrase="UTC+11"></option>
185                <option value="10"<mt:if name="SERVER_OFFSET_10"> selected="selected"</mt:if>><__trans phrase="UTC+10 (East Australian Time)"></option>
186                <option value="9.5"<mt:if name="SERVER_OFFSET_9_5"> selected="selected"</mt:if>><__trans phrase="UTC+9.5 (Central Australian Time)"></option>
187                <option value="9"<mt:if name="SERVER_OFFSET_9"> selected="selected"</mt:if>><__trans phrase="UTC+9 (Japan Time)"></option>
188                <option value="8"<mt:if name="SERVER_OFFSET_8"> selected="selected"</mt:if>><__trans phrase="UTC+8 (China Coast Time)"></option>
189                <option value="7"<mt:if name="SERVER_OFFSET_7"> selected="selected"</mt:if>><__trans phrase="UTC+7 (West Australian Time)"></option>
190                <option value="6.5"<mt:if name="SERVER_OFFSET_6_5"> selected="selected"</mt:if>><__trans phrase="UTC+6.5 (North Sumatra)"></option>
191                <option value="6"<mt:if name="SERVER_OFFSET_6"> selected="selected"</mt:if>><__trans phrase="UTC+6 (Russian Federation Zone 5)"></option>
192                <option value="5.5"<mt:if name="SERVER_OFFSET_5_5"> selected="selected"</mt:if>><__trans phrase="UTC+5.5 (Indian)"></option>
193                <option value="5"<mt:if name="SERVER_OFFSET_5"> selected="selected"</mt:if>><__trans phrase="UTC+5 (Russian Federation Zone 4)"></option>
194                <option value="4"<mt:if name="SERVER_OFFSET_4"> selected="selected"</mt:if>><__trans phrase="UTC+4 (Russian Federation Zone 3)"></option>
195                <option value="3.5"<mt:if name="SERVER_OFFSET_3_5"> selected="selected"</mt:if>><__trans phrase="UTC+3.5 (Iran)"></option>
196                <option value="3"<mt:if name="SERVER_OFFSET_3"> selected="selected"</mt:if>><__trans phrase="UTC+3 (Baghdad Time/Moscow Time)"></option>
197                <option value="2"<mt:if name="SERVER_OFFSET_2"> selected="selected"</mt:if>><__trans phrase="UTC+2 (Eastern Europe Time)"></option>
198                <option value="1"<mt:if name="SERVER_OFFSET_1"> selected="selected"</mt:if>><__trans phrase="UTC+1 (Central European Time)"></option>
199                <option value="0"<mt:if name="SERVER_OFFSET_0"> selected="selected"</mt:if>><__trans phrase="UTC+0 (Universal Time Coordinated)"></option>
200                <option value="-1"<mt:if name="SERVER_OFFSET__1"> selected="selected"</mt:if>><__trans phrase="UTC-1 (West Africa Time)"></option>
201                <option value="-2"<mt:if name="SERVER_OFFSET__2"> selected="selected"</mt:if>><__trans phrase="UTC-2 (Azores Time)"></option>
202                <option value="-3"<mt:if name="SERVER_OFFSET__3"> selected="selected"</mt:if>><__trans phrase="UTC-3 (Atlantic Time)"></option>
203                <option value="-3.5"<mt:if name="SERVER_OFFSET__3_5"> selected="selected"</mt:if>><__trans phrase="UTC-3.5 (Newfoundland)"></option>
204                <option value="-4"<mt:if name="SERVER_OFFSET__4"> selected="selected"</mt:if>><__trans phrase="UTC-4 (Atlantic Time)"></option>
205                <option value="-5"<mt:if name="SERVER_OFFSET__5"> selected="selected"</mt:if>><__trans phrase="UTC-5 (Eastern Time)"></option>
206                <option value="-6"<mt:if name="SERVER_OFFSET__6"> selected="selected"</mt:if>><__trans phrase="UTC-6 (Central Time)"></option>
207                <option value="-7"<mt:if name="SERVER_OFFSET__7"> selected="selected"</mt:if>><__trans phrase="UTC-7 (Mountain Time)"></option>
208                <option value="-8"<mt:if name="SERVER_OFFSET__8"> selected="selected"</mt:if>><__trans phrase="UTC-8 (Pacific Time)"></option>
209                <option value="-9"<mt:if name="SERVER_OFFSET__9"> selected="selected"</mt:if>><__trans phrase="UTC-9 (Alaskan Time)"></option>
210                <option value="-10"<mt:if name="SERVER_OFFSET__10"> selected="selected"</mt:if>><__trans phrase="UTC-10 (Aleutians-Hawaii Time)"></option>
211                <option value="-11"<mt:if name="SERVER_OFFSET__11"> selected="selected"</mt:if>><__trans phrase="UTC-11 (Nome Time)"></option>
212            </select>
213    </mtapp:setting>
214</mt:if>
215
216<mt:setvarblock name="action_buttons">
217    <button
218        type="submit"
219        accesskey="s"
220        title="<__trans phrase="Create Blog (s)">"
221        class="primary-button"
222        ><__trans phrase="Create Blog"></button>
223</mt:setvarblock>
224<mt:include name="include/actions_bar.tmpl" bar_position="bottom" hide_pager="1" settings_bar="1">
225    </fieldset>
226</form>
227
228<mt:include name="include/footer.tmpl">
Note: See TracBrowser for help on using the browser.