[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [6650] merge 6639:6649 from trunk
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [6650] merge 6639:6649 from trunk |
Date: |
Fri, 26 Nov 2010 17:24:05 +0000 |
Revision: 6650
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6650
Author: sigurdne
Date: 2010-11-26 17:24:05 +0000 (Fri, 26 Nov 2010)
Log Message:
-----------
merge 6639:6649 from trunk
Modified Paths:
--------------
branches/Version-1_0-branch/booking/inc/class.bobuilding.inc.php
branches/Version-1_0-branch/booking/inc/class.sobuilding.inc.php
branches/Version-1_0-branch/booking/inc/class.soevent.inc.php
branches/Version-1_0-branch/booking/inc/class.uiapplication.inc.php
branches/Version-1_0-branch/booking/inc/class.uibuilding.inc.php
branches/Version-1_0-branch/booking/inc/class.uievent.inc.php
branches/Version-1_0-branch/booking/jasper/templates/application.jrxml
branches/Version-1_0-branch/booking/setup/phpgw_no.lang
branches/Version-1_0-branch/booking/setup/setup.inc.php
branches/Version-1_0-branch/booking/setup/tables_current.inc.php
branches/Version-1_0-branch/booking/setup/tables_update.inc.php
branches/Version-1_0-branch/booking/templates/base/building_form.xsl
branches/Version-1_0-branch/booking/templates/base/event_edit.xsl
branches/Version-1_0-branch/bookingfrontend/inc/class.uibuilding.inc.php
branches/Version-1_0-branch/bookingfrontend/setup/phpgw_no.lang
branches/Version-1_0-branch/bookingfrontend/setup/setup.inc.php
branches/Version-1_0-branch/bookingfrontend/templates/base/building.xsl
branches/Version-1_0-branch/bookingfrontend/templates/base/building_schedule.xsl
branches/Version-1_0-branch/frontend/inc/class.hook_helper.inc.php
branches/Version-1_0-branch/frontend/inc/class.uidelegates.inc.php
branches/Version-1_0-branch/property/inc/class.fileuploader.inc.php
branches/Version-1_0-branch/property/inc/class.uidocument.inc.php
branches/Version-1_0-branch/property/inc/class.uientity.inc.php
branches/Version-1_0-branch/property/js/yahoo/entity.edit.js
branches/Version-1_0-branch/property/templates/base/entity.xsl
Added Paths:
-----------
branches/Version-1_0-branch/phpgwapi/js/swfupload/
Property Changed:
----------------
branches/Version-1_0-branch/
Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
-
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6627,6629-6631,6633-6634,6636,6638
+
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6627,6629-6631,6633-6634,6636,6638,6640-6649
Modified: branches/Version-1_0-branch/booking/inc/class.bobuilding.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.bobuilding.inc.php
2010-11-26 17:21:18 UTC (rev 6649)
+++ branches/Version-1_0-branch/booking/inc/class.bobuilding.inc.php
2010-11-26 17:24:05 UTC (rev 6650)
@@ -20,7 +20,7 @@
),
booking_sopermission::ROLE_CASE_OFFICER
=> array
(
- 'write' =>
array_fill_keys(array('name', 'homepage', 'description', 'email', 'phone',
'street', 'zip_code', 'city', 'district'), true),
+ 'write' =>
array_fill_keys(array('name', 'homepage', 'description', 'email', 'phone',
'street', 'zip_code', 'city',
'district','deactivate_application','deactivate_calendar'), true),
),
'global' => array
(
Modified: branches/Version-1_0-branch/booking/inc/class.sobuilding.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.sobuilding.inc.php
2010-11-26 17:21:18 UTC (rev 6649)
+++ branches/Version-1_0-branch/booking/inc/class.sobuilding.inc.php
2010-11-26 17:24:05 UTC (rev 6650)
@@ -13,6 +13,8 @@
'description' => array('type' =>
'string'),
'phone' => array('type' => 'string'),
'email' => array('type' => 'string'),
+ 'deactivate_calendar' => array('type'
=> 'int'),
+ 'deactivate_application' =>
array('type' => 'int'),
'location_code' =>array('type' =>
'string', 'required' => false),
'street' => array('type'
=> 'string', 'query' => true),
'zip_code' => array('type'
=> 'string'),
Modified: branches/Version-1_0-branch/booking/inc/class.soevent.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.soevent.inc.php
2010-11-26 17:21:18 UTC (rev 6649)
+++ branches/Version-1_0-branch/booking/inc/class.soevent.inc.php
2010-11-26 17:24:05 UTC (rev 6650)
@@ -74,7 +74,7 @@
function get_building_info($id)
{
- $this->db->limit_query("SELECT bb_building.id,
bb_building.name FROM bb_building, bb_resource, bb_event_resource WHERE
bb_building.id=bb_resource.building_id AND
bb_resource.id=bb_event_resource.resource_id AND bb_event_resource.event_id=" .
intval($id), 0, __LINE__, __FILE__, 1);
+ $this->db->limit_query("SELECT bb_building.id,
bb_building.name, bb_building.email FROM bb_building, bb_resource,
bb_event_resource WHERE bb_building.id=bb_resource.building_id AND
bb_resource.id=bb_event_resource.resource_id AND bb_event_resource.event_id=" .
intval($id), 0, __LINE__, __FILE__, 1);
if(!$this->db->next_record())
{
return False;
Modified: branches/Version-1_0-branch/booking/inc/class.uiapplication.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.uiapplication.inc.php
2010-11-26 17:21:18 UTC (rev 6649)
+++ branches/Version-1_0-branch/booking/inc/class.uiapplication.inc.php
2010-11-26 17:24:05 UTC (rev 6650)
@@ -359,6 +359,13 @@
$errors['email'] = lang('The e-mail
addresses you entered do not match');
$application['contact_email2'] =
$_POST['contact_email2'];
}
+ foreach($application['agegroups'] as $ag)
+ {
+ if($ag['male'] > 9999 || $ag['female']
> 9999) {
+ $errors['agegroups'] =
lang('Agegroups kan not be larger than 9999 peoples');
+ }
+ }
+
if(!$errors)
{
$comment_text =
$this->create_accepted_documents_comment_text($application);
Modified: branches/Version-1_0-branch/booking/inc/class.uibuilding.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.uibuilding.inc.php
2010-11-26 17:21:18 UTC (rev 6649)
+++ branches/Version-1_0-branch/booking/inc/class.uibuilding.inc.php
2010-11-26 17:24:05 UTC (rev 6650)
@@ -26,7 +26,7 @@
$this->bo = CreateObject('booking.bobuilding');
self::set_active_menu('booking::buildings');
- $this->fields = array('name', 'homepage',
'description', 'email', 'street', 'zip_code', 'city', 'district', 'phone',
'active', 'location_code');
+ $this->fields = array('name', 'homepage',
'description', 'email', 'street', 'zip_code', 'city', 'district', 'phone',
'active', 'location_code','deactivate_application','deactivate_calendar');
}
public function properties()
@@ -177,7 +177,7 @@
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$building = array_merge($building,
extract_values($_POST, $this->fields));
-
+
$errors = $this->bo->validate($building);
if(!$errors)
{
Modified: branches/Version-1_0-branch/booking/inc/class.uievent.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.uievent.inc.php
2010-11-26 17:21:18 UTC (rev 6649)
+++ branches/Version-1_0-branch/booking/inc/class.uievent.inc.php
2010-11-26 17:24:05 UTC (rev 6650)
@@ -482,9 +482,9 @@
if(!$errors['event'] and
!$errors['resource_number'] and !$errors['organization_number'] and
!$errors['invoice_data'])
{
- if (phpgw::get_var('mail', 'POST'))
+ if (phpgw::get_var('mail', 'POST') ||
phpgw::get_var('sendtorbuilding', 'POST'))
{
-
if(phpgw::get_var('sendtocollision', 'POST') || phpgw::get_var('sendtocontact',
'POST'))
+
if(phpgw::get_var('sendtocollision', 'POST') || phpgw::get_var('sendtocontact',
'POST') || phpgw::get_var('sendtorbuilding', 'POST'))
{
$maildata =
$this->create_sendt_mail_notification_comment_text($event,$errors);
if ($maildata)
@@ -518,6 +518,34 @@
$comment_text_log = phpgw::get_var('mail', 'POST');
$this->send_mailnotification($event['contact_email'], lang('Event changed'),
$comment_text_log);
}
+
if(phpgw::get_var('sendtorbuilding', 'POST'))
+ {
+
+ if
($event['customer_organization_name']) {
+
$comment_text_log = $event['customer_organization_name'];
+ } else {
+
$comment_text_log = $event['contact_name'];
+ }
+
$comment_text_log = $comment_text_log.' har fått innvilget et arrangement i
'.$event['building_name'].' '.date('d-m-Y H:i',
strtotime($event['from_'])).".\nFor mer opplysinger slå opp i AktivBy.";
+//
$comment_text_log = phpgw::get_var('mail', 'POST');
+ $sendt = 0;
+
if($building_info['email']) {
+
$sendt++;
+
$this->send_mailnotification($building_info['email'], lang('Message about new
event'), $comment_text_log);
+ }
+ if
($_POST['sendtorbuilding_email1']) {
+
$sendt++;
+
$this->send_mailnotification($_POST['sendtorbuilding_email1'], lang('Message
about new event'), $comment_text_log);
+
+ }
+ if
($_POST['sendtorbuilding_email2']) {
+
$sendt++;
+
$this->send_mailnotification($_POST['sendtorbuilding_email2'], lang('Message
about new event'), $comment_text_log);
+ }
+ if ($sendt > 0)
{
+
$errors['mailtobuilding'] = lang('Unable to send warning, No mailadresses
found');
+ }
+ }
}
else
{
Modified: branches/Version-1_0-branch/booking/jasper/templates/application.jrxml
===================================================================
--- branches/Version-1_0-branch/booking/jasper/templates/application.jrxml
2010-11-26 17:21:18 UTC (rev 6649)
+++ branches/Version-1_0-branch/booking/jasper/templates/application.jrxml
2010-11-26 17:24:05 UTC (rev 6650)
@@ -62,7 +62,7 @@
<parameter name="BK_APPLICATION_ID" class="java.lang.String"/>
<parameter name="BK_BUILDING_NAME" class="java.lang.String"/>
<queryString>
- <![CDATA[SELECT bb_application.id AS application_id,
bb_application.status AS application_status, to_char(bb_application.created,
'DD/MM/YYYY HH24:MI') AS application_created, to_char(bb_application.modified,
'DD/MM/YYYY HH24:MI') AS application_modified,bb_application.contact_name,
bb_application.contact_email,
bb_application.contact_phone,bb_application.description,
to_char(bb_application_date.from_, 'DD/MM/YYYY HH24:MI') AS from,
to_char(bb_application_date.to_, 'DD/MM/YYYY HH24:MI') AS to, bb_activity.name
AS activity_name, bb_event.cost AS price,bb_application_comment.comment AS
comment FROM bb_application, bb_application_date,bb_activity, bb_event,
bb_application_comment WHERE bb_application.id = $P!{BK_APPLICATION_ID} AND
bb_application.id = bb_application_date.application_id AND
bb_application.activity_id = bb_activity.id AND bb_application.id =
bb_event.application_id AND bb_application.id =
bb_application_comment.application_id LIMIT 1]]>
+ <![CDATA[SELECT bb_application.id AS application_id,
bb_application.status AS application_status, to_char(bb_application.created,
'DD/MM/YYYY HH24:MI') AS application_created, to_char(bb_application.modified,
'DD/MM/YYYY HH24:MI') AS application_modified,bb_application.contact_name,
bb_application.contact_email,
bb_application.contact_phone,bb_application.description,
to_char(bb_application_date.from_, 'DD/MM/YYYY HH24:MI') AS from,
to_char(bb_application_date.to_, 'DD/MM/YYYY HH24:MI') AS to, bb_activity.name
AS activity_name, bb_event.cost AS price,bb_application_comment.comment AS
comment FROM bb_application, bb_application_date,bb_activity, bb_event,
bb_application_comment WHERE bb_application.id = ANY
(string_to_array($P{BK_APPLICATION_ID}, ',')::int4[]) AND bb_application.id =
bb_application_date.application_id AND bb_application.activity_id =
bb_activity.id AND bb_application.id = bb_event.application_id AND
bb_application.id = bb_application_comment.application_id LIMIT 1]]>
</queryString>
<field name="application_id" class="java.lang.Integer"/>
<field name="application_status" class="java.lang.String"/>
Modified: branches/Version-1_0-branch/booking/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/booking/setup/phpgw_no.lang 2010-11-26
17:21:18 UTC (rev 6649)
+++ branches/Version-1_0-branch/booking/setup/phpgw_no.lang 2010-11-26
17:24:05 UTC (rev 6650)
@@ -477,3 +477,8 @@
Repeat until booking no Gjenta til
Bookings that can be created booking no Bookinger som kan lages
Bookings and allocations booking no Bookinger og tildelinger
+Send warning to building responsible booking no Send e-post til
ansvarlig på bygget
+Optional e-mail adress booking no Valgfri e-post adresse
+Message about new event booking no Melding om nytt arrangement
+Deactivate application booking no Inaktiver kalender (frontend)
+Deactivate calendar booking no Inaktiver søknad (frontend)
Modified: branches/Version-1_0-branch/booking/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/setup/setup.inc.php 2010-11-26
17:21:18 UTC (rev 6649)
+++ branches/Version-1_0-branch/booking/setup/setup.inc.php 2010-11-26
17:24:05 UTC (rev 6650)
@@ -1,6 +1,6 @@
<?php
$setup_info['booking']['name'] = 'booking';
- $setup_info['booking']['version'] = '0.2.01';
+ $setup_info['booking']['version'] = '0.2.02';
$setup_info['booking']['app_order'] = 9;
$setup_info['booking']['enable'] = 1;
$setup_info['booking']['app_group'] = 'office';
Modified: branches/Version-1_0-branch/booking/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/setup/tables_current.inc.php
2010-11-26 17:21:18 UTC (rev 6649)
+++ branches/Version-1_0-branch/booking/setup/tables_current.inc.php
2010-11-26 17:24:05 UTC (rev 6650)
@@ -19,6 +19,8 @@
'fd' => array(
'id' => array('type' => 'auto', 'nullable' =>
false),
'active' => array('type' => 'int', 'nullable'
=> False,'precision' => '4', 'default' => 1),
+ 'deactive_calendar' => array('type' => 'int',
'nullable' => False,'precision' => '4', 'default' => 0),
+ 'deactive_application' => array('type' =>
'int', 'nullable' => False,'precision' => '4', 'default' => 0),
'name' => array('type' => 'varchar','precision'
=> '50','nullable' => False),
'homepage' => array('type' => 'text',
'nullable' => False),
'location_code' => array('type' =>
'varchar','precision' => '50','nullable' => True),
Modified: branches/Version-1_0-branch/booking/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/setup/tables_update.inc.php
2010-11-26 17:21:18 UTC (rev 6649)
+++ branches/Version-1_0-branch/booking/setup/tables_update.inc.php
2010-11-26 17:24:05 UTC (rev 6650)
@@ -2395,4 +2395,23 @@
}
}
+ $test[] = '0.2.01';
+ function booking_upgrade0_2_01()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+ $table = "bb_building";
+
+ $GLOBALS['phpgw_setup']->oProc->m_odb->query("ALTER TABLE
$table ADD COLUMN deactivate_calendar int NOT NULL DEFAULT 0");
+ $GLOBALS['phpgw_setup']->oProc->m_odb->query("UPDATE $table SET
deactivate_calendar = 0");
+ $GLOBALS['phpgw_setup']->oProc->m_odb->query("ALTER TABLE
$table ADD COLUMN deactivate_application int NOT NULL DEFAULT 0");
+ $GLOBALS['phpgw_setup']->oProc->m_odb->query("UPDATE $table SET
deactivate_application = 0");
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['booking']['currentver'] =
'0.2.02';
+ return $GLOBALS['setup_info']['booking']['currentver'];
+ }
+ }
+
Modified: branches/Version-1_0-branch/booking/templates/base/building_form.xsl
===================================================================
--- branches/Version-1_0-branch/booking/templates/base/building_form.xsl
2010-11-26 17:21:18 UTC (rev 6649)
+++ branches/Version-1_0-branch/booking/templates/base/building_form.xsl
2010-11-26 17:24:05 UTC (rev 6650)
@@ -76,8 +76,50 @@
</dd>
</xsl:if>
</dl>
-
<div class="clr"/>
+ <dl class="form-col">
+ <xsl:if test="not(new_form)">
+ <dt><label
for="field_deactivate_calendar"><xsl:value-of select="php:function('lang',
'Deactivate calendar')"/></label></dt>
+ <dd>
+ <select
id="deactivate_calendar" name="deactivate_calendar">
+ <option value="1">
+ <xsl:if
test="building/deactivate_calendar=1">
+
<xsl:attribute name="selected">checked</xsl:attribute>
+ </xsl:if>
+ <xsl:value-of
select="php:function('lang', 'Yes')"/>
+ </option>
+ <option value="0">
+ <xsl:if
test="building/deactivate_calendar=0">
+
<xsl:attribute name="selected">checked</xsl:attribute>
+ </xsl:if>
+ <xsl:value-of
select="php:function('lang', 'No')"/>
+ </option>
+ </select>
+ </dd>
+ </xsl:if>
+ </dl>
+ <dl class="form-col">
+ <xsl:if test="not(new_form)">
+ <dt><label
for="field_deactivate_application"><xsl:value-of select="php:function('lang',
'Deactivate application')"/></label></dt>
+ <dd>
+ <select
id="field_deactivate_application" name="deactivate_application">
+ <option value="1">
+ <xsl:if
test="building/deactivate_application=1">
+
<xsl:attribute name="selected">checked</xsl:attribute>
+ </xsl:if>
+ <xsl:value-of
select="php:function('lang', 'Yes')"/>
+ </option>
+ <option value="0">
+ <xsl:if
test="building/deactivate_application=0">
+
<xsl:attribute name="selected">checked</xsl:attribute>
+ </xsl:if>
+ <xsl:value-of
select="php:function('lang', 'No')"/>
+ </option>
+ </select>
+ </dd>
+ </xsl:if>
+ </dl>
+ <div class="clr"/>
<dl class="form-col">
<dt><label
for="field_description"><xsl:value-of select="php:function('lang',
'Description')" /></label></dt>
Modified: branches/Version-1_0-branch/booking/templates/base/event_edit.xsl
===================================================================
--- branches/Version-1_0-branch/booking/templates/base/event_edit.xsl
2010-11-26 17:21:18 UTC (rev 6649)
+++ branches/Version-1_0-branch/booking/templates/base/event_edit.xsl
2010-11-26 17:24:05 UTC (rev 6650)
@@ -262,7 +262,9 @@
<textarea id="field_mail" name="mail"
class="full-width"></textarea><br />
<label><input type="checkbox" value="1"
name="sendtocontact" /> <xsl:value-of select="php:function('lang', 'Send to
contact')" /></label><br />
<label><input type="checkbox" value="1"
name="sendtocollision" /> <xsl:value-of select="php:function('lang', 'Send to
contact for overlaping allocations/bookings')" /></label><br />
- </dd>
+ <label><input type="checkbox" value="1"
name="sendtorbuilding" /> <xsl:value-of select="php:function('lang', 'Send
warning to building responsible')" /></label><br />
+ <label><input type="text" name="sendtorbuilding_email1"
/> <xsl:value-of select="php:function('lang', 'Optional e-mail adress')"
/></label><br />
+ <label><input type="text" name="sendtorbuilding_email2"
/> <xsl:value-of select="php:function('lang', 'Optional e-mail adress')"
/></label><br /> </dd>
</dl>
<div class="form-buttons">
<input type="submit">
Modified:
branches/Version-1_0-branch/bookingfrontend/inc/class.uibuilding.inc.php
===================================================================
--- branches/Version-1_0-branch/bookingfrontend/inc/class.uibuilding.inc.php
2010-11-26 17:21:18 UTC (rev 6649)
+++ branches/Version-1_0-branch/bookingfrontend/inc/class.uibuilding.inc.php
2010-11-26 17:24:05 UTC (rev 6650)
@@ -14,11 +14,15 @@
{
$backend = phpgw::get_var('backend', 'GET');
$building =
$this->bo->get_schedule(phpgw::get_var('id', 'GET'),
'bookingfrontend.uibuilding');
- $building['application_link'] = self::link(array(
- 'menuaction' =>
'bookingfrontend.uiapplication.add',
- 'building_id' => $building['id'],
- 'building_name' => $building['name'],
- ));
+ if ($building['deactivate_application'] == 0) {
+ $building['application_link'] =
self::link(array(
+ 'menuaction' =>
'bookingfrontend.uiapplication.add',
+ 'building_id' => $building['id'],
+ 'building_name' => $building['name'],
+ ));
+ } else {
+ $building['application_link'] =
self::link(array('menuaction' => 'bookingfrontend.uibuilding.schedule', 'id' =>
$building['id']));
+ }
$building['datasource_url'] = self::link(array(
'menuaction' =>
'bookingfrontend.uibooking.building_schedule',
'building_id' => $building['id'],
@@ -47,6 +51,7 @@
{
$building['homepage'] =
'http://'.$building['homepage'];
}
+// echo "<pre>";print_r($building);exit;
self::render_template('building', array("building" =>
$building));
}
Modified: branches/Version-1_0-branch/bookingfrontend/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/bookingfrontend/setup/phpgw_no.lang
2010-11-26 17:21:18 UTC (rev 6649)
+++ branches/Version-1_0-branch/bookingfrontend/setup/phpgw_no.lang
2010-11-26 17:24:05 UTC (rev 6650)
@@ -321,3 +321,4 @@
The e-mail addresses you entered do not match bookingfrontend no
E-postadressene er ikke like
Lengt of shortname is to long, max 11 characters long bookingfrontend no
Kortnavn er for langt, maks 11 tegn
Go back to calendar bookingfrontend no Tilbake til kalender
+Agegroups kan not be larger than 9999 peoples bookingfrontend no
Estimert antall deltakere kan ikke være større en 9999 personer
Modified: branches/Version-1_0-branch/bookingfrontend/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/bookingfrontend/setup/setup.inc.php
2010-11-26 17:21:18 UTC (rev 6649)
+++ branches/Version-1_0-branch/bookingfrontend/setup/setup.inc.php
2010-11-26 17:24:05 UTC (rev 6650)
@@ -21,7 +21,7 @@
$setup_info['bookingfrontend']['depends'][] = array(
'appname' => 'booking',
- 'versions' => Array('0.1.92', '0.1.93', '0.1.94', '0.1.95',
'0.1.96', '0.1.97', '0.1.98', '0.1.99', '0.2.00', '0.2.01')
+ 'versions' => Array('0.2.00', '0.2.01','0.2.02')
);
$setup_info['bookingfrontend']['depends'][] = array(
Modified:
branches/Version-1_0-branch/bookingfrontend/templates/base/building.xsl
===================================================================
--- branches/Version-1_0-branch/bookingfrontend/templates/base/building.xsl
2010-11-26 17:21:18 UTC (rev 6649)
+++ branches/Version-1_0-branch/bookingfrontend/templates/base/building.xsl
2010-11-26 17:24:05 UTC (rev 6650)
@@ -13,10 +13,13 @@
<xsl:for-each select="building">
+ <xsl:if test="deactivate_calendar=0">
<div>
<button
onclick="window.location.href='{schedule_link}'"><xsl:value-of
select="php:function('lang', 'Building schedule')" /></button>
- Søk ledig tid/informasjon om hva som skjer
</div>
+ </xsl:if>
+
<div>
<button
onclick="window.location.href='{message_link}'"><xsl:value-of
select="php:function('lang', 'Send message')" /></button>
- Meldig til saksbehandler for bygg
Modified:
branches/Version-1_0-branch/bookingfrontend/templates/base/building_schedule.xsl
===================================================================
---
branches/Version-1_0-branch/bookingfrontend/templates/base/building_schedule.xsl
2010-11-26 17:21:18 UTC (rev 6649)
+++
branches/Version-1_0-branch/bookingfrontend/templates/base/building_schedule.xsl
2010-11-26 17:24:05 UTC (rev 6650)
@@ -18,8 +18,10 @@
<xsl:call-template name="msgbox"/>
- <button
onclick="YAHOO.booking.newApplicationForm();"><xsl:value-of
select="php:function('lang', 'New booking application')" /></button>
- - Søk ledig tid
+ <xsl:if test="building/deactivate_application=0">
+ <button
onclick="YAHOO.booking.newApplicationForm();"><xsl:value-of
select="php:function('lang', 'New booking application')" /></button>
+ - Søk ledig tid
+ </xsl:if>
</xsl:if>
<ul id="week-selector">
Modified: branches/Version-1_0-branch/frontend/inc/class.hook_helper.inc.php
===================================================================
--- branches/Version-1_0-branch/frontend/inc/class.hook_helper.inc.php
2010-11-26 17:21:18 UTC (rev 6649)
+++ branches/Version-1_0-branch/frontend/inc/class.hook_helper.inc.php
2010-11-26 17:24:05 UTC (rev 6650)
@@ -61,7 +61,7 @@
$group_lid =
$GLOBALS['phpgw']->accounts->name2id($default_group_id);
$group_lid = $group_lid ?
$group_lid : 'frontend_delegates';
- $password = 'PEre' . mt_rand()
. '&';
+ $password = 'PEre' .
mt_rand(100,mt_getrandmax ()) . '&';
$account_id =
frontend_bofrontend::create_delegate_account($account_lid,
$fellesdata_user['firstname'], $fellesdata_user['lastname'], $password,
$group_lid);
}
}
Modified: branches/Version-1_0-branch/frontend/inc/class.uidelegates.inc.php
===================================================================
--- branches/Version-1_0-branch/frontend/inc/class.uidelegates.inc.php
2010-11-26 17:21:18 UTC (rev 6649)
+++ branches/Version-1_0-branch/frontend/inc/class.uidelegates.inc.php
2010-11-26 17:24:05 UTC (rev 6650)
@@ -157,8 +157,9 @@
$username = phpgw::get_var('username');
$firstname = phpgw::get_var('firstname');
$lastname = phpgw::get_var('lastname');
- $password = 'TEst1234';
-
+// $password = 'TEst1234';
+ $password = 'PEre' . mt_rand(100,mt_getrandmax
()) . '&';
+
$account_id =
frontend_bofrontend::create_delegate_account($username, $firstname, $lastname,
$password);
if(isset($account_id) &&
!is_numeric($account_id))
Modified: branches/Version-1_0-branch/property/inc/class.fileuploader.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.fileuploader.inc.php
2010-11-26 17:21:18 UTC (rev 6649)
+++ branches/Version-1_0-branch/property/inc/class.fileuploader.inc.php
2010-11-26 17:24:05 UTC (rev 6650)
@@ -24,7 +24,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package property
* @subpackage location
- * @version $Id: class.uilocation.inc.php 5083 2010-03-19 14:29:26Z
sigurd $
+ * @version $Id: class.fileuploader.inc.php 5083 2010-03-19 14:29:26Z
sigurd $
*/
/**
@@ -43,7 +43,7 @@
function __construct()
{
- $GLOBALS['phpgw_info']['flags']['xslt_app']
= true;
+ $GLOBALS['phpgw_info']['flags']['xslt_app']
= false;
$GLOBALS['phpgw_info']['flags']['noframework']
= true;
$GLOBALS['phpgw_info']['flags']['no_reset_fonts']
= true;
}
@@ -53,207 +53,341 @@
$upload_target = phpgw::get_var('upload_target');
$id = phpgw::get_var('id');
- $link_data = array
- (
- 'menuaction' =>
$upload_target,
- 'id' => $id,
- 'last_loginid' =>
phpgw::get_var('last_loginid'),
- 'last_domain' =>
phpgw::get_var('last_domain'),
- 'sessionphpgwsessid' =>
phpgw::get_var('sessionphpgwsessid'),
- 'domain' =>
phpgw::get_var('domain')
- );
-
+ $oArgs = "{menuaction:'$upload_target',"
+ ."id:'$id',"
+ ."last_loginid:'".
phpgw::get_var('last_loginid')."',"
+ ."last_domain:'" .
phpgw::get_var('last_domain')."',"
+ ."sessionphpgwsessid:'" .
phpgw::get_var('sessionphpgwsessid')."',"
+ ."domain:'" . phpgw::get_var('domain')."'";
+
foreach ($_GET as $varname => $value)
{
if(strpos($varname, '_')===0)
{
-
$link_data[substr($varname,1,strlen($varname)-1)] = $value;
+ $oArgs .= ',' .
substr($varname,1,strlen($varname)-1) . ":'{$value}'";
}
}
+ $oArgs .= '}';
- $upload_url = $GLOBALS['phpgw']->link('/index.php',
$link_data);
+ $js_code = self::get_js($oArgs);
- $js_code = self::get_js($upload_url);
-
-
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
-
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/fonts/fonts-min.css');
- phpgwapi_yui::load_widget('uploader');
+ $title = lang('fileuploader');
+ $html = <<<HTML
+ <!DOCTYPE html>
+ <html>
+ <head>
+ <title>{$title}</title>
+ <link
href="{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/swfupload/default.css"
rel="stylesheet" type="text/css" />
+ <script type="text/javascript"
src="{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/core/base.js"></script>
+ <script type="text/javascript"
src="{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/swfupload/swfupload.js"></script>
+ <script type="text/javascript"
src="{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/swfupload/swfupload.queue.js"></script>
+ <script type="text/javascript"
src="{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/swfupload/fileprogress.js"></script>
+ <script type="text/javascript"
src="{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/swfupload/handlers.js"></script>
+ $js_code
+ </head>
+ <body>
-
$GLOBALS['phpgw']->xslttpl->add_file(array('fileuploader'));
- $data = array
- (
- 'js_code' => $js_code,
- );
- $GLOBALS['phpgw']->xslttpl->set_var('phpgw',
array('fileuploader' => $data));
+ <div id="content">
+ <h2>{$title}</h2>
+ <form id="form1" action="index.php"
method="post" enctype="multipart/form-data">
+
+ <div class="fieldset
flash" id="fsUploadProgress">
+ <span
class="legend">Upload Queue</span>
+ </div>
+ <div id="divStatus">0 Files
Uploaded</div>
+ <div>
+ <span
id="spanButtonPlaceHolder"></span>
+ <input
id="btnCancel" type="button" value="Cancel All Uploads"
onclick="swfu.cancelQueue();" disabled="disabled" style="margin-left: 2px;
font-size: 8pt; height: 29px;" />
+ </div>
+ </form>
+ </div>
+ </body>
+ </html>
+HTML;
+ echo $html;
}
- static function get_js($upload_url = '')
+ static function get_js($oArgs = '')
{
+ $button_text = lang('Select Files');
+ $str_base_url = 'http';
+ $str_base_url .= phpgw::get_var('HTTPS', 'bool',
'SERVER') ? 's' : '' ;
+ $str_base_url .= '://';
+ $str_base_url .= phpgw::get_var('HTTP_HOST', 'string',
'SERVER');
+
+ $str_base_url .= $GLOBALS['phpgw']->link('/', array(),
true);
$js_code = <<<JS
- YAHOO.util.Event.onDOMReady(function () {
- var uiLayer = YAHOO.util.Dom.getRegion('selectLink');
- var overlay = YAHOO.util.Dom.get('uploaderOverlay');
- YAHOO.util.Dom.setStyle(overlay, 'width',
uiLayer.right-uiLayer.left + "px");
- YAHOO.util.Dom.setStyle(overlay, 'height',
uiLayer.bottom-uiLayer.top + "px");
- });
+<script type="text/javascript">
+ var swfu;
+ var strBaseURL = '$str_base_url';
- // Custom URL for the uploader swf file (same folder).
+ var sUrl = phpGWLink('index.php', $oArgs);
- YAHOO.widget.Uploader.SWFURL =
"{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/yahoo/uploader/assets/uploader.swf";
+ window.onload = function() {
+ var settings = {
+ flash_url :
"{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/swfupload/swfupload.swf",
+ flash9_url :
"{$GLOBALS['phpgw_info']['server']['webserver_url']}/phpgwapi/js/swfupload/swfupload_fp9.swf",
+ upload_url: sUrl,
+// post_params: {"PHPSESSID" : "<?php echo
session_id(); ?>"},
+ file_size_limit : "100 MB",
+ file_types : "*.*",
+ file_types_description : "All Files",
+ file_upload_limit : 100,
+ file_queue_limit : 0,
+ custom_settings : {
+ progressTarget : "fsUploadProgress",
+ cancelButtonId : "btnCancel"
+ },
+ debug: false,
- // Instantiate the uploader and write it to its
placeholder div.
- var uploader = new YAHOO.widget.Uploader(
"uploaderOverlay" );
-
- // Add event listeners to various events on the
uploader.
- // Methods on the uploader should only be called once
the
- // contentReady event has fired.
+ // Button settings
+ button_image_url:
"images/TestImageNoText_65x29.png",
+ button_width: "65",
+ button_height: "29",
+ button_placeholder_id: "spanButtonPlaceHolder",
+ button_text: '<span
class="theFont">{$button_text}</span>',
+ button_text_style: ".theFont { font-size: 16;
}",
+ button_text_left_padding: 12,
+ button_text_top_padding: 3,
+
+ // The event handler functions are defined in
handlers.js
+ swfupload_preload_handler : preLoad,
+ swfupload_load_failed_handler : loadFailed,
+ file_queued_handler : fileQueued,
+ file_queue_error_handler : fileQueueError,
+ file_dialog_complete_handler :
fileDialogComplete,
+ upload_start_handler : uploadStart,
+ upload_progress_handler : uploadProgress,
+ upload_error_handler : uploadError,
+ upload_success_handler : uploadSuccess,
+ upload_complete_handler : uploadComplete,
+ queue_complete_handler : queueComplete //
Queue plugin event
+ };
+
+ swfu = new SWFUpload(settings);
+ };
+ </script>
+JS;
+ return $js_code;
+ }
+
+
+/*
+This is an upload script for SWFUpload that attempts to properly handle
uploaded files
+in a secure way.
+
+Notes:
- uploader.addListener('contentReady',
handleContentReady);
- uploader.addListener('fileSelect', onFileSelect)
- uploader.addListener('uploadStart', onUploadStart);
- uploader.addListener('uploadProgress',
onUploadProgress);
- uploader.addListener('uploadCancel', onUploadCancel);
- uploader.addListener('uploadComplete',
onUploadComplete);
- uploader.addListener('uploadCompleteData',
onUploadResponse);
- uploader.addListener('uploadError', onUploadError);
- uploader.addListener('rollOver', handleRollOver);
- uploader.addListener('rollOut', handleRollOut);
- uploader.addListener('click', handleClick);
-
- // Variable for holding the filelist.
- var fileList;
+ SWFUpload doesn't send a MIME-TYPE. In my opinion this is ok since
MIME-TYPE is no better than
+ file extension and is probably worse because it can vary from OS to OS
and browser to browser (for the same file).
+ The best thing to do is content sniff the file but this can be
resource intensive, is difficult, and can still be fooled or inaccurate.
+ Accepting uploads can never be 100% secure.
+
+ You can't guarantee that SWFUpload is really the source of the upload.
A malicious user
+ will probably be uploading from a tool that sends invalid or false
metadata about the file.
+ The script should properly handle this.
+
+ The script should not over-write existing files.
- // When the mouse rolls over the uploader, this function
- // is called in response to the rollOver event.
- // It changes the appearance of the UI element below
the Flash overlay.
- function handleRollOver () {
-
YAHOO.util.Dom.setStyle(YAHOO.util.Dom.get('selectLink'), 'color', "#FFFFFF");
-
YAHOO.util.Dom.setStyle(YAHOO.util.Dom.get('selectLink'), 'background-color',
"#000000");
- }
+ The script should strip away invalid characters from the file name or
reject the file.
+
+ The script should not allow files to be saved that could then be
executed on the webserver (such as .php files).
+ To keep things simple we will use an extension whitelist for allowed
file extensions. Which files should be allowed
+ depends on your server configuration. The extension white-list is
_not_ tied your SWFUpload file_types setting
+
+ For better security uploaded files should be stored outside the
webserver's document root. Downloaded files
+ should be accessed via a download script that proxies from the file
system to the webserver. This prevents
+ users from executing malicious uploaded files. It also gives the
developer control over the outgoing mime-type,
+ access restrictions, etc. This, however, is outside the scope of this
script.
+
+ SWFUpload sends each file as a separate POST rather than several files
in a single post. This is a better
+ method in my opinion since it better handles file size limits, e.g.,
if post_max_size is 100 MB and I post two 60 MB files then
+ the post would fail (2x60MB = 120MB). In SWFupload each 60 MB is
posted as separate post and we stay within the limits. This
+ also simplifies the upload script since we only have to handle a
single file.
+
+ The script should properly handle situations where the post was too
large or the posted file is larger than
+ our defined max. These values are not tied to your SWFUpload
file_size_limit setting.
+
+*/
- // On rollOut event, this function is called, which
changes the appearance of the
- // UI element below the Flash layer back to its
original state.
- function handleRollOut () {
-
YAHOO.util.Dom.setStyle(YAHOO.util.Dom.get('selectLink'), 'color', "#0000CC");
-
YAHOO.util.Dom.setStyle(YAHOO.util.Dom.get('selectLink'), 'background-color',
"#FFFFFF");
- }
+ function upload($bofiles, $save_path = '')
+ {
+ $use_vfs = true;
+ // Check post_max_size
(http://us3.php.net/manual/en/features.file-upload.php#73762)
+ $POST_MAX_SIZE = ini_get('post_max_size');
+ $unit = strtoupper(substr($POST_MAX_SIZE, -1));
+ $multiplier = ($unit == 'M' ? 1048576 : ($unit == 'K' ?
1024 : ($unit == 'G' ? 1073741824 : 1)));
- // When the Flash layer is clicked, the "Browse" dialog
is invoked.
- // The click event handler allows you to do something
else if you need to.
- function handleClick () {
+ if ((int)$_SERVER['CONTENT_LENGTH'] >
$multiplier*(int)$POST_MAX_SIZE && $POST_MAX_SIZE)
+ {
+ header("HTTP/1.1 500 Internal Server Error");
// This will trigger an uploadError event in SWFUpload
+ echo "POST exceeded maximum allowed size.";
+ $GLOBALS['phpgw']->common->phpgw_exit();
}
- // When contentReady event is fired, you can call
methods on the uploader.
- function handleContentReady () {
- // Allows the uploader to send log messages to
trace, as well as to YAHOO.log
- uploader.setAllowLogging(true);
+ // Settings
- // Allows multiple file selection in "Browse"
dialog.
- uploader.setAllowMultipleFiles(true);
+ if(!$save_path)
+ {
+ $save_path =
"{$GLOBALS['phpgw_info']['server']['temp_dir']}";
+ $use_vfs = false;
+ }
+ $upload_name = "Filedata";
+ $max_file_size_in_bytes = 2147483647;
// 2GB in bytes
+ $extension_whitelist = array("jpg", "gif", "png");
// Allowed file extensions
+ $valid_chars_regex = '.A-Z0-9_
address@hidden&()+={}\[\]\',~`-'; // Characters
allowed in the file name (in a Regular Expression format)
+
+ // Other variables
+ $MAX_FILENAME_LENGTH = 260;
+ $file_name = "";
+ $file_extension = "";
+ $uploadErrors = array
+ (
+ 0=>"There is no error, the file uploaded successfully",
+ 1=>"The uploaded file exceeds the upload_max_filesize
directive in php.ini",
+ 2=>"The uploaded file exceeds the MAX_FILE_SIZE
directive that was specified in the HTML form",
+ 3=>"The uploaded file was only partially uploaded",
+ 4=>"No file was uploaded",
+ 6=>"Missing a temporary folder"
+ );
- // New set of file filters.
- var ff = new Array({description:"Images",
extensions:"*.jpg;*.png;*.gif"},
- {description:"Videos",
extensions:"*.avi;*.mov;*.mpg"});
- // Apply new set of file filters to the
uploader.
-// uploader.setFileFilters(ff);
+ // Validate the upload
+ if (!isset($_FILES[$upload_name]))
+ {
+ $this->HandleError("No upload found in \$_FILES
for " . $upload_name);
+ $GLOBALS['phpgw']->common->phpgw_exit();
}
-
- // Actually uploads the files. In this case,
- // uploadAll() is used for automated queueing and
upload
- // of all files on the list.
- // You can manage the queue on your own and use
"upload" instead,
- // if you need to modify the properties of the request
for each
- // individual file.
- function upload() {
- if (fileList != null) {
-//
uploader.setSimUploadLimit(parseInt(document.getElementById("simulUploads").value));
- uploader.setSimUploadLimit(1);
- uploader.uploadAll("{$upload_url}",
"POST", null, "Filedata");
- }
+ else if (isset($_FILES[$upload_name]["error"]) &&
$_FILES[$upload_name]["error"] != 0)
+ {
+
$this->HandleError($uploadErrors[$_FILES[$upload_name]["error"]]);
+ $GLOBALS['phpgw']->common->phpgw_exit();
}
+ else if (!isset($_FILES[$upload_name]["tmp_name"]) ||
address@hidden($_FILES[$upload_name]["tmp_name"]))
+ {
+ $this->HandleError("Upload failed
is_uploaded_file test.");
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
+ else if (!isset($_FILES[$upload_name]['name']))
+ {
+ $this->HandleError("File has no name.");
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
+
+ // Validate the file size (Warning: the largest files supported
by this code is 2GB)
+ $file_size =
@filesize($_FILES[$upload_name]["tmp_name"]);
+ if (!$file_size || $file_size > $max_file_size_in_bytes)
+ {
+ $this->HandleError("File exceeds the maximum
allowed size");
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
+
+ if ($file_size <= 0)
+ {
+ $this->HandleError("File size outside allowed
lower bound");
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
- // Fired when the user selects files in the "Browse"
dialog
- // and clicks "Ok".
- function onFileSelect(event) {
- if('fileList' in event && event.fileList !=
null) {
- fileList = event.fileList;
- createDataTable(fileList);
- }
+ // Validate file name (for our purposes we'll just remove
invalid characters)
+ $file_name =
preg_replace('/[^'.$valid_chars_regex.']|\.+$/i', "",
basename($_FILES[$upload_name]['name']));
+ if (strlen($file_name) == 0 || strlen($file_name) >
$MAX_FILENAME_LENGTH)
+ {
+ $this->HandleError("Invalid file name");
+ $GLOBALS['phpgw']->common->phpgw_exit();
}
- function createDataTable(entries) {
- rowCounter = 0;
- this.fileIdHash = {};
- this.dataArr = [];
- for(var i in entries) {
- var entry = entries[i];
- entry["progress"] = "<div
style='height:5px;width:100px;background-color:#CCC;'></div>";
- dataArr.unshift(entry);
- }
- for (var j = 0; j < dataArr.length; j++) {
- this.fileIdHash[dataArr[j].id] = j;
- }
+ $to_file = "{$save_path}/{$file_name}";
- var myColumnDefs = [
- {key:"name", label: "File Name",
sortable:false},
- {key:"size", label: "Size", sortable:false},
- {key:"progress", label: "Upload progress",
sortable:false}
- ];
+ // Validate that we won't over-write an existing file
+ if ($bofiles->vfs->file_exists(array(
+ 'string' => $to_file,
+ 'relatives' => Array(RELATIVE_NONE)
+ )))
+ {
+ $receipt['error'][]=array('msg'=>lang('This
file already exists !'));
+ $this->HandleError("File with this name already
exists");
+ exit(0);
+ }
- this.myDataSource = new YAHOO.util.DataSource(dataArr);
- this.myDataSource.responseType =
YAHOO.util.DataSource.TYPE_JSARRAY;
- this.myDataSource.responseSchema = {
- fields: ["id","name","created","modified","type",
"size", "progress"]
- };
+ $bofiles->create_document_dir($save_path);
- this.singleSelectDataTable = new
YAHOO.widget.DataTable("dataTableContainer",
- myColumnDefs, this.myDataSource, {
- caption:"Files To Upload",
- selectionMode:"single"
- });
+/*
+ // Validate that we won't over-write an existing file
+ if (file_exists("{$save_path}/{$file_name}"))
+ {
+ $this->HandleError("File with this name already
exists");
+ exit(0);
}
-
- // Do something on each file's upload start.
- function onUploadStart(event) {
-
+*/
+ // Validate file extension
+ $path_info = pathinfo($_FILES[$upload_name]['name']);
+ $file_extension = $path_info["extension"];
+ $is_valid_extension = false;
+ foreach ($extension_whitelist as $extension)
+ {
+ if (strcasecmp($file_extension, $extension) ==
0)
+ {
+ $is_valid_extension = true;
+ break;
+ }
}
-
- // Do something on each file's upload progress event.
- function onUploadProgress(event) {
- rowNum = fileIdHash[event["id"]];
- prog =
Math.round(100*(event["bytesLoaded"]/event["bytesTotal"]));
- progbar = "<div
style='height:5px;width:100px;background-color:#CCC;'><div
style='height:5px;background-color:#F00;width:" + prog + "px;'></div></div>";
- singleSelectDataTable.updateRow(rowNum, {name:
dataArr[rowNum]["name"], size: dataArr[rowNum]["size"], progress: progbar});
+ if (!$is_valid_extension)
+ {
+ $this->HandleError("Invalid file extension");
+ $GLOBALS['phpgw']->common->phpgw_exit();
}
- // Do something when each file's upload is complete.
- function onUploadComplete(event) {
- rowNum = fileIdHash[event["id"]];
- prog =
Math.round(100*(event["bytesLoaded"]/event["bytesTotal"]));
- progbar = "<div
style='height:5px;width:100px;background-color:#CCC;'><div
style='height:5px;background-color:#F00;width:100px;'></div></div>";
- singleSelectDataTable.updateRow(rowNum, {name:
dataArr[rowNum]["name"], size: dataArr[rowNum]["size"], progress: progbar});
- }
+ // Validate file contents (extension and mime-type can't be
trusted)
+ /*
+ Validating the file contents is OS and web
server configuration dependant. Also, it may not be reliable.
+ See the comments on this page:
http://us2.php.net/fileinfo
+
+ Also see
http://72.14.253.104/search?q=cache:3YGZfcnKDrYJ:www.scanit.be/uploads/php-file-upload.pdf+php+file+command&hl=en&ct=clnk&cd=8&gl=us&client=firefox-a
+ which describes how a PHP script can be
embedded within a GIF image file.
+
+ Therefore, no sample code will be provided
here. Research the issue, decide how much security is
+ needed, and implement a solution that meets the
need.
+ */
- // Do something if a file upload throws an error.
- // (When uploadAll() is used, the Uploader will
- // attempt to continue uploading.
- function onUploadError(event) {
- console.log(event);
- }
- // Do something if an upload is cancelled.
- function onUploadCancel(event) {
+ // Process the file
+ /*
+ At this point we are ready to process the valid
file. This sample code shows how to save the file. Other tasks
+ could be done such as creating an entry in a
database or generating a thumbnail.
+
+ Depending on your server OS and needs you may
need to set the Security Permissions on the file after it has
+ been saved.
+ */
+ $bofiles->vfs->override_acl = 1;
+ if(!$bofiles->vfs->cp (array (
+ 'from' => $_FILES[$upload_name]["tmp_name"],
+ 'to' => "{$save_path}/{$file_name}",
+ 'relatives' => array
(RELATIVE_NONE|VFS_REAL, RELATIVE_ALL))))
+ {
+ $receipt['error'][]=array('msg'=>lang('Failed
to upload file !'));
+ $this->HandleError("File could not be saved.");
+ exit(0);
}
- // Do something when data is received back from the
server.
- function onUploadResponse(event) {
+ $bofiles->vfs->override_acl = 0;
+/*
+ if (address@hidden($_FILES[$upload_name]["tmp_name"],
"{$save_path}/{$file_name}"))
+ {
+ $this->HandleError("File could not be saved.");
+ exit(0);
}
-JS;
- return $js_code;
+*/
+// exit(0);
}
+
+ /* Handles the error output. This error message will be sent to
the uploadSuccess event handler. The event handler
+ will have to check for any error messages and react as needed.
*/
+ function HandleError($message)
+ {
+ echo $message;
+ }
}
Modified: branches/Version-1_0-branch/property/inc/class.uidocument.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uidocument.inc.php
2010-11-26 17:21:18 UTC (rev 6649)
+++ branches/Version-1_0-branch/property/inc/class.uidocument.inc.php
2010-11-26 17:24:05 UTC (rev 6650)
@@ -408,7 +408,8 @@
);
// values for datatable
- if(isset($datatable['rows']['row']) &&
is_array($datatable['rows']['row'])){
+ if(isset($datatable['rows']['row']) &&
is_array($datatable['rows']['row']))
+ {
foreach( $datatable['rows']['row'] as $row )
{
$json_row = array();
@@ -416,12 +417,13 @@
{
if(isset($column['format']) &&
$column['format']== "link" && $column['java_link']==true)
{
-
$json_row[$column['name']] = "<a href='#' id='".$column['link']."'
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+
$json_row[$column['name']] = "<a href='#' id='{$column['link']}'
onclick='javascript:filter_data(this.id);'>{$column['value']}</a>";
}
- elseif(isset($column['format'])
&& $column['format']== "link")
+ else
if(isset($column['format']) && $column['format']== "link")
{
- $json_row[$column['name']] =
"<a href='".$column['link']."'>" .$column['value']."</a>";
- }else
+ $json_row[$column['name']] =
"<a href='{$column['link']}'>{$column['value']}</a>";
+ }
+ else
{
$json_row[$column['name']] =
$column['value'];
}
@@ -928,7 +930,8 @@
);
// values for datatable
- if(isset($datatable['rows']['row']) &&
is_array($datatable['rows']['row'])){
+ if(isset($datatable['rows']['row']) &&
is_array($datatable['rows']['row']))
+ {
foreach( $datatable['rows']['row'] as $row )
{
$json_row = array();
@@ -936,12 +939,13 @@
{
if(isset($column['format']) &&
$column['format']== "link" && $column['java_link']==true)
{
-
$json_row[$column['name']] = "<a href='#' id='".$column['link']."'
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+
$json_row[$column['name']] = "<a href='#' id='{$column['link']}
onclick='javascript:filter_data(this.id);'>{$column['value']}</a>";
}
- elseif(isset($column['format'])
&& $column['format']== "link")
+ else
if(isset($column['format']) && $column['format']== "link")
{
- $json_row[$column['name']] =
"<a href='".$column['link']."'>" .$column['value']."</a>";
- }else
+ $json_row[$column['name']] =
"<a href='{$column['link']}' target = '_blank'>{$column['value']}</a>";
+ }
+ else
{
$json_row[$column['name']] =
$column['value'];
}
Modified: branches/Version-1_0-branch/property/inc/class.uientity.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uientity.inc.php
2010-11-26 17:21:18 UTC (rev 6649)
+++ branches/Version-1_0-branch/property/inc/class.uientity.inc.php
2010-11-26 17:24:05 UTC (rev 6650)
@@ -57,8 +57,9 @@
'attrib_history'=> true,
'attrib_help' => true,
'print_pdf' => true,
- 'index' => true,
- 'addfiles' => true
+ 'index' => true,
+ 'addfiles' => true,
+ 'get_files' => true
);
function property_uientity()
@@ -158,6 +159,9 @@
$id = phpgw::get_var('id',
'int');
$jasperfile = phpgw::get_var('jasperfile',
'bool');
+ $fileuploader = CreateObject('property.fileuploader');
+
+
if(!$this->acl_add && !$this->acl_edit)
{
$GLOBALS['phpgw']->common->phpgw_exit();
@@ -174,7 +178,6 @@
foreach ($_FILES as $fieldName => $file)
{
move_uploaded_file($file['tmp_name'],
"{$GLOBALS['phpgw_info']['server']['temp_dir']}/" .
strip_tags(basename($file['name'])));
- echo (" ");
}
$GLOBALS['phpgw']->common->phpgw_exit();
}
@@ -189,54 +192,66 @@
$bofiles = CreateObject('property.bofiles');
- $files = array();
- foreach ($_FILES as $fieldName => $file)
+ $fileuploader->upload($bofiles,
"{$bofiles->fakebase}/{$this->category_dir}/{$loc1}/{$id}");
+ }
+
+ function get_files()
+ {
+ $id = phpgw::get_var('id', 'int');
+
+ if( !$this->acl_read)
{
- $file_name = str_replace('
','_',strip_tags(basename($file['name'])));
- if($jasperfile)
+ return;
+ }
+
+ $values =
$this->bo->read_single(array('entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id,'id'=>$id));
+
+ $link_file_data = array
+ (
+ 'menuaction' =>
'property.uientity.view_file',
+ 'loc1' =>
$values['location_data']['loc1'],
+ 'id' => $id,
+ 'cat_id' => $this->cat_id,
+ 'entity_id' => $this->entity_id,
+ 'type' => $this->type
+ );
+
+ if(isset($values['files']) &&
is_array($values['files']))
+ {
+ $j = count($values['files']);
+ for ($i=0;$i<$j;$i++)
{
- $file_name = 'jasper::' . $file_name;
+
$values['files'][$i]['file_name']=urlencode($values['files'][$i]['name']);
}
- $to_file =
"{$bofiles->fakebase}/{$this->category_dir}/{$loc1}/{$id}/{$file_name}";
+ }
- if ($bofiles->vfs->file_exists(array(
- 'string' => $to_file,
- 'relatives' =>
Array(RELATIVE_NONE)
- )))
+
+ $content_files = array();
+ foreach($values['files'] as $_entry )
+ {
+ $content_files[] = array
+ (
+ 'file_name' => '<a
href="'.$GLOBALS['phpgw']->link('/index.php',$link_file_data).'&file_name='.$_entry['name'].'"
target="_blank" title="'.lang('click to view
file').'">'.$_entry['name'].'</a>',
+ 'delete_file' => '<input
type="checkbox" name="values[file_action][]" value="'.$_entry['name'].'"
title="'.lang('Check to delete file').'">'
+ );
+ }
+
+ if( phpgw::get_var('phpgw_return_as') == 'json' )
+ {
+
+ if(count($content_files))
{
-
$receipt['error'][]=array('msg'=>lang('This file already exists !'));
+ return json_encode($content_files);
}
else
{
- $files[] = array
- (
- 'from_file' =>
$file['tmp_name'],
- 'to_file' => $to_file
- );
+ return "";
}
-
- unset($to_file);
- unset($file_name);
}
-
$bofiles->create_document_dir("{$this->category_dir}/{$loc1}/{$id}");
- $bofiles->vfs->override_acl = 1;
- foreach ($files as $file)
- {
- if(!$bofiles->vfs->cp (array (
- 'from' => $file['from_file'],
- 'to' => $file['to_file'],
- 'relatives' => array
(RELATIVE_NONE|VFS_REAL, RELATIVE_ALL))))
- {
-
$receipt['error'][]=array('msg'=>lang('Failed to upload file !'));
- }
- echo (" ");
- }
- $bofiles->vfs->override_acl = 0;
- unset($loc1);
- unset($files);
- unset($file);
+ return $content_files;
}
+
function columns()
{
//cramirez: necesary for windows.open . Avoid error JS
@@ -1759,7 +1774,12 @@
'textarearows'
=>
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
&& $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ?
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6,
'tabs'
=> phpgwapi_yui::tabview_generate($tabs, $active_tab),
'integration'
=> $integration,
- 'value_integration_src' =>
$integration_src
+ 'value_integration_src' =>
$integration_src,
+ 'base_java_url'
=> "{menuaction:'property.uientity.get_files',".
+
"id:'{$id}',".
+
"entity_id:'{$this->entity_id}',".
+
"cat_id:'{$this->cat_id}',".
+
"type:'{$this->type}'}"
);
phpgwapi_yui::load_widget('dragdrop');
Modified: branches/Version-1_0-branch/property/js/yahoo/entity.edit.js
===================================================================
--- branches/Version-1_0-branch/property/js/yahoo/entity.edit.js
2010-11-26 17:21:18 UTC (rev 6649)
+++ branches/Version-1_0-branch/property/js/yahoo/entity.edit.js
2010-11-26 17:24:05 UTC (rev 6650)
@@ -1,7 +1,8 @@
var myDataSource, myDataTable, myContextMenu;
var myPaginator_0, myDataTable_0
var myPaginator_1, myDataTable_1;
-
+var d;
+var uploadsuccess = 0;
/********************************************************************************/
var FormatterCenter = function(elCell, oRecord, oColumn, oData)
{
@@ -14,7 +15,6 @@
{
}
-
this.fileuploader = function()
{
var sUrl = phpGWLink('index.php', fileuploader_action);
@@ -23,14 +23,34 @@
var frame = document.createElement('iframe');
frame.src = sUrl;
frame.width = "100%";
- frame.height = "350";
+ frame.height = "400";
o.setBody(frame);
};
lightbox.showEvent.subscribe(onDialogShow, lightbox);
lightbox.show();
}
+ this.refresh_files = function()
+ {
+ if(document.getElementById('uploadsuccess').value !=
uploadsuccess)
+ {
+ execute_async(myDataTable_0);
+ uploadsuccess =
document.getElementById('uploadsuccess').value;
+ }
+ }
+ this.onDOMAttrModified = function(e)
+ {
+ var attr = e.attrName || e.propertyName
+ var target = e.target || e.srcElement;
+ if (attr.toLowerCase() == 'uploadsuccess')
+ {
+ refresh_files();
+ }
+ }
+
+
+
YAHOO.util.Event.addListener(window, "load", function()
{
var loader = new YAHOO.util.YUILoader();
@@ -60,3 +80,17 @@
YAHOO.util.Dom.setStyle('lightbox-placeholder', 'display',
'block');
});
+
+YAHOO.util.Event.addListener(window, "load", function()
+{
+ d = document.getElementById('uploadsuccess');
+ if (d.attachEvent)
+ {
+ d.attachEvent('onpropertychange', onDOMAttrModified, false);
+ }
+ else
+ {
+ d.addEventListener('DOMAttrModified', onDOMAttrModified, false);
+ }
+});
+
Modified: branches/Version-1_0-branch/property/templates/base/entity.xsl
===================================================================
--- branches/Version-1_0-branch/property/templates/base/entity.xsl
2010-11-26 17:21:18 UTC (rev 6649)
+++ branches/Version-1_0-branch/property/templates/base/entity.xsl
2010-11-26 17:24:05 UTC (rev 6650)
@@ -27,6 +27,7 @@
<script type="text/javascript">
var property_js = <xsl:value-of select="property_js" />;
+ var base_java_url = <xsl:value-of
select="base_java_url" />;
var datatable = new Array();
var myColumnDefs = new Array();
@@ -235,6 +236,14 @@
<div
id="datatable-container_0"></div>
</td>
</tr>
+ <tr>
+ <td align="left"
valign="top">
+ </td>
+ <td>
+ <input
type="button" id="refresh" value="refresh files" onclick="refresh_files();"/>
+ </td>
+ </tr>
+
<xsl:choose>
<xsl:when
test="cat_list='' and fileupload = 1 and mode = 'edit'">
<xsl:call-template name="file_upload"/>
@@ -286,7 +295,7 @@
</table>
</xsl:when>
</xsl:choose>
-
+ <input type="hidden" id="uploadsuccess" name="uploadsuccess"
value="0"/>
</div>
</form>
<xsl:choose>
@@ -334,6 +343,7 @@
<div id="lightbox-placeholder"
style="background-color:#000000;color:#FFFFFF;display:none">
<div class="hd" style="background-color:#000000;color:#000000;
border:0; text-align:center"> <xsl:value-of select="php:function('lang',
'fileuploader')" /> </div>
<div class="bd" style="text-align:center;"> </div>
+
</div>
</xsl:template>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [6650] merge 6639:6649 from trunk,
Sigurd Nes <=