[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [8679]
From: |
Torstein |
Subject: |
[Fmsystem-commits] [8679] |
Date: |
Wed, 25 Jan 2012 09:31:44 +0000 |
Revision: 8679
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8679
Author: vator
Date: 2012-01-25 09:31:44 +0000 (Wed, 25 Jan 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/controller/inc/class.uicontrol.inc.php
trunk/controller/js/controller/ajax.js
trunk/controller/templates/base/control/control.xsl
trunk/controller/templates/base/css/base.css
Modified: trunk/controller/inc/class.uicontrol.inc.php
===================================================================
--- trunk/controller/inc/class.uicontrol.inc.php 2012-01-25 09:26:44 UTC
(rev 8678)
+++ trunk/controller/inc/class.uicontrol.inc.php 2012-01-25 09:31:44 UTC
(rev 8679)
@@ -271,41 +271,11 @@
array('id' => "2", 'value' => "Måned"),
array('id' => "3", 'value' => "År")
);
-
- if( $control != null )
- {
- $tabs = array(
- array(
- 'label' => "1: " .
lang('Details'),
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol.view_control_details',
-
'id' => $control->get_id()))
- ),array(
- 'label' => "2: " .
lang('Choose_control_groups'),
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol.view_control_groups',
-
'control_id' => $control->get_id()))
- ),array(
- 'label' => "3: " .
lang('Choose_control_items'),
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol.view_control_items',
-
'control_id' => $control->get_id()))
- ),array('label' => "4: " .
lang('Sort_check_list'),
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol.view_check_list',
-
'control_id' => $control->get_id()))
- )
- );
- }
- else
- {
- $tabs = array( array(
- 'label' => "1: " .
lang('Details')
- ), array(
- 'label' => "2: " .
lang('Choose_control_groups')
- ), array(
- 'label' => "3: " .
lang('Choose_control_items')
- ), array(
- 'label' => "4: " .
lang('Sort_check_list')
- ));
- }
+
+ $tabs = $this->make_tab_menu($control_id);
+ print_r( $tabs );
+
$data = array
(
'tabs'
=> $GLOBALS['phpgw']->common->create_tabs($tabs, 0),
@@ -349,7 +319,7 @@
$control_area_id_from_req =
$control->get_control_area_id();
- if($control_area_id_in_db != $control_area_id_from_req
){
+ if( $control_area_id_in_db > 0 & $control_area_id_in_db
!= $control_area_id_from_req ){
// Deleting earlier saved control groups
$this->so_control_group_list->delete_control_groups($control_id);
@@ -397,24 +367,7 @@
}
}
- $tabs = array(
- array(
- 'label' => "1: " .
lang('Details'),
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol.view_control_details',
-
'id' => $control->get_id()))
- ),array(
- 'label' => "2: " .
lang('Choose_control_groups'),
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol.view_control_groups',
-
'control_id' => $control->get_id()))
- ),array(
- 'label' => "3: " .
lang('Choose_control_items'),
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol.view_control_items',
-
'control_id' => $control->get_id()))
- ),array('label' => "4: " .
lang('Sort_check_list'),
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol.view_check_list',
-
'control_id' => $control->get_id()))
- )
- );
+ $tabs = $this->make_tab_menu($control_id);
$data = array
(
@@ -498,24 +451,7 @@
$groups_with_control_items[] =
array("control_group" => $control_group->toArray(), "group_control_items" =>
$control_items_for_group_array);
}
- $tabs = array(
- array(
- 'label' => "1: " .
lang('Details'),
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol.view_control_details',
-
'id' => $control->get_id()))
- ),array(
- 'label' => "2: " .
lang('Choose_control_groups'),
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol.view_control_groups',
-
'control_id' => $control->get_id()))
- ),array(
- 'label' => "3: " .
lang('Choose_control_items'),
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol.view_control_items',
-
'control_id' => $control->get_id()))
- ),array('label' => "4: " .
lang('Sort_check_list'),
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol.view_check_list',
-
'control_id' => $control->get_id()))
- )
- );
+ $tabs = $this->make_tab_menu($control_id);
$data = array
(
@@ -542,6 +478,7 @@
// Deleting earlier saved control items
$this->so_control_item_list->delete_control_items($control_id);
+ $order_nr = 1;
// Saving control items if submit save control items is
clicked
foreach ($control_tag_ids as $control_item_tag)
{
@@ -552,7 +489,10 @@
$control_item_list = new
controller_control_item_list();
$control_item_list->set_control_id($control_id);
$control_item_list->set_control_item_id($control_item_id);
+ $control_item_list->set_order_nr($order_nr);
$this->so_control_item_list->add($control_item_list);
+
+ $order_nr++;
}
$this->redirect(array('menuaction' =>
'controller.uicontrol.view_check_list', 'control_id'=>$control_id ));
@@ -575,29 +515,13 @@
$saved_groups_with_items_array[] =
array("control_group" => $control_group->toArray(), "control_items" =>
$saved_control_items);
}
- $tabs = array(
- array(
- 'label' => "1: " .
lang('Details'),
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol.view_control_details',
-
'id' => $control_id))
- ),array(
- 'label' => "2: " .
lang('Choose_control_groups'),
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol.view_control_groups',
-
'control_id' => $control_id))
- ),array(
- 'label' => "3: " .
lang('Choose_control_items'),
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol.view_control_items',
-
'control_id' => $control_id))
- ),array('label' => "4: " .
lang('Sort_check_list')
- )
-
- );
+ $tabs = $this->make_tab_menu($control_id);
$data = array
(
- 'tabs' =>
$GLOBALS['phpgw']->common->create_tabs($tabs, 3),
- 'view' =>
"sort_check_list",
- 'control' =>
$control->toArray(),
+ 'tabs'
=> $GLOBALS['phpgw']->common->create_tabs($tabs, 3),
+ 'view'
=> "sort_check_list",
+ 'control'
=> $control->toArray(),
'saved_groups_with_items_array' =>
$saved_groups_with_items_array
);
@@ -610,95 +534,78 @@
self::render_template_xsl(array('control/control_tabs',
'control_item/sort_check_list'), $data);
}
- /* Kommentert ut av Torstein 21.01.2012 - Tror ikke vi bruker
denne... Kanskje den bør slettes...
- *
- public function generate_check_lists_for_control(){
- $control_id = phpgw::get_var('control_id');
- $control = $this->so->get_single($control_id);
-
- $start_date = $control->get_start_date();
- $end_date = $control->get_end_date();
- $repeat_type = $control->get_repeat_type();
- $repeat_interval = $control->get_repeat_interval();
+ function make_tab_menu($control_id){
+ $tabs = array();
- $status = FALSE;
- $comment = "Kommentar for sjekkliste";
- $deadline = $start_date;
-
- // Saving check_list
- $new_check_list = new controller_check_list();
- $new_check_list->set_control_id( $control_id );
- $new_check_list->set_status( $status );
- $new_check_list->set_comment( $comment );
- $new_check_list->set_deadline( $deadline );
-
- $check_list_id = $this->so_check_list->store(
$new_check_list );
-
- $control_items_list =
$this->so_control_item_list->get_control_items_by_control($control_id);
-
- foreach($control_items_list as $control_item){
+ if($control_id > 0){
- $status = '0';
- $comment = "Kommentar for sjekk item";
+ echo " Detaljer ";
+ $control = $this->so->get_single($control_id);
- // Saving check_items for a list
- $new_check_item = new controller_check_item();
- $new_check_item->set_check_list_id(
$check_list_id );
+ $tabs[] = array(
+ 'label' => "1: " .
lang('Details'),
+ 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol.view_control_details',
+
'id' => $control->get_id()))
+ );
- $new_check_item->set_control_item_id(
$control_item->get_id() );
- $new_check_item->set_status( $status );
- $new_check_item->set_comment( $comment );
-
- $saved_check_item =
$this->so_check_item->store( $new_check_item );
- }
+ $saved_control_groups =
$this->so_control_group_list->get_control_groups_by_control( $control->get_id()
);
+
+ if(count($saved_control_groups) > 0)
+ {
+ echo " Grupper ";
+ $tabs[] = array(
+ 'label' => "2:
" . lang('Choose_control_groups'),
+ 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol.view_control_groups',
+
'control_id' => $control->get_id()))
+ );
+
+ $saved_control_items =
$this->so_control_item_list->get_control_items_by_control( $control->get_id() );
+
+ if(count($saved_control_items) > 0)
+ {
+ echo " Punkter ";
+ $tabs[] = array(
+ 'label'
=> "3: " . lang('Choose_control_items'),
+ 'link'
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol.view_control_items',
+
'control_id' => $control->get_id())));
+ $tabs[] = array('label' => "4:
" . lang('Sort_check_list'),
+ 'link'
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol.view_check_list',
+
'control_id' => $control->get_id())));
+ }else{
+ $tabs[] = array('label' => "3:
" . lang('Choose_control_items'));
+ $tabs[] = array('label' => "4:
" . lang('Sort_check_list'));
+ }
+ }else{
+ $tabs[] = array('label' => "2: " .
lang('Choose_control_groups'));
+ $tabs[] = array('label' => "3: " .
lang('Choose_control_items'));
+ $tabs[] = array('label' => "4: " .
lang('Sort_check_list'));
+ }
+ }else{
+ $tabs = array(
+ array(
+ 'label' => "1: " .
lang('Details')
+ ), array(
+ 'label' => "2: " .
lang('Choose_control_groups')
+ ), array(
+ 'label' => "3: " .
lang('Choose_control_items')
+ ), array(
+ 'label' => "4: " .
lang('Sort_check_list')
+ ));
+ }
- $this->redirect(array('menuaction' =>
'controller.uicontrol.view_check_lists_for_control', 'control_id'=>$control_id
));
- }
-
-
- public function view_check_lists_for_control()
- {
- $control_id = phpgw::get_var('control_id');
- $control = $this->so->get_single($control_id);
- $date_format =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-
- $check_list_array =
$this->so_check_list->get_check_lists_for_control( $control_id );
- $tabs = array(
- array(
- 'label' => "1: " .
lang('Details'),
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol.view_control_details',
-
'view' => "view_control_details", 'id' => $control_id))
- ),array(
- 'label' => "2: " .
lang('Choose_control_groups'),
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol.view_control_groups',
-
'view' => "view_control_groups", 'control_id' => $control_id,
-
'control_group_ids' => $control_group_ids,
-
'control_area_id' => $control->get_control_area_id()))
- ),array(
- 'label' => "3: " .
lang('Choose_control_items'),
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'controller.uicontrol.view_control_items',
-
'view' => "view_control_items", 'control_id' => $control_id,
-
'control_group_ids' => $control_group_ids))
- ),array('label' => "4: " .
lang('Sort_check_list')
- )
- );
- $data = array
- (
- 'tabs' =>
$GLOBALS['phpgw']->common->create_tabs($tabs, 4),
- 'view' =>
"view_check_lists",
- 'control_as_array' => $control->toArray(),
- 'check_list_array' => $check_list_array,
- 'date_format' => $date_format
- );
- self::render_template_xsl(array('control/control_tabs',
'tab_view_check_lists'), $data);
- self::add_javascript('controller', 'yahoo',
'control_tabs.js');
- }
- */
+ echo " 2: ";
+ print_r($tabs);
+
+ return $tabs;
+ }
+
+
+
// Returns control list info as JSON
public function get_controls_by_control_area()
{
Modified: trunk/controller/js/controller/ajax.js
===================================================================
--- trunk/controller/js/controller/ajax.js 2012-01-25 09:26:44 UTC (rev
8678)
+++ trunk/controller/js/controller/ajax.js 2012-01-25 09:31:44 UTC (rev
8679)
@@ -1,5 +1,5 @@
$(document).ready(function(){
-
+
// file: uicalendar.xsl
$("#choose_my_location option").click(function () {
var location_code = $(this).val();
@@ -144,22 +144,57 @@
}
});
});
+
+ $("#frm_save_control_details input").focus(function(e){
+
$("#frm_save_control_details").find(".focus").removeClass("focus");
+ $(this).addClass("focus");
+ });
+ $("#frm_save_control_details select").focus(function(e){
+
$("#frm_save_control_details").find(".focus").removeClass("focus");
+ $(this).addClass("focus");
+ });
+
$("#frm_save_control_details").submit(function(e){
-
+
var thisForm = $(this);
-
- var hidden_control_area_id =
$(thisForm).find("input[name='control_area_id_hidden']").val();
- var control_area_id = $("#control_area_id").val();
-
- if(hidden_control_area_id != control_area_id)
- {
- var answer = confirm("Du har endret kontrollområde til
kontrollen. " +
- "Hvis du
lagrer vil kontrollgrupper og kontrollpunkter til kontrollen bli slettet.")
- if (!answer){
- e.preventDefault();
- }
- }
+
+ var $required_input_fields = $(this).find(".required");
+ var status = true;
+
+ $required_input_fields.each(function() {
+
+ if($(this).val() == ''){
+ var nextElem = $(this).next();
+
+ if( !$(nextElem).hasClass("input_error_msg") )
+ $(this).after("<div class='input_error_msg'>Du
må fylle ut dette feltet</div>");
+
+ status = false;
+ }else{
+ var nextElem = $(this).next();
+
+ if( $(nextElem).hasClass("input_error_msg") )
+ $(nextElem).remove();
+ }
+ });
+
+ if( status ){
+ var saved_control_area_id =
$(thisForm).find("input[name='saved_control_area_id']").val();
+ var new_control_area_id = $("#control_area_id").val();
+
+ if(saved_control_area_id != '' & saved_control_area_id !=
new_control_area_id)
+ {
+ var answer = confirm("Du har endret kontrollområde til
kontrollen. " +
+ "Hvis du
lagrer vil kontrollgrupper og kontrollpunkter til kontrollen bli slettet.")
+ if (!answer){
+ e.preventDefault();
+ }
+ }
+ }else{
+ e.preventDefault();
+ }
+
});
// file: view_check_lists_for_location.xsl
@@ -406,7 +441,6 @@
var submitBnt = $(thisForm).find("input[type='submit']");
$(submitBnt).removeClass("not_active");
});
-
});
Modified: trunk/controller/templates/base/control/control.xsl
===================================================================
--- trunk/controller/templates/base/control/control.xsl 2012-01-25 09:26:44 UTC
(rev 8678)
+++ trunk/controller/templates/base/control/control.xsl 2012-01-25 09:31:44 UTC
(rev 8679)
@@ -22,12 +22,11 @@
});
});
</script>
-
<div class="yui-content">
<div id="control_details">
<form id="frm_save_control_details"
action="index.php?menuaction=controller.uicontrol.save_control_details"
method="post">
<input type="hidden" name="control_id"
value="{$control_id}" />
- <input type="hidden" name="control_area_id_hidden"
value="{$control_area_id}" />
+ <input type="hidden" name="saved_control_area_id"
value="{$control_area_id}" />
<dl class="proplist-col">
<dt>
@@ -36,7 +35,7 @@
<dd>
<xsl:choose>
<xsl:when test="editable">
- <select id="control_area_id"
name="control_area_id">
+ <select class="required"
id="control_area_id" name="control_area_id">
<option value="">Velg
kontrollområde</option>
<xsl:for-each
select="control_areas_array2">
<xsl:choose>
@@ -94,7 +93,7 @@
<dd>
<xsl:choose>
<xsl:when test="editable">
- <input type="text"
name="title" id="title" value="{control/title}" size="80"/>
+ <input class="required"
type="text" name="title" id="title" value="{control/title}" size="80"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of
select="control/title" />
@@ -105,7 +104,7 @@
<label
for="start_date">Startdato</label>
</dt>
<dd>
- <input id="start_date"
name="start_date" type="text">
+ <input class="required" id="start_date"
name="start_date" type="text">
<xsl:if test="control/start_date != ''">
<xsl:attribute
name="value"><xsl:value-of select="php:function('date', $date_format,
number(control/start_date))"/></xsl:attribute>
</xsl:if>
@@ -125,7 +124,7 @@
<label>Frekvenstype</label>
</dt>
<dd>
- <select id="repeat_type"
name="repeat_type">
+ <select class="required"
id="repeat_type" name="repeat_type">
<option value="">Velg
frekvenstype</option>
<xsl:for-each
select="repeat_type_array">
<xsl:choose>
@@ -149,7 +148,7 @@
<dd>
<xsl:choose>
<xsl:when test="editable">
- <input size="2" type="text"
name="repeat_interval" value="{control/repeat_interval}" />
+ <input class="required"
style="width:20px;" size="2" type="text" name="repeat_interval"
value="{control/repeat_interval}" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of
select="control/repeat_interval" />
@@ -162,7 +161,7 @@
<dd>
<xsl:choose>
<xsl:when test="editable">
- <select id="responsibility_id"
name="responsibility_id">
+ <select class="required"
id="responsibility_id" name="responsibility_id">
<option value="">Velg
rolle</option>
<xsl:for-each
select="role_array">
<xsl:choose>
Modified: trunk/controller/templates/base/css/base.css
===================================================================
--- trunk/controller/templates/base/css/base.css 2012-01-25 09:26:44 UTC
(rev 8678)
+++ trunk/controller/templates/base/css/base.css 2012-01-25 09:31:44 UTC
(rev 8679)
@@ -1266,4 +1266,16 @@
}
ul#groups h4{
margin: 4px 0;
+}
+.input_error_msg{
+ background:#FBE3E4;
+ border-bottom-right-radius: 4px;
+ color: #D12F19;
+ display: block;
+ padding: 4px 5px;
+ width: 150px;
+}
+
+input.focus, select.focus{
+ border: 2px solid #dae6f4;
}
\ No newline at end of file
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [8679],
Torstein <=