private void bindAppInfo( AppInstaller info )
 {
     set( "app.Name", info.Name );
     set( "app.Description", info.Description );
     set( "app.Id", info.Id );
     //set( "app.AccessStatus", AccessStatusUtil.GetRadioList( AccessStatus.Public ) );
 }
Beispiel #2
0
 private static String ToUserDataAdmin( AppInstaller appInfo )
 {
     // /bv/Admin/Apps/Blog/Main/Index.aspx
     String controller = "Admin/Apps/" + strUtil.TrimEnd( appInfo.TypeName, "App" ) + "/Main/Index";
     String result = strUtil.Join( sys.Path.Root, controller );
     return result + MvcConfig.Instance.UrlExt;
 }
Beispiel #3
0
        private CacheObject getThemeById( AppInstaller installer, int id )
        {
            if (strUtil.IsNullOrEmpty( installer.ThemeType )) return null;

            Type themeType = ObjectContext.GetType( installer.ThemeType );
            if (themeType == null) return null;

            return cdbx.findById( themeType, id );
        }
Beispiel #4
0
        public static ITheme GetThemeById( AppInstaller installer, String id )
        {
            if (strUtil.IsNullOrEmpty( installer.ThemeType )) return null;

            Type themeType = ObjectContext.GetType( installer.ThemeType );
            if (themeType == null) return null;

            ITheme obj = ObjectContext.Create<ITheme>( themeType );
            return obj.GetById( id );
        }
Beispiel #5
0
        private List<CacheObject> getThemeList( AppInstaller installer )
        {
            List<CacheObject> list = new List<CacheObject>();
            if (strUtil.IsNullOrEmpty( installer.ThemeType )) return list;

            Type themeType = ObjectContext.GetType( installer.ThemeType );
            if (themeType == null) return list;

            return cdbx.findAll( themeType );
        }
Beispiel #6
0
        public static List<ITheme> GetThemeList( AppInstaller installer )
        {
            List<ITheme> list = new List<ITheme>();
            if (strUtil.IsNullOrEmpty( installer.ThemeType )) return list;

            Type themeType = ObjectContext.GetType( installer.ThemeType );
            if (themeType == null) return list;

            ITheme obj = ObjectContext.Create<ITheme>( themeType );
            return obj.GetAll();
        }
Beispiel #7
0
        private static IApp CreateApp( AppInstaller appInfo, IMember owner, AccessStatus accessStatus )
        {
            IApp app = Entity.New( appInfo.TypeFullName ) as IApp;
            app.OwnerId = owner.Id;
            app.OwnerUrl = owner.Url;
            app.OwnerType = owner.GetType().FullName;
            db.insert( app );

            UpdateAccessStatus( app, accessStatus );

            return app;
        }
        private void bindAppAdder( IList apps, IBlock listBlock, AppInstaller app )
        {
            String addGif = strUtil.Join( sys.Path.Img, "add.gif" );
            String downGif = strUtil.Join( sys.Path.Img, "downWhite.gif" );

            List<AppInstaller> childApps = getChildApp( app, apps );
            if (childApps.Count <= 0) {

                String lnk = to( NewApp, app.Id );
                String addInfo = string.Format( "<a href=\"{0}\" class=\"cmd frmBox\" title=\"{1}\"><img src=\"{2}\"> {3}</a>",
                    lnk, lang( "appAddTip" ), addGif, lang( "appadd" ) );

                listBlock.Set( "app.AddInfo", addInfo );
            }
            else {
                String addInfo = getSubApps( app, childApps );
                listBlock.Set( "app.AddInfo", addInfo );
            }
        }
Beispiel #9
0
        private bool valIsDefault( AppInstaller installer, string postValues )
        {
            String[] arrValues = postValues.Split( ',' );

            // 通用的程序
            if (installer.CatId == AppCategory.General) {
                return matchAllMembers( arrValues );
            }
            else {
                AppCategory ac = AppCategory.GetByCatId( installer.CatId );
                return ac.TypeFullName.Equals( postValues.Trim() );
            }
        }
Beispiel #10
0
 private String getUserDataAdminLink( AppInstaller app )
 {
     return string.Format( "<a href='{1}' class='frmLink userDataLink' loadto='adminMainBody' nolayout=1>{0}</a>", app.Name, ToUserDataAdmin( app ) );
 }
Beispiel #11
0
 private void bindAppInfo( AppInstaller info )
 {
     set( "app.Name", info.Name );
     set( "app.Description", info.Description );
     set( "app.Id", info.Id );
 }
Beispiel #12
0
 private Boolean checkInstall( AppInstaller info )
 {
     if (isInstalled( info )) {
         //if (info.Singleton && userAppService.HasInstall( ctx.owner.Id, info.Id )) {
         echoRedirect( lang( "exAppInstalled" ) );
         return false;
     }
     return true;
 }
        private Boolean isInstalled( AppInstaller app ) {

            if (app.Singleton == false) return false;
            if (ctx.owner.obj.GetType() == typeof( Site ) && app.TypeFullName == typeof( ForumApp ).FullName) return false;

            if (userAppService.HasInstall( ctx.owner.Id, app.Id )) return true;

            return false;


        }
 private List<AppInstaller> getChildApp( AppInstaller app, IList apps ) {
     List<AppInstaller> list = new List<AppInstaller>();
     foreach (AppInstaller a in apps) {
         if (a.ParentId == app.Id) list.Add( a );
     }
     return list;
 }
        private String getSubApps( AppInstaller app,  List<AppInstaller> childApps ) {

            String addGif = strUtil.Join( sys.Path.Img, "add.gif" );
            String downGif = strUtil.Join( sys.Path.Img, "down.gif" );

            String addInfo = "<span class=\"cmd menuMore\" list=\"subApps" + app.Id + "\"><img src=\"" + addGif + "\"> " + lang( "appadd" ) + " <img src=\"" + downGif + "\"/>";
            addInfo += "<ul class=\"menuItems\" style=\"width:250px;text-align:left\" id=\"subApps" + app.Id + "\">";

            String lnk = string.Format( "<a href=\"{0}\" class=\"frmBox\" title=\"{1}\"><img src=\"" + addGif + "\"> ", to( NewApp, app.Id ), lang( "appAddTip" ) );

            addInfo += "<li><div><strong>" + lnk + app.Name + "</a></strong><span class=\"note\">(基本型)</span></div></li>";

            foreach (AppInstaller a in childApps) {

                String alnk = string.Format( "<a href=\"{0}\" class=\"frmBox\" title=\"{1}\"><img src=\"" + addGif + "\"> ", to( NewApp, a.Id ), lang( "appAddTip" ) );

                addInfo += "<li><div><strong>" + alnk + a.Name + "</a></strong><span class=\"note\">(" + a.Description + ")</span></div></li>";
            }

            addInfo += "</ul></span>";
            return addInfo;
        }
Beispiel #16
0
 private void clearAppMemberShip( AppInstaller installer )
 {
     List<AppMemberShip> list = cdb.findAll<AppMemberShip>();
     for (int i = 0; i < list.Count; i++) {
         if (list[i].AppInstallerId == installer.Id) list[i].delete();
     }
 }
Beispiel #17
0
        private void addAppMemberShip( AppInstaller installer, string postValues )
        {
            // 先删掉已有的
            clearAppMemberShip( installer );

            // 增加现在的
            String[] arrValues = postValues.Split( ',' );
            foreach (String val in arrValues) {

                if (strUtil.IsNullOrEmpty( val )) continue;
                AppMemberShip am = new AppMemberShip();
                am.AppInstallerId = installer.Id;
                am.MemberTypeName = val.Trim();
                am.insert();
            }
        }
Beispiel #18
0
        //------------------------------------------
        public void UpdateStatus( AppInstaller installer, string postValues )
        {
            // 如果没有值(什么都不选)
            if (strUtil.IsNullOrEmpty( postValues )) {
                clearAppMemberShip( installer );
                installer.Status = AppInstallerStatus.Stop.Id;
            }

            // 如果和默认值相同
            else if (valIsDefault( installer, postValues )) {
                clearAppMemberShip( installer );
                installer.Status = AppInstallerStatus.Run.Id;
            }

            // 自定义
            else {
                addAppMemberShip( installer, postValues );
                installer.Status = AppInstallerStatus.Custom.Id;
            }

            installer.update();
        }