fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [9663]


From: Torstein
Subject: [Fmsystem-commits] [9663]
Date: Tue, 26 Jun 2012 10:36:24 +0000

Revision: 9663
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9663
Author:   vator
Date:     2012-06-26 10:36:24 +0000 (Tue, 26 Jun 2012)
Log Message:
-----------


Modified Paths:
--------------
    trunk/controller/inc/class.uicontrol.inc.php
    trunk/controller/inc/class.uicontrol_item.inc.php
    trunk/controller/inc/class.uiprocedure.inc.php
    trunk/controller/templates/base/control_item/control_item.xsl
    trunk/controller/templates/base/css/base.css

Modified: trunk/controller/inc/class.uicontrol.inc.php
===================================================================
--- trunk/controller/inc/class.uicontrol.inc.php        2012-06-26 10:25:14 UTC 
(rev 9662)
+++ trunk/controller/inc/class.uicontrol.inc.php        2012-06-26 10:36:24 UTC 
(rev 9663)
@@ -185,7 +185,13 @@
                                                                'type' => 
'submit',
                                                                'name' => 
'search',
                                                                'value' => 
lang('Search')
-                                                       )
+                                                       ),
+                                                               array(
+                                                               'type' => 
'link',
+                                                               'value' => 
lang('New control'),
+                                                               'href' => 
self::link(array('menuaction' => 'controller.uicontrol_item.add')),
+                                                               'class' => 
'new_item'
+                                                       ),
                                                ),
                                        ),
                                ),

Modified: trunk/controller/inc/class.uicontrol_item.inc.php
===================================================================
--- trunk/controller/inc/class.uicontrol_item.inc.php   2012-06-26 10:25:14 UTC 
(rev 9662)
+++ trunk/controller/inc/class.uicontrol_item.inc.php   2012-06-26 10:36:24 UTC 
(rev 9663)
@@ -53,7 +53,8 @@
                        'query' =>      true,
                        'edit'  =>      true,
                        'view'  =>      true,
-                       'add'   =>      true,
+                       'add'           =>      true,
+                       'save'  =>      true,
                        'display_control_items' => true,
                        'delete_item_list'      => true
                );
@@ -217,9 +218,9 @@
                        $data = array
                        (
                                'editable'                              => true,
-                               'control_item'                  => 
$control_item_array,
-                               'control_areas'                 => 
$control_areas_array,
-                               'control_groups'                => 
$control_groups_array,
+                               'control_item'          => $control_item_array,
+                               'control_areas'         => $control_areas_array,
+                               'control_groups'        => 
$control_groups_array,
                        );
 
                        $this->use_yui_editor(array('what_to_do','how_to_do'));
@@ -234,37 +235,91 @@
                public function save()
                {
                        $control_item_id = phpgw::get_var('id');
+                       $title = phpgw::get_var('title');
+                       $required = phpgw::get_var('required') == 'on' ? true : 
false;
+                       $type = phpgw::get_var('control_item_type');
+                       $control_group_id = phpgw::get_var('control_group');
+                       $control_area_id = phpgw::get_var('control_area');
+                       $type = phpgw::get_var('control_item_type');
                        $what_to_do_txt = phpgw::get_var('what_to_do','html');
                        $what_to_do_txt = str_replace(" ", " ", 
$what_to_do_txt);
                        $how_to_do_txt = phpgw::get_var('how_to_do','html');
                        $how_to_do_txt = str_replace(" ", " ", 
$how_to_do_txt);
-                       $control_item->set_title(phpgw::get_var('title'));
-                       $control_item->set_required(phpgw::get_var('required') 
== 'on' ? true : false);
-                       
$control_item->set_type(phpgw::get_var('control_item_type'));
-                       $control_item->set_what_to_do( $what_to_do_txt );
-                       $control_item->set_how_to_do( $how_to_do_txt );
-                       $control_item->set_control_group_id( 
phpgw::get_var('control_group') );
-                       $control_item->set_control_area_id( 
phpgw::get_var('control_area') );
-                               
-                       $control_item_id = $this->so->store($control_item);
-                               
+
                        if($control_item_id > 0)
                        {
-                               $message = lang('messages_saved_form');
+                               $control_item = $this->so->get_single( 
$control_item_id );
+                       }
+                       else
+                       {
+                               $control_item = new controller_control_item();
+                       } 
+                       
+                       $control_item->set_title($title);
+                       $control_item->set_required($required);
+                       $control_item->set_control_group_id($control_group_id);
+                       $control_item->set_control_area_id($control_area_id);
+                       $control_item->set_type($type);
+                       $control_item->set_what_to_do($what_to_do_txt);
+                       $control_item->set_how_to_do($how_to_do_txt);
+
+                       $saved_control_item_id = 
$this->so->store($control_item);
                                
+                       if($saved_control_item_id > 0)
+                       {
                                if($control_item->get_type() == 
'control_item_type_3' | $control_item->get_type() == 'control_item_type_4'){
                                        $option_values = 
phpgw::get_var('option_values');
                
                                        foreach($option_values as 
$option_value){
-                                               $control_item_option = new 
controller_control_item_option($option_value, $control_item_id);
+                                               $control_item_option = new 
controller_control_item_option($option_value, $saved_control_item_id);
                                                $control_item_option_id = 
$this->so_control_item_option->store( $control_item_option );
                                        }
                                }
                        }
                        
-                       $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'controller.uicontrol_item.index', 'dir' => 'desc'));
+                       $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'controller.uicontrol_item.view', 'id' => 
$saved_control_item_id));
                }
 
+               /**
+                * Public method. Called when a user wants to view information 
about a control item.
+                * @param HTTP::id      the control_item ID
+                */
+               public function view()
+               {
+                       $GLOBALS['phpgw_info']['flags']['app_header'] .= 
'::'.lang('view');
+                       //Retrieve the control_item object
+                       $control_item_id = (int)phpgw::get_var('id');
+               
+                       if(isset($control_item_id) && $control_item_id > 0)
+                       {
+                               $control_item = 
$this->so->get_single($control_item_id);
+                       }
+                       else
+                       {
+                               
$this->render('permission_denied.php',array('error' => 
lang('invalid_request')));
+                               return;
+                       }
+       
+                       $category = 
execMethod('phpgwapi.categories.return_single', 
$control_item->get_control_area_id());
+                       
$control_item->set_control_area_name($category[0]['name']);
+                       
+                       /*
+                        * hack to fix display of   char 
+                        */
+                       $control_item->set_what_to_do(str_replace(" ", " 
",$control_item->get_what_to_do()));
+                       $control_item->set_how_to_do(str_replace(' ', ' ', 
$control_item->get_how_to_do()));
+                       
+                       $control_item_array = $control_item->toArray();
+
+                       $data = array
+                       (
+                               'value_id'                      => 
!empty($control_item) ? $control_item->get_id() : 0,
+                               'control_item'  => $control_item_array,
+                       );
+
+                       self::render_template_xsl('control_item/control_item', 
$data);
+               }
+               
                public function query()
                {
                        $params = array(
@@ -348,63 +403,4 @@
 
                        return $this->yui_results($results);
                }
-
-               /**
-                * Public method. Called when a user wants to view information 
about a control item.
-                * @param HTTP::id      the control_item ID
-                */
-               public function view()
-               {
-                       $GLOBALS['phpgw_info']['flags']['app_header'] .= 
'::'.lang('view');
-                       //Retrieve the control_item object
-                       $control_item_id = (int)phpgw::get_var('id');
-                       if(isset($_POST['edit_control_item']))
-                       {
-                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'controller.uicontrol_item.edit', 'id' => 
$control_item_id));
-                       }
-                       else
-                       {
-                               if(isset($control_item_id) && $control_item_id 
> 0)
-                               {
-                                       $control_item = 
$this->so->get_single($control_item_id);
-                               }
-                               else
-                               {
-                                       
$this->render('permission_denied.php',array('error' => 
lang('invalid_request')));
-                                       return;
-                               }
-                               //var_dump($control_item);
-
-                               if($this->flash_msgs)
-                               {
-                                       $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox_data($this->flash_msgs);
-                                       $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
-                               }
-                               
-                               $category = 
execMethod('phpgwapi.categories.return_single', 
$control_item->get_control_area_id());
-                               
$control_item->set_control_area_name($category[0]['name']);
-                               
-                               /*
-                                * hack to fix display of   char 
-                                */
-                               
$control_item->set_what_to_do(str_replace(" ", " 
",$control_item->get_what_to_do()));
-                               
$control_item->set_how_to_do(str_replace(' ', ' ', 
$control_item->get_how_to_do()));
-                               
-                               $control_item_array = $control_item->toArray();
-
-                               $data = array
-                               (
-                                       'value_id'                              
=> !empty($control_item) ? $control_item->get_id() : 0,
-                                       'img_go_home'                   => 
'rental/templates/base/images/32x32/actions/go-home.png',
-                                       'control_item'                  => 
$control_item_array,
-                               );
-
-
-                               $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('controller') . '::' . lang('Control item');
-
-                               
self::render_template_xsl('control_item/control_item', $data);
-                       }
-               }
-
-
        }

Modified: trunk/controller/inc/class.uiprocedure.inc.php
===================================================================
--- trunk/controller/inc/class.uiprocedure.inc.php      2012-06-26 10:25:14 UTC 
(rev 9662)
+++ trunk/controller/inc/class.uiprocedure.inc.php      2012-06-26 10:36:24 UTC 
(rev 9663)
@@ -118,7 +118,13 @@
                                                                'type' => 
'submit',
                                                                'name' => 
'search',
                                                                'value' => 
lang('Search')
-                                                       )
+                                                       ),
+                                                       array(
+                                                               'type' => 
'link',
+                                                               'value' => 
lang('t_new_procedure'),
+                                                               'href' => 
self::link(array('menuaction' => 'controller.uicontrol_item.add')),
+                                                               'class' => 
'new_item'
+                                                       ),
                                                ),
                                        ),
                                ),

Modified: trunk/controller/templates/base/control_item/control_item.xsl
===================================================================
--- trunk/controller/templates/base/control_item/control_item.xsl       
2012-06-26 10:25:14 UTC (rev 9662)
+++ trunk/controller/templates/base/control_item/control_item.xsl       
2012-06-26 10:36:24 UTC (rev 9663)
@@ -15,17 +15,9 @@
                <h1><xsl:value-of select="php:function('lang', 'View control 
item')" /></h1>
        </xsl:otherwise>
 </xsl:choose>
-
-<ul class="check_list">
-       <xsl:for-each select="check_list_array">
-               <li>
-                       <span>Tittel:</span><xsl:value-of 
select="title"/><span>Start dato:</span><xsl:value-of select="start_date"/>
-               </li>
-       </xsl:for-each>
-</ul>
        
        <div id="control_item_details">
-               <form action="#" method="post">
+               <form 
action="index.php?menuaction=controller.uicontrol_item.save" method="post">
                        <input type="hidden" name="id" 
value="{control_item/id}">
                        </input>
                        <dl class="proplist">

Modified: trunk/controller/templates/base/css/base.css
===================================================================
--- trunk/controller/templates/base/css/base.css        2012-06-26 10:25:14 UTC 
(rev 9662)
+++ trunk/controller/templates/base/css/base.css        2012-06-26 10:36:24 UTC 
(rev 9663)
@@ -492,9 +492,9 @@
 }
 
 #control_item_details label {
-    display: block;
-    margin-bottom: 2px;
-    margin-right: 10px;
+  display: block;
+  margin-bottom: 2px;
+  margin-right: 10px;
 }
 
 #control_item_details label.line{
@@ -524,7 +524,8 @@
 }
 
 #control_item_details .control_item_type .active {
-    background: none repeat scroll 0 0 #0F6CCF;
+    background: none repeat scroll 0 0 #F57056;
+    border: 1px solid #CB563F;
 }
 
 #control_item_details input[type=radio] {
@@ -873,11 +874,11 @@
        margin-top:0;
 }
 
-.content-wrp{
+.content-wrp {
   background: none repeat scroll 0 0 #EDF5FF;
   border: 1px solid #DBE5EF;
   margin-top: 1em;
-  padding: 1em;
+  padding: 0;
 }
 
 /* =======================================  CHECK LIST DETAILS 
========================================= */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]