MidCOM svn: r22014 - in branches/ragnaroek/midcom/org.maemo.brainstorm: . config handler idea locale midcom static style

netblade midcom-commits at lists.midgard-project.org
Sat Apr 25 22:20:34 CEST 2009


Author: netblade
Date: Sat Apr 25 22:20:33 2009
New Revision: 22014
URL: http://trac.midgard-project.org/changeset/22014

Log:
even more functinality to component, refs #1082


Added:
   branches/ragnaroek/midcom/org.maemo.brainstorm/config/schemadb_milestone_default.inc
   branches/ragnaroek/midcom/org.maemo.brainstorm/handler/milestone.php
   branches/ragnaroek/midcom/org.maemo.brainstorm/handler/sandbox.php
   branches/ragnaroek/midcom/org.maemo.brainstorm/milestone.php
   branches/ragnaroek/midcom/org.maemo.brainstorm/style/admin-manage-milestones.php
   branches/ragnaroek/midcom/org.maemo.brainstorm/style/admin-milestone-create.php
   branches/ragnaroek/midcom/org.maemo.brainstorm/style/admin-milestone-delete.php
   branches/ragnaroek/midcom/org.maemo.brainstorm/style/admin-milestone-update.php
   branches/ragnaroek/midcom/org.maemo.brainstorm/style/sandbox-end.php
   branches/ragnaroek/midcom/org.maemo.brainstorm/style/sandbox-item.php
   branches/ragnaroek/midcom/org.maemo.brainstorm/style/sandbox-start.php
Removed:
   branches/ragnaroek/midcom/org.maemo.brainstorm/idea/._solution.php
Modified:
   branches/ragnaroek/midcom/org.maemo.brainstorm/config/config.inc
   branches/ragnaroek/midcom/org.maemo.brainstorm/config/manifest.inc
   branches/ragnaroek/midcom/org.maemo.brainstorm/config/mgdschema.xml
   branches/ragnaroek/midcom/org.maemo.brainstorm/config/midcom_dba_classes.inc
   branches/ragnaroek/midcom/org.maemo.brainstorm/config/schemadb_idea_default.inc
   branches/ragnaroek/midcom/org.maemo.brainstorm/handler/idea.php
   branches/ragnaroek/midcom/org.maemo.brainstorm/handler/index.php
   branches/ragnaroek/midcom/org.maemo.brainstorm/handler/solution.php
   branches/ragnaroek/midcom/org.maemo.brainstorm/idea.php
   branches/ragnaroek/midcom/org.maemo.brainstorm/locale/default.en.txt
   branches/ragnaroek/midcom/org.maemo.brainstorm/locale/default.fi.txt
   branches/ragnaroek/midcom/org.maemo.brainstorm/midcom/interfaces.php
   branches/ragnaroek/midcom/org.maemo.brainstorm/static/brainstorm.css
   branches/ragnaroek/midcom/org.maemo.brainstorm/style/index-item.php
   branches/ragnaroek/midcom/org.maemo.brainstorm/style/index-start.php
   branches/ragnaroek/midcom/org.maemo.brainstorm/style/navigation-sub.php
   branches/ragnaroek/midcom/org.maemo.brainstorm/style/navigation-top.php
   branches/ragnaroek/midcom/org.maemo.brainstorm/style/show-idea-solutions.php
   branches/ragnaroek/midcom/org.maemo.brainstorm/style/show-idea.php
   branches/ragnaroek/midcom/org.maemo.brainstorm/viewer.php

Modified: branches/ragnaroek/midcom/org.maemo.brainstorm/config/config.inc
==============================================================================
--- branches/ragnaroek/midcom/org.maemo.brainstorm/config/config.inc	(original)
+++ branches/ragnaroek/midcom/org.maemo.brainstorm/config/config.inc	Sat Apr 25 22:20:33 2009
@@ -3,6 +3,7 @@
 /* The schema database to use */
 'schemadb_idea' => 'file:/org/maemo/brainstorm/config/schemadb_idea_default.inc',
 'schemadb_solution' => 'file:/org/maemo/brainstorm/config/schemadb_solution_default.inc',
+'schemadb_milestone' => 'file:/org/maemo/brainstorm/config/schemadb_milestone_default.inc',
 'schema_idea' => 'default',
 'schema_solution' => 'default',
 'schemadb_config' => 'file:/net/nemein/faq/config/config_schemadb.inc',

Modified: branches/ragnaroek/midcom/org.maemo.brainstorm/config/manifest.inc
==============================================================================
--- branches/ragnaroek/midcom/org.maemo.brainstorm/config/manifest.inc	(original)
+++ branches/ragnaroek/midcom/org.maemo.brainstorm/config/manifest.inc	Sat Apr 25 22:20:33 2009
@@ -2,7 +2,10 @@
 'purecode' => false,
 'version' => '0.0.1',
 'state' => 'beta',
-'privileges' => array(),
+'privileges' => array
+(
+    'moderation' => MIDCOM_PRIVILEGE_DENY,
+),
 'class_definitions' => array
 (
     'midcom_dba_classes.inc',

Modified: branches/ragnaroek/midcom/org.maemo.brainstorm/config/mgdschema.xml
==============================================================================
--- branches/ragnaroek/midcom/org.maemo.brainstorm/config/mgdschema.xml	(original)
+++ branches/ragnaroek/midcom/org.maemo.brainstorm/config/mgdschema.xml	Sat Apr 25 22:20:33 2009
@@ -19,6 +19,9 @@
         <property name="status" type="unsigned integer" index="yes">
             <description>Status of the idea</description>
         </property>
+        <property name="milestone" link="org_maemo_brainstorm_milestone:id" type="unsigned integer">
+            <description>Milestone of the idea</description>
+        </property>
         <property name="category" type="string" index="yes">
             <description>Category of the idea</description>
         </property>
@@ -44,4 +47,25 @@
             <description>Description of the solution</description>
         </property>
     </type>
+
+    <type name="org_maemo_brainstorm_milestone" table="org_maemo_brainstorm_milestone">
+        <property name="id" type="unsigned integer" primaryfield="id">
+            <description>Local non-replication-safe database identifier</description>
+        </property>
+        <property name="topic" link="midgard_topic:id" type="unsigned integer" parentfield="topic">
+            <description>Topic which the idea relates to</description>
+        </property>
+        <property name="name" type="string" index="yes">
+            <description>URL name of the milestone</description>
+        </property>
+        <property name="title" type="string">
+            <description>Title of the milestone</description>
+        </property>
+        <property name="content" type="text">
+            <description>Description of the milestone</description>
+        </property>
+        <property name="status" type="unsigned integer">
+            <description>Status of the milestone</description>
+        </property>
+    </type>
 </Schema>
\ No newline at end of file

Modified: branches/ragnaroek/midcom/org.maemo.brainstorm/config/midcom_dba_classes.inc
==============================================================================
--- branches/ragnaroek/midcom/org.maemo.brainstorm/config/midcom_dba_classes.inc	(original)
+++ branches/ragnaroek/midcom/org.maemo.brainstorm/config/midcom_dba_classes.inc	Sat Apr 25 22:20:33 2009
@@ -5,4 +5,8 @@
 array(
     'mgdschema_class_name' => 'org_maemo_brainstorm_idea_solution',
     'midcom_class_name' => 'org_maemo_brainstorm_idea_solution_dba',
+),
+array(
+    'mgdschema_class_name' => 'org_maemo_brainstorm_milestone',
+    'midcom_class_name' => 'org_maemo_brainstorm_milestone_dba',
 ),
\ No newline at end of file

Modified: branches/ragnaroek/midcom/org.maemo.brainstorm/config/schemadb_idea_default.inc
==============================================================================
--- branches/ragnaroek/midcom/org.maemo.brainstorm/config/schemadb_idea_default.inc	(original)
+++ branches/ragnaroek/midcom/org.maemo.brainstorm/config/schemadb_idea_default.inc	Sat Apr 25 22:20:33 2009
@@ -42,14 +42,13 @@
             (
                 'options'        => Array
                 (
-                    ORG_MAEMO_BRAINSTORM_STATUS_SANDBOX             => 'sandbox, general',
-                    ORG_MAEMO_BRAINSTORM_STATUS_SANDBOX_WAITING     => 'sandbox, waiting for approval',
-                    ORG_MAEMO_BRAINSTORM_STATUS_SANDBOX_INVALID     => 'sandbox, invalid',
-                    ORG_MAEMO_BRAINSTORM_STATUS_SANDBOX_IMPLEMENTED => 'sandbox, implemented',
-                    ORG_MAEMO_BRAINSTORM_STATUS_SANDBOX_DUPLICATE   => 'sandbox, duplicate',
-                    ORG_MAEMO_BRAINSTORM_STATUS_UNDER_VOTE          => 'under vote',
-                    ORG_MAEMO_BRAINSTORM_STATUS_IN_DEVELOPMENT      => 'in development',
-                    ORG_MAEMO_BRAINSTORM_STATUS_IMPLEMENTED         => 'implemented',
+                    ORG_MAEMO_BRAINSTORM_IDEA_STATUS_SANDBOX_WAITING     => 'sandbox, waiting for approval',
+                    ORG_MAEMO_BRAINSTORM_IDEA_STATUS_SANDBOX_INVALID     => 'sandbox, invalid',
+                    ORG_MAEMO_BRAINSTORM_IDEA_STATUS_SANDBOX_IMPLEMENTED => 'sandbox, implemented',
+                    ORG_MAEMO_BRAINSTORM_IDEA_STATUS_SANDBOX_DUPLICATE   => 'sandbox, duplicate',
+                    ORG_MAEMO_BRAINSTORM_IDEA_STATUS_UNDER_VOTE          => 'under vote',
+                    ORG_MAEMO_BRAINSTORM_IDEA_STATUS_IN_DEVELOPMENT      => 'in development',
+                    ORG_MAEMO_BRAINSTORM_IDEA_STATUS_IMPLEMENTED         => 'implemented',
                 ),
                 'allow_other'    => false,
                 'allow_multiple' => false,

Added: branches/ragnaroek/midcom/org.maemo.brainstorm/config/schemadb_milestone_default.inc
==============================================================================
--- (empty file)
+++ branches/ragnaroek/midcom/org.maemo.brainstorm/config/schemadb_milestone_default.inc	Sat Apr 25 22:20:33 2009
@@ -0,0 +1,55 @@
+'default' => array
+(
+    'description' => 'milestone',
+    'fields'      => array
+    (
+        'name' => Array
+        (
+            // COMPONENT-REQUIRED
+            'title' => 'url name',
+            'storage' => 'name',
+            'type' => 'urlname',
+            'widget' => 'text',
+        ),
+        'title' => Array
+        (
+            // COMPONENT-REQUIRED
+            'title' => 'title',
+            'storage' => 'title',
+            'required' => true,
+            'type' => 'text',
+            'widget' => 'text',
+        ),
+        'content' => Array
+        (
+            // COMPONENT-REQUIRED
+            'title' => 'content',
+            'storage' => 'content',
+            'required' => true,
+            'type' => 'text',
+            'type_config' => array
+            (
+                'output_mode' => 'html'
+            ),
+            'widget' => 'tinymce',
+        ),
+        'status' => Array
+        (
+            'title' => 'status',
+            'storage' => 'status',
+            'type' => 'select',
+            'type_config' => array
+            (
+                'options'        => Array
+                (
+                    ORG_MAEMO_BRAINSTORM_MILESTONE_STATUS_ACTIVE       => 'active',
+                    ORG_MAEMO_BRAINSTORM_MILESTONE_STATUS_ARCHIVED     => 'archived',
+                ),
+                'allow_other'    => false,
+                'allow_multiple' => false,
+            ),
+            'widget' => 'select',
+        ),
+    ),
+),
+

Modified: branches/ragnaroek/midcom/org.maemo.brainstorm/handler/idea.php
==============================================================================
--- branches/ragnaroek/midcom/org.maemo.brainstorm/handler/idea.php	(original)
+++ branches/ragnaroek/midcom/org.maemo.brainstorm/handler/idea.php	Sat Apr 25 22:20:33 2009
@@ -54,7 +54,7 @@
     public function _get_object_url()
     {
         $prefix = $_MIDCOM->get_context_data(MIDCOM_CONTEXT_ANCHORPREFIX);
-        $url = $prefix . $this->_idea->name . '/';
+        $url = $prefix . 'view/' . $this->_idea->name . '/';
         return $url;
     }
     
@@ -123,6 +123,18 @@
                 );
             }
         }
+        if ($this->_object->can_do('midgard:delete'))
+        {
+            $this->_view_toolbar->add_item
+            (
+                array
+                (
+                    MIDCOM_TOOLBAR_URL => "delete/{$this->_object->name}/",
+                    MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('delete idea'),
+                    MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/delete.png',
+                )
+            );
+        }
     }
 
     public function _show_create($handler_id, &$data)

Modified: branches/ragnaroek/midcom/org.maemo.brainstorm/handler/index.php
==============================================================================
--- branches/ragnaroek/midcom/org.maemo.brainstorm/handler/index.php	(original)
+++ branches/ragnaroek/midcom/org.maemo.brainstorm/handler/index.php	Sat Apr 25 22:20:33 2009
@@ -62,7 +62,7 @@
         $this->_datamanager_solution = new midcom_helper_datamanager2_datamanager($data['schemadb_solution']);
         $qb->add_constraint('topic', '=', $this->_request_data['content_topic']->id);
         // remove comment, when we have more finished handlers
-//        $qb->add_constraint('status', '=', ORG_MAEMO_BRAINSTORM_STATUS_UNDER_VOTE);
+//        $qb->add_constraint('status', '=', ORG_MAEMO_BRAINSTORM_IDEA_STATUS_UNDER_VOTE);
         $this->_ideas = $qb->execute();
 
         $this->_update_breadcrumb_line($handler_id);

Added: branches/ragnaroek/midcom/org.maemo.brainstorm/handler/milestone.php
==============================================================================
--- (empty file)
+++ branches/ragnaroek/midcom/org.maemo.brainstorm/handler/milestone.php	Sat Apr 25 22:20:33 2009
@@ -0,0 +1,237 @@
+<?php
+/**
+* 
+*/
+class org_maemo_brainstorm_handler_milestone extends midcom_baseclasses_components_handler_crud
+{
+    var $_milestone = null;
+
+    function __construct()
+    {
+        parent::__construct();
+    }
+    
+    public function _load_object($handler_id, $args, &$data)
+    {
+        $qb = org_maemo_brainstorm_milestone_dba::new_query_builder();
+        $qb->add_constraint('topic', '=', $this->_request_data['content_topic']->id);
+        $qb->add_constraint('name', '=', $args[0]);
+        $qb->set_limit(1);
+        $objects = $qb->execute();
+
+        if (   is_array($objects)
+            && count($objects)>0)
+        {
+            $this->_object = new org_maemo_brainstorm_milestone_dba($objects[0]->guid);
+            $this->_milestone = $this->_object;
+        }
+        else
+        {
+            debug_push_class(__CLASS__, __FUNCTION__);
+            debug_pop();
+            $_MIDCOM->generate_error(MIDCOM_ERRNOTFOUND,
+                'Failed to load milestone, cannot continue. Last Midgard error was: '. midgard_connection::get_error_string());
+            // This will exit.
+        }
+
+        return $this->_object;
+    }
+    
+    public function _load_parent($handler_id, $args, &$data)
+    {
+        return;
+    }
+    
+    public function _load_schemadb()
+    {
+        $this->_schemadb =& $this->_request_data['schemadb_milestone'];
+    }
+    
+    public function _get_object_url()
+    {
+        $prefix = $_MIDCOM->get_context_data(MIDCOM_CONTEXT_ANCHORPREFIX);
+        $url = $prefix . 'view_milestone/' . $this->_milestone->name . '/';
+        return $url;
+    }
+    
+    public function _update_breadcrumb($handler_id)
+    {
+        return;
+    }
+    
+    public function _update_title($handler_id)
+    {
+        return;
+    }
+    
+    function &dm2_create_callback(&$controller)
+    {
+        $this->_milestone = new org_maemo_brainstorm_milestone_dba();
+        $this->_milestone->topic = $this->_request_data['content_topic']->id;
+        
+        if (! $this->_milestone->create())
+        {
+            debug_push_class(__CLASS__, __FUNCTION__);
+            debug_print_r('We operated on this object:', $this->_milestone);
+            debug_pop();
+            $_MIDCOM->generate_error(MIDCOM_ERRNOTFOUND,
+                'Failed to create a new milestone, cannot continue. Last Midgard error was: '. midgard_connection::get_error_string());
+            // This will exit.
+        }
+
+        return $this->_milestone;
+    }
+    
+    public function _populate_toolbar($handler_id)
+    {
+        if ($this->_topic->can_do('org.maemo.brainstorm:moderation'))
+        {
+            foreach (array_keys($this->_request_data['schemadb_milestone']) as $name)
+            {
+                $this->_node_toolbar->add_item
+                (
+                    array
+                    (
+                        MIDCOM_TOOLBAR_URL => "create_milestone/{$name}/",
+                        MIDCOM_TOOLBAR_LABEL => sprintf
+                        (
+                            $this->_l10n_midcom->get('create %s'),
+                            $this->_request_data['schemadb_milestone'][$name]->description
+                        ),
+                        MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/new-text.png',
+                    )
+                );
+            }
+        }
+        if (!$this->_object)
+        {
+            return;
+        }
+        if ($this->_object->can_do('midgard:update'))
+        {
+            $this->_view_toolbar->add_item
+            (
+                array
+                (
+                    MIDCOM_TOOLBAR_URL => "edit_milestone/{$this->_object->name}/",
+                    MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('edit milestone'),
+                    MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png',
+                )
+            );
+        }
+        if ($this->_object->can_do('midgard:delete'))
+        {
+            $this->_view_toolbar->add_item
+            (
+                array
+                (
+                    MIDCOM_TOOLBAR_URL => "delete_milestone/{$this->_object->name}/",
+                    MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('delete milestone'),
+                    MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/delete.png',
+                )
+            );
+        }
+    }
+
+    public function _handler_manage($handler_id, &$data)
+    {
+        if ($this->_topic->can_do('org.maemo.brainstorm:moderation'))
+        {
+            foreach (array_keys($this->_request_data['schemadb_milestone']) as $name)
+            {
+                $this->_node_toolbar->add_item
+                (
+                    array
+                    (
+                        MIDCOM_TOOLBAR_URL => "create_milestone/{$name}/",
+                        MIDCOM_TOOLBAR_LABEL => sprintf
+                        (
+                            $this->_l10n_midcom->get('create %s'),
+                            $this->_request_data['schemadb_milestone'][$name]->description
+                        ),
+                        MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/new-text.png',
+                    )
+                );
+            }
+            if (   isset($_POST)
+                && array_key_exists('default_milestone', $_POST))
+            {
+                $this->_request_data['content_topic']->set_parameter('org.maemo.brainstorm', 'default_milestone', $_POST['default_milestone']);
+                $_MIDCOM->relocate($_MIDCOM->get_context_data(MIDCOM_CONTEXT_ANCHORPREFIX).'manage_milestones/');
+            }
+        }
+        $qb_active = org_maemo_brainstorm_milestone_dba::new_query_builder();
+        $qb_active->add_constraint('topic', '=', $this->_request_data['content_topic']->id);
+        $qb_active->add_constraint('status', '=', ORG_MAEMO_BRAINSTORM_MILESTONE_STATUS_ACTIVE);
+        $this->_active_milestones = $qb_active->execute();
+        
+        $qb_archived = org_maemo_brainstorm_milestone_dba::new_query_builder();
+        $qb_archived->add_constraint('topic', '=', $this->_request_data['content_topic']->id);
+        $qb_archived->add_constraint('status', '=', ORG_MAEMO_BRAINSTORM_MILESTONE_STATUS_ARCHIVED);
+        $this->_archived_milestones = $qb_archived->execute();
+        
+        $this->_request_data['active_milestones'] = $this->_active_milestones;
+        $this->_request_data['archived_milestones'] = $this->_archived_milestones;
+
+        return true;
+    }
+
+    public function _show_manage($handler_id, &$data)
+    {
+        midcom_show_style('header');
+        midcom_show_style('navigation-start');
+        midcom_show_style('navigation-top');
+        midcom_show_style('navigation-sub');
+        midcom_show_style('navigation-end');
+        midcom_show_style('admin-manage-milestones');
+        midcom_show_style('footer');
+    }
+
+    public function _show_create($handler_id, &$data)
+    {
+        midcom_show_style('header');
+        midcom_show_style('navigation-start');
+        midcom_show_style('navigation-top');
+        midcom_show_style('navigation-sub');
+        midcom_show_style('navigation-end');
+        midcom_show_style('admin-milestone-create');
+        midcom_show_style('footer');
+    }
+    
+    public function _show_read($handler_id, &$data)
+    {
+        $this->_request_data['view_milestone'] = $data['datamanager']->get_content_html();
+
+        midcom_show_style('header');
+        midcom_show_style('navigation-start');
+        midcom_show_style('navigation-top');
+        midcom_show_style('navigation-sub');
+        midcom_show_style('navigation-end');
+        midcom_show_style('show-milestone');
+        midcom_show_style('footer');
+    }
+
+    public function _show_update($handler_id, &$data)
+    {
+        midcom_show_style('header');
+        midcom_show_style('navigation-start');
+        midcom_show_style('navigation-top');
+        midcom_show_style('navigation-sub');
+        midcom_show_style('navigation-end');
+        midcom_show_style('admin-milestone-update');
+        midcom_show_style('footer');
+    }
+    
+    public function _show_delete($handler_id, &$data)
+    {
+        midcom_show_style('header');
+        midcom_show_style('navigation-start');
+        midcom_show_style('navigation-top');
+        midcom_show_style('navigation-sub');
+        midcom_show_style('navigation-end');
+        midcom_show_style('admin-milestone-delete');
+        midcom_show_style('footer');
+    }
+}
+
+?>
\ No newline at end of file

Added: branches/ragnaroek/midcom/org.maemo.brainstorm/handler/sandbox.php
==============================================================================
--- (empty file)
+++ branches/ragnaroek/midcom/org.maemo.brainstorm/handler/sandbox.php	Sat Apr 25 22:20:33 2009
@@ -0,0 +1,175 @@
+<?php
+/**
+ * @package org.maemo.brainstorm
+ * @author The Midgard Project, http://www.midgard-project.org
+ * @copyright The Midgard Project, http://www.midgard-project.org
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License
+ */
+
+/**
+ * This is a URL handler class for org.maemo.brainstorm
+ *
+ * The midcom_baseclasses_components_handler class defines a bunch of helper vars
+ *
+ * @see midcom_baseclasses_components_handler
+ * @see: http://www.midgard-project.org/api-docs/midcom/dev/midcom.baseclasses/midcom_baseclasses_components_handler/
+ * 
+ * @package org.maemo.brainstorm
+ */
+class org_maemo_brainstorm_handler_sandbox extends midcom_baseclasses_components_handler
+{
+
+    /**
+     * Simple default constructor.
+     */
+    function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * _on_initialize is called by midcom on creation of the handler.
+     */
+    function _on_initialize()
+    {
+    }
+    
+    /**
+     * Simple helper which references all important members to the request data listing
+     * for usage within the style listing.
+     */
+    function _prepare_request_data()
+    {
+        $this->_request_data['datamanager_idea'] =& $this->_datamanager_idea;
+        $this->_request_data['datamanager_solution'] =& $this->_datamanager_solution;
+    }
+
+    /**
+     * The handler for the index article.
+     *
+     * @param mixed $handler_id the array key from the request array
+     * @param array $args the arguments given to the handler
+     * @param Array &$data The local request data.
+     * @return boolean Indicating success.
+     */
+    function _handler_list($handler_id, $args, &$data)
+    {
+        $this->_request_data['name']  = "org.maemo.brainstorm";
+        
+        $qb = org_maemo_brainstorm_idea_dba::new_query_builder();
+        $this->_datamanager_idea = new midcom_helper_datamanager2_datamanager($data['schemadb_idea']);
+
+        $this->_datamanager_solution = new midcom_helper_datamanager2_datamanager($data['schemadb_solution']);
+        $qb->add_constraint('topic', '=', $this->_request_data['content_topic']->id);
+        if (   $handler_id == 'list_sandbox_substatus'
+                || $handler_id == 'list_sandbox_substatus_orderby')
+        {
+            switch ($args[0])
+            {
+                default:
+                case 'waiting':
+                    $qb->add_constraint('status', '=', ORG_MAEMO_BRAINSTORM_IDEA_STATUS_SANDBOX_WAITING);
+                  break;
+                case 'invalid':
+                    $qb->add_constraint('status', '=', ORG_MAEMO_BRAINSTORM_IDEA_STATUS_SANDBOX_INVALID);
+                  break;
+                case 'implemented':
+                    $qb->add_constraint('status', '=', ORG_MAEMO_BRAINSTORM_IDEA_STATUS_SANDBOX_IMPLEMENTED);
+                  break;
+                case 'duplicate':
+                    $qb->add_constraint('status', '=', ORG_MAEMO_BRAINSTORM_IDEA_STATUS_SANDBOX_DUPLICATE);
+                  break;
+            }
+        }
+        else
+        {
+            $qb->add_constraint('status', '=', ORG_MAEMO_BRAINSTORM_IDEA_STATUS_SANDBOX_WAITING);
+        }
+
+        $this->_ideas = $qb->execute();
+
+        $this->_update_breadcrumb_line($handler_id);
+        $this->_prepare_request_data();
+        $title = $this->_l10n_midcom->get('index');
+        $this->_request_data['sort_order'] = $this->_config->get('sort_order');
+        return true;
+    }
+
+    /**
+     * This function does the output.
+     *
+     * @param mixed $handler_id The ID of the handler.
+     * @param mixed &$data The local request data.
+     */
+    function _show_list($handler_id, &$data)
+    {
+
+        if ($this->_config->get('comments_enable'))
+        {
+            $comments_node = org_maemo_brainstorm_viewer::_seek_comments();
+        }
+        
+        if ($this->_config->get('favourites_enable'))
+        {
+            $favourites_node = org_maemo_brainstorm_viewer::_seek_favourites();
+        }
+
+        midcom_show_style('header');
+        midcom_show_style('navigation-start');
+        midcom_show_style('navigation-top');
+        midcom_show_style('navigation-sub');
+        midcom_show_style('navigation-end');
+        midcom_show_style('sandbox-start');
+        foreach ($this->_ideas as $idea)
+        {
+            if ($this->_config->get('comments_enable'))
+            {
+                if ($comments_node)
+                {
+                    $this->_request_data['comments_url'] = $comments_node[MIDCOM_NAV_RELATIVEURL] . "comment/{$idea->guid}";
+                }
+            }
+            
+            if ($this->_config->get('favourites_enable'))
+            {
+                if ($favourites_node)
+                {
+                    $this->_request_data['favourites_url'] = $favourites_node[MIDCOM_NAV_RELATIVEURL];
+                }
+            }
+
+            if (! $this->_datamanager_idea->autoset_storage($idea))
+            {
+                debug_push_class(__CLASS__, __FUNCTION__);
+                debug_add("The datamanager for idea {$idea->id} could not be initialized, skipping it.");
+                debug_print_r('Object was:', $idea);
+                debug_pop();
+                continue;
+            }
+            $this->_request_data['view_idea'] = $data['datamanager_idea']->get_content_html();
+            $this->_request_data['idea'] = $idea;
+            midcom_show_style('sandbox-item');
+        }
+        midcom_show_style('sandbox-end');
+        midcom_show_style('footer');
+    }
+
+    /**
+     * Helper, updates the context so that we get a complete breadcrumb line towards the current
+     * location.
+     *
+     */
+    function _update_breadcrumb_line()
+    {
+        $tmp = Array();
+
+        $tmp[] = Array
+        (
+            MIDCOM_NAV_URL => "/",
+            MIDCOM_NAV_NAME => $this->_l10n->get('sandbox'),
+        );
+
+        $_MIDCOM->set_custom_context_data('midcom.helper.nav.breadcrumb', $tmp);
+    }
+}
+?>
\ No newline at end of file

Modified: branches/ragnaroek/midcom/org.maemo.brainstorm/handler/solution.php
==============================================================================
--- branches/ragnaroek/midcom/org.maemo.brainstorm/handler/solution.php	(original)
+++ branches/ragnaroek/midcom/org.maemo.brainstorm/handler/solution.php	Sat Apr 25 22:20:33 2009
@@ -69,7 +69,7 @@
     public function _get_object_url()
     {
         $prefix = $_MIDCOM->get_context_data(MIDCOM_CONTEXT_ANCHORPREFIX);
-        $url = $prefix . $this->_idea->name . '/' . $this->_solution->name . '/';
+        $url = $prefix . 'view_solution/' . $this->_idea->name . '/' . $this->_solution->name . '/';
         return $url;
     }
     
@@ -103,6 +103,34 @@
     
     public function _populate_toolbar($handler_id)
     {
+        if (!$this->_object)
+        {
+            return;
+        }
+        if ($this->_object->can_do('midgard:update'))
+        {
+            $this->_view_toolbar->add_item
+            (
+                array
+                (
+                    MIDCOM_TOOLBAR_URL => "edit_solution/{$this->_object->name}/",
+                    MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('edit solution'),
+                    MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png',
+                )
+            );
+        }
+        if ($this->_object->can_do('midgard:delete'))
+        {
+            $this->_view_toolbar->add_item
+            (
+                array
+                (
+                    MIDCOM_TOOLBAR_URL => "delete_solution/{$this->_object->name}/",
+                    MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('delete solution'),
+                    MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/delete.png',
+                )
+            );
+        }
         return;
     }
     

Modified: branches/ragnaroek/midcom/org.maemo.brainstorm/idea.php
==============================================================================
--- branches/ragnaroek/midcom/org.maemo.brainstorm/idea.php	(original)
+++ branches/ragnaroek/midcom/org.maemo.brainstorm/idea.php	Sat Apr 25 22:20:33 2009
@@ -30,5 +30,6 @@
         $this->metadata->score = $new_score;
 
         $this->update();
-    }}
+    }
+}
 ?>
\ No newline at end of file

Modified: branches/ragnaroek/midcom/org.maemo.brainstorm/locale/default.en.txt
==============================================================================
--- branches/ragnaroek/midcom/org.maemo.brainstorm/locale/default.en.txt	(original)
+++ branches/ragnaroek/midcom/org.maemo.brainstorm/locale/default.en.txt	Sat Apr 25 22:20:33 2009
@@ -44,4 +44,36 @@
 
 ---STRING posted on %s
 Posted on %s
+---STRINGEND
+
+---STRING create milestone
+Create milestone
+---STRINGEND
+
+---STRING update milestone
+Update milestone
+---STRINGEND
+
+---STRING delete milestone
+Delete milestone
+---STRINGEND
+
+---STRING manage milestones
+Manage milestones
+---STRINGEND
+
+---STRING active milestones
+Active milestones
+---STRINGEND
+
+---STRING archived milestones
+Archived milestones
+---STRINGEND
+
+---STRING edit
+Edit
+---STRINGEND
+
+---STRING remove
+Remove
 ---STRINGEND
\ No newline at end of file

Modified: branches/ragnaroek/midcom/org.maemo.brainstorm/locale/default.fi.txt
==============================================================================
--- branches/ragnaroek/midcom/org.maemo.brainstorm/locale/default.fi.txt	(original)
+++ branches/ragnaroek/midcom/org.maemo.brainstorm/locale/default.fi.txt	Sat Apr 25 22:20:33 2009
@@ -44,4 +44,36 @@
 
 ---STRING posted on %s
 Kirjoitettu %s
+---STRINGEND
+
+---STRING create milestone
+Luo milestone
+---STRINGEND
+
+---STRING update milestone
+Muokkaa milestone
+---STRINGEND
+
+---STRING delete milestone
+Poista milestone
+---STRINGEND
+
+---STRING manage milestones
+Hallinnoi milestones
+---STRINGEND
+
+---STRING active milestones
+Aktiiviset milestones
+---STRINGEND
+
+---STRING archived milestones
+Arkistoidut milestones
+---STRINGEND
+
+---STRING edit
+Muokkaa
+---STRINGEND
+
+---STRING remove
+Poista
 ---STRINGEND
\ No newline at end of file

Modified: branches/ragnaroek/midcom/org.maemo.brainstorm/midcom/interfaces.php
==============================================================================
--- branches/ragnaroek/midcom/org.maemo.brainstorm/midcom/interfaces.php	(original)
+++ branches/ragnaroek/midcom/org.maemo.brainstorm/midcom/interfaces.php	Sat Apr 25 22:20:33 2009
@@ -31,21 +31,26 @@
 
     private function define_constants()
     {
+        // Status definitions for ideas
         // Sandbox
-        define('ORG_MAEMO_BRAINSTORM_STATUS_SANDBOX', 1010);
-        define('ORG_MAEMO_BRAINSTORM_STATUS_SANDBOX_WAITING', 1011);
-        define('ORG_MAEMO_BRAINSTORM_STATUS_SANDBOX_INVALID', 1012);
-        define('ORG_MAEMO_BRAINSTORM_STATUS_SANDBOX_IMPLEMENTED', 1013);
-        define('ORG_MAEMO_BRAINSTORM_STATUS_SANDBOX_DUPLICATE', 1014);
+        define('ORG_MAEMO_BRAINSTORM_IDEA_STATUS_SANDBOX', 1010);
+        define('ORG_MAEMO_BRAINSTORM_IDEA_STATUS_SANDBOX_WAITING', 1011);
+        define('ORG_MAEMO_BRAINSTORM_IDEA_STATUS_SANDBOX_INVALID', 1012);
+        define('ORG_MAEMO_BRAINSTORM_IDEA_STATUS_SANDBOX_IMPLEMENTED', 1013);
+        define('ORG_MAEMO_BRAINSTORM_IDEA_STATUS_SANDBOX_DUPLICATE', 1014);
 
         // Under voting
-        define('ORG_MAEMO_BRAINSTORM_STATUS_UNDER_VOTE', 1020);
+        define('ORG_MAEMO_BRAINSTORM_IDEA_STATUS_UNDER_VOTE', 1020);
 
         // In development
-        define('ORG_MAEMO_BRAINSTORM_STATUS_IN_DEVELOPMENT', 1030);
+        define('ORG_MAEMO_BRAINSTORM_IDEA_STATUS_IN_DEVELOPMENT', 1030);
 
         // Implemented
-        define('ORG_MAEMO_BRAINSTORM_STATUS_IMPLEMENTED', 1040);
+        define('ORG_MAEMO_BRAINSTORM_IDEA_STATUS_IMPLEMENTED', 1040);
+        
+        // Status definitions for milestones
+        define('ORG_MAEMO_BRAINSTORM_MILESTONE_STATUS_ACTIVE', 1500);
+        define('ORG_MAEMO_BRAINSTORM_MILESTONE_STATUS_ARCHIVED', 1510);
     }
     
     function _on_watched_dba_create($favourite)

Added: branches/ragnaroek/midcom/org.maemo.brainstorm/milestone.php
==============================================================================
--- (empty file)
+++ branches/ragnaroek/midcom/org.maemo.brainstorm/milestone.php	Sat Apr 25 22:20:33 2009
@@ -0,0 +1,5 @@
+<?php
+class org_maemo_brainstorm_milestone_dba extends __org_maemo_brainstorm_milestone_dba
+{
+}
+?>
\ No newline at end of file

Modified: branches/ragnaroek/midcom/org.maemo.brainstorm/static/brainstorm.css
==============================================================================
--- branches/ragnaroek/midcom/org.maemo.brainstorm/static/brainstorm.css	(original)
+++ branches/ragnaroek/midcom/org.maemo.brainstorm/static/brainstorm.css	Sat Apr 25 22:20:33 2009
@@ -31,19 +31,22 @@
     color: #FFFFFF;
 }
 
-#brainstorm #brainstorm_nav #brainstorm_nav_milestones
+#brainstorm #brainstorm_nav #brainstorm_nav_milestones,
+#brainstorm #brainstorm_nav #brainstorm_nav_sandbox
 {
     clear: both;
     border: 1px solid #4F5050;
     margin: 5px 0px;
 }
 
-#brainstorm #brainstorm_nav #brainstorm_nav_milestones ul li
+#brainstorm #brainstorm_nav #brainstorm_nav_milestones ul li,
+#brainstorm #brainstorm_nav #brainstorm_nav_sandbox ul li
 {
     float: left;
 }
 
-#brainstorm #brainstorm_nav #brainstorm_nav_milestones a
+#brainstorm #brainstorm_nav #brainstorm_nav_milestones a,
+#brainstorm #brainstorm_nav #brainstorm_nav_sandbox a
 {
     color: #4F5050;
     display: block;
@@ -53,7 +56,9 @@
 }
 
 #brainstorm #brainstorm_nav #brainstorm_nav_milestones a:hover,
-#brainstorm #brainstorm_nav #brainstorm_nav_milestones li.active a
+#brainstorm #brainstorm_nav #brainstorm_nav_milestones li.active a,
+#brainstorm #brainstorm_nav #brainstorm_nav_sandbox a:hover,
+#brainstorm #brainstorm_nav #brainstorm_nav_sandbox li.active a
 {
     color: #FFFFFF;
     background-color: #FB9200;

Added: branches/ragnaroek/midcom/org.maemo.brainstorm/style/admin-manage-milestones.php
==============================================================================
--- (empty file)
+++ branches/ragnaroek/midcom/org.maemo.brainstorm/style/admin-manage-milestones.php	Sat Apr 25 22:20:33 2009
@@ -0,0 +1,58 @@
+<?php
+$static_url = MIDCOM_STATIC_URL;
+$prefix = $_MIDCOM->get_context_data(MIDCOM_CONTEXT_ANCHORPREFIX);
+?>
+
+<h2><?php echo $data['l10n']->get('manage milestones'); ?></h2>
+<h3><?php echo $data['l10n']->get('active milestones'); ?></h3>
+<form method="POST">
+<table>
+    <tr>
+        <th><?php echo $data['l10n']->get('set as default'); ?></th>
+        <th><?php echo $data['l10n']->get('name'); ?></th>
+        <th><?php echo $data['l10n']->get('tools'); ?></th>
+    </tr>
+<?php
+foreach ($data['active_milestones'] as $milestone)
+{
+    $class_str = '';
+    if ($data['default_milestone'] == $milestone->id)
+    {
+        $class_str = ' checked="true"';
+    }
+?>
+    <tr>
+        <td><input &(class_str:h); type="radio" name="default_milestone" value="&(milestone.id);" /></td>
+        <td><?php echo $milestone->title; ?></td>
+        <td>
+            <a href="&(prefix);edit_milestone/&(milestone.name);/" title="<? echo $data['l10n']->get('edit'); ?>" alt="<? echo $data['l10n']->get('edit'); ?>"><img src="&(static_url);/stock-icons/16x16/edit.png" alt="<? echo $data['l10n']->get('edit'); ?>" border="0" /></a>
+            <a href="&(prefix);delete_milestone/&(milestone.name);" title="<? echo $data['l10n']->get('remove'); ?>" alt="<? echo $data['l10n']->get('remove'); ?>"><img src="&(static_url);/stock-icons/16x16/cancel.png" alt="<? echo $data['l10n']->get('remove'); ?>" border="0" /></a>
+        </td>
+    </tr>
+<?php
+}
+?>
+</table>
+<input type="submit" value="<?php echo $data['l10n']->get('set default'); ?>" />
+</form>
+<h3><?php echo $data['l10n']->get('archived milestones'); ?></h3>
+<table>
+    <tr>
+        <th>Name</th>
+        <th>Tools</th>
+    </tr>
+<?php
+foreach ($data['archived_milestones'] as $milestone)
+{
+?>
+    <tr>
+        <td><?php echo $milestone->title; ?></td>
+        <td>
+            <a href="&(prefix);edit_milestone/&(milestone.name);/" title="<? echo $data['l10n']->get('edit'); ?>" alt="<? echo $data['l10n']->get('edit'); ?>"><img src="&(static_url);/stock-icons/16x16/edit.png" alt="<? echo $data['l10n']->get('edit'); ?>" border="0" /></a>
+            <a href="&(prefix);delete_milestone/&(milestone.name);" title="<? echo $data['l10n']->get('remove'); ?>" alt="<? echo $data['l10n']->get('remove'); ?>"><img src="&(static_url);/stock-icons/16x16/cancel.png" alt="<? echo $data['l10n']->get('remove'); ?>" border="0" /></a>
+        </td>
+    </tr>
+<?php
+}
+?>
+</table>
\ No newline at end of file

Added: branches/ragnaroek/midcom/org.maemo.brainstorm/style/admin-milestone-create.php
==============================================================================
--- (empty file)
+++ branches/ragnaroek/midcom/org.maemo.brainstorm/style/admin-milestone-create.php	Sat Apr 25 22:20:33 2009
@@ -0,0 +1,7 @@
+<?php
+// Available request keys: controller, indexmode, schema, schemadb
+?>
+
+<h2><?php echo $data['l10n']->get('create milestone'); ?></h2>
+
+<?php $data['controller']->display_form (); ?>
\ No newline at end of file

Added: branches/ragnaroek/midcom/org.maemo.brainstorm/style/admin-milestone-delete.php
==============================================================================
--- (empty file)
+++ branches/ragnaroek/midcom/org.maemo.brainstorm/style/admin-milestone-delete.php	Sat Apr 25 22:20:33 2009
@@ -0,0 +1,7 @@
+<?php
+// Available request keys: controller, indexmode, schema, schemadb
+?>
+
+<h2><?php echo $data['l10n']->get('delete milestone'); ?></h2>
+
+<?php $data['controller']->display_form (); ?>
\ No newline at end of file

Added: branches/ragnaroek/midcom/org.maemo.brainstorm/style/admin-milestone-update.php
==============================================================================
--- (empty file)
+++ branches/ragnaroek/midcom/org.maemo.brainstorm/style/admin-milestone-update.php	Sat Apr 25 22:20:33 2009
@@ -0,0 +1,7 @@
+<?php
+// Available request keys: controller, indexmode, schema, schemadb
+?>
+
+<h2><?php echo $data['l10n']->get('update milestone'); ?></h2>
+
+<?php $data['controller']->display_form (); ?>
\ No newline at end of file

Modified: branches/ragnaroek/midcom/org.maemo.brainstorm/style/index-item.php
==============================================================================
--- branches/ragnaroek/midcom/org.maemo.brainstorm/style/index-item.php	(original)
+++ branches/ragnaroek/midcom/org.maemo.brainstorm/style/index-item.php	Sat Apr 25 22:20:33 2009
@@ -1,5 +1,6 @@
 <?php
-// Available request keys: controller, indexmode, schema, schemadb
+$prefix = $_MIDCOM->get_context_data(MIDCOM_CONTEXT_ANCHORPREFIX);
+
 $idea = $data['idea'];
 $view = $data['view_idea'];
 
@@ -28,7 +29,7 @@
 
 ?>
         <div class="brainstorm_idea">
-            <h2 class="entry-title">&(view['title']:h);</h2>
+            <h2 class="entry-title"><a href="&(prefix:h);view/&(idea.name:h);">&(view['title']:h);</a></h2>
             <p class="published">&(published:h); by &(author_string);.</p>
 
             <div class="entry-content">
@@ -48,7 +49,6 @@
 $solutions = $qb_solutions->execute();
 
 $count = count($solutions);
-$prefix = $_MIDCOM->get_context_data(MIDCOM_CONTEXT_ANCHORPREFIX);
 $static_url = MIDCOM_STATIC_URL;
 $empty_gif_url = $static_url . '/org.maemo.brainstorm/empty.gif';
 ?>
@@ -97,7 +97,7 @@
 
     $content = $solution->content;
 
-    $solution_url = $prefix . $data['idea']->name . '/' . $solution->name . '/';
+    $solution_url = $prefix . 'view_solution/' . $data['idea']->name . '/' . $solution->name . '/';
 
     $slider_max_with = 90;
     $slider_fav = $slider_max_with;

Modified: branches/ragnaroek/midcom/org.maemo.brainstorm/style/index-start.php
==============================================================================
--- branches/ragnaroek/midcom/org.maemo.brainstorm/style/index-start.php	(original)
+++ branches/ragnaroek/midcom/org.maemo.brainstorm/style/index-start.php	Sat Apr 25 22:20:33 2009
@@ -2,4 +2,4 @@
 
 ?>
     <div id="brainstorm_listing">
-        <h2>Popular ideas</h2>
+        <h2><?php echo $data['l10n']->get('popular ideas'); ?></h2>

Modified: branches/ragnaroek/midcom/org.maemo.brainstorm/style/navigation-sub.php
==============================================================================
--- branches/ragnaroek/midcom/org.maemo.brainstorm/style/navigation-sub.php	(original)
+++ branches/ragnaroek/midcom/org.maemo.brainstorm/style/navigation-sub.php	Sat Apr 25 22:20:33 2009
@@ -1,17 +1,18 @@
 <?php
+$static_url = MIDCOM_STATIC_URL;
+$prefix = $_MIDCOM->get_context_data(MIDCOM_CONTEXT_ANCHORPREFIX);
+
 $handler_id = $data['handler_id'];
 if (strstr($handler_id, 'list_sandbox'))
 {
 ?>
 
         <div id="brainstorm_nav_sandbox">
-            NOT YET IMPLEMENTED
             <ul>
-                <li><a href="#">Milestone 1</a></li>
-                <li class="active"><a href="#">Milestone 2</a></li>
-                <li><a href="#">Milestone 3</a></li>
-                <li><a href="#">Milestone 4</a></li>
-                <li><a href="#">No milestone</a></li>
+                <li><a href="&(prefix);list/sandbox/waiting/"><?php echo $data['l10n']->get('sandbox waiting'); ?></a></li>
+                <li><a href="&(prefix);list/sandbox/invalid/"><?php echo $data['l10n']->get('sandbox invalid'); ?></a></li>
+                <li><a href="&(prefix);list/sandbox/implemented/"><?php echo $data['l10n']->get('sandbox implemented'); ?></a></li>
+                <li><a href="&(prefix);list/sandbox/duplicate/"><?php echo $data['l10n']->get('sandbox duplicate'); ?></a></li>
             </ul>
             <div class="brainstorm_clearer"></div>
         </div>
@@ -21,13 +22,52 @@
 {
 ?>
         <div id="brainstorm_nav_milestones">
-            NOT YET IMPLEMENTED
+<?php
+$qb_milestones = org_maemo_brainstorm_milestone_dba::new_query_builder();
+$qb_milestones->add_constraint('status', '=', ORG_MAEMO_BRAINSTORM_MILESTONE_STATUS_ACTIVE);
+$milestones = $qb_milestones->execute();
+?>
             <ul>
-                <li><a href="#">Milestone 1</a></li>
-                <li class="active"><a href="#">Milestone 2</a></li>
-                <li><a href="#">Milestone 3</a></li>
-                <li><a href="#">Milestone 4</a></li>
-                <li><a href="#">No milestone</a></li>
+<?php
+$active_not_set = true;
+$selected_milestone = $data['selected_milestone'];
+if ($selected_milestone == '')
+{
+    $selected_milestone = $data['default_milestone'];
+}
+
+foreach ($milestones as $milestone)
+{
+    $class = '';
+    $active = false;
+    if ($selected_milestone == $milestone->id)
+    {
+        $active = true;
+    }
+    
+    if ($active)
+    {
+        $class = ' class="active"';
+        $active_not_set = false;
+    }
+?>
+                <li&(class:h);><a href="#"><?php echo $milestone->title; ?></a></li>
+<?php
+}
+
+if ($active_not_set)
+{
+?>
+                <li class="active"><a href="#"><?php echo $data['l10n']->get('no milestone'); ?></a></li>
+<?php
+}
+else
+{
+?>
+                <li><a href="#"><?php echo $data['l10n']->get('no milestone'); ?></a></li>
+<?php
+}
+?>
             </ul>
             <div class="brainstorm_clearer"></div>
         </div>

Modified: branches/ragnaroek/midcom/org.maemo.brainstorm/style/navigation-top.php
==============================================================================
--- branches/ragnaroek/midcom/org.maemo.brainstorm/style/navigation-top.php	(original)
+++ branches/ragnaroek/midcom/org.maemo.brainstorm/style/navigation-top.php	Sat Apr 25 22:20:33 2009
@@ -1,4 +1,6 @@
 <?php
+$prefix = $_MIDCOM->get_context_data(MIDCOM_CONTEXT_ANCHORPREFIX);
+
 $handler_id = $data['handler_id'];
 $sandbox_class = '';
 $ideas_class = '';
@@ -30,10 +32,10 @@
         <div id="brainstorm_nav_top">
             <ul>
 
-                <li&(sandbox_class:h);><a href="/list/sandbox/">Idea sandbox</a></li>
-                <li&(ideas_class:h);><a href="/list/ideas/">Popular ideas</a></li>
-                <li&(under_development_class:h);><a href="/list/under_development/">Ideas in development</a></li>
-                <li&(implemented_class:h);><a href="/list/implemented/">Implemented ideas</a></li>
+                <li&(sandbox_class:h);><a href="&(prefix:h);list/sandbox/">Idea sandbox</a></li>
+                <li&(ideas_class:h);><a href="&(prefix:h);list/ideas/">Popular ideas</a></li>
+                <li&(under_development_class:h);><a href="&(prefix:h);list/under_development/">Ideas in development</a></li>
+                <li&(implemented_class:h);><a href="&(prefix:h);list/implemented/">Implemented ideas</a></li>
             </ul>
             <div class="brainstorm_clearer"></div>
         </div>
\ No newline at end of file

Added: branches/ragnaroek/midcom/org.maemo.brainstorm/style/sandbox-end.php
==============================================================================
--- (empty file)
+++ branches/ragnaroek/midcom/org.maemo.brainstorm/style/sandbox-end.php	Sat Apr 25 22:20:33 2009
@@ -0,0 +1 @@
+</div>
\ No newline at end of file

Added: branches/ragnaroek/midcom/org.maemo.brainstorm/style/sandbox-item.php
==============================================================================
--- (empty file)
+++ branches/ragnaroek/midcom/org.maemo.brainstorm/style/sandbox-item.php	Sat Apr 25 22:20:33 2009
@@ -0,0 +1,169 @@
+<?php
+$prefix = $_MIDCOM->get_context_data(MIDCOM_CONTEXT_ANCHORPREFIX);
+
+$idea = $data['idea'];
+$view = $data['view_idea'];
+
+$publish_time = $data['idea']->metadata->published;
+$date_string = "<abbr class=\"published\" title=\"" . strftime('%Y-%m-%dT%H:%M:%S%z', $idea->metadata->published) . "\">" . gmdate('Y-m-d H:i e', $idea->metadata->published) . "</abbr>";
+$published = sprintf($data['l10n']->get('posted on %s'), $date_string);
+
+if (isset($idea->metadata->authors))
+{
+    $authors = explode('|', $idea->metadata->authors);
+    foreach ($authors as $author_guid)
+    {
+        if (empty($author_guid))
+        {
+            continue;
+        }
+        $author = new midcom_db_person($author_guid);
+        if ($author->id == 1)
+        {
+            continue;
+        }
+        $author_string = $author->name;
+        //$author_string = '<a href="http://maemo.org/profile/view/'. $author->username .'">'. $author->name . '</a>';
+    }
+}
+
+?>
+        <div class="brainstorm_idea">
+            <h2 class="entry-title"><a href="&(prefix:h);view/&(idea.name:h);">&(view['title']:h);</a></h2>
+            <p class="published">&(published:h); by &(author_string);.</p>
+
+            <div class="entry-content">
+                &(view['content']:h);
+<?php
+    if (array_key_exists('comments_url', $data))
+    {
+        $_MIDCOM->dynamic_load($data['comments_url']);
+    }
+?>
+            </div>
+        </div>
+<?php
+
+$qb_solutions = org_maemo_brainstorm_idea_solution_dba::new_query_builder();
+$qb_solutions->add_constraint('idea', '=', $data['idea']->id);
+$solutions = $qb_solutions->execute();
+
+$count = count($solutions);
+$static_url = MIDCOM_STATIC_URL;
+$empty_gif_url = $static_url . '/org.maemo.brainstorm/empty.gif';
+?>
+
+            <div class="brainstorm_solutions">
+                <h2><?php echo $data['l10n']->get('solutions for this idea'); ?></h2>
+<?php
+if ($count > 0)
+{
+    foreach ($solutions as $key => $solution)
+    {
+        $counter = ++$key;
+        $counter_str = 'solution_' . $counter;
+        if ($counter == 1)
+        {
+            $counter_str .= ' first';
+        }
+        if ($counter == $count)
+        {
+            $counter_str .= ' last';
+        }
+    
+    
+    $publish_time = $solution->metadata->published;
+    $date_string = "<abbr class=\"published\" title=\"" . strftime('%Y-%m-%dT%H:%M:%S%z', $solution->metadata->published) . "\">" . gmdate('Y-m-d H:i e', $solution->metadata->published) . "</abbr>";
+    $published = sprintf($data['l10n']->get('posted on %s'), $date_string);
+    
+    if (isset($solution->metadata->authors))
+    {
+        $authors = explode('|', $solution->metadata->authors);
+        foreach ($authors as $author_guid)
+        {
+            if (empty($author_guid))
+            {
+                continue;
+            }
+            $author = new midcom_db_person($author_guid);
+            if ($author->id == 1)
+            {
+                continue;
+            }
+            $author_string = $author->name;
+            //$author_string = '<a href="http://maemo.org/profile/view/'. $author->username .'">'. $author->name . '</a>';
+        }
+    }
+
+    $content = $solution->content;
+
+    $solution_url = $prefix . 'view_solution/' . $data['idea']->name . '/' . $solution->name . '/';
+
+    $slider_max_with = 90;
+    $slider_fav = $slider_max_with;
+    $slider_bury = 0;
+
+    $qb = net_nemein_favourites_favourite_dba::new_query_builder();
+    $qb->add_constraint('objectGuid', '=', $solution->guid);
+    $favourites = $qb->execute();
+
+    if (count($favourites) > 0)
+    {
+        $count_bury = 0;
+        $count_fav = 0;
+        $favourites_count = count($favourites);
+        foreach ($favourites as $favourite)
+        {
+            if ($favourite->bury == 1)
+            {
+                ++$count_bury;
+            }
+        }
+
+        $count_fav = $favourites_count - $count_bury;
+
+        $slider_tmp = $slider_max_with / ($count_fav + $count_bury);
+        $slider_bury = $slider_tmp * $count_bury;
+        $slider_bury = (int) $slider_bury;
+        $slider_fav = $slider_max_with - $slider_bury;
+    }
+
+
+?>
+                <div class="brainstorm_solution &(counter_str:h);">
+                    <div class="brainstorm_solution_fav">
+                        <div class="brainstorm_score"><?php echo $solution->metadata->score; ?></div>
+
+                        <div class="brainstorm_score_slider">
+                            <div class="brainstorm_score_slider_fav"><img src="&(empty_gif_url);" height="4" width="&(slider_fav);" alt="" /></div>
+                            <div class="brainstorm_score_slider_bury"><img src="&(empty_gif_url);" height="4" width="&(slider_bury);" alt="" /></div>
+                        </div>
+                        <div id="net_nemein_favourites_for_<?php echo $solution->guid; ?>" class='net_nemein_favourites <?php echo net_nemein_favourites_admin::get_json_data($solution->__mgdschema_class_name__, $solution->guid, '/' . $data['favourites_url']);?>'>
+                            <div class="fav_btn"><span class="favs_count">0</span></div>
+                            <div class="bury_btn"><span class="bury_count">0</span></div>
+                            <div class="net_nemein_favourites_clearfix"></div>
+                        </div>
+                        <noscript>
+                        <?php net_nemein_favourites_admin::render_add_link($solution->__mgdschema_class_name__, $solution->guid, '/' . $data['favourites_url']); ?>
+                        </noscript>
+                    </div>
+                    <div class="brainstorm_solution_content">
+                        <h3 class="entry-title"><a href="&(solution_url:h);"><?php echo $data['l10n']->get('solution'); ?> #&(counter:h);: <?php echo $solution->title; ?></a></h2>
+                        <p class="published">&(published:h); by &(author_string);.</p>
+
+                        <div class="entry-content">
+                            <?php org_maemo_brainstorm_viewer::org_maemo_brainstorm_truncater($data, $content, $solution_url, false); ?>
+                            (<a href="#"><?php echo sprintf($data['l10n']->get('%s comments'), net_nehmer_comments_comment::count_by_objectguid($solution->guid)) ?></a>)
+                        </div>
+                    </div>
+                </div>
+<?php
+    }
+}
+else
+{
+    echo "<h3>" . $data['l10n']->get('no solutions yet') . "</h3>";
+}
+
+?>
+            </div>

Added: branches/ragnaroek/midcom/org.maemo.brainstorm/style/sandbox-start.php
==============================================================================
--- (empty file)
+++ branches/ragnaroek/midcom/org.maemo.brainstorm/style/sandbox-start.php	Sat Apr 25 22:20:33 2009
@@ -0,0 +1,5 @@
+<?php
+
+?>
+    <div id="brainstorm_listing">
+        <h2><?php echo $data['l10n']->get('sandbox waiting'); ?></h2>

Modified: branches/ragnaroek/midcom/org.maemo.brainstorm/style/show-idea-solutions.php
==============================================================================
--- branches/ragnaroek/midcom/org.maemo.brainstorm/style/show-idea-solutions.php	(original)
+++ branches/ragnaroek/midcom/org.maemo.brainstorm/style/show-idea-solutions.php	Sat Apr 25 22:20:33 2009
@@ -49,7 +49,7 @@
 
     $content = $solution->content;
 
-    $solution_url = $prefix . $data['object']->name . '/' . $solution->name . '/';
+    $solution_url = $prefix . 'view_solution/' . $data['object']->name . '/' . $solution->name . '/';
 
     $slider_max_with = 90;
     $slider_fav = $slider_max_with;

Modified: branches/ragnaroek/midcom/org.maemo.brainstorm/style/show-idea.php
==============================================================================
--- branches/ragnaroek/midcom/org.maemo.brainstorm/style/show-idea.php	(original)
+++ branches/ragnaroek/midcom/org.maemo.brainstorm/style/show-idea.php	Sat Apr 25 22:20:33 2009
@@ -1,5 +1,6 @@
 <?php
-// Available request keys: controller, indexmode, schema, schemadb
+$prefix = $_MIDCOM->get_context_data(MIDCOM_CONTEXT_ANCHORPREFIX);
+
 $idea = $data['object'];
 $view = $data['view_idea'];
 
@@ -28,7 +29,7 @@
 
 ?>
         <div class="brainstorm_idea">
-            <h2 class="entry-title">&(view['title']:h);</h2>
+            <h2 class="entry-title"><a href="&(prefix:h);view/&(idea.name:h);">&(view['title']:h);</a></h2>
             <p class="published">&(published:h); by &(author_string);.</p>
 
             <div class="entry-content">

Modified: branches/ragnaroek/midcom/org.maemo.brainstorm/viewer.php
==============================================================================
--- branches/ragnaroek/midcom/org.maemo.brainstorm/viewer.php	(original)
+++ branches/ragnaroek/midcom/org.maemo.brainstorm/viewer.php	Sat Apr 25 22:20:33 2009
@@ -55,10 +55,11 @@
             'variable_args' => 1,
         );
 
-        // Handle /<ideaname>/
+        // Handle /view/<ideaname>/
         $this->_request_switch['idea_read'] = array
         (
             'handler' => array('org_maemo_brainstorm_handler_idea', 'read'),
+            'fixed_args' => array('view'),
             'variable_args' => 1,
         );
 
@@ -88,10 +89,11 @@
             'variable_args' => 2,
         );
 
-        // Handle /<ideaname>/<solutionname>/
+        // Handle /view_solution/<ideaname>/<solutionname>/
         $this->_request_switch['solution_read'] = array
         (
             'handler' => array('org_maemo_brainstorm_handler_solution', 'read'),
+            'fixed_args' => array('view_solution'),
             'variable_args' => 2,
         );
 
@@ -111,6 +113,49 @@
             'variable_args' => 2,
         );
 
+        // Milestones
+
+        // Handle /manage_milestones/
+        $this->_request_switch['milestone_management'] = array
+        (
+            'handler' => array('org_maemo_brainstorm_handler_milestone', 'manage'),
+            'fixed_args' => array('manage_milestones'),
+        );
+
+        // Crud for milestones
+
+        // Handle /create_milestone/<milestone_schemaname>/
+        $this->_request_switch['milestone_create'] = array
+        (
+            'handler' => array('org_maemo_brainstorm_handler_milestone', 'create'),
+            'fixed_args' => array('create_milestone'),
+            'variable_args' => 1,
+        );
+
+        // Handle /view_milestone/<milestonename>/
+        $this->_request_switch['milestone_read'] = array
+        (
+            'handler' => array('org_maemo_brainstorm_handler_milestone', 'read'),
+            'fixed_args' => array('view_milestone'),
+            'variable_args' => 1,
+        );
+
+        // Handle /edit_milestone/<milestonename>/
+        $this->_request_switch['milestone_update'] = array
+        (
+            'handler' => array('org_maemo_brainstorm_handler_milestone', 'update'),
+            'fixed_args' => array('edit_milestone'),
+            'variable_args' => 1,
+        );
+
+        // Handle /delete_milestone/<ideaname>/
+        $this->_request_switch['milestone_delete'] = array
+        (
+            'handler' => array('org_maemo_brainstorm_handler_milestone', 'delete'),
+            'fixed_args' => array('delete_milestone'),
+            'variable_args' => 1,
+        );
+
         // Listings
 
         // Handle /list/sandbox/
@@ -248,6 +293,19 @@
                 );
             }
         }
+        if ($this->_topic->can_do('org.maemo.brainstorm:moderation'))
+        {
+            $this->_node_toolbar->add_item
+            (
+                array
+                (
+                    MIDCOM_TOOLBAR_URL => 'manage_milestones/',
+                    MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('manage milestones'),
+                    MIDCOM_TOOLBAR_HELPTEXT => $this->_l10n->get('milestones management helptext'),
+                    MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/properties.png',
+                )
+            );
+        }
         if (   $this->_topic->can_do('midgard:update')
             && $this->_topic->can_do('midcom:component_config'))
         {
@@ -271,6 +329,9 @@
     {
         $this->_request_data['schemadb_idea'] = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb_idea'));
         $this->_request_data['schemadb_solution'] = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb_solution'));
+        $this->_request_data['schemadb_milestone'] = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb_milestone'));
+        $this->_request_data['default_milestone'] = $this->_config->get('default_milestone');
+        $this->_request_data['selected_milestone'] = '';
 
         $this->_request_data['comments_enable'] = false;
         if ($this->_config->get('comments_enable'))


More information about the midcom-commits mailing list