Example #1
0
$pageName = $langCreateDoc;

$uploadPath = $editPath = false;
if (isset($_GET['uploadPath'])) {
    $uploadPath = q($_GET['uploadPath']);
} elseif (isset($_GET['editPath'])) {
    $editPath = q($_GET['editPath']);
    $uploadPath = my_dirname($editPath);
}

if (defined('EBOOK_DOCUMENTS')) {
    $navigation[] = array('url' => 'edit.php?course=' . $course_code . '&id=' . $ebook_id, 'name' => $langEBookEdit);
}

$backUrl = documentBackLink($uploadPath);

if ($can_upload) {
    $navigation[] = array('url' => $backUrl, 'name' => $toolName);
    if ($editPath) {
        $pageName = $langEditDoc;
        $info = Database::get()->querySingle("SELECT * FROM document WHERE $group_sql AND path = ?s", $editPath);
        $htmlFileName = "
      <div class='form-group'>
        <label for='file_name' class='col-sm-2 control-label'>$langFileName:</label>
        <div class='col-sm-10'>
          <p class='form-control-static'>" . q($info->filename) . "</p>
        </div>
      </div>";
        $htmlTitle = ' value="' . (Session::has('file_title') ? Session::get('file_title') : q($info->title)) . '"';
        $fileContent = Session::has('file_content') ? Session::get('file_content') : getHtmlBody($basedir . $info->path);
Example #2
0
/**
 * @brief A page that shows a table with statistic data and a gauge bar
 * @global type $langQuotaUsed
 * @global type $langQuotaPercentage
 * @global type $langQuotaTotal
 * @global type $langBack
 * @global type $langQuotaBar
 * @global type $course_code
 * @global type $subsystem
 * @global type $group_id
 * @global type $ebook_id
 * @param type $quota
 * @param type $used
 * @return string
 */
function showquota($quota, $used, $backPath = null)
{
    global $langQuotaUsed, $langQuotaPercentage, $langQuotaTotal, $langBack, $langQuotaBar, $course_code, $subsystem, $group_id, $ebook_id, $pageName;
    $retstring = '';
    // pososto xrhsimopoioumenou xorou se %
    if ($quota == 0) {
        $diskUsedPercentage = $used > 0 ? '100%' : '0%';
    } else {
        $diskUsedPercentage = round($used / $quota * 100) . '%';
    }
    // morfopoihsh tou synolikou diathesimou megethous tou quota
    $quota = format_bytesize($quota / 1024);
    // morfopoihsh tou synolikou megethous pou xrhsimopoieitai
    $used = format_bytesize($used / 1024);
    // telos diamorfwshs ths grafikh mparas kai twn arithmitikwn statistikwn stoixeiwn
    // ektypwsh pinaka me arithmitika stoixeia + thn grafikh bara
    $pageName = $langQuotaBar;
    if (!is_null($backPath)) {
        $retstring .= action_bar(array(array('title' => $langBack, 'url' => $backPath, 'icon' => 'fa-reply', 'level' => 'primary-label')));
    } else {
        $retstring .= action_bar(array(array('title' => $langBack, 'url' => documentBackLink($backPath), 'icon' => 'fa-reply', 'level' => 'primary-label')));
    }
    $retstring .= "\n    <div class='row'><div class='col-sm-12'>\n    <div class='form-wrapper'>\n    <form class='form-horizontal' role='form'>\n      <div class='form-group'>\n        <label class='col-sm-3 control-label'>{$langQuotaUsed}:</label>\n        <div class='col-sm-9'>\n          <p class='form-control-static'>{$used}</p>\n        </div>\n      </div>\n      <div class='form-group'>\n        <label class='col-sm-3 control-label'>{$langQuotaPercentage}:</label>\n        <div class='col-sm-9'>\n            <div class='progress'>\n              <p class='progress-bar active from-control-static' role='progressbar' aria-valuenow='" . str_replace('%', '', $diskUsedPercentage) . "' aria-valuemin='0' aria-valuemax='100' style='min-width: 2em; width: {$diskUsedPercentage};'>\n                {$diskUsedPercentage}\n              </p>\n            </div>\n        </div>\n      </div>\n      <div class='form-group'>\n        <label class='col-sm-3 control-label'>{$langQuotaTotal}:</label>\n        <div class='col-sm-9'>\n              <p class='form-control-static'>{$quota}</p>\n        </div>\n      </div>  \n    </form>\n    </div></div></div>";
    $tmp_cwd = getcwd();
    return $retstring;
}
Example #3
0
function directory_selection($source_value, $command, $entryToExclude, $directoryToExclude)
{
    global $langParentDir, $langTo, $langMove, $langCancel;
    global $groupset;
    $backUrl = documentBackLink($entryToExclude);
    if (!empty($groupset)) {
        $groupset = '?' . $groupset;
    }
    $dirList = directory_list();
    $dialogBox = "\n        <div class='row'>\n            <div class='col-xs-12'>\n                <div class='form-wrapper'>\n                    <form class='form-horizontal' role='form' action='{$_SERVER['SCRIPT_NAME']}{$groupset}' method='post'>\n                        <fieldset>\n                                <input type='hidden' name='source' value='" . q($source_value) . "'>\n                                <div class='form-group'>\n                                    <label for='{$command}' class='col-sm-2 control-label' >{$langMove} {$langTo}:</label>\n                                    <div class='col-sm-10'>\n                                        <select name='{$command}' class='form-control'>";
    if ($entryToExclude !== '/' and $entryToExclude !== '') {
        $dialogBox .= "<option value=''>{$langParentDir}</option>";
    }
    /* build html form inputs */
    foreach ($dirList as $path => $filename) {
        $disabled = '';
        $depth = substr_count($path, '/');
        $tab = str_repeat('&nbsp;&nbsp;&nbsp;', $depth);
        if ($directoryToExclude !== '/' and $directoryToExclude !== '') {
            $disabled = strpos($path, $directoryToExclude) === 0 ? ' disabled' : '';
        }
        if ($disabled === '' and $entryToExclude !== '/' and $entryToExclude !== '') {
            $disabled = $path === $entryToExclude ? ' disabled' : '';
        }
        $dialogBox .= "<option{$disabled} value='" . q($path) . "'>{$tab}" . q($filename) . "</option>";
    }
    $dialogBox .= "</select>\n                                        </div>\n                                </div>\n                                <div class='form-group'>\n                                    <div class='col-sm-offset-2 col-sm-10'>\n                                        <input class='btn btn-primary' type='submit' value='{$langMove}' >\n                                        <a href='{$backUrl}' class='btn btn-default' >{$langCancel}</a>\n                                    </div>\n                                </div>\n                        </fieldset>\n                    </form>\n                </div>\n            </div>\n        </div>";
    return $dialogBox;
}
Example #4
0
                <input type='hidden' size='80' name='file_date' value='$oldDate'>
                </fieldset>
                </form></div>";
        } else {
            $action_message = "<div class='alert alert-danger'>$langFileNotFound</div>";
        }
    }

    // Display form to modify metadata
    if (isset($_GET['metadata'])) {

        $metadata = $_GET['metadata'];
        $row = Database::get()->querySingle("SELECT filename FROM document WHERE $group_sql AND path = ?s", $metadata);
        if ($row) {
            $curDirPath = my_dirname($metadata);
            $backUrl = documentBackLink($curDirPath);
            $navigation[] = array('url' => $backUrl, 'name' => $pageName);
            $oldFilename = q($row->filename);
            $real_filename = $basedir . str_replace('/..', '', q($metadata));
            $dialogBox .= metaCreateForm($metadata, $oldFilename, $real_filename);
        } else {
            $action_message = "<div class='alert alert-danger'>$langFileNotFound</div>";
        }
    }

    // Visibility commands
    if (isset($_GET['mkVisibl']) || isset($_GET['mkInvisibl'])) {
        if (isset($_GET['mkVisibl'])) {
            $newVisibilityStatus = 1;
            $visibilityPath = $_GET['mkVisibl'];
        } else {