شركة التطبيقات المتكاملة لتصميم النظم البرمجية الخاصة

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » Ui

Public general use code classes and xml files that we've compiled and used over the years:

Islamic Tawheed Support Functions: UI model

   1:  using System;
   2:  using System.Web;
   3:  using System.Xml;
   4:  using System.IO;
   5:  using System.Configuration;
   6:  using System.Text;
   7:  using System.Text.RegularExpressions;
   8:  using System.Data;
   9:  using System.Data.SqlClient;
  10:  using System.Web.UI;
  11:  using System.Web.UI.WebControls;
  12:  using Ia.Islamic.Tawheed.Model;
  13:   
  14:  namespace Ia.Islamic.Tawheed.Model
  15:  {
  16:      ////////////////////////////////////////////////////////////////////////////
  17:   
  18:      /// <summary publish="true">
  19:      /// Islamic Tawheed Support Functions: UI model
  20:      /// </summary>
  21:      /// <value>
  22:      /// https://msdn.microsoft.com/en-us/library/z1hkazw7(v=vs.100).aspx
  23:      /// </value>
  24:      /// <remarks> 
  25:      /// Copyright © 2001-2015 Jasem Y. Al-Shamlan (info@ia.com.kw), Internet Applications - Kuwait. All Rights Reserved.
  26:      ///
  27:      /// This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
  28:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  29:      ///
  30:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  31:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  32:      /// 
  33:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  34:      /// 
  35:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  36:      /// </remarks> 
  37:      public abstract class Ui
  38:      {
  39:          private static string languageCode;
  40:   
  41:          ////////////////////////////////////////////////////////////////////////////
  42:          
  43:          /// <summary>
  44:          ///
  45:          /// </summary>
  46:          public Ui() 
  47:          { 
  48:          }
  49:   
  50:          ////////////////////////////////////////////////////////////////////////////
  51:   
  52:          /// <summary>
  53:          ///
  54:          /// </summary>
  55:          public static void Theme(System.Web.UI.Page page, System.Web.Profile.ProfileBase profile)
  56:          {
  57:              string title, author, date, content, coverImage, stylesheetCss;
  58:   
  59:              Data.BookAttributesUsingLanguage("ar", out title, out author, out date, out content, out coverImage, out stylesheetCss);
  60:   
  61:              // below: use mobile master pages if this browser is mobile
  62:              if (HttpContext.Current.Request.Browser.IsMobileDevice)
  63:              {
  64:                  //page.MasterPageFile = page.MasterPageFile.Replace("/", "/m/");
  65:                  //page.Theme = /*stylesheetCss + ".m";*/ "m";
  66:   
  67:                  page.Response.Redirect("~/m/default.aspx");
  68:              }
  69:              else
  70:              {
  71:                  if (page.Session["languageCode"] != null)
  72:                  {
  73:                      languageCode = page.Session["languageCode"].ToString();
  74:   
  75:                      if (languageCode != "ar" && languageCode != "fa") languageCode = "ar";
  76:                  }
  77:                  else languageCode = "ar";
  78:   
  79:                  page.Theme = stylesheetCss;
  80:              }
  81:          }
  82:   
  83:          ////////////////////////////////////////////////////////////////////////////
  84:   
  85:          /// <summary>
  86:          ///
  87:          /// </summary>
  88:          public static void BuildBookMasterPage(ref Literal titleLiteral)
  89:          {
  90:              string title, author, date, content, coverImage, stylesheetCss;
  91:   
  92:              Data.BookAttributesUsingLanguage("ar", out title, out author, out date, out content, out coverImage, out stylesheetCss);
  93:   
  94:              titleLiteral.Text = title + ": " + author;
  95:          }
  96:   
  97:          ////////////////////////////////////////////////////////////////////////////
  98:   
  99:          /// <summary>
 100:          ///
 101:          /// </summary>
 102:          public static void BuildBookPage(ref Literal authorDateLiteral, ref Literal contentLiteral)
 103:          {
 104:              string title, author, date, content, coverImage, stylesheetCss;
 105:   
 106:              Data.BookAttributesUsingLanguage("ar", out title, out author, out date, out content, out coverImage, out stylesheetCss);
 107:   
 108:              authorDateLiteral.Text = author + " (" + date + ")";
 109:   
 110:              content = content.Replace("paragraph", "p");
 111:              content = content.Replace("</p>", "</p>\r\n");
 112:   
 113:              content = content.Replace("header", "h2");
 114:              content = content.Replace("</h2>", "</h2>\r\n");
 115:   
 116:              content = Ia.Cl.Model.Language.SlightlyChangeSomeSentencesToPreventSystemFromGeneratingSingleCharacters(content);
 117:              content = Ia.Cl.Model.Language.RemoveSmallKoranicJawazAndSiliCharacters(content);
 118:   
 119:              content = content.Replace(@"</ءاية>", "</a>");
 120:              content = Regex.Replace(content, @"<ءاية id=""(\d{1,3})\:(\d{1,3})"">", @"<a href=""http://krn.org/ar/$1.aspx#$2"">");
 121:   
 122:              content = content.Replace(@"</ترجمة>", "»");
 123:              content = Regex.Replace(content, @"<ترجمة id=""(\d{1,3})\:(\d{1,3})"">", @"«");
 124:   
 125:              contentLiteral.Text = content;
 126:          }
 127:   
 128:          ////////////////////////////////////////////////////////////////////////////
 129:   
 130:          /// <summary>
 131:          ///
 132:          /// </summary>
 133:          public static void BuildBookPage(ref Literal authorDateLiteral, ref Literal contentLiteral, ref Image asideFigureImage, ref Literal asideFigureCaption)
 134:          {
 135:              string title, author, date, content, coverImage, stylesheetCss;
 136:   
 137:              Data.BookAttributesUsingLanguage("ar", out title, out author, out date, out content, out coverImage, out stylesheetCss);
 138:   
 139:              authorDateLiteral.Text = author + " (" + date + ")";
 140:   
 141:              content = content.Replace("paragraph", "p");
 142:              content = content.Replace("</p>", "</p>\r\n");
 143:   
 144:              content = content.Replace("header", "h2");
 145:              content = content.Replace("</h2>", "</h2>\r\n");
 146:   
 147:              content = Ia.Cl.Model.Language.SlightlyChangeSomeSentencesToPreventSystemFromGeneratingSingleCharacters(content);
 148:              content = Ia.Cl.Model.Language.RemoveSmallKoranicJawazAndSiliCharacters(content);
 149:   
 150:              content = content.Replace(@"</ءاية>", "</a>");
 151:              content = Regex.Replace(content, @"<ءاية id=""(\d{1,3})\:(\d{1,3})"">", @"<a href=""http://krn.org/ar/$1.aspx#$2"">");
 152:   
 153:              content = content.Replace(@"</ترجمة>", "»");
 154:              content = Regex.Replace(content, @"<ترجمة id=""(\d{1,3})\:(\d{1,3})"">", @"«");
 155:   
 156:              contentLiteral.Text = content;
 157:   
 158:              asideFigureImage.ImageUrl = coverImage;
 159:              asideFigureImage.AlternateText = title;
 160:              asideFigureImage.DescriptionUrl = title;
 161:   
 162:              asideFigureCaption.Text = title;
 163:          }
 164:   
 165:          ////////////////////////////////////////////////////////////////////////////
 166:          ////////////////////////////////////////////////////////////////////////////
 167:      }
 168:  }