/// <summary> /// The default editor for editing the build-in pre values in umbraco /// </summary> /// <param name="DataType">The DataType to be parsed</param> /// <param name="DisplayTextBox">Whether to use the default text box</param> public DefaultPrevalueEditor(cms.businesslogic.datatype.BaseDataType DataType, bool DisplayTextBox) { // state it knows its datatypedefinitionid _displayTextBox = DisplayTextBox; _datatype = DataType; setupChildControls(); }
public uploadFieldPreValue(cms.businesslogic.datatype.BaseDataType DataType) { // state it knows its datatypedefinitionid _datatype = DataType; setupChildControls(); }
protected void btnsubmit_Click(object sender, EventArgs e) { using (cms obj = new cms()) { obj._title = txttitle.Text.Trim(); obj._desc = txtdesc.Text.Trim(); if (ckbactive.Checked == true) { obj._active = true; } else { obj._active = false; } if (btnsubmit.Text == "Update") { obj._cid = Convert.ToInt64(Request.QueryString["id"].ToString()); obj.cms_update(); Response.Redirect("cmspagerepeater.aspx?flag=edit"); } else { obj.cms_insert(); Response.Redirect("cmspagerepeater.aspx?flag=add"); } } }
public mailerConfiguratorPreValueEditor(cms.businesslogic.datatype.BaseDataType DataType) : base(DataType) { // state it knows its datatypedefinitionid _datatype = DataType; setupChildControls(); }
public editor(cms.businesslogic.datatype.DefaultData Data) { _data = Data; if (HttpContext.Current.Request.Browser.Win32 && HttpContext.Current.Request.Browser.Browser == "IE") _browserIsCompatible = true; }
public void EmptyTrashcan(cms.businesslogic.RecycleBin.RecycleBinType type) { if (BasePage.ValidateUserContextID(BasePage.umbracoUserContextID)) { Application["trashcanEmptyLeft"] = RecycleBin.Count(type).ToString(); emptyTrashCanDo(type); } }
public ContentTypeControl(cms.businesslogic.ContentType ct, string id) { this.ID = id; this.OnSave +=new EventHandler(tmp_OnSave); this.OnPropertyTypeCreate += new EventHandler(this.tmp_OnSave); this.OnPropertyTypeDelete += new EventHandler(this.tmp_OnSave); docType = ct; this.Width = Unit.Pixel(600); this.Height = Unit.Pixel(600); string UmbracoPath = SystemDirectories.Umbraco; Panel1 = this.NewTabPage("Generelt"); uicontrols.MenuImageButton Save = Panel1.Menu.NewImageButton(); Save.Click += new System.Web.UI.ImageClickEventHandler(save_click); Save.ID = "Panel1Save"; Save.ImageUrl = UmbracoPath + "/images/editor/save.gif"; Panel2 = this.NewTabPage("Faneblade"); Save = Panel2.Menu.NewImageButton(); Save.ID = "Panel2Save"; Save.Click += new System.Web.UI.ImageClickEventHandler(save_click); Save.ImageUrl = UmbracoPath + "/images/editor/save.gif"; Panel3 = this.NewTabPage("Struktur"); Save = Panel3.Menu.NewImageButton(); Save.ID = "Panel3Save"; Save.Click += new System.Web.UI.ImageClickEventHandler(save_click); Save.ImageUrl = UmbracoPath + "/images/editor/save.gif"; Panel4 = this.NewTabPage("Generiske egenskaber"); Save = Panel4.Menu.NewImageButton(); Save.ID = "Panel4Save"; Save.Click += new System.Web.UI.ImageClickEventHandler(save_click); Save.ImageUrl = UmbracoPath + "/images/editor/save.gif"; Panel1.Attributes.Add("align","center"); Panel2.Attributes.Add("align","center"); Panel3.Attributes.Add("align","center"); Panel4.Attributes.Add("align","center"); br = new HtmlGenericControl(); br.TagName = "br"; Panel1.Controls.Add(br); br = new HtmlGenericControl(); br.TagName = "br"; Panel2.Controls.Add(br); br = new HtmlGenericControl(); br.TagName = "br"; Panel3.Controls.Add(br); br = new HtmlGenericControl(); br.TagName = "br"; Panel4.Controls.Add(br); }
private void FillRepeater() { using (cms obj = new cms()) { DataSet dsR = new DataSet(); if (txtserch.Text == "") { dsR = obj.cms_selectall(); } else { obj._serch = txtserch.Text.Trim(); dsR = obj.cms_Select_Searchdata(); } int cnt = dsR.Tables[0].Rows.Count; PagedDataSource page = new PagedDataSource(); page.DataSource = dsR.Tables[0].DefaultView; page.AllowPaging = true; page.PageSize = 5; page.CurrentPageIndex = Pgnm; vcnt = cnt / page.PageSize; if (Pgnm < 1) { linkprev.Visible = false; } else if (Pgnm > 0) { linkprev.Visible = true; } if (Pgnm == vcnt) { linknext.Visible = false; } if (Pgnm < vcnt) { linknext.Visible = true; } if (dsR.Tables[0].Rows.Count > 0) { rptrcms.DataSource = page; rptrcms.DataBind(); if (txtserch.Text != "") { lblMessage.Text = " Record Found :" + dsR.Tables[0].Rows.Count; messagegreen.Visible = true; } } else { rptrcms.Visible = false; } } }
public KeyValuePrevalueEditor(cms.businesslogic.datatype.BaseDataType DataType) { // state it knows its datatypedefinitionid _datatype = DataType; setupChildControls(); // Bootstrap delete. if (System.Web.HttpContext.Current.Request["delete"] != null) { DeletePrevalue(int.Parse(System.Web.HttpContext.Current.Request["delete"])); } }
private void emptyTrashCanDo(cms.businesslogic.RecycleBin.RecycleBinType type) { RecycleBin trashCan = new RecycleBin(type); var callback = new Action<int>(x => { Application.Lock(); Application["trashcanEmptyLeft"] = x.ToString(); Application.UnLock(); }); trashCan.CallTheGarbageMan(callback); }
public static void MakeNew(BusinessLogic.User User, cms.businesslogic.CMSNode Node, char PermissionKey) { IParameter[] parameters = new IParameter[] { SqlHelper.CreateParameter("@userId", User.Id), SqlHelper.CreateParameter("@nodeId", Node.Id), SqlHelper.CreateParameter("@permission", PermissionKey.ToString()) }; // Method is synchronized so exists remains consistent (avoiding race condition) bool exists = SqlHelper.ExecuteScalar<int>("SELECT COUNT(userId) FROM umbracoUser2nodePermission WHERE userId = @userId AND nodeId = @nodeId AND permission = @permission", parameters) > 0; if (!exists) { SqlHelper.ExecuteNonQuery("INSERT INTO umbracoUser2nodePermission (userId, nodeId, permission) VALUES (@userId, @nodeId, @permission)", parameters); // clear user cache to ensure permissions are re-loaded User.GetUser(User.Id).FlushFromCache(); } }
protected void rptrcms_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "EditData") { Response.Redirect("cmspage.aspx?id=" + e.CommandArgument.ToString()); } if (e.CommandName == "DeleteData") { using (cms obj = new cms()) { obj._cid = Convert.ToInt64(e.CommandArgument.ToString()); obj.cms_delete(); FillRepeater(); } } }
private void processKeys(cms.businesslogic.Dictionary.DictionaryItem[] items, int level) { string style = "style='padding-left: " + level * 10 + "px;'"; foreach (cms.businesslogic.Dictionary.DictionaryItem di in items) { lt_table.Text += "<tr><th " + style + "><a href='editDictionaryItem.aspx?id=" + di.id.ToString() + "'>" + di.key + "</a></th>"; foreach (cms.businesslogic.language.Language lang in languages) { lt_table.Text += "<td>"; if (string.IsNullOrEmpty(di.Value(lang.id))) lt_table.Text += "<img src='../images/false.png' />"; else lt_table.Text += "<img src='../images/true.png' />"; lt_table.Text += "</td>"; } lt_table.Text += "</tr>"; if (di.hasChildren) processKeys(di.Children, (level+1)); } }
private void Fillregdata() { using (cms obj = new cms()) { DataSet ds = new DataSet(); obj._cid = Convert.ToInt64(Request.QueryString["id"].ToString()); ds = obj.cms_selectbyid(); if (ds.Tables[0].Rows.Count > 0) { txttitle.Text = ds.Tables[0].Rows[0]["Title"].ToString(); txtdesc.Text = ds.Tables[0].Rows[0]["Description"].ToString(); Boolean b = Convert.ToBoolean(ds.Tables[0].Rows[0]["Active"].ToString()); if (b == true) { ckbactive.Checked = true; } else { ckbactive.Checked = false; } } btnsubmit.Text = "Update"; } }
/// <summary> /// Fires the content of the before refresh. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="umbraco.cms.businesslogic.RefreshContentEventArgs"/> instance containing the event data.</param> protected virtual void FireBeforeRefreshContent(cms.businesslogic.RefreshContentEventArgs e) { if (BeforeRefreshContent != null) { BeforeRefreshContent(null, e); } }
/// <summary> /// Takes a little (after publish the article is still with the old name (id)) /// but works well enough for me /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void Document_AfterSave(Document sender, cms.businesslogic.SaveEventArgs e) { var title = sender.getProperty("titulo"); if (title != null && !string.IsNullOrEmpty(title.Value.ToString())) sender.Text = title.Value.ToString(); }
public editor(cms.businesslogic.propertytype.PropertyType pt,ContentTypeControl parent) { this.pt = pt; ent = parent; }
private void DoPublishSubs(cms.businesslogic.web.Document d) { if (d.Published || PublishUnpublishedItems.Checked) { if (d.PublishWithResult(base.getUser())) { // Needed for supporting distributed calls if (UmbracoSettings.UseDistributedCalls) library.UpdateDocumentCache(d); else _documents.Add(d); _nodesPublished++; Application.Lock(); Application["publishDone" + _nodeId.ToString()] = _nodesPublished.ToString(); Application.UnLock(); foreach (var dc in d.Children) { DoPublishSubs(dc); } } else { LogHelper.Warn<publish>("Publishing failed due to event cancelling the publishing for document " + d.Id); } } }
public NodeTypeAddPropertyTypeControl(cms.businesslogic.ContentType dt, ContentTypeControl parent) { ctctrl = parent; this.Attributes.Add("width","100%"); HtmlTableRow tr = new HtmlTableRow(); HtmlTableCell td = new HtmlTableCell(); td.InnerText = "Alias"; tr.Cells.Add(td); td = new HtmlTableCell(); td.InnerText = "Navn"; tr.Cells.Add(td); td = new HtmlTableCell(); td.InnerText = "Type"; tr.Cells.Add(td); td = new HtmlTableCell(); td.InnerText = "Fane"; tr.Cells.Add(td); td = new HtmlTableCell(); tr.Cells.Add(td); this.Rows.Add(tr); tr = new HtmlTableRow(); td = new HtmlTableCell(); td.Controls.Add(AliasTxt); tr.Cells.Add(td); td = new HtmlTableCell(); td.Controls.Add(NameTxt); tr.Cells.Add(td); td = new HtmlTableCell(); td.Controls.Add(DataTypeDDL); tr.Cells.Add(td); td = new HtmlTableCell(); td.Controls.Add(TabDDL); tr.Cells.Add(td); td = new HtmlTableCell(); Button btn = new Button(); td.Controls.Add(btn); btn.Text = "Opret"; tr.Cells.Add(td); this.Rows.Add(tr); // Add create new PropertyType eventhandler btn.Click += new System.EventHandler(this.AddPropertyType); foreach (cms.businesslogic.ContentType.TabI t in dt.getVirtualTabs.ToList()) { ListItem li = new ListItem(); li.Value = t.Id.ToString(); li.Text = t.Caption; TabDDL.Items.Add(li); } ListItem lie = new ListItem(); lie.Text = "Egenskaber"; lie.Value = "0"; TabDDL.Items.Add(lie); foreach(cms.businesslogic.datatype.DataTypeDefinition DataType in cms.businesslogic.datatype.DataTypeDefinition.GetAll()) { ListItem li = new ListItem(); li.Value = DataType.Id.ToString(); li.Text = DataType.Text; DataTypeDDL.Items.Add(li); } _dt = dt; }
public templateCarrier createTemplateCarrier(cms.businesslogic.template.Template template) { var carrier = new templateCarrier { Id = template.Id, MastertemplateId = template.MasterTemplate, Alias = template.Alias, Name = template.Text, Design = template.Design, MasterPageFile = template.MasterPageFile }; return carrier; }
/// <summary> /// Fires the after document cache unpublish. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="umbraco.cms.businesslogic.DocumentCacheEventArgs"/> instance containing the event data.</param> protected virtual void FireAfterClearDocumentCache(Document sender, cms.businesslogic.DocumentCacheEventArgs e) { if (AfterClearDocumentCache != null) { AfterClearDocumentCache(sender, e); } }
//PPH moving multiple nodes and publishing them aswell. private void handleChildNodes(cms.businesslogic.web.Document document) { //store children array here because iterating over an Array object is very inneficient. var children = document.Children; foreach (Document child in children.Where(child => child.Published)) { child.Publish(new BusinessLogic.User(0)); //using library.publish to support load balancing. library.UpdateDocumentCache(child.Id); if (child.HasChildren) handleChildNodes(child); } }
//PPH moving multiple nodes and publishing them aswell. private void handleChildNodes(cms.businesslogic.web.Document d) { //store children array here because iterating over an Array object is very inneficient. var c = d.Children; foreach (cms.businesslogic.web.Document cd in c) { if (cd.Published) { cd.Publish(new umbraco.BusinessLogic.User(0)); //using library.publish to support load balancing. umbraco.library.UpdateDocumentCache(cd.Id); if (cd.HasChildren) { handleChildNodes(cd); } } } }
public DataInteger(cms.businesslogic.datatype.BaseDataType DataType) : base(DataType) {}
private void clearCachedTemplate(cms.businesslogic.template.Template cachedTemplate) { // Clear cache in rutime if (UmbracoSettings.UseDistributedCalls) umbraco.presentation.cache.dispatcher.Refresh( new Guid("dd12b6a0-14b9-46e8-8800-c154f74047c8"), cachedTemplate.Id); else umbraco.template.ClearCachedTemplate(cachedTemplate.Id); }
private static bool HasAccess(int DocumentId, string Path, cms.businesslogic.member.Member Member) { bool hasAccess = false; if (!IsProtected(DocumentId, Path)) hasAccess = true; else { XmlNode currentNode = getPage(getProtectedPage(Path)); if (Member != null) { IDictionaryEnumerator ide = Member.Groups.GetEnumerator(); while(ide.MoveNext()) { cms.businesslogic.member.MemberGroup mg = (cms.businesslogic.member.MemberGroup) ide.Value; if (currentNode.SelectSingleNode("./group [@id=" + mg.Id.ToString() + "]") != null) { hasAccess = true; break; } } } } return hasAccess; }
/// <summary> /// Fires the content of the after refresh. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="umbraco.cms.businesslogic.RefreshContentEventArgs"/> instance containing the event data.</param> protected virtual void FireAfterRefreshContent(cms.businesslogic.RefreshContentEventArgs e) { if (AfterRefreshContent != null) { AfterRefreshContent(null, e); } }
public templateCarrier createTemplateCarrier(cms.businesslogic.template.Template template) { templateCarrier carrier = new templateCarrier(); carrier.Id = template.Id; carrier.MastertemplateId = template.MasterTemplate; carrier.Alias = template.Alias; carrier.Name = template.Text; carrier.Design = template.Design; carrier.MasterPageFile = template.MasterPageFile; return carrier; }
/// <summary> /// Fires the before document cache. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="umbraco.cms.businesslogic.DocumentCacheEventArgs"/> instance containing the event data.</param> protected virtual void FireBeforeUpdateDocumentCache(Document sender, cms.businesslogic.DocumentCacheEventArgs e) { if (BeforeUpdateDocumentCache != null) { BeforeUpdateDocumentCache(sender, e); } }
public DefaultDataKeyValue(cms.businesslogic.datatype.BaseDataType DataType) : base(DataType) {}
private void doPublishSubs(cms.businesslogic.web.Document d) { if (d.Published || PublishUnpublishedItems.Checked) { if (d.PublishWithResult(base.getUser())) { // Needed for supporting distributed calls if (UmbracoSettings.UseDistributedCalls) library.UpdateDocumentCache(d.Id); else documents.Add(d); nodesPublished++; Application.Lock(); Application["publishDone" + nodeId.ToString()] = nodesPublished.ToString(); Application.UnLock(); foreach (cms.businesslogic.web.Document dc in d.Children) { doPublishSubs(dc); } } else { BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Error, d.Id, "Publishing failed due to event cancelling the publishing"); } } }
public tinyMCEPreValueConfigurator(cms.businesslogic.datatype.BaseDataType DataType) { // state it knows its datatypedefinitionid _datatype = DataType; setupChildControls(); }
private void DoPublishSubs(cms.businesslogic.web.Document d) { if (d.Published || PublishUnpublishedItems.Checked) { if (d.PublishWithResult(UmbracoUser)) { _nodesPublished++; Application.Lock(); Application["publishDone" + _nodeId.ToString()] = _nodesPublished.ToString(); Application.UnLock(); foreach (var dc in d.Children) { DoPublishSubs(dc); } } else { LogHelper.Warn<publish>("Publishing failed due to event cancelling the publishing for document " + d.Id); } } }