Ejemplo n.º 1
0
        public string wmGetClips()
        {
            FunctionTemplates.HTMLTemplates ft = new FunctionTemplates.HTMLTemplates();
            acUI.acUI ui = new acUI.acUI();

            try
            {
                string sUserID = ui.GetSessionUserID();
                string sHTML = "";

                ClipboardSteps oCSteps = new ClipboardSteps(sUserID);
                if (oCSteps != null)
                {
                    foreach (ClipboardStep cs in oCSteps.Values)
                    {
                        string sStepID = cs.ID;
                        string sLabel = cs.Function.Label;
                        string sIcon = cs.Function.Icon;
                        string sDesc = ui.GetSnip(cs.Description, 75);
                        string sClipDT = cs.ClipDT;

                        sHTML += "<li" +
                            " id=\"clip_" + sStepID + "\"" +
                                " name=\"clip_" + sStepID + "\"" +
                                " class=\"command_item function clip\"" +
                                ">";

                        //a table for the label so the clear icon can right align
                        sHTML += "<table width=\"99%\" border=\"0\"><tr>";
                        sHTML += "<td width=\"1px\"><img alt=\"\" src=\"../images/" + sIcon + "\" /></td>";
                        sHTML += "<td style=\"vertical-align: middle; padding-left: 5px;\">" + sLabel + "</td>";
                        sHTML += "<td width=\"1px\" style=\"vertical-align: middle;\">";

                        //view icon
                        //due to the complexity of telling the core routines to look in the clipboard table, it
                        //it not possible to easily show the complex command types
                        // without a redesign of how this works.  NSC 4-19-2011
                        //due to several reasons, most notable being that the XML node for each of those commands
                        //that contains the step_id is hardcoded and the node names differ.
                        //and GetSingleStep requires a step_id which must be mined from the XML.
                        //so.... don't show a preview icon for them
                        string sFunction = cs.Function.Name;

                        if (!"loop,exists,if,while".Contains(sFunction))
                        {
                            sHTML += "<span id=\"btn_view_clip\" view_id=\"v_" + sStepID + "\">" +
                                "<img src=\"../images/icons/search.png\" style=\"width: 16px; height: 16px;\" alt=\"\" />" +
                                    "</span>";
                        }
                        sHTML += "</td></tr>";

                        sHTML += "<tr><td>&nbsp;</td><td><span class=\"code\">" + sClipDT + "</span></td>";
                        sHTML += "<td>";
                        //delete icon
                        sHTML += "<span id=\"btn_clear_clip\" remove_id=\"" + sStepID + "\">" +
                            "<img src=\"../images/icons/fileclose.png\" style=\"width: 16px; height: 16px;\" alt=\"\" />" +
                                "</span>";
                        sHTML += "</td></tr></table>";

                        sHTML += "<div class=\"hidden\" id=\"help_text_clip_" + sStepID + "\">" + sDesc + "</div>";

                        //we use this function because it draws a smaller version than DrawReadOnlyStep
                        string sStepHTML = "";
                        //and don't draw those complex ones either
                        if (!"loop,exists,if,while".Contains(sFunction))
                            sStepHTML = ft.DrawClipboardStep(cs, true);

                        sHTML += "<div class=\"hidden\" id=\"v_" + sStepID + "\">" + sStepHTML + "</div>";
                        sHTML += "</li>";
                    }
                }
                return sHTML;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }