fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11170] bkbooking: stavanger kode update


From: Kjell Arne Espedal
Subject: [Fmsystem-commits] [11170] bkbooking: stavanger kode update
Date: Thu, 13 Jun 2013 08:14:02 +0000

Revision: 11170
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11170
Author:   kjell
Date:     2013-06-13 08:14:00 +0000 (Thu, 13 Jun 2013)
Log Message:
-----------
bkbooking: stavanger kode update

Modified Paths:
--------------
    branches/stavangerkommune/booking/inc/class.boapplication.inc.php
    branches/stavangerkommune/booking/inc/class.soallocation.inc.php
    branches/stavangerkommune/booking/inc/class.soapplication.inc.php
    branches/stavangerkommune/booking/inc/class.sobuilding.inc.php
    branches/stavangerkommune/booking/inc/class.sogroup.inc.php
    branches/stavangerkommune/booking/inc/class.soorganization.inc.php
    branches/stavangerkommune/booking/inc/class.soresource.inc.php
    branches/stavangerkommune/booking/inc/class.uiallocation.inc.php
    branches/stavangerkommune/booking/inc/class.uiapplication.inc.php
    branches/stavangerkommune/booking/inc/class.uibooking.inc.php
    branches/stavangerkommune/booking/inc/class.uievent.inc.php
    branches/stavangerkommune/booking/inc/class.uiseason.inc.php
    
branches/stavangerkommune/booking/templates/base/allocation_delete_preview.xsl
    branches/stavangerkommune/booking/templates/base/application.xsl
    branches/stavangerkommune/bookingfrontend/inc/class.bosearch.inc.php
    branches/stavangerkommune/bookingfrontend/inc/class.menu.inc.php
    branches/stavangerkommune/phpgwapi/templates/stavanger/head.inc.php
    branches/stavangerkommune/phpgwapi/templates/stavanger/head.tpl

Added Paths:
-----------
    branches/stavangerkommune/booking/inc/class.uimetasettings.inc.php
    branches/stavangerkommune/booking/templates/base/metasettings.xsl

Modified: branches/stavangerkommune/booking/inc/class.boapplication.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.boapplication.inc.php   
2013-06-12 19:25:58 UTC (rev 11169)
+++ branches/stavangerkommune/booking/inc/class.boapplication.inc.php   
2013-06-13 08:14:00 UTC (rev 11170)
@@ -9,7 +9,7 @@
                        $this->so = CreateObject('booking.soapplication');
                }
 
-               function send_notification($application, $created=false)
+               function send_notification($application, $created=false, 
$assocciated=false)
                {
                        if 
(!(isset($GLOBALS['phpgw_info']['server']['smtp_server']) && 
$GLOBALS['phpgw_info']['server']['smtp_server']))
                                return;
@@ -43,21 +43,23 @@
                                        $body .= '<p>Kommentar fra 
saksbehandler:<br />'.$application['comment'].'</p>';
                                }
                                $buildingemail = 
$this->get_tilsyn_email($application['building_id']);
-                               $resourcename = 
implode(",",$this->get_resource_name($application['resources']));
-                               $dates = "";
-                               foreach ($application['dates'] as $date) {
-                                       $dates .=implode(", ",$date)." ";
-                               }
-                               $bbody = "<p>".$application['contact_name']." 
sin søknad  om leie/lån av ".$resourcename." i 
".$application[building_name]."</p>"; 
-                               $bbody .= "<p>Den ".$dates."er Godkjent</p>";
+                               if ($buildingemail != '') {
+                                       $resourcename = 
implode(",",$this->get_resource_name($application['resources']));
+                                       $dates = "";
+                                       foreach ($application['dates'] as 
$date) {
+                                               $dates .=implode(", ",$date)." 
";
+                                       }
+                                       $bbody = 
"<p>".$application['contact_name']." sin søknad  om leie/lån av 
".$resourcename." i ".$application[building_name]."</p>"; 
+                                       $bbody .= "<p>Den ".$dates."er 
Godkjent</p>";
                                
-                               try
-                               {
-                                       $send->msg('email', $buildingemail, 
$subject, $bbody, '', '', '', $from, '', 'html');
-                               }
-                               catch (phpmailerException $e)
-                               {
+                                       try
+                                       {
+                                               $send->msg('email', 
$buildingemail, $subject, $bbody, '', '', '', $from, '', 'html');
+                                       }
+                                       catch (phpmailerException $e)
+                                       {
                                        // TODO: Inform user if something goes 
wrong
+                                       }
                                }
                
                        } elseif ($application['status'] == 'REJECTED') {
@@ -90,6 +92,11 @@
                        $applications = array();
                        $this->db = & $GLOBALS['phpgw']->db;
 
+#                      $sql = "select distinct ap.id
+#                                      from bb_application ap
+#                                      inner join bb_application_resource ar 
on ar.application_id = ap.id
+#                                      inner join bb_resource re on re.id = 
ar.resource_id
+#                                      inner join bb_building bu on bu.id = 
re.building_id";
                        $sql = "select distinct ap.id
                                        from bb_application ap
                                        inner join bb_application_resource ar 
on ar.application_id = ap.id

Modified: branches/stavangerkommune/booking/inc/class.soallocation.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.soallocation.inc.php    
2013-06-12 19:25:58 UTC (rev 11169)
+++ branches/stavangerkommune/booking/inc/class.soallocation.inc.php    
2013-06-13 08:14:00 UTC (rev 11170)
@@ -271,6 +271,7 @@
                        $table_name = $this->table_name;
                        $sql = "DELETE FROM $table_name WHERE id = ($id)";
                        $db->query($sql, __LINE__, __FILE__);
+                       return True;
                }
 
                public function update_id_string() 

Modified: branches/stavangerkommune/booking/inc/class.soapplication.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.soapplication.inc.php   
2013-06-12 19:25:58 UTC (rev 11169)
+++ branches/stavangerkommune/booking/inc/class.soapplication.inc.php   
2013-06-13 08:14:00 UTC (rev 11170)
@@ -161,6 +161,38 @@
                        return $results;
                }
 
+               function set_inactive($id,$type)
+               {
+                       if ($type == 'event') {
+                               $sql = "UPDATE bb_event SET active = 0 where id 
= ($id)";
+               } elseif ($type == 'allocation') {
+                               $sql = "UPDATE bb_allocation SET active = 0 
where id = ($id)";
+                       } elseif ($type == 'booking') {
+                               $sql = "UPDATE bb_booking SET active = 0 where 
id = ($id)";
+                       } else {
+                               throw new UnexpectedValueException('Encountered 
an unexpected error');
+                       }
+                       $this->db->query($sql, __LINE__, __FILE__);
+                       return;
+
+               }
+
+               function set_active($id,$type)
+               {
+                       if ($type == 'event') {
+                               $sql = "UPDATE bb_event SET active = 1 where id 
= ($id)";
+               } elseif ($type == 'allocation') {
+                               $sql = "UPDATE bb_allocation SET active = 1 
where id = ($id)";
+                       } elseif ($type == 'booking') {
+                               $sql = "UPDATE bb_booking SET active = 1 where 
id = ($id)";
+                       } else {
+                               throw new UnexpectedValueException('Encountered 
an unexpected error');
+                       }
+                       $this->db->query($sql, __LINE__, __FILE__);
+                       return;
+
+               }
+
         function get_activities_main_level()
         {
                    $results = array();
@@ -235,7 +267,7 @@
                                        'id'                                    
=> array('type' => 'int'),
                                        'application_id'                => 
array('type' => 'int'),
                                        'type'  => array('type' => 'string', 
'required' => true),
-                                       'from_' => array('type' => 'timestamp'),
+                                       'from_' => array('type' => 
'timestamp','query' => true),
                                        'to_'   => array('type' => 
'timestamp')));
                }
        }

Modified: branches/stavangerkommune/booking/inc/class.sobuilding.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.sobuilding.inc.php      
2013-06-12 19:25:58 UTC (rev 11169)
+++ branches/stavangerkommune/booking/inc/class.sobuilding.inc.php      
2013-06-13 08:14:00 UTC (rev 11170)
@@ -28,6 +28,19 @@
                                )
                        );
                }
+
+               function get_metainfo($id)
+               {
+                       $this->db->limit_query("SELECT name, district, city, 
description FROM bb_building where id=" . intval($id), 0, __LINE__, __FILE__, 
1);
+                       if(!$this->db->next_record())
+                       {
+                               return False;
+                       }
+                       return array('name' => $this->db->f('name', false),
+                                                 'district' => 
$this->db->f('district', false),
+                                                 'city' => 
$this->db->f('city', false),
+                                                 'description' => 
$this->db->f('description', false));
+               }
                
                /**
                 * Returns buildings used by the organization with the 
specified id

Modified: branches/stavangerkommune/booking/inc/class.sogroup.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.sogroup.inc.php 2013-06-12 
19:25:58 UTC (rev 11169)
+++ branches/stavangerkommune/booking/inc/class.sogroup.inc.php 2013-06-13 
08:14:00 UTC (rev 11170)
@@ -46,6 +46,21 @@
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
                }
 
+               function get_metainfo($id)
+               {
+                       $this->db->limit_query("SELECT bg.name, bg.shortname, 
bo.name as organization, bo.district, bo.city, bg.description FROM bb_group as 
bg, bb_organization as bo where bg.organization_id=bo.id and bg.id=" . 
intval($id), 0, __LINE__, __FILE__, 1);
+                       if(!$this->db->next_record())
+                       {
+                               return False;
+                       }
+                       return array('name' => $this->db->f('name', false),
+                                                'shortname' => 
$this->db->f('shortname', false),
+                                                'organization' => 
$this->db->f('organization', false),
+                                                'district' => 
$this->db->f('district', false),
+                                                'city' => $this->db->f('city', 
false),
+                                                'description' => 
$this->db->f('description', false));
+               }
+
                /**
                 * Removes any extra contacts from entity if such exists (only 
two contacts allowed per group).
                 */

Modified: branches/stavangerkommune/booking/inc/class.soorganization.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.soorganization.inc.php  
2013-06-12 19:25:58 UTC (rev 11169)
+++ branches/stavangerkommune/booking/inc/class.soorganization.inc.php  
2013-06-13 08:14:00 UTC (rev 11170)
@@ -52,6 +52,19 @@
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
                }
 
+               function get_metainfo($id)
+               {
+                       $this->db->limit_query("SELECT name, shortname, 
district, city, description FROM bb_organization where id=" . intval($id), 0, 
__LINE__, __FILE__, 1);
+                       if(!$this->db->next_record())
+                       {
+                               return False;
+                       }
+                       return array('name' => $this->db->f('name', false),
+                                                 'shortname' => 
$this->db->f('shortname', false),
+                                                 'district' => 
$this->db->f('district', false),
+                                                 'city' => 
$this->db->f('city', false),
+                                                 'description' => 
$this->db->f('description', false));
+               }
         function get_groups($organization_id)
         {
             static $groups = null;

Modified: branches/stavangerkommune/booking/inc/class.soresource.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.soresource.inc.php      
2013-06-12 19:25:58 UTC (rev 11169)
+++ branches/stavangerkommune/booking/inc/class.soresource.inc.php      
2013-06-13 08:14:00 UTC (rev 11170)
@@ -61,6 +61,20 @@
                        );
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
                }
+
+               function get_metainfo($id)
+               {
+                       $this->db->limit_query("SELECT br.name, bb.name as 
building, bb.city, bb.district, br.description FROM bb_resource as br, 
bb_building as bb where br.building_id=bb.id and br.id=" . intval($id), 0, 
__LINE__, __FILE__, 1);
+                       if(!$this->db->next_record())
+                       {
+                               return False;
+                       }
+                       return array('name' => $this->db->f('name', false),
+                                                 'building' => 
$this->db->f('building', false),
+                                                 'district' => 
$this->db->f('district', false),
+                                                 'city' => 
$this->db->f('city', false),
+                                                 'description' => 
$this->db->f('description', false));
+               }
                
                public static function allowed_types()
                {

Modified: branches/stavangerkommune/booking/inc/class.uiallocation.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.uiallocation.inc.php    
2013-06-12 19:25:58 UTC (rev 11169)
+++ branches/stavangerkommune/booking/inc/class.uiallocation.inc.php    
2013-06-13 08:14:00 UTC (rev 11170)
@@ -395,7 +395,6 @@
 
                public function delete()
                {
-                       
                        $id = intval(phpgw::get_var('allocation_id', 'GET'));
                        $outseason = phpgw::get_var('outseason', 'GET');
                        $recurring = phpgw::get_var('recurring', 'GET');
@@ -409,6 +408,7 @@
                        $invalid_dates = array();
                        $valid_dates = array();
 
+                       
                        if($_SERVER['REQUEST_METHOD'] == 'POST')
                        {
                                $from_date = $_POST['from_'];

Modified: branches/stavangerkommune/booking/inc/class.uiapplication.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.uiapplication.inc.php   
2013-06-12 19:25:58 UTC (rev 11169)
+++ branches/stavangerkommune/booking/inc/class.uiapplication.inc.php   
2013-06-13 08:14:00 UTC (rev 11170)
@@ -204,6 +204,7 @@
                                ),
                                'datatable' => array(
                                        'source' => 
self::link(array('menuaction' => 'booking.uiapplication.index', 
'phpgw_return_as' => 'json')),
+                                       'sorted_by' => array('key' => 
'created', 'dir' => 'asc'),
                                        'field' => array(
                                                array(
                                                        'key' => 'id',
@@ -231,6 +232,10 @@
                                                        'label' => lang('last 
modified')
                                                ),
                                                array(
+                                                       'key' => 'from_',
+                                                       'label' => lang('From')
+                                               ),
+                                               array(
                                                        'key' => 
'activity_name',
                                                        'label' => 
lang('Activity')
                                                ),
@@ -276,13 +281,18 @@
                 }
                 
                        } else {
+                               $test = phpgw::get_var('status', 'string', 
'REQUEST', null);
                                if (phpgw::get_var('status') == 'none')
                                {
                                        $filters['status'] = array('NEW', 
'PENDING', 'REJECTED', 'ACCEPTED');
-                               } 
+                               }
+                               elseif (isset($test)) 
+                               {
+                       $filters['status'] = phpgw::get_var('status');
+                               }
                                else
                                {
-                $filters['status'] = phpgw::get_var('status');
+                       $filters['status'] = 'NEW';
                                }
                 $testdata =  phpgw::get_var('buildings', 'int', 'REQUEST', 
null);
                 if ($testdata != 0) {
@@ -317,6 +327,12 @@
                                        $application['building_name'] = 
str_replace($search, $replace, $application['building_name']);
                                }
 
+                               $dates = array();
+                               foreach ($application['dates'] as $data) {
+                                       $dates[] = $data['from_'];
+                                       break;
+                               }
+                               $application['from_'] = implode(',',$dates);
                                $application['status'] = 
lang($application['status']);
                                $application['created'] = 
pretty_timestamp($application['created']);
                                $application['modified'] = 
pretty_timestamp($application['modified']);
@@ -430,6 +446,16 @@
                                array_set_default($_POST, 'to_', array());
 
                                $application = $this->extract_form_data();
+
+                               foreach ($_POST['from_'] as &$from) {
+                                       $timestamp =  strtotime($from);
+                                       $from =  date("Y-m-d H:i:s",$timestamp);
+                               }
+                               foreach ($_POST['to_'] as &$to) {
+                                       $timestamp =  strtotime($to);
+                                       $to =  date("Y-m-d H:i:s",$timestamp);
+                               }
+
                                $application['dates'] = array_map(array(self, 
'_combine_dates'), $_POST['from_'], $_POST['to_']);
                                $application['active'] = '1';
                                $application['status'] = 'NEW';
@@ -550,7 +576,18 @@
                                }
 
                                $errors = $this->validate($application);
+
+                               foreach ($_POST['from_'] as &$from) {
+                                       $timestamp =  strtotime($from);
+                                       $from =  date("Y-m-d H:i:s",$timestamp);
+                               }
+                               foreach ($_POST['to_'] as &$to) {
+                                       $timestamp =  strtotime($to);
+                                       $to =  date("Y-m-d H:i:s",$timestamp);
+                               }
+
                                $application['dates'] = array_map(array(self, 
'_combine_dates'), $_POST['from_'], $_POST['to_']);
+
                                if(!$errors)
                                {
                                        $receipt = 
$this->bo->update($application);
@@ -690,6 +727,21 @@
                                {
                                        
$this->check_application_assigned_to_current_user($application);
                                        $application['status'] = 
$_POST['status'];
+
+                                       if ($application['status'] == 
'REJECTED') {
+                                               $test = 
$this->assoc_bo->so->read(array('filters'=>array('application_id'=>$application['id'])));
+                                               foreach ($test['results'] as 
$app) {
+                                                       
$this->bo->so->set_inactive($app['id'],$app['type']);                           
                
+                                               }
+                                       }
+
+                                       if ($application['status'] == 
'ACCEPTED') {
+                                               $test = 
$this->assoc_bo->so->read(array('filters'=>array('application_id'=>$application['id'])));
+                                               foreach ($test['results'] as 
$app) {
+                                                       
$this->bo->so->set_active($app['id'],$app['type']);                             
                
+                                               }
+                                       }
+
                                        $update = true;
                                        $notify = true;
                                }
@@ -736,7 +788,7 @@
                        $audience = $audience['results'];
                        $application['status'] = $application['status'];
                        // Check if any bookings, allocations or events are 
associated with this application
-                       $associations = 
$this->assoc_bo->so->read(array('filters'=>array('application_id'=>$application['id'])));
+                       $associations = 
$this->assoc_bo->so->read(array('filters'=>array('application_id'=>$application['id']),'sort'=>'from_',
 'dir' => 'asc'));
                        $num_associations = $associations['total_records'];
                        self::check_date_availability($application);
                        self::render_template('application', 
array('application' => $application, 

Modified: branches/stavangerkommune/booking/inc/class.uibooking.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.uibooking.inc.php       
2013-06-12 19:25:58 UTC (rev 11169)
+++ branches/stavangerkommune/booking/inc/class.uibooking.inc.php       
2013-06-13 08:14:00 UTC (rev 11170)
@@ -245,10 +245,12 @@
                        $booking['building_id'] = phpgw::get_var('building_id', 
'int', 'GET');
                        $booking['resources'] = phpgw::get_var('resources', 
'int', 'GET');
             #The string replace is a workaround for a problem at Bergen 
Kommune 
+
             $booking['from_'] = str_replace('%3A',':',phpgw::get_var('from_', 
'str', 'GET'));
             $booking['to_'] = str_replace('%3A',':',phpgw::get_var('to_', 
'str', 'GET'));
                        $time_from = split(" ",phpgw::get_var('from_', 'str', 
'GET'));
                        $time_to =      split(" ",phpgw::get_var('to_', 'str', 
'GET'));
+
                        $step = phpgw::get_var('step', 'str', 'POST');
                        if (! isset($step)) $step = 1;
                        if (! isset($allocation_id)) $noallocation = 1;
@@ -279,6 +281,11 @@
                                $today = getdate();
                                $booking = extract_values($_POST, 
$this->fields);
 
+                               $timestamp =  strtotime($booking['from_']);
+                               $booking['from_'] =  date("Y-m-d 
H:i:s",$timestamp);
+                               $timestamp =  strtotime($booking['to_']);
+                               $booking['to_'] =  date("Y-m-d 
H:i:s",$timestamp);
+
                                if(strlen($_POST['from_']) < 6) 
                                {
                                        $date_from = array($time_from[0], 
$_POST['from_']);

Modified: branches/stavangerkommune/booking/inc/class.uievent.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.uievent.inc.php 2013-06-12 
19:25:58 UTC (rev 11169)
+++ branches/stavangerkommune/booking/inc/class.uievent.inc.php 2013-06-13 
08:14:00 UTC (rev 11170)
@@ -114,6 +114,10 @@
                                                        'label' => lang('To')
                                                ),
                                                array(
+                                                       'key' => 'active',
+                                                       'label' => 
lang('Active')
+                                               ),
+                                               array(
                                                        'key' => 'link',
                                                        'hidden' => true
                                                )
@@ -356,6 +360,7 @@
 
                                if (!$_POST['application_id'])
                                {
+                                       $event['active'] = '0';
                     $temp_errors = array();
                                        foreach( $event['dates'] as $checkdate) 
                        
                                        {

Added: branches/stavangerkommune/booking/inc/class.uimetasettings.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.uimetasettings.inc.php          
                (rev 0)
+++ branches/stavangerkommune/booking/inc/class.uimetasettings.inc.php  
2013-06-13 08:14:00 UTC (rev 11170)
@@ -0,0 +1,40 @@
+<?php
+       phpgw::import_class('booking.uicommon');
+
+       class booking_uimetasettings extends booking_uicommon
+       {
+               public $public_functions = array
+               (
+                       'index'                 =>      true,
+               );
+               
+               public function __construct()
+               {
+                       parent::__construct();
+                       
self::set_active_menu('admin::bookingfrontend::metasettings');
+               }
+               
+               public function index()
+               {
+                       $config = CreateObject('phpgwapi.config','booking');
+                       $config->read();
+
+                       if($_SERVER['REQUEST_METHOD'] == 'POST')
+                       {
+                               foreach($_POST as $dim => $value)
+                               {
+                                       if (strlen(trim($value)) > 0)
+                                       {
+                                               $config->value($dim, 
trim($value));
+                                       }
+                                       else
+                                       {
+                                               
unset($config->config_data[$dim]);
+                                       }
+                               }
+                               $config->save_repository();
+                       }
+                       $this->use_yui_editor();
+                       self::render_template('metasettings', 
array('config_data' =>$config->config_data));
+               }
+       }

Modified: branches/stavangerkommune/booking/inc/class.uiseason.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.uiseason.inc.php        
2013-06-12 19:25:58 UTC (rev 11169)
+++ branches/stavangerkommune/booking/inc/class.uiseason.inc.php        
2013-06-13 08:14:00 UTC (rev 11170)
@@ -155,7 +155,12 @@
                                $season = extract_values($_POST, $this->fields);
                                $season['active'] = '1';
                                array_set_default($_POST, 'resources', array());
+                               $from =  strtotime($season['from_']);
+                               $to =  strtotime($season['to_']);
+                               $season['from_'] = date("Y-m-d",$from);
+                               $season['to_'] = date("Y-m-d",$to);
                                $errors = $this->bo->validate($season);
+                               
                                if(!$errors)
                                {
                                        try {
@@ -188,6 +193,10 @@
                        $season = $this->bo->read_single($id);
                        $season['buildings_link'] = 
self::link(array('menuaction' => 'booking.uibuilding.index'));
                        $season['building_link'] = 
self::link(array('menuaction' => 'booking.uibuilding.show', 'id' => 
$season['building_id']));
+                       $from =  strtotime($season['from_']);
+                       $to =  strtotime($season['to_']);
+                       $season['from_'] = date("Y-m-d",$from);
+                       $season['to_'] = date("Y-m-d",$to);
                        $errors = array();
                        if($_SERVER['REQUEST_METHOD'] == 'POST')
                        {
@@ -358,8 +367,11 @@
                        if($_SERVER['REQUEST_METHOD'] == 'POST')
                        {
                                $step = phpgw::get_var('create', 'POST') ? 3 : 
2;
-                               $from_ = phpgw::get_var('from_', 'POST');
-                               $to_ = phpgw::get_var('to_', 'POST');
+                               $from =  strtotime(phpgw::get_var('from_', 
'POST'));
+                               $to =  strtotime(phpgw::get_var('to_', 'POST'));
+                               $from_ = date("Y-m-d",$from);
+                               $to_ = date("Y-m-d",$to);
+
                                $interval = phpgw::get_var('field_interval', 
'POST');
                                if($from_ < $season['from_'])
                                {

Modified: 
branches/stavangerkommune/booking/templates/base/allocation_delete_preview.xsl
===================================================================
--- 
branches/stavangerkommune/booking/templates/base/allocation_delete_preview.xsl  
    2013-06-12 19:25:58 UTC (rev 11169)
+++ 
branches/stavangerkommune/booking/templates/base/allocation_delete_preview.xsl  
    2013-06-13 08:14:00 UTC (rev 11170)
@@ -21,6 +21,7 @@
                        <input type="hidden" name="season_id" 
value="{allocation/season_id}"/>
                        <input type="hidden" name="field_building_id" 
value="{allocation/building_id}"/>
                        <input type="hidden" name="step" value="{step}" />
+                       <input type="hidden" name="recurring" 
value="{recurring}" />
                        <input type="hidden" name="repeat_until" 
value="{repeat_until}" />
                        <input type="hidden" name="field_interval" 
value="{interval}" />
                        <input type="hidden" name="outseason" 
value="{outseason}" />

Modified: branches/stavangerkommune/booking/templates/base/application.xsl
===================================================================
--- branches/stavangerkommune/booking/templates/base/application.xsl    
2013-06-12 19:25:58 UTC (rev 11169)
+++ branches/stavangerkommune/booking/templates/base/application.xsl    
2013-06-13 08:14:00 UTC (rev 11170)
@@ -326,7 +326,7 @@
        if (resourceIds) {
            <![CDATA[
            var url = 
'index.php?menuaction=booking.uiresource.index&sort=name&phpgw_return_as=json&' 
+ resourceIds;
-           var url2 = 
'index.php?menuaction=booking.uiapplication.associated&phpgw_return_as=json&filter_application_id='
 + app_id;
+           var url2 = 
'index.php?menuaction=booking.uiapplication.associated&sort=from_&dir=asc&phpgw_return_as=json&filter_application_id='
 + app_id;
                ]]>
            var colDefs = [{key: 'name', label: lang['Resources'], formatter: 
YAHOO.booking.formatLink}, {key: 'type', label: lang['Resource Type']}];
            YAHOO.booking.inlineTableHelper('resources_container', url, 
colDefs);

Added: branches/stavangerkommune/booking/templates/base/metasettings.xsl
===================================================================
--- branches/stavangerkommune/booking/templates/base/metasettings.xsl           
                (rev 0)
+++ branches/stavangerkommune/booking/templates/base/metasettings.xsl   
2013-06-13 08:14:00 UTC (rev 11170)
@@ -0,0 +1,44 @@
+<xsl:template match="data" xmlns:php="http://php.net/xsl";>
+    <div id="content">
+
+    <xsl:call-template name="msgbox"/>
+       <xsl:call-template name="yui_booking_i18n"/>
+
+       <dl class="form">
+               <dt class="heading"><xsl:value-of select="php:function('lang', 
'Booking system settings')"/></dt>
+       </dl>
+
+    <form action="" method="POST">
+
+       <dl class="form-col">
+            <dt><label for="field_metatag_author"><xsl:value-of 
select="php:function('lang', 'Author')"/></label></dt>
+            <dd>
+                               <input id="field_metatag_author" 
name="metatag_author" type="text" size="50">
+                                       <xsl:attribute 
name="value"><xsl:value-of select="config_data/metatag_author"/></xsl:attribute>
+                               </input>
+            </dd>
+            <dt><label for="field_metatag_robots"><xsl:value-of 
select="php:function('lang', 'Robots')"/></label></dt>
+            <dd>
+                               <input id="field_metatag_robots" 
name="metatag_robots" type="text" size="50">
+                                       <xsl:attribute 
name="value"><xsl:value-of select="config_data/metatag_robots"/></xsl:attribute>
+                               </input>
+            </dd>
+        </dl>
+
+               <div class="form-buttons">
+                       <input type="submit">
+                       <xsl:attribute name="value"><xsl:value-of 
select="php:function('lang', 'Save')"/></xsl:attribute>
+                       </input>
+               </div>
+    </form>
+    </div>
+
+</xsl:template>
+
+
+
+
+
+
+
+

Modified: branches/stavangerkommune/bookingfrontend/inc/class.bosearch.inc.php
===================================================================
--- branches/stavangerkommune/bookingfrontend/inc/class.bosearch.inc.php        
2013-06-12 19:25:58 UTC (rev 11169)
+++ branches/stavangerkommune/bookingfrontend/inc/class.bosearch.inc.php        
2013-06-13 08:14:00 UTC (rev 11170)
@@ -9,6 +9,7 @@
                        $this->sobuilding = CreateObject('booking.sobuilding');
                        $this->soorganization = 
CreateObject('booking.soorganization');
                        $this->soresource = CreateObject('booking.soresource');
+                       $this->soevent = CreateObject('booking.soevent');
                }
                
                function search($searchterm)
@@ -54,9 +55,22 @@
                     $res['img_url'] = 
$GLOBALS['phpgw']->link('/bookingfrontend/', array('menuaction' => 
'bookingfrontend.uidocument_resource.index_images', 'filter_owner_id' => 
$res['id'], 'phpgw_return_as' => 'json', 'results' => '1'));
                 }
             }
-                       $final_array = array_merge_recursive($bui_result, 
$org_result, $res_result);
+
+            if(!$type || $type == "event") {
+                               $now = date('Y-m-d');
+                               $expired_conditions = "(bb_event.active != 0 
AND bb_event.completed = 0 AND bb_event.from_ > '{$now}' AND 
bb_event.description != '')";
+                $event_result = 
$this->soevent->read(array("query"=>$searchterm, "sort"  => "name", "dir" => 
"asc",  "filters" => array("active" => "1",'where' => $expired_conditions)));
+                foreach($event_result['results'] as &$event)
+                {
+                    $event['name'] = $event['building_name']. ' / ' . 
$event['description'];
+                    $event['type'] = "Event";
+                                       $date = 
date('Y-m-d',strtotime($event['from_']));                                       
                        
+                                       $res = 
$this->soresource->read(array('filters' => array('id' => 
$event['resources'][0])));
+                    $event['link'] = 
$GLOBALS['phpgw']->link('/bookingfrontend/', array('menuaction' => 
'bookingfrontend.uibuilding.schedule', 'id' => 
$res['results'][0]['building_id'], 'date' => $date));
+                }
+            }
+                       $final_array = array_merge_recursive($bui_result, 
$org_result, $res_result, $event_result);
                        $final_array['total_records_sum']       =       
array_sum((array)$final_array['total_records']);
-                       
                        return $final_array;
                }
        }

Modified: branches/stavangerkommune/bookingfrontend/inc/class.menu.inc.php
===================================================================
--- branches/stavangerkommune/bookingfrontend/inc/class.menu.inc.php    
2013-06-12 19:25:58 UTC (rev 11169)
+++ branches/stavangerkommune/bookingfrontend/inc/class.menu.inc.php    
2013-06-13 08:14:00 UTC (rev 11170)
@@ -18,6 +18,11 @@
                                                'text'  => 
lang('Configuration'),
                                                'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.uiconfig.index', 'appname' => 'bookingfrontend') )
                                        ),
+                                       'metasettings'  => array
+                                       (
+                                               'text'  => lang('Metadata'),
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'booking.uimetasettings.index', 'appname' => 'booking') )
+                                       ),
                                );
                        }
 

Modified: branches/stavangerkommune/phpgwapi/templates/stavanger/head.inc.php
===================================================================
--- branches/stavangerkommune/phpgwapi/templates/stavanger/head.inc.php 
2013-06-12 19:25:58 UTC (rev 11169)
+++ branches/stavangerkommune/phpgwapi/templates/stavanger/head.inc.php 
2013-06-13 08:14:00 UTC (rev 11170)
@@ -115,9 +115,61 @@
        $logofile_frontend = isset($config->config_data['logopath_frontend']) 
&& $config->config_data['logopath_frontend'] ? 
$config->config_data['logopath_frontend'] : 
"/phpgwapi/templates/stavanger/images/stavanger_logo.png";
 
        $bodoc = CreateObject('booking.bodocumentation');
-       
        $manual  =  $bodoc->so->getFrontendDoc();       
 
+       $menuaction = phpgw::get_var('menuaction', 'GET');
+       $id = phpgw::get_var('id', 'GET');
+       if (strpos($menuaction, 'organization'))
+       {
+               $boorganization = CreateObject('booking.boorganization');
+               $metainfo = $boorganization->so->get_metainfo($id);
+               $description = preg_replace('/\s+/', ' ', 
strip_tags($metainfo['description']));
+               $keywords = 
$metainfo['name'].",".$metainfo['shortname'].",".$metainfo['district'].",".$metainfo['city'];
 
+       } 
+       elseif (strpos($menuaction, 'group'))
+       {
+               $bogroup = CreateObject('booking.bogroup');
+               $metainfo = $bogroup->so->get_metainfo($id);
+               $description = preg_replace('/\s+/', ' ', 
strip_tags($metainfo['description']));
+               $keywords = 
$metainfo['name'].",".$metainfo['shortname'].",".$metainfo['organization'].",".$metainfo['district'].",".$metainfo['city'];
 
+       }       
+       elseif (strpos($menuaction, 'building'))
+       {
+               $bobuilding = CreateObject('booking.bobuilding');
+               $metainfo = $bobuilding->so->get_metainfo($id);
+               $description = preg_replace('/\s+/', ' ', 
strip_tags($metainfo['description']));
+               $keywords = 
$metainfo['name'].",".$metainfo['district'].",".$metainfo['city']; 
+       }
+       elseif (strpos($menuaction, 'resource'))
+       {
+               $boresource = CreateObject('booking.boresource');
+               $metainfo = $boresource->so->get_metainfo($id);
+               $description = preg_replace('/\s+/', ' ', 
strip_tags($metainfo['description']));
+               $keywords = 
$metainfo['name'].",".$metainfo['building'].",".$metainfo['district'].",".$metainfo['city'];
 
+       }
+       if($keywords != '') {
+               $keywords = '<meta name="keywords" content="'.$keywords.'">';
+       } else {
+               $keywords = '<meta name="keywords" content="phpGroupWare">';
+       }
+       if($description != '') {
+               $description = '<meta name="description" 
content="'.$description.'">';
+       } else {
+               $description = '<meta name="description" 
content="phpGroupWare">';
+       }
+       if ($config->config_data['metatag_author'] != '')
+       {
+               $author = '<meta name="author" 
content="'.$config->config_data['metatag_author'].'">';
+       } else {
+               $author = '<meta name="author" content="phpGroupWare 
http://www.phpgroupware.org";>';
+       }
+       if ($config->config_data['metatag_robots'] != '')
+       {
+               $robots = '<meta name="robots" 
content="'.$config->config_data['metatag_robots'].'">';
+       } else {
+               $robots = '<meta name="robots" content="none">';
+       }
+
        $app = lang($app);
        $tpl_vars = array
        (
@@ -129,6 +181,10 @@
                'webserver_url' => 
$GLOBALS['phpgw_info']['server']['webserver_url'],
                'win_on_events' => $GLOBALS['phpgw']->common->get_on_events(),
                'navbar_config' => $_navbar_config,
+               'metainfo_author' => $author,
+               'metainfo_keywords' => $keywords,
+               'metainfo_description' => $description,
+               'metainfo_robots' => $robots,
                'lbl_search'    => lang('Search'),
                'logofile'              => $logofile_frontend,
                'header_search_class'   => 
'hidden'//(isset($_GET['menuaction']) && $_GET['menuaction'] == 
'bookingfrontend.uisearch.index' ? 'hidden' : '')
@@ -143,7 +199,7 @@
        $bouser = CreateObject('bookingfrontend.bouser');
        if($bouser->is_logged_in())
        {
-               $tpl_vars['login_text'] = $bouser->orgnr . ' :: ' . 
lang('Logout');
+               $tpl_vars['login_text'] = $bouser->orgname . ' :: ' . 
lang('Logout');
                $tpl_vars['login_url'] = 'logout.php';
        }
        else
@@ -164,7 +220,6 @@
                        $tpl_vars['login_url'] = $custom_login_url;
                }
        }
-
        $GLOBALS['phpgw']->template->set_var($tpl_vars);
 
        $GLOBALS['phpgw']->template->pfp('out', 'head');

Modified: branches/stavangerkommune/phpgwapi/templates/stavanger/head.tpl
===================================================================
--- branches/stavangerkommune/phpgwapi/templates/stavanger/head.tpl     
2013-06-12 19:25:58 UTC (rev 11169)
+++ branches/stavangerkommune/phpgwapi/templates/stavanger/head.tpl     
2013-06-13 08:14:00 UTC (rev 11170)
@@ -4,10 +4,10 @@
 <html>
        <head>
                <meta http-equiv="Content-Type" content="text/html; 
charset=utf-8">
-               <meta name="author" content="phpGroupWare 
http://www.phpgroupware.org";>
-               <meta name="description" content="phpGroupWare">
-               <meta name="keywords" content="phpGroupWare">
-               <meta name="robots" content="none">
+               {metainfo_author}
+               {metainfo_description}
+               {metainfo_keywords}
+               {metainfo_robots}
                <title>{site_title}</title>
                <link rel="icon" href="{img_icon}" type="image/x-ico">
                <link rel="shortcut icon" href="{img_icon}">




reply via email to

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