*** empty log message ***

This commit is contained in:
sebastian 2005-03-07 17:03:29 +00:00
parent df99ff2cb5
commit 214e3e960e
17 changed files with 197 additions and 237 deletions

View File

@ -23,15 +23,15 @@
Author : $Author: sebastian $
Version : $Revision: 1.1 $
Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/htmlUI/var/Attic/SchedulerPhpClient.class.php,v $
------------------------------------------------------------------------------*/
/* ================================================================= includes */
require_once 'DB.php';
#include_once dirname(__FILE__)."/../../storageServer/var/xmlrpc/XML/RPC.php";
#include_once dirname(__FILE__)."/../../storageServer/var/conf.php";
require_once "XML/RPC.php";
#include_once "../conf.php";
/* ================================================== method definition array */
/**
@ -41,14 +41,17 @@ require_once 'DB.php';
* <ul>
* <li>m</li> full method name (include optional prefix)
* <li>p</li> array of input parameter names
* <li>t</li> array of input parameter types
* <li>r</li> array of result element names (not used there at present)
* <li>e</li> array of error codes/messages (not used there at present)
* </ul>
*/
$mdefs = array(
"listMethods" => array('m'=>"system.listMethods", 'p'=>NULL, 't'=>NULL),
"AddAudioClipToPlaylistMethod" => array(
'm'=>'AddAudioClipToPlaylistMethod',
'm'=>'addAudioClipToPlaylist',
'p'=>array('sessionId'/*string*/, 'playlistId'/*string*/, 'audioClipId'/*string*/, 'relativeOffset'/*int*/),
't'=>array('string', 'string', 'string', 'int'),
'r'=>array('playlistElementId'/*string*/),
'e'=>array(
'301'=>'invalid argument format',
@ -63,8 +66,9 @@ $mdefs = array(
)
),
"CreatePlaylistMethod" => array(
'm'=>'CreatePlaylistMethod',
'm'=>'createPlaylist',
'p'=>array('sessionId'/*string*/),
't'=>array('string'),
'r'=>array('playlist'/*string*/),
'e'=>array(
'201'=>'invalid argument format',
@ -73,8 +77,9 @@ $mdefs = array(
)
),
"DeletePlaylistMethod" => array(
'm'=>'DeletePlaylistMethod',
'm'=>'deletePlaylist',
'p'=>array('sessionId'/*string*/, 'playlistId'/*string*/),
't'=>array('string', 'string'),
'r'=>array(),
'e'=>array(
'901'=>'invalid argument format',
@ -86,8 +91,9 @@ $mdefs = array(
)
),
"DisplayAudioClipMethod" => array(
'm'=>'DisplayAudioClipMethod',
'm'=>'displayAudioClip',
'p'=>array('sessionId'/*string*/, 'audioClipId'/*string*/),
't'=>array('string', 'string'),
'r'=>array('audioClip'/*string*/),
'e'=>array(
'601'=>'invalid argument format',
@ -97,8 +103,9 @@ $mdefs = array(
)
),
"DisplayAudioClipsMethod" => array(
'm'=>'DisplayAudioClipsMethod',
'm'=>'displayAudioClips',
'p'=>array('sessionId'/*string*/),
't'=>array('string'),
'r'=>array(array('audioClip'/*string*/)),
'e'=>array(
'1801'=>'invalid argument format',
@ -107,8 +114,9 @@ $mdefs = array(
)
),
"DisplayPlaylistMethod" => array(
'm'=>'DisplayPlaylistMethod',
'm'=>'displayPlaylist',
'p'=>array('sessionId'/*string*/, 'playlistId'/*string*/),
't'=>array('string', 'string'),
'r'=>array('playlist'/*string*/),
'e'=>array(
'1001'=>'invalid argument format',
@ -118,8 +126,9 @@ $mdefs = array(
)
),
"DisplayPlaylistsMethod" => array(
'm'=>'DisplayPlaylistsMethod',
'm'=>'displayPlaylists',
'p'=>array('sessionId'/*string*/),
't'=>array('string'),
'r'=>array(array('playlist'/*string*/)),
'e'=>array(
'1701'=>'invalid argument format',
@ -128,8 +137,9 @@ $mdefs = array(
)
),
"DisplayScheduleMethod" => array(
'm'=>'DisplayScheduleMethod',
'm'=>'displaySchedule',
'p'=>array('sessionId'/*string*/, 'from'/*datetime*/, 'to'/*datetime*/),
't'=>array('string', 'dateTime.iso8601', 'dateTime.iso8601'),
'r'=>array(array('id'/*int*/, 'playlistId'/*string*/, 'start'/*datetime*/, 'end'/*datetime*/)),
'e'=>array(
'1101'=>'invalid argument format',
@ -139,8 +149,9 @@ $mdefs = array(
)
),
"GeneratePlayReportMethod" => array(
'm'=>'GeneratePlayReportMethod',
'm'=>'generatePlayReport',
'p'=>array('sessionId'/*string*/, 'from'/*datetime*/, 'to'/*datetime*/),
't'=>array('string', 'dateTime.iso8601', 'dateTime.iso8601'),
'r'=>array(array('audioClipId'/*string*/, 'timestamp'/*datetime*/)),
'e'=>array(
'1501'=>'invalid argument format',
@ -150,21 +161,24 @@ $mdefs = array(
)
),
"GetSchedulerTimeMethod" => array(
'm'=>'GetSchedulerTimeMethod',
'm'=>'getSchedulerTime',
'p'=>array(),
't'=>array(),
'r'=>array('schedulerTime'/*datetime*/),
'e'=>array(
)
),
"GetVersionMethod" => array(
'm'=>'GetVersionMethod',
'm'=>'getVersion',
'p'=>array(),
't'=>array(),
'r'=>array('version'/*string*/),
'e'=>array()
),
"LoginMethod" => array(
'm'=>'LoginMethod',
'm'=>'login',
'p'=>array('login'/*string*/, 'password'/*string*/),
't'=>array('string', 'string'),
'r'=>array('sessionId'/*string*/),
'e'=>array(
'2001'=>'invalid argument format',
@ -174,8 +188,9 @@ $mdefs = array(
)
),
"LogoutMethod" => array(
'm'=>'LogoutMethod',
'm'=>'logout',
'p'=>array('sessionId'/*string*/),
't'=>array('string'),
'r'=>array(),
'e'=>array(
'2101'=>'invalid argument format',
@ -184,8 +199,9 @@ $mdefs = array(
)
),
"OpenPlaylistForEditingMethod" => array(
'm'=>'OpenPlaylistForEditingMethod',
'm'=>'openPlaylistForEditing',
'p'=>array('sessionId'/*string*/, 'playlistId'/*string*/),
't'=>array('string', 'string'),
'r'=>array('playlist'/*string*/),
'e'=>array(
'101'=>'invalid argument format',
@ -195,8 +211,9 @@ $mdefs = array(
)
),
"RemoveAudioClipFromPlaylistMethod" => array(
'm'=>'RemoveAudioClipFromPlaylistMethod',
'm'=>'removeAudioClipFromPlaylist',
'p'=>array('sessionId'/*string*/, 'playlistId'/*string*/, 'playlistElementId'/*string*/),
't'=>array('string', 'string', 'string'),
'r'=>array(),
'e'=>array(
'401'=>'invalid argument format',
@ -209,8 +226,9 @@ $mdefs = array(
)
),
"RemoveFromScheduleMethod" => array(
'm'=>'RemoveFromScheduleMethod',
'm'=>'removeFromSchedule',
'p'=>array('sessionId'/*string*/, 'scheduleEntryId'/*string*/),
't'=>array('string', 'string'),
'r'=>array(),
'e'=>array(
'1201'=>'invalid argument format',
@ -220,8 +238,9 @@ $mdefs = array(
)
),
"RescheduleMethod" => array(
'm'=>'RescheduleMethod',
'm'=>'reschedule',
'p'=>array('sessionId'/*string*/, 'scheduleEntryId'/*string*/, 'playtime'/*datetime*/),
't'=>array('string', 'string', 'dateTime.iso8601'),
'r'=>array(),
'e'=>array(
'1301'=>'invalid argument format',
@ -233,14 +252,16 @@ $mdefs = array(
)
),
"ResetStorageMethod" => array(
'm'=>'ResetStorageMethod',
'm'=>'resetStorage',
'p'=>array(),
't'=>array(),
'r'=>array(),
'e'=>array('3001'=>'storage client reported an error'),
),
"RevertEditedPlaylistMethod" => array(
'm'=>'RevertEditedPlaylistMethod',
'm'=>'revertEditedPlaylist',
'p'=>array('sessionId'/*string*/, 'playlistId'/*string*/),
't'=>array('string', 'string'),
'r'=>array(),
'e'=>array(
'801'=>'invalid argument format',
@ -251,8 +272,9 @@ $mdefs = array(
)
),
"SavePlaylistMethod" => array(
'm'=>'SavePlaylistMethod',
'm'=>'savePlaylist',
'p'=>array('sessionId'/*string*/, 'playlistId'/*string*/),
't'=>array('string', 'string'),
'r'=>array(),
'e'=>array(
'701'=>'invalid argument format',
@ -263,8 +285,9 @@ $mdefs = array(
)
),
"UpdateFadeInFadeOutMethod" => array(
'm'=>'UpdateFadeInFadeOutMethod',
'm'=>'updateFadeInFadeOut',
'p'=>array('sessionId'/*string*/, 'playlistId'/*string*/, 'playlistElementId'/*string*/, 'fadeIn'/*int*/, 'fadeOut'/*int*/),
't'=>array('string', 'string', 'string', 'int', 'int'),
'r'=>array(),
'e'=>array(
'1601'=>'invalid argument format',
@ -279,22 +302,24 @@ $mdefs = array(
)
),
"UploadPlaylistMethod" => array(
'm'=>'UploadPlaylistMethod',
'm'=>'uploadPlaylist',
'p'=>array('sessionId'/*string*/, 'playlistId'/*string*/, 'playtime'/*datetime*/),
't'=>array('string', 'string', 'dateTime.iso8601'),
'r'=>array('scheduleEntryId'/*string*/),
'e'=>array(
'1401'=>'invalid argument format',
'1402'=>'missing playlist ID argument',
'1403'=>'missing playtime argument',
'1404'=>'playlist not found',
'1405'=>'timeframe not available',
'1405'=>'timeframe not aaaaavailable',
'1406'=>'could not schedule playlist',
'1420'=>'missing session ID argument',
)
),
"ValidatePlaylistMethod" => array(
'm'=>'ValidatePlaylistMethod',
'm'=>'validatePlaylist',
'p'=>array('sessionId'/*string*/, 'playlistId'/*string*/),
't'=>array('string', 'string'),
'r'=>array('valid'/*bool*/),
'e'=>array(
'501'=>'invalid argument format',
@ -307,6 +332,7 @@ $mdefs = array(
"LoginGB" => array(
'm'=>'locstor.login',
'p'=>array('login'/*string*/, 'pass'/*string*/),
't'=>array('string', 'string'),
'r'=>array('sessid'/*string*/),
'e'=>array(
'2001'=>'invalid argument format',
@ -318,6 +344,7 @@ $mdefs = array(
"LogoutGB" => array(
'm'=>'locstor.logout',
'p'=>array('sessid'/*string*/),
't'=>array('string'),
'r'=>array('status'/*boolean*/),
'e'=>array(
'2001'=>'invalid argument format',
@ -374,11 +401,11 @@ class SchedulerPhpClient{
$this->debug = $debug;
$this->verbose = $verbose;
$confPrefix = "scheduler";
#$confPrefix = "storage";
# $confPrefix = "storage";
$serverPath =
"http://{$config["{$confPrefix}UrlHost"]}:{$config["{$confPrefix}UrlPort"]}".
"{$config["{$confPrefix}UrlPath"]}/{$config["{$confPrefix}XMLRPC"]}";
#$serverPath = "http://localhost:80/livesupportStorageServer/xmlrpc/xrLocStor.php";
#$serverPath = "http://localhost:80/livesupportStorageServerCVS/xmlrpc/xrLocStor.php";
if($this->verbose) echo "serverPath: $serverPath\n";
$url = parse_url($serverPath);
$this->client = new XML_RPC_Client($url['path'], $url['host'], $url['port']);
@ -434,11 +461,14 @@ class SchedulerPhpClient{
function callMethod($method, $gettedPars)
{
$parr = array();
$XML_RPC_val = new XML_RPC_Value;
foreach($this->mdefs[$method]['p'] as $i=>$p){
$parr[$p] = $gettedPars[$i];
$parr[$p] = new XML_RPC_Value;
$parr[$p]->addScalar($gettedPars[$i], $this->mdefs[$method]['t'][$i]);
}
$XML_RPC_val->addStruct($parr);
$fullmethod = $this->mdefs[$method]['m'];
$msg = new XML_RPC_Message($fullmethod, array(XML_RPC_encode($parr)));
$msg = new XML_RPC_Message($fullmethod, array($XML_RPC_val));
if($this->verbose){
echo "parr:\n";
var_dump($parr);
@ -446,17 +476,23 @@ class SchedulerPhpClient{
echo $msg->serialize()."\n";
}
$this->client->setDebug($this->debug);
$res = $this->client->send($msg);
if (!$res = $this->client->send($msg)) {
return array('error' => array('code' => -1, 'message' => 'Cannot connect to Scheduler'));
}
if($res->faultCode() > 0) {
return array('error' => array('code' => $res->faultCode(), 'message' => $res->faultString())); ## changed by sebastian
/*
return $this->dbc->raiseError(
"SchedulerPhpClient::$method:".$res->faultString()." ".
$res->faultCode()."\n", $res->faultCode()
);
); */
}
if($verbose){
if($this->verbose){
echo "result:\n";
echo $res->serialize();
}
$val = $res->value();
# echo"<pre>\n"; var_dump($val); exit;
$resp = XML_RPC_decode($res->value());
return $resp;
}
@ -472,18 +508,25 @@ class SchedulerPhpClient{
/*
// db object handling:
include('conf.php');
$dbc = DB::connect($config['dsn'], TRUE);
$dbc->setFetchMode(DB_FETCHMODE_ASSOC);
$dbc->setErrorHandling(PEAR_ERROR_RETURN);
// scheduler client instantiation:
$spc =& SchedulerPhpClient::factory($dbc, $mdefs, $config);
#$spc =& SchedulerPhpClient::factory($dbc, $mdefs, $config, 0, TRUE);
// call of chosen function by name according to key values in $mdefs array:
// (for testing on storageServer XMLRPC I've changes confPrefix in
// SchedulerPhpClient constructor from 'scheduler' to 'storage' value)
$r = $spc->LoginGB('root', 'q'); var_dump($r);
#$r = $spc->LoginGB('root', 'q'); var_dump($r);
#$r = $spc->LogoutGB(''); var_dump($r);
#$r = $spc->DisplayScheduleMethod($this->Base->sessid, '2005-01-01 00:00:00.000000', '2005-02-01 00:00:00.000000'); var_dump($r);
$r = $spc->DisplayScheduleMethod($this->Base->sessid, '20040101T00:00:00', '20050401T00:00:00'); var_dump($r);
#$r = $spc->LoginMethod('root', 'q'); var_dump($r);
#$r = $spc->LogoutMethod('dummySessionId3-1714636915'); var_dump($r);
#$r = $spc->listMethods(); var_dump($r);
#$r = $spc->GetSchedulerTimeMethod(); var_dump($r);
*/
?>

View File

@ -1,126 +1,4 @@
<?php
/*------------------------------------------------------------------------------
Copyright (c) 2004 Media Development Loan Fund
This file is part of the LiveSupport project.
http://livesupport.campware.org/
To report bugs, send an e-mail to bugs@campware.org
LiveSupport 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.
LiveSupport is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with LiveSupport; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: sebastian $
Version : $Revision: 1.21 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/htmlUI/var/Attic/conf.php,v $
------------------------------------------------------------------------------*/
/**
* \file conf.php
* storageServer configuration file
*/
/**
* configuration structure:
*
* <dl>
* <dt>dsn<dd> datasource setting
* <dt>tblNamePrefix <dd>prefix for table names in the database
* <dt>authCookieName <dd>secret token cookie name
* <dt>storageDir <dd>main directory for storing binary media files
* <dt>bufferDir <dd>directory for temporary files
* <dt>transDir <dd>directory for incomplete transferred files
* <dt>accessDir <dd>directory for symlinks to accessed files
* <dt>isArchive <dd>local/central flag
* <dt>storageUrlPath<dd>path-URL-part of storageServer base dir
* <dt>storageXMLRPC<dd>XMLRPC server script address relative to storageUrlPath
* <dt>storageUrlHost, storageUrlPort<dd>host and port of storageServer
* <dt>archiveUrlPath<dd>path-URL-part of archiveServer base dir
* <dt>archiveXMLRPC<dd>XMLRPC server script address relative to archiveUrlPath
* <dt>archiveUrlHost, archiveUrlPort<dd>host and port of archiveServer
* </dl>
*/
$config = array(
/* ================================================== basic configuration */
'dsn' => array(
'username' => 'test',
'password' => 'test',
'hostspec' => 'localhost',
'phptype' => 'pgsql',
'database' => 'LiveSupport-test',
),
'tblNamePrefix' => 'ls_',
'authCookieName'=> 'lssid',
'StationPrefsGr'=> 'StationPrefs',
'AllGr' => 'All',
'storageDir' => dirname(__FILE__).'/../../storageServer/var/stor',
'bufferDir' => dirname(__FILE__).'/../../storageServer/var/stor/buffer',
'transDir' => dirname(__FILE__).'/../../storageServer/var/trans',
'accessDir' => dirname(__FILE__).'/../../storageServer/var/access',
'isArchive' => FALSE,
/* ==================================================== URL configuration */
'storageUrlPath' => '/livesupportStorageServer',
'storageXMLRPC' => 'xmlrpc/xrLocStor.php',
'storageUrlHost' => 'localhost',
'storageUrlPort' => 80,
/* ================================================ archive configuration */
'archiveUrlPath' => '/livesupportArchiveServer',
'archiveXMLRPC' => 'xmlrpc/xrArchive.php',
'archiveUrlHost' => 'localhost',
'archiveUrlPort' => 80,
'archiveAccountLogin' => 'root',
'archiveAccountPass' => 'q',
/* ============================================== scheduler configuration */
'schedulerUrlPath' => '',
'schedulerXMLRPC' => 'RC2',
'schedulerUrlHost' => 'localhost',
'schedulerUrlPort' => 3344,
/* ==================================== aplication-specific configuration */
'objtypes' => array(
'RootNode' => array('Folder'),
'Storage' => array('Folder', 'File', 'Replica'),
'Folder' => array('Folder', 'File', 'Replica'),
'File' => array(),
'audioclip' => array(),
'playlist' => array(),
'Replica' => array(),
),
'allowedActions'=> array(
'RootNode' => array('classes', 'subjects'),
'Folder' => array('editPrivs', 'write', 'read'),
'File' => array('editPrivs', 'write', 'read'),
'audioclip' => array('editPrivs', 'write', 'read'),
'playlist' => array('editPrivs', 'write', 'read'),
'Replica' => array('editPrivs', 'write', 'read'),
'_class' => array('editPrivs', 'write', 'read'),
),
'allActions' => array(
'editPrivs', 'write', 'read', 'classes', 'subjects'
),
/* ============================================== auxiliary configuration */
'RootNode' => 'RootNode',
'tmpRootPass' => 'q',
);
define('UI_HANDLER', 'ui_handler.php');
define('UI_BROWSER', 'ui_browser.php');
define('UI_FORM_STANDARD_METHOD', 'POST');
@ -135,19 +13,41 @@ define('UI_SEARCH_MAX_ROWS', 8);
define('UI_SEARCH_MIN_ROWS', 2);
define('UI_REGEX_URL', '/^(ht|f)tps?:\/\/[^ ]+$/');
define('UI_PL_ACCESSTOKEN_KEY', 'playlistToken');
define('UI_SCRATCHPAD_KEY', 'djBagContents');
define('UI_SCRATCHPAD_KEY', 'djBagContents');
define('UI_SCRATCHPAD_MAXLENGTH_KEY', 'djBagMaxlength');
#define('UI_SCRATCHPAD_REGEX', '/^[0-9a-f]{16}:[0-9]{4}-[0-9]{2}-[0-9]{2}$/');
## session keys
## Session Keys
define('UI_SCRATCHPAD_SESSNAME', 'SCRATCHPAD');
define('UI_STATIONINFO_SESSNAME', 'STATIONINFO');
define('UI_SEARCH_SESSNAME', 'L_SEARCH');
define('UI_PLAYLIST_SESSNAME', 'PLAYLIST');
define('UI_BROWSE_SESSNAME', 'L_BROWSE');
## Metadata Keys
define('UI_MDATA_KEY_TITLE', 'dc:title');
define('UI_MDATA_KEY_ARTIST', 'dc:creator');
define('UI_MDATA_KEY_DURATION', 'dcterms:extent');
define('UI_MDATA_KEY_URL', 'ls:url');
require_once dirname(__FILE__).'/../../storageServer/var/conf.php';
## LS classes/functions #############################################
require_once dirname(__FILE__).'/ui_base.inc.php';
require_once dirname(__FILE__).'/ui_scratchpad.class.php';
require_once dirname(__FILE__).'/ui_playlist.class.php';
require_once dirname(__FILE__).'/ui_search.class.php';
require_once dirname(__FILE__).'/ui_browse.class.php';
require_once dirname(__FILE__).'/../../storageServer/var/GreenBox.php';
require_once dirname(__FILE__).'/formmask/general.inc.php';
require_once dirname(__FILE__).'/ui_calendar.class.php';
require_once dirname(__FILE__).'/ui_scheduler.class.php';
## well known classes ###############################################
require_once 'DB.php';
require_once 'HTML/QuickForm.php';
#PEAR::setErrorHandling(PEAR_ERROR_TRIGGER, E_USER_WARNING);
#PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'errCallBack');
PEAR::setErrorHandling(PEAR_ERROR_RETURN);
#PEAR::setErrorHandling(PEAR_ERROR_PRINT);
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 911 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 911 B

View File

@ -222,17 +222,22 @@ switch($_REQUEST['act']){
$uiHandler->SCHEDULER->setReload();
break;
case "SCHEDULER.displaySchedule":
$uiHandler->SCHEDULER->displaySchedule();
case "SCHEDULER.uploadPlaylistMethod":
$uiHandler->SCHEDULER->uploadPlaylistMethod($_REQUEST);
$uiHandler->SCHEDULER->setReload();
break;
default:
$_SESSION["alertMsg"] = tra("Unknown method: $1", $_REQUEST["act"]);
#header("Location: ".UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close');
die();
$uiHandler->_retMsg("Unknown method: $1", $_REQUEST["act"]);
$uiHandler->redirUrl = UI_BROWSER;
if ($_REQUEST['was_popup'])
$uiHandler->redirUrl .= '?popup[]=_reload_parent&popup[]=_close';
}
if ($uiHandler->alertMsg) $_SESSION['alertMsg'] = $uiHandler->alertMsg;
#header('Location: '.$uiHandler->redirUrl);
if (ob_get_contents()) {
$ui_wait = 5;
}
ob_end_clean
?>
<meta http-equiv="refresh" content="0; URL=<?php echo $uiHandler->redirUrl; ?>">
<meta http-equiv="refresh" content="<?php echo $ui_wait ? $ui_wait : 0; ?>; URL=<?php echo $uiHandler->redirUrl; ?>">

View File

@ -3,7 +3,7 @@
<table border=1>
<tr><th colspan="8">{$SCHEDULER->curr.year}-{$SCHEDULER->curr.month}-{$SCHEDULER->curr.day}</th></tr>
<tr> <td></td>
<tr> <td>&nbsp;</td>
{foreach from=$SCHEDULER->Week item="_Weekday"}
<td>{$_Weekday.label.short}</td>
{/foreach}
@ -11,17 +11,19 @@
{foreach from=$SCHEDULER->Month item="_Day"}
{if $_Day.isFirst}
<tr>
<th><a href="#" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&week={$_Day.week}')">{$_Day.week}</a></th>
<th><a href="#" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&view=week&day={$_Day.day}&month={$_Day.month}')">{$_Day.week}</a></th>
{/if}
<td>
{if $_Day.isEmpty}
&nbsp;
{elseif $_Day.isSelected}
<b>{$_Day.day}</b>
{else}
<a href="#" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&day={$_Day.day}')">{$_Day.day}</a>
{/if}
{if $_Day.isEmpty}
<div>
{elseif $_Day.isSelected}
<div style="background-color: lightblue">
{else}
<div style="background-color: white">
{/if}
<a href="#" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&day={$_Day.day}&month={$_Day.month}')">{$_Day.day}</a>
</div>
</td>
{if $_Day.isLast}
</tr>

View File

@ -12,7 +12,7 @@
{/if}
</td>
<td align="center">{$i.type}</td>
<td><a href="#" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.uploadPL&gunid={$i.gunid}')">{$i.gunid}</td>
<td><a href="#" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.uploadPlaylistMethod&gunid={$i.gunid}')">{$i.gunid}</td>
</tr>
{/foreach}
</table>

View File

@ -4,7 +4,7 @@
<input type="button" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&view=day')" value="Day">
<input type="button" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&view=week')" value="Week">
<input type="button" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&view=month')" value="Month">
<input type="button" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.displaySchedule')" value="Display Scheduler">
<input type="button" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&view=input')" value="Schedule">
{include file="scheduler/calendar.tpl"}

View File

@ -1,4 +1,4 @@
{$SCHEDULER->buildMonth()}
{$SCHEDULER->buildMonth()}
{$SCHEDULER->buildWeek()}
Month View
@ -7,11 +7,13 @@ Month View
<tr>
{foreach from=$SCHEDULER->Week item="_Weekday"}
<td>{$_Weekday.label.full}</td>
<th>{$_Weekday.label.full}</th>
{/foreach}
</tr>
{foreach from=$SCHEDULER->Month item="_Day"}
{assign var="percentage" value=$SCHEDULER->getDayUsagePercentage($_Day.year, $_Day.month, $_Day.day)}
{if $_Day.isFirst}
<tr>
{/if}
@ -19,7 +21,10 @@ Month View
{if $_Day.isEmpty}
<td>&nbsp;</td>
{else}
<td><a href="#" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&day={$_Day.day}')">{$_Day.day}</td>
<td width="80">
<a href="#" onClick="hpopup('{$UI_HANDLER}?act=SCHEDULER.set&day={$_Day.day}')">{$_Day.day}
<div><img src="img/percentage_red.png" width="{if $percentage>50}{$percentage}{elseif $percentage>0}{$percentage+2}{else}0{/if}%" height="10" border="0"><img src="img/percentage_blue.png" width="{if $percentage>50}{$null-$percentage+100}{elseif $percentage>0}{$NULL-$percentage-2+100}{else}100{/if}%" height="10" border="0"></div>
</td>
{/if}
{if $_Day.isLast}

View File

@ -33,7 +33,7 @@
{
var screenX;
var screenY;
url = url + '&was_popup=1';
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, left='+screenX+', top='+screenY;
@ -44,6 +44,7 @@
function hpopup(url, name) //hidden popup! 'width=1, height=1'
{
url = url + '&was_popup=1';
popupwin = window.open(url, name);
//window.parent.focus();
}

View File

@ -259,7 +259,8 @@ class uiBase
if ($format=='text') {
return "<div align='left'><pre>".var_export($ia, TRUE)."</pre></div>";
} elseif ($format=='xml') {
return '<?xml version="1.0" encoding="utf-8"?>
return '!!!XML IS DEPRICATED!!!
<?xml version="1.0" encoding="utf-8"?>
<audioClip>
<metadata
xmlns:dc="http://purl.org/dc/elements/1.1/"
@ -268,7 +269,7 @@ class uiBase
xmlns:ls="http://mdlf.org/livesupport/elements/1.0/"
>
<dc:title>'.$this->_getFileTitle($id).'</dc:title>
<dcterms:extent>'.date('H:i:s', round($s)-date('Z')).substr(number_format($s, 6), strpos(number_format($s, 6), '.')).'</dcterms:extent>
<dcterms:extent>'.$extent.'</dcterms:extent>
</metadata>
</audioClip>';

View File

@ -3,37 +3,17 @@ session_start();
## LS classes/functions #############################################
require_once dirname(__FILE__).'/conf.php';
require_once dirname(__FILE__).'/ui_base.inc.php';
require_once dirname(__FILE__).'/ui_browser.class.php';
require_once dirname(__FILE__).'/ui_scratchpad.class.php';
require_once dirname(__FILE__).'/ui_playlist.class.php'; #
require_once dirname(__FILE__).'/ui_search.class.php';
require_once dirname(__FILE__).'/ui_browse.class.php';
require_once dirname(__FILE__).'/../../storageServer/var/GreenBox.php';
require_once dirname(__FILE__).'/formmask/general.inc.php';
require_once dirname(__FILE__).'/ui_calendar.class.php';
require_once dirname(__FILE__).'/ui_scheduler.class.php';
## well known classes ###############################################
require_once dirname(__FILE__).'/Smarty/libs/Smarty.class.php';
require_once 'DB.php';
require_once 'HTML/QuickForm.php';
require_once 'HTML/QuickForm/Renderer/ArraySmarty.php';
#PEAR::setErrorHandling(PEAR_ERROR_TRIGGER, E_USER_WARNING);
#PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'errCallBack');
PEAR::setErrorHandling(PEAR_ERROR_RETURN);
#PEAR::setErrorHandling(PEAR_ERROR_PRINT);
## initialize objects ###############################################
$Smarty =& new Smarty;
$uiBrowser =& new uiBrowser($config);
#$uiBase = new uiBase($config);
$uiBase =& $uiBrowser;
#$uiScratchPad = new uiScratchPad(&$uiBrowser);
## load Smarty+filters ##############################################
require_once dirname(__FILE__).'/SmartyExtensions.inc.php';
@ -59,8 +39,7 @@ $Smarty->assign('USER', array('sessid' => &$uiBrowser->sessid,
));
$uiBrowser->loadStationPrefs($ui_fmask['stationPrefs']);
$Smarty->assign('STATIONPREFS', $uiBrowser->STATIONPREFS);
## retransfer incomplete formdata from SESSION to POST-data #########
if (is_array($_SESSION['retransferFormData'])){
foreach($_SESSION['retransferFormData'] as $k=>$v){

View File

@ -26,6 +26,8 @@ class uiCalendar
$this->Month[] = array(
'day' => $this->Base->_twoDigits($Day->thisDay()),
'week' => $this->_getWeekNr($Day),
'month' => $this->Base->_twoDigits($Day->thisMonth()),
'year' => $Day->thisYear(),
'isEmpty' => $Day->isEmpty(),
'isFirst' => $Day->isFirst(),
'isLast' => $Day->isLast(),
@ -52,6 +54,7 @@ class uiCalendar
}
function buildDay()
{
if (is_array($this->Day)) return FALSE;
@ -66,6 +69,7 @@ class uiCalendar
}
function buildHour()
{
require_once 'Calendar/Hour.php';

View File

@ -175,9 +175,13 @@ class uiHandler extends uiBase {
function transMData($id)
{
include dirname(__FILE__).'/formmask/metadata.inc.php';
$this->gb->replaceMetadata($id, $this->_analyzeFile($id, 'xml'), 'string', $this->sessid);
#$this->gb->replaceMetadata($id, $this->_analyzeFile($id, 'xml'), 'string', $this->sessid);
$ia = $this->gb->analyzeFile($id, $this->sessid);
$s = $ia['playtime_seconds'];
$extent = date('H:i:s', floor($s)-date('Z')).substr(number_format($s, 6), strpos(number_format($s, 6), '.'));
$this->_setMdataValue($id, UI_MDATA_KEY_DURATION, $extent);
foreach ($mask['pages'] as $key=>$val) {
foreach ($mask['pages'][$key] as $k=>$v) {
if ($v['id3'] != FALSE) {

View File

@ -1,33 +1,13 @@
<?php
session_start();
## LS classes/functions #############################################
require_once dirname(__FILE__).'/conf.php';
require_once dirname(__FILE__).'/ui_base.inc.php';
require_once dirname(__FILE__).'/ui_handler.class.php';
require_once dirname(__FILE__).'/ui_scratchpad.class.php';
require_once dirname(__FILE__).'/ui_playlist.class.php';
require_once dirname(__FILE__).'/ui_search.class.php';
require_once dirname(__FILE__).'/ui_browse.class.php';
require_once dirname(__FILE__).'/../../storageServer/var/GreenBox.php';
require_once dirname(__FILE__).'/formmask/general.inc.php';
require_once dirname(__FILE__).'/ui_calendar.class.php';
require_once dirname(__FILE__).'/ui_scheduler.class.php';
## well known classes ###############################################
require_once 'DB.php';
require_once 'HTML/QuickForm.php';
#PEAR::setErrorHandling(PEAR_ERROR_TRIGGER, E_USER_WARNING);
#PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'errCallBack');
PEAR::setErrorHandling(PEAR_ERROR_RETURN);
#PEAR::setErrorHandling(PEAR_ERROR_PRINT);
## initialize objects ###############################################
$uiHandler =& new uiHandler($config);
#$uiBase = new uiBase($config);
$uiBase =& $uiHandler;
#$uiScratchPad =& new uiScratchPad(&$uiHandler);
ob_start();
?>

View File

@ -15,6 +15,7 @@ class uiScheduler extends uiCalendar
$this->reloadUrl = UI_BROWSER.'?popup[]=_reload_parent&popup[]=_close';
$this->uiCalendar();
$this->initXmlRpc();
}
@ -27,23 +28,58 @@ class uiScheduler extends uiCalendar
{
extract($arr);
if ($view) $this->curr['view'] = $view;
if ($year) $this->curr['year'] = $year;
if ($month) $this->curr['month']= $month;
if ($day) $this->curr['day'] = $day;
if ($hour) $this->curr['hour'] = $hour;
}
function displaySchedule()
function _datetime2timestamp($i)
{
$formatted = $i[0].$i[1].$i[2].$i[3].'-'.$i[6].$i[7].'-'.$i[4].$i[5].strrchr($i, 'T');
#echo $formatted;
return strtotime($formatted);
}
function getDayUsagePercentage($year, $month, $day)
{
$duration = 0;
$date = $year.$month.$day;
$arr = $this->displayScheduleMethod($date.'T00:00:00', $date.'T23:59:59.999999');
if (!count($arr)) {
return FALSE;
}
foreach ($arr as $val) {
$duration =+ $this->_datetime2timestamp($val['end'])-$this->_datetime2timestamp($val['start']);
}
return $duration/86400*100;
}
## XML-RPC methods ############################################################################################
function initXmlRpc()
{
include_once dirname(__FILE__).'/SchedulerPhpClient.class.php';
$this->spc =& SchedulerPhpClient::factory($this->Base->dbc, $mdefs, $this->Base->config);
}
// scheduler client instantiation:
$spc =& SchedulerPhpClient::factory($this->Base->dbc, $mdefs, $this->Base->config);
// call of chosen function by name according to key values in $mdefs array:
// (for testing on storageServer XMLRPC I've changes confPrefix in
// SchedulerPhpClient constructor from 'scheduler' to 'storage' value)
$r = $spc->DisplayScheduleMethod($this->Base->sessid, '2005-01-01 00:00:00.000000', '2005-02-01 00:00:00.000000');
function uploadPlaylistMethod(&$formdata)
{
$gunid = $formdata['gunid'];
$datetime = $formdate['datetime'];
$r = $this->spc->UploadPlaylistMethod($this->Base->sessid, $gunid, '20050308T04:44:00.000000'.UI_TIMEZONE);
var_dump($r);
}
function displayScheduleMethod($from, $to)
{
$r = $this->spc->displayScheduleMethod($this->Base->sessid, $from, $to);
return $r;
}
}
?>

View File

@ -66,7 +66,7 @@ class uiScratchPad
function addItem($id)
{
if(!$this->Base->STATIONPREFS[UI_SCRATCHPAD_MAXLENGTH_KEY]) {
if ($this->verbose) $this->Base->_retMsg('ScratchPad length is not set in System Preferences, so it cannot be used.');
if (!$this->verbose) $this->Base->_retMsg('ScratchPad length is not set in System Preferences, so it cannot be used.');
return false;
}