new_macro_page

NAML documentation   Watch a video
   Usages of this macro
The source code below doesn't have navigation links because no usage has been compiled yet. Navigation links depend on how and where the macro is used, so first you may try finding all usages of "new_macro_page".
... in macro_viewer.naml
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
<macro name="new_macro_page" requires="servlet">
    <n.naml_tools.>
        <n.html>
            <head>
                <meta name="robots" content="noindex,nofollow"/>
                <n.title.>New Macro</n.title.>
                <n.codemirror_shared_head/>
                <script type="text/javascript">
                    <![CDATA[
                    var defaultMacroBody = '<macro name="">\n\n</'+'macro>';
                    $(document).ready(function() {
                        var $textarea = $('#txt_basic');
                        if ($textarea.val() == '')
                            $textarea.val(defaultMacroBody);
                        var canGoBack = history.length > 1;
                        if (canGoBack)
                            $('#go-back').show().before('<t>or</t> ');
                        inlineEditor('27em', 1, 13);
 
                        window.onbeforeunload = function() {
                            $textarea.val(basicEditor.getCode());
                        };
                    });
 
                    function saveChanges() {
                        notice('Saving... Please wait');
                        var call = '/template/NamlServlet.jtp?macro=save_tweak';
                        var code = basicEditor.getCode();
                        if (code.match(/^\s*$/) != null) {
                            notice('Error Found', 3000, 1500);
                            var msg = "Error: invalid macro code.";
                            var $errorBox = $('#error-box');
                            $errorBox.html(formatError(msg)).show();
                            if ($errorBox.height() > 150) {
                                $errorBox.css('overflow-y','scroll').height(150);
                            }
                            return;
                        }
                        var params = { contents: code };
                        $.post(call, params,
                            function(data) {
                                var result = eval('(' + data + ')');
                                if (result.error != null) {
                                    notice('Error Found', 3000, 1500);
                                    $('#error-box').html(formatError(result.error)).show();
                                } else {
                                    var url = '/template/NamlServlet.jtp?macro=macro_viewer&id=' + result.macroId;
                                    window.location = url;
                                }
                            }
                        );
                    };
                    ]]>
                </script>
            </head>
            <body>
                <n.macro_viewer_header.>
                    New Macro
                </n.macro_viewer_header.>
 
                <n.important_notices/>
 
                <div style="clear:both">
                    <n.macro_options_dropdown/>
                    <button id="saveButton" class="toolbar" style="font-weight:bold" onclick="saveChanges()">
                        Save Changes
                    </button>
                    <a id="go-back" href="javascript: void history.back()" style="display:none"><t>Go back</t></a>
 
                    <div style="clear:both">
                        <div id="error-box" class="error-message" style="padding:.5em;display:none"></div>
                        <textarea id="txt_basic" style="display:none"></textarea>
                    </div>
                </div>
            </body>
        </n.html>
    </n.naml_tools.>
</macro>