0

所以我已经能够在 Alfresco 中弄清楚,有一个名为的表单skin.css可以让我更改数据表项的突出显示颜色。但是,我只希望能够在工作流过程中更改此属性,而不是因为它适用于整个 Share 网站中的所有数据列表元素。

首先,我有一个脚本,它根据规则启动并将任何更新/新文件移动到指定文件夹中,然后启动该文件的工作流。在启动工作流时,包项目列表将填充与刚刚移动的文档/工作流启动的文档位于同一文件夹中的所有文档。下面是脚本:

function main()
{
    var counter=0;
    //Administrative Adjudication space/folder MUST exist under companyhome.
    var rootSpaceName = companyhome.childByNamePath("mainFolder");

    //If the rootspacename is null (not previously created), then exit the program as we have nothing to do.
    if(rootSpaceName == null)
    {
        logger.log("Company Home/mainFolder does not exist, so we have nothing to do.");
        return;
    }
    else
    {
        logger.log("Company Home/mainFolder exists, so carry on our process.");
        //Creates an array of all the children under the rootSpaceName
        var childList = rootSpaceName.children;
        //Creates a variable which counts the number of children in the childList array
        var count = childList.length;
        //var seconds = new Date().getTime() / 1000;

        //If there are no children in the rootSpaceName folder, exit the program.
        if(count == 0)
        {
            logger.log("Company Home/mainFolder does not have child, nothing to do.");
            return;
        }
        else
        {
            for(var i = 0; i < count; i++)
            {
                //Title MUST exist.
                var childTitle = childList[i].properties["hearing:childTitle"];
                //Author MUST exist.
                var childAuthor = childList[i].properties["hearing:childAuthor"];
                logger.log("childTitle: " + childTitle);
                logger.log("childAuthor: " + childAuthor);

                if(childTitle == null || childAuthor == null)
                {
                    logger.log(i + ". Both the childTitle and childAuthor are null...");
                    continue;                             
                }

                var child = childList[i];

                if(child.isContainer == false)
                {
                    for(var j = 0; j < count; j++)
                    {
                        var newChildName = childList[j].properties.name;
                        logger.log("New child name: " + newChildName);
                        var newChild = childList[j];

                        if((newChild.isContainer == true) && (childTitle == newChildName))
                        {
                            logger.log("There is a currently existing folder with the same name as the title of original child");
                            var newSpaceName = rootSpaceName.childByNamePath(newChildName);
                            var newChildList = newSpaceName.children;
                            var newCount = newChildList.length;

                            for(var k = 0; k < newCount; k++)
                            {
                                var newNewChildName = newChildList[k].properties.name;
                                var newNewchildAuthor = newChildList[k].properties.author;
                                var newNewChild = newChildList[k];

                                if((newNewChild.isContainer == true) && (newNewchildAuthor == childAuthor))
                                {
                                    var currentSpace = newSpaceName.childByNamePath(newNewChildName);                                  

                                    if(child.isDocument == true)
                                    {
                                        //Only want the workflow to run once so we increment count
                                        counter=counter+1;
                                        child.move(currentSpace);
                                        //If Count is 1, then run workflow
                                        if(counter==1)
                                        {                   
                                            //starts HelloWorldUI workflow                 
                                            var wfdef=workflow.getDefinitionByName("activiti$helloWorldUI");

                                            if(wfdef)
                                            {
                                                var wfparams=new Array();
                                                wfparams["bpm:workflowDescription"]="";
                                                wfparams["bpm:groupAssignee"]=people.getGroup("GROUP_Managers");

                                                var wfpackage=workflow.createPackage();
                                                var rootSpaceName=currentSpace;
                                                var childList=rootSpaceName.children;
                                                var count=childList.length;

                                                //add all existing documents in the space to the workflow
                                                for(var i = 0; i < count; i++)
                                                {
                                                    wfpackage.addNode(childList[i]);
                                                }

                                                var wfpath=wfdef.startWorkflow(wfpackage,wfparams);
                                                var tasks=wfpath.getTasks();

                                                for each(task in tasks)
                                                {
                                                    task.endTask(null);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }

                        else

                        {
                            // If title folder is already created, not need to create again.
                            var newSpaceName = companyhome.childByNamePath("mainFolder/" + childTitle);

                            if(newSpaceName == null)
                            {
                                newSpaceName = rootSpaceName.createFolder(childTitle);
                                logger.log("mainFolder/" + childTitle + " is created.");
                            }

                            // If author folder is already created, not need to create again.
                            var newNewSpaceName = companyhome.childByNamePath("mainFolder/" + childTitle + "/" + childAuthor);

                            if(newNewSpaceName == null)
                            {
                                newNewSpaceName = newSpaceName.createFolder(childAuthor);
                                logger.log("mainFolder/" + childTitle + "/" + childAuthor + " is created.");
                            }

                            if(child.isDocument == true)
                            {
                                counter=counter + 1;
                                child.move(newNewSpaceName);

                                if(counter == 1)
                                {
                                    var wfdef=workflow.getDefinitionByName("activiti$helloWorldUI");

                                    if(wfdef)
                                    {
                                        var wfparams=new Array();
                                        wfparams["bpm:workflowDescription"]="";
                                        wfparams["bpm:groupAssignee"]=people.getGroup("GROUP_Managers");
                                        var wfpackage=workflow.createPackage();
                                        var rootSpaceName=newNewSpaceName;
                                        var childList=rootSpaceName.children;
                                        var count=childList.length;

                                        //add all items from the space to the workflow
                                        for(var i = 0; i <c ount; i++)
                                        {
                                            wfpackage.addNode(childList[i]);
                                        }   

                                        var wfpath=wfdef.startWorkflow(wfpackage,wfparams);
                                        var tasks=wfpath.getTasks();

                                        for each(task in tasks)
                                        {
                                            task.endTask(null);
                                        }

                                    }
                                }
                                logger.log("Moving file " + child.properties.name);
                            }
                        }
                    }
                }
            }
        }
    }
    return;
}

main();

我希望能够创建某种类型的函数,该函数只能在工作流程过程中调用以访问 skin.css 文件,并且基本上.yui-skin-default tr.yui-dt-first{background-color:#FFF}在 CSS 文件中设置。有谁知道我会怎么做?

4

2 回答 2

1

我找到了一个书签,可以让你在任何你想要的页面上注入 CSS 文件。唯一的缺点是每次加载页面时都必须运行它。

http://allben.net/post/2010/01/30/CSS-JavaScript-Injection-Bookmarklets.aspx

于 2012-09-14T18:11:54.590 回答
1

如果您只想在启动工作流start-workflow.css页面中进行更改,您的css 应写入start-workflow.get.head.ftl. 这个 css 将覆盖在其他 css 文件中,如 skin.css。

像这样,您可以覆盖任何 css 以仅影响启动工作流页面而不影响其他页面。您可以尝试其他工作流相关页面。

于 2012-09-15T05:30:22.007 回答