Вы находитесь на странице: 1из 96

http://www.allbest.

ru/

CMS ASP.NET

http://www.allbest.ru/

1.
2.
2.1
2.2. CMS
3.
3.1 Rumba XML
3.2 Made Simple
3.3 Kandidat CMS
3.4 Zimplit CMS
3.5 Get Simple
3.6
4.
4.1 UML
5.
5.1 C#
5.2 ASP.NET MVC 3
5.3 XML
5.4 ARGO UML UML
6.
6.1
6.2
7.
7.1
7.2
8.
9.

http://www.allbest.ru/
9.1

http://www.allbest.ru/


,
- . .

,
,
. .
,
. .

, HTML.
,
.
CMS (Content
Management System). CMS

).

, , .
,
, ,
.
,
, ,
. , CMS
, ,
, , , ,
-, .
CMS ,
. , -

http://www.allbest.ru/
- CMS
.
CMS ( ).
, ..
, .

CMS-, -, - ..

http://www.allbest.ru/
1.
web, , ,
-.

:
1. .
, ,
,
.
2. .


3.
.
.
4. .
,

, ,

.
5. .

.
6. .

.
.

http://www.allbest.ru/
CMS ,
, Web. , .
, , ,
.

http://www.allbest.ru/
2

2.1

,
, -.
CMS ,
. -

[1].



, ,
HTTP- :
http- http- html, , , - [1].
,
FreeBSD[2], Debian[3], Windows Server[4] .
- Apache[5] IIS[6]
, ,
. ,
Windows Server - Microsoft IIS[6].
Microsoft Internet Information Services
.
IIS 7.5 web-,
40 ,
web-,
.

http://www.allbest.ru/
,
[7].
IIS

7.0

,
.
IIS 7.5
, .
,
. API

, - .
Web- IIS
web-:
ASP.NET[8] Windows ,
, web- web-. ASP.NET
IIS 6.0.
ASP[9] web . IIS, 3.0.
CGI[10] .
ISAPI Windows ,
IIS.
CGI ISAPI web- IIS
web-, , PHP Perl.
IIS,
7.0, IIS Media Pack.
web- . Microsoft
-.

http://www.allbest.ru/
: ASF, AVI, FLV, M4V, MOV, MP3,
MP4, RM, RMVB, WMA, WMV.

Silverlight[11] .
. .

web-

( Apple Macintosh).

,
- .
.
2.2 CMS
CMS

flat-.
,
CMS,
CMS. ,

,
, .
CMS, ,
, txt, xml .
,
,

.

http://www.allbest.ru/
, ,
xml-.

http://www.allbest.ru/
3


, .

.

3.1

Rumba XML

web-, Rumba XML


2.8[12].
, CMS,
3.1.

3.1 , RumbaXML 2.8


3.2 .
CMS , ,
, .

CMS . ,
, ,
.

http://www.allbest.ru/

3.2 RumbaXML 2.8


,
, , , (
/ ),
,

URL

html,

. SEO ..
,
WordPress[13].
xml.

, PHP, ,
Yandex - narod.ru[14].

, , hut.ru,
.
,
, CMS .
[13].

http://www.allbest.ru/
3.2

Made Simple

CMS Made Simple[15].

3.3 , Made Simple 1.9.4


, CMS Made Simple,
3.3.

3.4 Made Simple 1.9.4


,
. 3.4
CMS.
CMS
. .
CMS,
,

http://www.allbest.ru/
web-[16].
,
. , Rumba XML
xml-.
. CMS
GNU GPL[16].

3.3 Kandidat CMS

Kandidat_CMS[17].

3.5 , Kandidat CMS 1.4.4

3.6 Kandidat CMS 1.4.4

http://www.allbest.ru/
CMS , .
Kan-studio.
,
.
Kandidat CMS .
CMS :
,
, ,
,
, ,
, "" javascript ajax-, HTML ,

.
,
xml-.
.
,

Kandidat

CMS

.
, :
( ) . ,

, . CMS
[17].

http://www.allbest.ru/
3.4

Zimplit CMS

Zimplit CMS[18].

3.7 , Zimplit CMS

3.8 Zimplit CMS


Zimplit -.
. CMS ,
,
, .
,
CMS. ,
Zimplit. Zimplit CMS
.

http://www.allbest.ru/
, .

, . ,
[18].

3.5

Get Simple

CMS Get Simple[19]. Get Simple


-, - -.
, .
.

3.9 , Get Simple 3

3.10 Get Simple 3


.
,

CMS

http://www.allbest.ru/
, .
. GetSimple
xml-. ,
.
GNU GPL[20].

3.6

CMS ( 3.1).
3.1

Rumba

Made Simple

Kandidat

Zimplit

GetSimple

()

Xml

SQL

Xml

Xml

http://www.allbest.ru/

:




xml-

http://www.allbest.ru/
4
4.1

UML

4.1 UML
,
UML ( 4.1).
.
2 :

,
.

:

:

http://www.allbest.ru/
1. ,
.
2.
,

, ,
.
3. .

:
1.


.
2.

.
3. .
4. .
.
5. .
:
1. ,
.
2. .
:
.

.

:
1.

http://www.allbest.ru/
2. ,
, .
3. .

:
1. , ,
, .
2. xml .
3. .

:
1. , ,
.
2. xml .
3. .

:
1. , ,
.
2. xml .
3. .

:
1. , ,
.
2. xml .

http://www.allbest.ru/
3. .

:
1. ,
.
2. -.
3. xml .
4. .

:
1. , ,
.
2. xml .
3. .

, .
,
- ,
. ,
.

http://www.allbest.ru/
5.

: C#, ASP.NET MVC 3, XML,


ARGO UML UML .
5.1 C#
C# - .
19982001 Microsoft
Microsoft .NET
Framework. Visual Studio [21].
C# C- .
C++ Java. ,
, (
), , , , ,
, ,
, LINQ, , XML[22].
web- Visual Studio
ASP.NET. ASP.NET MVC 3.

5.2

ASP.NET MVC 3

ASP.NET[23] -
-. ASP.NET .NET Framework,
.NET.Framework ASP.NET.
ASP.NET MVC 3[24] , MVC.
.
ASP.NET MVC:

http://www.allbest.ru/
.
ASP.NET MVC .
,
URL- .
ASP.NET.
URL-
URL-, . URL

URL-,

, (SEO).
ASP.NET. ASP.NET MVC
,
Windows, URL-,
, ,
, ,
[25].

5.2.1

Razor

ASP.NET 3 Razor[26].
:
,
View
, ,
C# Visual Basic
Visual Studio[27].
5.2.2

MVC (Model-View-Controller)

MVC[28].
.
.

http://www.allbest.ru/
,
. ,
.
MVC ,
:
(Model). ( View),
( ),
.
(View).
( ).

(Controller).

,
.

.
MVC[29]:
.

,

.

http://www.allbest.ru/
.
, -
,
. - MVC
Framework ,
URI.
URL-.
.
.
,
.
. MVC Framework
,


() ,
,
.
ASP.NET
:

HTML, CSS, JavaScript

http://www.allbest.ru/
5.3

XML

XML (eXtensible Markup Language)[30] ,


. HTML,
,
.
:
XML (
)
XML-


xml- ,
, , .. .
XML- LINQ.

5.4

ARGO UML UML

ARGO UML[31] UML .


:
UML 1.3, 1.4, XMI 1.0, 1.1, 1.2
9 UML ( , , ,
, , , , ,
)
OCL
Java, C++, C# PHP
Java.

http://www.allbest.ru/
6
6.1


.

.
: , ,
,
.
Microsoft Expression Blend SketchFlow[32].
( 6.1)
.

6.1 Sketch flow map


.
,
, .. .
, Autorisation ( 6.2)
,
MainMenu,
.

http://www.allbest.ru/

6.2.
,
Welcome
Autorisation.
,
, ( 6.4), (
6.3), ( 6.5) ,
, ,
.

6.3 Styles

6.4. Menu

http://www.allbest.ru/

6.5. Categories

6.2

ASP.NET MVC 3[24] Model-View-Controller,


-.
MVC
-. , ASP.NET MVC
,
,

.
MVC, MVC-
( 6.6).

6.6. MVC-

HTTP-

ASP.NET, MVC

http://www.allbest.ru/
Framework .

,
, , ,
.
,
( URL-, IP- ..),

MVC[33].

,
( MVC),
.

ViewData
.
,
-
HTTP. MVC-
. ,

6.7

. XCMS.Controllers,
, XCMS.Models,
XCMS.Views, . HomeController
, ,
CMS,
, Home Index.

AdminController

, , ,

http://www.allbest.ru/
.
, Index,Auth,MainTools, MenuEditor, Styles,
Users.
XCMS.Models .
, StylesModel (id)
(id). , ,
.
XCMS.Views ,
. AdmLayout ,

.
. Admin
. Home
.

6.7 XCMS

http://www.allbest.ru/

7
7.1

XCMS -,
, ASP.NET 4 ASP.NET MVC 2

ASP.NET 4.0 Integrated


Papeline. , XCMS -.
XCMS,
URL (/)
admin. admin
admin. .

7.2

XCMS ,
-
.
,
. , ,
:


,
.
:


http://www.allbest.ru/





:

( 7.1)

XCMS.

. - .
,
.
.

7.1

( 7.2) 2 :
. ,
XCMS.
.

http://www.allbest.ru/
(

),

XCMS .

, ,
, , .

7.2 XCMS

7.3

. ( 7.3)

( 7.4).
:
. . ,
.
. .
html- description.

http://www.allbest.ru/

7.4

7.5

( 7.5)
(SS ),
.
CSS - (
7.6).

CSS . ,

styles . ,
.

http://www.allbest.ru/

7.6

( 7.7)
,
.

7.7

http://www.allbest.ru/

7.8

( 7.8)
. .
,
. .
( 7.9).

. ,

. ,
. .
, ,
,
.
,
.

http://www.allbest.ru/

7.9 -

( 7.10)
.

7.10

( 7.11).

http://www.allbest.ru/
,
, .

7.11 -
.
,
.
! .

( 7.12)
CMS. XCMS
.

( 7.13).
.

http://www.allbest.ru/

7.12

7.13

http://www.allbest.ru/
8

XCMS
:



Wash and Repair
RepairCar,
Flash Templates Today[34].

1.
8.1 .

8.1

http://www.allbest.ru/

.
8.2 .
,

.

8.2

8.3

http://www.allbest.ru/
,
.
, , , .

,
.

8.4

, 8.4.
, . ,
.

XCMS Wash and
Repair. , .
1 .

http://www.allbest.ru/
9

9.1

.
.
, ,
, ,
.

.

:
;
;
.
,
, . ,
.,
, . ,
,
.

.
,
, ,
, ,

http://www.allbest.ru/

, (9.1):

3 t 2 t
5

(9.1)

, ;

, .


:
(ai);
(mi);
(bi);

9.1.
9.1

ai,

mi,

bi,

12

10

11

16

13,5

14

21

17,5

14

31

22,5

18

38

28

28

42

35

8,5

10

.
(9.2) :

http://www.allbest.ru/

MOi

ai 4 mi bi
,
6

MOi i-o ;

(9.2)

a i , mi , bi .


(10.3):

Gi

bi ai
,
6

(9.3)

Gi i- .

(9.4):

MO MOi ,

(9.4)

i 1

MO ;

MOi i- ;
n

(9.5):

G
i 1

Gi

2
i

(9.5)

G ;

i- .


. , . (10.6)

http://www.allbest.ru/
i- (10.7)
:

Gi
,
MOi

Yi

(9.6)

Yi i- ;

Gi i- ;

MOi i- .
Y

G
,
MO

(9.7)

Y ;

G ;
MO .

Y 0,33 ,
.
MOi , Gi , Yi , MO , G , Y
9.2.
9.2

i,

Gi,

Yi,

ai,

mi,

bi,

10

13

17,5

13,25

1,25

0,094

22,5

28

35

28,25

2,08

0,074

8,5

0,67

0,083

37,5

49,5

61,5

49,5

0,25

http://www.allbest.ru/
Y
0,25 0,33, .

(9.8):

(k 1) (t1 t 2 t 3 ) (k 1) 8 8 ,

(9.8)

;
M ;

t1 ;
t 2 ;
t3

k , ( 24

34 % );
k ;


9.3.

http://www.allbest.ru/
9.3

, .

15000

M , .

22

t1 ,

13,25

t 2 ,

28.25

t 3 , .

k,%

26

k , %

50

, .

0,6

50

40

.

(9.9):

(9.9)

.
1987 .
2500 .

http://www.allbest.ru/

,
. (9.10)
:
,

(9.10)

1 ;

.

:
0,1 /;
1,8

/.

(9.10) :
1987 1,8 0,1 357,66

.;


(9.11):
,

( 25000 .);

(9.11)

http://www.allbest.ru/

, 259.1 .
1 2002 1
, ,
2 3 .
2 .
:
1

12 100 % 50 %
24

(9.11)
30000 0,5 15000

./.

5 % .
(9.12):

0,05 ( )
.
0,95

(9.12)

(9.12) :

0,05 (357,66 15000 2500)


939,88 ./.
0,95

,
(9.9):

http://www.allbest.ru/

357,66 15000 2500 939,88


9,46 .
1987

(9.8):

15000
(0,34 1) (13,25 28,25 8) (0,5 1) 8 50 9,46 8 40 0,6 109653,5
22

.
(9.13):
(1 R) ,

(9.13)

;
R .

:
R 20 % 0,2

(9.13) :
109653,5 (1 0,2) 131584,2 .


(9.14):
,

(10.14)

http://www.allbest.ru/
18%

164 21 .
(9.14)
:
.

131584,2 131584,2 0,18 155269,36


155269,36 .

.
, .
.
.

-,
CMS-. ,

.

.

.

.
, ,

.
.

http://www.allbest.ru/

CMS, CSS.
.

http://www.allbest.ru/

,
-
. ,
:
1.

CMS

lite.
2.

UML.

.
3.

ASP.NET MVC.
4.

.
5.

. ,
.
, .NET (C#) ASP.NET MVC 3 Framework.

http://www.allbest.ru/

1.

. . -. .:

, 2009. . 24
2.

FreeBSD

URL:

URL:

URL:

http://www.freebsd.org/ ( 04.03.2011)
3.

Debian

http://www.debian.org ( 04.03.2011)
4.

Windows

Server

http://www.microsoft.com/windowsserver2008/ru/ru/default.aspx
04.03.2011)
5.

Apache

URL:

http://www.apache.org/ ( 04.03.2011)
6.

IIS [ ] URL: http://www.iis.net/ (

04.03.2011)
7.

MSDN

Magazine

URL:http://msdn.microsoft.com/ru-ru/magazine/ ( 04.03.2011)
8.

ASP.NET [ ] URL: http://www.asp.net/ (

05.03.2011)
9.

MSDN [ ] URL: http://msdn.microsoft.com/en-

us/library/aa286483.aspx ( 05.03.2011)
10.

CGI [ ] URL: http://www.cgi.com/ (

05.03.2011)
11.

Silverlight

URL:

http://www.silverlight.net/ ( 05.03.2011)
12.

Rumba CMS [ ] URL:

http://rumbacms.com ( 10.03.2011)
13.

Rumba CMS [ ]

URL: http://rumba.net.ru ( 10.03.2011)

http://www.allbest.ru/
14.

URL:

http://narod.yandex.ru/ ( 10.03.2011)
15.

MadeSimple CMS [ ] URL:

http://www.cmsmadesimple.org ( 10.03.2011)
16.

MadeSimple CMS [

] URL: http://www.cmsmadesimple.ru/ ( 10.03.2011)


17.

Kandidat CMS [ ] URL:

http://www.kan-studio.ru/ ( 12.03.2011)
18.

Zimplit CMS [ ]URL:

http://www.zimplit.com/index.html ( 12.03.2011)
19.

GetSimple CMS [ ] URL:

http://get-simple.info/ ( 12.03.2011)
20.

GetSimple CMS [

] URL: http://get-simple.info/ ( 12.03.2011)


21.

Visual

Studio

URL:

http://www.microsoft.com/visualstudio/ ( 29.03.2011)
22.

MSDN

Visual

C#

http://msdn.microsoft.com/ru-ru/vcsharp/default.aspx

URL:

29.03.2011)
23.

ASP.NET

URL:

http://www.asp.net/ ( 29.03.2011)
24.

ASP.NET

URL:

http://www.asp.net/mvc/mvc3 ( 29.03.2011)
25.

, ASP.NET 3.5, AJAX

= Pro ASP.NET 3.5


Server Controls with AJAX Components. .: , 2009. . 608
26.

Razor Microsoft [ ] URL:

http://www.microsoft.com/web/category/razor ( 03.04.2011)
27.

ASP.NET

MVC

http://www.techdays.ru/videos/3307.html ( 3.04.2011)

URL:

http://www.allbest.ru/
28.

Enode

URL:

http://www.enode.com/x/markup/tutorial/mvc.html ( 3.04.2011)
29.

RSDN

URL:

http://www.rsdn.ru/

3.04.2011)
30.

[ ] URL:

http://www.w3.org/ ( 3.04.2011)
31.

ARGO

UML

URL:

http://www.argouml.tigrus.org ( 7.04.2011)
32.

Expression Studio [ ] URL:

http://www.microsoft.com/expression/ ( 25.04.2011)
33.

. ., . . ASP.NET MVC Framework . .:

-, 2010 c. 20
34.

CSS [ ] URL: http://free-flash-

templates.com ( 25.05.2011)

http://www.allbest.ru/



HTTP (HyperText Transfer Protocol)

Www (World Wide Web)
CMS (Content Management System)
HTML (HyperText Markup Language)

CSS (Cascading Style Sheets) ,

URL (Uniform Resource Locator)

UML

(Unified

Modeling

Language)

http://www.allbest.ru/

Home (Index.cshtml)
@model XCMS.Models.MenuItemModel
@section Style{
<link

href="@Url.Content(ViewBag.StylePath)"

type="text/css" media="screen" />


}
<div id="container">
<div id="header">
<div class="logo">
<h1>@ViewBag.Title</h1>
<h2>@ViewBag.Description</h2>
</div>
<div id="navcontainer">
<ul id="navlist">
@foreach (var @item in ViewBag.MenuList){
<li>@Html.ActionLink(
(string)item.name,
"Index",
"Home",
new{cat = item.cat},
null)
@{if (item.sub.Count > 0){
<ul>
@foreach (var @it in item.sub){
<li>@Html.ActionLink(
(string)it.name,

rel="stylesheet"

http://www.allbest.ru/
"Index",
"Home",
new{cat = it.cat},
null)
</li>
}
</ul>
}
}
</li>
}
</ul>
</div>
</div>
</div>
<div id="mainContent">
<h2>@ViewBag.PageName</h2>
@if (@ViewBag.Art.Count > 0){
foreach (var it in ViewBag.Art){
<p>
@if (@ViewBag.Art.Count > 1){
<h3>@it.name</h3>
}
@it.text
</p>
}}
</div>
HomeController.cs
using System;
using System.Collections.Generic;

http://www.allbest.ru/
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Xml.Linq;
using XCMS.Models;
using System.IO;

namespace XCMS.Controllers
{
public class HomeController : Controller
{
//
// GET: /Home/
publicstring title;
public List<string> text;

public List<StructDataModel> GetMainMenu(List<StructDataModel> data)


{
List<StructDataModel> MainMenuList =
data.FindAll(delegate(StructDataModel item)
{ return item.parrent.Equals("");});

return MainMenuList;
}
//
public List<StructDataModel> GetSectionMenu(List<StructDataModel>
data,string parrent)
{
List<StructDataModel> SectionMenu =
data.FindAll(delegate(StructDataModel item)

http://www.allbest.ru/
{ return item.parrent.Equals(parrent);});

return SectionMenu;
}
//
privatestring GetStylePath()
{
string path;
string fileName =
AppDomain.CurrentDomain.BaseDirectory +
"\\Data\\main.xml";
XDocument doc = XDocument.Load(fileName);
string styleName ="";

foreach (XElement el in doc.Root.Elements())


{
styleName =
el.Attribute("style").Value.ToString();
}
return (path =
AppDomain.CurrentDomain.BaseDirectory
+ "\\Styles\\" +styleName +
"\\style.css");
}

privatestring GetSiteName()
{
string sitename = "no site name";
string fileName =

http://www.allbest.ru/
AppDomain.CurrentDomain.BaseDirectory +
"\\Data\\main.xml";
XDocument doc = XDocument.Load(fileName);
foreach (XElement el in doc.Root.Elements())
{
sitename =
el.Attribute("sitename").Value.ToString();
}
return sitename;
}

privatestring GetDescription()
{
string description = "";
string fileName =
AppDomain.CurrentDomain.BaseDirectory +
"\\Data\\main.xml";
XDocument doc = XDocument.Load(fileName);

foreach (XElement el in doc.Root.Elements())


{
description =
el.Attribute("description").Value.ToString();
}
return description;
}
private void GetMainPage()
{
string path =
AppDomain.CurrentDomain.BaseDirectory +

http://www.allbest.ru/
"\\Data\\mp.xml";
XDocument doc = XDocument.Load(path);
bool fl = true;
foreach (XElement el in doc.Root.Elements())
{
text.Clear();
if (fl)
{
title = el.Attribute("title").Value.ToString();
fl = false;
}

foreach (XElement element in el.Elements())


{
text.Add(element.Value);
}
}
}
//
private void GetChapter(string alias)
{
string filePath =
AppDomain.CurrentDomain.BaseDirectory
+ "\\Data\\" + alias+".xml";

if (System.IO.File.Exists(filePath))
{
XDocument doc = XDocument.Load(filePath);

http://www.allbest.ru/
bool fl = true;

foreach (XElement el in doc.Root.Elements())


{
if (fl)
{
title = el.Attribute("title").Value.ToString();
fl = false;
}

foreach (XElement element in el.Elements())


{
text.Add(element.Value);
}
}
}
else
{
//ViewBag.SectionMenu = "";
title = "White Page";
text.Clear();
}
}

//
public ActionResult Index()
{
List<MenuItemModel> listOfItems = new List<MenuItemModel>();
string fileName =

http://www.allbest.ru/
AppDomain.CurrentDomain.BaseDirectory
+ "\\Data\\struct.xml";
XDocument doc = XDocument.Load(fileName);

foreach (XElement el in doc.Root.Elements())


{
MenuItemModel temp = new MenuItemModel(el);
foreach (XElement elem in el.Elements())
{
MenuItemModel temp2 = new MenuItemModel(elem);
temp.sub.Add(temp2);
}
listOfItems.Add(temp);
}

ViewBag.MenuList = listOfItems;
// ViewBag.SubMenu = subList;
ViewBag.PageName = "";
ViewBag.StylePath = GetStylePath();

ViewBag.Title = GetSiteName();
ViewBag.Description = GetDescription();
//
List<ArticleModel> ArtStruct = new List<ArticleModel>();

if (Request["cat"] != null)
{
string CatfileName =

http://www.allbest.ru/
AppDomain.CurrentDomain.BaseDirectory
+ "\\Data\\cat.xml";

XDocument catdoc = XDocument.Load(CatfileName);


foreach (XElement el in catdoc.Root.Elements())
{
if (el.Attribute("name").Value.Equals(Request["cat"]))
{
ViewBag.PageName = Request["cat"];
foreach (XElement elem in el.Elements())
{
string artname = elem.Attribute("name").Value;
string artfileName =
AppDomain.CurrentDomain.BaseDirectory
+ "\\Data\\articles.xml";
XDocument artdoc = XDocument.Load(artfileName);
foreach (XElement elm in artdoc.Root.Elements())
{
if (artname.Equals(elm.Attribute("name").Value))
{
ArtStruct.Add(new ArticleModel{ name = elm.Attribute("name").Value,
text = elm.Value});
break;
}
}
}

}
}
}

http://www.allbest.ru/
ViewBag.Art = ArtStruct;
//ViewBag.Text = text;

return View();
}
}
}
MenuItemModel.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Xml.Linq;

namespace XCMS.Models
{
public class MenuItemModel
{
publicstring alias{ get; set;}
publicstring name{ get; set;}
publicstring cat{ get; set;}

public List<MenuItemModel> sub{ get; set;}

public MenuItemModel()
{
name = "";
alias = "";
cat = "";

http://www.allbest.ru/
sub = new List<MenuItemModel>();
}

public MenuItemModel(XElement xe)


{
name = xe.Attribute("name").Value;
alias = xe.Attribute("alias").Value;
cat = xe.Attribute("cat").Value;

sub = new List<MenuItemModel>();


}
}
}
MenuEditor.cshtml
@model XCMS.Models.MenuItemModel

@{
ViewBag.PageMenu = "selected";
Layout = "~/Views/Shared/_AdminLayout.cshtml";
ViewBag.Title = "MenuEditor";
}
<link

href="@Url.Content("~/Content/adminstyle/menueditor.css")"

rel="stylesheet" type="text/css" media="screen" />


<h2></h2>

<div id="content">
<div id="list5">
<table>

http://www.allbest.ru/
@foreach(XCMS.Models.MenuItemModel item in ViewBag.MenuList)
{
<tr class="outs">
<td>@item.name</td>
<td><div class="small button blue">
@Html.ActionLink(
"",
"RenameMenu",
"Admin",
new{rename = item.name},
null)
</div></td>
<td><div class="small button red">
@Html.ActionLink(
"",
"DeleteItemMenu",
"Admin",
new{ del = item.name},
null)
</div>
</td>
</tr>
<tr>
<td>
@if (item.sub.Count > 0)
{
<ol>
@foreach (XCMS.Models.MenuItemModel item2 in item.sub)
{
<li>@item2.name</li>

http://www.allbest.ru/
}
</ol>
}
</td>
@if (item.sub.Count > 0)
{
<td>
@foreach (XCMS.Models.MenuItemModel item2 in item.sub){

<div class="small button blue">


@Html.ActionLink(
"",
"RenameMenu",
"Admin",
new{ rename = item2.name},
null)
</div>
}
</td>
}
@if (item.sub.Count > 0)
{
<td>
@foreach (XCMS.Models.MenuItemModel item2 in item.sub){

<div class="small button red">


@Html.ActionLink(
"",
"DeleteItemMenu",
"Admin",

http://www.allbest.ru/
new{ del = item2.name},
null)
</div>
}
</td>
}
</tr>
}
<tr>
<td>
<div class="small button green">
@Html.ActionLink(
"",
"AddMenu",
"Admin",
null,
null)
</div>

</td>
</tr>
</table>
</div>
</div>
EditCat.cshtml
@{
ViewBag.Title = " ";
Layout = "~/Views/Shared/_AdminLayout.cshtml";
}

http://www.allbest.ru/
<link

href="@Url.Content("~/Content/adminstyle/styles.css")"

rel="stylesheet" type="text/css" media="screen" />


<h2> @ViewBag.CatName</h2>
<br />
<div>
<h3 style="margin-left:30px"> :</h3>
@using

(Html.BeginForm("ConnectToMenu",

"Admin",

FormMethod.Post))
{
<input type="hidden" name="catname" value="@ViewBag.CatNam" />
<select name="itemattach" style="margin-left:20px">
@foreach (var item in ViewBag.MenuList)
{
<option value="@item.name">@item.name</option>
}

</select>
<input type="submit" value="" />

}
</div>
<input type="hidden" id="selname" value="#" />
<div>
<h3 style="margin-left:30px"> </h3>
<p style="margin-left:30px">( )</p>
@using (Html.BeginForm("MainSheet", "Admin", FormMethod.Post))
{
<input type="hidden" name="catname" value="@ViewBag.CatNam" />
<select name="mainart" style="margin-left:20px">

http://www.allbest.ru/
@foreach (var item in ViewBag.Artlist)
{
<option value="@item">@item</option>
}
</select>
<input type="submit" value="" />
}
</div>
<br />
<br />
<br />
<div>
<h3 style="margin-left:30px"> </h3>
<table>
<input type="hidden" name="catname" value="@ViewBag.CatNam" />
@foreach (var iten in ViewBag.Enabl)
{ <tr>
<td>@iten</td><td></td><td><input type=submit value=""></td>
</tr>
}
<tr>

@using (Html.BeginForm("AddToCat", "Admin", FormMethod.Post))


{
<td>
<input type="hidden" name="catname" value="@ViewBag.CatNam" />
<select name="add" style="margin-left:20px">
@foreach (var item in ViewBag.Artlist)
{
<option>@item</option>

http://www.allbest.ru/
}
</select></td><td><input type="submit" value="" />
</td>}</div><td></td>
</tr>
<tr><td></td></tr>
</table>
</div>
MainTools.cshtml
@{
ViewBag.PageMainTools = "selected";
ViewBag.Title = "MainTools";
Layout = "~/Views/Shared/_AdminLayout.cshtml";
}
<link

href="@Url.Content("~/Content/adminstyle/maintools.css")"

rel="stylesheet" type="text/css" media="screen" />

<div id="sideLeft">
<div class="box">
<div class="innerBox">
<h3> </h3>
@using(Html.BeginForm("ChangeMains","Admin",FormMethod.Post))
{
<div>
<table border="0">
<tr>
<td> :</td>
<td><input

type="text"

value="@ViewBag.SiteName" /></td>
</tr>
<tr>

name="sitename"

size="30"

http://www.allbest.ru/
<td class="atvo">: </td>
<td><textarea

cols="25"

rows="3"

name="descript">@ViewBag.Desc</textarea></td>
</tr>
<tr>
<td colspan="2" align="right">
<input type="submit" value="" name="Save" />
</td>
</tr>
</table>
</div>
}
</div>
</div>
</div>
EditStyle.cshtml
@{
ViewBag.Title = "EditStyle";
Layout = "~/Views/Shared/_AdminLayout.cshtml";
}
<link

href="@Url.Content("~/Content/adminstyle/styles.css")"

rel="stylesheet" type="text/css" media="screen" />


<h2> <strong>RC</strong></h2>

<div>
@using(Html.BeginForm("EditStyle","Admin",FormMethod.Post))
{
<input type="hidden" name="edit" value="@ViewBag.StyleName" />
<textarea rows="20" cols="100" name="cssstyle" id="cssstyle">

http://www.allbest.ru/
@ViewBag.StyleEdit
</textarea>
<br />
<div style="margin-left : 30px; margin-bottom: 10px">
<input type="submit" value="" />
</div>
}
</div>
AddMenu.cshtml
@{
ViewBag.PageMainTools = "selected";
ViewBag.Title = "MainTools";
Layout = "~/Views/Shared/_AdminLayout.cshtml";
}
<link

href="@Url.Content("~/Content/adminstyle/maintools.css")"

rel="stylesheet" type="text/css" media="screen" />

<div id="sideLeft">
<div class="box">
<div class="innerBox">
<h3> </h3>
@using(Html.BeginForm("AddMenuItem","Admin",FormMethod.Get))
{
<div>
<table border="0">
<tr>
<td>:</td>
<td><input type="text" name="menuitemname" size="30" /></td>
</tr>
<tr>

http://www.allbest.ru/
<td class="atvo"> : </td>
<td><select name="parrent">
<option value=""></option>
@foreach (var it in ViewBag.Menu)
{
<option value="@it.name">@it.name</option>
}
</select></td>
</tr>
<tr>
<td colspan="2" align="right">
<input type="submit" value="" name="Save" >
</td>
</tr>
</table>
</div>
}
</div>
</div>
</div>
AdminController.cshtml
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.IO;
using XCMS.Models;
using System.Xml.Linq;
using System.ComponentModel;

http://www.allbest.ru/
namespace XCMS.Controllers
{
public class AdminController : Controller
{
//
// GET: /Admin/
public ActionResult AddToCat()
{
string fileName =
AppDomain.CurrentDomain.BaseDirectory
+ "\\Data\\cat.xml";
XDocument doc = XDocument.Load(fileName);

XElement art = new XElement("art",


new XAttribute("name", Request["add"])
);
foreach (XElement el in doc.Root.Elements())
{
string ttt = Request["catname"];
if (el.Attribute("name").Value.Equals(Request["catname"]))
{
el.Add(art);
break;
}}
doc.Save(fileName);
return RedirectToAction("EditCat");
}

public ActionResult ConnectToMenu()


{

http://www.allbest.ru/
string fileNamee =
AppDomain.CurrentDomain.BaseDirectory
+ "\\Data\\struct.xml";
XDocument doce = XDocument.Load(fileNamee);
foreach (XElement el in doce.Root.Elements())
{
if (el.Attribute("name").Value.Equals(Request["itemattach"]))
{
el.Attribute("cat").SetValue(Request["catname"]);
break;
}
foreach (XElement elem in el.Elements())
{
if (elem.Attribute("name").Value.Equals(Request["itemattach"]))
{
elem.Attribute("cat").SetValue(Request["catname"]);
break;
}
}

}
doce.Save(fileNamee);

return RedirectToAction("EditCat");
}

public ActionResult AddCat()


{
string fileName =

http://www.allbest.ru/
AppDomain.CurrentDomain.BaseDirectory
+ "\\Data\\cat.xml";
XDocument doc = XDocument.Load(fileName);

XElement cat = new XElement("cat",


new XAttribute("name", Request["catname"]));
doc.Root.Add(cat);

doc.Save(fileName);

return RedirectToAction("Categories");
}

public ActionResult RenameMenu()


{
ViewBag.Change = ""+Request["rename"]+"";
ViewBag.Chan = Request["rename"];

return View();
}

public ActionResult AddMenuItem()


{
string fileName =
AppDomain.CurrentDomain.BaseDirectory
+ "\\Data\\struct.xml";
XDocument doc = XDocument.Load(fileName);

XElement dat = new XElement("dat",


new XAttribute("name", Request["menuitemname"]),

http://www.allbest.ru/
new XAttribute("alias", ""),
new XAttribute("cat", Request["parrent"])
);
string ttt = Request["parrent"];
if (Request["parrent"].Equals(""))
doc.Root.Add(dat);
else
{
foreach (XElement el in doc.Root.Elements())
{
string str = el.Attribute("name").Value;
if (str == ttt)
{
el.Add(dat);
break;
}
}
}

doc.Save(fileName);

return RedirectToAction("MenuEditor");
}

public ActionResult AddMenu()


{
List<MenuItemModel> listOfItems = new List<MenuItemModel>();
string fileName =
AppDomain.CurrentDomain.BaseDirectory
+ "\\Data\\struct.xml";

http://www.allbest.ru/
XDocument doc = XDocument.Load(fileName);

foreach (XElement el in doc.Root.Elements())


{
MenuItemModel temp = new MenuItemModel(el);
foreach (XElement elem in el.Elements())
{
MenuItemModel temp2 = new MenuItemModel(elem);
temp.sub.Add(temp2);
}
listOfItems.Add(temp);
}

ViewBag.Menu = listOfItems;
return View();
}
//
public ActionResult Index()
{
return View();
//return RedirectToAction("Auth");
}

//
[HttpPost]
public ActionResult ChangeMains()
{
string fileName =
AppDomain.CurrentDomain.BaseDirectory

http://www.allbest.ru/
+ "\\Data\\main.xml";
XDocument doc = XDocument.Load(fileName);
foreach (XElement el in doc.Root.Elements())
{
el.Attribute("sitename").SetValue(Request["sitename"]);
el.Attribute("description").SetValue(Request["descript"]);
}
doc.Save(fileName);
return RedirectToAction("Index");
}
// " "
public ActionResult EditStyle(string editPath)
{
string path =
AppDomain.CurrentDomain.BaseDirectory
+ "\\Styles\\" + Request["edit"] + "\\style.css";
if (Request["cssstyle"] != null)
{
StreamWriter

write

new

StreamWriter(new

FileMode.Open, FileAccess.Write));
write.Write(Request["cssstyle"]);
write.Close();
return RedirectToAction("Styles");
}
else
{
DirectoryInfo dir = new DirectoryInfo(path);
StreamReader read = new StreamReader(path);
ViewBag.StyleEdit = read.ReadToEnd();

FileStream(path,

http://www.allbest.ru/
read.Close();
}
ViewBag.StyleName = Request["edit"];
return View();
}
//
public ActionResult DeleteItemMenu()
{
string fileName =
AppDomain.CurrentDomain.BaseDirectory
+ "\\Data\\struct.xml";
XDocument doc = XDocument.Load(fileName);
foreach (XElement el in doc.Root.Elements())
{
if (el.Attribute("name").Value.Equals(Request["del"]))
{
el.Remove();
break;
}
foreach (XElement elem in el.Elements())
{
if (elem.Attribute("name").Value.Equals(Request["del"]))
{
elem.Remove();
break;
}
}

http://www.allbest.ru/
doc.Save(fileName);
return RedirectToAction("MenuEditor");
}
//
[HttpGet]
public ActionResult EditMenuItem()
{
List<string> text = new List<string>();
string fileName =
AppDomain.CurrentDomain.BaseDirectory
+ "\\Data\\struct.xml";

XDocument doc = XDocument.Load(fileName);

List<StructDataModel> listOfData = new List<StructDataModel>();

foreach(XElement el in doc.Root.Elements())
{
listOfData.Add(new StructDataModel{
id = int.Parse(el.Attribute("id").Value),
parrent = el.Attribute("parrent").Value,
alias = el.Attribute("alias").Value,
menuItem = el.Attribute("menu").Value,
dop = el.Attribute("dop").Value,
vetv = el.Attribute("vetv").Value});
}

ViewBag.ItemEdited = listOfData.Find(delegate(StructDataModel item)

http://www.allbest.ru/
{ return item.menuItem.Equals(Request["name"]);});

return View();
}

[HttpPost]
public ActionResult EditMenuItem(object r,string it)
{
List<string> text = new List<string>();
string fileName =
AppDomain.CurrentDomain.BaseDirectory
+ "\\Data\\struct.xml";

XDocument doc = XDocument.Load(fileName);

List<string> listOfData = new List<string>();

foreach (XElement el in doc.Root.Elements())


{
if
(el.Attribute("menu").Value.Equals(Request["MenuItemAddress"].ToString()))
el.Attribute("menu").SetValue(Request["MenuItemEdit"]);
}
doc.Save(fileName);
return RedirectToAction("MenuEditor");
}
// " "
public ActionResult Editusers()

http://www.allbest.ru/
{
return View();
}
//
public List<StylesModel> GetStyles()
{
//
string path =
AppDomain.CurrentDomain.BaseDirectory
+ "\\Styles\\";
DirectoryInfo dir = new DirectoryInfo(path);

List<StylesModel> StylesList = new List<StylesModel>();


int ind = 0;
foreach (var item in dir.GetDirectories())
{
StylesList.Add(new StylesModel{
id = ind++, name = item.Name});
}
return StylesList;
}
//
public void RemoveStyle(string delPath)
{
string path =
AppDomain.CurrentDomain.BaseDirectory
+ "\\Styles\\" + delPath+ "\\";

http://www.allbest.ru/
DirectoryInfo dir = new DirectoryInfo(path);
dir.Delete(true);
}
//
public void UseStyle(string usePath)
{
string fileName =
AppDomain.CurrentDomain.BaseDirectory
+ "\\Data\\main.xml";
XDocument doc = XDocument.Load(fileName);
foreach (XElement el in doc.Root.Elements())
{
el.Attribute("style").SetValue(usePath);
}
doc.Save(fileName);
}
// Styles
public ActionResult Styles()
{
//
if (Request["del"] != null)
RemoveStyle(Request["del"]);
//
if (Request["use"] != null)
UseStyle(Request["use"]);
List<StylesModel> styles = GetStyles();
ViewBag.Styles = styles;
return View();

http://www.allbest.ru/
}
// MainTools
public ActionResult MainTools()
{
string fileName =
AppDomain.CurrentDomain.BaseDirectory
+ "\\Data\\main.xml";
XDocument doc = XDocument.Load(fileName);
foreach (XElement el in doc.Root.Elements())
{
ViewBag.SiteName = el.Attribute("sitename").Value;
ViewBag.Desc = el.Attribute("description").Value;
}
return View();
}
// MenuEditor
public ActionResult MenuEditor()
{
List<MenuItemModel> listOfItems = new List<MenuItemModel>();
string fileName =
AppDomain.CurrentDomain.BaseDirectory
+ "\\Data\\struct.xml";
XDocument doc = XDocument.Load(fileName);

foreach (XElement el in doc.Root.Elements())


{
MenuItemModel temp = new MenuItemModel(el);
foreach (XElement elem in el.Elements())
{

http://www.allbest.ru/
MenuItemModel temp2 = new MenuItemModel(elem);
temp.sub.Add(temp2);
}
listOfItems.Add(temp);
}

ViewBag.MenuList = listOfItems;

return View();
}
// Categories
public ActionResult Categories()
{
List<CategoryModel> catList = new List<CategoryModel>();
string fileName =
AppDomain.CurrentDomain.BaseDirectory
+ "\\Data\\cat.xml";
XDocument doc = XDocument.Load(fileName);

foreach (XElement el in doc.Root.Elements())


{
CategoryModel temp = new CategoryModel(el);
foreach (XElement elem in el.Elements())
{
string temp2 = elem.ToString();
temp.articles.Add(temp2);
}
catList.Add(temp);
}

http://www.allbest.ru/

ViewBag.CatList = catList;
return View();
}
// Articles
public ActionResult Articles()
{
List<string> artList = new List<string>();
string fileName =
AppDomain.CurrentDomain.BaseDirectory
+ "\\Data\\articles.xml";
XDocument doc = XDocument.Load(fileName);

foreach (XElement el in doc.Root.Elements())


{
artList.Add(el.Attribute("name").Value);
}

ViewBag.Artlist = artList;
return View();
}
}
}

1.

www.allbest.ru