Skip to content

Commit

Permalink
fixed yapp dependencies to vdir handling, added local stylesheet and …
Browse files Browse the repository at this point in the history
…updated yapp_intro documentation

git-svn-id: https://erlyaws.svn.sourceforge.net/svnroot/erlyaws/trunk/yaws@1114 9fbdc01b-0d2c-0410-bfb7-fb27d70d8b52
  • Loading branch information
Mikael Karlsson committed Apr 9, 2007
1 parent f25346c commit b866cf9
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 62 deletions.
4 changes: 2 additions & 2 deletions applications/yapp/priv/docroot/HEAD.inc
Expand Up @@ -9,7 +9,7 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<meta name="keywords" content="Yaws"/>
<title>Yapp</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<link rel="stylesheet" type="text/css" href="/stil.css"/>
<link rel="stylesheet" type="text/css" href="stil.css"/>
<link rel="shortcut icon" href="/icons/yaws_y.gif" type="image/x-icon"/>
</head>

Expand All @@ -22,7 +22,7 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

<div id="sidebar">
<h4> Yapp </h4>
<div class="%%list%%"> <a href="list.yaws" id="list">List</a></div>
<div class="%%list%%"> <a href="index.yaws" id="list">List</a></div>
<div class="%%add%%"> <a href="add.yaws" id="Add" >Add</a> </div>
<div class="%%remove%%"> <a href="remove.yaws" id="remove">Remove</a> </div>
</div>
Expand Down
38 changes: 35 additions & 3 deletions applications/yapp/priv/docroot/index.yaws
@@ -1,7 +1,39 @@

<erl>
%% Bootstrap page to handle both "/xxx" and "/xxx/" root paths
out(A) -> {ssi, "HEAD.inc","%%",[{"list", "choosen"}]}.
</erl>

<h3>Yapp list</h3>

<erl>

format_yapp_tables([]) -> [];
format_yapp_tables([{ServId,Yapps}|T]) ->
[{h3,[], ["Server id : ", ServId]}, [{p,[],format_yapp_table(Yapps)}] |
format_yapp_tables(T)].

format_yapp_table(Yapps) ->
{table,[{border,"1"}],
[{tr,[],[{th,[],"Application"},{th,[],"Url"},{th,[],"Docroot"}]} |
format_yapps(Yapps)]
}.

format_yapps([]) ->
[];
format_yapps([{yapp, Urlpath, Docroot, Appname, Appmods, _Opaque}|T]) ->
[{tr,[],[{td,[],atom_to_list(Appname)}, {td,[], Urlpath},{td,[],Docroot}]} |
format_yapps(T)].

out(A) ->
Redir = yapp:prepath(A) ++ "/list.yaws",
{redirect, Redir }.
Header = "Cache-Control:no-store",
[{header, Header},
{ehtml, format_yapp_tables(yapp:get_yapps())}].

</erl>

<erl>
out(A) -> {ssi,"END.inc",[],[]}.
</erl>



38 changes: 0 additions & 38 deletions applications/yapp/priv/docroot/list.yaws

This file was deleted.

68 changes: 68 additions & 0 deletions applications/yapp/priv/docroot/stil.css
@@ -0,0 +1,68 @@


html {margin: 0; padding: 0;}

body {font: 12px Verdana, Arial, Helvetica, sans-serif;
margin: 0; padding: 0;
background: rgb(95%,95%,95%); color: black;}

h1 {font-size: 200%; text-transform: lowercase; letter-spacing: 3px;
margin: 0.66em 0 0.33em 3%; padding: 0;}

h3 {font-size: 133%; margin: 0; padding: 0;
border-bottom: 1px solid black;}

h4 {font-size: 100%; margin: 0; padding: 0.33em 0 0;
border-bottom: 1px solid rgb(50%,50%,35%);
color: rgb(50%,50%,35%);}


h5 {font-size: 100%; margin: 0; padding: 0.33em 0 0;
color: rgb(50%,50%,35%);}

p {line-height: 1.66; margin: 0.5em 0 1em 3em;}


div.logo {margin: 3em;}


div#entry {margin: 0 33% 1em 7%; padding: 0;}

div#sidebar {position: absolute; top: 4em; right: 0; width: 20%; font-size: 11px;}

div#sidebar a {display: block; padding: 8px 0 2px 10px; margin: 0;
border-left: 1px solid rgb(50%,50%,35%);}

div#sidebar a:hover {background: rgb(221,221,221);}

div.links {
background: green;
}

div.box { border: solid; border-width: thin; width: 96%;
background: rgb(211, 211, 211) }

div.news { border: solid; border-width: thin; width: 96%;
border-bottom: 3px solid black;
margin: 18px 5px 2px 10px;
background: rgb(211, 211, 211) }

div.box pre {margin: 0.66em 0 0.33em 1%; padding: 0;}

div.man { border: solid; border-width: thin; width: 100%;
font-size: 90%;
margin : 4;
background: rgb(211,211,211) }


div.choosen {border: solid; border-width: thin;
background: rgb(231, 231, 231) }

div.none { }



I { font-size : 12px;
font-family: Times, Verdana, Arial, Helvetica, sans-serif;}


30 changes: 17 additions & 13 deletions applications/yapp/src/yapp.erl
Expand Up @@ -100,25 +100,29 @@ arg_rewrite(Arg) ->
undefined ->
Arg;
{#yapp{urlpath = YappPath, docroot = Docroot,
appmods = YappMods, opaque = YOpaque }, Rest} ->
appmods = YappMods, opaque = YOpaque }, _Rest} ->

%% Add Yapp appmods, Yaws uses process dictionary...
DocMount =
case string:right(YappPath,1) of
"/" -> YappPath;
_ -> YappPath ++ "/"
end,

VDir = {"vdir", DocMount ++ " " ++ Docroot},

AddOpaque = [ VDir | YOpaque],

%% Add Yapp appmods, Yaws uses process dictionary.
SC = get(sc),
AppMods = SC#sconf.appmods,

Opaque = SC#sconf.opaque,
SC2 = SC#sconf{docroot = Docroot,
appmods = AppMods ++ YappMods, opaque = YOpaque ++ Opaque},

SC2 = SC#sconf{docroot=Docroot, appmods = AppMods ++ YappMods,
opaque = AddOpaque ++ Opaque},
put(sc, SC2),

Req = Arg#arg.req,
Opaque2 = Arg#arg.opaque,
NewReq = Req#http_request{path={abs_path,Rest}},

Arg#arg{docroot=Docroot,
req=NewReq, state=[{?prepath,YappPath}], opaque = YOpaque ++ Opaque2}

Arg#arg{docroot=Docroot, docroot_mount=DocMount,
opaque = AddOpaque ++ Opaque2}
end.


Expand All @@ -144,7 +148,7 @@ start() ->
%% fun or an erl section in a .yaws file to get the Yapp root
%% path.
prepath(Arg) ->
proplists:get_value(?prepath,Arg#arg.state,"").
Arg#arg.docroot_mount.


%% @spec log(Level, FormatStr::string(), Args) -> void()
Expand Down
8 changes: 2 additions & 6 deletions www/yapp_intro.yaws
Expand Up @@ -150,10 +150,10 @@ out(A) ->
{vsn,\"0.1\"},
{modules,[]},
{registered, []},
% {mod,{myapp1_mod,[]}}, %% Only needed if the application needs to be started
% {mod,{myapp1_app,[]}}, %% Only needed if the application needs to be started
{env, [
{yapp_docroot,\"www\"},
{yapp_appmods,[{\"/\",erlyweb}]},
{yapp_appmods,[{\"erlyweb\",erlyweb}]},
{yapp_opaque,[{\"appname\",\"myapp1\"}]}
]},
{applications,[kernel,stdlib]}]}.
Expand All @@ -163,10 +163,6 @@ out(A) ->

{h2,[],"Problems"},
{p,[],"Embedded ssi directives in ehtml parts will not work for now."},
{p,[],
"http://servername/yappname (without a trailing \"/\") will not work unless "
"a redirect is done in the index.yaws file, see the index.yaws file in "
"the yapp handler itself (yaws/applications/yapp/priv/docroot/index.yaws). "},

{h2,[],"Future"},
{p,[],
Expand Down

0 comments on commit b866cf9

Please sign in to comment.