Skip to content

Commit

Permalink
#46
Browse files Browse the repository at this point in the history
  • Loading branch information
tihhanovski committed Jul 12, 2016
1 parent f2e174c commit 95df606
Show file tree
Hide file tree
Showing 26 changed files with 372 additions and 97 deletions.
9 changes: 0 additions & 9 deletions classes/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,6 @@ function getVersion()
return "";
}

/**
* app top menu class to distinguish test version from production
* @return String
*/
function getTopMenuClass()
{
return "topMenu" . (defined("TOPMENU_COLOR") ? " " . TOPMENU_COLOR : "");
}

/**
* Is it possible for new users to add themselves, not implemented yet
* @return bool
Expand Down
2 changes: 1 addition & 1 deletion classes/RequestHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ function mainMenu()
{
if(!app()->user()->isNew())
{
echo app()->uiHelper()->getMainMenu()->toHtml();
echo app()->ui()->getMainMenu()->toHtml();
echo hr(),
linkItem("document.location = '" . app()->url() . "';", "Frontpage"),
linkItem("app.mainMenu();", "close");
Expand Down
11 changes: 3 additions & 8 deletions classes/UIHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@ class UIHelper

public function getMainMenu()
{
if(!isset($this->mainMenu))
{
if(!defined(MAIN_MENU_CLASS))
define("MAIN_MENU_CLASS", "MainMenu");
if(class_exists($cls = MAIN_MENU_CLASS))
$this->mainMenu = new $cls;
}
return $this->mainMenu;
return app()->ui()->getMainMenu();
}

public function includeStyles()
Expand All @@ -26,6 +19,7 @@ public function includeStyles()
//SETUP_3RD_COMBOGRID_CSS2,
//SETUP_3RD_COMBOGRID_CSS, //combogrid
SETUP_JQUERY_UI_CSS,
app()->ui()->url("css/styles.css"),
app()->url("resources/ui.css"),
SETUP_3RD_MULTISELECT_CSS,
L3RD_METISMENU_CSS,
Expand Down Expand Up @@ -59,6 +53,7 @@ public function includeScripts()
WFW_WEB . "js/messagesControl.js",
WFW_WEB . "js/commentsControl.js",
WFW_WEB . "js/combobox.js",
app()->ui()->url("js/mainMenu.js"),
);

foreach ( $scripts as $src)
Expand Down
2 changes: 1 addition & 1 deletion classes/ddl/DBDocumentor.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ function getTables()
$ts = array();
$q = app()->query("show tables");
$this->db = $q->dbh->dsn["database"];
while($q->fetchInto($o, DB_FETCHMODE_ARRAY))
while($q->fetchInto($o, 0))
$ts[strtolower($o[0])] = new DBDocTableData($this->db, $o[0]);

ksort($ts); //TODO PHP 5.4 | SORT_FLAG_CASE
Expand Down
17 changes: 17 additions & 0 deletions classes/ui/AbstractUIModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ public function getFilePath($path)
return $modulePath . $path;
}

public function includeFile($path)
{
include $this->getFilePath($path);
}

public function url($path)
{
return app()->url(UI_MODULE . $path);
Expand All @@ -67,4 +72,16 @@ public function outputFrontpage()
{
include $this->getFilePath("html/frontpage.php");
}

//misc functions
/**
* app top menu class to distinguish test version from production
* @return String
*/
function getTopMenuClass()
{
return "topMenu" . (defined("TOPMENU_COLOR") ? " " . TOPMENU_COLOR : "");
}


}
12 changes: 9 additions & 3 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,14 @@ var app = {

"rightPanelThreshold": 30,

"resizeMainMenu": function()
{
var w = $(window).width();
$("#mainMenu").offset({ top: 30, left: 0 })
.width(w - 100)
.height($(window).height() - 130);
},

"start": function()
{
try
Expand All @@ -210,9 +218,7 @@ var app = {
var w = $(window).width();
$(".rightPanel").css("left", w - $(".rightPanel").width() - app.rightPanelThreshold);

$("#mainMenu").offset({ top: 30, left: 0 })
.width(w - 100)
.height($(window).height() - 130);
app.resizeMainMenu();

//$(".formRowLocked").width(w - 40);
//$(".formInputContainerLocked").width(w - 270); //TODO test 05.02.2016
Expand Down
2 changes: 1 addition & 1 deletion ui/edit.start.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<body><?php include "topmenu.php"; ?><div class="editorContent"><div id="doc_warnings" class="docWarningContainer"></div><?php
<body><?php include app()->ui()->getFilePath("html/topmenu.php"); ?><div class="editorContent"><div id="doc_warnings" class="docWarningContainer"></div><?php

if(isset($context) && isset($context->obj))
$obj = $context->obj;
2 changes: 1 addition & 1 deletion ui/index.default.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
});
});

</script><div id="dh" class="mainMenuTopDiv <?=app()->getTopMenuClass()?>">
</script><div id="dh" class="mainMenuTopDiv <?=app()->ui()->getTopMenuClass()?>">
<div style="float: left; font-size: 32px; font-weight: bold; color: #505050;"><?=APP_TITLE . ($cn ? " / " . $cn : "")?></div>
<div style="float: right;">
<div><a href="JavaScript:logout();"><?=t("Logout")?></a></div>
Expand Down
2 changes: 1 addition & 1 deletion ui/index.start.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<body style="overflow: hidden;"><div class="pageHeader"><?php include "topmenu.php"; ?><div class="topMenuPlaceholder"></div>
<body style="overflow: hidden;"><div class="pageHeader"><?php include app()->ui()->getFilePath("html/topmenu.php"); ?><div class="topMenuPlaceholder"></div>
76 changes: 76 additions & 0 deletions ui/old/classes/OldMainMenu.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php
/**
* MainMenu
* @author Ilja Tihhanovski <[email protected]>
* @copyright (c) 2015 Intellisoft OÜ
*
*/

class OldMainMenu extends HtmlComponent
{
public function toHtml()
{
$ret = "";

$widgets = array();
foreach (app()->registries() as $widget)
if($widget->typeId == ROBJECT_TYPE_SIMPLEWIDGET)
$widgets[] = $widget;
if(count($widgets))
{
$ret .= "<div class=\"mainMenuWidgets\">";

foreach ($widgets as $widget)
if(file_exists($fn = app()->getAbsoluteFile("registries/" . $widget->name . "/" . $widget->name . ".wt.php")))
include $fn;

$ret .= "</div><div class=\"clearBoth\"></div>";
}


$p = app()->dbo("menupart");
$p->orderBy("id");
$parts = array();
if($p->find())
while($p->fetch())
$parts[] = clone $p;

$ret .= "<table border=\"0\" cellspacing=\"20\">";
$ret .= "<tr><td></td>";
foreach ( $parts as $p )
$ret .= "<td>" . t($p->name) . "</td>";
$ret .= "</tr>";

$m = app()->dbo("rmodule");
$m->orderBy("pos");
if($m->find())
while($m->fetch())
{
$tcnt = 0;
$mh = "<tr><td valign=\"top\" align=\"right\">" . t($m->name) . "</td>";
foreach ( $parts as $p )
{
$l = array();
foreach (app()->registries() as $val)
if(($val->module == $m->getIdValue()) && ($val->menupartId == $p->getIdValue()) && ($val->typeId < 10)) //TODO
$l[] = $val;

$mh .= "<td valign=\"top\">";

$cnt = 0;
foreach ($l as $val)
{
$mh .= mi($val);
$cnt++;
$tcnt++;
}
$mh .= "</td>";
}
$mh .= "</tr>";

if($tcnt) $ret .= $mh;
}
$ret .= "</table>";
return $ret;
}
}
19 changes: 19 additions & 0 deletions ui/old/classes/OldToolbar.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
/**
* MainMenu
* @author Ilja Tihhanovski <[email protected]>
* @copyright (c) 2015 Intellisoft OÜ
*
*/

class OldToolbar extends HtmlComponent
{
public function toHtml()
{
$ret = '<div id="dh" class="frontpageTopMenu">
<div class="frontpageCaption">
<img src="<?=app()->url("resources/p2logo.png")?>" border="0" height="24"/>
<?=APP_TITLE . ($cn ? " / " . $cn : "")?>
</div>' . app()->ui()->getUserMenu()->toHtml() . '</div>';
}
}
File renamed without changes.
22 changes: 22 additions & 0 deletions ui/old/classes/OldUserMenu.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
/**
* MainMenu
* @author Ilja Tihhanovski <[email protected]>
* @copyright (c) 2015 Intellisoft OÜ
*
*/

class OldUserMenu extends HtmlComponent
{
public function toHtml()
{
return '<div class="squaredUserMenu">
<div>
<!--a href="JavaScript:logout();"><?=t("Logout")?></a-->
<i class="userMenuItem fa fa-share-alt" aria-hidden="true"></i>
<i class="userMenuItem fa fa-user" aria-hidden="true"></i>
<i class="userMenuItem fa fa-cog" aria-hidden="true"></i>
</div>
</div>';
}
}
27 changes: 27 additions & 0 deletions ui/old/css/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.mainMenu
{
color: #505050;
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#E0FFFFFF,endColorstr=#E0FFFFFF);
background: rgba(255,255,255,0.95);
position: fixed;
overflow: auto;
padding: 50px;
z-index: 30;
}

.mainMenuItem
{
width: 150px;
height: 40px;
float: left;
font-size: 14px;
font-weight: bold;
cursor: pointer;
text-align: left;
padding: 10px;
}

.mmi
{
margin-bottom: 10px; margin-right: 20px;
}
2 changes: 1 addition & 1 deletion ui/old/html/frontpage.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function showNews()
}, "json");
}

</script><div id="dh" class="mainMenuTopDiv <?=app()->getTopMenuClass()?>">
</script><div id="dh" class="mainMenuTopDiv <?=app()->ui()->getTopMenuClass()?>">
<div style="float: left; font-size: 32px; font-weight: bold; color: #505050;"><?=APP_TITLE . ($cn ? " / " . $cn : "")?></div>
<div style="float: right;">
<div><a href="JavaScript:logout();"><?=t("Logout")?></a></div>
Expand Down
6 changes: 6 additions & 0 deletions ui/old/html/topmenu.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div class="<?=app()->ui()->getTopMenuClass()?>"><div class="appIcon"><img src="<?=app()->url("resources/webicon.png")?>" width="16" height="16" border="0"/></div><div class="topMenuItem" id="toolbar_MainMenu"><a href="<?=app()->url()?>" tabindex="-1"><b><?=app()->getPageTitle()?></b></a></div><div id="toolbar_UserMenu" class="topMenuRightItem" style="margin-right: 20px;"><?=app()->isI18n() ? "<span onclick=\"JavaScript:app.userMenu();\">" . app()->getLocale() . "</span> " : ""?><a href="JavaScript:app.userMenu();" tabindex="-1"><?=app()->user()->uid?></a></div><div id="toolbar_Help" class="topMenuRightItem"><?php

if($h = app()->helpLink())
echo "<a href=\"$h\" target=\"_blank\" tabindex=\"-1\"><img src=\"" . app()->url("ui/img/16/help.png") . "\" alt=\"\" border=\"0\"/></a>";

?></div><?=$this->getTopToolbar()?></div><div id="mainMenu" class="mainMenu" style="display: none;"></div>
10 changes: 8 additions & 2 deletions ui/old/index.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<?php

$uiModuleDir = app()->getAbsoluteFile(UI_MODULE);
require_once $uiModuleDir . "OldUIModule.php";
//require_once $uiModuleDir . "OldUIModule.php";

app()->_uiModule = new OldUIModule();
$uiModuleDir = app()->getAbsoluteFile(UI_MODULE);
require_once $uiModuleDir . "classes/OldUIModule.php";
require_once $uiModuleDir . "classes/OldMainMenu.php";
require_once $uiModuleDir . "classes/OldToolbar.php";
require_once $uiModuleDir . "classes/OldUserMenu.php";

app()->_uiModule = new OldUIModule("Old");
2 changes: 1 addition & 1 deletion ui/report.index.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

?><body><?php

include "topmenu.php";
include app()->ui()->getFilePath("html/topmenu.php");

?><div class="editorContent"><div class="reportInputContents"><?php

Expand Down
22 changes: 19 additions & 3 deletions ui/squared/classes/SquaredMainMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,25 @@
*
*/

class SquaredMainMenu extends HtmlComponent
class SquaredMainMenuItem extends HtmlComponent
{
public $icon, $href, $caption;
public $items = array();

public function __construct($icon, $href, $caption)
{
$this->icon = $icon;
$this->href = $href;
$this->caption = $caption;
}
}

class SquaredMainMenu extends SquaredMainMenuItem
{
public $items = array();



public function toHtml()
{
$p = app()->dbo("menupart");
Expand Down Expand Up @@ -69,8 +86,7 @@ public function toHtml()
"</li>";
}

$ret .= "</ul></nav></aside>" .
"<script src=\"" . app()->ui()->url("js/mainMenu.js") . "\"></script>";
$ret .= "</ul></nav></aside>";


return $ret;
Expand Down
Loading

0 comments on commit 95df606

Please sign in to comment.