*** empty log message ***

This commit is contained in:
sebastian 2005-02-14 16:23:55 +00:00
parent 7391795ac5
commit b74cb6e047
13 changed files with 224 additions and 145 deletions

View File

@ -23,7 +23,7 @@
Author : $Author: sebastian $
Version : $Revision: 1.8 $
Version : $Revision: 1.9 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/htmlUI/var/Attic/conf.php,v $
------------------------------------------------------------------------------*/
@ -124,5 +124,5 @@ define('UI_SEARCH_MAX_ROWS', 8);
define('UI_SEARCH_MIN_ROWS', 2);
define('UI_REGEX_URL', '/^(ht|f)tps?:\/\/[^ ]+$/');
define('UI_SCRATCHPAD_KEY', 'djBagContents');
define('UI_SCRATCHPAD_REGEX', '/^([0-9a-f]{16}:[0-9]{4}-[0-9]{2}-[0-9]{2}( )?)+$/');
#define('UI_SCRATCHPAD_REGEX', '/^[0-9a-f]{16}:[0-9]{4}-[0-9]{2}-[0-9]{2}$/');
?>

View File

@ -1,10 +1,10 @@
<div id="menu_top">
<a href="{$UI_BROWSER}" class="button">[Home directory]</a>
<a href="{$UI_BROWSER}?id={$GLOBALS.id}&act=newfile" class="button">[UploadM]</a>
<a href="{$UI_BROWSER}?id={$GLOBALS.id}&act=upload_1" class="button">[Upload]</a>
<a href="{$UI_BROWSER}?id={$GLOBALS.id}&act=uploadFile" class="button">[Upload]</a>
<a href="javascript:newFolder()" class="button">[Create&nbsp;new&nbsp;folder]</a>
<a href="{$UI_BROWSER}?id={$GLOBALS.id}&act=search" class="button">[Search]</a>
<a href="{$UI_BROWSER}?id={$GLOBALS.id}&act=subjects" class="button">{tra 0='[Subjects]' 1=x}</a>
<a href="{$UI_BROWSER}?id={$GLOBALS.id}&act=subjects" class="button">{tra 0='[Subjects]'}</a>
<!-- <br>
<a href="{$UI_BROWSER}?act=MetaDataValues&Main=1" class="button">[Metadata]</a> -->
<a href="{$UI_BROWSER}?act=systemPrefs" class="button">[SystemPrefs]</a>

View File

@ -13,41 +13,38 @@
{foreach from=$structure.listdata item=o}
<tr bgcolor="{cycle values='#eeeeee, #dadada"'}">
<td>
{if $structure.tree}
{str_repeat str='&nbsp;' count=$o.level}<span id="ID{$o.id}">
{else}
{str_repeat str='&nbsp;' count=3} <span id="ID{$o.id}">
{/if}
<a {if $o.type eq 'Folder'}href="{$UI_BROWSER}?id={$o.id}" {/if}>[{$o.title}]</a>:&nbsp;&nbsp;
</span>
<span id="ID{$o.id}">
{if $structure.tree}
{str_repeat str='&nbsp;' count=$o.level}
{else}
{str_repeat str='&nbsp;' count=3}
{/if}
<a {if $o.type eq 'Folder'}href="{$UI_BROWSER}?id={$o.id}" {/if}>[{$o.title}]</a>:&nbsp;&nbsp;
</span>
</td>
<td>
{$a.$o.type}
&nbsp;<a href="javascript:frename('{$o.name}', '{$o.id}')" class="button">[rename]</a>
&nbsp;<a href="javascript:fmove('{$o.id}', '.')" class="button">[move]</a>
&nbsp;<a href="javascript:fcopy('{$o.id}', '.')" class="button">[copy]</a>
{*
&nbsp;<a href="javascript:freplicate('<?php echo$o['name']?>', '{$o.id}')" class="button">[replicate]</a>
*}
&nbsp;<a href="{$UI_BROWSER}?act=permissions&id={$o.id}" class="button">[permissions]</a>
&nbsp;<a href="javascript:frename('{$o.name}', '{$o.id}')">[rename]</a>
&nbsp;<a href="javascript:fmove('{$o.id}', '.')">[move]</a>
&nbsp;<a href="javascript:fcopy('{$o.id}', '.')">[copy]</a>
&nbsp;<a href="{$UI_BROWSER}?act=permissions&id={$o.id}">[permissions]</a>
<br>
&nbsp;
{if ($delOverride eq $o.id)}
<a href="{$UI_HANDLER}?act=delete&id={$o.id}&delOverride={$o.id}" class="button"
<a href="{$UI_HANDLER}?act=delete&id={$o.id}&delOverride={$o.id}"
onClick="return confirm('Really delete non empty object &quot;{$o.name}&quot; now?')">[DEL]</a>
{else}
<a href="{$UI_HANDLER}?act=delete&id={$o.id}" class="button"
<a href="{$UI_HANDLER}?act=delete&id={$o.id}"
onClick="return confirm('Delete object &quot;{$o.name}&quot;?')">[DEL]</a>
{/if}
{if $o.type != 'Folder'}
&nbsp;<a href="{$UI_BROWSER}?act=getFile&id={$o.id}" class="button">[Access]</a>
&nbsp;<a href="{$UI_BROWSER}?act=getInfo&id={$o.id}" class="button">[Analyze]</a>
&nbsp;<a href="{$UI_BROWSER}?act=editMetaDataValues&id={$o.id}" class="button">[MData]</a>
&nbsp;<a href="#" onclick="popup('{$UI_HANDLER}?act=add2SP&id={$o.id}', '2SP', 1, 1)" class="button">[SP]</a>
{/if}
{if $o.type eq 'Replica'}
&nbsp; (-&gt;$o.target})
&nbsp;<a href="{$UI_BROWSER}?act=getFile&id={$o.id}">[Access]</a>
&nbsp;<a href="{$UI_BROWSER}?act=getMData&id={$o.id}">[vMData]</a>
&nbsp;<a href="{$UI_BROWSER}?act=getInfo&id={$o.id}">[Analyze]</a>
&nbsp;<a href="{$UI_BROWSER}?act=editFile&id={$o.id}">[Edit]</a>
&nbsp;<a href="{$UI_BROWSER}?act=editMetaDataValues&id={$o.id}">[eMData]</a>
&nbsp;<a href="#" onclick="hpopup('{$UI_HANDLER}?act=add2SP&id={$o.id}', '2SP')">[SP]</a>
{/if}
&nbsp;
</td>

View File

@ -12,7 +12,7 @@
<td>{$i.title}</td>
<td>{$i.duration}</td>
<td>{$i.type} </td>
<th><a href="#" onclick="popup('{$UI_HANDLER}?act=remFromSP&id={$i.id}', 'remFromSP', 1, 1)">X</th>
<th><a href="#" onclick="hpopup('{$UI_HANDLER}?act=remFromSP&id={$i.id}', 'remFromSP')">X</th>
</tr>
{/foreach}
<tr><td></td><td colspan="2">[Edit]</td><td colspan="2">[Delete]</td></tr>

View File

@ -29,21 +29,27 @@
{literal}}{/literal}
{literal}
function popup(url, name, width, height)
function popup(url, name, width, height) // popup in center of perent window
{
var screenX;
var screenY;
screenX = (window.screenX + window.innerWidth/2 - width/2);
screenY = (window.screenY + window.innerHeight/2 - height/2);
arg = 'width='+width+', height='+height+', scrollbars=no, menubar=no, depend=yes, screenX='+screenX+', screenY='+screenY;
arg = 'width='+width+', height='+height+', scrollbars=no, menubar=no, depend=yes, left='+screenX+', top='+screenY;
popupwin = window.open(url, name, arg);
window.popupwin.focus();
}
function hpopup(url, name) //hidden popup!
{
popupwin = window.open(url, name, 'width=1, height=1, scrollbars=no, menubar=no, depend=yes');
window.parent.focus();
}
{/literal}
{uiBrowser->alertMsg assign='alertMsg'}
{uiBrowser->getAlertMsg assign='alertMsg'}
{if $alertMsg}
alert('{$alertMsg}');
{/if}

View File

@ -31,7 +31,7 @@
<td>{$s.duration}</td>
<td><a href="{$UI_BROWSER}?act=getMdata&id={$s.id}">[XML]</a>
<a href="{$UI_BROWSER}?act=editMetaDataValues&id={$s.id}">[Form]</a>
<a href="#" onClick="popup('{$UI_HANDLER}?act=add2SP&id={$s.id}', '2SP', 1, 1)">[SP]</a>
<a href="#" onClick="hpopup('{$UI_HANDLER}?act=add2SP&id={$s.id}', '2SP')">[SP]</a>
</td>
</tr>
</div>

View File

@ -58,7 +58,7 @@ if ($uiBrowser->userid) {
break;
case "permissions":
$Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id, $_REQUEST['act']=='getHomeDir' ? TRUE : FALSE));
$Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id));
$Smarty->assign('showPath', TRUE);
$Smarty->assign('perms', $uiBrowser->getPermissions($uiBrowser->id));
@ -67,29 +67,31 @@ if ($uiBrowser->userid) {
case "newfile":
$Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id, $_REQUEST['act']=='getHomeDir' ? TRUE : FALSE));
$Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id));
$Smarty->assign('showPath', TRUE);
$Smarty->assign('newfileform', $uiBrowser->getNewFileForm($uiBrowser->id, $ui_fmask['upload']));
$Smarty->assign('showNewFileForm', TRUE);
break;
break;
case "upload_1":
$Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id, $_REQUEST['act']=='getHomeDir' ? TRUE : FALSE));
case "uploadFile":
$Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id));
$Smarty->assign('showPath', FALSE);
$Smarty->assign('uploadform', $uiBrowser->getUploadFileForm($uiBrowser->id, $ui_fmask['uploadFile']));
$Smarty->assign('showUploadForm', TRUE);
break;
case "editFile":
$Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id));
$Smarty->assign('showPath', FALSE);
$Smarty->assign('uploadform', $uiBrowser->getUploadFileForm($uiBrowser->id, $ui_fmask['upload_1']));
$Smarty->assign('showUploadForm', TRUE);
break;
break;
case "upload_2":
$Smarty->assign('structure', $uiBrowser->getStructure($uiBrowser->id, $_REQUEST['act']=='getHomeDir' ? TRUE : FALSE));
$Smarty->assign('showPath', FALSE);
$Smarty->assign('mDataForm', $uiBrowser->getMetaDataForm($uiBrowser->id, $ui_fmask['mData'], FALSE, $uiBrowser->getInfo($id, 'array')));
$Smarty->assign('showMetaDataForm', TRUE);
break;
case "search":
if($_REQUEST['doSearch']) {
@ -130,7 +132,7 @@ if ($uiBrowser->userid) {
$Smarty->assign('showFile', TRUE);
break;
case "getMdata":
case "getMData":
$Smarty->assign('fMetaData', $uiBrowser->getMdata($uiBrowser->id));
$Smarty->assign('showFile', TRUE);
break;
@ -141,7 +143,7 @@ if ($uiBrowser->userid) {
break;
case "getInfo":
$Smarty->assign('fInfo', $uiBrowser->getInfo($uiBrowser->id, 'text'));
$Smarty->assign('fInfo', $uiBrowser->_getInfo($uiBrowser->id, 'text'));
$Smarty->assign('showFile', TRUE);
break;

View File

@ -15,16 +15,12 @@ switch($_REQUEST['act']){
$uiHandler->logout(TRUE);
break;
case "upload": ## media- and metadata file together
case "upload": ## media- and metadata file together #####
$uiHandler->upload(array_merge($_REQUEST, $_FILES), $uiHandler->id, $ui_fmask["upload"]);
break;
case "upload_1": ## first upload
$uiHandler->upload_1(array_merge($_REQUEST, $_FILES), $uiHandler->id, $ui_fmask["upload_1"]);
break;
case "upload_2": ## then edit metadata
case "uploadFile": ## just media file #######################
$uiHandler->uploadFile(array_merge($_REQUEST, $_FILES), $uiHandler->id, $ui_fmask["uploadFile"]);
break;
case "newFolder":

View File

@ -28,12 +28,12 @@ class uiBase
*/
function uiBase(&$config)
{
$dbc = DB::connect($config['dsn'], TRUE);
if (DB::isError($dbc)) {
die($dbc->getMessage());
$this->dbc = DB::connect($config['dsn'], TRUE);
if (DB::isError($this->dbc)) {
die($this->dbc->getMessage());
}
$dbc->setFetchMode(DB_FETCHMODE_ASSOC);
$this->gb =& new GreenBox(&$dbc, $config);
$this->dbc->setFetchMode(DB_FETCHMODE_ASSOC);
$this->gb =& new GreenBox(&$this->dbc, $config);
$this->config = $config;
$this->sessid = $_REQUEST[$config['authCookieName']];
$this->userid = $this->gb->getSessUserId($this->sessid);
@ -211,7 +211,7 @@ class uiBase
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
<dc:title>'.$this->_getFileTitle($id).'</dc:title>
<dc:format.extent>'.$ia['playtime_string'].'</dc:format.extent>
<dcterms:extent>'.$ia['playtime_string'].'</dcterms:extent>
</metadata>
</audioClip>';
@ -250,20 +250,50 @@ class uiBase
}
function _toHex($gunid)
{
$res = $this->dbc->query("SELECT to_hex($gunid)");
$row = $res->fetchRow();
return $row['to_hex'];
}
function _toInt8($gunid)
{
$res = $this->dbc->query("SELECT x'$gunid'::bigint");
$row = $res->fetchRow();
return $row['int8'];
}
function getSP()
{
$spData = $this->gb->loadPref($this->sessid, UI_SCRATCHPAD_KEY);
if (!PEAR::isError($spData) && trim($spData) != '') {
$arr = explode(' ', $spData);
/*
## Akos old format #####################################
foreach($arr as $val) {
$pieces = explode(':', $val);
if (preg_match(UI_SCRATCHPAD_REGEX, $val)) {
$res[] = array_merge($this->_getMetaInfo($this->gb->_idFromGunid($pieces[0])),
array('added' => $pieces[1])
);
list ($gunid, $date) = explode(':', $val);
if ($this->gb->_idFromGunid($gunid) != FALSE) {
$res[] = array_merge($this->_getMetaInfo($this->gb->_idFromGunid($gunid)), array('added' => $date));
}
}
}
*/
## new format ##########################################
foreach($arr as $gunid) {
if (preg_match('/[0-9]{1,20}/', $gunid)) {
if ($this->gb->_idFromGunid($this->_toHex($gunid)) != FALSE) {
$res[] = $this->_getMetaInfo($this->gb->_idFromGunid($this->_toHex($gunid)));
}
}
}
return ($res);
} else {
@ -275,11 +305,12 @@ class uiBase
{
if (is_array($data)) {
foreach($data as $val) {
$str .= $val['gunid'].':'.$val['added'].' ';
#$str .= $val['gunid'].':'.$val['added'].' '; ## new format ###
$str .= $this->_toInt8($val['gunid']).' '; ## Akos´ old format ###
}
}
$this->gb->savePref($this->sessid, UI_SCRATCHPAD_KEY, trim($str));
$this->gb->savePref($this->sessid, UI_SCRATCHPAD_KEY, $str);
}
function add2SP($id)
@ -288,27 +319,26 @@ class uiBase
$this->redirUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close';
if ($sp = $this->getSP()) {
foreach ($sp as $val) {
foreach ($sp as $key => $val) {
if ($val['gunid'] == $info['gunid']) {
$exists = TRUE;
unset($sp[$key]);
$this->_retMsg('Entry $1 was already on $2.\nMoved to Top.', $info['title'], $val['added']);
} else {
#$this->incAccessCounter($id);
}
}
}
if(!$exists) {
$sp = array_merge(array(array('gunid' => $info['gunid'],
'added' => date('Y-m-d')
),
),
is_array($sp) ? $sp : NULL);
#print_r($sp);
$this->_saveSP($sp);
#$this->_retmsg('Entry $1 added', $gunid);
return TRUE;
} else {
$this->_retmsg('Entry $1 already exists', $info['title']);
return FALSE;
}
$sp = array_merge(array(array('gunid' => $info['gunid'],
'added' => date('Y-m-d')
),
),
is_array($sp) ? $sp : NULL);
$this->_saveSP($sp);
#$this->_retmsg('Entry $1 added', $info['title']);
return TRUE;
}
@ -339,12 +369,13 @@ class uiBase
function _getMetaInfo($id)
{
$data['id'] = $id;
$data['gunid'] = $this->gb->_gunidFromId($id);
$data['title'] = $this->_getMDataValue($id, 'Title');
$data['artist'] = $this->_getMDataValue($id, 'Artist');
$data['duration'] = substr($this->_getMDataValue($id, 'format.extent'), 0 ,8);
$data['type'] = $this->gb->existsPlaylist($this->sessid, $this->gb->_idFromgunid($id)) ? $this->tra('playlist') : $this->tra('file');
$data = array('id' => $id,
'gunid' => $this->gb->_gunidFromId($id),
'title' => $this->_getMDataValue($id, 'title'),
'artist' => $this->_getMDataValue($id, 'artist'),
'duration' => substr($this->_getMDataValue($id, 'format.extent'), 0 ,8),
'type' => $this->_getType($id),
);
return ($data);
}
@ -362,5 +393,15 @@ class uiBase
$file = array_pop($this->gb->getPath($id));
return $file['name'];
}
function _getType($id)
{
if ($this->gb->existsPlaylist($this->sessid, $this->gb->_gunidFromId($id))) return 'playlist';
return 'file';
#if ($this->gb->existsAudioClip($this->sessid, $this->gb->_gunidFromId($id))) return 'audioclip';
#if ($this->gb->existsFile($this->sessid, $this->gb->_gunidFromId($id))) return 'File';
return FALSE;
}
}
?>

View File

@ -16,20 +16,45 @@ class uiBrowser extends uiBase {
$this->uiBase($config);
}
/**
* login
*
* Perform a frontend action
* map to a function called action_<actionName>.inc.php
*
* @param actionName string, name of a action
* @param params array[], request vars
*/
function performAction( $actionName, $params )
{
$actionFunctionName = 'action_' . $actionName ;
$actionFunctionFileName = ACTION_BASE . '/action_' . $actionName . '.inc.php' ;
if ( file_exists( $actionFunctionFileName ) )
{
include ( $actionFunctionFileName ) ;
if ( method_exists( $actionFunctionName ) )
{
$actionFunctionName( &$this, $params ) ;
}
}
}
// --- error handling ---
/**
* alertMsg
* getAlertMsg
*
* takes error message from session var
* extractes error message from session var
*
* @return string
*/
function alertMsg()
function getAlertMsg()
{
if ($_SESSION['alertMsg']) {
$this->alertMsg = $_SESSION['alertMsg'];
unset($_SESSION['alertMsg']);
return $this->alertMsg;
}
return false;

View File

@ -30,7 +30,7 @@ $uiBase = new uiBase($config);
## load Smarty+filters ##############################################
require_once dirname(__FILE__).'/SmartyExtensions.inc.php';
#$Smarty->load_filter('output', 'trimwhitespace');
$Smarty->load_filter('output', 'trimwhitespace');
$Smarty->load_filter('post', 'template_marker');

View File

@ -165,7 +165,7 @@ $ui_fmask = array(
'pages' => array(
'Main' => array(
array(
'element' => 'Title',
'element' => 'dc:title',
'type' => 'text',
'label' => 'Title',
'required' => TRUE
@ -174,31 +174,31 @@ $ui_fmask = array(
'element' => 'Creator',
'type' => 'text',
'label' => 'Creator',
'required' => TRUE
#'required' => TRUE,
),
array(
'element' => 'Type_Genre',
'type' => 'text',
'label' => 'Type_Genre',
'required' => TRUE,
#'required' => TRUE,
),
array(
'element' => 'Format',
'element' => 'dc:format',
'type' => 'select',
'label' => 'Format',
'required' => TRUE,
#'required' => TRUE,
'options' => array(
'' => '',
'audio/mpeg' => 'audio/mpeg',
'File' => 'File',
'live stream' => 'Live Stream',
'networked file'=> 'Networked File',
'audio/mpeg' => 'audio/mpeg'
)
),
array(
'element' => 'Format_Extent',
'element' => 'dcterms:extent',
'type' => 'text',
'label' => 'Format_Extent',
'label' => 'Extent',
#'attributes'=> array('readonly' => 'on')
),
/*
@ -233,12 +233,12 @@ $ui_fmask = array(
),
'Music_Basic' => array(
array(
'element' => 'Title',
'element' => 'dc:title',
'type' => 'text',
'label' => 'Title',
),
array(
'element' => 'Creator',
'element' => 'dc:creator',
'type' => 'text',
'label' => 'Creator',
),
@ -247,6 +247,7 @@ $ui_fmask = array(
'type' => 'text',
'label' => 'Source_Album',
),
/*
array(
'element' => 'Source_Year',
'type' => 'date',
@ -258,25 +259,27 @@ $ui_fmask = array(
'minYear' => 1900
)
),
*/
array(
'element' => 'Type_Genre',
'type' => 'text',
'label' => 'Type_Genre',
),
array(
'element' => 'Description',
'element' => 'dc:description',
'type' => 'textarea',
'label' => 'Description',
),
array(
'element' => 'Format',
'element' => 'dc:format',
'type' => 'select',
'label' => 'Format',
'options' => array(
'' => '',
'audio/mpeg' => 'audio/mpeg',
'File' => 'File',
'live stream' => 'Live Stream',
'networked file'=> 'Networked File',
'audio/mpeg' => 'audio/mpeg'
'networked file'=> 'Networked File'
)
),
array(
@ -292,9 +295,9 @@ $ui_fmask = array(
'rule' => 'numeric',
),
array(
'element' => 'Format_Extent',
'element' => 'dcterms:extent',
'type' => 'text',
'label' => 'Format_Extent',
'label' => 'Extent',
'attributes'=> array('readonly' => 'on')
),
),
@ -342,6 +345,7 @@ $ui_fmask = array(
'type' => 'select',
'label' => 'Format_Medium_Channels',
'options' => array(
'' => '',
'mono' => 'Mono',
'stereo' => 'Stereo',
'5.1' => '5.1'
@ -444,7 +448,7 @@ $ui_fmask = array(
),
'Talk_Basic' => array(
array(
'element' => 'Title',
'element' => 'dc:title',
'type' => 'text',
'label' => 'Title',
'relation' => 1
@ -455,7 +459,7 @@ $ui_fmask = array(
'label' => 'Coverage',
),
array(
'element' => 'Description',
'element' => 'dc:description',
'type' => 'textarea',
'label' => 'Description',
),
@ -475,14 +479,15 @@ $ui_fmask = array(
'label' => 'Type_Genre',
),
array(
'element' => 'Format',
'element' => 'dc:format',
'type' => 'select',
'label' => 'Format',
'options' => array(
'' => '',
'audio/mpeg' => 'audio/mpeg',
'File' => 'File',
'live stream' => 'Live Stream',
'networked file'=> 'Networked File',
'audio/mpeg' => 'audio/mpeg'
)
),
),
@ -663,11 +668,11 @@ $ui_fmask = array(
)
),
'upload_1' => array(
'uploadFile' => array(
array(
'element' => 'act',
'type' => 'hidden',
'constant' => 'upload_1'
'constant' => 'uploadFile'
),
array(
'element' => 'id',

View File

@ -1,4 +1,7 @@
<?php
define('ACTION_BASE', '/actions' ) ;
/**
* uiHandler class
*
@ -22,6 +25,9 @@ class uiHandler extends uiBase {
$this->uiBase($config);
}
// --- authentication ---
/**
* login
@ -42,7 +48,7 @@ class uiHandler extends uiBase {
$fid = $this->gb->getObjId($formdata['login'], $this->gb->storId);
if(!PEAR::isError($fid)) $this->redirUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close';
}else{
$this->alertMsg = 'Login failed.';
$this->_retMsg('Login failed.');
$_SESSION['retransferFormData']['login']=$formdata['login'];
$this->redirUrl = UI_BROWSER.'?popup[]=login';
}
@ -97,7 +103,7 @@ class uiHandler extends uiBase {
}
}
$r = $this->gb->putFile($id, $formdata['mediafile']['name'], $ntmp, $mdtmp, $this->sessid);
if(PEAR::isError($r)) $this->alertMsg = $r->getMessage();
if(PEAR::isError($r)) $this->_retMsg($r->getMessage());
else{
# $gb->updateMetadataDB($gb->_pathFromId($r), $mdata, $sessid);
@unlink($ntmp);
@ -114,14 +120,14 @@ class uiHandler extends uiBase {
/**
* upload_1
* uploadS1
*
* Provides file upload and store it to the storage
*
* @param formdata array, submitted text and file
* @param id int, destination folder id
*/
function upload_1(&$formdata, $id, &$mask)
function uploadFile(&$formdata, $id, &$mask)
{
if ($this->_validateForm($formdata, $mask)) {
$tmpgunid = md5(
@ -134,7 +140,7 @@ class uiHandler extends uiBase {
chmod($ntmp, 0664);
$r = $this->gb->putFile($id, $formdata['mediafile']['name'], $ntmp, NULL, $this->sessid);
if(PEAR::isError($r)) $this->alertMsg = $r->getMessage();
if(PEAR::isError($r)) $this->_retMsg($r->getMessage());
else{
# $gb->updateMetadataDB($gb->_pathFromId($r), $mdata, $sessid);
@unlink($ntmp);
@ -147,7 +153,7 @@ class uiHandler extends uiBase {
$this->redirUrl = UI_BROWSER."?act=editMetaDataValues&id=$r";
return $r;
} else {
$this->redirUrl = UI_BROWSER."?act=upload_1&id=$id";
$this->redirUrl = UI_BROWSER."?act=uploadFile&id=$id";
return FALSE;
}
}
@ -163,7 +169,7 @@ class uiHandler extends uiBase {
function newFolder($newname, $id)
{
$r = $this->gb->createFolder($id, $newname, $this->sessid);
if(PEAR::isError($r)) $this->alertMsg = $r->getMessage();
if(PEAR::isError($r)) $this->_retMsg($r->getMessage());
$this->redirUrl = UI_BROWSER.'?id='.$id;
}
@ -179,7 +185,7 @@ class uiHandler extends uiBase {
{
$parid = $this->gb->getparent($this->id);
$r = $this->gb->renameFile($id, $newname, $this->sessid);
if(PEAR::isError($r)) $this->alertMsg = $r->getMessage();
if(PEAR::isError($r)) $this->_retMsg($r->getMessage());
$this->redirUrl = UI_BROWSER."?id=$parid";
}
@ -199,7 +205,7 @@ class uiHandler extends uiBase {
$parid = $this->gb->getparent($id);
$r = $this->gb->moveFile($id, $did, $this->sessid);
if(PEAR::isError($r)){
$this->alertMsg = $r->getMessage();
$this->_retMsg($r->getMessage());
$this->redirUrl = UI_BROWSER."?id=$parid";
}
else $this->redirUrl = UI_BROWSER."?id=$did";
@ -221,7 +227,7 @@ class uiHandler extends uiBase {
$parid = $this->gb->getparent($id);
$r = $this->gb->copyFile($id, $did, $this->sessid);
if(PEAR::isError($r)){
$this->alertMsg = $r->getMessage();
$this->_retMsg($r->getMessage());
$this->redirUrl = UI_BROWSER."?id=$parid";
}
else $this->redirUrl = UI_BROWSER."?id=$did";
@ -242,14 +248,14 @@ class uiHandler extends uiBase {
## add emtyness-test here ###
if (!($delOverride==$id) && (count($this->gb->getObjType($id)=='Folder'?
$this->gb->listFolder($id, $this->sessid):NULL))) {
$this->alertMsg = $this->tra("Folder is not empty. You can override this protection by clicking DEL again");
$this->_retMsg("Folder is not empty. You can override this protection by clicking DEL again");
$this->redirUrl = UI_BROWSER."?id=$parid&delOverride=$id";
return;
}
#############################
$r = $this->gb->deleteFile($id, $this->sessid);
if(PEAR::isError($r)) $this->alertMsg = $r->getMessage();
if(PEAR::isError($r)) $this->_retMsg($r->getMessage());
$this->redirUrl = UI_BROWSER."?id=$parid";
}
@ -266,7 +272,7 @@ class uiHandler extends uiBase {
function getFile($id)
{
$r = $this->gb->access($id, $this->sessid);
if(PEAR::isError($r)) $this->alertMsg = $r->getMessage();
if(PEAR::isError($r)) $this->_retMsg($r->getMessage());
else echo $r;
}
@ -300,13 +306,13 @@ class uiHandler extends uiBase {
if ($this->_validateForm($formdata, $mask)) {
if($this->gb->checkPerm($this->userid, 'subjects')){
$res = $this->gb->addSubj($formdata['login'], ($formdata['pass']=='' ? NULL:$formdata['pass'] ));
$this->alertMsg = $this->tra('Subject "'.$formdata['login'].'" added.');
$this->_retMsg('Subject $1 added.', $formdata['login']);
} else {
$this->alertMsg = $this->tra('Access denied.');
$this->_retMsg('Access denied.');
return;
}
}
if(PEAR::isError($res)) $this->alertMsg = $res->getMessage();
if(PEAR::isError($res)) $this->_retMsg($res->getMessage());
}
/**
@ -323,10 +329,10 @@ class uiHandler extends uiBase {
if($this->gb->checkPerm($this->userid, 'subjects')){
$res = $this->gb->removeSubj($login);
}else{
$this->alertMsg='Access denied.';
$this->_retMsg('Access denied.');
return;
}
if(PEAR::isError($res)) $this->alertMsg = $res->getMessage();
if(PEAR::isError($res)) $this->_retMsg($res->getMessage());
}
/**
@ -346,15 +352,15 @@ class uiHandler extends uiBase {
if($this->userid != $uid &&
! $this->gb->checkPerm($this->userid, 'subjects')){
$this->alertMsg='Access denied..';
$this->_retMsg('Access denied.');
return;
}
if(FALSE === $this->gb->authenticate($ulogin, $oldpass)){
$this->alertMsg='Wrong old pasword.';
$this->_retMsg('Wrong old pasword.');
return;
}
if($pass !== $pass2){
$this->alertMsg = "Passwords do not match. ".
$this->_retMsg("Passwords do not match.").
"($pass/$pass2)";
$this->redirUrl = UI_BROWSER.'?act=subjects';
return;
@ -379,7 +385,7 @@ class uiHandler extends uiBase {
$this->gb->addPerm($subj, $permAction,
$id, $allowDeny);
}else{
$this->alertMsg='Access denied.';
$this->_retMsg('Access denied.');
}
$this->redirUrl = UI_BROWSER.'?id='.$id.'&act=permissions';
}
@ -396,7 +402,7 @@ class uiHandler extends uiBase {
{
if($this->gb->checkPerm($this->userid, 'editPerms', $oid))
$this->gb->removePerm($permid);
else $this->alertMsg='Access denied.';
else $this->_retMsg('Access denied.');
$this->redirUrl = UI_BROWSER.'?act=permissions&id='.$oid;
}
@ -416,10 +422,10 @@ class uiHandler extends uiBase {
if($this->gb->checkPerm($this->userid, 'subjects')){
$res = $this->gb->addSubj2Gr($login, $gname);
}else{
$this->alertMsg='Access denied.';
$this->_retMsg('Access denied.');
return;
}
if(PEAR::isError($res)) $this->alertMsg = $res->getMessage();
if(PEAR::isError($res)) $this->_retMsg($res->getMessage());
$this->redirUrl = UI_BROWSER.'?act=groups&id='.$reid;
}
@ -436,10 +442,10 @@ class uiHandler extends uiBase {
if($this->gb->checkPerm($this->userid, 'subjects')){
$res = $this->gb->removeSubjFromGr($login, $gname);
}else{
$this->alertMsg='Access denied.';
$this->_retMsg('Access denied.');
return;
}
if(PEAR::isError($res)) $this->alertMsg = $res->getMessage();
if(PEAR::isError($res)) $this->_retMsg($res->getMessage());
$this->redirUrl = UI_BROWSER.'?act=groups&id='.$reid;
}
@ -457,10 +463,11 @@ class uiHandler extends uiBase {
$this->_dateArr2Str(&$mData);
foreach ($mData as $key=>$val) {
#echo "id: {$formdata['id']}, key: $key, val: $val<br>";
$this->gb->setMDataValue($formdata['id'], $key, $this->sessid, $val);
}
$this->alertMsg = $this->tra('Metadata saved');
$this->_retMsg('Metadata saved');
}
@ -519,7 +526,7 @@ class uiHandler extends uiBase {
}
if ($val['type'] == 'file' && $formdata[$val['element']]['name']) {
if (FALSE === @move_uploaded_file($formdata[$val['element']]['tmp_name'], $this->gb->loadGroupPref($this->sessid, 'StationPrefs', 'stationLogoPath')))
$this->alertMsg = $this->tra('Error uploading Logo');
$this->_retMsg('Error uploading Logo');
return;
}
}