[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [6631] patched after savannah downtime:
From: |
Erik Holm-Larsen |
Subject: |
[Fmsystem-commits] [6631] patched after savannah downtime: |
Date: |
Thu, 02 Dec 2010 14:25:23 +0000 |
Revision: 6631
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6631
Author: erikhl
Date: 2010-12-02 14:25:23 +0000 (Thu, 02 Dec 2010)
Log Message:
-----------
patched after savannah downtime:
added possibility for uploading help-document
fixed mail-sending when delegating
Modified Paths:
--------------
trunk/frontend/inc/class.bofrontend.inc.php
trunk/frontend/inc/class.menu.inc.php
trunk/frontend/inc/class.uidelegates.inc.php
trunk/frontend/inc/class.uifrontend.inc.php
trunk/frontend/setup/phpgw_no.lang
Added Paths:
-----------
trunk/frontend/inc/class.uidocumentupload.inc.php
trunk/frontend/templates/base/documentupload.xsl
Modified: trunk/frontend/inc/class.bofrontend.inc.php
===================================================================
--- trunk/frontend/inc/class.bofrontend.inc.php 2010-12-02 14:23:51 UTC (rev
6630)
+++ trunk/frontend/inc/class.bofrontend.inc.php 2010-12-02 14:25:23 UTC (rev
6631)
@@ -276,7 +276,7 @@
if($result && $db->affected_rows() > 0)
{
- //Retrieve the usernames
+/* //Retrieve the usernames
$user_account =
$GLOBALS['phpgw']->accounts->get($account_id);
$owner_account =
$GLOBALS['phpgw']->accounts->get($owner_id);
$user_name =
$user_account->__get('lid');
@@ -301,8 +301,13 @@
}
}
}
+*/
return true;
}
+ else
+ {
+ return false;
+ }
}
return false;
}
Modified: trunk/frontend/inc/class.menu.inc.php
===================================================================
--- trunk/frontend/inc/class.menu.inc.php 2010-12-02 14:23:51 UTC (rev
6630)
+++ trunk/frontend/inc/class.menu.inc.php 2010-12-02 14:25:23 UTC (rev
6631)
@@ -25,6 +25,11 @@
(
'text' => lang('Configure
Access Permissions'),
'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'preferences.uiadmin_acl.list_acl', 'acl_app' => 'frontend') )
+ ),
+ 'documents' => array
+ (
+ 'text' =>
lang('upload_userdoc'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'frontend.uidocumentupload.index','appname' => 'frontend'))
)
);
}
Modified: trunk/frontend/inc/class.uidelegates.inc.php
===================================================================
--- trunk/frontend/inc/class.uidelegates.inc.php 2010-12-02 14:23:51 UTC
(rev 6630)
+++ trunk/frontend/inc/class.uidelegates.inc.php 2010-12-02 14:25:23 UTC
(rev 6631)
@@ -67,18 +67,66 @@
{
if($org_unit_id == 'all' ||
$org_unit['ORG_UNIT_ID'] == $org_unit_id)
{
+ //$curr_success = true;
$res =
$this->add_delegate($account_id,$org_unit['ORG_UNIT_ID'],$org_unit['ORG_NAME']);
- if(!$res)
+ if($res)
{
+ //$mail_contents[] =
$res;
+ $org_unit_names[] =
$org_unit['ORG_NAME'];
+ }
+ else
+ {
$msglog['error'][] =
array('msg' => lang('error_delegating_unit',$org_unit['ORG_NAME']));
}
- $success = $success && $res;
+
+ $success = $success && $res;
}
}
if($success)
{
- $msglog['message'][] = array('msg' =>
lang('delegation_successful'));
+ //Retrieve the usernames
+ $user_account =
$GLOBALS['phpgw']->accounts->get($account_id);
+ $owner_account =
$GLOBALS['phpgw']->accounts->get($GLOBALS['phpgw_info']['user']['account_id']);
+ $user_name =
$user_account->__get('lid');
+ $owner_name =
$owner_account->__get('lid');
+ $org_name_string = implode(',',
$org_unit_names);
+
+ //If the usernames are set retrieve
account data from Fellesdata
+ if(isset($user_name) && $user_name !=
'' && $owner_name && $owner_name != '')
+ {
+ $fellesdata_user =
frontend_bofellesdata::get_instance()->get_user($user_name);
+ $fellesdata_owner =
frontend_bofellesdata::get_instance()->get_user($owner_name);
+
+ if($fellesdata_user &&
$fellesdata_owner)
+ {
+ //Send email
notification to delegate
+ $email =
$fellesdata_user['email'];
+ if(isset($email) &&
$email != '')
+ {
+
+ $title =
lang('email_add_delegate_title');
+ $message =
lang('email_add_delegate_message',$fellesdata_user['firstname'],$fellesdata_user['lastname'],$fellesdata_owner['firstname'],$fellesdata_owner['lastname'],$org_name_string);
+
frontend_bofrontend::send_system_message($email,$title,$message);
+ }
+ }
+ }
+ $msglog['message'][] = array('msg' =>
lang('delegation_successful'));
+/*
+ //send e-mail to user
+ $user_account =
$GLOBALS['phpgw']->accounts->get($account_id);
+ $user_name =
$user_account->__get('lid');
+ $fellesdata_user =
frontend_bofellesdata::get_instance()->get_user($user_name);
+ if($fellesdata_user)
+ {
+ $email =
$fellesdata_user['email'];
+ if(isset($email) && $email !=
'')
+ {
+ $title =
lang('email_add_delegate_title');
+ $mail_content =
implode(',',$mail_contents);
+
frontend_bofrontend::send_system_message($email,$title,$mail_content);
+ }
+ }*/
}
else
{
Added: trunk/frontend/inc/class.uidocumentupload.inc.php
===================================================================
--- trunk/frontend/inc/class.uidocumentupload.inc.php
(rev 0)
+++ trunk/frontend/inc/class.uidocumentupload.inc.php 2010-12-02 14:25:23 UTC
(rev 6631)
@@ -0,0 +1,315 @@
+<?php
+phpgw::import_class('frontend.uifrontend');
+
+class frontend_uidocumentupload extends frontend_uifrontend
+{
+ public static $ROOT_FOR_DOCUMENTS = '/frontend';
+ public static $HELP_DOCUMENTS = '/help';
+ public static $LANG_DIR = '/NO';
+
+ protected static $so;
+ protected $document_types; // Used for caching the values
+
+ public $public_functions = array(
+ 'index' => true,
+ 'read_helpfile_from_vfs' => true
+ );
+
+ public function __construct()
+ {
+ //parent::__construct();
+ // This module uses XSLT templates
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
+ $GLOBALS['phpgw_info']['flags']['menu_selection'] =
"admin::frontend::documents";
+ }
+
+ public function index()
+ {
+ if(isset($_POST['file_upload'])){
+ //$filename = phpgw::get_var('help_filename');
+ $test2 = "testing litt";
+ if ($_FILES["file"]["error"] > 0)
+ {
+ //error
+ }
+ else
+ {
+ $filename = $_FILES["help_filename"]["name"];
+ $stored_in =
$_FILES["help_filename"]["tmp_name"];
+ $success =
$this->store_doc_to_vfs($_FILES["help_filename"]);
+ }
+ }
+
+ $form_action =
$GLOBALS['phpgw']->link('/index.php',array('menuaction' =>
'frontend.uidocumentupload.index'));
+ $data = array (
+ 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($GLOBALS['phpgw']->common->msgbox_data($msgbox)),
+ 'documentupload_data' => array(
+ 'test' => $test2,
+ 'filename' => $filename,
+ 'storage' => $stored_in,
+ 'success' => $success,
+ 'file' => $_FILES["help_filename"],
+ 'form_action' => $form_action)
+ );
+ $GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('app_data' =>
$data));
+
$GLOBALS['phpgw']->xslttpl->add_file(array('frontend','documentupload'));
+ }
+
+ public function store_doc_to_vfs($file)
+ {
+ $root_directory = self::$ROOT_FOR_DOCUMENTS;
+ $type_directory = self::$HELP_DOCUMENTS;
+ $lang_directory = self::$LANG_DIR;
+
+ $vfs = CreateObject('phpgwapi.vfs');
+ $vfs->override_acl = 1;
+
+ $path = $root_directory;
+ $dir = array('string' => $path, RELATIVE_NONE);
+ if(!$vfs->file_exists($dir)){
+ if(!$vfs->mkdir($dir))
+ {
+ return;
+ }
+ }
+
+ $path .= $type_directory;
+ $dir = array('string' => $path, RELATIVE_NONE);
+ if(!$vfs->file_exists($dir)){
+ if(!$vfs->mkdir($dir))
+ {
+ return;
+ }
+ }
+
+ $path .= $lang_directory;
+ $dir = array('string' => $path, RELATIVE_NONE);
+ if(!$vfs->file_exists($dir)){
+ if(!$vfs->mkdir($dir))
+ {
+ return;
+ }
+ }
+
+ $file_path = $path."/{$file['name']}";
+ $result = $vfs->write
+ (
+ array
+ (
+ 'string' => $file_path,
+ RELATIVE_NONE,
+ 'content' =>
file_get_contents($file['tmp_name'])
+ )
+ );
+ if($result)
+ {
+ return "Stored in vfs";
+ }
+ return "something failed...";
+
+/*
+ if (file_exists("/u01/filer/bkb_data/frontend/upload/" .
$file['name']))
+ {
+ return $file["name"] . " already exists. ";
+ }
+ else
+ {
+
move_uploaded_file($file["tmp_name"],"/u01/filer/bkb_data/frontend/upload/" .
$file["name"]);
+ return "Stored in: " .
"/u01/filer/bkb_data/frontend/upload/" . $file["name"] . ' (temp: '.
$file['tmp_name']. ')';
+ }
+ //return "file stored";
+*/
+ }
+
+ public function get_id_field_name($extended_info = false)
+ {
+ if(!$extended_info)
+ {
+ $ret = 'document_id';
+ }
+ else
+ {
+ $ret = array
+ (
+ 'table' => 'rental_document',
// alias
+ 'field' => 'id',
+ 'translated' => 'document_id'
+ );
+ }
+ return $ret;
+ }
+
+ private function get_document_path(string $filename)
+ {
+ $root_directory = self::$ROOT_FOR_DOCUMENTS;
+ $type_directory = self::$HELP_DOCUMENTS;
+ $lang_directory = self::$LANG_DIR;
+
+ $vfs = CreateObject('phpgwapi.vfs');
+ $vfs->override_acl = 1;
+
+ $path = "{$root_directory}";
+ $dir = array('string' => $path, RELATIVE_NONE);
+ if(!$vfs->file_exists($dir)){
+ if(!$vfs->mkdir($dir))
+ {
+ return false;
+ }
+ }
+
+ $path .= "{$type_directory}";
+ $dir = array('string' => $path, RELATIVE_NONE);
+ if(!$vfs->file_exists($dir)){
+ if(!$vfs->mkdir($dir))
+ {
+ return false;
+ }
+ }
+
+ $path .= "{$lang_directory}";
+ $dir = array('string' => $path, RELATIVE_NONE);
+ if(!$vfs->file_exists($dir)){
+ if(!$vfs->mkdir($dir))
+ {
+ return false;
+ }
+ }
+
+ $path .= "/{$filename}";
+ $dir = array('string' => $path, RELATIVE_NONE);
+ if(!$vfs->file_exists($dir)){
+ if(!$vfs->mkdir($dir))
+ {
+ return false;
+ }
+ }
+
+ return
"{$root_directory}{$type_directory}{$lang_directory}/{$filename}";
+ }
+
+ public function write_document_to_vfs(string $filename)
+ {
+
+ $path = $this->get_document_path($filename);
+
+ if(!$path)
+ {
+ return false;
+ }
+
+ $vfs = CreateObject('phpgwapi.vfs');
+ $vfs->override_acl = 1;
+
+ $file = array('string' => $path, RELATIVE_NONE);
+
+ return $vfs->write
+ (
+ array
+ (
+ 'string' => $path,
+ RELATIVE_NONE,
+ 'content' => file_get_contents($filename)
+ )
+ );
+ }
+
+ public function read_document_from_vfs(string $filename)
+ {
+ if(!isset($filename))
+ {
+ $filename = 'helpdesk.index.pdf';
+ }
+ $path = $this->get_document_path($filename);
+
+ $vfs = CreateObject('phpgwapi.vfs');
+ $vfs->override_acl = 1;
+
+ $vfs->read
+ (
+ array
+ (
+ 'string' => $path,
+ RELATIVE_NONE
+ )
+ );
+ }
+
+ public function read_helpfile_from_vfs()
+ {
+
+ $GLOBALS['phpgw_info']['flags']['noheader'] = true;
+ $GLOBALS['phpgw_info']['flags']['nofooter'] = true;
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
+
+ $directory = "/frontend/help/NO";
+
+ $vfs = CreateObject('phpgwapi.vfs');
+ $vfs->override_acl = 1;
+
+ $ls_array = $vfs->ls(array(
+ 'string' => $directory,
+ 'relatives' => array(RELATIVE_NONE)
+ ));
+
+ //$file = isset($ls_array[0]['directory']['name']) ?
"{$ls_array[0]['directory']}/{$ls_array[0]['name']}" : '';
+ $file="{$ls_array[0]['directory']}/helpdesk.index.pdf";
+
+ $document = $vfs->read(array(
+ 'string' => $file,
+ 'relatives' => array(RELATIVE_NONE))
+ );
+
+ $vfs->override_acl = 0;
+
+ $mime_type = 'text/plain';
+ if ($ls_array[0]['mime_type'])
+ {
+ $mime_type = $ls_array[0]['mime_type'];
+ }
+
+ $browser = CreateObject('phpgwapi.browser');
+
$browser->content_header($ls_array[0]['name'],$ls_array[0]['mime_type'],$ls_array[0]['size']);
+ echo $document;
+
+/* $vfs = CreateObject('phpgwapi.vfs');
+ $vfs->override_acl = 1;
+ $filename = 'helpdesk.index.pdf';
+
+ $path = $this->get_document_path($filename);
+ //$pdffile = PHPGW_SERVER_ROOT .
"/{$app}/help/{$lang}/{$section}.pdf";
+ //$full_filename = "/opt/portico/pe". $path;
+ $document = $vfs->read
+ (
+ array
+ (
+ 'string' => $path,
+ RELATIVE_NONE
+ )
+ );
+
+
+ $browser = CreateObject('phpgwapi.browser');
+ $browser->content_header($filename, '', filesize($document));
+ ob_clean();
+ flush();
+ readfile($document);
+*/
+ }
+
+ public function delete_document_from_vfs(string $filename)
+ {
+ $path = $this->get_document_path($filename);
+
+ $vfs = CreateObject('phpgwapi.vfs');
+ $vfs->override_acl = 1;
+
+ return $vfs->rm
+ (
+ array
+ (
+ 'string' => $path,
+ RELATIVE_NONE
+ )
+ );
+ }
+}
Modified: trunk/frontend/inc/class.uifrontend.inc.php
===================================================================
--- trunk/frontend/inc/class.uifrontend.inc.php 2010-12-02 14:23:51 UTC (rev
6630)
+++ trunk/frontend/inc/class.uifrontend.inc.php 2010-12-02 14:25:23 UTC (rev
6631)
@@ -281,15 +281,36 @@
function insert_links_on_header_state()
{
+ $help_url = "";
+ //check if help-document exists in VFS. If not, use
manual.
+ $help_in_vfs = true;
+ $fileName = '/frontend/help/NO/helpdesk.index.pdf';
+ $vfs = CreateObject('phpgwapi.vfs');
+ $vfs->override_acl = 1;
+
+ $file = array('string' => $fileName, RELATIVE_NONE);
+ if($vfs->file_exists($file)){
+ $help_in_vfs = true;
+ }
- $help_url = "javascript:openwindow('"
+ if($help_in_vfs)
+ {
+ $help_url = "javascript:openwindow('"
.
$GLOBALS['phpgw']->link('/index.php', array
(
+ 'menuaction'=>
'frontend.uidocumentupload.read_helpfile_from_vfs',
+ 'app' => 'frontend'
+ )) . "','700','600')";
+ }else{
+ $help_url = "javascript:openwindow('"
+ .
$GLOBALS['phpgw']->link('/index.php', array
+ (
'menuaction'=>
'manual.uimanual.help',
'app' =>
$GLOBALS['phpgw_info']['flags']['currentapp'],
'section' =>
isset($GLOBALS['phpgw_info']['apps']['manual']['section']) ?
$GLOBALS['phpgw_info']['apps']['manual']['section'] : '',
'referer' =>
phpgw::get_var('menuaction')
)) . "','700','600')";
+ }
$contact_url = "javascript:openwindow('"
. $GLOBALS['phpgw']->link('/index.php', array
Modified: trunk/frontend/setup/phpgw_no.lang
===================================================================
--- trunk/frontend/setup/phpgw_no.lang 2010-12-02 14:23:51 UTC (rev 6630)
+++ trunk/frontend/setup/phpgw_no.lang 2010-12-02 14:25:23 UTC (rev 6631)
@@ -126,4 +126,5 @@
searching_for_self frontend no Vennligst søk etter et annet
brukernavn enn ditt eget
remove_delegate_successful frontend no Delegaten ble fjernet
remove_delegate_error frontend no Fjerning av delegaten var
mislykket
-message_empty frontend no Meldingen kan ikke være tom
\ No newline at end of file
+message_empty frontend no Meldingen kan ikke være tom
+upload_userdoc frontend no Last opp brukerveiledning
\ No newline at end of file
Added: trunk/frontend/templates/base/documentupload.xsl
===================================================================
--- trunk/frontend/templates/base/documentupload.xsl
(rev 0)
+++ trunk/frontend/templates/base/documentupload.xsl 2010-12-02 14:25:23 UTC
(rev 6631)
@@ -0,0 +1,20 @@
+<xsl:template match="documentupload_data" xmlns:php="http://php.net/xsl">
+ <div class="yui-navset" id="ticket_tabview">
+ <xsl:value-of disable-output-escaping="yes" select="tabs" />
+ <div class="yui-content">
+ <h3>Vi skal laste opp greier!</h3>
+ <img
src="frontend/templates/base/images/32x32/page_white.png"
class="list_image"/><br/>
+ file: <xsl:value-of select="file"/><br/>
+ test: <xsl:value-of select="test"/><br/>
+ fn: <xsl:value-of select="filename"/><br/>
+ stored: <xsl:value-of select="storage"/><br/>
+ success: <xsl:value-of select="success"/><br/>
+ <form ENCTYPE="multipart/form-data" name="uploadform"
method="post" action="{form_action}">
+ <dl>
+ <dt><input type="file" name="help_filename"
id="help_filename"/></dt>
+ <dt><input type="submit" value="Last opp"
name="file_upload"/></dt>
+ </dl>
+ </form>
+ </div>
+ </div>
+</xsl:template>
\ No newline at end of file
Property changes on: trunk/frontend/templates/base/documentupload.xsl
___________________________________________________________________
Added: svn:mime-type
+ text/plain
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [6631] patched after savannah downtime:,
Erik Holm-Larsen <=