2005-02-03 17:42:20 +01:00
|
|
|
|
<?php
|
|
|
|
|
/**************************************************************************\
|
|
|
|
|
* eGroupWare - resources - Resource Management System *
|
|
|
|
|
* http://www.egroupware.org *
|
2005-03-02 09:50:39 +01:00
|
|
|
|
* Written by Lukas Weiss <wnz_gh05t@users.sourceforge.net> and *
|
|
|
|
|
* Cornelius Weiss <egw@von-und-zu-weiss.de> *
|
2005-02-03 17:42:20 +01:00
|
|
|
|
* ----------------------------------------------- *
|
|
|
|
|
* 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. *
|
|
|
|
|
\**************************************************************************/
|
|
|
|
|
|
2005-02-09 15:41:43 +01:00
|
|
|
|
/* $Id$ */
|
|
|
|
|
|
2005-02-03 17:42:20 +01:00
|
|
|
|
class ui_resources
|
|
|
|
|
{
|
|
|
|
|
var $public_functions = array(
|
|
|
|
|
'index' => True,
|
|
|
|
|
'edit' => True,
|
2005-03-01 11:20:03 +01:00
|
|
|
|
'show' => True,
|
2005-06-11 16:58:07 +02:00
|
|
|
|
'select' => True,
|
2005-03-01 11:20:03 +01:00
|
|
|
|
'admin' => True,
|
2005-02-03 17:42:20 +01:00
|
|
|
|
'writeLangFile' => True
|
|
|
|
|
);
|
|
|
|
|
|
2005-06-10 22:40:57 +02:00
|
|
|
|
/**
|
|
|
|
|
* constructor of class ui_resources
|
|
|
|
|
*
|
|
|
|
|
*/
|
2005-02-03 17:42:20 +01:00
|
|
|
|
function ui_resources()
|
|
|
|
|
{
|
2005-06-10 22:40:57 +02:00
|
|
|
|
// print_r($GLOBALS['egw_info']); die();
|
|
|
|
|
$this->tmpl =& CreateObject('etemplate.etemplate','resources.show');
|
|
|
|
|
$this->bo =& CreateObject('resources.bo_resources');
|
2005-02-03 17:42:20 +01:00
|
|
|
|
|
2005-06-10 22:40:57 +02:00
|
|
|
|
if(!@is_object($GLOBALS['egw']->js))
|
2005-02-03 17:42:20 +01:00
|
|
|
|
{
|
2005-06-10 22:40:57 +02:00
|
|
|
|
$GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript');
|
2005-02-03 17:42:20 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-06-10 22:40:57 +02:00
|
|
|
|
/**
|
|
|
|
|
* main resources list.
|
|
|
|
|
*
|
|
|
|
|
* Cornelius Wei<EFBFBD> <egw@von-und-zu-weiss.de>
|
|
|
|
|
* @param array $content content from eTemplate callback
|
|
|
|
|
*
|
|
|
|
|
* FIXME don't translate cats in nextmach
|
|
|
|
|
*/
|
2005-02-03 17:42:20 +01:00
|
|
|
|
function index($content='')
|
|
|
|
|
{
|
|
|
|
|
if (is_array($content))
|
|
|
|
|
{
|
2005-03-02 09:35:10 +01:00
|
|
|
|
$sessiondata = $content['nm'];
|
|
|
|
|
|
2005-02-03 17:42:20 +01:00
|
|
|
|
if (isset($content['nm']['rows']))
|
|
|
|
|
{
|
2005-03-02 09:35:10 +01:00
|
|
|
|
unset($sessiondata['rows']);
|
2005-06-10 22:40:57 +02:00
|
|
|
|
$GLOBALS['egw']->session->appsession('session_data','resources_index_nm',$sessiondata);
|
2005-03-02 09:35:10 +01:00
|
|
|
|
|
2005-02-28 16:19:31 +01:00
|
|
|
|
unset($content['nm']['rows']['checkbox']);
|
|
|
|
|
switch (key($content['nm']['rows']))
|
2005-02-03 17:42:20 +01:00
|
|
|
|
{
|
2005-03-02 09:35:10 +01:00
|
|
|
|
case 'edit': // note: this is a popup dialog now
|
2005-02-28 16:19:31 +01:00
|
|
|
|
list($id) = each($content['nm']['rows']['edit']);
|
|
|
|
|
return $this->edit($id);
|
|
|
|
|
case 'delete':
|
|
|
|
|
list($id) = each($content['nm']['rows']['delete']);
|
|
|
|
|
return $this->delete($id);
|
2005-03-02 09:35:10 +01:00
|
|
|
|
case 'new_acc': // note: this is a popup dialog now
|
2005-02-28 16:19:31 +01:00
|
|
|
|
list($id) = each($content['nm']['rows']['new_acc']);
|
2005-03-02 09:35:10 +01:00
|
|
|
|
return $this->edit($id = 0, $accessory_of = $id);
|
2005-02-28 16:19:31 +01:00
|
|
|
|
case 'view_acc':
|
|
|
|
|
list($id) = each($content['nm']['rows']['view_acc']);
|
2005-03-02 09:35:10 +01:00
|
|
|
|
$sessiondata['view_accs_of'] = $id;
|
2005-06-10 22:40:57 +02:00
|
|
|
|
$GLOBALS['egw']->session->appsession('session_data','resources_index_nm',$sessiondata);
|
2005-03-02 09:35:10 +01:00
|
|
|
|
return $this->index();
|
2005-02-28 16:19:31 +01:00
|
|
|
|
case 'view':
|
2005-03-21 10:52:53 +01:00
|
|
|
|
list($id) = each($content['nm']['rows']['view']);
|
|
|
|
|
return $this->show($id);
|
2005-06-11 16:58:07 +02:00
|
|
|
|
case 'select': // note: this is a popup dialog
|
|
|
|
|
return $this->select();
|
2005-02-28 16:19:31 +01:00
|
|
|
|
case 'bookable':
|
|
|
|
|
case 'buyable':
|
2005-02-03 17:42:20 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
2005-03-02 09:35:10 +01:00
|
|
|
|
if (isset($content['add'])) // note: this isn't used as add is a popup now!
|
2005-02-03 17:42:20 +01:00
|
|
|
|
{
|
2005-06-10 22:40:57 +02:00
|
|
|
|
$GLOBALS['egw']->session->appsession('session_data','resources_index_nm',$sessiondata);
|
2005-03-02 09:35:10 +01:00
|
|
|
|
return $content['nm']['view_accs_of'] ? $this->edit(array('id' => 0, 'accessory_of' => $content['nm']['view_accs_of'])) : $this->edit(0);
|
2005-02-03 17:42:20 +01:00
|
|
|
|
}
|
2005-02-28 16:19:31 +01:00
|
|
|
|
if (isset($content['back']))
|
|
|
|
|
{
|
2005-03-02 09:35:10 +01:00
|
|
|
|
unset($sessiondata['view_accs_of']);
|
2005-06-10 22:40:57 +02:00
|
|
|
|
$GLOBALS['egw']->session->appsession('session_data','resources_index_nm',$sessiondata);
|
2005-02-28 16:19:31 +01:00
|
|
|
|
return $this->index();
|
|
|
|
|
}
|
2005-03-02 09:35:10 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$content = array();
|
2005-06-10 22:40:57 +02:00
|
|
|
|
$content['nm'] = $GLOBALS['egw']->session->appsession('session_data','resources_index_nm');
|
2005-02-03 17:42:20 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$content['nm']['get_rows'] = 'resources.bo_resources.get_rows';
|
|
|
|
|
$content['nm']['no_filter'] = False;
|
2005-02-15 17:26:21 +01:00
|
|
|
|
$content['nm']['filter_label'] = 'Category';
|
2005-02-21 16:56:21 +01:00
|
|
|
|
$content['nm']['filter_help'] = lang('Select a category'); // is this used???
|
2005-06-10 22:40:57 +02:00
|
|
|
|
$content['nm']['options-filter']= array('0'=>lang('all categories'))+(array)$this->bo->acl->get_cats(EGW_ACL_READ);
|
2005-02-21 16:56:21 +01:00
|
|
|
|
$content['nm']['no_filter2'] = true;
|
|
|
|
|
$content['nm']['filter_no_lang'] = true;
|
|
|
|
|
$content['nm']['no_cat'] = true;
|
2005-02-03 17:42:20 +01:00
|
|
|
|
|
|
|
|
|
// check if user is permitted to add resources
|
2005-06-10 22:40:57 +02:00
|
|
|
|
if(!$this->bo->acl->get_cats(EGW_ACL_ADD))
|
2005-02-03 17:42:20 +01:00
|
|
|
|
{
|
|
|
|
|
$no_button['add'] = true;
|
|
|
|
|
}
|
2005-02-28 16:19:31 +01:00
|
|
|
|
$no_button['back'] = true;
|
2005-03-02 09:35:10 +01:00
|
|
|
|
$no_button['add_sub'] = true;
|
2005-06-10 22:40:57 +02:00
|
|
|
|
$GLOBALS['egw_info']['flags']['app_header'] = lang('resources');
|
2005-02-03 17:42:20 +01:00
|
|
|
|
|
2005-03-02 09:35:10 +01:00
|
|
|
|
if($content['nm']['view_accs_of'])
|
2005-02-28 16:19:31 +01:00
|
|
|
|
{
|
2005-03-02 09:35:10 +01:00
|
|
|
|
$master = $this->bo->so->read($content['nm']['view_accs_of']);
|
|
|
|
|
$content['view_accs_of'] = $content['nm']['view_accs_of'];
|
2005-02-28 16:19:31 +01:00
|
|
|
|
$content['nm']['get_rows'] = 'resources.bo_resources.get_rows';
|
|
|
|
|
$content['nm']['no_filter'] = true;
|
|
|
|
|
$content['nm']['no_filter2'] = true;
|
|
|
|
|
$no_button['back'] = false;
|
2005-03-02 09:35:10 +01:00
|
|
|
|
$no_button['add'] = true;
|
|
|
|
|
$no_button['add_sub'] = false;
|
2005-06-10 22:40:57 +02:00
|
|
|
|
$GLOBALS['egw_info']['flags']['app_header'] = lang('resources') . ' - ' . lang('accessories of ') . $master['name'] .
|
2005-03-02 09:35:10 +01:00
|
|
|
|
($master['short_description'] ? ' [' . $master['short_description'] . ']' : '');
|
2005-02-28 16:19:31 +01:00
|
|
|
|
}
|
2005-03-01 11:20:03 +01:00
|
|
|
|
$preserv = $content;
|
2005-06-10 22:40:57 +02:00
|
|
|
|
$GLOBALS['egw']->session->appsession('session_data','resources_index_nm',$content['nm']);
|
2005-03-01 11:58:04 +01:00
|
|
|
|
$this->tmpl->read('resources.show');
|
2005-02-03 17:42:20 +01:00
|
|
|
|
$this->tmpl->exec('resources.ui_resources.index',$content,$sel_options,$no_button,$preserv);
|
|
|
|
|
}
|
|
|
|
|
|
2005-06-10 22:40:57 +02:00
|
|
|
|
/**
|
|
|
|
|
* @author Cornelius Wei<EFBFBD> <egw@von-und-zu-weiss.de>
|
|
|
|
|
* invokes add or edit dialog for resources
|
|
|
|
|
*
|
|
|
|
|
* @param $content Content from the eTemplate Exec call or id on inital call
|
|
|
|
|
*/
|
2005-03-02 09:35:10 +01:00
|
|
|
|
function edit($content=0,$accessory_of = -1)
|
2005-02-03 17:42:20 +01:00
|
|
|
|
{
|
|
|
|
|
if (is_array($content))
|
|
|
|
|
{
|
2005-02-24 19:24:26 +01:00
|
|
|
|
if(isset($content['save']) || isset($content['delete']))
|
2005-02-03 17:42:20 +01:00
|
|
|
|
{
|
2005-02-24 19:24:26 +01:00
|
|
|
|
if(isset($content['save']))
|
2005-02-12 09:25:26 +01:00
|
|
|
|
{
|
2005-02-24 19:24:26 +01:00
|
|
|
|
unset($content['save']);
|
|
|
|
|
if($content['id'] != 0)
|
|
|
|
|
{
|
|
|
|
|
// links are already saved by eTemplate
|
|
|
|
|
unset($resource['link_to']['to_id']);
|
|
|
|
|
}
|
|
|
|
|
$content['msg'] = $this->bo->save($content);
|
2005-02-12 09:25:26 +01:00
|
|
|
|
}
|
2005-02-24 19:24:26 +01:00
|
|
|
|
if(isset($content['delete']))
|
2005-02-03 17:42:20 +01:00
|
|
|
|
{
|
2005-02-24 19:24:26 +01:00
|
|
|
|
unset($content['delete']);
|
|
|
|
|
$content['msg'] = $this->delete($content['id']);
|
2005-02-03 17:42:20 +01:00
|
|
|
|
}
|
2005-03-02 09:35:10 +01:00
|
|
|
|
|
|
|
|
|
if($content['msg'])
|
|
|
|
|
{
|
|
|
|
|
return $this->edit($content);
|
|
|
|
|
}
|
2005-06-10 22:40:57 +02:00
|
|
|
|
$js = "opener.location.href='".$GLOBALS['egw']->link('/index.php',
|
2005-03-02 09:35:10 +01:00
|
|
|
|
array('menuaction' => 'resources.ui_resources.index'))."';";
|
|
|
|
|
$js .= 'window.close();';
|
|
|
|
|
echo "<html><body><script>$js</script></body></html>\n";
|
2005-06-10 22:40:57 +02:00
|
|
|
|
$GLOBALS['egw']->common->egw_exit();
|
2005-02-24 19:24:26 +01:00
|
|
|
|
}
|
|
|
|
|
elseif($content['cancel'])
|
|
|
|
|
{
|
2005-03-02 09:35:10 +01:00
|
|
|
|
$js .= 'window.close();';
|
|
|
|
|
echo "<html><body><script>$js</script></body></html>\n";
|
2005-06-10 22:40:57 +02:00
|
|
|
|
$GLOBALS['egw']->common->egw_exit();
|
2005-02-03 17:42:20 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
2005-02-09 15:41:43 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
2005-03-01 11:20:03 +01:00
|
|
|
|
$id = $content;
|
2005-03-02 09:35:10 +01:00
|
|
|
|
if (isset($_GET['id'])) $id = $_GET['id'];
|
|
|
|
|
if (isset($_GET['accessory_of'])) $accessory_of = $_GET['accessory_of'];
|
2005-03-01 11:20:03 +01:00
|
|
|
|
$content = array('id' => $id);
|
2005-02-24 19:24:26 +01:00
|
|
|
|
|
2005-03-01 11:20:03 +01:00
|
|
|
|
if ($id > 0)
|
2005-02-24 19:24:26 +01:00
|
|
|
|
{
|
2005-03-01 11:20:03 +01:00
|
|
|
|
$content = $this->bo->read($id);
|
2005-02-24 19:24:26 +01:00
|
|
|
|
$content['gen_src_list'] = strstr($content['picture_src'],'.') ? $content['picture_src'] : false;
|
|
|
|
|
$content['picture_src'] = strstr($content['picture_src'],'.') ? 'gen_src' : $content['picture_src'];
|
|
|
|
|
$content['link_to'] = array(
|
2005-03-01 11:20:03 +01:00
|
|
|
|
'to_id' => $id,
|
2005-02-24 19:24:26 +01:00
|
|
|
|
'to_app' => 'resources'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2005-02-25 12:15:27 +01:00
|
|
|
|
}
|
2005-02-28 16:19:31 +01:00
|
|
|
|
// some presetes
|
2005-03-01 11:20:03 +01:00
|
|
|
|
$content['resource_picture'] = $this->bo->get_picture($content['id'],$content['picture_src'],$size=true);
|
2005-02-28 16:19:31 +01:00
|
|
|
|
$content['quantity'] = $content['quantity'] ? $content['quantity'] : 1;
|
|
|
|
|
$content['useable'] = $content['useable'] ? $content['useable'] : 1;
|
|
|
|
|
|
2005-03-02 09:35:10 +01:00
|
|
|
|
$sel_options['gen_src_list'] = $this->bo->get_genpicturelist();
|
2005-06-10 22:40:57 +02:00
|
|
|
|
$sel_options['cat_id'] = $this->bo->acl->get_cats(EGW_ACL_ADD);
|
2005-02-25 12:15:27 +01:00
|
|
|
|
$sel_options['cat_id'] = count($sel_options['cat_id']) == 1 ? $sel_options['cat_id'] : array('' => lang('select one')) + $sel_options['cat_id'];
|
2005-03-02 09:35:10 +01:00
|
|
|
|
|
|
|
|
|
if($accessory_of > 0 || $content['accessory_of'] > 0)
|
2005-02-28 16:19:31 +01:00
|
|
|
|
{
|
2005-03-02 09:35:10 +01:00
|
|
|
|
$content['accessory_of'] = $content['accessory_of'] ? $content['accessory_of'] : $accessory_of;
|
2005-02-28 16:19:31 +01:00
|
|
|
|
$catofmaster = $this->bo->so->get_value('cat_id',$content['accessory_of']);
|
|
|
|
|
$sel_options['cat_id'] = array($catofmaster => $sel_options['cat_id'][$catofmaster]);
|
|
|
|
|
}
|
|
|
|
|
|
2005-05-24 17:40:14 +02:00
|
|
|
|
$content['general|page|pictures|links|calendar'] = 'resources.edit_tabs.page'; //debug
|
2005-02-24 19:24:26 +01:00
|
|
|
|
$no_button = array(); // TODO: show delete button only if allowed to delete resource
|
|
|
|
|
$preserv = $content;
|
2005-02-03 17:42:20 +01:00
|
|
|
|
$this->tmpl->read('resources.edit');
|
2005-03-02 09:35:10 +01:00
|
|
|
|
$this->tmpl->exec('resources.ui_resources.edit',$content,$sel_options,$no_button,$preserv,2);
|
2005-02-03 17:42:20 +01:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2005-06-10 22:40:57 +02:00
|
|
|
|
/**
|
|
|
|
|
* adminsection of resources
|
|
|
|
|
*
|
|
|
|
|
* @author Cornelius Wei<EFBFBD> <egw@von-und-zu-weiss.de>
|
|
|
|
|
*/
|
2005-03-01 11:58:04 +01:00
|
|
|
|
function admin($content='')
|
|
|
|
|
{
|
|
|
|
|
if(is_array($content))
|
|
|
|
|
{
|
|
|
|
|
if(isset($content['save']))
|
|
|
|
|
{
|
|
|
|
|
$this->bo->conf->read_repository();
|
|
|
|
|
$this->bo->conf->save_value('dont_use_vfs',$content['dont_use_vfs']);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2005-06-10 22:40:57 +02:00
|
|
|
|
return $GLOBALS['egw']->redirect_link('/admin/index.php');
|
2005-03-01 11:58:04 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$content = $this->bo->conf->read_repository();
|
|
|
|
|
$this->tmpl->read('resources.admin');
|
|
|
|
|
$this->tmpl->exec('resources.ui_resources.admin',$content,$sel_options,$no_button,$preserv);
|
|
|
|
|
}
|
|
|
|
|
|
2005-06-10 22:40:57 +02:00
|
|
|
|
/**
|
|
|
|
|
* showes a single resource
|
|
|
|
|
*
|
|
|
|
|
* @param int $id resource id
|
|
|
|
|
* @author Lukas Weiss <wnz.gh05t@users.sourceforge.net>
|
|
|
|
|
*/
|
2005-03-21 10:52:53 +01:00
|
|
|
|
function show($id=0)
|
2005-02-03 17:42:20 +01:00
|
|
|
|
{
|
2005-03-21 10:52:53 +01:00
|
|
|
|
if (isset($_GET['id'])) $id = $_GET['id'];
|
|
|
|
|
|
|
|
|
|
$content = array('id' => $id);
|
|
|
|
|
$content = $this->bo->read($id);
|
|
|
|
|
$content['gen_src_list'] = strstr($content['picture_src'],'.') ? $content['picture_src'] : false;
|
|
|
|
|
$content['picture_src'] = strstr($content['picture_src'],'.') ? 'gen_src' : $content['picture_src'];
|
|
|
|
|
$content['link_to'] = array(
|
2005-06-10 22:40:57 +02:00
|
|
|
|
'to_id' => $id,
|
|
|
|
|
'to_app' => 'resources'
|
|
|
|
|
);
|
2005-02-03 17:42:20 +01:00
|
|
|
|
|
2005-03-21 10:52:53 +01:00
|
|
|
|
$content['resource_picture'] = $this->bo->get_picture($content['id'],$content['picture_src'],$size=true);
|
|
|
|
|
$content['quantity'] = $content['quantity'] ? $content['quantity'] : 1;
|
|
|
|
|
$content['useable'] = $content['useable'] ? $content['useable'] : 1;
|
|
|
|
|
|
|
|
|
|
$content['quantity'] = ($content['useable'] == $content['quantity']) ? $content['quantity'] : $content['quantity'].' ('.lang('useable ').$content['useable'].')';
|
|
|
|
|
|
2005-06-10 22:40:57 +02:00
|
|
|
|
//$sel_options['gen_src_list'] = $this->bo->get_genpicturelist();
|
|
|
|
|
|
2005-03-21 10:52:53 +01:00
|
|
|
|
$content['cat_name'] = $this->bo->acl->get_cat_name($content['cat_id']);
|
|
|
|
|
$content['cat_admin'] = $this->bo->acl->get_cat_admin($content['cat_id']);
|
|
|
|
|
|
|
|
|
|
/* if($content['accessory_of'] > 0)
|
|
|
|
|
{
|
|
|
|
|
$catofmaster = $this->bo->so->get_value('cat_id',$content['accessory_of']);
|
|
|
|
|
$sel_options['cat_id'] = array($catofmaster => $sel_options['cat_id'][$catofmaster]);
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
$content['description'] = $content['long_description'] ? $content['long_description'] : $content['short_description'];
|
|
|
|
|
$content['description'] = $content['description'] ? $content['description'] : lang('no description available');
|
|
|
|
|
$sel_options = array();
|
|
|
|
|
$no_button = array();
|
|
|
|
|
$preserv = $content;
|
|
|
|
|
//print_r($content);
|
|
|
|
|
$this->tmpl->read('resources.showdetails');
|
|
|
|
|
$this->tmpl->exec('resources.ui_resources.show',$content,$sel_options,$no_button,$preserv,2);
|
|
|
|
|
|
2005-02-03 17:42:20 +01:00
|
|
|
|
}
|
|
|
|
|
|
2005-06-11 16:58:07 +02:00
|
|
|
|
/**
|
|
|
|
|
* select resources
|
|
|
|
|
*
|
|
|
|
|
* @author Lukas Weiss <wnz.gh05t@users.sourceforge.net>
|
|
|
|
|
*/
|
|
|
|
|
function select()
|
|
|
|
|
{
|
|
|
|
|
if (isset($_GET['name'])) $name = $_GET['name'];
|
2005-06-11 17:03:32 +02:00
|
|
|
|
$content=array('js_id' => $name);
|
2005-06-11 16:58:07 +02:00
|
|
|
|
$content['js'] = "<script LANGUAGE=\"JavaScript\">
|
|
|
|
|
window.focus();
|
|
|
|
|
|
|
|
|
|
function addOption(id,label,value,multiple)
|
|
|
|
|
{
|
|
|
|
|
openerSelectBox = opener.document.getElementById(id);
|
|
|
|
|
|
|
|
|
|
if (multiple && openerSelectBox) {
|
|
|
|
|
select = '';
|
|
|
|
|
for(i=0; i < openerSelectBox.length; i++) {
|
|
|
|
|
with (openerSelectBox.options[i]) {
|
|
|
|
|
if (selected || openerSelectBox.selectedIndex == i) {
|
|
|
|
|
select += (value.slice(0,1)==',' ? '' : ',')+value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
select += (select ? ',' : '')+value;
|
|
|
|
|
opener.addOption(id,label,value,0);
|
|
|
|
|
opener.addOption(id,'multiple*',select,0);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
opener.addOption(id,label,value,!multiple && openerSelectBox && openerSelectBox.selectedIndex < 0);
|
|
|
|
|
}
|
|
|
|
|
selectBox = document.getElementById('uiaccountsel_popup_selection');
|
|
|
|
|
if (selectBox) {
|
|
|
|
|
for (i=0; i < selectBox.length; i++) {
|
|
|
|
|
if (selectBox.options[i].value == value) {
|
|
|
|
|
selectBox.options[i].selected = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (i >= selectBox.length) {
|
|
|
|
|
selectBox.options[selectBox.length] = new Option(label,value,false,true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function removeSelectedOptions(id)
|
|
|
|
|
{
|
|
|
|
|
openerSelectBox = opener.document.getElementById(id);
|
|
|
|
|
if (openerSelectBox == null) window.close();
|
|
|
|
|
selectBox = document.getElementById('uiaccountsel_popup_selection');
|
|
|
|
|
for (i=0; i < selectBox.length; i++) {
|
|
|
|
|
if (selectBox.options[i].selected) {
|
|
|
|
|
for (j=0; j < openerSelectBox.length; j++) {
|
|
|
|
|
if (openerSelectBox[j].value == selectBox.options[i].value) {
|
|
|
|
|
openerSelectBox.removeChild(openerSelectBox[j]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
selectBox.options[i--] = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function copyOptions(id)
|
|
|
|
|
{
|
|
|
|
|
openerSelectBox = opener.document.getElementById(id);
|
|
|
|
|
selectBox = document.getElementById('uiaccountsel_popup_selection');
|
|
|
|
|
for (i=0; i < openerSelectBox.length; i++) {
|
|
|
|
|
with (openerSelectBox.options[i]) {
|
|
|
|
|
if (selected && value.slice(0,1) != ',') {
|
|
|
|
|
selectBox.options[selectBox.length] = new Option(text,value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function oneLineSubmit(id)
|
|
|
|
|
{
|
|
|
|
|
openerSelectBox = opener.document.getElementById(id);
|
|
|
|
|
|
|
|
|
|
if (openerSelectBox) {
|
|
|
|
|
if (openerSelectBox.selectedIndex >= 0) {
|
|
|
|
|
selected = openerSelectBox.options[openerSelectBox.selectedIndex].value;
|
|
|
|
|
if (selected.slice(0,1) == ',') selected = selected.slice(1);
|
|
|
|
|
opener.addOption(id,'multiple*',selected,1);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
for (i=0; i < openerSelectBox.length; i++) {
|
|
|
|
|
with (openerSelectBox.options[i]) {
|
|
|
|
|
if (selected) {
|
|
|
|
|
opener.addOption(id,text,value,1);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
window.close();
|
|
|
|
|
}
|
|
|
|
|
</script>";
|
|
|
|
|
$sel_options = array();
|
|
|
|
|
$no_button = array();
|
|
|
|
|
$preserv = $content;
|
|
|
|
|
$this->tmpl->read('resources.resource_select');
|
|
|
|
|
$this->tmpl->exec('resources.ui_resources.select',$content,$sel_options,$no_button,$preserv,2);
|
|
|
|
|
}
|
|
|
|
|
|
2005-06-10 22:40:57 +02:00
|
|
|
|
/**
|
|
|
|
|
* deletes a resource
|
|
|
|
|
*
|
|
|
|
|
* @param int $id resource id
|
|
|
|
|
* @author Lukas Weiss <wnz.gh05t@users.sourceforge.net>
|
|
|
|
|
*/
|
2005-02-03 17:42:20 +01:00
|
|
|
|
function delete($id)
|
|
|
|
|
{
|
|
|
|
|
$this->bo->delete($id);
|
2005-02-17 18:29:07 +01:00
|
|
|
|
return $this->index();
|
2005-02-03 17:42:20 +01:00
|
|
|
|
}
|
|
|
|
|
}
|