macro_viewer_js

NAML documentation   Watch a video
Error Found
An error was found in the NAML code of this application – View Details | Go to NAML Editor
tag (custom_tweak:send_subscription_email:14) - <set_headers_for.local_node/> is not allowed here, only tags <cc>, , <html_part>, <text_part>, <bcc>, <attachments>, <aol_part>, <to_name>, <subject>, <bounce_to>, <from>, <to>, <from_name> are allowed here in tag element 'send'
  in send(custom_tweak:send_subscription_email:6) - <n.send> - public void nabble.view.web.template.EmailNamespace.send(nabble.naml.compiler.IPrintWriter,nabble.naml.compiler.Interpreter) throws nabble.model.ModelException$EmailFormat
  in new_email(custom_tweak:send_subscription_email:5) - <n.new_email.> - public void nabble.view.web.template.NabbleNamespace.new_email(nabble.naml.compiler.IPrintWriter,nabble.naml.compiler.ScopedInterpreter)
  in block(custom_tweak:send_subscription_email:4) - <n.block.> - public void nabble.naml.namespaces.BasicNamespace.block(nabble.naml.compiler.IPrintWriter,nabble.naml.compiler.ScopedInterpreter)
  in send_subscription_email(nabble:reply.naml:500) - <n.send_subscription_email node_attr="[n.node_attr/]">
  in send_node_as_email_to_user(nabble:reply.naml:488) - <n.send_node_as_email_to_user.local_node/>
  in subscription_for(nabble:reply.naml:487) - <n.subscription_for. email="[n.var name='email'/]"> - public void nabble.view.web.template.NodeNamespace.subscription_for(nabble.naml.compiler.IPrintWriter,nabble.naml.compiler.ScopedInterpreter) throws nabble.model.ModelException$EmailFormat
  in do(nabble:permissions.naml:139) - <n.topic_node.do/>
  in topic_node(nabble:permissions.naml:139) - <n.topic_node.do/> - public void nabble.view.web.template.NodeNamespace.topic_node(nabble.naml.compiler.IPrintWriter,nabble.naml.compiler.ScopedInterpreter)
  in do(nabble:utilities.naml:1107) - <n.do/>
  in get_node(nabble:utilities.naml:1107) - <n.get_node node="[n.uplevel_var name='local_node'/]" do="[n.do/]" /> - public void nabble.view.web.template.NabbleNamespace.get_node(nabble.naml.compiler.IPrintWriter,nabble.naml.compiler.ScopedInterpreter)
  in local_node(nabble:permissions.naml:139) - <then.local_node.topic_node.do/>
  in if(nabble:permissions.naml:138) - <n.if.local_node.is_post> - public static void nabble.naml.namespaces.BasicNamespace._if(nabble.naml.compiler.IPrintWriter,nabble.naml.compiler.Interpreter)
  in block(nabble:permissions.naml:137) - <n.block.> - public void nabble.naml.namespaces.BasicNamespace.block(nabble.naml.compiler.IPrintWriter,nabble.naml.compiler.ScopedInterpreter)
  in topic_or_app(nabble:reply.naml:487) - <n.topic_or_app.subscription_for. email="[n.var name='email'/]">
  in do(nabble:utilities.naml:1107) - <n.do/>
  in get_node(nabble:utilities.naml:1107) - <n.get_node node="[n.uplevel_var name='local_node'/]" do="[n.do/]" /> - public void nabble.view.web.template.NabbleNamespace.get_node(nabble.naml.compiler.IPrintWriter,nabble.naml.compiler.ScopedInterpreter)
  in local_node(nabble:reply.naml:487) - <then.local_node.topic_or_app.subscription_for. email="[n.var name='email'/]">
  in if(nabble:reply.naml:486) - <n.if.not.is_null.var name="email"> - public static void nabble.naml.namespaces.BasicNamespace._if(nabble.naml.compiler.IPrintWriter,nabble.naml.compiler.Interpreter)
  in do(nabble:utilities.naml:865) - <n.do/>
  in while(nabble:utilities.naml:863) - <n.while.next_element inc="[n.by/]"> - public void nabble.naml.namespaces.BasicNamespace._while(nabble.naml.compiler.IPrintWriter,nabble.naml.compiler.Interpreter)
  in loop(nabble:reply.naml:484) - <n.loop.>
  in get_parameter_values(nabble:reply.naml:483) - <then.get_parameter_values. name="email-to"> - public void nabble.view.web.template.RequestNamespace.get_parameter_values(nabble.naml.compiler.IPrintWriter,nabble.naml.compiler.ScopedInterpreter) throws java.io.IOException,javax.servlet.ServletException
  in if(nabble:reply.naml:482) - <n.if.visitor.is_registered> - public static void nabble.naml.namespaces.BasicNamespace._if(nabble.naml.compiler.IPrintWriter,nabble.naml.compiler.Interpreter)
  in block(nabble:reply.naml:481) - <n.block.> - public void nabble.naml.namespaces.BasicNamespace.block(nabble.naml.compiler.IPrintWriter,nabble.naml.compiler.ScopedInterpreter)
  in send_node_as_email(nabble:reply.naml:40) - <n.send_node_as_email/>
  in do(nabble:reply.naml:122) - <n.do/>
  in get_node(nabble:reply.naml:122) - <n.get_node node="[n.global_var name='new_node'/]" do="[n.do/]" /> - public void nabble.view.web.template.NabbleNamespace.get_node(nabble.naml.compiler.IPrintWriter,nabble.naml.compiler.ScopedInterpreter)
  in new_node(nabble:reply.naml:40) - <n.new_node.send_node_as_email/>
  in if(nabble:reply.naml:36) - <n.if.not.is_preview> - public static void nabble.naml.namespaces.BasicNamespace._if(nabble.naml.compiler.IPrintWriter,nabble.naml.compiler.Interpreter)
  in create_child_of_page_node(nabble:reply.naml:28) - <n.create_child_of_page_node commit="[n.not.is_preview/]"> - public void nabble.view.web.template.NodePageNamespace.create_child_of_page_node(nabble.naml.compiler.IPrintWriter,nabble.naml.compiler.ScopedInterpreter) throws nabble.model.ModelException,javax.servlet.ServletException
  in catch_exception(nabble:reply.naml:25) - <n.catch_exception. id="save-block"> - public void nabble.naml.namespaces.BasicNamespace.catch_exception(nabble.naml.compiler.IPrintWriter,nabble.naml.compiler.Interpreter)
  in if(nabble:reply.naml:18) - <n.if.not.is_submitted_form> - public static void nabble.naml.namespaces.BasicNamespace._if(nabble.naml.compiler.IPrintWriter,nabble.naml.compiler.Interpreter)
  in do(nabble:utilities.naml:936) - <n.as_node_page.do/>
  in as_node_page(nabble:utilities.naml:936) - <n.as_node_page.do/> - public void nabble.view.web.template.NodeNamespace.as_node_page(nabble.naml.compiler.IPrintWriter,nabble.naml.compiler.ScopedInterpreter)
  in do(nabble:utilities.naml:941) - <n.get_node_from_request_parameter.do/>
  in get_node_from_request_parameter(nabble:utilities.naml:941) - <n.get_node_from_request_parameter.do/> - public void nabble.view.web.template.ServletNamespace.get_node_from_request_parameter(nabble.naml.compiler.IPrintWriter,nabble.naml.compiler.ScopedInterpreter) throws java.io.IOException,javax.servlet.ServletException,nabble.naml.namespaces.TemplateException
  in catch_exception(nabble:utilities.naml:940) - <n.catch_exception. id="get-node-block"> - public void nabble.naml.namespaces.BasicNamespace.catch_exception(nabble.naml.compiler.IPrintWriter,nabble.naml.compiler.Interpreter)
  in get_node_from_parameter(nabble:utilities.naml:936) - <n.get_node_from_parameter.as_node_page.do/>
  in node_page(nabble:reply.naml:16) - <n.node_page.>
  in new_post(nabble:reply.naml:2) - <n.new_post>
  in (nabble:reply.naml:1) - <macro name="reply" requires="servlet">
   Usages of this macro
... in macro_viewer.naml
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
<macro name="macro_viewer_js">
    <script type="text/javascript">
        var isCustomTweak = <n.is_custom_tweak
Binary
Namespace: MacroSourceNamespace
/>;
        var pBase = '&base=<n.hide_null
Binary
Namespace: BasicNamespace
Parameters: value
.current_base_classes
Macro
/>';
        var pBreadcrumbs = '<n.hide_null
Binary
Namespace: BasicNamespace
Parameters: value
.current_breadcrumbs
Macro
/>';
        pBreadcrumbs = pBreadcrumbs == ''? '' : '&breadcrumbs=' + pBreadcrumbs;
        var isSiteAdmin = <n.visitor
Binary
Namespace: ServletNamespace
Parameters: do
.is_site_admin
Macro
Requires: user
/>;
 
        var tweakFileContents = "<n.javascript_string_encode
Binary
Namespace: NabbleNamespace
Parameters: text
.hide_null
Binary
Namespace: BasicNamespace
Parameters: value
.tweak_file_contents
Binary
Namespace: MacroSourceNamespace
/>";
        var macroOpeningTag = "<n.javascript_string_encode
Binary
Namespace: NabbleNamespace
Parameters: text
.hide_null
Binary
Namespace: BasicNamespace
Parameters: value
.macro_opening_tag
Binary
Namespace: MacroSourceNamespace
/>";
        $(document).ready(function() {
            function lineSelector(e) {
                return 'div.line'+e.id.substring(8);
            };
            var $lineDivs = $('table.code div.line-contents');
            $lineDivs.hover(
                function() { $(lineSelector(this), $(this).parent().prev()).css('font-weight','bold').addClass('dark-bg-color'); },
                function() { $(lineSelector(this), $(this).parent().prev()).css('font-weight','normal').removeClass('dark-bg-color'); }
            );
            function fixHeights() {
                $lineDivs.each(function() {
                    var h = $(this).outerHeight();
                    var $table = $(this).parents('table');
                    $(lineSelector(this), $table).height(h);
                });
            }
            $(window).resize(fixHeights);
            fixHeights();
 
            var $textarea = $('#txt_basic');
            var textareaValue = $textarea.val().replace(/\s*/g, '');
            var originalFileContents = tweakFileContents.replace(/\s*/g, '');
            if (textareaValue != originalFileContents) {
                showEditor();
            }
            window.onbeforeunload = function() {
                $textarea.val(basicEditor.getCode());
            };
        });
 
        function openNamlLogin() {
            $('#naml-login').slideDown();
        };
 
        function showEditor() {
            if (!isSiteAdmin) {
                openNamlLogin();
                return;
            }
            $('#saveButton,#cancelButton,#wrapping_basic,#resizebar').show();
            $('#editButton,#removeButton').hide();
            if (isCustomTweak)
                $('#current-source').hide();
            else
                $('#overrides-arrow').show();
            var line = getLineNumber(tweakFileContents, macroOpeningTag);
            inlineEditor('20em', line);
        };
        function saveChanges() {
            notice('Saving... Please wait');
            var call = '/template/NamlServlet.jtp?macro=save_tweak&id=<n.id
Binary
Namespace: MacroSourceNamespace
/>' + pBase + pBreadcrumbs;
            var code = basicEditor.getCode();
            if (code.match(/^\s*$/) != null) {
                notice('Error Found', 3000, 1500);
                var msg = "Error: invalid macro code.";
                $('#error-box').html(msg).show();
                return;
            }
            var params = { contents: code };
            $.post(call, params,
                function(data) {
                    var result = eval('(' + data + ')');
                    if (result.error != null) {
                        notice('Error Found', 3000, 1500);
                        var $errorBox = $('#error-box');
                        $errorBox.html(formatError(result.error)).show();
                        if ($errorBox.height() > 150) {
                            $errorBox.css('overflow-y','scroll').height(150);
                        }
                    } else {
                        pBase = result.base == null? pBase : '&base=' + result.base;
                        pBreadcrumbs = result.breadcrumbs == null? pBreadcrumbs : '&breadcrumbs=' + result.breadcrumbs;
                        var url = '/template/NamlServlet.jtp?macro=macro_viewer&id=' + result.macroId + pBase + pBreadcrumbs;
                        window.location = url;
                    }
                }
            );
        };
        function cancelChanges() {
            $('#saveButton,#cancelButton,#wrapping_basic,#resizebar,#error-box').hide();
            $('#editButton,#removeButton').show();
            if (isCustomTweak)
                $('#current-source').show();
            else
                $('#overrides-arrow').hide();
            basicEditor.setCode(tweakFileContents);
        };
        function removeOverride() {
            if (!isSiteAdmin) {
                openNamlLogin();
                return;
            }
            <n.if
Binary
Namespace: BasicNamespace
Parameters: condition, else, then
.is_override
Binary
Namespace: MacroSourceNamespace
>
                <then>
                    var confirmQuestion = "Do you really want to remove this override?";
                    var nextUrl = "<n.use_text_encoder
Binary
Namespace: BasicNamespace
Parameters: text
.path_to_overridden_macro
Macro
/>";
                </then>
                <else>
                    var confirmQuestion = "Do you really want to remove this macro?";
                    var nextUrl = "<n.use_text_encoder
Binary
Namespace: BasicNamespace
Parameters: text
.macro_deleted_path
Macro
/>";
                </else>
            </n.if.is_override>
            if( !confirm(confirmQuestion) )
                return;
            var call = '/template/NamlServlet.jtp?macro=revert_tweak&id=<n.id
Binary
Namespace: MacroSourceNamespace
/>' + pBase + pBreadcrumbs;
            $.get(call, function(data) {
                if (Nabble.trim(data) == 'ok')
                    window.location = nextUrl;
            });
        };
    </script>
</macro>