[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [9511] Added new location; contract_documents; used t
From: |
Erik Holm-Larsen |
Subject: |
[Fmsystem-commits] [9511] Added new location; contract_documents; used to display contract documents for 'innleie' |
Date: |
Tue, 05 Jun 2012 08:23:12 +0000 |
Revision: 9511
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9511
Author: erikhl
Date: 2012-06-05 08:23:11 +0000 (Tue, 05 Jun 2012)
Log Message:
-----------
Added new location; contract_documents; used to display contract documents for
'innleie'
Added files for displaying 'innleie' contract documents
Modified Paths:
--------------
trunk/frontend/setup/default_records.inc.php
trunk/frontend/setup/phpgw_no.lang
trunk/frontend/setup/setup.inc.php
trunk/frontend/setup/tables_update.inc.php
Added Paths:
-----------
trunk/frontend/inc/class.uicontract_documents.inc.php
trunk/frontend/templates/base/document.xsl
Added: trunk/frontend/inc/class.uicontract_documents.inc.php
===================================================================
--- trunk/frontend/inc/class.uicontract_documents.inc.php
(rev 0)
+++ trunk/frontend/inc/class.uicontract_documents.inc.php 2012-06-05
08:23:11 UTC (rev 9511)
@@ -0,0 +1,229 @@
+<?php
+ /**
+ * Frontend : a simplified tool for end users.
+ *
+ * @author Erik Holm-Larsen <address@hidden>
+ * @copyright Copyright (C) 2010 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @package Frontend
+ * @version $Id:$
+ */
+
+ /*
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+ phpgw::import_class('frontend.uifrontend');
+ phpgw::import_class('rental.uicontract');
+ phpgw::import_class('rental.socontract');
+ include_class('rental', 'document', 'inc/model/');
+
+ /**
+ * Drawings
+ *
+ * @package Frontend
+ */
+
+ class frontend_uicontract_documents extends frontend_uifrontend
+ {
+
+ public $public_functions = array
+ (
+ 'index' => true,
+ );
+
+ public function __construct()
+ {
+ $this->contract_state_identifier_doc = "contract_state_in";
+ $this->contracts_per_location_identifier_doc =
"contracts_in_per_location";
+ $this->form_url_doc =
"index.php?menuaction=frontend.uicontract_documents.index";
+
phpgwapi_cache::session_set('frontend','tab',$GLOBALS['phpgw']->locations->get_id('frontend','.document.contracts'));
+ parent::__construct();
+ $this->location_code =
$this->header_state['selected_location'];
+// $this->location_code = '1102-01';
+ }
+
+ public function index()
+ {
+ $contractdata = array(); // This is the main container
for all contract data sent to XSLT template stuff
+ $msglog = array(); // Array of errors and
other notifications displayed to us
+
+ $filter = phpgw::get_var('contract_filter');
+ // The user wants to change the contract status filter
+ if(isset($filter))
+ {
+ $this->contract_filter_doc = $filter;
+ phpgwapi_cache::session_set('frontend',
'contract_filter_doc', $filter);
+
+ // ... if the user changes filter that may
cause the
+ if($filter == 'active' || $filter ==
'not_active')
+ {
+ $change_contract = true;
+ }
+ }
+ else
+ {
+ $filter = phpgwapi_cache::session_get('frontend',
'contract_filter_doc');
+ $this->contract_filter_doc = isset($filter) ? $filter :
'active';
+ }
+
+ // If the user wants to view another contract connected
to this location
+ // Request parameter: the user wants to view details about
anther contract
+ // The current state of the contract view of this user's session
+ $this->contract_state_doc =
phpgwapi_cache::session_get('frontend', $this->contract_state_identifier_doc);
+ $new_contract = phpgw::get_var('contract_id');
+ $contracts_per_location =
phpgwapi_cache::session_get('frontend',
$this->contracts_per_location_identifier_doc);
+ $contracts_for_selection = array();
+ $number_of_valid_contracts = 0;
+
foreach($contracts_per_location[$this->header_state['selected_location']] as
$contract)
+ {
+ if( ($this->contract_filter_doc == 'active' &&
$contract->is_active()) ||
+ ($this->contract_filter_doc == 'not_active' &&
!$contract->is_active()) ||
+ $this->contract_filter_doc == 'all'
+ )
+ {
+ $number_of_valid_contracts += 1;
+ //Only select necessary fields
+ $contracts_for_selection[] = array(
+ 'id' =>
$contract->get_id(),
+ 'old_contract_id' =>
$contract->get_old_contract_id(),
+ 'contract_status' =>
$contract->get_contract_status()
+
+ );
+
+ if($change_contract || $new_contract ==
$contract->get_id() || !isset($this->contract_state_doc['contract']))
+ {
+ $this->contract_state_doc['selected'] =
$contract->get_id();
+ $this->contract_state_doc['contract'] =
$contract;
+ //$this->contract =
rental_socontract::get_instance()->get_single($new_contract);
+ phpgwapi_cache::session_set('frontend',
$this->contract_state_identifier_doc , $this->contract_state_doc);
+ $change_contract = false;
+ }
+ }
+ }
+
+ if($number_of_valid_contracts == 0)
+ {
+ $this->contract_state_doc['selected'] = '';
+ $this->contract_state_doc['contract'] = null;
+ }
+
+ $config = CreateObject('phpgwapi.config','frontend');
+ $config->read();
+ //$doc_types =
isset($config->config_data['document_frontend_cat']) &&
$config->config_data['document_frontend_cat'] ?
$config->config_data['document_frontend_cat'] : array();
+ $doc_types = array('type' => 1);
+
+ $allrows = true;
+ $sodocument = CreateObject('rental.sodocument');
+ $filters = array('contract_id' =>
$this->contract_state_doc['selected'], 'document_type' => 1);
+ $document_list = array();
+ $total_records = 0;
+ if( $this->location_code )
+ {
+ foreach ($doc_types as $doc_type)
+ {
+ if($doc_type)
+ {
+ $document_list =
array_merge($document_list, $sodocument->get($start_index, $num_of_objects,
'id', true, $search_for, $search_type, $filters));
+ }
+
+ $total_records = $total_records +
$sodocument->get_count($search_for, $search_type, $filters);;
+ }
+ }
+
+
//----------------------------------------------datatable settings--------
+
+ $valid_types =
isset($config->config_data['document_valid_types']) &&
$config->config_data['document_valid_types'] ? str_replace ( ',' , '|' ,
$config->config_data['document_valid_types'] ) : '';
+
+ $content = array();
+ if($valid_types)
+ {
+ foreach($document_list as $entry)
+ {
+ if (
!preg_match("/({$valid_types})$/i", $entry->get_name()) )
+ {
+ continue;
+ }
+
+ $content[] = array
+ (
+ 'document_id'
=> $entry->get_id(),
+ 'document_name'
=> $entry->get_name(),
+ 'link'
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'rental.uidocument.view', 'id' => $entry->get_id())),
+ 'title'
=> $entry->get_title(),
+ 'description'
=> $entry->get_description(),
+ 'doc_type'
=> lang($entry->get_type()),
+ );
+ }
+ }
+ $datavalues[0] = array
+ (
+ 'name' => "0",
+ 'values' =>
json_encode($content),
+ 'total_records' =>
count($content),
+ 'edit_action' =>
isset($entry) && $entry->get_id() ?
json_encode($GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'rental.uidocument.view', 'id' => $entry->get_id()))):'' ,
+ 'is_paginator' => 1,
+ 'footer' => 0
+ );
+
+
+ $myColumnDefs[0] = array
+ (
+ 'name' => "0",
+ 'values' => json_encode(array(
array('key' =>
'document_name','label'=>lang('filename'),'sortable'=>true,'resizeable'=>true,'formatter'=>'YAHOO.widget.DataTable.formatLink'),
+
array('key' =>
'document_id','label'=>lang('filename'),'sortable'=>false,'hidden' => true),
+
array('key' =>
'title','label'=>lang('name'),'sortable'=>true,'resizeable'=>true),
+
array('key' =>
'description','label'=>lang('description'),'sortable'=>true,'resizeable'=>true),
+
array('key' =>
'doc_type','label'=>'Type','sortable'=>true,'resizeable'=>true)
+
))
+ );
+
+
//----------------------------------------------datatable settings--------
+
+
+ $datatable = array
+ (
+ 'property_js' =>
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
+ 'datatable' =>
$datavalues,
+ 'myColumnDefs' => $myColumnDefs
+ );
+
+ $data = array
+ (
+ 'header' =>
$this->header_state,
+ 'tabs' =>
$this->tabs,
+ 'contract_data' => array (
+ 'select' => $contracts_for_selection,
+ 'selected_contract' =>
$this->contract_state_doc['selected'],
+ 'contract' =>
isset($this->contract_state_doc['contract']) ?
$this->contract_state_doc['contract']->serialize() : array(),
+ 'contract_filter' => $this->contract_filter_doc,
+ 'form_url' => $this->form_url_doc
+ ),
+ 'documents' =>
array('datatable' => $datatable)
+ );
+
+ $GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('app_data' =>
$data));
+
$GLOBALS['phpgw']->xslttpl->add_file(array('frontend','document'));
+ $GLOBALS['phpgw']->js->validate_file( 'yahoo',
'drawing.list', 'frontend' );
+
+ phpgwapi_yui::load_widget('dragdrop');
+ phpgwapi_yui::load_widget('datatable');
+ phpgwapi_yui::load_widget('connection');
+ phpgwapi_yui::load_widget('loader');
+ phpgwapi_yui::load_widget('paginator');
+
+
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+ }
+ }
Modified: trunk/frontend/setup/default_records.inc.php
===================================================================
--- trunk/frontend/setup/default_records.inc.php 2012-06-05 08:09:08 UTC
(rev 9510)
+++ trunk/frontend/setup/default_records.inc.php 2012-06-05 08:23:11 UTC
(rev 9511)
@@ -15,6 +15,7 @@
$GLOBALS['phpgw']->locations->add('.rental.contract_ex','contract_ex','frontend',
false);
$GLOBALS['phpgw']->locations->add('.document.drawings', 'drawings',
'frontend', false);
$GLOBALS['phpgw']->locations->add('.document.pictures', 'pictures',
'frontend', false);
+
$GLOBALS['phpgw']->locations->add('.document.contracts','contract_documents','frontend',
false);
$GLOBALS['phpgw']->locations->add('.property.maintenance',
'maintenance', 'frontend', false);
$GLOBALS['phpgw']->locations->add('.property.refurbishment',
'refurbishment', 'frontend', false);
$GLOBALS['phpgw']->locations->add('.property.services', 'services',
'frontend', false);
Modified: trunk/frontend/setup/phpgw_no.lang
===================================================================
--- trunk/frontend/setup/phpgw_no.lang 2012-06-05 08:09:08 UTC (rev 9510)
+++ trunk/frontend/setup/phpgw_no.lang 2012-06-05 08:23:11 UTC (rev 9511)
@@ -8,6 +8,7 @@
contract frontend no Kontrakter
contract_in frontend no Innleiekontrakter
contract_ex frontend no Eksternleiekontrakter
+contract_documents frontend no Kontraktsdokumenter
helpdesk frontend no Melding om avvik
subject frontend no Meldingstittel
entry_date frontend no Dato
@@ -130,3 +131,4 @@
message_empty frontend no Meldingen kan ikke være tom
upload_userdoc frontend no Last opp brukerveiledning
filename frontend no Filnavn
+contracts frontend no Kontrakt
\ No newline at end of file
Modified: trunk/frontend/setup/setup.inc.php
===================================================================
--- trunk/frontend/setup/setup.inc.php 2012-06-05 08:09:08 UTC (rev 9510)
+++ trunk/frontend/setup/setup.inc.php 2012-06-05 08:23:11 UTC (rev 9511)
@@ -1,6 +1,6 @@
<?php
$setup_info['frontend']['name'] = 'frontend';
- $setup_info['frontend']['version'] = '0.4';
+ $setup_info['frontend']['version'] = '0.5';
$setup_info['frontend']['app_order'] = 9;
// $setup_info['frontend']['tables'] = array();
$setup_info['frontend']['enable'] = 1;
Modified: trunk/frontend/setup/tables_update.inc.php
===================================================================
--- trunk/frontend/setup/tables_update.inc.php 2012-06-05 08:09:08 UTC (rev
9510)
+++ trunk/frontend/setup/tables_update.inc.php 2012-06-05 08:23:11 UTC (rev
9511)
@@ -38,7 +38,7 @@
}
/**
- * Update frontend version from 0.1 to 0.2
+ * Update frontend version from 0.2 to 0.3
* Add new location as placeholders for functions and menues
*
*/
@@ -51,7 +51,7 @@
}
/**
- * Update frontend version from 0.2 to 0.3
+ * Update frontend version from 0.3 to 0.4
* Add new location as placeholders for functions and menues
*
*/
@@ -62,3 +62,16 @@
$GLOBALS['setup_info']['frontend']['currentver'] = '0.4';
return $GLOBALS['setup_info']['frontend']['currentver'];
}
+
+ /**
+ * Update frontend version from 04 to 0.5
+ * Add new location as placeholders for functions and menues
+ *
+ */
+ $test[] = '0.4';
+ function frontend_upgrade0_4()
+ {
+
$GLOBALS['phpgw']->locations->add('.document.contracts','contract_documents','frontend',
false);
+ $GLOBALS['setup_info']['frontend']['currentver'] = '0.5';
+ return $GLOBALS['setup_info']['frontend']['currentver'];
+ }
Added: trunk/frontend/templates/base/document.xsl
===================================================================
--- trunk/frontend/templates/base/document.xsl (rev 0)
+++ trunk/frontend/templates/base/document.xsl 2012-06-05 08:23:11 UTC (rev
9511)
@@ -0,0 +1,105 @@
+<xsl:template match="contract_data" xmlns:php="http://php.net/xsl">
+ <!-- <xsl:copy-of select="."/> -->
+ <div class="yui-navset" id="documents_tabview">
+ <xsl:value-of disable-output-escaping="yes" select="tabs" />
+ <div class="yui-content">
+ <div class="toolbar-container">
+ <div class="toolbar" style="display: block;
padding-bottom: 1em;">
+ <div id="contract_selector">
+ <img
src="frontend/templates/base/images/16x16/page_white_stack.png"
class="list_image"/>
+ <form action="{form_url}" method="post"
style="float:left;">
+ <select name="contract_filter"
onchange="this.form.submit()">
+ <xsl:choose>
+ <xsl:when
test="//contract_filter = 'active'">
+ <option
value="active" selected="selected"><xsl:value-of select="php:function('lang',
'active')"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option
value="active"><xsl:value-of select="php:function('lang', 'active')"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when
test="//contract_filter = 'not_active'">
+ <option
value="not_active" selected="selected"><xsl:value-of
select="php:function('lang', 'not_active')"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option
value="not_active"><xsl:value-of select="php:function('lang',
'not_active')"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when
test="//contract_filter = 'all'">
+ <option
value="all" selected="selected"><xsl:value-of select="php:function('lang',
'all')"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option
value="all"><xsl:value-of select="php:function('lang', 'all')"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </select>
+ </form>
+ <xsl:choose>
+ <xsl:when
test="not(normalize-space(select)) and (count(select) <= 1)">
+ <em
style="margin-left: 1em; float: left;"><xsl:value-of
select="php:function('lang', 'no_contracts')"/></em>
+ </xsl:when>
+ <xsl:otherwise>
+ <form action="{form_url}"
method="post" style="float: left;">
+ <xsl:for-each
select="select">
+
<xsl:choose>
+
<xsl:when test="id = //selected_contract">
+
<input name="contract_id" type="radio" value="{id}" checked=""
onclick="this.form.submit();" style="margin-left: 1em;"></input>
+
</xsl:when>
+
<xsl:otherwise>
+
<input name="contract_id" type="radio" value="{id}" onclick
="this.form.submit();" style="margin-left: 1em;"></input>
+
</xsl:otherwise>
+
</xsl:choose>
+ <label
style="margin-right: 1em; padding-left: 5px;"> <xsl:value-of
select="old_contract_id"/> (<xsl:value-of select="contract_status"/>)</label>
+ </xsl:for-each>
+ </form>
+ </xsl:otherwise>
+ </xsl:choose>
+ </div>
+ </div>
+ </div>
+ <div style="clear: both;"></div>
+ <div class="tickets">
+ <table cellpadding="2" cellspacing="2" width="95%"
align="center">
+ <xsl:choose>
+ <xsl:when test="msgbox_data != ''">
+ <tr>
+ <td align="left" colspan="3">
+ <xsl:call-template
name="msgbox"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ </table>
+ <div id="paging_0"> </div>
+ <div id="datatable-container_0"></div>
+ <xsl:apply-templates select="datatable" />
+ </div>
+ </div>
+ </div>
+</xsl:template>
+
+<xsl:template name="datatable" match="datatable">
+ <!-- DATATABLE DEFINITIONS-->
+ <script type="text/javascript">
+ var property_js = <xsl:value-of select="property_js" />;
+ var datatable = new Array();
+ var myColumnDefs = new Array();
+
+ <xsl:for-each select="datatable">
+ datatable[<xsl:value-of select="name"/>] = [
+ {
+ values : <xsl:value-of
select="values"/>,
+ total_records : <xsl:value-of
select="total_records"/>,
+ edit_action : <xsl:value-of
select="edit_action"/>,
+ is_paginator : <xsl:value-of
select="is_paginator"/>,
+ footer : <xsl:value-of
select="footer"/>
+ }
+ ]
+ </xsl:for-each>
+
+ <xsl:for-each select="myColumnDefs">
+ myColumnDefs[<xsl:value-of select="name"/>] =
<xsl:value-of select="values"/>
+ </xsl:for-each>
+ </script>
+</xsl:template>
\ No newline at end of file
Property changes on: trunk/frontend/templates/base/document.xsl
___________________________________________________________________
Added: svn:mime-type
+ text/plain
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [9511] Added new location; contract_documents; used to display contract documents for 'innleie',
Erik Holm-Larsen <=