Skip to topic | Skip to bottom
Home
Search:

Local
Local.UkMirUkTopicr1.6 - 25 Dec 2005 - 22:23 - WietsEtopic end
You are here: Local > ImcUk > ImcUkTech > UkMirUkTopic

Start of topic | Skip to actions

UK Topic for www.indymedia.org.uk

It was agreed at the Sheffield UkNetworkMeetings3 to set up a UK topic, this page documents how to do this.

Work in progress (and as I am on the move some notes would be good smile I'll make sure that these get written into a form folk can learn from once I understand too!

TODO the big one is make the UK box ticked by default on the publish form This can be done by including &to_uk=61 in the uri smile but there must be a prettier way? just to_uk?

BUGS? is it a bug that you can post with no region ticked? For example this is a post with no topics or regions — this means that it will only be linked to from the view all posts page... is this a problem?
solution? This probably could be solved by adding a form checking condition that one must be ticked there is a validation section of the publish form java

The Topic

I just created it using the usual Mir admin superuser menu. But I only gave it a title, description and template (although don't think the last is needed either).

id          | 61
parent_id   | 0
title       | Uk
description | editing ekes/producer.xml
filename    |
main_url    | startpage.template
archiv_url  | 

Populating the topic

dev=> INSERT INTO content_x_topic (content_id, topic_id)
dev-> SELECT id, 61
dev-> FROM content WHERE to_article_type!=8;

This inserts into the content/topic lookup table an entry for every previous article* with the 61 (uk) topic. * except content in article_type 8 (regional feature).

Removing Regional Features type

UPDATE content SET to_article_type=2 WHERE to_article_type=8;
DELETE FROM article_type WHERE id=8;

Changes content article_type 8 (regional feature) to type 2 (feature). Removes the feature type from the list. You need to recompile to remove it from admin menus.

Editing producer.xml

Use the new uk topic

and id in (select content_id from content_x_topic where topic_id = 61)

This added to the selection for startpage, feature archive etc..

I don't like the fact the topic_id number is hard coded as 61 here and would prefer a constant or something, but that's just me.

Forget regional features

Delete all references to the regional features article type ${articletype.localfeature} You can delete it fomr etc/bundles/adminlocal.properties too - but it doesn't seem essential

UK page isn't a topicpage

In the <producer name="topicstartpage"> stop the uk topic being generated as a topic start page by changing the Enumerate selections to exclude topics without an archiv_url (added /dev/null to conditions as well so our deleted topics no longer get created either).

      <Enumerate key="issue" table="topic" selection="archiv_url &lt;&gt; 'regions' and archiv_url &lt;&gt; '' and archiv_url &lt;&gt; '/dev/null' and ${topiccondition}">

The Publish Page

I understand this less but the two main files involved are extrasource/IMCUKArticlePostingHandler.java and open/editarticle.template

Previously, for regions, topics and actions (all of which are Topics) a List has been created in the java which is looped through in the template to create the form. As there is only one Topic here this seems daft, but it seemed as easy to cut and paste.

IMCUKArticlePostingHandler.java

public class IMCUKArticlePostingHandler extends MirBasicArticlePostingHandler

protected void initializeResponseData(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure

this seems to set up the Lists

      aResponse.setResponseValue("to_uk", aRequest.getParameters("to_uk"));
      aResponse.setResponseValue("to_issue", aRequest.getParameters("to_issue"));
      aResponse.setResponseValue("to_region", aRequest.getParameters("to_region"));
      aResponse.setResponseValue("to_action", aRequest.getParameters("to_action"));
...
      aResponse.setResponseValue("uk",
          new CachingRewindableIterator(
            new EntityIteratorAdapter("title='Uk'", "id", 30,
              MirGlobal.localizer().dataModel().adapterModel(), "topic")));
      aResponse.setResponseValue("actions",
          new CachingRewindableIterator(
            new EntityIteratorAdapter("archiv_url='actions/2005'", "id", 30,
              MirGlobal.localizer().dataModel().adapterModel(), "topic")));
and so on...

As the uk topic doesn't have an archiv_url (this creates a directory for it) it is selected using its title field (I suppose you could use id instead).

public void validate(List aResults, Request aRequest, Session aSession) throws SessionExc, SessionFailure

I've not used it as there is only one topic here and just a check box, but it has the validation of form input. This includes how many regions and topics can be selected.

public void setArticleTopics(Request aRequest, Session aSession, EntityContent aContent) throws SessionExc, SessionFailure

Takes the form to_*'s and turns them back into the the topics from the info set before using the Lists set before

editarticle.template

to pull out the to_* lists it uses a loop


      <p class="optional">
        <strong>${lang("posting.to_uk")}</strong>
        <br>
        ${lang("posting.to_uk.info")}
        <br>
        <list uk as t>
          <input type="checkbox" name="to_region" id="to_region_${t.id}" value="${t.id}"
            <list to_uk as to><if (t.id == to)>checked="checked" </if></list>>
          <label for="to_uk_${t.id}">${t.title}</label>
          <br>
        </list>
      </p>

      <p class="optional">
        <strong>${lang("posting.to_region")}</strong>
        <br>
        ${lang("posting.to_region.info")}
        <br>
        <list regions as t>
          <input type="checkbox" name="to_region" id="to_region_${t.id}" value="${t.id}"
            <list to_region as to><if (t.id == to)>checked="checked" </if></list>>
          <label for="to_region_${t.id}">${t.title}</label>
          <br>
        </list>
        <em>(${lang("optional")})</em>
      </p>
etc...

Now really uk doesn't even need to be a List but hey ho!

open_en.properties

This replaces the included language variable on the form above. It's located in etc/bundles

posting.title=<strong>title</strong> of your article
posting.title.info=(Please use a unique and meaningful title)
posting.to_uk=For the Front Page
posting.to_uk.info=If your post isn't just for a kolletives region page or a topic page
posting.to_issue=<strong>Topic</strong> of your posting
posting.to_issue.info=(multiple selection is possible, max 3)

-- WikiKes - 18 Dec 2004
to top


You are here: Local > ImcUk > ImcUkTech > UkMirUkTopic

to top

Copyright © 1999-2008 by the contributing authors.
All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding this tool? Send feedback (in English, Francais, Deutsch or Dutch).