Class ::xowiki::ADP_Generator

::xowiki::ADP_Generator[i] create ... \
           [ -extra_header_stuff (default "") ] \
           [ -footer (default "1") ] \
           [ -master (default "1") ] \
           [ -recreate (default "0") ] \
           [ -wikicmds (default "1") ]

Class Relations

  • class: ::xotcl::Class[i]
  • superclass: ::xotcl::Object[i]
::xotcl::Class create ::xowiki::ADP_Generator \
     -superclass ::xotcl::Object

Methods (to be applied on instances)

  • before_render (scripted)

    # just a hook, might be removed later
  • content_part (scripted)

    return " @top_includelets;noquote@\n <if @body.menubarHTML@ not nil><div class='visual-clear'><!-- --></div>@body.menubarHTML;noquote@</if>\n <if @page_context@ not nil><h1>@body.title@ (@page_context@)</h1></if>\n <else><h1>@body.title@</h1></else>\n <if @body.folderHTML@ not nil> \n <div class='folders' style=''>@body.folderHTML;noquote@</div> \n <div class='content-with-folders'>@content;noquote@</div> \n </if>
    <else>@content;noquote@</else>"
  • extra_header_stuff (setter)

  • footer (setter)

  • footer_part (scripted)

    if {![:footer]} {return ""}
    return "@footer;noquote@"
  • generate (scripted)

    set _ "<!-- Generated by [self class] on [clock format [clock seconds]] -->\n"
    
    # if we include the master, we include the primitive js function
    if {${:master}} {
      append _ [:master_part]
    }
    
    append _  {<!-- The following DIV is needed for overlib to function! -->
          <div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
          <div class='xowiki-content'>} \n
    
    append _ [:wikicmds_part] \n
    append _ [:content_part] \n
    append _ [:footer_part] \n
    append _ "</div> <!-- class='xowiki-content' -->\n"
  • init (scripted)

    set name [namespace tail [self]]
    set adpFilename [file dirname [info script]]/../resources/templates/$name.adp
    #
    # Generate the ADP file, when does not exist, or when the
    # generator is newer.
    #
    if {![ad_file exists $adpFilename]
        || [file mtime [info script]] > [ad_file mtime $adpFilename]} {
      try {
        set f [open $adpFilename w]
      } on error {errorMsg} {
        :log "Warning: cannot overwrite ADP $adpFilename, ignoring possible changes"
      } on ok {r} {
        ::puts -nonewline $f [:generate]
        close $f
        :log "Notice: created ADP $adpFilename"
      }
    }
  • master (setter)

  • master_part (scripted)

    return [subst -novariables -nobackslashes  {<master>
                  <property name="context">@context;literal@</property>
                  <if @item_id@ not nil><property name="displayed_object_id">@item_id;literal@</property></if>
                  <property name="&body">body</property>
                  <property name="&doc">doc</property>
                  <property name="head">[:extra_header_stuff]</property>}]\n
  • recreate (setter)

  • wikicmds (setter)

  • wikicmds_part (scripted)

    if {![:wikicmds]} {return ""}
    return {
      <%
      if {$::xowiki::search_mounted_p} {
        template::add_event_listener  -id wiki-menu-do-search-control  -script {
            document.getElementById('do_search').style.display = 'inline';
            document.getElementById('do_search_q').focus();
          }
      }
      %>
      <div id='wikicmds'>
      <if @view_link@ not nil><a href="@view_link@" accesskey='v' title='#xowiki.view_title#'>#xowiki.view#</a> &middot; </if>
      <if @edit_link@ not nil><a href="@edit_link@" accesskey='e' title='#xowiki.edit_title#'>#xowiki.edit#</a> &middot; </if>
      <if @rev_link@ not nil><a href="@rev_link@" accesskey='r' title='#xowiki.revisions_title#'>#xotcl-core.revisions#</a> &middot; </if>
      <if @new_link@ not nil><a href="@new_link@" accesskey='n' title='#xowiki.new_title#'>#xowiki.new_page#</a> &middot; </if>
      <if @delete_link@ not nil><a href="@delete_link@" accesskey='d' title='#xowiki.delete_title#'>#xowiki.delete#</a> &middot; </if>
      <if @admin_link@ not nil><a href="@admin_link@" accesskey='a' title='#xowiki.admin_title#'>#xowiki.admin#</a> &middot; </if>
      <if @notification_subscribe_link@ not nil><a href='/notifications/manage' title='#xowiki.notifications_title#'>#xowiki.notifications#</a>
      <a href="@notification_subscribe_link@" class="notification-image-button">&nbsp;</a>&middot; </if>
      <if @::xowiki::search_mounted_p@ true><a href='#' id='wiki-menu-do-search-control' title='#xowiki.search_title#'>#xowiki.search#</a> &middot; </if>
      <if @index_link@ not nil><a href="@index_link@" accesskey='i' title='#xowiki.index_title#'>#xowiki.index#</a></if>
      <div id='do_search' style='display: none'>
      <form action='/search/search'><div><label for='do_search_q'>#xowiki.search#</label><input id='do_search_q' name='q' type='text'><input type="hidden" name="search_package_id" value="@package_id@"><if @::__csrf_token@ defined><input type="hidden" name="__csrf_token" value="@::__csrf_token;literal@"></if></div></form>
      </div>
      </div>}